namespace {
struct GlobalDCE : public Pass {
- const char *getPassName() const { return "Dead Global Elimination"; }
-
// run - Do the GlobalDCE pass on the specified module, optionally updating
// the specified callgraph to reflect the changes.
//
AU.addRequired(CallGraph::ID);
}
};
+ RegisterPass<GlobalDCE> X("globaldce", "Dead Global Elimination");
}
Pass *createGlobalDCEPass() { return new GlobalDCE(); }
static Statistic<> NumChanged("internalize\t- Number of functions internal'd");
+namespace {
class InternalizePass : public Pass {
- const char *getPassName() const { return "Internalize Functions"; }
-
virtual bool run(Module &M) {
bool FoundMain = false; // Look for a function named main...
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
}
};
+RegisterPass<InternalizePass> X("internalize", "Internalize Functions");
+} // end anonymous namespace
+
Pass *createInternalizePass() {
return new InternalizePass();
}
// Define the pass class that we implement...
struct PoolAllocate : public Pass {
- const char *getPassName() const { return "Pool Allocate"; }
-
PoolAllocate() {
switch (ReqPointerSize) {
case Ptr32bits: POINTERTYPE = Type::UIntTy; break;
map<DSNode*, PoolInfo> &PoolDescs);
};
+
+ RegisterPass<PoolAllocate> X("poolalloc",
+ "Pool allocate disjoint datastructures");
}
// isNotPoolableAlloc - This is a predicate that returns true if the specified
using std::vector;
-struct EmitFunctionTable : public Pass {
- const char *getPassName() const { return "EmitFunctionTablePass"; }
-
- bool run(Module &M);
-};
+namespace {
+ struct EmitFunctionTable : public Pass {
+ bool run(Module &M);
+ };
+
+ RegisterPass<EmitFunctionTable> X("emitfuncs", "Emit a Function Table");
+}
// Create a new pass to add function table
//
using std::vector;
struct ProfilePaths : public FunctionPass {
- const char *getPassName() const { return "ProfilePaths"; }
-
bool runOnFunction(Function &F);
// Before this pass, make sure that there is only one
}
};
+static RegisterPass<ProfilePaths> X("paths", "Profile Paths");
+
// createProfilePathsPass - Create a new pass to add path profiling
//
Pass *createProfilePathsPass() {
// The public interface for this class
//
public:
- const char *getPassName() const { return "Aggressive Dead Code Elimination"; }
-
// Execute the Aggressive Dead Code Elimination Algorithm
//
virtual bool runOnFunction(Function &F) {
}
};
+ RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
} // End of anonymous namespace
Pass *createAggressiveDCEPass() { return new ADCE(); }
-
void ADCE::markBlockAlive(BasicBlock *BB) {
// Mark the basic block as being newly ALIVE... and mark all branches that
// this block is control dependant on as being alive also...
namespace {
struct ConstantPropogation : public FunctionPass {
- const char *getPassName() const { return "Simple Constant Propogation"; }
-
bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG();
}
};
+
+RegisterPass<ConstantPropogation> X("constprop", "Simple constant propogation");
}
Pass *createConstantPropogationPass() {
namespace {
struct DeadInstElimination : public BasicBlockPass {
- const char *getPassName() const { return "Dead Instruction Elimination"; }
-
virtual bool runOnBasicBlock(BasicBlock &BB) {
bool Changed = false;
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
AU.preservesCFG();
}
};
+
+ RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination");
}
Pass *createDeadInstEliminationPass() {
namespace {
struct DCE : public FunctionPass {
- const char *getPassName() const { return "Dead Code Elimination"; }
-
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG();
}
};
+
+ RegisterPass<DCE> Y("dce", "Dead Code Elimination");
}
bool DCE::runOnFunction(Function &F) {
namespace {
struct DecomposePass : public BasicBlockPass {
- const char *getPassName() const { return "Decompose Subscripting Exps"; }
-
virtual bool runOnBasicBlock(BasicBlock &BB);
private:
static void decomposeArrayRef(BasicBlock::iterator &BBI);
};
+
+RegisterPass<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
+ "structure/array references");
}
Pass *createDecomposeMultiDimRefsPass() {
//
map<BasicBlock*, bool> BBContainsStore;
public:
- const char *getPassName() const {
- return "Global Common Subexpression Elimination";
- }
-
virtual bool runOnFunction(Function &F);
// Visitation methods, these are invoked depending on the type of
AU.addRequired(ImmediateDominators::ID);
}
};
+
+ RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination");
}
// createGCSEPass - The public interface to this file...
namespace {
struct InductionVariableSimplify : public FunctionPass {
- const char *getPassName() const {
- return "Induction Variable Cannonicalize";
- }
-
virtual bool runOnFunction(Function &) {
LoopInfo &LI = getAnalysis<LoopInfo>();
AU.preservesCFG();
}
};
+ RegisterPass<InductionVariableSimplify> X("indvars",
+ "Cannonicalize Induction Variables");
}
Pass *createIndVarSimplifyPass() {
return new InductionVariableSimplify();
}
-
}
public:
- const char *getPassName() const { return "Instruction Combining"; }
-
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
// visitInstruction - Specify what to return for unhandled instructions...
Instruction *visitInstruction(Instruction &I) { return 0; }
};
+
+ RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions");
}
namespace {
struct LICM : public FunctionPass, public InstVisitor<LICM> {
- const char *getPassName() const { return "Loop Invariant Code Motion"; }
-
virtual bool runOnFunction(Function &F);
// This transformation requires natural loop information...
hoist(I);
}
};
+
+ RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
}
Pass *createLICMPass() { return new LICM(); }
namespace {
struct PiNodeInserter : public FunctionPass {
- const char *getPassName() const { return "Pi Node Insertion"; }
-
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
//
bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0);
};
+
+ RegisterPass<PiNodeInserter> X("pinodes", "Pi Node Insertion");
}
Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
class Reassociate : public FunctionPass {
map<BasicBlock*, unsigned> RankMap;
public:
- const char *getPassName() const {
- return "Expression Reassociation";
- }
-
bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
bool ReassociateExpr(BinaryOperator *I);
bool ReassociateBB(BasicBlock *BB);
};
+
+ RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
}
Pass *createReassociatePass() { return new Reassociate(); }
std::vector<BasicBlock*> BBWorkList; // The BasicBlock work list
public:
- const char *getPassName() const {
- return "Sparse Conditional Constant Propogation";
- }
-
// runOnFunction - Run the Sparse Conditional Constant Propogation algorithm,
// and return true if the function was modified.
//
visit(I);
}
};
+
+ RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propogation");
} // end anonymous namespace
}
-
//===----------------------------------------------------------------------===//
// SCCP Class Implementation
namespace {
struct CFGSimplifyPass : public FunctionPass {
- const char *getPassName() const { return "Simplify CFG"; }
-
virtual bool runOnFunction(Function &F);
};
+ RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
}
Pass *createCFGSimplificationPass() {
namespace {
struct SymbolStripping : public FunctionPass {
- const char *getPassName() const { return "Strip Symbols from Functions"; }
-
virtual bool runOnFunction(Function &F) {
return StripSymbolTable(F.getSymbolTable());
}
AU.setPreservesAll();
}
};
+ RegisterPass<SymbolStripping> X("strip", "Strip symbols from functions");
struct FullSymbolStripping : public SymbolStripping {
- const char *getPassName() const { return "Strip Symbols from Module"; }
virtual bool doInitialization(Module &M) {
return StripSymbolTable(M.getSymbolTable());
}
};
+ RegisterPass<FullSymbolStripping> Y("mstrip",
+ "Strip symbols from module and functions");
}
Pass *createSymbolStrippingPass() {
map<BasicBlock*,vector<PHINode*> > NewPhiNodes; // the PhiNodes we're adding
public:
- const char *getPassName() const { return "Promote Memory to Register"; }
-
// runOnFunction - To run this pass, first we calculate the alloca
// instructions that are safe for promotion, then we promote each one.
//
void FindSafeAllocas(Function &F);
};
+ RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
} // end of anonymous namespace
AnalysisID UnifyFunctionExitNodes::ID(AnalysisID::create<UnifyFunctionExitNodes>());
+static RegisterPass<UnifyFunctionExitNodes>
+X("mergereturn", "Unify function exit nodes");
// UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
// BasicBlock, and converting all returns to unconditional branches to this