R600: Add local memory support via LDS
[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
6 namespace llvm {
7
8 const char *AMDGPUMachineFunction::ShaderTypeAttribute = "ShaderType";
9
10 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
11     MachineFunctionInfo() {
12   ShaderType = ShaderType::COMPUTE;
13   LDSSize = 0;
14   AttributeSet Set = MF.getFunction()->getAttributes();
15   Attribute A = Set.getAttribute(AttributeSet::FunctionIndex,
16                                  ShaderTypeAttribute);
17
18   if (A.isStringAttribute()) {
19     StringRef Str = A.getValueAsString();
20     if (Str.getAsInteger(0, ShaderType))
21       llvm_unreachable("Can't parse shader type!");
22   }
23 }
24
25 }