LLVM  3.7.0
AMDGPUMachineFunction.cpp
Go to the documentation of this file.
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 // Pin the vtable to this file.
10 void AMDGPUMachineFunction::anchor() {}
11 
14  ShaderType(ShaderType::COMPUTE),
15  LDSSize(0),
16  ScratchSize(0),
17  IsKernel(true) {
19 
20  if (A.isStringAttribute()) {
21  StringRef Str = A.getValueAsString();
22  if (Str.getAsInteger(0, ShaderType))
23  llvm_unreachable("Can't parse shader type!");
24  }
25 }
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Definition: StringRef.h:347
AMDGPUMachineFunction(const MachineFunction &MF)
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Definition: Function.h:225
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:98
This file contains the simple types necessary to represent the attributes associated with functions a...
#define true
Definition: ConvertUTF.c:66
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
Definition: Attributes.cpp:115
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:140
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
static const char *const ShaderTypeAttribute