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