blob: 9a1e3447e7e5d3a11c6d96822424364c1a277f86 [file] [log] [blame]
Vincent Lejeuneace6f732013-04-01 21:47:53 +00001#include "AMDGPUMachineFunction.h"
Tom Stellard456adc62013-04-26 18:32:24 +00002#include "AMDGPU.h"
Vincent Lejeuneace6f732013-04-01 21:47:53 +00003#include "llvm/IR/Attributes.h"
4#include "llvm/IR/Function.h"
5
6namespace llvm {
7
8const char *AMDGPUMachineFunction::ShaderTypeAttribute = "ShaderType";
9
10AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
11 MachineFunctionInfo() {
Tom Stellard456adc62013-04-26 18:32:24 +000012 ShaderType = ShaderType::COMPUTE;
Tom Stellardc026e8b2013-06-28 15:47:08 +000013 LDSSize = 0;
Vincent Lejeuneace6f732013-04-01 21:47:53 +000014 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}