Change create*Pass factory functions to return Pass* instead of

LoopPass*.
 - Although less precise, this means they can be used in clients
   without RTTI (who would otherwise need to include LoopPass.h, which
   eventually includes things using dynamic_cast). This was the
   simplest solution that presented itself, but I am happy to use a
   better one if available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2008-10-22 23:32:42 +00:00
parent 30f100e140
commit 394f0441e0
10 changed files with 18 additions and 19 deletions

View File

@ -18,7 +18,6 @@
namespace llvm { namespace llvm {
class FunctionPass; class FunctionPass;
class LoopPass;
class Pass; class Pass;
class GetElementPtrInst; class GetElementPtrInst;
class PassInfo; class PassInfo;
@ -81,7 +80,7 @@ FunctionPass *createScalarReplAggregatesPass(signed Threshold = -1);
// InductionVariableSimplify - Transform induction variables in a program to all // InductionVariableSimplify - Transform induction variables in a program to all
// use a single canonical induction variable per loop. // use a single canonical induction variable per loop.
// //
LoopPass *createIndVarSimplifyPass(); Pass *createIndVarSimplifyPass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
@ -101,7 +100,7 @@ FunctionPass *createInstructionCombiningPass();
// //
// LICM - This pass is a loop invariant code motion and memory promotion pass. // LICM - This pass is a loop invariant code motion and memory promotion pass.
// //
LoopPass *createLICMPass(); Pass *createLICMPass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
@ -110,32 +109,32 @@ LoopPass *createLICMPass();
// optional parameter used to consult the target machine whether certain // optional parameter used to consult the target machine whether certain
// transformations are profitable. // transformations are profitable.
// //
LoopPass *createLoopStrengthReducePass(const TargetLowering *TLI = 0); Pass *createLoopStrengthReducePass(const TargetLowering *TLI = 0);
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// LoopUnswitch - This pass is a simple loop unswitching pass. // LoopUnswitch - This pass is a simple loop unswitching pass.
// //
LoopPass *createLoopUnswitchPass(bool OptimizeForSize = false); Pass *createLoopUnswitchPass(bool OptimizeForSize = false);
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// LoopUnroll - This pass is a simple loop unrolling pass. // LoopUnroll - This pass is a simple loop unrolling pass.
// //
LoopPass *createLoopUnrollPass(); Pass *createLoopUnrollPass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// LoopRotate - This pass is a simple loop rotating pass. // LoopRotate - This pass is a simple loop rotating pass.
// //
LoopPass *createLoopRotatePass(); Pass *createLoopRotatePass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// LoopIndexSplit - This pass divides loop's iteration range by spliting loop // LoopIndexSplit - This pass divides loop's iteration range by spliting loop
// such that each individual loop is executed efficiently. // such that each individual loop is executed efficiently.
// //
LoopPass *createLoopIndexSplitPass(); Pass *createLoopIndexSplitPass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
@ -274,7 +273,7 @@ FunctionPass *createBlockPlacementPass();
// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
// optimizations. // optimizations.
// //
LoopPass *createLCSSAPass(); Pass *createLCSSAPass();
extern const PassInfo *const LCSSAID; extern const PassInfo *const LCSSAID;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -310,7 +309,7 @@ FunctionPass *createMemCpyOptPass();
// LoopDeletion - This pass performs DCE of non-infinite loops that it // LoopDeletion - This pass performs DCE of non-infinite loops that it
// can prove are dead. // can prove are dead.
// //
LoopPass *createLoopDeletionPass(); Pass *createLoopDeletionPass();
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //

View File

@ -102,7 +102,7 @@ char IndVarSimplify::ID = 0;
static RegisterPass<IndVarSimplify> static RegisterPass<IndVarSimplify>
X("indvars", "Canonicalize Induction Variables"); X("indvars", "Canonicalize Induction Variables");
LoopPass *llvm::createIndVarSimplifyPass() { Pass *llvm::createIndVarSimplifyPass() {
return new IndVarSimplify(); return new IndVarSimplify();
} }

View File

@ -230,7 +230,7 @@ namespace {
char LICM::ID = 0; char LICM::ID = 0;
static RegisterPass<LICM> X("licm", "Loop Invariant Code Motion"); static RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
LoopPass *llvm::createLICMPass() { return new LICM(); } Pass *llvm::createLICMPass() { return new LICM(); }
/// Hoist expressions out of the specified loop. Note, alias info for inner /// Hoist expressions out of the specified loop. Note, alias info for inner
/// loop is not preserved so it is not a good idea to run LICM multiple /// loop is not preserved so it is not a good idea to run LICM multiple

View File

@ -60,7 +60,7 @@ namespace {
char LoopDeletion::ID = 0; char LoopDeletion::ID = 0;
static RegisterPass<LoopDeletion> X("loop-deletion", "Delete dead loops"); static RegisterPass<LoopDeletion> X("loop-deletion", "Delete dead loops");
LoopPass* llvm::createLoopDeletionPass() { Pass* llvm::createLoopDeletionPass() {
return new LoopDeletion(); return new LoopDeletion();
} }

View File

@ -205,7 +205,7 @@ char LoopIndexSplit::ID = 0;
static RegisterPass<LoopIndexSplit> static RegisterPass<LoopIndexSplit>
X("loop-index-split", "Index Split Loops"); X("loop-index-split", "Index Split Loops");
LoopPass *llvm::createLoopIndexSplitPass() { Pass *llvm::createLoopIndexSplitPass() {
return new LoopIndexSplit(); return new LoopIndexSplit();
} }

View File

@ -107,7 +107,7 @@ namespace {
char LoopRotate::ID = 0; char LoopRotate::ID = 0;
static RegisterPass<LoopRotate> X("loop-rotate", "Rotate Loops"); static RegisterPass<LoopRotate> X("loop-rotate", "Rotate Loops");
LoopPass *llvm::createLoopRotatePass() { return new LoopRotate(); } Pass *llvm::createLoopRotatePass() { return new LoopRotate(); }
/// Rotate Loop L as many times as possible. Return true if /// Rotate Loop L as many times as possible. Return true if
/// loop is rotated at least once. /// loop is rotated at least once.

View File

@ -213,7 +213,7 @@ char LoopStrengthReduce::ID = 0;
static RegisterPass<LoopStrengthReduce> static RegisterPass<LoopStrengthReduce>
X("loop-reduce", "Loop Strength Reduction"); X("loop-reduce", "Loop Strength Reduction");
LoopPass *llvm::createLoopStrengthReducePass(const TargetLowering *TLI) { Pass *llvm::createLoopStrengthReducePass(const TargetLowering *TLI) {
return new LoopStrengthReduce(TLI); return new LoopStrengthReduce(TLI);
} }

View File

@ -73,7 +73,7 @@ namespace {
char LoopUnroll::ID = 0; char LoopUnroll::ID = 0;
static RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops"); static RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops");
LoopPass *llvm::createLoopUnrollPass() { return new LoopUnroll(); } Pass *llvm::createLoopUnrollPass() { return new LoopUnroll(); }
/// ApproximateLoopSize - Approximate the size of the loop. /// ApproximateLoopSize - Approximate the size of the loop.
static unsigned ApproximateLoopSize(const Loop *L) { static unsigned ApproximateLoopSize(const Loop *L) {

View File

@ -154,7 +154,7 @@ namespace {
char LoopUnswitch::ID = 0; char LoopUnswitch::ID = 0;
static RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops"); static RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops");
LoopPass *llvm::createLoopUnswitchPass(bool Os) { Pass *llvm::createLoopUnswitchPass(bool Os) {
return new LoopUnswitch(Os); return new LoopUnswitch(Os);
} }

View File

@ -99,7 +99,7 @@ namespace {
char LCSSA::ID = 0; char LCSSA::ID = 0;
static RegisterPass<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass"); static RegisterPass<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass");
LoopPass *llvm::createLCSSAPass() { return new LCSSA(); } Pass *llvm::createLCSSAPass() { return new LCSSA(); }
const PassInfo *const llvm::LCSSAID = &X; const PassInfo *const llvm::LCSSAID = &X;
/// runOnFunction - Process all loops in the function, inner-most out. /// runOnFunction - Process all loops in the function, inner-most out.