15 #define DEBUG_TYPE "mem2reg"
25 STATISTIC(NumPromoted,
"Number of alloca's promoted");
57 bool PromotePass::runOnFunction(
Function &
F) {
58 std::vector<AllocaInst*> Allocas;
74 Allocas.push_back(AI);
76 if (Allocas.empty())
break;
79 NumPromoted += Allocas.size();
89 return new PromotePass();
AnalysisUsage & addPreserved()
static PassRegistry * getPassRegistry()
An abstraction for memory operations.
STATISTIC(NumPromoted,"Number of alloca's promoted")
void PromoteMemToReg(ArrayRef< AllocaInst * > Allocas, DominatorTree &DT, AliasSetTracker *AST=0)
Promote the specified list of alloca instructions into scalar registers, inserting PHI nodes as appro...
bool isAllocaPromotable(const AllocaInst *AI)
Return true if this alloca is legal for promotion.
void initializePromotePassPass(PassRegistry &)
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
ID
LLVM Calling Convention Representation.
AnalysisUsage & addPreservedID(const void *ID)
LLVM Basic Block Representation.
Promote Memory to Register
INITIALIZE_PASS_BEGIN(PromotePass,"mem2reg","Promote Memory to Register", false, false) INITIALIZE_PASS_END(PromotePass
FunctionPass * createPromoteMemoryToRegisterPass()