1 #include "AMDGPUMachineFunction.h"
3 #include "llvm/IR/Attributes.h"
4 #include "llvm/IR/Function.h"
7 static const char *const ShaderTypeAttribute = "ShaderType";
9 // Pin the vtable to this file.
10 void AMDGPUMachineFunction::anchor() {}
12 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
13 MachineFunctionInfo(),
14 ShaderType(ShaderType::COMPUTE),
18 Attribute A = MF.getFunction()->getFnAttribute(ShaderTypeAttribute);
20 if (A.isStringAttribute()) {
21 StringRef Str = A.getValueAsString();
22 if (Str.getAsInteger(0, ShaderType))
23 llvm_unreachable("Can't parse shader type!");