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;
77 void *
operator new(
size_t s) {
78 return User::operator
new(s, 1);
132 return static_cast<Constant*
>(Op<0>().
get());
136 return static_cast<Constant*
>(Op<0>().
get());
151 return isExternallyInitializedConstant;
154 isExternallyInitializedConstant = Val;
193 return Attrs.hasAttribute(Kind);
198 return Attrs.hasAttribute(Kind);
203 return Attrs.hasAttributes();
208 return Attrs.getAttribute(Kind);
213 return Attrs.getAttribute(Kind);
227 std::pair<unsigned, AttributeSet> AS[1] = {{index,
Attrs}};
245 return V->
getValueID() == Value::GlobalVariableVal;
258 #endif // LLVM_IR_GLOBALVARIABLE_H
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
static bool classof(const Value *V)
A Module instance is used to store all the information related to an LLVM module. ...
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression * > &GVs) const
Fill the vector with all debug info attachements.
void addAttribute(Attribute::AttrKind Kind)
Add attribute to this global.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
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
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...
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
bool hasUniqueInitializer() const
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...
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 hasAttribute(StringRef Kind) const
Return true if the attribute exists.
AttributeList getAttributesAsList(unsigned index) const
Return attribute set as list with index.
bool hasDefinitiveInitializer() const
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...
AttributeSet getAttributes() const
Return the attribute set for this global.
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 ...
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
bool isExternallyInitialized() const
bool hasAttributes() const
Return true if any attributes exist.
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 eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
A pair of DIGlobalVariable and DIExpression.
unsigned getValueID() const
Return an ID for the concrete type of this object.
OptionalOperandTraits - when the number of operands may change at runtime.
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
void setConstant(bool Val)
LLVMContext & getContext() const
All values hold a context through their type.
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide fast operand accessors.
Attribute getAttribute(StringRef Kind) const
Return the attribute object.
bool hasInitializer() const
Definitions have initializers, declarations don't.
LinkageTypes
An enumeration for the kinds of linkage for global values.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
void setAttributes(AttributeSet A)
Set attribute list for this global.
void dropAllReferences()
Drop all references in preparation to destroy the GlobalVariable.
bool hasImplicitSection() const
Check if section name is present.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
void copyAttributesFrom(const GlobalVariable *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
Compile-time customization of User operands.
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Attribute getAttribute(Attribute::AttrKind 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()
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...