19#ifndef LLVM_IR_GLOBALVARIABLE_H
20#define LLVM_IR_GLOBALVARIABLE_H
47 bool isConstantGlobal : 1;
50 bool isExternallyInitializedConstant : 1;
54 static const unsigned CodeModelMask = (1 << CodeModelBits) - 1;
80 void setGlobalVariableNumOperands(
unsigned NumOps) {
81 assert(NumOps <= 1 &&
"GlobalVariable can only have 0 or 1 operands");
92 setGlobalVariableNumOperands(1);
96 void *
operator new(
size_t s) {
return User::operator
new(s, AllocMarker); }
99 void operator delete(
void *ptr) { User::operator
delete(ptr); }
177 return isExternallyInitializedConstant;
180 isExternallyInitializedConstant = Val;
209 Attrs = Attrs.addAttribute(
getContext(), Kind);
214 Attrs = Attrs.addAttribute(
getContext(), Kind, Val);
219 return Attrs.hasAttribute(Kind);
224 return Attrs.hasAttribute(Kind);
229 return Attrs.hasAttributes();
234 return Attrs.getAttribute(Kind);
239 return Attrs.getAttribute(Kind);
253 std::pair<unsigned, AttributeSet> AS[1] = {{index, Attrs}};
274 return (
Data >> CodeModelShift) & CodeModelMask;
283 if (CodeModelData > 0)
294 return V->getValueID() == Value::GlobalVariableVal;
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute > > Attrs)
Create an AttributeList with the specified parameters in it.
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
This is an important base class in LLVM.
A pair of DIGlobalVariable and DIExpression.
This class represents an Operation in the Expression.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time ...
unsigned getGlobalValueSubClassData() const
LinkageTypes
An enumeration for the kinds of linkage for global values.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
unsigned getCodeModelRaw() const
Get the custom code model raw value of this global.
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists.
bool isExternallyInitialized() const
bool hasInitializer() const
Definitions have initializers, declarations don't.
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.
bool hasAttributes() const
Return true if any attributes exist.
AttributeSet getAttributes() const
Return the attribute set for this global.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide fast operand accessors.
std::optional< CodeModel::Model > getCodeModel() const
Get the custom code model of this global if it has one.
void setAttributes(AttributeSet A)
Set attribute list for this global.
void replaceInitializer(Constant *InitVal)
replaceInitializer - Sets the initializer for this global variable, and sets the value type of the gl...
void setConstant(bool Val)
GlobalVariable & operator=(const GlobalVariable &)=delete
void copyAttributesFrom(const GlobalVariable *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
GlobalVariable(const GlobalVariable &)=delete
void addAttribute(StringRef Kind, StringRef Val=StringRef())
Add attribute to this global.
Constant * getInitializer()
bool hasImplicitSection() const
Check if section name is present.
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression * > &GVs) const
Fill the vector with all debug info attachements.
AttributeList getAttributesAsList(unsigned index) const
Return attribute set as list with index.
Attribute getAttribute(StringRef Kind) const
Return the attribute object.
static bool classof(const Value *V)
bool hasAttribute(StringRef Kind) const
Return true if the attribute exists.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
void setCodeModel(CodeModel::Model CM)
Change the code model for this global.
bool hasUniqueInitializer() const
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...
void setExternallyInitialized(bool Val)
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
bool hasDefinitiveInitializer() const
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...
void addAttribute(Attribute::AttrKind Kind)
Add attribute to this global.
void dropAllReferences()
Drop all references in preparation to destroy the GlobalVariable.
A Module instance is used to store all the information related to an LLVM module.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
LLVMContext & getContext() const
All values hold a context through their type.
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This is an optimization pass for GlobalISel generic memory operations.
Compile-time customization of User operands.
OptionalOperandTraits - when the number of operands may change at runtime.
Indicates this User has operands co-allocated.