Revert r194865 and r194874.
[oota-llvm.git] / lib / Target / R600 / AMDGPUMachineFunction.cpp
1 #include "AMDGPUMachineFunction.h"
2 #include "AMDGPU.h"
3 #include "llvm/IR/Attributes.h"
4 #include "llvm/IR/Function.h"
5 using namespace llvm;
6
7 static const char *const ShaderTypeAttribute = "ShaderType";
8
9 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
10     MachineFunctionInfo() {
11   ShaderType = ShaderType::COMPUTE;
12   LDSSize = 0;
13   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 }