]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/llvm/lib/Target/R600/AMDGPUMachineFunction.cpp
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / llvm / 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   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 }
23
24 }