2013-04-01 23:47:53 +02:00
|
|
|
#include "AMDGPUMachineFunction.h"
|
2013-04-26 20:32:24 +02:00
|
|
|
#include "AMDGPU.h"
|
2013-04-01 23:47:53 +02:00
|
|
|
#include "llvm/IR/Attributes.h"
|
|
|
|
#include "llvm/IR/Function.h"
|
2013-07-17 02:31:35 +02:00
|
|
|
using namespace llvm;
|
2013-04-01 23:47:53 +02:00
|
|
|
|
2013-07-17 02:31:35 +02:00
|
|
|
static const char *const ShaderTypeAttribute = "ShaderType";
|
2013-04-01 23:47:53 +02:00
|
|
|
|
|
|
|
AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
|
|
|
|
MachineFunctionInfo() {
|
2013-04-26 20:32:24 +02:00
|
|
|
ShaderType = ShaderType::COMPUTE;
|
2013-06-28 17:47:08 +02:00
|
|
|
LDSSize = 0;
|
2013-04-01 23:47:53 +02: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!");
|
|
|
|
}
|
|
|
|
}
|