LLVM API Documentation

AMDGPUMachineFunction.cpp
Go to the documentation of this file.
00001 #include "AMDGPUMachineFunction.h"
00002 #include "AMDGPU.h"
00003 #include "llvm/IR/Attributes.h"
00004 #include "llvm/IR/Function.h"
00005 using namespace llvm;
00006 
00007 static const char *const ShaderTypeAttribute = "ShaderType";
00008 
00009 // Pin the vtable to this file.
00010 void AMDGPUMachineFunction::anchor() {}
00011 
00012 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
00013   MachineFunctionInfo(),
00014   ShaderType(ShaderType::COMPUTE),
00015   LDSSize(0),
00016   ScratchSize(0),
00017   IsKernel(true) {
00018   AttributeSet Set = MF.getFunction()->getAttributes();
00019   Attribute A = Set.getAttribute(AttributeSet::FunctionIndex,
00020                                  ShaderTypeAttribute);
00021 
00022   if (A.isStringAttribute()) {
00023     StringRef Str = A.getValueAsString();
00024     if (Str.getAsInteger(0, ShaderType))
00025       llvm_unreachable("Can't parse shader type!");
00026   }
00027 }