AMDGPUMachineFunction.cpp revision e3d4cbc7d25061441adafa47450a31571c87bf85
1#include "AMDGPUMachineFunction.h" 2#include "AMDGPU.h" 3#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() { 12 ShaderType = ShaderType::COMPUTE; 13 LDSSize = 0; 14 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} 26