47 if (isa<GlobalValue>(C))
50 if (isa<ConstantData>(C))
54 if (
const Constant *
CU = dyn_cast<Constant>(U)) {
65 if (GV->isExternallyInitialized())
69 const User *UR = U.getUser();
70 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(UR)) {
75 if (!isa<PointerType>(CE->getType()))
81 }
else if (
const Instruction *
I = dyn_cast<Instruction>(UR)) {
83 const Function *
F =
I->getParent()->getParent();
89 if (
const LoadInst *LI = dyn_cast<LoadInst>(
I)) {
95 }
else if (
const StoreInst *
SI = dyn_cast<StoreInst>(
I)) {
97 if (
SI->getOperand(0) == V)
101 if (
SI->isVolatile())
111 dyn_cast<GlobalVariable>(
SI->getOperand(1))) {
112 Value *StoredVal =
SI->getOperand(0);
114 if (
Constant *
C = dyn_cast<Constant>(StoredVal)) {
115 if (
C->isThreadDependent()) {
121 if (GV->hasInitializer() && StoredVal == GV->getInitializer()) {
124 }
else if (isa<LoadInst>(StoredVal) &&
125 cast<LoadInst>(StoredVal)->getOperand(0) == GV) {
141 }
else if (isa<BitCastInst>(
I) || isa<GetElementPtrInst>(
I)) {
146 }
else if (isa<SelectInst>(
I) || isa<PHINode>(
I)) {
151 if (VisitedUsers.
insert(
I).second)
154 }
else if (isa<CmpInst>(
I)) {
157 if (MTI->isVolatile())
159 if (MTI->getArgOperand(0) == V)
161 if (MTI->getArgOperand(1) == V)
163 }
else if (
const MemSetInst *MSI = dyn_cast<MemSetInst>(
I)) {
164 assert(MSI->getArgOperand(0) == V &&
"Memset only takes one pointer!");
165 if (MSI->isVolatile())
175 }
else if (
const Constant *
C = dyn_cast<Constant>(UR)) {
bool IsLoaded
True if the global is ever loaded.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Atomic ordering constants.
This class represents lattice values for constants.
bool HasMultipleAccessingFunctions
This class wraps the llvm.memset intrinsic.
An instruction for reading from memory.
This defines the Use class.
This global is stored to, but the only thing stored is the constant it was initialized with...
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS, SmallPtrSetImpl< const Value *> &VisitedUsers)
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.
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.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
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...
bool isCallee(Value::const_user_iterator UI) const
Determine whether the passed iterator points to the callee operand's Use.
This global is stored to by multiple values or something else that we cannot track.
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.
Establish a view to a call site for examination.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
for(unsigned i=Desc.getNumOperands(), e=OldMI.getNumOperands();i !=e;++i)