2013-04-01 21:47:53 +00:00
|
|
|
#include "AMDGPUMachineFunction.h"
|
2013-04-26 18:32:24 +00:00
|
|
|
#include "AMDGPU.h"
|
2013-04-01 21:47:53 +00:00
|
|
|
#include "llvm/IR/Attributes.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
2013-07-17 00:31:35 +00:00
|
|
|
using namespace llvm;
|
2013-04-01 21:47:53 +00:00
|
|
|
|
2013-07-17 00:31:35 +00:00
|
|
|
static const char *const ShaderTypeAttribute = "ShaderType";
|
2013-04-01 21:47:53 +00:00
|
|
|
|
2013-11-19 00:57:56 +00:00
|
|
|
// Pin the vtable to this file.
|
|
|
|
void AMDGPUMachineFunction::anchor() {}
|
|
|
|
|
2013-04-01 21:47:53 +00:00
|
|
|
AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
|
2014-07-13 03:06:39 +00:00
|
|
|
MachineFunctionInfo(),
|
|
|
|
ShaderType(ShaderType::COMPUTE),
|
2014-09-15 15:41:53 +00:00
|
|
|
LDSSize(0),
|
|
|
|
ScratchSize(0),
|
|
|
|
IsKernel(true) {
|
2013-04-01 21:47:53 +00:00
|
|
|
AttributeSet Set = MF.getFunction()->getAttributes();
|
|
|
|
Attribute A = Set.getAttribute(AttributeSet::FunctionIndex,
|
|
|
|
ShaderTypeAttribute);
|
|
|
|
|
|
|
|
if (A.isStringAttribute()) {
|
|
|
|
StringRef Str = A.getValueAsString();
|
|
|
|
if (Str.getAsInteger(0, ShaderType))
|
|
|
|
llvm_unreachable("Can't parse shader type!");
|
|
|
|
}
|
|
|
|
}
|