Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 1 | #include "AMDGPUMachineFunction.h" |
Tom Stellard | 456adc6 | 2013-04-26 18:32:24 +0000 | [diff] [blame] | 2 | #include "AMDGPU.h" |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 3 | #include "llvm/IR/Attributes.h" |
| 4 | #include "llvm/IR/Function.h" |
Craig Topper | 8fc4096 | 2013-07-17 00:31:35 +0000 | [diff] [blame^] | 5 | using namespace llvm; |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 6 | |
Craig Topper | 8fc4096 | 2013-07-17 00:31:35 +0000 | [diff] [blame^] | 7 | static const char *const ShaderTypeAttribute = "ShaderType"; |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 8 | |
| 9 | AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) : |
| 10 | MachineFunctionInfo() { |
Tom Stellard | 456adc6 | 2013-04-26 18:32:24 +0000 | [diff] [blame] | 11 | ShaderType = ShaderType::COMPUTE; |
Tom Stellard | c026e8b | 2013-06-28 15:47:08 +0000 | [diff] [blame] | 12 | LDSSize = 0; |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 13 | AttributeSet Set = MF.getFunction()->getAttributes(); |
| 14 | Attribute A = Set.getAttribute(AttributeSet::FunctionIndex, |
| 15 | ShaderTypeAttribute); |
| 16 | |
| 17 | if (A.isStringAttribute()) { |
| 18 | StringRef Str = A.getValueAsString(); |
| 19 | if (Str.getAsInteger(0, ShaderType)) |
| 20 | llvm_unreachable("Can't parse shader type!"); |
| 21 | } |
| 22 | } |