34 if (isa<GlobalValue>(C))
37 if (isa<ConstantData>(C))
41 if (
const Constant *CU = dyn_cast<Constant>(U)) {
52 if (GV->isExternallyInitialized())
56 const User *UR = U.getUser();
57 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(UR)) {
62 if (!isa<PointerType>(CE->getType()))
67 }
else if (
const Instruction *
I = dyn_cast<Instruction>(UR)) {
69 const Function *
F =
I->getParent()->getParent();
75 if (
const LoadInst *LI = dyn_cast<LoadInst>(
I)) {
81 }
else if (
const StoreInst *
SI = dyn_cast<StoreInst>(
I)) {
83 if (
SI->getOperand(0) == V)
97 dyn_cast<GlobalVariable>(
SI->getOperand(1))) {
98 Value *StoredVal =
SI->getOperand(0);
100 if (
Constant *
C = dyn_cast<Constant>(StoredVal)) {
101 if (
C->isThreadDependent()) {
107 if (GV->hasInitializer() && StoredVal == GV->getInitializer()) {
110 }
else if (isa<LoadInst>(StoredVal) &&
111 cast<LoadInst>(StoredVal)->getOperand(0) == GV) {
127 }
else if (isa<BitCastInst>(
I)) {
130 }
else if (isa<GetElementPtrInst>(
I)) {
133 }
else if (isa<SelectInst>(
I)) {
136 }
else if (
const PHINode *PN = dyn_cast<PHINode>(
I)) {
139 if (PhiUsers.
insert(PN).second)
142 }
else if (isa<CmpInst>(
I)) {
145 if (MTI->isVolatile())
147 if (MTI->getArgOperand(0) == V)
149 if (MTI->getArgOperand(1) == V)
151 }
else if (
const MemSetInst *MSI = dyn_cast<MemSetInst>(
I)) {
152 assert(MSI->getArgOperand(0) == V &&
"Memset only takes one pointer!");
153 if (MSI->isVolatile())
163 }
else if (
const Constant *
C = dyn_cast<Constant>(UR)) {
185 StoredOnceValue(nullptr), AccessingFunction(nullptr),
186 HasMultipleAccessingFunctions(
false), HasNonInstructionUser(
false),
bool IsLoaded
True if the global is ever loaded.
iterator_range< use_iterator > uses()
Value * StoredOnceValue
If only one value (besides the initializer constant) is ever stored to this global, keep track of what value it is.
const Function * AccessingFunction
These start out null/false.
bool HasMultipleAccessingFunctions
This class wraps the llvm.memset intrinsic.
An instruction for reading from memory.
This global is stored to, but the only thing stored is the constant it was initialized with...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
A Use represents the edge between a Value definition and its users.
StoredType
Keep track of what stores to the global look like.
bool HasNonInstructionUser
Set to true if this global has a user that is not an instruction (e.g.
AtomicOrdering
Atomic ordering for LLVM's memory model.
A constant value that is initialized with an expression using other constant values.
Function Alias Analysis false
An instruction for storing to memory.
This global is stored to, but only its initializer and one other value is ever stored to it...
static AtomicOrdering strongerOrdering(AtomicOrdering X, AtomicOrdering Y)
Return the stronger of the two ordering.
As we analyze each global, keep track of some information about it.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
This is an important base class in LLVM.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
for(unsigned i=0, e=MI->getNumOperands();i!=e;++i)
static bool analyzeGlobal(const Value *V, GlobalStatus &GS)
Look at all uses of the global and fill in the GlobalStatus structure.
bool isSafeToDestroyConstant(const Constant *C)
It is safe to destroy a constant iff it is only used by constants itself.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This global is stored to by multiple values or something else that we cannot track.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
iterator_range< user_iterator > users()
This class wraps the llvm.memcpy/memmove intrinsics.
bool IsCompared
True if the global's address is used in a comparison.
AtomicOrdering Ordering
Set to the strongest atomic ordering requirement.
ImmutableCallSite - establish a view to a call site for examination.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS, SmallPtrSetImpl< const PHINode * > &PhiUsers)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")