31 if (
const Function *
F = dyn_cast<Function>(
this))
32 return F->isMaterializable();
47 void GlobalValue::destroyConstantImpl() {
64 if (
auto *GA = dyn_cast<GlobalAlias>(
this)) {
67 return GO->getAlignment();
78 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
80 "Alignment is greater than MaximumAlignment!");
81 unsigned AlignmentData =
Log2_32(Align) + 1;
84 assert(
getAlignment() == Align &&
"Alignment representation error!");
100 const auto *GV = cast<GlobalObject>(Src);
107 if (
auto *GA = dyn_cast<GlobalAlias>(
this)) {
110 return GO->getSection();
113 return cast<GlobalObject>(
this)->
getSection();
117 if (
auto *GA = dyn_cast<GlobalAlias>(
this)) {
120 return const_cast<GlobalObject *>(GO)->getComdat();
123 return cast<GlobalObject>(
this)->
getComdat();
131 return GV->getNumOperands() == 0;
134 if (
const Function *
F = dyn_cast<Function>(
this))
135 return F->empty() && !
F->isMaterializable();
138 assert(isa<GlobalAlias>(
this));
149 bool isExternallyInitialized)
152 InitVal != nullptr, Link, Name),
153 isConstantGlobal(constant),
154 isExternallyInitializedConstant(isExternallyInitialized) {
157 assert(InitVal->
getType() == Ty &&
158 "Initializer should be the same type as the GlobalVariable!");
163 GlobalVariable::GlobalVariable(
Module &M,
Type *Ty,
bool constant,
167 bool isExternallyInitialized)
170 InitVal != nullptr, Link, Name),
171 isConstantGlobal(constant),
172 isExternallyInitializedConstant(isExternallyInitialized) {
175 assert(InitVal->
getType() == Ty &&
176 "Initializer should be the same type as the GlobalVariable!");
186 void GlobalVariable::setParent(
Module *parent) {
204 Op<0>().set(
nullptr);
209 "Initializer type must match GlobalVariable type");
215 Op<0>().set(InitVal);
222 assert(isa<GlobalVariable>(Src) &&
"Expected a GlobalVariable!");
246 return new GlobalAlias(Ty, Link, Name, Aliasee, ParentModule);
251 return create(Ty, Linkage, Name,
nullptr, Parent);
262 return create(PTy, Link, Name, Aliasee);
269 void GlobalAlias::setParent(
Module *parent) {
283 "Alias and aliasee types should match!");
void setVisibility(VisibilityTypes V)
LinkageTypes getLinkage() const
VisibilityTypes getVisibility() const
virtual void copyAttributesFrom(const GlobalValue *Src)
Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...
std::error_code materialize(GlobalValue *GV)
Make sure the GlobalValue is fully read.
A Module instance is used to store all the information related to an LLVM module. ...
void dematerialize(GlobalValue *GV)
If the GlobalValue is read in, and if the GVMaterializer supports it, release the memory for the func...
const GlobalListType & getGlobalList() const
Get the Module's list of global variables (constant).
const char * getSection() const
void setAlignment(unsigned Align)
const AliasListType & getAliasList() const
Get the Module's list of aliases (constant).
unsigned getGlobalObjectSubClassData() const
void push_back(NodeTy *val)
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 ...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
A Use represents the edge between a Value definition and its users.
void setThreadLocalMode(ThreadLocalMode Val)
static const unsigned MaximumAlignment
void eraseFromParent() override
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
void setDLLStorageClass(DLLStorageClassTypes C)
unsigned getAlignment() const
bool isMaterializable() const
If this function's Module is being lazily streamed in functions from disk or some other source...
Type * getElementType() const
PointerType - Class to represent pointers.
bool isExternallyInitialized() const
bool isDematerializable(const GlobalValue *GV) const
Returns true if this GV was loaded from this Module's GVMaterializer and the GVMaterializer knows how...
The instances of the Type class are immutable: once they are created, they are never changed...
static GlobalAlias * create(PointerType *Ty, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isDematerializable() const
Returns true if this function was loaded from a GVMaterializer that's still attached to its Module an...
void setExternallyInitialized(bool Val)
void removeFromParent() override
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...
iterator insert(iterator where, NodeTy *New)
void setGlobalVariableNumOperands(unsigned NumOps)
Set the number of operands on a GlobalVariable.
iterator erase(iterator where)
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
void setUnnamedAddr(bool Val)
void copyAttributesFrom(const GlobalValue *Src) override
Copy all additional attributes (those not needed to create a GlobalValue) from the GlobalValue Src to...
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
void setOperand(unsigned i, Value *Val)
unsigned Log2_32(uint32_t Value)
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
bool hasInitializer() const
Definitions have initializers, declarations don't.
void eraseFromParent() override
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
LinkageTypes
An enumeration for the kinds of linkage for global values.
void setGlobalValueSubClassData(unsigned V)
ThreadLocalMode getThreadLocalMode() const
unsigned getGlobalValueSubClassData() const
PointerType * getType() const
Global values are always pointers.
static const unsigned AlignmentBits
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Compile-time customization of User operands.
void copyAttributesFrom(const GlobalValue *Src) override
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
unsigned getAlignment() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
bool hasUnnamedAddr() const
void dematerialize()
If this GlobalValue is read in, and if the GVMaterializer supports it, release the memory for the fun...
DLLStorageClassTypes getDLLStorageClass() const
StringRef - Represent a constant reference to a string, i.e.
NodeTy * remove(iterator &IT)
std::error_code materialize()
Make sure this GlobalValue is fully read.
void setSection(StringRef S)
void setGlobalObjectSubClassData(unsigned Val)
void setAliasee(Constant *Aliasee)
These methods retrive and set alias target.
void removeFromParent() override
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it...