59 assert((Align & (Align-1)) == 0 &&
"Alignment is not a power of 2!");
61 "Alignment is greater than MaximumAlignment!");
63 assert(
getAlignment() == Align &&
"Alignment representation error!");
69 return GV->getNumOperands() == 0;
72 if (
const Function *
F = dyn_cast<Function>(
this))
76 assert(isa<GlobalAlias>(
this));
88 bool isExternallyInitialized)
90 Value::GlobalVariableVal,
92 InitVal != 0, Link, Name),
93 isConstantGlobal(constant), threadLocalMode(TLMode),
94 isExternallyInitializedConstant(isExternallyInitialized) {
96 assert(InitVal->
getType() == Ty &&
97 "Initializer should be the same type as the GlobalVariable!");
104 GlobalVariable::GlobalVariable(
Module &M,
Type *Ty,
bool constant,
109 bool isExternallyInitialized)
111 Value::GlobalVariableVal,
113 InitVal != 0, Link, Name),
114 isConstantGlobal(constant), threadLocalMode(TLMode),
115 isExternallyInitializedConstant(isExternallyInitialized) {
117 assert(InitVal->
getType() == Ty &&
118 "Initializer should be the same type as the GlobalVariable!");
130 void GlobalVariable::setParent(
Module *parent) {
151 "Attempt to replace uses of Constants on a GVar with no initializer");
156 "Attempt to replace wrong constant initializer in GVar");
159 assert(isa<Constant>(To) &&
160 "Attempt to replace GVar initializer with non-constant");
174 "Initializer type must match GlobalVariable type");
177 Op<0>().set(InitVal);
184 assert(isa<GlobalVariable>(Src) &&
"Expected a GlobalVariable!");
202 assert(aliasee->
getType() == Ty &&
"Alias and aliasee types should match!");
209 void GlobalAlias::setParent(
Module *parent) {
227 "Alias and aliasee types should match!");
234 if (C == 0)
return 0;
240 assert((CE->
getOpcode() == Instruction::BitCast ||
241 CE->
getOpcode() == Instruction::GetElementPtr) &&
242 "Unsupported aliasee");
258 while (
GlobalAlias *GA = dyn_cast<GlobalAlias>(GV)) {
259 if (stopOnWeak && GA->mayBeOverridden())
262 GV = GA->getAliasedGlobal();
void setVisibility(VisibilityTypes V)
VisibilityTypes getVisibility() const
virtual void copyAttributesFrom(const GlobalValue *Src)
The main container class for the LLVM Intermediate Representation.
unsigned getAlignment() const
const GlobalListType & getGlobalList() const
Get the Module's list of global variables (constant).
unsigned getNumOperands() const
void setSection(StringRef S)
const AliasListType & getAliasList() const
Get the Module's list of aliases (constant).
const Constant * getAliasee() const
unsigned getOpcode() const
getOpcode - Return the opcode at the root of this constant expression
virtual void eraseFromParent()
static void removeGarbageObject(void *Object)
void push_back(NodeTy *val)
void setInitializer(Constant *InitVal)
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
#define llvm_unreachable(msg)
bool Materialize(GlobalValue *GV, std::string *ErrInfo=0)
void setThreadLocal(bool Val)
bool isMaterializable() const
GlobalValue * resolveAliasedGlobal(bool stopOnWeak=true)
Type * getElementType() const
bool isDematerializable(const GlobalValue *GV) const
LLVM Constant Representation.
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U)
bool isDematerializable() const
virtual void eraseFromParent()
iterator insert(iterator where, NodeTy *New)
Value * getOperand(unsigned i) const
const std::string & getSection() const
void Dematerialize(GlobalValue *GV)
virtual void removeFromParent()
iterator erase(iterator where)
void setAlignment(unsigned Align)
void copyAttributesFrom(const GlobalValue *Src)
void setUnnamedAddr(bool Val)
void setAliasee(Constant *GV)
set/getAliasee - These methods retrive and set alias target.
void setOperand(unsigned i, Value *Val)
unsigned Log2_32(uint32_t Value)
bool hasInitializer() const
LinkageTypes
An enumeration for the kinds of linkage for global values.
static void addGarbageObject(void *Object)
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
virtual void destroyConstant()
Override from Constant class.
PointerType * getType() const
getType - Global values are always pointers.
bool isDeclaration() const
virtual void removeFromParent()
bool isMaterializable(const GlobalValue *GV) const
LLVM Value Representation.
bool hasUnnamedAddr() const
bool mayBeOverridden() const
bool Materialize(std::string *ErrInfo=0)
NodeTy * remove(iterator &IT)
GlobalValue * getAliasedGlobal()