*** empty log message ***

llvm-svn: 3016
This commit is contained in:
Chris Lattner 2002-07-23 18:06:35 +00:00
parent 6788f25f99
commit b28b680155
20 changed files with 48 additions and 55 deletions

View File

@ -70,8 +70,6 @@ static bool RemoveUnreachableGlobalVariables(Module &M) {
namespace { namespace {
struct GlobalDCE : public Pass { struct GlobalDCE : public Pass {
const char *getPassName() const { return "Dead Global Elimination"; }
// run - Do the GlobalDCE pass on the specified module, optionally updating // run - Do the GlobalDCE pass on the specified module, optionally updating
// the specified callgraph to reflect the changes. // the specified callgraph to reflect the changes.
// //
@ -88,6 +86,7 @@ namespace {
AU.addRequired(CallGraph::ID); AU.addRequired(CallGraph::ID);
} }
}; };
RegisterPass<GlobalDCE> X("globaldce", "Dead Global Elimination");
} }
Pass *createGlobalDCEPass() { return new GlobalDCE(); } Pass *createGlobalDCEPass() { return new GlobalDCE(); }

View File

@ -14,9 +14,8 @@
static Statistic<> NumChanged("internalize\t- Number of functions internal'd"); static Statistic<> NumChanged("internalize\t- Number of functions internal'd");
namespace {
class InternalizePass : public Pass { class InternalizePass : public Pass {
const char *getPassName() const { return "Internalize Functions"; }
virtual bool run(Module &M) { virtual bool run(Module &M) {
bool FoundMain = false; // Look for a function named main... bool FoundMain = false; // Look for a function named main...
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
@ -42,6 +41,9 @@ class InternalizePass : public Pass {
} }
}; };
RegisterPass<InternalizePass> X("internalize", "Internalize Functions");
} // end anonymous namespace
Pass *createInternalizePass() { Pass *createInternalizePass() {
return new InternalizePass(); return new InternalizePass();
} }

View File

@ -207,8 +207,6 @@ namespace {
// Define the pass class that we implement... // Define the pass class that we implement...
struct PoolAllocate : public Pass { struct PoolAllocate : public Pass {
const char *getPassName() const { return "Pool Allocate"; }
PoolAllocate() { PoolAllocate() {
switch (ReqPointerSize) { switch (ReqPointerSize) {
case Ptr32bits: POINTERTYPE = Type::UIntTy; break; case Ptr32bits: POINTERTYPE = Type::UIntTy; break;
@ -316,6 +314,9 @@ namespace {
map<DSNode*, PoolInfo> &PoolDescs); map<DSNode*, PoolInfo> &PoolDescs);
}; };
RegisterPass<PoolAllocate> X("poolalloc",
"Pool allocate disjoint datastructures");
} }
// isNotPoolableAlloc - This is a predicate that returns true if the specified // isNotPoolableAlloc - This is a predicate that returns true if the specified

View File

@ -12,11 +12,13 @@
using std::vector; using std::vector;
struct EmitFunctionTable : public Pass { namespace {
const char *getPassName() const { return "EmitFunctionTablePass"; } struct EmitFunctionTable : public Pass {
bool run(Module &M);
bool run(Module &M); };
};
RegisterPass<EmitFunctionTable> X("emitfuncs", "Emit a Function Table");
}
// Create a new pass to add function table // Create a new pass to add function table
// //

View File

@ -37,8 +37,6 @@
using std::vector; using std::vector;
struct ProfilePaths : public FunctionPass { struct ProfilePaths : public FunctionPass {
const char *getPassName() const { return "ProfilePaths"; }
bool runOnFunction(Function &F); bool runOnFunction(Function &F);
// Before this pass, make sure that there is only one // Before this pass, make sure that there is only one
@ -49,6 +47,8 @@ struct ProfilePaths : public FunctionPass {
} }
}; };
static RegisterPass<ProfilePaths> X("paths", "Profile Paths");
// createProfilePathsPass - Create a new pass to add path profiling // createProfilePathsPass - Create a new pass to add path profiling
// //
Pass *createProfilePathsPass() { Pass *createProfilePathsPass() {

View File

@ -43,8 +43,6 @@ class ADCE : public FunctionPass {
// The public interface for this class // The public interface for this class
// //
public: public:
const char *getPassName() const { return "Aggressive Dead Code Elimination"; }
// Execute the Aggressive Dead Code Elimination Algorithm // Execute the Aggressive Dead Code Elimination Algorithm
// //
virtual bool runOnFunction(Function &F) { virtual bool runOnFunction(Function &F) {
@ -86,11 +84,11 @@ private:
} }
}; };
RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
} // End of anonymous namespace } // End of anonymous namespace
Pass *createAggressiveDCEPass() { return new ADCE(); } Pass *createAggressiveDCEPass() { return new ADCE(); }
void ADCE::markBlockAlive(BasicBlock *BB) { void ADCE::markBlockAlive(BasicBlock *BB) {
// Mark the basic block as being newly ALIVE... and mark all branches that // Mark the basic block as being newly ALIVE... and mark all branches that
// this block is control dependant on as being alive also... // this block is control dependant on as being alive also...

View File

@ -24,14 +24,14 @@ static Statistic<> NumInstKilled("constprop - Number of instructions killed");
namespace { namespace {
struct ConstantPropogation : public FunctionPass { struct ConstantPropogation : public FunctionPass {
const char *getPassName() const { return "Simple Constant Propogation"; }
bool runOnFunction(Function &F); bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG(); AU.preservesCFG();
} }
}; };
RegisterPass<ConstantPropogation> X("constprop", "Simple constant propogation");
} }
Pass *createConstantPropogationPass() { Pass *createConstantPropogationPass() {

View File

@ -26,8 +26,6 @@ static Statistic<> DCEEliminated("dce\t\t- Number of insts removed");
namespace { namespace {
struct DeadInstElimination : public BasicBlockPass { struct DeadInstElimination : public BasicBlockPass {
const char *getPassName() const { return "Dead Instruction Elimination"; }
virtual bool runOnBasicBlock(BasicBlock &BB) { virtual bool runOnBasicBlock(BasicBlock &BB) {
bool Changed = false; bool Changed = false;
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
@ -43,6 +41,8 @@ namespace {
AU.preservesCFG(); AU.preservesCFG();
} }
}; };
RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination");
} }
Pass *createDeadInstEliminationPass() { Pass *createDeadInstEliminationPass() {
@ -57,14 +57,14 @@ Pass *createDeadInstEliminationPass() {
namespace { namespace {
struct DCE : public FunctionPass { struct DCE : public FunctionPass {
const char *getPassName() const { return "Dead Code Elimination"; }
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG(); AU.preservesCFG();
} }
}; };
RegisterPass<DCE> Y("dce", "Dead Code Elimination");
} }
bool DCE::runOnFunction(Function &F) { bool DCE::runOnFunction(Function &F) {

View File

@ -21,13 +21,14 @@ static Statistic<> NumAdded("lowerrefs\t\t- New instructions added");
namespace { namespace {
struct DecomposePass : public BasicBlockPass { struct DecomposePass : public BasicBlockPass {
const char *getPassName() const { return "Decompose Subscripting Exps"; }
virtual bool runOnBasicBlock(BasicBlock &BB); virtual bool runOnBasicBlock(BasicBlock &BB);
private: private:
static void decomposeArrayRef(BasicBlock::iterator &BBI); static void decomposeArrayRef(BasicBlock::iterator &BBI);
}; };
RegisterPass<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
"structure/array references");
} }
Pass *createDecomposeMultiDimRefsPass() { Pass *createDecomposeMultiDimRefsPass() {

View File

@ -42,10 +42,6 @@ namespace {
// //
map<BasicBlock*, bool> BBContainsStore; map<BasicBlock*, bool> BBContainsStore;
public: public:
const char *getPassName() const {
return "Global Common Subexpression Elimination";
}
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
// Visitation methods, these are invoked depending on the type of // Visitation methods, these are invoked depending on the type of
@ -87,6 +83,8 @@ namespace {
AU.addRequired(ImmediateDominators::ID); AU.addRequired(ImmediateDominators::ID);
} }
}; };
RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination");
} }
// createGCSEPass - The public interface to this file... // createGCSEPass - The public interface to this file...

View File

@ -184,10 +184,6 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
namespace { namespace {
struct InductionVariableSimplify : public FunctionPass { struct InductionVariableSimplify : public FunctionPass {
const char *getPassName() const {
return "Induction Variable Cannonicalize";
}
virtual bool runOnFunction(Function &) { virtual bool runOnFunction(Function &) {
LoopInfo &LI = getAnalysis<LoopInfo>(); LoopInfo &LI = getAnalysis<LoopInfo>();
@ -202,9 +198,10 @@ namespace {
AU.preservesCFG(); AU.preservesCFG();
} }
}; };
RegisterPass<InductionVariableSimplify> X("indvars",
"Cannonicalize Induction Variables");
} }
Pass *createIndVarSimplifyPass() { Pass *createIndVarSimplifyPass() {
return new InductionVariableSimplify(); return new InductionVariableSimplify();
} }

View File

@ -46,8 +46,6 @@ namespace {
} }
public: public:
const char *getPassName() const { return "Instruction Combining"; }
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@ -80,6 +78,8 @@ namespace {
// visitInstruction - Specify what to return for unhandled instructions... // visitInstruction - Specify what to return for unhandled instructions...
Instruction *visitInstruction(Instruction &I) { return 0; } Instruction *visitInstruction(Instruction &I) { return 0; }
}; };
RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions");
} }

View File

@ -34,8 +34,6 @@ static Statistic<> NumHoistedPH("licm\t\t- Number of insts hoisted to a loop "
namespace { namespace {
struct LICM : public FunctionPass, public InstVisitor<LICM> { struct LICM : public FunctionPass, public InstVisitor<LICM> {
const char *getPassName() const { return "Loop Invariant Code Motion"; }
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
// This transformation requires natural loop information... // This transformation requires natural loop information...
@ -104,6 +102,8 @@ namespace {
hoist(I); hoist(I);
} }
}; };
RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
} }
Pass *createLICMPass() { return new LICM(); } Pass *createLICMPass() { return new LICM(); }

View File

@ -40,8 +40,6 @@ static Statistic<> NumInserted("pinodes\t\t- Number of Pi nodes inserted");
namespace { namespace {
struct PiNodeInserter : public FunctionPass { struct PiNodeInserter : public FunctionPass {
const char *getPassName() const { return "Pi Node Insertion"; }
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@ -56,6 +54,8 @@ namespace {
// //
bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0); bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0);
}; };
RegisterPass<PiNodeInserter> X("pinodes", "Pi Node Insertion");
} }
Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); } Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }

