37 DerefAndAligned.
clear();
42char MemDerefPrinter::ID = 0;
44 "Memory Dereferenciblity of pointers in function",
false,
true)
49 return new MemDerefPrinter();
52bool MemDerefPrinter::runOnFunction(
Function &
F) {
55 if (
LoadInst *LI = dyn_cast<LoadInst>(&
I)) {
56 Value *PO = LI->getPointerOperand();
61 DerefAndAligned.
insert(PO);
68 OS <<
"The following are dereferenceable:\n";
69 for (
Value *V: Deref) {
72 if (DerefAndAligned.
count(V))
75 OS <<
"\t(unaligned)";
82 OS <<
"Memory Dereferencibility of pointers in function '" <<
F.getName()
90 if (
LoadInst *LI = dyn_cast<LoadInst>(&
I)) {
91 Value *PO = LI->getPointerOperand();
96 DerefAndAligned.
insert(PO);
100 OS <<
"The following are dereferenceable:\n";
101 for (
Value *V : Deref) {
104 if (DerefAndAligned.
count(V))
107 OS <<
"\t(unaligned)";
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
print Memory Dereferenciblity of pointers in function
Module.h This file contains the declarations for the Module class.
print must be executed print the must be executed context for all instructions
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
A parsed version of the target data layout string in and methods for querying it.
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
An instruction for reading from memory.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A Module instance is used to store all the information related to an LLVM module.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual void releaseMemory()
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
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.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
This class implements an extremely fast bulk output stream that can only output to a stream.
This class provides various memory handling functions that manipulate MemoryBlock instances.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
bool isDereferenceableAndAlignedPointer(const Value *V, Type *Ty, Align Alignment, const DataLayout &DL, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr)
Returns true if V is always a dereferenceable pointer with alignment greater or equal than requested.
FunctionPass * createMemDerefPrinter()
void initializeMemDerefPrinterPass(PassRegistry &)
bool isDereferenceablePointer(const Value *V, Type *Ty, const DataLayout &DL, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr)
Return true if this is always a dereferenceable pointer.