diff options
author | Christian König <[email protected]> | 2013-03-04 15:35:30 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2013-03-07 10:03:22 +0100 |
commit | b8f4ca3d85b8a192b5c1940f9a4b558f1ce78d8f (patch) | |
tree | 019359507cfdd556f67524057d9142a8642f26bc /src/gallium/drivers/radeon | |
parent | de80e560bcdf365845cfdfbfd919e2f91cea2b26 (diff) |
radeon/llvm: replace shader type intrinsic with function attribute
Signed-off-by: Christian König <[email protected]>
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/radeon_llvm_emit.cpp | 22 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_llvm_emit.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp index 0491e64bb6f..ee82a902872 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp @@ -28,10 +28,12 @@ #if HAVE_LLVM < 0x0303 #include <llvm/LLVMContext.h> #include <llvm/Module.h> +#include <llvm/Function.h> #include <llvm/DataLayout.h> #else #include <llvm/IR/LLVMContext.h> #include <llvm/IR/Module.h> +#include <llvm/IR/Function.h> #include <llvm/IR/DataLayout.h> #endif @@ -69,6 +71,26 @@ static LLVMEnsureMultithreaded lLVMEnsureMultithreaded; } /** + * Set the shader type we want to compile + * + * @param type shader type to set + */ +extern "C" void +radeon_llvm_shader_type(LLVMValueRef F, unsigned type) +{ + Function *Func = unwrap<Function>(F); + int Idx = AttributeSet::FunctionIndex; + AttrBuilder B; + char Str[2]; + + sprintf(Str, "%1d", type); + B.addAttribute("ShaderType", Str); + + AttributeSet Set = AttributeSet::get(Func->getContext(), Idx, B); + Func->addAttributes(Idx, Set); +} + +/** * Compile an LLVM module to machine code. * * @param bytes This function allocates memory for the byte stream, it is the diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h index bdb242bfa0e..b68100f372f 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.h +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h @@ -33,6 +33,8 @@ extern "C" { #endif +void radeon_llvm_shader_type(LLVMValueRef F, unsigned type); + unsigned radeon_llvm_bitcode_compile( unsigned char * bitcode, unsigned bitcode_len, unsigned char ** bytes, unsigned * byte_count, |