View File

@ -35,10 +35,6 @@ namespace {
class Reassociate : public FunctionPass { class Reassociate : public FunctionPass {
map<BasicBlock*, unsigned> RankMap; map<BasicBlock*, unsigned> RankMap;
public: public:
const char *getPassName() const {
return "Expression Reassociation";
}
bool runOnFunction(Function &F); bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@ -50,6 +46,8 @@ namespace {
bool ReassociateExpr(BinaryOperator *I); bool ReassociateExpr(BinaryOperator *I);
bool ReassociateBB(BasicBlock *BB); bool ReassociateBB(BasicBlock *BB);
}; };
RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
} }
Pass *createReassociatePass() { return new Reassociate(); } Pass *createReassociatePass() { return new Reassociate(); }

View File

@ -94,10 +94,6 @@ class SCCP : public FunctionPass, public InstVisitor<SCCP> {
std::vector<BasicBlock*> BBWorkList; // The BasicBlock work list std::vector<BasicBlock*> BBWorkList; // The BasicBlock work list
public: public:
const char *getPassName() const {
return "Sparse Conditional Constant Propogation";
}
// runOnFunction - Run the Sparse Conditional Constant Propogation algorithm, // runOnFunction - Run the Sparse Conditional Constant Propogation algorithm,
// and return true if the function was modified. // and return true if the function was modified.
// //
@ -223,6 +219,8 @@ private:
visit(I); visit(I);
} }
}; };
RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propogation");
} // end anonymous namespace } // end anonymous namespace
@ -233,7 +231,6 @@ Pass *createSCCPPass() {
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// SCCP Class Implementation // SCCP Class Implementation

View File

@ -24,10 +24,9 @@ static Statistic<> NumSimpl("cfgsimplify\t- Number of blocks simplified");
namespace { namespace {
struct CFGSimplifyPass : public FunctionPass { struct CFGSimplifyPass : public FunctionPass {
const char *getPassName() const { return "Simplify CFG"; }
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
}; };
RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
} }
Pass *createCFGSimplificationPass() { Pass *createCFGSimplificationPass() {

View File

@ -44,8 +44,6 @@ static bool StripSymbolTable(SymbolTable *SymTab) {
namespace { namespace {
struct SymbolStripping : public FunctionPass { struct SymbolStripping : public FunctionPass {
const char *getPassName() const { return "Strip Symbols from Functions"; }
virtual bool runOnFunction(Function &F) { virtual bool runOnFunction(Function &F) {
return StripSymbolTable(F.getSymbolTable()); return StripSymbolTable(F.getSymbolTable());
} }
@ -53,13 +51,15 @@ namespace {
AU.setPreservesAll(); AU.setPreservesAll();
} }
}; };
RegisterPass<SymbolStripping> X("strip", "Strip symbols from functions");
struct FullSymbolStripping : public SymbolStripping { struct FullSymbolStripping : public SymbolStripping {
const char *getPassName() const { return "Strip Symbols from Module"; }
virtual bool doInitialization(Module &M) { virtual bool doInitialization(Module &M) {
return StripSymbolTable(M.getSymbolTable()); return StripSymbolTable(M.getSymbolTable());
} }
}; };
RegisterPass<FullSymbolStripping> Y("mstrip",
"Strip symbols from module and functions");
} }
Pass *createSymbolStrippingPass() { Pass *createSymbolStrippingPass() {

View File

@ -47,8 +47,6 @@ namespace {
map<BasicBlock*,vector<PHINode*> > NewPhiNodes; // the PhiNodes we're adding map<BasicBlock*,vector<PHINode*> > NewPhiNodes; // the PhiNodes we're adding
public: public:
const char *getPassName() const { return "Promote Memory to Register"; }
// runOnFunction - To run this pass, first we calculate the alloca // runOnFunction - To run this pass, first we calculate the alloca
// instructions that are safe for promotion, then we promote each one. // instructions that are safe for promotion, then we promote each one.
// //
@ -68,6 +66,7 @@ namespace {
void FindSafeAllocas(Function &F); void FindSafeAllocas(Function &F);
}; };
RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
} // end of anonymous namespace } // end of anonymous namespace

View File

@ -17,6 +17,8 @@ using std::vector;
AnalysisID UnifyFunctionExitNodes::ID(AnalysisID::create<UnifyFunctionExitNodes>()); 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 // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
// BasicBlock, and converting all returns to unconditional branches to this // BasicBlock, and converting all returns to unconditional branches to this