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" |
| 5 | |
| 6 | namespace llvm { |
| 7 | |
| 8 | const char *AMDGPUMachineFunction::ShaderTypeAttribute = "ShaderType"; |
| 9 | |
| 10 | AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) : |
| 11 | MachineFunctionInfo() { |
Tom Stellard | 456adc6 | 2013-04-26 18:32:24 +0000 | [diff] [blame] | 12 | ShaderType = ShaderType::COMPUTE; |
Tom Stellard | c026e8b | 2013-06-28 15:47:08 +0000 | [diff] [blame^] | 13 | LDSSize = 0; |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 14 | AttributeSet Set = MF.getFunction()->getAttributes(); |
| 15 | Attribute A = Set.getAttribute(AttributeSet::FunctionIndex, |
| 16 | ShaderTypeAttribute); |
| 17 | |
| 18 | if (A.isStringAttribute()) { |
| 19 | StringRef Str = A.getValueAsString(); |
| 20 | if (Str.getAsInteger(0, ShaderType)) |
| 21 | llvm_unreachable("Can't parse shader type!"); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | } |