ac: add new helper function to add a integer target dependent function attr.
authorDave Airlie <airlied@redhat.com>
Mon, 5 Jun 2017 00:20:10 +0000 (01:20 +0100)
committerDave Airlie <airlied@redhat.com>
Mon, 5 Jun 2017 00:37:29 +0000 (01:37 +0100)
This is needed to add the max workgroup size attribute.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_llvm_util.c
src/amd/common/ac_llvm_util.h

index e20456e2ff8f85e096ac7351f2d65b215cf06501..ee5fc89a2dfa92c9e96c52061873b56e3a215a5e 100644 (file)
@@ -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);
+}
index 38e7dde5b63216e1da5fe99200f490ed37c3565e..4ce59ec8701f4916d281e97ec1c924b91a5b926d 100644 (file)
@@ -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