Mesa (master): ac: add new helper function to add a integer target dependent function attr.

Dave Airlie airlied at kemper.freedesktop.org
Mon Jun 5 00:38:01 UTC 2017


Module: Mesa
Branch: master
Commit: 68c812f6993504ae5b5fe5ea47b86132c98c8fa1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=68c812f6993504ae5b5fe5ea47b86132c98c8fa1

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Jun  5 01:20:10 2017 +0100

ac: add new helper function to add a integer target dependent function attr.

This is needed to add the max workgroup size attribute.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/amd/common/ac_llvm_util.c | 10 ++++++++++
 src/amd/common/ac_llvm_util.h |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
index e20456e2ff..ee5fc89a2d 100644
--- a/src/amd/common/ac_llvm_util.c
+++ b/src/amd/common/ac_llvm_util.c
@@ -217,3 +217,13 @@ ac_dump_module(LLVMModuleRef module)
 	fprintf(stderr, "%s", str);
 	LLVMDisposeMessage(str);
 }
+
+void
+ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
+				     const char *name, int value)
+{
+	char str[16];
+
+	snprintf(str, sizeof(str), "%i", value);
+	LLVMAddTargetDependentFunctionAttr(F, name, str);
+}
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index 38e7dde5b6..4ce59ec870 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -66,6 +66,11 @@ void ac_dump_module(LLVMModuleRef module);
 
 LLVMValueRef ac_llvm_get_called_value(LLVMValueRef call);
 bool ac_llvm_is_function(LLVMValueRef v);
+
+void
+ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
+				     const char *name, int value);
+
 #ifdef __cplusplus
 }
 #endif




More information about the mesa-commit mailing list