[Mesa-dev] [PATCH] ac, gallium: fix building with LLVM >= r298393

Vedran Miletić vedran at miletic.net
Wed Mar 22 15:01:43 UTC 2017


AttributeSet got renamed to AttributeList.

Signed-off-by: Vedran Miletić <vedran at miletic.net>
---
 src/amd/common/ac_llvm_helper.cpp             | 10 ++++++++--
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp |  8 +++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
index 4f03103..01a981b 100644
--- a/src/amd/common/ac_llvm_helper.cpp
+++ b/src/amd/common/ac_llvm_helper.cpp
@@ -35,18 +35,24 @@
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/IR/Attributes.h>
 
+#if HAVE_LLVM >= 0x0500
+   typedef llvm::AttributeList llvm_attribute_list;
+#else
+   typedef llvm::AttributeSet llvm_attribute_list;
+#endif
+
 void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
 {
    llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
    llvm::AttrBuilder B;
    B.addDereferenceableAttr(bytes);
-   A->addAttr(llvm::AttributeSet::get(A->getContext(), A->getArgNo() + 1,  B));
+   A->addAttr(llvm_attribute_list::get(A->getContext(), A->getArgNo() + 1,  B));
 }
 
 bool ac_is_sgpr_param(LLVMValueRef arg)
 {
 	llvm::Argument *A = llvm::unwrap<llvm::Argument>(arg);
-	llvm::AttributeSet AS = A->getParent()->getAttributes();
+	llvm_attribute_list AS = A->getParent()->getAttributes();
 	unsigned ArgNo = A->getArgNo();
 	return AS.hasAttribute(ArgNo + 1, llvm::Attribute::ByVal) ||
 	       AS.hasAttribute(ArgNo + 1, llvm::Attribute::InReg);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 444686f..e2ea6e8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -86,6 +86,12 @@
 #  pragma pop_macro("DEBUG")
 #endif
 
+#if HAVE_LLVM >= 0x0500
+   typedef llvm::AttributeList llvm_attribute_list;
+#else
+   typedef llvm::AttributeSet llvm_attribute_list;
+#endif
+
 #include "c11/threads.h"
 #include "os/os_thread.h"
 #include "pipe/p_config.h"
@@ -754,7 +760,7 @@ lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
    llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
    llvm::AttrBuilder B;
    B.addDereferenceableAttr(bytes);
-   A->addAttr(llvm::AttributeSet::get(A->getContext(), A->getArgNo() + 1,  B));
+   A->addAttr(llvm_attribute_list::get(A->getContext(), A->getArgNo() + 1,  B));
 #endif
 }
 
-- 
2.9.3



More information about the mesa-dev mailing list