Go to the documentation of this file.
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();
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
InstListType::iterator iterator
Instruction iterators...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
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...
LLVM Basic Block Representation.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Represent the analysis usage information of a pass.
Legacy analysis pass which computes a DominatorTree.
STATISTIC(NumFunctions, "Total number of functions")
static bool promoteMemoryToRegister(Function &F, DominatorTree &DT, AssumptionCache &AC)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
void initializePromoteLegacyPassPass(PassRegistry &)
A function analysis which provides an AssumptionCache.
INITIALIZE_PASS_BEGIN(PromoteLegacyPass, "mem2reg", "Promote Memory to " "Register", false, false) INITIALIZE_PASS_END(PromoteLegacyPass
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
An immutable pass that tracks lazily created AssumptionCache objects.
This class provides various memory handling functions that manipulate MemoryBlock instances.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
A cache of @llvm.assume calls within a function.
Represents analyses that only rely on functions' control flow.
Wrapper class representing virtual and physical registers.
static bool runOnFunction(Function &F, bool PostInlining)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
FunctionPass * createPromoteMemoryToRegisterPass()
Analysis pass which computes a DominatorTree.
void preserveSet()
Mark an analysis set as preserved.
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
AnalysisUsage & addRequired()
an instruction to allocate memory on the stack
bool isAllocaPromotable(const AllocaInst *AI)
Return true if this alloca is legal for promotion.