Convert to new simpler pass structure

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-18 05:21:56 +00:00
parent edcf6491a8
commit b44523bd9d
6 changed files with 25 additions and 30 deletions

View File

@ -51,8 +51,8 @@ namespace opt {
return DoRaiseRepresentation(M, Level::Highest); return DoRaiseRepresentation(M, Level::Highest);
} }
struct RaiseRepresentation : public StatelessPass<RaiseRepresentation> { struct RaiseRepresentation : public Pass {
inline static bool doPerMethodWork(Method *M) { virtual bool doPerMethodWork(Method *M) {
return DoRaiseRepresentation(M); return DoRaiseRepresentation(M);
} }
}; };

View File

@ -13,13 +13,13 @@ class CallInst;
namespace opt { namespace opt {
struct MethodInlining : public StatelessPass<MethodInlining> { struct MethodInlining : public Pass {
// DoMethodInlining - Use a heuristic based approach to inline methods that // DoMethodInlining - Use a heuristic based approach to inline methods that
// seem to look good. // seem to look good.
// //
static bool doMethodInlining(Method *M); static bool doMethodInlining(Method *M);
inline static bool doPerMethodWork(Method *M) { virtual bool doPerMethodWork(Method *M) {
return doMethodInlining(M); return doMethodInlining(M);
} }
}; };

View File

@ -12,12 +12,12 @@ class TerminatorInst;
namespace opt { namespace opt {
struct ConstantPropogation : public StatelessPass<ConstantPropogation> { struct ConstantPropogation : public Pass {
// doConstantPropogation - Do trivial constant propogation and expression // doConstantPropogation - Do trivial constant propogation and expression
// folding // folding
static bool doConstantPropogation(Method *M); static bool doConstantPropogation(Method *M);
inline static bool doPerMethodWork(Method *M) { inline bool doPerMethodWork(Method *M) {
return doConstantPropogation(M); return doConstantPropogation(M);
} }
}; };
@ -34,11 +34,10 @@ bool ConstantFoldTerminator(TerminatorInst *T);
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Sparse Conditional Constant Propogation Pass // Sparse Conditional Constant Propogation Pass
// //
struct SCCPPass : public Pass {
struct SCCPPass : public StatelessPass<SCCPPass> {
static bool doSCCP(Method *M); static bool doSCCP(Method *M);
inline static bool doPerMethodWork(Method *M) { inline bool doPerMethodWork(Method *M) {
return doSCCP(M); return doSCCP(M);
} }
}; };

View File

@ -12,7 +12,7 @@
namespace opt { namespace opt {
struct DeadCodeElimination : public StatelessPass<DeadCodeElimination> { struct DeadCodeElimination : public Pass {
// External Interface: // External Interface:
// //
static bool doDCE(Method *M); static bool doDCE(Method *M);
@ -32,23 +32,23 @@ struct DeadCodeElimination : public StatelessPass<DeadCodeElimination> {
// static bool RemoveUnusedGlobalValuesAfterLink(Module *M); // TODO // static bool RemoveUnusedGlobalValuesAfterLink(Module *M); // TODO
// Pass Interface... // Pass Interface...
inline static bool doPassInitialization(Module *M) { virtual bool doPassInitialization(Module *M) {
return RemoveUnusedGlobalValues(M); return RemoveUnusedGlobalValues(M);
} }
inline static bool doPerMethodWork(Method *M) { return doDCE(M); } virtual bool doPerMethodWork(Method *M) { return doDCE(M); }
inline static bool doPassFinalization(Module *M) { virtual bool doPassFinalization(Module *M) {
return RemoveUnusedGlobalValues(M); return RemoveUnusedGlobalValues(M);
} }
}; };
struct AgressiveDCE : public StatelessPass<AgressiveDCE> { struct AgressiveDCE : public Pass {
// DoADCE - Execute the Agressive Dead Code Elimination Algorithm // DoADCE - Execute the Agressive Dead Code Elimination Algorithm
// //
static bool doADCE(Method *M); // Defined in ADCE.cpp static bool doADCE(Method *M); // Defined in ADCE.cpp
inline static bool doPerMethodWork(Method *M) { virtual bool doPerMethodWork(Method *M) {
return doADCE(M); return doADCE(M);
} }
}; };

View File

@ -13,17 +13,13 @@
namespace opt { namespace opt {
// DoInductionVariableCannonicalize - Simplify induction variables in loops struct InductionVariableCannonicalize : public Pass {
// // doInductionVariableCannonicalize - Simplify induction variables in loops
bool DoInductionVariableCannonicalize(Method *M); //
static inline bool DoInductionVariableCannonicalize(Module *M) { static bool doIt(Method *M);
return M->reduceApply(DoInductionVariableCannonicalize);
}
struct InductionVariableCannonicalize : virtual bool doPerMethodWork(Method *M) {
public StatelessPass<InductionVariableCannonicalize> { return doIt(M);
inline static bool doPerMethodWork(Method *M) {
return DoInductionVariableCannonicalize(M);
} }
}; };

View File

@ -14,28 +14,28 @@ class Module;
namespace opt { namespace opt {
struct SymbolStripping : public StatelessPass<SymbolStripping> { struct SymbolStripping : public Pass {
// doSymbolStripping - Remove all symbolic information from a method // doSymbolStripping - Remove all symbolic information from a method
// //
static bool doSymbolStripping(Method *M); static bool doSymbolStripping(Method *M);
inline static bool doPerMethodWork(Method *M) { virtual bool doPerMethodWork(Method *M) {
return doSymbolStripping(M); return doSymbolStripping(M);
} }
}; };
struct FullSymbolStripping : public StatelessPass<FullSymbolStripping> { struct FullSymbolStripping : public Pass {
// doStripGlobalSymbols - Remove all symbolic information from all methods // doStripGlobalSymbols - Remove all symbolic information from all methods
// in a module, and all module level symbols. (method names, etc...) // in a module, and all module level symbols. (method names, etc...)
// //
static bool doStripGlobalSymbols(Module *M); static bool doStripGlobalSymbols(Module *M);
inline static bool doPassInitialization(Module *M) { virtual bool doPassInitialization(Module *M) {
return doStripGlobalSymbols(M); return doStripGlobalSymbols(M);
} }
inline static bool doPerMethodWork(Method *M) { virtual bool doPerMethodWork(Method *M) {
return SymbolStripping::doSymbolStripping(M); return SymbolStripping::doSymbolStripping(M);
} }
}; };