From 0e63653ab0d25d579ad99948db606d8723d271dd Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 5 Aug 2010 23:42:04 +0000 Subject: Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/BreakCriticalEdges.cpp | 4 ++-- lib/Transforms/Utils/InstructionNamer.cpp | 4 ++-- lib/Transforms/Utils/LCSSA.cpp | 4 ++-- lib/Transforms/Utils/LoopSimplify.cpp | 4 ++-- lib/Transforms/Utils/LowerInvoke.cpp | 4 ++-- lib/Transforms/Utils/LowerSwitch.cpp | 4 ++-- lib/Transforms/Utils/Mem2Reg.cpp | 4 ++-- lib/Transforms/Utils/SSI.cpp | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lib/Transforms/Utils') diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index baa114b..424d878 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -36,7 +36,7 @@ STATISTIC(NumBroken, "Number of blocks inserted"); namespace { struct BreakCriticalEdges : public FunctionPass { static char ID; // Pass identification, replacement for typeid - BreakCriticalEdges() : FunctionPass(&ID) {} + BreakCriticalEdges() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F); @@ -57,7 +57,7 @@ static RegisterPass X("break-crit-edges", "Break critical edges in CFG"); // Publically exposed interface to pass... -const PassInfo *const llvm::BreakCriticalEdgesID = &X; +char &llvm::BreakCriticalEdgesID = BreakCriticalEdges::ID; FunctionPass *llvm::createBreakCriticalEdgesPass() { return new BreakCriticalEdges(); } diff --git a/lib/Transforms/Utils/InstructionNamer.cpp b/lib/Transforms/Utils/InstructionNamer.cpp index 090af95..81a7101 100644 --- a/lib/Transforms/Utils/InstructionNamer.cpp +++ b/lib/Transforms/Utils/InstructionNamer.cpp @@ -23,7 +23,7 @@ using namespace llvm; namespace { struct InstNamer : public FunctionPass { static char ID; // Pass identification, replacement for typeid - InstNamer() : FunctionPass(&ID) {} + InstNamer() : FunctionPass(ID) {} void getAnalysisUsage(AnalysisUsage &Info) const { Info.setPreservesAll(); @@ -53,7 +53,7 @@ namespace { } -const PassInfo *const llvm::InstructionNamerID = &X; +char &llvm::InstructionNamerID = InstNamer::ID; //===----------------------------------------------------------------------===// // // InstructionNamer - Give any unnamed non-void instructions "tmp" names. diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index d380e0d..bf3695d 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -47,7 +47,7 @@ STATISTIC(NumLCSSA, "Number of live out of a loop variables"); namespace { struct LCSSA : public LoopPass { static char ID; // Pass identification, replacement for typeid - LCSSA() : LoopPass(&ID) {} + LCSSA() : LoopPass(ID) {} // Cached analysis information for the current function. DominatorTree *DT; @@ -93,7 +93,7 @@ char LCSSA::ID = 0; static RegisterPass X("lcssa", "Loop-Closed SSA Form Pass"); Pass *llvm::createLCSSAPass() { return new LCSSA(); } -const PassInfo *const llvm::LCSSAID = &X; +char &llvm::LCSSAID = LCSSA::ID; /// BlockDominatesAnExit - Return true if the specified block dominates at least diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index 1571fe8..16902ff 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -65,7 +65,7 @@ STATISTIC(NumNested , "Number of nested loops split out"); namespace { struct LoopSimplify : public LoopPass { static char ID; // Pass identification, replacement for typeid - LoopSimplify() : LoopPass(&ID) {} + LoopSimplify() : LoopPass(ID) {} // AA - If we have an alias analysis object to update, this is it, otherwise // this is null. @@ -110,7 +110,7 @@ static RegisterPass X("loopsimplify", "Canonicalize natural loops", true); // Publically exposed interface to pass... -const PassInfo *const llvm::LoopSimplifyID = &X; +char &llvm::LoopSimplifyID = LoopSimplify::ID; Pass *llvm::createLoopSimplifyPass() { return new LoopSimplify(); } /// runOnLoop - Run down all loops in the CFG (recursively, but we could do diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 2696e69..f239a99 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -78,7 +78,7 @@ namespace { static char ID; // Pass identification, replacement for typeid explicit LowerInvoke(const TargetLowering *tli = NULL, bool useExpensiveEHSupport = ExpensiveEHSupport) - : FunctionPass(&ID), useExpensiveEHSupport(useExpensiveEHSupport), + : FunctionPass(ID), useExpensiveEHSupport(useExpensiveEHSupport), TLI(tli) { } bool doInitialization(Module &M); bool runOnFunction(Function &F); @@ -103,7 +103,7 @@ char LowerInvoke::ID = 0; static RegisterPass X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators"); -const PassInfo *const llvm::LowerInvokePassID = &X; +char &llvm::LowerInvokePassID = LowerInvoke::ID; // Public Interface To the LowerInvoke pass. FunctionPass *llvm::createLowerInvokePass(const TargetLowering *TLI) { diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index 468a5fe..1910fd9 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -34,7 +34,7 @@ namespace { class LowerSwitch : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - LowerSwitch() : FunctionPass(&ID) {} + LowerSwitch() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F); @@ -85,7 +85,7 @@ static RegisterPass X("lowerswitch", "Lower SwitchInst's to branches"); // Publically exposed interface to pass... -const PassInfo *const llvm::LowerSwitchID = &X; +char &llvm::LowerSwitchID = LowerSwitch::ID; // createLowerSwitchPass - Interface to this file... FunctionPass *llvm::createLowerSwitchPass() { return new LowerSwitch(); diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp index 99203b6..13dda65 100644 --- a/lib/Transforms/Utils/Mem2Reg.cpp +++ b/lib/Transforms/Utils/Mem2Reg.cpp @@ -27,7 +27,7 @@ STATISTIC(NumPromoted, "Number of alloca's promoted"); namespace { struct PromotePass : public FunctionPass { static char ID; // Pass identification, replacement for typeid - PromotePass() : FunctionPass(&ID) {} + PromotePass() : FunctionPass(ID) {} // runOnFunction - To run this pass, first we calculate the alloca // instructions that are safe for promotion, then we promote each one. @@ -82,7 +82,7 @@ bool PromotePass::runOnFunction(Function &F) { } // Publically exposed interface to pass... -const PassInfo *const llvm::PromoteMemoryToRegisterID = &X; +char &llvm::PromoteMemoryToRegisterID = PromotePass::ID; // createPromoteMemoryToRegister - Provide an entry point to create this pass. // FunctionPass *llvm::createPromoteMemoryToRegisterPass() { diff --git a/lib/Transforms/Utils/SSI.cpp b/lib/Transforms/Utils/SSI.cpp index 62a93e4..81523d3 100644 --- a/lib/Transforms/Utils/SSI.cpp +++ b/lib/Transforms/Utils/SSI.cpp @@ -399,7 +399,7 @@ INITIALIZE_PASS(SSI, "ssi", namespace { struct SSIEverything : public FunctionPass { static char ID; // Pass identification, replacement for typeid - SSIEverything() : FunctionPass(&ID) {} + SSIEverything() : FunctionPass(ID) {} bool runOnFunction(Function &F); -- cgit v1.1