diff options
author | Vincent Lejeune <vljn@ovi.com> | 2013-04-01 21:47:53 +0000 |
---|---|---|
committer | Vincent Lejeune <vljn@ovi.com> | 2013-04-01 21:47:53 +0000 |
commit | 88524e3f6c314e231678a51479c305e9f3df3fa9 (patch) | |
tree | 56963a8182baf8294a81920370042d5b69f79e1f /lib/Target/R600/AMDGPUMachineFunction.cpp | |
parent | 8e59191eb8033133f5b2923d2056d4362af913ce (diff) |
R600/SI: Share code recording ShaderTypeAttribute between generations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/R600/AMDGPUMachineFunction.cpp')
-rw-r--r-- | lib/Target/R600/AMDGPUMachineFunction.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Target/R600/AMDGPUMachineFunction.cpp b/lib/Target/R600/AMDGPUMachineFunction.cpp new file mode 100644 index 0000000000..0223ec8e4f --- /dev/null +++ b/lib/Target/R600/AMDGPUMachineFunction.cpp @@ -0,0 +1,22 @@ +#include "AMDGPUMachineFunction.h" +#include "llvm/IR/Attributes.h" +#include "llvm/IR/Function.h" + +namespace llvm { + +const char *AMDGPUMachineFunction::ShaderTypeAttribute = "ShaderType"; + +AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) : + MachineFunctionInfo() { + AttributeSet Set = MF.getFunction()->getAttributes(); + Attribute A = Set.getAttribute(AttributeSet::FunctionIndex, + ShaderTypeAttribute); + + if (A.isStringAttribute()) { + StringRef Str = A.getValueAsString(); + if (Str.getAsInteger(0, ShaderType)) + llvm_unreachable("Can't parse shader type!"); + } +} + +} |