Go to the documentation of this file.
19 #ifndef LLVM_IR_GLOBALVARIABLE_H
20 #define LLVM_IR_GLOBALVARIABLE_H
36 template <
typename ValueSubClass>
class SymbolTableListTraits;
37 class DIGlobalVariableExpression;
43 bool isConstantGlobal : 1;
44 bool isExternallyInitializedConstant : 1;
72 void *
operator new(
size_t s) {
73 return User::operator
new(
s, 1);
77 void operator delete(
void *ptr){
78 assert(ptr !=
nullptr &&
"must not be nullptr");
79 User *Obj =
static_cast<User *
>(ptr);
83 User::operator
delete(Obj);
137 return static_cast<Constant*
>(Op<0>().get());
141 return static_cast<Constant*
>(Op<0>().get());
156 return isExternallyInitializedConstant;
159 isExternallyInitializedConstant = Val;
208 return Attrs.hasAttributes();
232 std::pair<unsigned, AttributeSet> AS[1] = {{
index,
Attrs}};
251 return V->
getValueID() == Value::GlobalVariableVal;
264 #endif // LLVM_IR_GLOBALVARIABLE_H
void setExternallyInitialized(bool Val)
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
This is an optimization pass for GlobalISel generic memory operations.
bool hasUniqueInitializer() const
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
void getDebugInfo(SmallVectorImpl< DIGlobalVariableExpression * > &GVs) const
Fill the vector with all debug info attachements.
void setConstant(bool Val)
void copyAttributesFrom(const GlobalVariable *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
void addAttribute(StringRef Kind, StringRef Val=StringRef())
Add attribute to this global.
bool isExternallyInitialized() const
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
The instances of the Type class are immutable: once they are created, they are never changed.
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
Constant * getInitializer()
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists.
LinkageTypes
An enumeration for the kinds of linkage for global values.
bool hasAttributes() const
Return true if any attributes exist.
bool hasInitializer() const
Definitions have initializers, declarations don't.
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
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...
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
unsigned getValueID() const
Return an ID for the concrete type of this object.
void addAttribute(Attribute::AttrKind Kind)
Add attribute to this global.
Attribute getAttribute(StringRef Kind) const
Return the attribute object.
bool hasAttribute(StringRef Kind) const
Return true if the attribute exists.
void dropAllReferences()
Drop all references in preparation to destroy the GlobalVariable.
void addDebugInfo(DIGlobalVariableExpression *GV)
Attach a DIGlobalVariableExpression.
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This is an important base class in LLVM.
bool hasDefinitiveInitializer() const
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...
bool hasImplicitSection() const
Check if section name is present.
multiplies can be turned into SHL s
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
LLVMContext & getContext() const
All values hold a context through their type.
Machine Check Debug Module
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 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 ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static bool classof(const Value *V)
AttributeList getAttributesAsList(unsigned index) const
Return attribute set as list with index.
AttributeSet getAttributes() const
Return the attribute set for this global.
A pair of DIGlobalVariable and DIExpression.
OptionalOperandTraits - when the number of operands may change at runtime.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Provide fast operand accessors.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
void setAttributes(AttributeSet A)
Set attribute list for this global.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
GlobalVariable & operator=(const GlobalVariable &)=delete
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.
LLVM Value Representation.
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...