mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
R600/SI: Share code recording ShaderTypeAttribute between generations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178504 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
22
lib/Target/R600/AMDGPUMachineFunction.cpp
Normal file
22
lib/Target/R600/AMDGPUMachineFunction.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "AMDGPUMachineFunction.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
const char *AMDGPUMachineFunction::ShaderTypeAttribute = "ShaderType";
|
||||
|
||||
AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
|
||||
MachineFunctionInfo() {
|
||||
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!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user