47 while (!Worklist.
empty()) {
54 for (
const User *U :
C->users()) {
67 if (GV->isExternallyInitialized())
70 for (
const Use &U : V->
uses()) {
71 const User *UR = U.getUser();
85 if (!GS.HasMultipleAccessingFunctions) {
86 const Function *
F =
I->getParent()->getParent();
87 if (!GS.AccessingFunction)
88 GS.AccessingFunction =
F;
89 else if (GS.AccessingFunction !=
F)
90 GS.HasMultipleAccessingFunctions =
true;
100 if (
SI->getOperand(0) == V)
104 if (
SI->isVolatile())
115 const Value *
Ptr =
SI->getPointerOperand()->stripPointerCasts();
117 Value *StoredVal =
SI->getOperand(0);
120 if (
C->isThreadDependent()) {
126 if (GV->hasInitializer() && StoredVal == GV->getInitializer()) {
135 GS.StoredOnceStore =
SI;
137 GS.getStoredOnceValue() == StoredVal) {
156 if (VisitedUsers.
insert(
I).second)
160 GS.IsCompared =
true;
162 if (MTI->isVolatile())
164 if (MTI->getArgOperand(0) == V)
166 if (MTI->getArgOperand(1) == V)
169 assert(MSI->getArgOperand(0) == V &&
"Memset only takes one pointer!");
170 if (MSI->isVolatile())
174 if (CB->getIntrinsicID() == Intrinsic::threadlocal_address) {
178 if (!CB->isCallee(&U))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Atomic ordering constants.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS, SmallPtrSetImpl< const Value * > &VisitedUsers)
static AtomicOrdering strongerOrdering(AtomicOrdering X, AtomicOrdering Y)
Return the stronger of the two ordering.
This defines the Use class.
This file defines the SmallPtrSet class.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
A constant value that is initialized with an expression using other constant values.
This is an important base class in LLVM.
An instruction for reading from memory.
This class wraps the llvm.memset and llvm.memset.inline intrinsics.
This class wraps the llvm.memcpy/memmove intrinsics.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
iterator_range< use_iterator > uses()
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isSafeToDestroyConstant(const Constant *C)
It is safe to destroy a constant iff it is only used by constants itself.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
AtomicOrdering
Atomic ordering for LLVM's memory model.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
As we analyze each global or thread-local variable, keep track of some information about it.
@ Stored
This global is stored to by multiple values or something else that we cannot track.
@ InitializerStored
This global is stored to, but the only thing stored is the constant it was initialized with.
@ StoredOnce
This global is stored to, but only its initializer and one other value is ever stored to it.
static bool analyzeGlobal(const Value *V, GlobalStatus &GS)
Look at all uses of the global and fill in the GlobalStatus structure.