31 #define DEBUG_TYPE "mem2reg" 33 STATISTIC(NumPromoted,
"Number of alloca's promoted");
37 std::vector<AllocaInst *> Allocas;
49 Allocas.push_back(AI);
55 NumPromoted += Allocas.size();
88 DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
90 getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
115 return new PromoteLegacyPass();
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
This class provides various memory handling functions that manipulate MemoryBlock instances...
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
STATISTIC(NumFunctions, "Total number of functions")
Analysis pass which computes a DominatorTree.
bool isAllocaPromotable(const AllocaInst *AI)
Return true if this alloca is legal for promotion.
iterator begin()
Instruction iterator methods.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
const BasicBlock & getEntryBlock() const
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
FunctionPass * createPromoteMemoryToRegisterPass()
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
A function analysis which provides an AssumptionCache.
Iterator for intrusive lists based on ilist_node.
static bool promoteMemoryToRegister(Function &F, DominatorTree &DT, AssumptionCache &AC)
INITIALIZE_PASS_BEGIN(PromoteLegacyPass, "mem2reg", "Promote Memory to " "Register", false, false) INITIALIZE_PASS_END(PromoteLegacyPass
Promote Memory to Register
void setPreservesCFG()
This function should be called by the pass, iff they do not:
void initializePromoteLegacyPassPass(PassRegistry &)
Represents analyses that only rely on functions' control flow.
void preserveSet()
Mark an analysis set as preserved.
void PromoteMemToReg(ArrayRef< AllocaInst *> Allocas, DominatorTree &DT, AssumptionCache *AC=nullptr)
Promote the specified list of alloca instructions into scalar registers, inserting PHI nodes as appro...
A container for analyses that lazily runs them and caches their results.
Legacy analysis pass which computes a DominatorTree.
This header defines various interfaces for pass management in LLVM.
an instruction to allocate memory on the stack