blob: f2342b0e8854ba11ea8cbc300b594047c47b7c6e [file] [log] [blame]
Vincent Lejeuneace6f732013-04-01 21:47:53 +00001#include "AMDGPUMachineFunction.h"
Tom Stellard456adc62013-04-26 18:32:24 +00002#include "AMDGPU.h"
Vincent Lejeuneace6f732013-04-01 21:47:53 +00003#include "llvm/IR/Attributes.h"
4#include "llvm/IR/Function.h"
Craig Topper8fc40962013-07-17 00:31:35 +00005using namespace llvm;
Vincent Lejeuneace6f732013-04-01 21:47:53 +00006
Craig Topper8fc40962013-07-17 00:31:35 +00007static const char *const ShaderTypeAttribute = "ShaderType";
Vincent Lejeuneace6f732013-04-01 21:47:53 +00008
9AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
10 MachineFunctionInfo() {
Tom Stellard456adc62013-04-26 18:32:24 +000011 ShaderType = ShaderType::COMPUTE;
Tom Stellardc026e8b2013-06-28 15:47:08 +000012 LDSSize = 0;
Vincent Lejeuneace6f732013-04-01 21:47:53 +000013 AttributeSet Set = MF.getFunction()->getAttributes();
14 Attribute A = Set.getAttribute(AttributeSet::FunctionIndex,
15 ShaderTypeAttribute);
16
17 if (A.isStringAttribute()) {
18 StringRef Str = A.getValueAsString();
19 if (Str.getAsInteger(0, ShaderType))
20 llvm_unreachable("Can't parse shader type!");
21 }
22}