Convert optimizations to use the Pass infrastructure

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-10-18 01:31:58 +00:00
parent 6db0f4795c
commit 475369e255
6 changed files with 108 additions and 43 deletions

View File

@@ -7,19 +7,21 @@
#ifndef LLVM_OPT_CONSTANT_PROPOGATION_H
#define LLVM_OPT_CONSTANT_PROPOGATION_H
#include "llvm/Module.h"
class Method;
#include "llvm/Transforms/Pass.h"
class TerminatorInst;
namespace opt {
// DoConstantPropogation - Do trivial constant propogation and expression
// folding
bool DoConstantPropogation(Method *M);
struct ConstantPropogation : public StatelessPass<ConstantPropogation> {
// doConstantPropogation - Do trivial constant propogation and expression
// folding
static bool doConstantPropogation(Method *M);
inline static bool doPerMethodWork(Method *M) {
return doConstantPropogation(M);
}
};
static inline bool DoConstantPropogation(Module *M) {
return M->reduceApply(DoConstantPropogation);
}
// ConstantFoldTerminator - If a terminator instruction is predicated on a
@@ -33,10 +35,13 @@ bool ConstantFoldTerminator(TerminatorInst *T);
// Sparse Conditional Constant Propogation Pass
//
bool DoSCCP(Method *M);
static inline bool DoSCCP(Module *M) {
return M->reduceApply(DoSCCP);
}
struct SCCPPass : public StatelessPass<SCCPPass> {
static bool doSCCP(Method *M);
inline static bool doPerMethodWork(Method *M) {
return doSCCP(M);
}
};
} // End Namespace opt