20 #ifndef LLVM_IR_GLOBALVARIABLE_H 21 #define LLVM_IR_GLOBALVARIABLE_H 38 template <
typename ValueSubClass>
class SymbolTableListTraits;
39 class DIGlobalVariable;
40 class DIGlobalVariableExpression;
46 bool isConstantGlobal : 1;
47 bool isExternallyInitializedConstant : 1;
74 void *
operator new(
size_t s) {
75 return User::operator
new(s, 1);
79 void operator delete(
void *ptr){
80 assert(ptr !=
nullptr &&
"must not be nullptr");
81 User *Obj =
static_cast<User *
>(ptr);
85 User::operator
delete(Obj);
139 return static_cast<Constant*
>(Op<0>().
get());
143 return static_cast<Constant*
>(Op<0>().
get());
158 return isExternallyInitializedConstant;
161 isExternallyInitializedConstant = Val;
190 Attrs = Attrs.addAttribute(
getContext(), Kind);
195 Attrs = Attrs.addAttribute(
getContext(), Kind, Val);
200 return Attrs.hasAttribute(Kind);
205 return Attrs.hasAttribute(Kind);
210 return Attrs.hasAttributes();
215 return Attrs.getAttribute(Kind);
220 return Attrs.getAttribute(Kind);
234 std::pair<unsigned, AttributeSet> AS[1] = {{index, Attrs}};
252 return V->
getValueID() == Value::GlobalVariableVal;
265 #endif // LLVM_IR_GLOBALVARIABLE_H AttributeSet getAttributes() const
Return the attribute set for this global.
bool hasDefinitiveInitializer() const
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...
unsigned getValueID() const
Return an ID for the concrete type of this object.
static bool classof(const Value *V)
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
bool hasAttributes() const
Return true if any attributes exist.
void addAttribute(Attribute::AttrKind Kind)
Add attribute to this global.
LLVMContext & getContext() const
All values hold a context through their type.
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
GlobalVariable & operator=(const GlobalVariable &)=delete
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This file contains the simple types necessary to represent the attributes associated with functions a...
void addAttribute(StringRef Kind, StringRef Val=StringRef())
Add attribute to this global.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
bool hasImplicitSection() const
Check if section name is present.
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
GlobalVariable(Type *Ty, bool isConstant, LinkageTypes Linkage, Constant *Initializer=nullptr, const Twine &Name="", ThreadLocalMode=NotThreadLocal, unsigned AddressSpace=0, bool isExternallyInitialized=false)
GlobalVariable ctor - If a parent module is specified, the global is automatically inserted into the ...
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
AttributeList getAttributesAsList(unsigned index) const
Return attribute set as list with index.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important base class in LLVM.
void setExternallyInitialized(bool Val)
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression *> &GVs) const
Fill the vector with all debug info attachements.
bool hasUniqueInitializer() const
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
A pair of DIGlobalVariable and DIExpression.
OptionalOperandTraits - when the number of operands may change at runtime.
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists.
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
void setConstant(bool Val)
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide fast operand accessors.
LinkageTypes
An enumeration for the kinds of linkage for global values.
void setAttributes(AttributeSet A)
Set attribute list for this global.
void dropAllReferences()
Drop all references in preparation to destroy the GlobalVariable.
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
void copyAttributesFrom(const GlobalVariable *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Compile-time customization of User operands.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
bool hasInitializer() const
Definitions have initializers, declarations don't.
Attribute getAttribute(StringRef Kind) const
Return the attribute object.
void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
StringRef - Represent a constant reference to a string, i.e.
Constant * getInitializer()
bool isExternallyInitialized() const
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
bool hasAttribute(StringRef Kind) const
Return true if the attribute exists.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...