1*45bb48eaSTom Stellard #include "AMDGPUMachineFunction.h" 2*45bb48eaSTom Stellard #include "AMDGPU.h" 3*45bb48eaSTom Stellard #include "llvm/IR/Attributes.h" 4*45bb48eaSTom Stellard #include "llvm/IR/Function.h" 5*45bb48eaSTom Stellard using namespace llvm; 6*45bb48eaSTom Stellard 7*45bb48eaSTom Stellard static const char *const ShaderTypeAttribute = "ShaderType"; 8*45bb48eaSTom Stellard 9*45bb48eaSTom Stellard // Pin the vtable to this file. 10*45bb48eaSTom Stellard void AMDGPUMachineFunction::anchor() {} 11*45bb48eaSTom Stellard 12*45bb48eaSTom Stellard AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) : 13*45bb48eaSTom Stellard MachineFunctionInfo(), 14*45bb48eaSTom Stellard ShaderType(ShaderType::COMPUTE), 15*45bb48eaSTom Stellard LDSSize(0), 16*45bb48eaSTom Stellard ScratchSize(0), 17*45bb48eaSTom Stellard IsKernel(true) { 18*45bb48eaSTom Stellard Attribute A = MF.getFunction()->getFnAttribute(ShaderTypeAttribute); 19*45bb48eaSTom Stellard 20*45bb48eaSTom Stellard if (A.isStringAttribute()) { 21*45bb48eaSTom Stellard StringRef Str = A.getValueAsString(); 22*45bb48eaSTom Stellard if (Str.getAsInteger(0, ShaderType)) 23*45bb48eaSTom Stellard llvm_unreachable("Can't parse shader type!"); 24*45bb48eaSTom Stellard } 25*45bb48eaSTom Stellard } 26