145bb48eaSTom Stellard #include "AMDGPUMachineFunction.h"
245bb48eaSTom Stellard #include "AMDGPU.h"
345bb48eaSTom Stellard #include "llvm/IR/Attributes.h"
445bb48eaSTom Stellard #include "llvm/IR/Function.h"
545bb48eaSTom Stellard using namespace llvm;
645bb48eaSTom Stellard 
745bb48eaSTom Stellard static const char *const ShaderTypeAttribute = "ShaderType";
845bb48eaSTom Stellard 
945bb48eaSTom Stellard // Pin the vtable to this file.
1045bb48eaSTom Stellard void AMDGPUMachineFunction::anchor() {}
1145bb48eaSTom Stellard 
1245bb48eaSTom Stellard AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
1345bb48eaSTom Stellard   MachineFunctionInfo(),
1445bb48eaSTom Stellard   ShaderType(ShaderType::COMPUTE),
1545bb48eaSTom Stellard   LDSSize(0),
16*e928533dSTom Stellard   ABIArgOffset(0),
1745bb48eaSTom Stellard   ScratchSize(0),
1845bb48eaSTom Stellard   IsKernel(true) {
1945bb48eaSTom Stellard   Attribute A = MF.getFunction()->getFnAttribute(ShaderTypeAttribute);
2045bb48eaSTom Stellard 
2145bb48eaSTom Stellard   if (A.isStringAttribute()) {
2245bb48eaSTom Stellard     StringRef Str = A.getValueAsString();
2345bb48eaSTom Stellard     if (Str.getAsInteger(0, ShaderType))
2445bb48eaSTom Stellard       llvm_unreachable("Can't parse shader type!");
2545bb48eaSTom Stellard   }
2645bb48eaSTom Stellard }
27