Change over to use new style pass mechanism, now passes only expose small

creation functions in their public header file, unless they can help it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-02-26 21:46:54 +00:00
parent 3b2541424f
commit bd0ef77cde
32 changed files with 528 additions and 512 deletions

View File

@@ -7,26 +7,19 @@
#ifndef LLVM_TRANSFORMS_SCALAR_CONSTANT_PROPOGATION_H
#define LLVM_TRANSFORMS_SCALAR_CONSTANT_PROPOGATION_H
#include "llvm/Pass.h"
#include "llvm/BasicBlock.h"
class TerminatorInst;
class Pass;
struct ConstantPropogation : public MethodPass {
// doConstantPropogation - Do trivial constant propogation and expression
// folding
static bool doConstantPropogation(Method *M);
// doConstantPropogation - Constant prop a specific instruction. Returns true
// and potentially moves the iterator if constant propogation was performed.
//
static bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &I);
inline bool runOnMethod(Method *M) {
return doConstantPropogation(M);
}
};
//===----------------------------------------------------------------------===//
// Normal Constant Propogation Pass
//
Pass *createConstantPropogationPass();
// doConstantPropogation - Constant prop a specific instruction. Returns true
// and potentially moves the iterator if constant propogation was performed.
//
bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &I);
// ConstantFoldTerminator - If a terminator instruction is predicated on a
// constant value, convert it into an unconditional branch to the constant
@@ -38,12 +31,6 @@ bool ConstantFoldTerminator(TerminatorInst *T);
//===----------------------------------------------------------------------===//
// Sparse Conditional Constant Propogation Pass
//
struct SCCPPass : public MethodPass {
static bool doSCCP(Method *M);
inline bool runOnMethod(Method *M) {
return doSCCP(M);
}
};
Pass *createSCCPPass();
#endif

View File

@@ -5,21 +5,19 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_OPT_DCE_H
#define LLVM_OPT_DCE_H
#ifndef LLVM_TRANSFORMS_SCALAR_DCE_H
#define LLVM_TRANSFORMS_SCALAR_DCE_H
#include "llvm/Pass.h"
#include "llvm/Method.h"
#include "llvm/BasicBlock.h"
class Pass;
//===----------------------------------------------------------------------===//
// DeadInstElimination - This pass quickly removes trivially dead instructions
// without modifying the CFG of the function. It is a BasicBlockPass, so it
// runs efficiently when queued next to other BasicBlockPass's.
//
struct DeadInstElimination : public BasicBlockPass {
virtual bool runOnBasicBlock(BasicBlock *BB);
};
Pass *createDeadInstEliminationPass();
//===----------------------------------------------------------------------===//
@@ -32,34 +30,16 @@ struct DeadInstElimination : public BasicBlockPass {
// otherwise simplifies control flow. This should be factored out of this pass
// eventually into it's own pass.
//
struct DeadCodeElimination : public MethodPass {
// External Interface:
//
static bool doDCE(Method *M);
// dceInstruction - Inspect the instruction at *BBI and figure out if it's
// [trivially] dead. If so, remove the instruction and update the iterator
// to point to the instruction that immediately succeeded the original
// instruction.
//
static bool dceInstruction(BasicBlock::InstListType &BBIL,
BasicBlock::iterator &BBI);
Pass *createDeadCodeEliminationPass();
// Remove unused global values - This removes unused global values of no
// possible value. This currently includes unused method prototypes and
// unitialized global variables.
//
static bool RemoveUnusedGlobalValues(Module *M);
// Pass Interface...
virtual bool doInitialization(Module *M) {
return RemoveUnusedGlobalValues(M);
}
virtual bool runOnMethod(Method *M) { return doDCE(M); }
virtual bool doFinalization(Module *M) {
return RemoveUnusedGlobalValues(M);
}
};
// dceInstruction - Inspect the instruction at *BBI and figure out if it's
// [trivially] dead. If so, remove the instruction and update the iterator
// to point to the instruction that immediately succeeded the original
// instruction.
//
bool dceInstruction(BasicBlock::InstListType &BBIL,
BasicBlock::iterator &BBI);
@@ -68,15 +48,7 @@ struct DeadCodeElimination : public MethodPass {
// algorithm assumes instructions are dead until proven otherwise, which makes
// it more successful are removing non-obviously dead instructions.
//
struct AgressiveDCE : public MethodPass {
virtual bool runOnMethod(Method *M);
// getAnalysisUsageInfo - We require post dominance frontiers (aka Control
// Dependence Graph)
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
Pass::AnalysisSet &Destroyed,
Pass::AnalysisSet &Provided);
};
Pass *createAgressiveDCEPass();
// SimplifyCFG - This function is used to do simplification of a CFG. For

View File

@@ -8,18 +8,7 @@
#ifndef LLVM_TRANSFORMS_SCALAR_INDVARSIMPLIFY_H
#define LLVM_TRANSFORMS_SCALAR_INDVARSIMPLIFY_H
#include "llvm/Pass.h"
namespace cfg { class LoopInfo; }
struct InductionVariableSimplify : public MethodPass {
static bool doit(Method *M, cfg::LoopInfo &Loops);
virtual bool runOnMethod(Method *M);
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
Pass::AnalysisSet &Destroyed,
Pass::AnalysisSet &Provided);
};
class Pass;
Pass *createIndVarSimplifyPass();
#endif

View File

@@ -15,14 +15,7 @@
#ifndef LLVM_TRANSFORMS_SCALAR_INSTRUCTIONCOMBINING_H
#define LLVM_TRANSFORMS_SCALAR_INSTRUCTIONCOMBINING_H
#include "llvm/Pass.h"
class Instruction;
struct InstructionCombining : public MethodPass {
static bool doit(Method *M);
static bool CombineInstruction(Instruction *I);
virtual bool runOnMethod(Method *M) { return doit(M); }
};
class Pass;
Pass *createInstructionCombiningPass();
#endif

View File

@@ -5,35 +5,12 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_OPT_SYMBOL_STRIPPING_H
#define LLVM_OPT_SYMBOL_STRIPPING_H
#ifndef LLVM_TRANSFORMS_SYMBOL_STRIPPING_H
#define LLVM_TRANSFORMS_SYMBOL_STRIPPING_H
#include "llvm/Pass.h"
class Pass;
struct SymbolStripping : public MethodPass {
// doSymbolStripping - Remove all symbolic information from a method
//
static bool doSymbolStripping(Method *M);
virtual bool runOnMethod(Method *M) {
return doSymbolStripping(M);
}
};
struct FullSymbolStripping : public MethodPass {
// doStripGlobalSymbols - Remove all symbolic information from all methods
// in a module, and all module level symbols. (method names, etc...)
//
static bool doStripGlobalSymbols(Module *M);
virtual bool doInitialization(Module *M) {
return doStripGlobalSymbols(M);
}
virtual bool runOnMethod(Method *M) {
return SymbolStripping::doSymbolStripping(M);
}
};
Pass *createSymbolStrippingPass();
Pass *createFullSymbolStrippingPass();
#endif