diff options
author | Nicolai Hähnle <[email protected]> | 2016-10-28 14:40:24 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-11-03 10:06:27 +0100 |
commit | 908100cfae88a9e83560919018fc8a8a3a7bf745 (patch) | |
tree | 9f211eca0ee99e201e532518eaef89a295e42081 /src/amd/common/ac_llvm_helper.cpp | |
parent | 2ff5df8f5097d25899996ea344d09be5c76de323 (diff) |
amd/common: add ac_is_sgpr_param helper
Reviewed-by: Dave Airlie <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common/ac_llvm_helper.cpp')
-rw-r--r-- | src/amd/common/ac_llvm_helper.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp index 125f5f3d7a9..594339ee8c8 100644 --- a/src/amd/common/ac_llvm_helper.cpp +++ b/src/amd/common/ac_llvm_helper.cpp @@ -35,6 +35,7 @@ #include <llvm-c/Core.h> #include <llvm/Target/TargetOptions.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> +#include <llvm/IR/Attributes.h> void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes) { @@ -43,3 +44,12 @@ void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes) B.addDereferenceableAttr(bytes); A->addAttr(llvm::AttributeSet::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(); + unsigned ArgNo = A->getArgNo(); + return AS.hasAttribute(ArgNo + 1, llvm::Attribute::ByVal) || + AS.hasAttribute(ArgNo + 1, llvm::Attribute::InReg); +} |