[Mesa-stable] [PATCH] swr/rast: support llvm 3.9 type declarations

Kyriazis, George george.kyriazis at intel.com
Wed Jan 24 18:34:56 UTC 2018


On Jan 24, 2018, at 11:43 AM, Emil Velikov <emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>> wrote:

On 24 January 2018 at 15:30, George Kyriazis <george.kyriazis at intel.com<mailto:george.kyriazis at intel.com>> wrote:
LLVM 3.9 was not taken into in initial check-in.

Fixes: 01ab218bbc ("swr/rast: Initial work for debugging support.")
cc: mesa-stable at lists.freedesktop.org<mailto:mesa-stable at lists.freedesktop.org>
---
src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 93e3240..1e954f6 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -249,9 +249,15 @@ DIType* JitManager::GetDebugType(Type* pTy)
    switch (id)
    {
    case Type::VoidTyID: return builder.createUnspecifiedType("void"); break;
+#if LLVM_VERSION_MAJOR >= 4
    case Type::HalfTyID: return builder.createBasicType("float16", 16, dwarf::DW_ATE_float); break;
    case Type::FloatTyID: return builder.createBasicType("float", 32, dwarf::DW_ATE_float); break;
    case Type::DoubleTyID: return builder.createBasicType("double", 64, dwarf::DW_ATE_float); break;
+#else
+    case Type::HalfTyID: return builder.createBasicType("float16", 16, 16, dwarf::DW_ATE_float); break;
+    case Type::FloatTyID: return builder.createBasicType("float", 32, 32, dwarf::DW_ATE_float); break;
+    case Type::DoubleTyID: return builder.createBasicType("double", 64, 64, dwarf::DW_ATE_float); break;
+#endif
    case Type::IntegerTyID: return GetDebugIntegerType(pTy); break;
    case Type::StructTyID: return GetDebugStructType(pTy); break;
    case Type::ArrayTyID: return GetDebugArrayType(pTy); break;
@@ -288,11 +294,19 @@ DIType* JitManager::GetDebugIntegerType(Type* pTy)
    IntegerType* pIntTy = cast<IntegerType>(pTy);
    switch (pIntTy->getBitWidth())
    {
+#if LLVM_VERSION_MAJOR >= 4
    case 1: return builder.createBasicType("int1", 1, dwarf::DW_ATE_unsigned); break;
    case 8: return builder.createBasicType("int8", 8, dwarf::DW_ATE_signed); break;
    case 16: return builder.createBasicType("int16", 16, dwarf::DW_ATE_signed); break;
    case 32: return builder.createBasicType("int", 32, dwarf::DW_ATE_signed); break;
    case 64: return builder.createBasicType("int64", 64, dwarf::DW_ATE_signed); break;
+#else
+    case 1: return builder.createBasicType("int1", 1, 8, dwarf::DW_ATE_unsigned); break;
+    case 8: return builder.createBasicType("int8", 8, 8, dwarf::DW_ATE_signed); break;
+    case 16: return builder.createBasicType("int16", 16, 16, dwarf::DW_ATE_signed); break;
+    case 32: return builder.createBasicType("int", 32, 32, dwarf::DW_ATE_signed); break;
+    case 64: return builder.createBasicType("int64", 64, 64, dwarf::DW_ATE_signed); break;
+#endif

Please mention in the commit message why we're not using zero for
AlignInBits as in the LLVM patch [1]. With that:

You are right, alignment could be 0.  I can do a v2 with alignment set to 0.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104749
Acked-by: Emil Velikov <emil.velikov at collabora.com<mailto:emil.velikov at collabora.com>>

Thanks
Emil

[1] https://github.com/llvm-mirror/llvm/commit/e69c459a6e9756ca1ff3acb1dcfc434843aee80f#diff-71a247a97ac2b40bf8d9d8d64460f6f9

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20180124/97fd6d7d/attachment-0001.html>


More information about the mesa-stable mailing list