From 1f74590e9d1b9cf0f1f81a156efea73f76546e05 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 6 Aug 2010 00:23:35 +0000 Subject: [PATCH] Revert r110396 to fix buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DOTGraphTraitsPass.h | 4 +- include/llvm/Analysis/Dominators.h | 6 +- include/llvm/Analysis/FindUsedTypes.h | 2 +- include/llvm/Analysis/IntervalPartition.h | 2 +- include/llvm/Analysis/LazyValueInfo.h | 2 +- include/llvm/Analysis/LibCallAliasAnalysis.h | 8 +- .../llvm/Analysis/LoopDependenceAnalysis.h | 2 +- include/llvm/Analysis/LoopInfo.h | 2 +- include/llvm/Analysis/LoopPass.h | 3 +- include/llvm/Analysis/Passes.h | 4 +- include/llvm/Analysis/PostDominators.h | 4 +- include/llvm/CallGraphSCCPass.h | 3 +- include/llvm/CodeGen/CalcSpillWeights.h | 2 +- include/llvm/CodeGen/LiveIntervalAnalysis.h | 2 +- include/llvm/CodeGen/LiveStackAnalysis.h | 2 +- include/llvm/CodeGen/LiveVariables.h | 2 +- include/llvm/CodeGen/MachineFunctionPass.h | 3 +- include/llvm/CodeGen/MachineLoopInfo.h | 2 +- include/llvm/CodeGen/Passes.h | 16 ++-- include/llvm/CodeGen/ProcessImplicitDefs.h | 2 +- include/llvm/CodeGen/SlotIndexes.h | 2 +- include/llvm/Pass.h | 42 ++++++---- include/llvm/PassAnalysisSupport.h | 47 ++++++----- include/llvm/PassManagers.h | 4 +- include/llvm/PassRegistry.h | 6 +- include/llvm/PassSupport.h | 22 ++--- include/llvm/Target/TargetData.h | 4 +- include/llvm/Transforms/IPO/InlinerPass.h | 4 +- include/llvm/Transforms/Scalar.h | 16 ++-- include/llvm/Transforms/Utils/SSI.h | 2 +- .../Transforms/Utils/UnifyFunctionExitNodes.h | 2 +- lib/Analysis/AliasAnalysisCounter.cpp | 6 +- lib/Analysis/AliasAnalysisEvaluator.cpp | 2 +- lib/Analysis/AliasDebugger.cpp | 6 +- lib/Analysis/AliasSetTracker.cpp | 2 +- lib/Analysis/BasicAliasAnalysis.cpp | 6 +- lib/Analysis/CFGPrinter.cpp | 12 +-- lib/Analysis/DbgInfoPrinter.cpp | 2 +- lib/Analysis/DomPrinter.cpp | 16 ++-- lib/Analysis/IPA/CallGraph.cpp | 6 +- lib/Analysis/IPA/CallGraphSCCPass.cpp | 6 +- lib/Analysis/IPA/GlobalsModRef.cpp | 6 +- lib/Analysis/IVUsers.cpp | 2 +- lib/Analysis/InstCount.cpp | 2 +- lib/Analysis/IntervalPartition.cpp | 2 +- lib/Analysis/Lint.cpp | 2 +- lib/Analysis/LiveValues.cpp | 2 +- lib/Analysis/LoopPass.cpp | 6 +- lib/Analysis/MemoryDependenceAnalysis.cpp | 2 +- lib/Analysis/ModuleDebugInfoPrinter.cpp | 2 +- lib/Analysis/PointerTracking.cpp | 2 +- lib/Analysis/ProfileEstimatorPass.cpp | 8 +- lib/Analysis/ProfileInfo.cpp | 6 +- lib/Analysis/ProfileInfoLoaderPass.cpp | 8 +- lib/Analysis/ProfileVerifierPass.cpp | 4 +- lib/Analysis/RegionInfo.cpp | 2 +- lib/Analysis/RegionPrinter.cpp | 8 +- lib/Analysis/ScalarEvolution.cpp | 2 +- lib/Analysis/ScalarEvolutionAliasAnalysis.cpp | 6 +- lib/Analysis/TypeBasedAliasAnalysis.cpp | 6 +- lib/Bitcode/Writer/BitcodeWriterPass.cpp | 2 +- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +- lib/CodeGen/BranchFolding.cpp | 2 +- lib/CodeGen/CodePlacementOpt.cpp | 2 +- lib/CodeGen/DeadMachineInstructionElim.cpp | 2 +- lib/CodeGen/DwarfEHPrepare.cpp | 2 +- lib/CodeGen/ELFWriter.cpp | 2 +- lib/CodeGen/GCMetadata.cpp | 8 +- lib/CodeGen/GCStrategy.cpp | 4 +- lib/CodeGen/IfConversion.cpp | 2 +- lib/CodeGen/LowerSubregs.cpp | 2 +- lib/CodeGen/MachineCSE.cpp | 2 +- lib/CodeGen/MachineDominators.cpp | 4 +- lib/CodeGen/MachineFunctionAnalysis.cpp | 4 +- lib/CodeGen/MachineFunctionPrinterPass.cpp | 2 +- lib/CodeGen/MachineLICM.cpp | 4 +- lib/CodeGen/MachineLoopInfo.cpp | 2 +- lib/CodeGen/MachineModuleInfo.cpp | 4 +- lib/CodeGen/MachineSink.cpp | 2 +- lib/CodeGen/MachineVerifier.cpp | 2 +- lib/CodeGen/OptimizeExts.cpp | 2 +- lib/CodeGen/OptimizePHIs.cpp | 2 +- lib/CodeGen/PHIElimination.cpp | 2 +- lib/CodeGen/PHIElimination.h | 2 +- lib/CodeGen/PostRASchedulerList.cpp | 2 +- lib/CodeGen/PreAllocSplitting.cpp | 4 +- lib/CodeGen/PrologEpilogInserter.h | 2 +- lib/CodeGen/RegAllocFast.cpp | 2 +- lib/CodeGen/RegAllocLinearScan.cpp | 2 +- lib/CodeGen/RegAllocPBQP.cpp | 2 +- lib/CodeGen/RenderMachineFunction.h | 2 +- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 +- lib/CodeGen/SimpleRegisterCoalescing.cpp | 2 +- lib/CodeGen/SimpleRegisterCoalescing.h | 2 +- lib/CodeGen/SjLjEHPrepare.cpp | 2 +- lib/CodeGen/Splitter.h | 2 +- lib/CodeGen/StackProtector.cpp | 4 +- lib/CodeGen/StackSlotColoring.cpp | 4 +- lib/CodeGen/StrongPHIElimination.cpp | 4 +- lib/CodeGen/TailDuplication.cpp | 2 +- lib/CodeGen/TwoAddressInstructionPass.cpp | 4 +- lib/CodeGen/UnreachableBlockElim.cpp | 6 +- lib/CodeGen/VirtRegMap.h | 2 +- lib/Target/ARM/ARMCodeEmitter.cpp | 2 +- lib/Target/ARM/ARMConstantIslandPass.cpp | 2 +- lib/Target/ARM/ARMExpandPseudoInsts.cpp | 2 +- lib/Target/ARM/ARMGlobalMerge.cpp | 2 +- lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 4 +- lib/Target/ARM/NEONMoveFix.cpp | 2 +- lib/Target/ARM/NEONPreAllocPass.cpp | 2 +- lib/Target/ARM/Thumb2ITBlockPass.cpp | 2 +- lib/Target/ARM/Thumb2SizeReduction.cpp | 2 +- lib/Target/Alpha/AlphaBranchSelector.cpp | 2 +- lib/Target/Alpha/AlphaCodeEmitter.cpp | 2 +- lib/Target/Alpha/AlphaLLRP.cpp | 2 +- lib/Target/CBackend/CBackend.cpp | 4 +- lib/Target/CppBackend/CPPBackend.cpp | 2 +- lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp | 2 +- lib/Target/MSIL/MSILWriter.h | 4 +- lib/Target/MSP430/MSP430BranchSelector.cpp | 2 +- lib/Target/Mips/MipsDelaySlotFiller.cpp | 2 +- lib/Target/PIC16/PIC16MemSelOpt.cpp | 2 +- lib/Target/PIC16/PIC16Passes/PIC16Cloner.h | 2 +- lib/Target/PIC16/PIC16Passes/PIC16Overlay.h | 2 +- lib/Target/PowerPC/PPCBranchSelector.cpp | 2 +- lib/Target/PowerPC/PPCCodeEmitter.cpp | 2 +- lib/Target/Sparc/DelaySlotFiller.cpp | 2 +- lib/Target/Sparc/FPMover.cpp | 2 +- lib/Target/TargetData.cpp | 4 +- lib/Target/X86/SSEDomainFix.cpp | 2 +- lib/Target/X86/X86CodeEmitter.cpp | 4 +- lib/Target/X86/X86FloatingPoint.cpp | 2 +- lib/Target/X86/X86InstrInfo.cpp | 2 +- lib/Target/X86/X86RegisterInfo.cpp | 2 +- lib/Transforms/Hello/Hello.cpp | 4 +- lib/Transforms/IPO/ArgumentPromotion.cpp | 2 +- lib/Transforms/IPO/ConstantMerge.cpp | 2 +- .../IPO/DeadArgumentElimination.cpp | 6 +- lib/Transforms/IPO/DeadTypeElimination.cpp | 2 +- lib/Transforms/IPO/ExtractGV.cpp | 2 +- lib/Transforms/IPO/FunctionAttrs.cpp | 2 +- lib/Transforms/IPO/GlobalDCE.cpp | 2 +- lib/Transforms/IPO/GlobalOpt.cpp | 2 +- lib/Transforms/IPO/IPConstantPropagation.cpp | 2 +- lib/Transforms/IPO/InlineAlways.cpp | 2 +- lib/Transforms/IPO/InlineSimple.cpp | 4 +- lib/Transforms/IPO/Inliner.cpp | 4 +- lib/Transforms/IPO/Internalize.cpp | 4 +- lib/Transforms/IPO/LoopExtractor.cpp | 4 +- lib/Transforms/IPO/LowerSetJmp.cpp | 2 +- lib/Transforms/IPO/MergeFunctions.cpp | 2 +- lib/Transforms/IPO/PartialInlining.cpp | 2 +- lib/Transforms/IPO/PartialSpecialization.cpp | 2 +- lib/Transforms/IPO/PruneEH.cpp | 2 +- lib/Transforms/IPO/StripDeadPrototypes.cpp | 2 +- lib/Transforms/IPO/StripSymbols.cpp | 8 +- lib/Transforms/IPO/StructRetPromotion.cpp | 2 +- lib/Transforms/InstCombine/InstCombine.h | 2 +- .../Instrumentation/EdgeProfiling.cpp | 2 +- .../Instrumentation/OptimalEdgeProfiling.cpp | 2 +- lib/Transforms/Scalar/ABCD.cpp | 2 +- lib/Transforms/Scalar/ADCE.cpp | 2 +- lib/Transforms/Scalar/BasicBlockPlacement.cpp | 2 +- lib/Transforms/Scalar/CodeGenPrepare.cpp | 2 +- lib/Transforms/Scalar/ConstantProp.cpp | 2 +- lib/Transforms/Scalar/DCE.cpp | 4 +- .../Scalar/DeadStoreElimination.cpp | 2 +- lib/Transforms/Scalar/GEPSplitter.cpp | 2 +- lib/Transforms/Scalar/GVN.cpp | 2 +- lib/Transforms/Scalar/IndVarSimplify.cpp | 2 +- lib/Transforms/Scalar/JumpThreading.cpp | 2 +- lib/Transforms/Scalar/LICM.cpp | 2 +- lib/Transforms/Scalar/LoopDeletion.cpp | 2 +- lib/Transforms/Scalar/LoopIndexSplit.cpp | 2 +- lib/Transforms/Scalar/LoopRotation.cpp | 2 +- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 2 +- lib/Transforms/Scalar/LoopUnrollPass.cpp | 2 +- lib/Transforms/Scalar/LoopUnswitch.cpp | 2 +- lib/Transforms/Scalar/LowerAtomic.cpp | 2 +- lib/Transforms/Scalar/MemCpyOptimizer.cpp | 2 +- lib/Transforms/Scalar/Reassociate.cpp | 2 +- lib/Transforms/Scalar/Reg2Mem.cpp | 4 +- lib/Transforms/Scalar/SCCP.cpp | 4 +- .../Scalar/ScalarReplAggregates.cpp | 2 +- lib/Transforms/Scalar/SimplifyCFGPass.cpp | 2 +- .../Scalar/SimplifyHalfPowrLibCalls.cpp | 2 +- lib/Transforms/Scalar/SimplifyLibCalls.cpp | 2 +- lib/Transforms/Scalar/Sink.cpp | 2 +- lib/Transforms/Scalar/TailDuplication.cpp | 2 +- .../Scalar/TailRecursionElimination.cpp | 2 +- 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 +- lib/VMCore/Pass.cpp | 55 ++++++------ lib/VMCore/PassManager.cpp | 84 ++++++++----------- lib/VMCore/PassRegistry.cpp | 6 +- lib/VMCore/PrintModulePass.cpp | 8 +- lib/VMCore/Verifier.cpp | 12 +-- tools/bugpoint/ExtractFunction.cpp | 3 +- tools/bugpoint/TestPasses.cpp | 4 +- tools/bugpoint/bugpoint.cpp | 3 +- tools/llvm-prof/llvm-prof.cpp | 2 +- tools/opt/AnalysisWrappers.cpp | 4 +- tools/opt/GraphPrinters.cpp | 4 +- tools/opt/PrintSCC.cpp | 4 +- tools/opt/opt.cpp | 33 ++++---- unittests/VMCore/PassManagerTest.cpp | 12 +-- 212 files changed, 476 insertions(+), 480 deletions(-) diff --git a/include/llvm/Analysis/DOTGraphTraitsPass.h b/include/llvm/Analysis/DOTGraphTraitsPass.h index d8daf5196fc..4828eba5b52 100644 --- a/include/llvm/Analysis/DOTGraphTraitsPass.h +++ b/include/llvm/Analysis/DOTGraphTraitsPass.h @@ -22,7 +22,7 @@ template struct DOTGraphTraitsViewer : public FunctionPass { std::string Name; - DOTGraphTraitsViewer(std::string GraphName, char &ID) : FunctionPass(ID) { + DOTGraphTraitsViewer(std::string GraphName, const void *ID) : FunctionPass(ID) { Name = GraphName; } @@ -48,7 +48,7 @@ struct DOTGraphTraitsPrinter : public FunctionPass { std::string Name; - DOTGraphTraitsPrinter(std::string GraphName, char &ID) + DOTGraphTraitsPrinter(std::string GraphName, const void *ID) : FunctionPass(ID) { Name = GraphName; } diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 73c6e6286b5..f79afdd1e9c 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -702,7 +702,7 @@ public: static char ID; // Pass ID, replacement for typeid DominatorTreeBase* DT; - DominatorTree() : FunctionPass(ID) { + DominatorTree() : FunctionPass(&ID) { DT = new DominatorTreeBase(false); } @@ -890,7 +890,7 @@ protected: const bool IsPostDominators; public: - DominanceFrontierBase(char &ID, bool isPostDom) + DominanceFrontierBase(void *ID, bool isPostDom) : FunctionPass(ID), IsPostDominators(isPostDom) {} /// getRoots - Return the root blocks of the current CFG. This may include @@ -1009,7 +1009,7 @@ class DominanceFrontier : public DominanceFrontierBase { public: static char ID; // Pass ID, replacement for typeid DominanceFrontier() : - DominanceFrontierBase(ID, false) {} + DominanceFrontierBase(&ID, false) {} BasicBlock *getRoot() const { assert(Roots.size() == 1 && "Should always have entry node!"); diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 8a78eb62497..1337385848e 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -26,7 +26,7 @@ class FindUsedTypes : public ModulePass { std::set UsedTypes; public: static char ID; // Pass identification, replacement for typeid - FindUsedTypes() : ModulePass(ID) {} + FindUsedTypes() : ModulePass(&ID) {} /// getTypes - After the pass has been run, return the set containing all of /// the types used in the module. diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 75a5cdf1f99..c1214e7427a 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -48,7 +48,7 @@ class IntervalPartition : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - IntervalPartition() : FunctionPass(ID), RootInterval(0) {} + IntervalPartition() : FunctionPass(&ID), RootInterval(0) {} // run - Calculate the interval partition for this function virtual bool runOnFunction(Function &F); diff --git a/include/llvm/Analysis/LazyValueInfo.h b/include/llvm/Analysis/LazyValueInfo.h index ac164c19c95..f59b2e35322 100644 --- a/include/llvm/Analysis/LazyValueInfo.h +++ b/include/llvm/Analysis/LazyValueInfo.h @@ -31,7 +31,7 @@ class LazyValueInfo : public FunctionPass { void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT. public: static char ID; - LazyValueInfo() : FunctionPass(ID), PImpl(0) {} + LazyValueInfo() : FunctionPass(&ID), PImpl(0) {} ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); } /// Tristate - This is used to return true/false/dunno results. diff --git a/include/llvm/Analysis/LibCallAliasAnalysis.h b/include/llvm/Analysis/LibCallAliasAnalysis.h index c9adf3f36ad..37abb77dc2f 100644 --- a/include/llvm/Analysis/LibCallAliasAnalysis.h +++ b/include/llvm/Analysis/LibCallAliasAnalysis.h @@ -28,9 +28,9 @@ namespace llvm { LibCallInfo *LCI; explicit LibCallAliasAnalysis(LibCallInfo *LC = 0) - : FunctionPass(ID), LCI(LC) { + : FunctionPass(&ID), LCI(LC) { } - explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC) + explicit LibCallAliasAnalysis(const void *ID, LibCallInfo *LC) : FunctionPass(ID), LCI(LC) { } ~LibCallAliasAnalysis(); @@ -55,8 +55,8 @@ namespace llvm { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(const void *PI) { - if (PI == &AliasAnalysis::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) return (AliasAnalysis*)this; return this; } diff --git a/include/llvm/Analysis/LoopDependenceAnalysis.h b/include/llvm/Analysis/LoopDependenceAnalysis.h index 94fd9907090..a1a563796f5 100644 --- a/include/llvm/Analysis/LoopDependenceAnalysis.h +++ b/include/llvm/Analysis/LoopDependenceAnalysis.h @@ -91,7 +91,7 @@ class LoopDependenceAnalysis : public LoopPass { public: static char ID; // Class identification, replacement for typeinfo - LoopDependenceAnalysis() : LoopPass(ID) {} + LoopDependenceAnalysis() : LoopPass(&ID) {} /// isDependencePair - Check whether two values can possibly give rise to /// a data dependence: that is the case if both are instructions accessing diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 462620f7e3c..2e90a9631fb 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -940,7 +940,7 @@ class LoopInfo : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - LoopInfo() : FunctionPass(ID) {} + LoopInfo() : FunctionPass(&ID) {} LoopInfoBase& getBase() { return LI; } diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 3e1c2a94180..6f77d019b69 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -28,7 +28,8 @@ class PMStack; class LoopPass : public Pass { public: - explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {} + explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {} + explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {} /// getPrinterPass - Get a pass to print the function corresponding /// to a Loop. diff --git a/include/llvm/Analysis/Passes.h b/include/llvm/Analysis/Passes.h index 37425ebe835..e8e77960ad8 100644 --- a/include/llvm/Analysis/Passes.h +++ b/include/llvm/Analysis/Passes.h @@ -92,7 +92,7 @@ namespace llvm { // file. // ModulePass *createProfileLoaderPass(); - extern char &ProfileLoaderPassID; + extern const PassInfo *ProfileLoaderPassID; //===--------------------------------------------------------------------===// // @@ -106,7 +106,7 @@ namespace llvm { // instead of loading it from a previous run. // FunctionPass *createProfileEstimatorPass(); - extern char &ProfileEstimatorPassID; + extern const PassInfo *ProfileEstimatorPassID; //===--------------------------------------------------------------------===// // diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 46ce8200f96..5552017d918 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -25,7 +25,7 @@ struct PostDominatorTree : public FunctionPass { static char ID; // Pass identification, replacement for typeid DominatorTreeBase* DT; - PostDominatorTree() : FunctionPass(ID) { + PostDominatorTree() : FunctionPass(&ID) { DT = new DominatorTreeBase(true); } @@ -106,7 +106,7 @@ template <> struct GraphTraits struct PostDominanceFrontier : public DominanceFrontierBase { static char ID; PostDominanceFrontier() - : DominanceFrontierBase(ID, true) {} + : DominanceFrontierBase(&ID, true) {} virtual bool runOnFunction(Function &) { Frontiers.clear(); diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index 5fa8b0e574a..e11b9677c74 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -33,7 +33,8 @@ class CallGraphSCC; class CallGraphSCCPass : public Pass { public: - explicit CallGraphSCCPass(char &pid) : Pass(PT_CallGraphSCC, pid) {} + explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {} + explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, pid) {} /// createPrinterPass - Get a pass that prints the Module /// corresponding to a CallGraph. diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h index e5273c54977..2fc03bd41de 100644 --- a/include/llvm/CodeGen/CalcSpillWeights.h +++ b/include/llvm/CodeGen/CalcSpillWeights.h @@ -23,7 +23,7 @@ namespace llvm { public: static char ID; - CalculateSpillWeights() : MachineFunctionPass(ID) {} + CalculateSpillWeights() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index b154bf1b051..8a59bf1428a 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -68,7 +68,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid - LiveIntervals() : MachineFunctionPass(ID) {} + LiveIntervals() : MachineFunctionPass(&ID) {} // Calculate the spill weight to assign to a single instruction. static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth); diff --git a/include/llvm/CodeGen/LiveStackAnalysis.h b/include/llvm/CodeGen/LiveStackAnalysis.h index ad984db1899..c6af6a1f89c 100644 --- a/include/llvm/CodeGen/LiveStackAnalysis.h +++ b/include/llvm/CodeGen/LiveStackAnalysis.h @@ -39,7 +39,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid - LiveStacks() : MachineFunctionPass(ID) {} + LiveStacks() : MachineFunctionPass(&ID) {} typedef SS2IntervalMap::iterator iterator; typedef SS2IntervalMap::const_iterator const_iterator; diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index c8182e073b9..fc5ea6f968b 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -46,7 +46,7 @@ class TargetRegisterInfo; class LiveVariables : public MachineFunctionPass { public: static char ID; // Pass identification, replacement for typeid - LiveVariables() : MachineFunctionPass(ID) {} + LiveVariables() : MachineFunctionPass(&ID) {} /// VarInfo - This represents the regions where a virtual register is live in /// the program. We represent this with three different pieces of diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h index b7bf0a36c44..685e86824c3 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -31,7 +31,8 @@ class MachineFunction; /// override runOnMachineFunction. class MachineFunctionPass : public FunctionPass { protected: - explicit MachineFunctionPass(char &ID) : FunctionPass(ID) {} + explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {} + explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {} /// runOnMachineFunction - This method must be overloaded to perform the /// desired machine code transformation or analysis. diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h index 9760eba7b86..3b3e31e02af 100644 --- a/include/llvm/CodeGen/MachineLoopInfo.h +++ b/include/llvm/CodeGen/MachineLoopInfo.h @@ -67,7 +67,7 @@ class MachineLoopInfo : public MachineFunctionPass { public: static char ID; // Pass identification, replacement for typeid - MachineLoopInfo() : MachineFunctionPass(ID) {} + MachineLoopInfo() : MachineFunctionPass(&ID) {} LoopInfoBase& getBase() { return LI; } diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index 5c148536629..c881d74c110 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -43,18 +43,18 @@ namespace llvm { /// MachineLoopInfo pass - This pass is a loop analysis pass. /// - extern char &MachineLoopInfoID; + extern const PassInfo *const MachineLoopInfoID; /// MachineDominators pass - This pass is a machine dominators analysis pass. /// - extern char &MachineDominatorsID; + extern const PassInfo *const MachineDominatorsID; /// PHIElimination pass - This pass eliminates machine instruction PHI nodes /// by inserting copy instructions. This destroys SSA information, but is the /// desired input for some register allocators. This pass is "required" by /// these register allocator like this: AU.addRequiredID(PHIEliminationID); /// - extern char &PHIEliminationID; + extern const PassInfo *const PHIEliminationID; /// StrongPHIElimination pass - This pass eliminates machine instruction PHI /// nodes by inserting copy instructions. This destroys SSA information, but @@ -62,23 +62,23 @@ namespace llvm { /// "required" by these register allocator like this: /// AU.addRequiredID(PHIEliminationID); /// This pass is still in development - extern char &StrongPHIEliminationID; + extern const PassInfo *const StrongPHIEliminationID; - extern char &PreAllocSplittingID; + extern const PassInfo *const PreAllocSplittingID; /// SimpleRegisterCoalescing pass. Aggressively coalesces every register /// copy it can. /// - extern char &SimpleRegisterCoalescingID; + extern const PassInfo *const SimpleRegisterCoalescingID; /// TwoAddressInstruction pass - This pass reduces two-address instructions to /// use two operands. This destroys SSA information but it is desired by /// register allocators. - extern char &TwoAddressInstructionPassID; + extern const PassInfo *const TwoAddressInstructionPassID; /// UnreachableMachineBlockElimination pass - This pass removes unreachable /// machine basic blocks. - extern char &UnreachableMachineBlockElimID; + extern const PassInfo *const UnreachableMachineBlockElimID; /// DeadMachineInstructionElim pass - This pass removes dead machine /// instructions. diff --git a/include/llvm/CodeGen/ProcessImplicitDefs.h b/include/llvm/CodeGen/ProcessImplicitDefs.h index 1d743c1cba2..30477b9b80b 100644 --- a/include/llvm/CodeGen/ProcessImplicitDefs.h +++ b/include/llvm/CodeGen/ProcessImplicitDefs.h @@ -31,7 +31,7 @@ namespace llvm { public: static char ID; - ProcessImplicitDefs() : MachineFunctionPass(ID) {} + ProcessImplicitDefs() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h index fe3b0e2d5fe..f150d853fc6 100644 --- a/include/llvm/CodeGen/SlotIndexes.h +++ b/include/llvm/CodeGen/SlotIndexes.h @@ -475,7 +475,7 @@ namespace llvm { public: static char ID; - SlotIndexes() : MachineFunctionPass(ID), indexListHead(0) {} + SlotIndexes() : MachineFunctionPass(&ID), indexListHead(0) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; virtual void releaseMemory(); diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index e5c073cd941..5a5893140e0 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -50,7 +50,7 @@ class raw_ostream; class StringRef; // AnalysisID - Use the PassInfo to identify a pass... -typedef const void* AnalysisID; +typedef const PassInfo* AnalysisID; /// Different types of internal pass managers. External pass managers /// (PassManager and FunctionPassManager) are not represented here. @@ -82,13 +82,14 @@ enum PassKind { /// class Pass { AnalysisResolver *Resolver; // Used to resolve analysis - const void *PassID; + intptr_t PassID; PassKind Kind; void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(PassKind K, char &pid); + explicit Pass(PassKind K, intptr_t pid); + explicit Pass(PassKind K, const void *pid); virtual ~Pass(); @@ -100,10 +101,10 @@ public: /// virtual const char *getPassName() const; - /// getPassID - Return the PassID number that corresponds to this pass. - virtual AnalysisID getPassID() const { - return PassID; - } + /// getPassInfo - Return the PassInfo data structure that corresponds to this + /// pass... If the pass has not been registered, this will return null. + /// + const PassInfo *getPassInfo() const; /// print - Print out the internal state of the pass. This is called by /// Analyze to print out the contents of an analysis. Otherwise it is not @@ -158,7 +159,7 @@ public: /// an analysis interface through multiple inheritance. If needed, it should /// override this to adjust the this pointer as needed for the specified pass /// info. - virtual void *getAdjustedAnalysisPointer(AnalysisID ID); + virtual void *getAdjustedAnalysisPointer(const PassInfo *); virtual ImmutablePass *getAsImmutablePass(); virtual PMDataManager *getAsPMDataManager(); @@ -169,9 +170,14 @@ public: // dumpPassStructure - Implement the -debug-passes=PassStructure option virtual void dumpPassStructure(unsigned Offset = 0); + template + static const PassInfo *getClassPassInfo() { + return lookupPassInfo(intptr_t(&AnalysisClass::ID)); + } + // lookupPassInfo - Return the pass info object for the specified pass class, // or null if it is not known. - static const PassInfo *lookupPassInfo(const void *TI); + static const PassInfo *lookupPassInfo(intptr_t TI); // lookupPassInfo - Return the pass info object for the pass with the given // argument string, or null if it is not known. @@ -194,7 +200,7 @@ public: /// don't have the class name available (use getAnalysisIfAvailable if you /// do), but it can tell you if you need to preserve the pass at least. /// - bool mustPreserveAnalysisID(char &AID) const; + bool mustPreserveAnalysisID(const PassInfo *AnalysisID) const; /// getAnalysis() - This function is used by subclasses to get /// to the analysis information that they claim to use by overriding the @@ -207,10 +213,10 @@ public: AnalysisType &getAnalysis(Function &F); // Defined in PassAnalysisSupport.h template - AnalysisType &getAnalysisID(AnalysisID PI) const; + AnalysisType &getAnalysisID(const PassInfo *PI) const; template - AnalysisType &getAnalysisID(AnalysisID PI, Function &F); + AnalysisType &getAnalysisID(const PassInfo *PI, Function &F); }; @@ -234,7 +240,8 @@ public: /// Return what kind of Pass Manager can manage this pass. virtual PassManagerType getPotentialPassManagerType() const; - explicit ModulePass(char &pid) : Pass(PT_Module, pid) {} + explicit ModulePass(intptr_t pid) : Pass(PT_Module, pid) {} + explicit ModulePass(const void *pid) : Pass(PT_Module, pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -261,7 +268,8 @@ public: /// bool runOnModule(Module &) { return false; } - explicit ImmutablePass(char &pid) + explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {} + explicit ImmutablePass(const void *pid) : ModulePass(pid) {} // Force out-of-line virtual method. @@ -279,7 +287,8 @@ public: /// class FunctionPass : public Pass { public: - explicit FunctionPass(char &pid) : Pass(PT_Function, pid) {} + explicit FunctionPass(intptr_t pid) : Pass(PT_Function, pid) {} + explicit FunctionPass(const void *pid) : Pass(PT_Function, pid) {} /// createPrinterPass - Get a function printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; @@ -331,7 +340,8 @@ public: /// class BasicBlockPass : public Pass { public: - explicit BasicBlockPass(char &pid) : Pass(PT_BasicBlock, pid) {} + explicit BasicBlockPass(intptr_t pid) : Pass(PT_BasicBlock, pid) {} + explicit BasicBlockPass(const void *pid) : Pass(PT_BasicBlock, pid) {} /// createPrinterPass - Get a function printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h index a99a1ae8711..977d4f4e30d 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -49,37 +49,34 @@ public: // addRequired - Add the specified ID to the required set of the usage info // for a pass. // - AnalysisUsage &addRequiredID(const void *ID); - AnalysisUsage &addRequiredID(char &ID); + AnalysisUsage &addRequiredID(AnalysisID ID); template AnalysisUsage &addRequired() { - return addRequiredID(PassClass::ID); + return addRequiredID(Pass::getClassPassInfo()); } - AnalysisUsage &addRequiredTransitiveID(char &ID); + AnalysisUsage &addRequiredTransitiveID(AnalysisID ID); template AnalysisUsage &addRequiredTransitive() { - return addRequiredTransitiveID(PassClass::ID); + AnalysisID ID = Pass::getClassPassInfo(); + return addRequiredTransitiveID(ID); } // addPreserved - Add the specified ID to the set of analyses preserved by // this pass // - AnalysisUsage &addPreservedID(const void *ID) { + AnalysisUsage &addPreservedID(AnalysisID ID) { Preserved.push_back(ID); return *this; } - AnalysisUsage &addPreservedID(char &ID) { - Preserved.push_back(&ID); - return *this; - } // addPreserved - Add the specified Pass class to the set of analyses // preserved by this pass. // template AnalysisUsage &addPreserved() { - Preserved.push_back(&PassClass::ID); + assert(Pass::getClassPassInfo() && "Pass class not registered!"); + Preserved.push_back(Pass::getClassPassInfo()); return *this; } @@ -88,7 +85,12 @@ public: // This can be useful when a pass is trivially preserved, but may not be // linked in. Be careful about spelling! // - AnalysisUsage &addPreserved(StringRef Arg); + AnalysisUsage &addPreserved(StringRef Arg) { + const PassInfo *PI = Pass::lookupPassInfo(Arg); + // If the pass exists, preserve it. Otherwise silently do nothing. + if (PI) Preserved.push_back(PI); + return *this; + } // setPreservesAll - Set by analyses that do not transform their input at all void setPreservesAll() { PreservesAll = true; } @@ -128,7 +130,7 @@ public: inline PMDataManager &getPMDataManager() { return PM; } // Find pass that is implementing PI. - Pass *findImplPass(AnalysisID PI) { + Pass *findImplPass(const PassInfo *PI) { Pass *ResultPass = 0; for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) { if (AnalysisImpls[i].first == PI) { @@ -140,10 +142,10 @@ public: } // Find pass that is implementing PI. Initialize pass for Function F. - Pass *findImplPass(Pass *P, AnalysisID PI, Function &F); + Pass *findImplPass(Pass *P, const PassInfo *PI, Function &F); - void addAnalysisImplsPair(AnalysisID PI, Pass *P) { - std::pair pir = std::make_pair(PI,P); + void addAnalysisImplsPair(const PassInfo *PI, Pass *P) { + std::pair pir = std::make_pair(PI,P); AnalysisImpls.push_back(pir); } @@ -158,7 +160,7 @@ public: // AnalysisImpls - This keeps track of which passes implements the interfaces // that are required by the current pass (to implement getAnalysis()). - std::vector > AnalysisImpls; + std::vector > AnalysisImpls; private: // PassManager that is used to resolve analysis info @@ -177,7 +179,8 @@ template AnalysisType *Pass::getAnalysisIfAvailable() const { assert(Resolver && "Pass not resident in a PassManager object!"); - const void *PI = &AnalysisType::ID; + const PassInfo *PI = getClassPassInfo(); + if (PI == 0) return 0; Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true); if (ResultPass == 0) return 0; @@ -196,11 +199,11 @@ AnalysisType *Pass::getAnalysisIfAvailable() const { template AnalysisType &Pass::getAnalysis() const { assert(Resolver && "Pass has not been inserted into a PassManager object!"); - return getAnalysisID(&AnalysisType::ID); + return getAnalysisID(getClassPassInfo()); } template -AnalysisType &Pass::getAnalysisID(AnalysisID PI) const { +AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { assert(PI && "getAnalysis for unregistered pass!"); assert(Resolver&&"Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used @@ -226,11 +229,11 @@ template AnalysisType &Pass::getAnalysis(Function &F) { assert(Resolver &&"Pass has not been inserted into a PassManager object!"); - return getAnalysisID(&AnalysisType::ID, F); + return getAnalysisID(getClassPassInfo(), F); } template -AnalysisType &Pass::getAnalysisID(AnalysisID PI, Function &F) { +AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) { assert(PI && "getAnalysis for unregistered pass!"); assert(Resolver && "Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h index 1f9b9821d59..81b7e7af816 100644 --- a/include/llvm/PassManagers.h +++ b/include/llvm/PassManagers.h @@ -302,7 +302,7 @@ public: /// through getAnalysis interface. virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass); - virtual Pass *getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F); + virtual Pass *getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F); /// Initialize available analysis information. void initializeAnalysisInfo() { @@ -414,7 +414,7 @@ class FPPassManager : public ModulePass, public PMDataManager { public: static char ID; explicit FPPassManager(int Depth) - : ModulePass(ID), PMDataManager(Depth) { } + : ModulePass(&ID), PMDataManager(Depth) { } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. diff --git a/include/llvm/PassRegistry.h b/include/llvm/PassRegistry.h index 59071391520..193ecfd1b58 100644 --- a/include/llvm/PassRegistry.h +++ b/include/llvm/PassRegistry.h @@ -34,7 +34,7 @@ class PassRegistry { mutable sys::SmartMutex Lock; /// PassInfoMap - Keep track of the PassInfo object for each registered pass. - typedef std::map MapType; + typedef std::map MapType; MapType PassInfoMap; typedef StringMap StringMapType; @@ -51,14 +51,14 @@ class PassRegistry { public: static PassRegistry *getPassRegistry(); - const PassInfo *getPassInfo(const void *TI) const; + const PassInfo *getPassInfo(intptr_t TI) const; const PassInfo *getPassInfo(StringRef Arg) const; void registerPass(const PassInfo &PI); void unregisterPass(const PassInfo &PI); /// Analysis Group Mechanisms. - void registerAnalysisGroup(const void *InterfaceID, const void *PassID, + void registerAnalysisGroup(intptr_t InterfaceID, intptr_t PassID, PassInfo& Registeree, bool isDefault); void enumerateWith(PassRegistrationListener *L); diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index ee987131726..07dc7f1d15c 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -41,7 +41,7 @@ public: private: const char *const PassName; // Nice name for Pass const char *const PassArgument; // Command Line argument to run this pass - const void *PassID; + const intptr_t PassID; const bool IsCFGOnlyPass; // Pass only looks at the CFG. const bool IsAnalysis; // True if an analysis pass. const bool IsAnalysisGroup; // True if an analysis group. @@ -52,7 +52,7 @@ private: public: /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. - PassInfo(const char *name, const char *arg, const void *pi, + PassInfo(const char *name, const char *arg, intptr_t pi, NormalCtor_t normal = 0, bool isCFGOnly = false, bool is_analysis = false) : PassName(name), PassArgument(arg), PassID(pi), @@ -63,7 +63,7 @@ public: /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. This version is for use by analysis groups; it /// does not auto-register the pass. - PassInfo(const char *name, const void *pi) + PassInfo(const char *name, intptr_t pi) : PassName(name), PassArgument(""), PassID(pi), IsCFGOnlyPass(false), IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(0) { @@ -81,11 +81,11 @@ public: /// getTypeInfo - Return the id object for the pass... /// TODO : Rename - const void *getTypeInfo() const { return PassID; } + intptr_t getTypeInfo() const { return PassID; } /// Return true if this PassID implements the specified ID pointer. - bool isPassID(const void *IDPtr) const { - return PassID == IDPtr; + bool isPassID(void *IDPtr) const { + return PassID == (intptr_t)IDPtr; } /// isAnalysisGroup - Return true if this is an analysis group, not a normal @@ -161,7 +161,7 @@ struct RegisterPass : public PassInfo { // Register Pass using default constructor... RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false, bool is_analysis = false) - : PassInfo(Name, PassArg, &passName::ID, + : PassInfo(Name, PassArg, intptr_t(&passName::ID), PassInfo::NormalCtor_t(callDefaultCtor), CFGOnly, is_analysis) { @@ -191,8 +191,8 @@ struct RegisterPass : public PassInfo { class RegisterAGBase : public PassInfo { protected: RegisterAGBase(const char *Name, - const void *InterfaceID, - const void *PassID = 0, + intptr_t InterfaceID, + intptr_t PassID = 0, bool isDefault = false); }; @@ -200,12 +200,12 @@ template struct RegisterAnalysisGroup : public RegisterAGBase { explicit RegisterAnalysisGroup(PassInfo &RPB) : RegisterAGBase(RPB.getPassName(), - &Interface::ID, RPB.getTypeInfo(), + intptr_t(&Interface::ID), RPB.getTypeInfo(), Default) { } explicit RegisterAnalysisGroup(const char *Name) - : RegisterAGBase(Name, &Interface::ID) { + : RegisterAGBase(Name, intptr_t(&Interface::ID)) { } }; diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index f72461f803b..cc88dae9fa6 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -110,7 +110,7 @@ public: /// Constructs a TargetData from a specification string. See init(). explicit TargetData(StringRef TargetDescription) - : ImmutablePass(ID) { + : ImmutablePass(&ID) { init(TargetDescription); } @@ -118,7 +118,7 @@ public: explicit TargetData(const Module *M); TargetData(const TargetData &TD) : - ImmutablePass(ID), + ImmutablePass(&ID), LittleEndian(TD.isLittleEndian()), PointerMemSize(TD.PointerMemSize), PointerABIAlign(TD.PointerABIAlign), diff --git a/include/llvm/Transforms/IPO/InlinerPass.h b/include/llvm/Transforms/IPO/InlinerPass.h index 3ac4c591c94..6af7ed7bdbf 100644 --- a/include/llvm/Transforms/IPO/InlinerPass.h +++ b/include/llvm/Transforms/IPO/InlinerPass.h @@ -30,8 +30,8 @@ namespace llvm { /// perform the inlining operations that do not depend on the policy. /// struct Inliner : public CallGraphSCCPass { - explicit Inliner(char &ID); - explicit Inliner(char &ID, int Threshold); + explicit Inliner(void *ID); + explicit Inliner(void *ID, int Threshold); /// getAnalysisUsage - For this class, we declare that we require and preserve /// the call graph. If the derived class implements this method, it should diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index bd5b16999f7..4d1d8636f61 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -149,7 +149,7 @@ Pass *createLoopIndexSplitPass(); // ret i32 %Y // FunctionPass *createPromoteMemoryToRegisterPass(); -extern char &PromoteMemoryToRegisterID; +extern const PassInfo *const PromoteMemoryToRegisterID; //===----------------------------------------------------------------------===// // @@ -158,7 +158,7 @@ extern char &PromoteMemoryToRegisterID; // hacking easier. // FunctionPass *createDemoteRegisterToMemoryPass(); -extern char &DemoteRegisterToMemoryID; +extern const PassInfo *const DemoteRegisterToMemoryID; //===----------------------------------------------------------------------===// // @@ -202,7 +202,7 @@ FunctionPass *createCFGSimplificationPass(); // (set, immediate dominators, tree, and frontier) information. // FunctionPass *createBreakCriticalEdgesPass(); -extern char &BreakCriticalEdgesID; +extern const PassInfo *const BreakCriticalEdgesID; //===----------------------------------------------------------------------===// // @@ -213,7 +213,7 @@ extern char &BreakCriticalEdgesID; // AU.addRequiredID(LoopSimplifyID); // Pass *createLoopSimplifyPass(); -extern char &LoopSimplifyID; +extern const PassInfo *const LoopSimplifyID; //===----------------------------------------------------------------------===// // @@ -228,7 +228,7 @@ FunctionPass *createTailCallEliminationPass(); // chained binary branch instructions. // FunctionPass *createLowerSwitchPass(); -extern char &LowerSwitchID; +extern const PassInfo *const LowerSwitchID; //===----------------------------------------------------------------------===// // @@ -243,7 +243,7 @@ extern char &LowerSwitchID; FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0); FunctionPass *createLowerInvokePass(const TargetLowering *TLI, bool useExpensiveEHSupport); -extern char &LowerInvokePassID; +extern const PassInfo *const LowerInvokePassID; //===----------------------------------------------------------------------===// // @@ -258,7 +258,7 @@ FunctionPass *createBlockPlacementPass(); // optimizations. // Pass *createLCSSAPass(); -extern char &LCSSAID; +extern const PassInfo *const LCSSAID; //===----------------------------------------------------------------------===// // @@ -304,7 +304,7 @@ FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); // InstructionNamer - Give any unnamed non-void instructions "tmp" names. // FunctionPass *createInstructionNamerPass(); -extern char &InstructionNamerID; +extern const PassInfo *const InstructionNamerID; //===----------------------------------------------------------------------===// // diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h index 864e1197a9f..198fc827bb0 100644 --- a/include/llvm/Transforms/Utils/SSI.h +++ b/include/llvm/Transforms/Utils/SSI.h @@ -39,7 +39,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid. SSI() : - FunctionPass(ID) { + FunctionPass(&ID) { } void getAnalysisUsage(AnalysisUsage &AU) const; diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h index a5060e6f586..c2d09935e76 100644 --- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h +++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h @@ -26,7 +26,7 @@ struct UnifyFunctionExitNodes : public FunctionPass { BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock; public: static char ID; // Pass identification, replacement for typeid - UnifyFunctionExitNodes() : FunctionPass(ID), + UnifyFunctionExitNodes() : FunctionPass(&ID), ReturnBlock(0), UnwindBlock(0) {} // We can preserve non-critical-edgeness when we unify function exit nodes diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index b17804186a6..7631e3655f3 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -34,7 +34,7 @@ namespace { Module *M; public: static char ID; // Class identification, replacement for typeinfo - AliasAnalysisCounter() : ModulePass(ID) { + AliasAnalysisCounter() : ModulePass(&ID) { No = May = Must = 0; NoMR = JustRef = JustMod = MR = 0; } @@ -87,8 +87,8 @@ namespace { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &AliasAnalysis::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index ce363cbc7bb..76a452e2e7d 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -50,7 +50,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid - AAEval() : FunctionPass(ID) {} + AAEval() : FunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); diff --git a/lib/Analysis/AliasDebugger.cpp b/lib/Analysis/AliasDebugger.cpp index b9fe64608c0..8209bb624a2 100644 --- a/lib/Analysis/AliasDebugger.cpp +++ b/lib/Analysis/AliasDebugger.cpp @@ -39,7 +39,7 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo - AliasDebugger() : ModulePass(ID) {} + AliasDebugger() : ModulePass(&ID) {} bool runOnModule(Module &M) { InitializeAliasAnalysis(this); // set up super class @@ -83,8 +83,8 @@ namespace { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &AliasAnalysis::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 46d8ee6fab3..7e11ce6360b 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -579,7 +579,7 @@ namespace { AliasSetTracker *Tracker; public: static char ID; // Pass identification, replacement for typeid - AliasSetPrinter() : FunctionPass(ID) {} + AliasSetPrinter() : FunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 399f61b80b9..35a3bb94f75 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -137,8 +137,8 @@ namespace { /// struct NoAA : public ImmutablePass, public AliasAnalysis { static char ID; // Class identification, replacement for typeinfo - NoAA() : ImmutablePass(ID) {} - explicit NoAA(char &PID) : ImmutablePass(PID) { } + NoAA() : ImmutablePass(&ID) {} + explicit NoAA(void *PID) : ImmutablePass(PID) { } virtual void getAnalysisUsage(AnalysisUsage &AU) const { } @@ -215,7 +215,7 @@ namespace { /// derives from the NoAA class. struct BasicAliasAnalysis : public NoAA { static char ID; // Class identification, replacement for typeinfo - BasicAliasAnalysis() : NoAA(ID) {} + BasicAliasAnalysis() : NoAA(&ID) {} AliasResult alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index f28b2dc787d..da2f0a6dbf0 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -25,7 +25,7 @@ using namespace llvm; namespace { struct CFGViewer : public FunctionPass { static char ID; // Pass identifcation, replacement for typeid - CFGViewer() : FunctionPass(ID) {} + CFGViewer() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F) { F.viewCFG(); @@ -46,7 +46,7 @@ INITIALIZE_PASS(CFGViewer, "view-cfg", "View CFG of function", false, true); namespace { struct CFGOnlyViewer : public FunctionPass { static char ID; // Pass identifcation, replacement for typeid - CFGOnlyViewer() : FunctionPass(ID) {} + CFGOnlyViewer() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F) { F.viewCFGOnly(); @@ -68,8 +68,8 @@ INITIALIZE_PASS(CFGOnlyViewer, "view-cfg-only", namespace { struct CFGPrinter : public FunctionPass { static char ID; // Pass identification, replacement for typeid - CFGPrinter() : FunctionPass(ID) {} - explicit CFGPrinter(char &pid) : FunctionPass(pid) {} + CFGPrinter() : FunctionPass(&ID) {} + explicit CFGPrinter(void *pid) : FunctionPass(pid) {} virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getNameStr() + ".dot"; @@ -101,8 +101,8 @@ P1("dot-cfg", "Print CFG of function to 'dot' file", false, true); namespace { struct CFGOnlyPrinter : public FunctionPass { static char ID; // Pass identification, replacement for typeid - CFGOnlyPrinter() : FunctionPass(ID) {} - explicit CFGOnlyPrinter(char &pid) : FunctionPass(pid) {} + CFGOnlyPrinter() : FunctionPass(&ID) {} + explicit CFGOnlyPrinter(void *pid) : FunctionPass(pid) {} virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getNameStr() + ".dot"; errs() << "Writing '" << Filename << "'..."; diff --git a/lib/Analysis/DbgInfoPrinter.cpp b/lib/Analysis/DbgInfoPrinter.cpp index bdd9a26feac..aef79787715 100644 --- a/lib/Analysis/DbgInfoPrinter.cpp +++ b/lib/Analysis/DbgInfoPrinter.cpp @@ -40,7 +40,7 @@ namespace { void printVariableDeclaration(const Value *V); public: static char ID; // Pass identification - PrintDbgInfo() : FunctionPass(ID), Out(outs()) {} + PrintDbgInfo() : FunctionPass(&ID), Out(outs()) {} virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Analysis/DomPrinter.cpp b/lib/Analysis/DomPrinter.cpp index 9f340942f2c..83e39f1e6fc 100644 --- a/lib/Analysis/DomPrinter.cpp +++ b/lib/Analysis/DomPrinter.cpp @@ -86,27 +86,27 @@ namespace { struct DomViewer : public DOTGraphTraitsViewer { static char ID; - DomViewer() : DOTGraphTraitsViewer("dom", ID){} + DomViewer() : DOTGraphTraitsViewer("dom", &ID){} }; struct DomOnlyViewer : public DOTGraphTraitsViewer { static char ID; - DomOnlyViewer() : DOTGraphTraitsViewer("domonly", ID){} + DomOnlyViewer() : DOTGraphTraitsViewer("domonly", &ID){} }; struct PostDomViewer : public DOTGraphTraitsViewer { static char ID; PostDomViewer() : - DOTGraphTraitsViewer("postdom", ID){} + DOTGraphTraitsViewer("postdom", &ID){} }; struct PostDomOnlyViewer : public DOTGraphTraitsViewer { static char ID; PostDomOnlyViewer() : - DOTGraphTraitsViewer("postdomonly", ID){} + DOTGraphTraitsViewer("postdomonly", &ID){} }; } // end anonymous namespace @@ -133,27 +133,27 @@ namespace { struct DomPrinter : public DOTGraphTraitsPrinter { static char ID; - DomPrinter() : DOTGraphTraitsPrinter("dom", ID) {} + DomPrinter() : DOTGraphTraitsPrinter("dom", &ID) {} }; struct DomOnlyPrinter : public DOTGraphTraitsPrinter { static char ID; - DomOnlyPrinter() : DOTGraphTraitsPrinter("domonly", ID) {} + DomOnlyPrinter() : DOTGraphTraitsPrinter("domonly", &ID) {} }; struct PostDomPrinter : public DOTGraphTraitsPrinter { static char ID; PostDomPrinter() : - DOTGraphTraitsPrinter("postdom", ID) {} + DOTGraphTraitsPrinter("postdom", &ID) {} }; struct PostDomOnlyPrinter : public DOTGraphTraitsPrinter { static char ID; PostDomOnlyPrinter() : - DOTGraphTraitsPrinter("postdomonly", ID) {} + DOTGraphTraitsPrinter("postdomonly", &ID) {} }; } // end anonymous namespace diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index b3635283fda..1af0055ce54 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -42,7 +42,7 @@ class BasicCallGraph : public ModulePass, public CallGraph { public: static char ID; // Class identification, replacement for typeinfo - BasicCallGraph() : ModulePass(ID), Root(0), + BasicCallGraph() : ModulePass(&ID), Root(0), ExternalCallingNode(0), CallsExternalNode(0) {} // runOnModule - Compute the call graph for the specified module. @@ -86,8 +86,8 @@ public: /// an analysis interface through multiple inheritance. If needed, it should /// override this to adjust the this pointer as needed for the specified pass /// info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &CallGraph::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&CallGraph::ID)) return (CallGraph*)this; return this; } diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index b7a27cb288d..5c4b2c3a793 100644 --- a/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -45,7 +45,7 @@ class CGPassManager : public ModulePass, public PMDataManager { public: static char ID; explicit CGPassManager(int Depth) - : ModulePass(ID), PMDataManager(Depth) { } + : ModulePass(&ID), PMDataManager(Depth) { } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. @@ -582,9 +582,9 @@ namespace { public: static char ID; - PrintCallGraphPass() : CallGraphSCCPass(ID), Out(dbgs()) {} + PrintCallGraphPass() : CallGraphSCCPass(&ID), Out(dbgs()) {} PrintCallGraphPass(const std::string &B, raw_ostream &o) - : CallGraphSCCPass(ID), Banner(B), Out(o) {} + : CallGraphSCCPass(&ID), Banner(B), Out(o) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index 43a61d0f60a..769e4b177ec 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -88,7 +88,7 @@ namespace { public: static char ID; - GlobalsModRef() : ModulePass(ID) {} + GlobalsModRef() : ModulePass(&ID) {} bool runOnModule(Module &M) { InitializeAliasAnalysis(this); // set up super class @@ -150,8 +150,8 @@ namespace { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &AliasAnalysis::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/IVUsers.cpp b/lib/Analysis/IVUsers.cpp index bd43026015b..e2b67e8365e 100644 --- a/lib/Analysis/IVUsers.cpp +++ b/lib/Analysis/IVUsers.cpp @@ -140,7 +140,7 @@ IVStrideUse &IVUsers::AddUser(Instruction *User, Value *Operand) { } IVUsers::IVUsers() - : LoopPass(ID) { + : LoopPass(&ID) { } void IVUsers::getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index dcbcac005a2..6133b8827b3 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -51,7 +51,7 @@ namespace { } public: static char ID; // Pass identification, replacement for typeid - InstCount() : FunctionPass(ID) {} + InstCount() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F); diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp index 1c9e1488431..0f11e34b600 100644 --- a/lib/Analysis/IntervalPartition.cpp +++ b/lib/Analysis/IntervalPartition.cpp @@ -91,7 +91,7 @@ bool IntervalPartition::runOnFunction(Function &F) { // distinguish it from a copy constructor. Always pass in false for now. // IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) - : FunctionPass(ID) { + : FunctionPass(&ID) { assert(IP.getRootInterval() && "Cannot operate on empty IntervalPartitions!"); // Pass false to intervals_begin because we take ownership of it's memory diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp index a9d972435f5..fe01fd7b222 100644 --- a/lib/Analysis/Lint.cpp +++ b/lib/Analysis/Lint.cpp @@ -108,7 +108,7 @@ namespace { raw_string_ostream MessagesStr; static char ID; // Pass identification, replacement for typeid - Lint() : FunctionPass(ID), MessagesStr(Messages) {} + Lint() : FunctionPass(&ID), MessagesStr(Messages) {} virtual bool runOnFunction(Function &F); diff --git a/lib/Analysis/LiveValues.cpp b/lib/Analysis/LiveValues.cpp index 0225f4fa254..3cc58c4feef 100644 --- a/lib/Analysis/LiveValues.cpp +++ b/lib/Analysis/LiveValues.cpp @@ -25,7 +25,7 @@ char LiveValues::ID = 0; INITIALIZE_PASS(LiveValues, "live-values", "Value Liveness Analysis", false, true); -LiveValues::LiveValues() : FunctionPass(ID) {} +LiveValues::LiveValues() : FunctionPass(&ID) {} void LiveValues::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index 717e0169b78..2727d2f9465 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -30,9 +30,9 @@ private: public: static char ID; - PrintLoopPass() : LoopPass(ID), Out(dbgs()) {} + PrintLoopPass() : LoopPass(&ID), Out(dbgs()) {} PrintLoopPass(const std::string &B, raw_ostream &o) - : LoopPass(ID), Banner(B), Out(o) {} + : LoopPass(&ID), Banner(B), Out(o) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -59,7 +59,7 @@ char PrintLoopPass::ID = 0; char LPPassManager::ID = 0; LPPassManager::LPPassManager(int Depth) - : FunctionPass(ID), PMDataManager(Depth) { + : FunctionPass(&ID), PMDataManager(Depth) { skipThisLoop = false; redoThisLoop = false; LI = NULL; diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index d18d5ce0ea4..e003d643691 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -50,7 +50,7 @@ INITIALIZE_PASS(MemoryDependenceAnalysis, "memdep", "Memory Dependence Analysis", false, true); MemoryDependenceAnalysis::MemoryDependenceAnalysis() -: FunctionPass(ID), PredCache(0) { +: FunctionPass(&ID), PredCache(0) { } MemoryDependenceAnalysis::~MemoryDependenceAnalysis() { } diff --git a/lib/Analysis/ModuleDebugInfoPrinter.cpp b/lib/Analysis/ModuleDebugInfoPrinter.cpp index 2cc1c2aa005..cf8988a403c 100644 --- a/lib/Analysis/ModuleDebugInfoPrinter.cpp +++ b/lib/Analysis/ModuleDebugInfoPrinter.cpp @@ -30,7 +30,7 @@ namespace { DebugInfoFinder Finder; public: static char ID; // Pass identification, replacement for typeid - ModuleDebugInfoPrinter() : ModulePass(ID) {} + ModuleDebugInfoPrinter() : ModulePass(&ID) {} virtual bool runOnModule(Module &M); diff --git a/lib/Analysis/PointerTracking.cpp b/lib/Analysis/PointerTracking.cpp index 07f46824700..03d3059fdbb 100644 --- a/lib/Analysis/PointerTracking.cpp +++ b/lib/Analysis/PointerTracking.cpp @@ -28,7 +28,7 @@ using namespace llvm; char PointerTracking::ID = 0; -PointerTracking::PointerTracking() : FunctionPass(ID) {} +PointerTracking::PointerTracking() : FunctionPass(&ID) {} bool PointerTracking::runOnFunction(Function &F) { predCache.clear(); diff --git a/lib/Analysis/ProfileEstimatorPass.cpp b/lib/Analysis/ProfileEstimatorPass.cpp index 062461a87cb..da4ce476926 100644 --- a/lib/Analysis/ProfileEstimatorPass.cpp +++ b/lib/Analysis/ProfileEstimatorPass.cpp @@ -39,7 +39,7 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo explicit ProfileEstimatorPass(const double execcount = 0) - : FunctionPass(ID), ExecCount(execcount) { + : FunctionPass(&ID), ExecCount(execcount) { if (execcount == 0) ExecCount = LoopWeight; } @@ -59,8 +59,8 @@ namespace { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &ProfileInfo::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&ProfileInfo::ID)) return (ProfileInfo*)this; return this; } @@ -78,7 +78,7 @@ X("profile-estimator", "Estimate profiling information", false, true); static RegisterAnalysisGroup Y(X); namespace llvm { - char &ProfileEstimatorPassID = ProfileEstimatorPass::ID; + const PassInfo *ProfileEstimatorPassID = &X; FunctionPass *createProfileEstimatorPass() { return new ProfileEstimatorPass(); diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp index fc7f28662c0..eb33e78af78 100644 --- a/lib/Analysis/ProfileInfo.cpp +++ b/lib/Analysis/ProfileInfo.cpp @@ -1076,14 +1076,14 @@ raw_ostream& operator<<(raw_ostream &O, std::pairisPassID(&ProfileInfo::ID)) return (ProfileInfo*)this; return this; } diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index b6434e72340..8ea4ecf54f9 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -45,7 +45,7 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo explicit LoaderPass(const std::string &filename = "") - : ModulePass(ID), Filename(filename) { + : ModulePass(&ID), Filename(filename) { if (filename.empty()) Filename = ProfileInfoFilename; } @@ -67,8 +67,8 @@ namespace { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &ProfileInfo::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&ProfileInfo::ID)) return (ProfileInfo*)this; return this; } @@ -84,7 +84,7 @@ X("profile-loader", "Load profile information from llvmprof.out", false, true); static RegisterAnalysisGroup Y(X); -char &llvm::ProfileLoaderPassID = LoaderPass::ID; +const PassInfo *llvm::ProfileLoaderPassID = &X; ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); } diff --git a/lib/Analysis/ProfileVerifierPass.cpp b/lib/Analysis/ProfileVerifierPass.cpp index 3f01b2d592b..dc1f28a95ae 100644 --- a/lib/Analysis/ProfileVerifierPass.cpp +++ b/lib/Analysis/ProfileVerifierPass.cpp @@ -59,10 +59,10 @@ namespace llvm { public: static char ID; // Class identification, replacement for typeinfo - explicit ProfileVerifierPassT () : FunctionPass(ID) { + explicit ProfileVerifierPassT () : FunctionPass(&ID) { DisableAssertions = ProfileVerifierDisableAssertions; } - explicit ProfileVerifierPassT (bool da) : FunctionPass(ID), + explicit ProfileVerifierPassT (bool da) : FunctionPass(&ID), DisableAssertions(da) { } diff --git a/lib/Analysis/RegionInfo.cpp b/lib/Analysis/RegionInfo.cpp index 27cee76e081..5c998522316 100644 --- a/lib/Analysis/RegionInfo.cpp +++ b/lib/Analysis/RegionInfo.cpp @@ -589,7 +589,7 @@ void RegionInfo::releaseMemory() { TopLevelRegion = 0; } -RegionInfo::RegionInfo() : FunctionPass(ID) { +RegionInfo::RegionInfo() : FunctionPass(&ID) { TopLevelRegion = 0; } diff --git a/lib/Analysis/RegionPrinter.cpp b/lib/Analysis/RegionPrinter.cpp index fee5c1bae97..67ce05a52f3 100644 --- a/lib/Analysis/RegionPrinter.cpp +++ b/lib/Analysis/RegionPrinter.cpp @@ -121,7 +121,7 @@ namespace { struct RegionViewer : public DOTGraphTraitsViewer { static char ID; - RegionViewer() : DOTGraphTraitsViewer("reg", ID){} + RegionViewer() : DOTGraphTraitsViewer("reg", &ID){} }; char RegionViewer::ID = 0; @@ -131,7 +131,7 @@ INITIALIZE_PASS(RegionViewer, "view-regions", "View regions of function", struct RegionOnlyViewer : public DOTGraphTraitsViewer { static char ID; - RegionOnlyViewer() : DOTGraphTraitsViewer("regonly", ID){} + RegionOnlyViewer() : DOTGraphTraitsViewer("regonly", &ID){} }; char RegionOnlyViewer::ID = 0; @@ -143,7 +143,7 @@ struct RegionPrinter : public DOTGraphTraitsPrinter { static char ID; RegionPrinter() : - DOTGraphTraitsPrinter("reg", ID) {} + DOTGraphTraitsPrinter("reg", &ID) {} }; } //end anonymous namespace @@ -157,7 +157,7 @@ struct RegionOnlyPrinter : public DOTGraphTraitsPrinter { static char ID; RegionOnlyPrinter() : - DOTGraphTraitsPrinter("reg", ID) {} + DOTGraphTraitsPrinter("reg", &ID) {} }; } diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index fb5acb91aee..9aaafafe052 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -5742,7 +5742,7 @@ ScalarEvolution::SCEVCallbackVH::SCEVCallbackVH(Value *V, ScalarEvolution *se) //===----------------------------------------------------------------------===// ScalarEvolution::ScalarEvolution() - : FunctionPass(ID), FirstUnknown(0) { + : FunctionPass(&ID), FirstUnknown(0) { } bool ScalarEvolution::runOnFunction(Function &F) { diff --git a/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp index 93b2a8b06fb..91ae98919d4 100644 --- a/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp +++ b/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp @@ -34,14 +34,14 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo - ScalarEvolutionAliasAnalysis() : FunctionPass(ID), SE(0) {} + ScalarEvolutionAliasAnalysis() : FunctionPass(&ID), SE(0) {} /// getAdjustedAnalysisPointer - This method is used when a pass implements /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &AliasAnalysis::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/TypeBasedAliasAnalysis.cpp b/lib/Analysis/TypeBasedAliasAnalysis.cpp index bbfdcec3f9b..3e71f226a05 100644 --- a/lib/Analysis/TypeBasedAliasAnalysis.cpp +++ b/lib/Analysis/TypeBasedAliasAnalysis.cpp @@ -82,14 +82,14 @@ namespace { public AliasAnalysis { public: static char ID; // Class identification, replacement for typeinfo - TypeBasedAliasAnalysis() : ImmutablePass(ID) {} + TypeBasedAliasAnalysis() : ImmutablePass(&ID) {} /// getAdjustedAnalysisPointer - This method is used when a pass implements /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(const void *PI) { - if (PI == &AliasAnalysis::ID) + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) return (AliasAnalysis*)this; return this; } diff --git a/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/lib/Bitcode/Writer/BitcodeWriterPass.cpp index 91e115cba6c..3a0d3ce0be9 100644 --- a/lib/Bitcode/Writer/BitcodeWriterPass.cpp +++ b/lib/Bitcode/Writer/BitcodeWriterPass.cpp @@ -21,7 +21,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit WriteBitcodePass(raw_ostream &o) - : ModulePass(ID), OS(o) {} + : ModulePass(&ID), OS(o) {} const char *getPassName() const { return "Bitcode Writer"; } diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 6e2098d6f54..1ba63100956 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -91,7 +91,7 @@ static unsigned getGVAlignmentLog2(const GlobalValue *GV, const TargetData &TD, AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer) - : MachineFunctionPass(ID), + : MachineFunctionPass(&ID), TM(tm), MAI(tm.getMCAsmInfo()), OutContext(Streamer.getContext()), OutStreamer(Streamer), diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp index cb81aa3c88c..7f98df0d22e 100644 --- a/lib/CodeGen/BranchFolding.cpp +++ b/lib/CodeGen/BranchFolding.cpp @@ -65,7 +65,7 @@ namespace { public: static char ID; explicit BranchFolderPass(bool defaultEnableTailMerge) - : MachineFunctionPass(ID), BranchFolder(defaultEnableTailMerge) {} + : MachineFunctionPass(&ID), BranchFolder(defaultEnableTailMerge) {} virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { return "Control Flow Optimizer"; } diff --git a/lib/CodeGen/CodePlacementOpt.cpp b/lib/CodeGen/CodePlacementOpt.cpp index 91a9536e775..e0e315c6c67 100644 --- a/lib/CodeGen/CodePlacementOpt.cpp +++ b/lib/CodeGen/CodePlacementOpt.cpp @@ -36,7 +36,7 @@ namespace { public: static char ID; - CodePlacementOpt() : MachineFunctionPass(ID) {} + CodePlacementOpt() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { diff --git a/lib/CodeGen/DeadMachineInstructionElim.cpp b/lib/CodeGen/DeadMachineInstructionElim.cpp index 138b83d4b66..2f5b6dd31bc 100644 --- a/lib/CodeGen/DeadMachineInstructionElim.cpp +++ b/lib/CodeGen/DeadMachineInstructionElim.cpp @@ -36,7 +36,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid - DeadMachineInstructionElim() : MachineFunctionPass(ID) {} + DeadMachineInstructionElim() : MachineFunctionPass(&ID) {} private: bool isDead(const MachineInstr *MI) const; diff --git a/lib/CodeGen/DwarfEHPrepare.cpp b/lib/CodeGen/DwarfEHPrepare.cpp index 57f45ec199d..dfa9622a20a 100644 --- a/lib/CodeGen/DwarfEHPrepare.cpp +++ b/lib/CodeGen/DwarfEHPrepare.cpp @@ -160,7 +160,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid. DwarfEHPrepare(const TargetMachine *tm, bool fast) : - FunctionPass(ID), TM(tm), TLI(TM->getTargetLowering()), + FunctionPass(&ID), TM(tm), TLI(TM->getTargetLowering()), CompileFast(fast), ExceptionValueIntrinsic(0), SelectorIntrinsic(0), URoR(0), EHCatchAllValue(0), RewindFunction(0) {} diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index d14728d8a36..8e4b98647fd 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -63,7 +63,7 @@ char ELFWriter::ID = 0; //===----------------------------------------------------------------------===// ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm) - : MachineFunctionPass(ID), O(o), TM(tm), + : MachineFunctionPass(&ID), O(o), TM(tm), OutContext(*new MCContext(*TM.getMCAsmInfo())), TLOF(TM.getTargetLowering()->getObjFileLowering()), is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64), diff --git a/lib/CodeGen/GCMetadata.cpp b/lib/CodeGen/GCMetadata.cpp index 0f6e882a7be..32bc7d785b6 100644 --- a/lib/CodeGen/GCMetadata.cpp +++ b/lib/CodeGen/GCMetadata.cpp @@ -30,8 +30,8 @@ namespace { raw_ostream &OS; public: - Printer() : FunctionPass(ID), OS(errs()) {} - explicit Printer(raw_ostream &OS) : FunctionPass(ID), OS(OS) {} + Printer() : FunctionPass(&ID), OS(errs()) {} + explicit Printer(raw_ostream &OS) : FunctionPass(&ID), OS(OS) {} const char *getPassName() const; @@ -70,7 +70,7 @@ GCFunctionInfo::~GCFunctionInfo() {} char GCModuleInfo::ID = 0; GCModuleInfo::GCModuleInfo() - : ImmutablePass(ID) {} + : ImmutablePass(&ID) {} GCModuleInfo::~GCModuleInfo() { clear(); @@ -189,7 +189,7 @@ FunctionPass *llvm::createGCInfoDeleter() { return new Deleter(); } -Deleter::Deleter() : FunctionPass(ID) {} +Deleter::Deleter() : FunctionPass(&ID) {} const char *Deleter::getPassName() const { return "Delete Garbage Collector Information"; diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp index 719fa194d8d..b27a420a243 100644 --- a/lib/CodeGen/GCStrategy.cpp +++ b/lib/CodeGen/GCStrategy.cpp @@ -130,7 +130,7 @@ FunctionPass *llvm::createGCLoweringPass() { char LowerIntrinsics::ID = 0; LowerIntrinsics::LowerIntrinsics() - : FunctionPass(ID) {} + : FunctionPass(&ID) {} const char *LowerIntrinsics::getPassName() const { return "Lower Garbage Collection Instructions"; @@ -318,7 +318,7 @@ FunctionPass *llvm::createGCMachineCodeAnalysisPass() { char MachineCodeAnalysis::ID = 0; MachineCodeAnalysis::MachineCodeAnalysis() - : MachineFunctionPass(ID) {} + : MachineFunctionPass(&ID) {} const char *MachineCodeAnalysis::getPassName() const { return "Analyze Machine Code For Garbage Collection"; diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index 0ea30d7a792..6c064a74cd0 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -154,7 +154,7 @@ namespace { int FnNum; public: static char ID; - IfConverter() : MachineFunctionPass(ID), FnNum(-1) {} + IfConverter() : MachineFunctionPass(&ID), FnNum(-1) {} virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { return "If Converter"; } diff --git a/lib/CodeGen/LowerSubregs.cpp b/lib/CodeGen/LowerSubregs.cpp index a1f1a078d61..dfd4eaeca66 100644 --- a/lib/CodeGen/LowerSubregs.cpp +++ b/lib/CodeGen/LowerSubregs.cpp @@ -36,7 +36,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid - LowerSubregsInstructionPass() : MachineFunctionPass(ID) {} + LowerSubregsInstructionPass() : MachineFunctionPass(&ID) {} const char *getPassName() const { return "Subregister lowering instruction pass"; diff --git a/lib/CodeGen/MachineCSE.cpp b/lib/CodeGen/MachineCSE.cpp index 60642d46223..ef4919239b9 100644 --- a/lib/CodeGen/MachineCSE.cpp +++ b/lib/CodeGen/MachineCSE.cpp @@ -41,7 +41,7 @@ namespace { MachineRegisterInfo *MRI; public: static char ID; // Pass identification - MachineCSE() : MachineFunctionPass(ID), LookAheadLimit(5), CurrVN(0) {} + MachineCSE() : MachineFunctionPass(&ID), LookAheadLimit(5), CurrVN(0) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/CodeGen/MachineDominators.cpp b/lib/CodeGen/MachineDominators.cpp index 36c9d66965a..b5f8fbba99d 100644 --- a/lib/CodeGen/MachineDominators.cpp +++ b/lib/CodeGen/MachineDominators.cpp @@ -27,7 +27,7 @@ char MachineDominatorTree::ID = 0; static RegisterPass E("machinedomtree", "MachineDominator Tree Construction", true); -char &llvm::MachineDominatorsID = MachineDominatorTree::ID; +const PassInfo *const llvm::MachineDominatorsID = &E; void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -41,7 +41,7 @@ bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) { } MachineDominatorTree::MachineDominatorTree() - : MachineFunctionPass(ID) { + : MachineFunctionPass(&ID) { DT = new DominatorTreeBase(false); } diff --git a/lib/CodeGen/MachineFunctionAnalysis.cpp b/lib/CodeGen/MachineFunctionAnalysis.cpp index 4f84b952e06..07a0f45c0f4 100644 --- a/lib/CodeGen/MachineFunctionAnalysis.cpp +++ b/lib/CodeGen/MachineFunctionAnalysis.cpp @@ -20,14 +20,14 @@ using namespace llvm; // a default constructor. static PassInfo X("Machine Function Analysis", "machine-function-analysis", - &MachineFunctionAnalysis::ID, 0, + intptr_t(&MachineFunctionAnalysis::ID), 0, /*CFGOnly=*/false, /*is_analysis=*/true); char MachineFunctionAnalysis::ID = 0; MachineFunctionAnalysis::MachineFunctionAnalysis(const TargetMachine &tm, CodeGenOpt::Level OL) : - FunctionPass(ID), TM(tm), OptLevel(OL), MF(0) { + FunctionPass(&ID), TM(tm), OptLevel(OL), MF(0) { } MachineFunctionAnalysis::~MachineFunctionAnalysis() { diff --git a/lib/CodeGen/MachineFunctionPrinterPass.cpp b/lib/CodeGen/MachineFunctionPrinterPass.cpp index 2aaa798a02c..547c4febc8d 100644 --- a/lib/CodeGen/MachineFunctionPrinterPass.cpp +++ b/lib/CodeGen/MachineFunctionPrinterPass.cpp @@ -29,7 +29,7 @@ struct MachineFunctionPrinterPass : public MachineFunctionPass { const std::string Banner; MachineFunctionPrinterPass(raw_ostream &os, const std::string &banner) - : MachineFunctionPass(ID), OS(os), Banner(banner) {} + : MachineFunctionPass(&ID), OS(os), Banner(banner) {} const char *getPassName() const { return "MachineFunction Printer"; } diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index 1a74b747e9f..63b145e2455 100644 --- a/lib/CodeGen/MachineLICM.cpp +++ b/lib/CodeGen/MachineLICM.cpp @@ -74,10 +74,10 @@ namespace { public: static char ID; // Pass identification, replacement for typeid MachineLICM() : - MachineFunctionPass(ID), PreRegAlloc(true) {} + MachineFunctionPass(&ID), PreRegAlloc(true) {} explicit MachineLICM(bool PreRA) : - MachineFunctionPass(ID), PreRegAlloc(PreRA) {} + MachineFunctionPass(&ID), PreRegAlloc(PreRA) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/CodeGen/MachineLoopInfo.cpp b/lib/CodeGen/MachineLoopInfo.cpp index 039edf26a2b..269538b31d0 100644 --- a/lib/CodeGen/MachineLoopInfo.cpp +++ b/lib/CodeGen/MachineLoopInfo.cpp @@ -33,7 +33,7 @@ char MachineLoopInfo::ID = 0; static RegisterPass X("machine-loops", "Machine Natural Loop Construction", true); -char &llvm::MachineLoopInfoID = MachineLoopInfo::ID; +const PassInfo *const llvm::MachineLoopInfoID = &X; bool MachineLoopInfo::runOnMachineFunction(MachineFunction &) { releaseMemory(); diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index b647a4dcc53..d2e3bf74641 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -254,7 +254,7 @@ void MMIAddrLabelMapCallbackPtr::allUsesReplacedWith(Value *V2) { //===----------------------------------------------------------------------===// MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI) -: ImmutablePass(ID), Context(MAI), +: ImmutablePass(&ID), Context(MAI), ObjFileMMI(0), CurCallSite(0), CallsEHReturn(0), CallsUnwindInit(0), DbgInfoAvailable(false){ // Always emit some info, by default "no personality" info. @@ -264,7 +264,7 @@ MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI) } MachineModuleInfo::MachineModuleInfo() -: ImmutablePass(ID), Context(*(MCAsmInfo*)0) { +: ImmutablePass(&ID), Context(*(MCAsmInfo*)0) { assert(0 && "This MachineModuleInfo constructor should never be called, MMI " "should always be explicitly constructed by LLVMTargetMachine"); abort(); diff --git a/lib/CodeGen/MachineSink.cpp b/lib/CodeGen/MachineSink.cpp index 1c83176db96..d1f91f271b9 100644 --- a/lib/CodeGen/MachineSink.cpp +++ b/lib/CodeGen/MachineSink.cpp @@ -44,7 +44,7 @@ namespace { public: static char ID; // Pass identification - MachineSinking() : MachineFunctionPass(ID) {} + MachineSinking() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp index 50d04760029..4b87ba53dad 100644 --- a/lib/CodeGen/MachineVerifier.cpp +++ b/lib/CodeGen/MachineVerifier.cpp @@ -194,7 +194,7 @@ namespace { static char ID; // Pass ID, replacement for typeid MachineVerifierPass() - : MachineFunctionPass(ID) {} + : MachineFunctionPass(&ID) {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/lib/CodeGen/OptimizeExts.cpp b/lib/CodeGen/OptimizeExts.cpp index 288f58b5083..586b84c5768 100644 --- a/lib/CodeGen/OptimizeExts.cpp +++ b/lib/CodeGen/OptimizeExts.cpp @@ -43,7 +43,7 @@ namespace { public: static char ID; // Pass identification - OptimizeExts() : MachineFunctionPass(ID) {} + OptimizeExts() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/CodeGen/OptimizePHIs.cpp b/lib/CodeGen/OptimizePHIs.cpp index edb4eea71b8..d27cc42319c 100644 --- a/lib/CodeGen/OptimizePHIs.cpp +++ b/lib/CodeGen/OptimizePHIs.cpp @@ -33,7 +33,7 @@ namespace { public: static char ID; // Pass identification - OptimizePHIs() : MachineFunctionPass(ID) {} + OptimizePHIs() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index 7bf0aa23af3..ea6b094d7ef 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -40,7 +40,7 @@ char PHIElimination::ID = 0; static RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); -char &llvm::PHIEliminationID = PHIElimination::ID; +const PassInfo *const llvm::PHIEliminationID = &X; void llvm::PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); diff --git a/lib/CodeGen/PHIElimination.h b/lib/CodeGen/PHIElimination.h index f183de6149c..7dedf0318a8 100644 --- a/lib/CodeGen/PHIElimination.h +++ b/lib/CodeGen/PHIElimination.h @@ -25,7 +25,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid - PHIElimination() : MachineFunctionPass(ID) {} + PHIElimination() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &Fn); diff --git a/lib/CodeGen/PostRASchedulerList.cpp b/lib/CodeGen/PostRASchedulerList.cpp index f0bd6d1372b..3005ec1075b 100644 --- a/lib/CodeGen/PostRASchedulerList.cpp +++ b/lib/CodeGen/PostRASchedulerList.cpp @@ -85,7 +85,7 @@ namespace { public: static char ID; PostRAScheduler(CodeGenOpt::Level ol) : - MachineFunctionPass(ID), OptLevel(ol) {} + MachineFunctionPass(&ID), OptLevel(ol) {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp index 82df6c23793..4cbd53a834e 100644 --- a/lib/CodeGen/PreAllocSplitting.cpp +++ b/lib/CodeGen/PreAllocSplitting.cpp @@ -92,7 +92,7 @@ namespace { public: static char ID; PreAllocSplitting() - : MachineFunctionPass(ID) {} + : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); @@ -206,7 +206,7 @@ char PreAllocSplitting::ID = 0; static RegisterPass X("pre-alloc-splitting", "Pre-Register Allocation Live Interval Splitting"); -char &llvm::PreAllocSplittingID = PreAllocSplitting::ID; +const PassInfo *const llvm::PreAllocSplittingID = &X; /// findSpillPoint - Find a gap as far away from the given MI that's suitable /// for spilling the current live interval. The index must be before any diff --git a/lib/CodeGen/PrologEpilogInserter.h b/lib/CodeGen/PrologEpilogInserter.h index e56c36fe908..aa95773596c 100644 --- a/lib/CodeGen/PrologEpilogInserter.h +++ b/lib/CodeGen/PrologEpilogInserter.h @@ -36,7 +36,7 @@ namespace llvm { class PEI : public MachineFunctionPass { public: static char ID; - PEI() : MachineFunctionPass(ID) {} + PEI() : MachineFunctionPass(&ID) {} const char *getPassName() const { return "Prolog/Epilog Insertion & Frame Finalization"; diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp index f0ccd351d2a..9567308aa73 100644 --- a/lib/CodeGen/RegAllocFast.cpp +++ b/lib/CodeGen/RegAllocFast.cpp @@ -47,7 +47,7 @@ namespace { class RAFast : public MachineFunctionPass { public: static char ID; - RAFast() : MachineFunctionPass(ID), StackSlotForVirtReg(-1), + RAFast() : MachineFunctionPass(&ID), StackSlotForVirtReg(-1), isBulkSpilling(false) {} private: const TargetMachine *TM; diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index c9c51b361d3..d10b5d63068 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -90,7 +90,7 @@ namespace { struct RALinScan : public MachineFunctionPass { static char ID; - RALinScan() : MachineFunctionPass(ID) { + RALinScan() : MachineFunctionPass(&ID) { // Initialize the queue to record recently-used registers. if (NumRecentlyUsedRegs > 0) RecentRegs.resize(NumRecentlyUsedRegs, 0); diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp index 0dd92148269..594618891de 100644 --- a/lib/CodeGen/RegAllocPBQP.cpp +++ b/lib/CodeGen/RegAllocPBQP.cpp @@ -84,7 +84,7 @@ namespace { static char ID; /// Construct a PBQP register allocator. - PBQPRegAlloc() : MachineFunctionPass(ID) {} + PBQPRegAlloc() : MachineFunctionPass(&ID) {} /// Return the pass name. virtual const char* getPassName() const { diff --git a/lib/CodeGen/RenderMachineFunction.h b/lib/CodeGen/RenderMachineFunction.h index 71a613bedaf..4d22b34d558 100644 --- a/lib/CodeGen/RenderMachineFunction.h +++ b/lib/CodeGen/RenderMachineFunction.h @@ -198,7 +198,7 @@ namespace llvm { public: static char ID; - RenderMachineFunction() : MachineFunctionPass(ID) {} + RenderMachineFunction() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 700d2cb2e87..1731be2be95 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -171,7 +171,7 @@ TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, //===----------------------------------------------------------------------===// SelectionDAGISel::SelectionDAGISel(const TargetMachine &tm, CodeGenOpt::Level OL) : - MachineFunctionPass(ID), TM(tm), TLI(*tm.getTargetLowering()), + MachineFunctionPass(&ID), TM(tm), TLI(*tm.getTargetLowering()), FuncInfo(new FunctionLoweringInfo(TLI)), CurDAG(new SelectionDAG(tm)), SDB(new SelectionDAGBuilder(*CurDAG, *FuncInfo, OL)), diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index fd6ffcecd14..7bf559fae28 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -65,7 +65,7 @@ X("simple-register-coalescing", "Simple Register Coalescing"); // Declare that we implement the RegisterCoalescer interface static RegisterAnalysisGroup V(X); -char &llvm::SimpleRegisterCoalescingID = SimpleRegisterCoalescing::ID; +const PassInfo *const llvm::SimpleRegisterCoalescingID = &X; void SimpleRegisterCoalescing::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); diff --git a/lib/CodeGen/SimpleRegisterCoalescing.h b/lib/CodeGen/SimpleRegisterCoalescing.h index 321cef8a38d..e154da60aff 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.h +++ b/lib/CodeGen/SimpleRegisterCoalescing.h @@ -64,7 +64,7 @@ namespace llvm { public: static char ID; // Pass identifcation, replacement for typeid - SimpleRegisterCoalescing() : MachineFunctionPass(ID) {} + SimpleRegisterCoalescing() : MachineFunctionPass(&ID) {} struct InstrSlots { enum { diff --git a/lib/CodeGen/SjLjEHPrepare.cpp b/lib/CodeGen/SjLjEHPrepare.cpp index b637980f885..e90869d600d 100644 --- a/lib/CodeGen/SjLjEHPrepare.cpp +++ b/lib/CodeGen/SjLjEHPrepare.cpp @@ -58,7 +58,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit SjLjEHPass(const TargetLowering *tli = NULL) - : FunctionPass(ID), TLI(tli) { } + : FunctionPass(&ID), TLI(tli) { } bool doInitialization(Module &M); bool runOnFunction(Function &F); diff --git a/lib/CodeGen/Splitter.h b/lib/CodeGen/Splitter.h index a726a7b834f..2b0645dfdcd 100644 --- a/lib/CodeGen/Splitter.h +++ b/lib/CodeGen/Splitter.h @@ -36,7 +36,7 @@ namespace llvm { public: static char ID; - LoopSplitter() : MachineFunctionPass(ID) {} + LoopSplitter() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp index 9f51778da75..ff20f11e6e6 100644 --- a/lib/CodeGen/StackProtector.cpp +++ b/lib/CodeGen/StackProtector.cpp @@ -62,9 +62,9 @@ namespace { bool RequiresStackProtector() const; public: static char ID; // Pass identification, replacement for typeid. - StackProtector() : FunctionPass(ID), TLI(0) {} + StackProtector() : FunctionPass(&ID), TLI(0) {} StackProtector(const TargetLowering *tli) - : FunctionPass(ID), TLI(tli) {} + : FunctionPass(&ID), TLI(tli) {} virtual bool runOnFunction(Function &Fn); }; diff --git a/lib/CodeGen/StackSlotColoring.cpp b/lib/CodeGen/StackSlotColoring.cpp index dab6bc3924d..7da3d17a541 100644 --- a/lib/CodeGen/StackSlotColoring.cpp +++ b/lib/CodeGen/StackSlotColoring.cpp @@ -95,9 +95,9 @@ namespace { public: static char ID; // Pass identification StackSlotColoring() : - MachineFunctionPass(ID), ColorWithRegs(false), NextColor(-1) {} + MachineFunctionPass(&ID), ColorWithRegs(false), NextColor(-1) {} StackSlotColoring(bool RegColor) : - MachineFunctionPass(ID), ColorWithRegs(RegColor), NextColor(-1) {} + MachineFunctionPass(&ID), ColorWithRegs(RegColor), NextColor(-1) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp index 5e2d414a3ee..59315cf6728 100644 --- a/lib/CodeGen/StrongPHIElimination.cpp +++ b/lib/CodeGen/StrongPHIElimination.cpp @@ -39,7 +39,7 @@ using namespace llvm; namespace { struct StrongPHIElimination : public MachineFunctionPass { static char ID; // Pass identification, replacement for typeid - StrongPHIElimination() : MachineFunctionPass(ID) {} + StrongPHIElimination() : MachineFunctionPass(&ID) {} // Waiting stores, for each MBB, the set of copies that need to // be inserted into that MBB @@ -154,7 +154,7 @@ static RegisterPass X("strong-phi-node-elimination", "Eliminate PHI nodes for register allocation, intelligently"); -char &llvm::StrongPHIEliminationID = StrongPHIElimination::ID; +const PassInfo *const llvm::StrongPHIEliminationID = &X; /// computeDFS - Computes the DFS-in and DFS-out numbers of the dominator tree /// of the given MachineFunction. These numbers are then used in other parts diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp index a815b364d54..aac8a0a2068 100644 --- a/lib/CodeGen/TailDuplication.cpp +++ b/lib/CodeGen/TailDuplication.cpp @@ -69,7 +69,7 @@ namespace { public: static char ID; explicit TailDuplicatePass(bool PreRA) : - MachineFunctionPass(ID), PreRegAlloc(PreRA) {} + MachineFunctionPass(&ID), PreRegAlloc(PreRA) {} virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { return "Tail Duplication"; } diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 2e17ebcf8a5..9c280faea0e 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -138,7 +138,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid - TwoAddressInstructionPass() : MachineFunctionPass(ID) {} + TwoAddressInstructionPass() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); @@ -162,7 +162,7 @@ char TwoAddressInstructionPass::ID = 0; static RegisterPass X("twoaddressinstruction", "Two-Address instruction pass"); -char &llvm::TwoAddressInstructionPassID = TwoAddressInstructionPass::ID; +const PassInfo *const llvm::TwoAddressInstructionPassID = &X; /// Sink3AddrInstruction - A two-address instruction has been converted to a /// three-address instruction to avoid clobbering a register. Try to sink it diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp index ade2ab4ffab..be1fd23e2fc 100644 --- a/lib/CodeGen/UnreachableBlockElim.cpp +++ b/lib/CodeGen/UnreachableBlockElim.cpp @@ -43,7 +43,7 @@ namespace { virtual bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid - UnreachableBlockElim() : FunctionPass(ID) {} + UnreachableBlockElim() : FunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); @@ -100,7 +100,7 @@ namespace { MachineModuleInfo *MMI; public: static char ID; // Pass identification, replacement for typeid - UnreachableMachineBlockElim() : MachineFunctionPass(ID) {} + UnreachableMachineBlockElim() : MachineFunctionPass(&ID) {} }; } char UnreachableMachineBlockElim::ID = 0; @@ -109,7 +109,7 @@ static RegisterPass Y("unreachable-mbb-elimination", "Remove unreachable machine basic blocks"); -char &llvm::UnreachableMachineBlockElimID = UnreachableMachineBlockElim::ID; +const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y; void UnreachableMachineBlockElim::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); diff --git a/lib/CodeGen/VirtRegMap.h b/lib/CodeGen/VirtRegMap.h index 8b6082d1819..87a9b2a7c46 100644 --- a/lib/CodeGen/VirtRegMap.h +++ b/lib/CodeGen/VirtRegMap.h @@ -139,7 +139,7 @@ namespace llvm { public: static char ID; - VirtRegMap() : MachineFunctionPass(ID), Virt2PhysMap(NO_PHYS_REG), + VirtRegMap() : MachineFunctionPass(&ID), Virt2PhysMap(NO_PHYS_REG), Virt2StackSlotMap(NO_STACK_SLOT), Virt2ReMatIdMap(NO_STACK_SLOT), Virt2SplitMap(0), Virt2SplitKillMap(SlotIndex()), ReMatMap(NULL), diff --git a/lib/Target/ARM/ARMCodeEmitter.cpp b/lib/Target/ARM/ARMCodeEmitter.cpp index 089d1c51598..93f617db64f 100644 --- a/lib/Target/ARM/ARMCodeEmitter.cpp +++ b/lib/Target/ARM/ARMCodeEmitter.cpp @@ -65,7 +65,7 @@ namespace { static char ID; public: ARMCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce) - : MachineFunctionPass(ID), JTI(0), + : MachineFunctionPass(&ID), JTI(0), II((const ARMInstrInfo *)tm.getInstrInfo()), TD(tm.getTargetData()), TM(tm), MCE(mce), MCPEs(0), MJTEs(0), diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index 118b2de7f4f..63d57b61b46 100644 --- a/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -173,7 +173,7 @@ namespace { bool isThumb2; public: static char ID; - ARMConstantIslands() : MachineFunctionPass(ID) {} + ARMConstantIslands() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/Target/ARM/ARMExpandPseudoInsts.cpp b/lib/Target/ARM/ARMExpandPseudoInsts.cpp index e5f8a638eb6..70ed67713e2 100644 --- a/lib/Target/ARM/ARMExpandPseudoInsts.cpp +++ b/lib/Target/ARM/ARMExpandPseudoInsts.cpp @@ -26,7 +26,7 @@ namespace { class ARMExpandPseudo : public MachineFunctionPass { public: static char ID; - ARMExpandPseudo() : MachineFunctionPass(ID) {} + ARMExpandPseudo() : MachineFunctionPass(&ID) {} const TargetInstrInfo *TII; const TargetRegisterInfo *TRI; diff --git a/lib/Target/ARM/ARMGlobalMerge.cpp b/lib/Target/ARM/ARMGlobalMerge.cpp index 85b0c6c248d..af7298a2439 100644 --- a/lib/Target/ARM/ARMGlobalMerge.cpp +++ b/lib/Target/ARM/ARMGlobalMerge.cpp @@ -78,7 +78,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid. explicit ARMGlobalMerge(const TargetLowering *tli) - : FunctionPass(ID), TLI(tli) {} + : FunctionPass(&ID), TLI(tli) {} virtual bool doInitialization(Module &M); virtual bool runOnFunction(Function& F); diff --git a/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/lib/Target/ARM/ARMLoadStoreOptimizer.cpp index db580fbf7b1..f80e316d23e 100644 --- a/lib/Target/ARM/ARMLoadStoreOptimizer.cpp +++ b/lib/Target/ARM/ARMLoadStoreOptimizer.cpp @@ -57,7 +57,7 @@ STATISTIC(NumSTRD2STR, "Number of strd instructions turned back into str's"); namespace { struct ARMLoadStoreOpt : public MachineFunctionPass { static char ID; - ARMLoadStoreOpt() : MachineFunctionPass(ID) {} + ARMLoadStoreOpt() : MachineFunctionPass(&ID) {} const TargetInstrInfo *TII; const TargetRegisterInfo *TRI; @@ -1268,7 +1268,7 @@ bool ARMLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) { namespace { struct ARMPreAllocLoadStoreOpt : public MachineFunctionPass{ static char ID; - ARMPreAllocLoadStoreOpt() : MachineFunctionPass(ID) {} + ARMPreAllocLoadStoreOpt() : MachineFunctionPass(&ID) {} const TargetData *TD; const TargetInstrInfo *TII; diff --git a/lib/Target/ARM/NEONMoveFix.cpp b/lib/Target/ARM/NEONMoveFix.cpp index 97e54bfaed9..bbdd3c7f7c3 100644 --- a/lib/Target/ARM/NEONMoveFix.cpp +++ b/lib/Target/ARM/NEONMoveFix.cpp @@ -24,7 +24,7 @@ STATISTIC(NumVMovs, "Number of reg-reg moves converted"); namespace { struct NEONMoveFixPass : public MachineFunctionPass { static char ID; - NEONMoveFixPass() : MachineFunctionPass(ID) {} + NEONMoveFixPass() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &Fn); diff --git a/lib/Target/ARM/NEONPreAllocPass.cpp b/lib/Target/ARM/NEONPreAllocPass.cpp index 006a25fb15c..f67717cdd56 100644 --- a/lib/Target/ARM/NEONPreAllocPass.cpp +++ b/lib/Target/ARM/NEONPreAllocPass.cpp @@ -23,7 +23,7 @@ namespace { public: static char ID; - NEONPreAllocPass() : MachineFunctionPass(ID) {} + NEONPreAllocPass() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF); diff --git a/lib/Target/ARM/Thumb2ITBlockPass.cpp b/lib/Target/ARM/Thumb2ITBlockPass.cpp index 45e693744b8..445b6a3a09b 100644 --- a/lib/Target/ARM/Thumb2ITBlockPass.cpp +++ b/lib/Target/ARM/Thumb2ITBlockPass.cpp @@ -27,7 +27,7 @@ namespace { public: static char ID; - Thumb2ITBlockPass() : MachineFunctionPass(ID) {} + Thumb2ITBlockPass() : MachineFunctionPass(&ID) {} const Thumb2InstrInfo *TII; const TargetRegisterInfo *TRI; diff --git a/lib/Target/ARM/Thumb2SizeReduction.cpp b/lib/Target/ARM/Thumb2SizeReduction.cpp index 1451c53112f..ba392f36d94 100644 --- a/lib/Target/ARM/Thumb2SizeReduction.cpp +++ b/lib/Target/ARM/Thumb2SizeReduction.cpp @@ -173,7 +173,7 @@ namespace { char Thumb2SizeReduce::ID = 0; } -Thumb2SizeReduce::Thumb2SizeReduce() : MachineFunctionPass(ID) { +Thumb2SizeReduce::Thumb2SizeReduce() : MachineFunctionPass(&ID) { for (unsigned i = 0, e = array_lengthof(ReduceTable); i != e; ++i) { unsigned FromOpc = ReduceTable[i].WideOpc; if (!ReduceOpcodeMap.insert(std::make_pair(FromOpc, i)).second) diff --git a/lib/Target/Alpha/AlphaBranchSelector.cpp b/lib/Target/Alpha/AlphaBranchSelector.cpp index 37681170953..001656e0121 100644 --- a/lib/Target/Alpha/AlphaBranchSelector.cpp +++ b/lib/Target/Alpha/AlphaBranchSelector.cpp @@ -22,7 +22,7 @@ using namespace llvm; namespace { struct AlphaBSel : public MachineFunctionPass { static char ID; - AlphaBSel() : MachineFunctionPass(ID) {} + AlphaBSel() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &Fn); diff --git a/lib/Target/Alpha/AlphaCodeEmitter.cpp b/lib/Target/Alpha/AlphaCodeEmitter.cpp index 3aec07035d7..a6c6f52704f 100644 --- a/lib/Target/Alpha/AlphaCodeEmitter.cpp +++ b/lib/Target/Alpha/AlphaCodeEmitter.cpp @@ -34,7 +34,7 @@ namespace { public: static char ID; - AlphaCodeEmitter(JITCodeEmitter &mce) : MachineFunctionPass(ID), + AlphaCodeEmitter(JITCodeEmitter &mce) : MachineFunctionPass(&ID), MCE(mce) {} /// getBinaryCodeForInstr - This function, generated by the diff --git a/lib/Target/Alpha/AlphaLLRP.cpp b/lib/Target/Alpha/AlphaLLRP.cpp index 85fbfd1affe..34be470f03e 100644 --- a/lib/Target/Alpha/AlphaLLRP.cpp +++ b/lib/Target/Alpha/AlphaLLRP.cpp @@ -39,7 +39,7 @@ namespace { static char ID; AlphaLLRPPass(AlphaTargetMachine &tm) - : MachineFunctionPass(ID), TM(tm) { } + : MachineFunctionPass(&ID), TM(tm) { } virtual const char *getPassName() const { return "Alpha NOP inserter"; diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 46f584cb1b5..3b4d0a604cf 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -73,7 +73,7 @@ namespace { public: static char ID; CBackendNameAllUsedStructsAndMergeFunctions() - : ModulePass(ID) {} + : ModulePass(&ID) {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); } @@ -110,7 +110,7 @@ namespace { public: static char ID; explicit CWriter(formatted_raw_ostream &o) - : FunctionPass(ID), Out(o), IL(0), Mang(0), LI(0), + : FunctionPass(&ID), Out(o), IL(0), Mang(0), LI(0), TheModule(0), TAsm(0), TCtx(0), TD(0), OpaqueCounter(0), NextAnonValueNumber(0) { FPCounter = 0; diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 3e21cd1de44..396b569f9d0 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -104,7 +104,7 @@ namespace { public: static char ID; explicit CppWriter(formatted_raw_ostream &o) : - ModulePass(ID), Out(o), uniqueNum(0), is_inline(false), indent_level(0){} + ModulePass(&ID), Out(o), uniqueNum(0), is_inline(false), indent_level(0){} virtual const char *getPassName() const { return "C++ backend"; } diff --git a/lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp b/lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp index b551b79b291..42fea250733 100644 --- a/lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp +++ b/lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp @@ -32,7 +32,7 @@ namespace { static char ID; Filler(TargetMachine &tm) - : MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { } + : MachineFunctionPass(&ID), TM(tm), TII(tm.getInstrInfo()) { } virtual const char *getPassName() const { return "MBlaze Delay Slot Filler"; diff --git a/lib/Target/MSIL/MSILWriter.h b/lib/Target/MSIL/MSILWriter.h index 87440e22987..92a3abe5c0a 100644 --- a/lib/Target/MSIL/MSILWriter.h +++ b/lib/Target/MSIL/MSILWriter.h @@ -40,7 +40,7 @@ namespace llvm { static char ID; MSILModule(const std::set*& _UsedTypes, const TargetData*& _TD) - : ModulePass(ID), UsedTypes(_UsedTypes), TD(_TD) {} + : ModulePass(&ID), UsedTypes(_UsedTypes), TD(_TD) {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); @@ -86,7 +86,7 @@ namespace llvm { DenseMap AnonValueNumbers; unsigned NextAnonValueNumber; - MSILWriter(formatted_raw_ostream &o) : FunctionPass(ID), Out(o), + MSILWriter(formatted_raw_ostream &o) : FunctionPass(&ID), Out(o), NextAnonValueNumber(0) { UniqID = 0; } diff --git a/lib/Target/MSP430/MSP430BranchSelector.cpp b/lib/Target/MSP430/MSP430BranchSelector.cpp index b1d6966caeb..529fd931f65 100644 --- a/lib/Target/MSP430/MSP430BranchSelector.cpp +++ b/lib/Target/MSP430/MSP430BranchSelector.cpp @@ -30,7 +30,7 @@ STATISTIC(NumExpanded, "Number of branches expanded to long format"); namespace { struct MSP430BSel : public MachineFunctionPass { static char ID; - MSP430BSel() : MachineFunctionPass(ID) {} + MSP430BSel() : MachineFunctionPass(&ID) {} /// BlockSizes - The sizes of the basic blocks in the function. std::vector BlockSizes; diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp index 597ea0d6c20..a2b615d8add 100644 --- a/lib/Target/Mips/MipsDelaySlotFiller.cpp +++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp @@ -32,7 +32,7 @@ namespace { static char ID; Filler(TargetMachine &tm) - : MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { } + : MachineFunctionPass(&ID), TM(tm), TII(tm.getInstrInfo()) { } virtual const char *getPassName() const { return "Mips Delay Slot Filler"; diff --git a/lib/Target/PIC16/PIC16MemSelOpt.cpp b/lib/Target/PIC16/PIC16MemSelOpt.cpp index b6aa38f765e..241170b11c2 100644 --- a/lib/Target/PIC16/PIC16MemSelOpt.cpp +++ b/lib/Target/PIC16/PIC16MemSelOpt.cpp @@ -38,7 +38,7 @@ using namespace llvm; namespace { struct MemSelOpt : public MachineFunctionPass { static char ID; - MemSelOpt() : MachineFunctionPass(ID) {} + MemSelOpt() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreservedID(MachineLoopInfoID); diff --git a/lib/Target/PIC16/PIC16Passes/PIC16Cloner.h b/lib/Target/PIC16/PIC16Passes/PIC16Cloner.h index e7d67ce0962..e8b5aa45cdc 100644 --- a/lib/Target/PIC16/PIC16Passes/PIC16Cloner.h +++ b/lib/Target/PIC16/PIC16Passes/PIC16Cloner.h @@ -35,7 +35,7 @@ namespace llvm { class PIC16Cloner : public ModulePass { public: static char ID; // Class identification - PIC16Cloner() : ModulePass(ID) {} + PIC16Cloner() : ModulePass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); diff --git a/lib/Target/PIC16/PIC16Passes/PIC16Overlay.h b/lib/Target/PIC16/PIC16Passes/PIC16Overlay.h index 2f611e65de1..5a2551fabcd 100644 --- a/lib/Target/PIC16/PIC16Passes/PIC16Overlay.h +++ b/lib/Target/PIC16/PIC16Passes/PIC16Overlay.h @@ -39,7 +39,7 @@ namespace llvm { unsigned IndirectCallColor; public: static char ID; // Class identification - PIC16Overlay() : ModulePass(ID) { + PIC16Overlay() : ModulePass(&ID) { OverlayStr = "Overlay="; InterruptDepth = PIC16OVERLAY::StartInterruptColor; IndirectCallColor = PIC16OVERLAY::StartIndirectCallColor; diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp index df24e96b8e8..8c427a1c78b 100644 --- a/lib/Target/PowerPC/PPCBranchSelector.cpp +++ b/lib/Target/PowerPC/PPCBranchSelector.cpp @@ -31,7 +31,7 @@ STATISTIC(NumExpanded, "Number of branches expanded to long format"); namespace { struct PPCBSel : public MachineFunctionPass { static char ID; - PPCBSel() : MachineFunctionPass(ID) {} + PPCBSel() : MachineFunctionPass(&ID) {} /// BlockSizes - The sizes of the basic blocks in the function. std::vector BlockSizes; diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp index df9ab52389b..d03cf05a9ce 100644 --- a/lib/Target/PowerPC/PPCCodeEmitter.cpp +++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp @@ -45,7 +45,7 @@ namespace { public: PPCCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce) - : MachineFunctionPass(ID), TM(tm), MCE(mce) {} + : MachineFunctionPass(&ID), TM(tm), MCE(mce) {} /// getBinaryCodeForInstr - This function, generated by the /// CodeEmitterGenerator using TableGen, produces the binary encoding for diff --git a/lib/Target/Sparc/DelaySlotFiller.cpp b/lib/Target/Sparc/DelaySlotFiller.cpp index aae5da85600..9e148ada885 100644 --- a/lib/Target/Sparc/DelaySlotFiller.cpp +++ b/lib/Target/Sparc/DelaySlotFiller.cpp @@ -32,7 +32,7 @@ namespace { static char ID; Filler(TargetMachine &tm) - : MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { } + : MachineFunctionPass(&ID), TM(tm), TII(tm.getInstrInfo()) { } virtual const char *getPassName() const { return "SPARC Delay Slot Filler"; diff --git a/lib/Target/Sparc/FPMover.cpp b/lib/Target/Sparc/FPMover.cpp index 1423b1e64d6..88b0927b355 100644 --- a/lib/Target/Sparc/FPMover.cpp +++ b/lib/Target/Sparc/FPMover.cpp @@ -36,7 +36,7 @@ namespace { static char ID; explicit FPMover(TargetMachine &tm) - : MachineFunctionPass(ID), TM(tm) { } + : MachineFunctionPass(&ID), TM(tm) { } virtual const char *getPassName() const { return "Sparc Double-FP Move Fixer"; diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 406d288d183..65f514c2647 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -226,13 +226,13 @@ void TargetData::init(StringRef Desc) { /// /// @note This has to exist, because this is a pass, but it should never be /// used. -TargetData::TargetData() : ImmutablePass(ID) { +TargetData::TargetData() : ImmutablePass(&ID) { report_fatal_error("Bad TargetData ctor used. " "Tool did not specify a TargetData to use?"); } TargetData::TargetData(const Module *M) - : ImmutablePass(ID) { + : ImmutablePass(&ID) { init(M->getDataLayout()); } diff --git a/lib/Target/X86/SSEDomainFix.cpp b/lib/Target/X86/SSEDomainFix.cpp index 13680c592e0..dab070e1feb 100644 --- a/lib/Target/X86/SSEDomainFix.cpp +++ b/lib/Target/X86/SSEDomainFix.cpp @@ -115,7 +115,7 @@ class SSEDomainFixPass : public MachineFunctionPass { unsigned Distance; public: - SSEDomainFixPass() : MachineFunctionPass(ID) {} + SSEDomainFixPass() : MachineFunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index ef2255de19c..4fd034e53ed 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -53,12 +53,12 @@ namespace { public: static char ID; explicit Emitter(X86TargetMachine &tm, CodeEmitter &mce) - : MachineFunctionPass(ID), II(0), TD(0), TM(tm), + : MachineFunctionPass(&ID), II(0), TD(0), TM(tm), MCE(mce), PICBaseOffset(0), Is64BitMode(false), IsPIC(TM.getRelocationModel() == Reloc::PIC_) {} Emitter(X86TargetMachine &tm, CodeEmitter &mce, const X86InstrInfo &ii, const TargetData &td, bool is64) - : MachineFunctionPass(ID), II(&ii), TD(&td), TM(tm), + : MachineFunctionPass(&ID), II(&ii), TD(&td), TM(tm), MCE(mce), PICBaseOffset(0), Is64BitMode(is64), IsPIC(TM.getRelocationModel() == Reloc::PIC_) {} diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp index cd23a7d6b2d..a58c5901478 100644 --- a/lib/Target/X86/X86FloatingPoint.cpp +++ b/lib/Target/X86/X86FloatingPoint.cpp @@ -50,7 +50,7 @@ STATISTIC(NumFP , "Number of floating point instructions"); namespace { struct FPS : public MachineFunctionPass { static char ID; - FPS() : MachineFunctionPass(ID) { + FPS() : MachineFunctionPass(&ID) { // This is really only to keep valgrind quiet. // The logic in isLive() is too much for it. memset(Stack, 0, sizeof(Stack)); diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 4ee0c0af835..98323fa7b07 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -3029,7 +3029,7 @@ namespace { /// global base register for x86-32. struct CGBR : public MachineFunctionPass { static char ID; - CGBR() : MachineFunctionPass(ID) {} + CGBR() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF) { const X86TargetMachine *TM = diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index 746e3fa7b5c..afb07405b70 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -1557,7 +1557,7 @@ unsigned getX86SubSuperRegister(unsigned Reg, EVT VT, bool High) { namespace { struct MSAH : public MachineFunctionPass { static char ID; - MSAH() : MachineFunctionPass(ID) {} + MSAH() : MachineFunctionPass(&ID) {} virtual bool runOnMachineFunction(MachineFunction &MF) { const X86TargetMachine *TM = diff --git a/lib/Transforms/Hello/Hello.cpp b/lib/Transforms/Hello/Hello.cpp index 838d5505490..bf59c044733 100644 --- a/lib/Transforms/Hello/Hello.cpp +++ b/lib/Transforms/Hello/Hello.cpp @@ -25,7 +25,7 @@ namespace { // Hello - The first implementation, without getAnalysisUsage. struct Hello : public FunctionPass { static char ID; // Pass identification, replacement for typeid - Hello() : FunctionPass(ID) {} + Hello() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F) { ++HelloCounter; @@ -43,7 +43,7 @@ namespace { // Hello2 - The second implementation with getAnalysisUsage implemented. struct Hello2 : public FunctionPass { static char ID; // Pass identification, replacement for typeid - Hello2() : FunctionPass(ID) {} + Hello2() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F) { ++HelloCounter; diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 0c77e1fd8cf..4cd4e17f3d2 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -67,7 +67,7 @@ namespace { virtual bool runOnSCC(CallGraphSCC &SCC); static char ID; // Pass identification, replacement for typeid explicit ArgPromotion(unsigned maxElements = 3) - : CallGraphSCCPass(ID), maxElements(maxElements) {} + : CallGraphSCCPass(&ID), maxElements(maxElements) {} /// A vector used to hold the indices of a single GEP instruction typedef std::vector IndicesVector; diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index 75282fae18b..5c6bc868c93 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -31,7 +31,7 @@ STATISTIC(NumMerged, "Number of global constants merged"); namespace { struct ConstantMerge : public ModulePass { static char ID; // Pass identification, replacement for typeid - ConstantMerge() : ModulePass(ID) {} + ConstantMerge() : ModulePass(&ID) {} // run - For this pass, process all of the globals in the module, // eliminating duplicate constants. diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 47df235424e..7202f50a362 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -122,11 +122,11 @@ namespace { protected: // DAH uses this to specify a different ID. - explicit DAE(char &ID) : ModulePass(ID) {} + explicit DAE(void *ID) : ModulePass(ID) {} public: static char ID; // Pass identification, replacement for typeid - DAE() : ModulePass(ID) {} + DAE() : ModulePass(&ID) {} bool runOnModule(Module &M); @@ -159,7 +159,7 @@ namespace { /// by bugpoint. struct DAH : public DAE { static char ID; - DAH() : DAE(ID) {} + DAH() : DAE(&ID) {} virtual bool ShouldHackArguments() const { return true; } }; diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index 5dc50c5bef3..5ff80f72cf4 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -26,7 +26,7 @@ STATISTIC(NumKilled, "Number of unused typenames removed from symtab"); namespace { struct DTE : public ModulePass { static char ID; // Pass identification, replacement for typeid - DTE() : ModulePass(ID) {} + DTE() : ModulePass(&ID) {} // doPassInitialization - For this pass, it removes global symbol table // entries for primitive types. These are never used for linking in GCC and diff --git a/lib/Transforms/IPO/ExtractGV.cpp b/lib/Transforms/IPO/ExtractGV.cpp index 9eb690d9474..7f67e48ade8 100644 --- a/lib/Transforms/IPO/ExtractGV.cpp +++ b/lib/Transforms/IPO/ExtractGV.cpp @@ -35,7 +35,7 @@ namespace { /// explicit GVExtractorPass(std::vector& GVs, bool deleteS = true, bool relinkCallees = false) - : ModulePass(ID), Named(GVs), deleteStuff(deleteS), + : ModulePass(&ID), Named(GVs), deleteStuff(deleteS), reLink(relinkCallees) {} bool runOnModule(Module &M) { diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp index 6165ba023f7..d5c35ea59d6 100644 --- a/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/lib/Transforms/IPO/FunctionAttrs.cpp @@ -41,7 +41,7 @@ STATISTIC(NumNoAlias, "Number of function returns marked noalias"); namespace { struct FunctionAttrs : public CallGraphSCCPass { static char ID; // Pass identification, replacement for typeid - FunctionAttrs() : CallGraphSCCPass(ID) {} + FunctionAttrs() : CallGraphSCCPass(&ID) {} // runOnSCC - Analyze the SCC, performing the transformation if possible. bool runOnSCC(CallGraphSCC &SCC); diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index aa18601b9ae..129cb7c46e0 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -31,7 +31,7 @@ STATISTIC(NumVariables, "Number of global variables removed"); namespace { struct GlobalDCE : public ModulePass { static char ID; // Pass identification, replacement for typeid - GlobalDCE() : ModulePass(ID) {} + GlobalDCE() : ModulePass(&ID) {} // run - Do the GlobalDCE pass on the specified module, optionally updating // the specified callgraph to reflect the changes. diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index a77af549caa..9ea98ec4775 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -59,7 +59,7 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const { } static char ID; // Pass identification, replacement for typeid - GlobalOpt() : ModulePass(ID) {} + GlobalOpt() : ModulePass(&ID) {} bool runOnModule(Module &M); diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index 1b3cf7810cc..762935e38c2 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -35,7 +35,7 @@ namespace { /// struct IPCP : public ModulePass { static char ID; // Pass identification, replacement for typeid - IPCP() : ModulePass(ID) {} + IPCP() : ModulePass(&ID) {} bool runOnModule(Module &M); private: diff --git a/lib/Transforms/IPO/InlineAlways.cpp b/lib/Transforms/IPO/InlineAlways.cpp index ecc60ad0693..43b50fcb3d5 100644 --- a/lib/Transforms/IPO/InlineAlways.cpp +++ b/lib/Transforms/IPO/InlineAlways.cpp @@ -36,7 +36,7 @@ namespace { InlineCostAnalyzer CA; public: // Use extremely low threshold. - AlwaysInliner() : Inliner(ID, -2000000000) {} + AlwaysInliner() : Inliner(&ID, -2000000000) {} static char ID; // Pass identification, replacement for typeid InlineCost getInlineCost(CallSite CS) { return CA.getInlineCost(CS, NeverInline); diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 9c6637dfe5a..e609fb6867f 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -33,8 +33,8 @@ namespace { SmallPtrSet NeverInline; InlineCostAnalyzer CA; public: - SimpleInliner() : Inliner(ID) {} - SimpleInliner(int Threshold) : Inliner(ID, Threshold) {} + SimpleInliner() : Inliner(&ID) {} + SimpleInliner(int Threshold) : Inliner(&ID, Threshold) {} static char ID; // Pass identification, replacement for typeid InlineCost getInlineCost(CallSite CS) { return CA.getInlineCost(CS, NeverInline); diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 4983e8e13a3..876e80e5371 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -48,10 +48,10 @@ HintThreshold("inlinehint-threshold", cl::Hidden, cl::init(325), // Threshold to use when optsize is specified (and there is no -inline-limit). const int OptSizeThreshold = 75; -Inliner::Inliner(char &ID) +Inliner::Inliner(void *ID) : CallGraphSCCPass(ID), InlineThreshold(InlineLimit) {} -Inliner::Inliner(char &ID, int Threshold) +Inliner::Inliner(void *ID, int Threshold) : CallGraphSCCPass(ID), InlineThreshold(Threshold) {} /// getAnalysisUsage - For this class, we declare that we require and preserve diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index a1d919fd8a0..1f861e02e2d 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -67,7 +67,7 @@ INITIALIZE_PASS(InternalizePass, "internalize", "Internalize Global Symbols", false, false); InternalizePass::InternalizePass(bool AllButMain) - : ModulePass(ID), AllButMain(AllButMain){ + : ModulePass(&ID), AllButMain(AllButMain){ if (!APIFile.empty()) // If a filename is specified, use it. LoadFile(APIFile.c_str()); if (!APIList.empty()) // If a list is specified, use it as well. @@ -75,7 +75,7 @@ InternalizePass::InternalizePass(bool AllButMain) } InternalizePass::InternalizePass(const std::vector&exportList) - : ModulePass(ID), AllButMain(false){ + : ModulePass(&ID), AllButMain(false){ for(std::vector::const_iterator itr = exportList.begin(); itr != exportList.end(); itr++) { ExternalNames.insert(*itr); diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp index f88dff67d7c..fd60adfc507 100644 --- a/lib/Transforms/IPO/LoopExtractor.cpp +++ b/lib/Transforms/IPO/LoopExtractor.cpp @@ -37,7 +37,7 @@ namespace { unsigned NumLoops; explicit LoopExtractor(unsigned numLoops = ~0) - : LoopPass(ID), NumLoops(numLoops) {} + : LoopPass(&ID), NumLoops(numLoops) {} virtual bool runOnLoop(Loop *L, LPPassManager &LPM); @@ -147,7 +147,7 @@ namespace { std::vector > BlocksToNotExtractByName; public: static char ID; // Pass identification, replacement for typeid - BlockExtractorPass() : ModulePass(ID) { + BlockExtractorPass() : ModulePass(&ID) { if (!BlockFile.empty()) LoadFile(BlockFile.c_str()); } diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index 6c715de04b7..fa19ea1fa46 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -109,7 +109,7 @@ namespace { bool IsTransformableFunction(StringRef Name); public: static char ID; // Pass identification, replacement for typeid - LowerSetJmp() : ModulePass(ID) {} + LowerSetJmp() : ModulePass(&ID) {} void visitCallInst(CallInst& CI); void visitInvokeInst(InvokeInst& II); diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp index 73aee456763..43b08bd9b3e 100644 --- a/lib/Transforms/IPO/MergeFunctions.cpp +++ b/lib/Transforms/IPO/MergeFunctions.cpp @@ -88,7 +88,7 @@ namespace { /// struct MergeFunctions : public ModulePass { static char ID; // Pass identification, replacement for typeid - MergeFunctions() : ModulePass(ID) {} + MergeFunctions() : ModulePass(&ID) {} bool runOnModule(Module &M); }; diff --git a/lib/Transforms/IPO/PartialInlining.cpp b/lib/Transforms/IPO/PartialInlining.cpp index eba7b3ae4d1..e4a8fc58c2e 100644 --- a/lib/Transforms/IPO/PartialInlining.cpp +++ b/lib/Transforms/IPO/PartialInlining.cpp @@ -30,7 +30,7 @@ namespace { struct PartialInliner : public ModulePass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { } static char ID; // Pass identification, replacement for typeid - PartialInliner() : ModulePass(ID) {} + PartialInliner() : ModulePass(&ID) {} bool runOnModule(Module& M); diff --git a/lib/Transforms/IPO/PartialSpecialization.cpp b/lib/Transforms/IPO/PartialSpecialization.cpp index 17245c7acd3..d46879f5093 100644 --- a/lib/Transforms/IPO/PartialSpecialization.cpp +++ b/lib/Transforms/IPO/PartialSpecialization.cpp @@ -50,7 +50,7 @@ namespace { int scanDistribution(Function&, int, std::map&); public : static char ID; // Pass identification, replacement for typeid - PartSpec() : ModulePass(ID) {} + PartSpec() : ModulePass(&ID) {} bool runOnModule(Module &M); }; } diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index 09ac76f9796..7d2968e024b 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -37,7 +37,7 @@ STATISTIC(NumUnreach, "Number of noreturn calls optimized"); namespace { struct PruneEH : public CallGraphSCCPass { static char ID; // Pass identification, replacement for typeid - PruneEH() : CallGraphSCCPass(ID) {} + PruneEH() : CallGraphSCCPass(&ID) {} // runOnSCC - Analyze the SCC, performing the transformation if possible. bool runOnSCC(CallGraphSCC &SCC); diff --git a/lib/Transforms/IPO/StripDeadPrototypes.cpp b/lib/Transforms/IPO/StripDeadPrototypes.cpp index ee10ad0b8ba..32722f1e1e8 100644 --- a/lib/Transforms/IPO/StripDeadPrototypes.cpp +++ b/lib/Transforms/IPO/StripDeadPrototypes.cpp @@ -29,7 +29,7 @@ namespace { class StripDeadPrototypesPass : public ModulePass { public: static char ID; // Pass identification, replacement for typeid - StripDeadPrototypesPass() : ModulePass(ID) { } + StripDeadPrototypesPass() : ModulePass(&ID) { } virtual bool runOnModule(Module &M); }; diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp index c6c4fde0a2b..55674614bce 100644 --- a/lib/Transforms/IPO/StripSymbols.cpp +++ b/lib/Transforms/IPO/StripSymbols.cpp @@ -39,7 +39,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit StripSymbols(bool ODI = false) - : ModulePass(ID), OnlyDebugInfo(ODI) {} + : ModulePass(&ID), OnlyDebugInfo(ODI) {} virtual bool runOnModule(Module &M); @@ -52,7 +52,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit StripNonDebugSymbols() - : ModulePass(ID) {} + : ModulePass(&ID) {} virtual bool runOnModule(Module &M); @@ -65,7 +65,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit StripDebugDeclare() - : ModulePass(ID) {} + : ModulePass(&ID) {} virtual bool runOnModule(Module &M); @@ -78,7 +78,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit StripDeadDebugInfo() - : ModulePass(ID) {} + : ModulePass(&ID) {} virtual bool runOnModule(Module &M); diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp index aa470b954d6..56896466c93 100644 --- a/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/lib/Transforms/IPO/StructRetPromotion.cpp @@ -50,7 +50,7 @@ namespace { virtual bool runOnSCC(CallGraphSCC &SCC); static char ID; // Pass identification, replacement for typeid - SRETPromotion() : CallGraphSCCPass(ID) {} + SRETPromotion() : CallGraphSCCPass(&ID) {} private: CallGraphNode *PromoteReturn(CallGraphNode *CGN); diff --git a/lib/Transforms/InstCombine/InstCombine.h b/lib/Transforms/InstCombine/InstCombine.h index 6f9609cf997..24e052881a9 100644 --- a/lib/Transforms/InstCombine/InstCombine.h +++ b/lib/Transforms/InstCombine/InstCombine.h @@ -81,7 +81,7 @@ public: BuilderTy *Builder; static char ID; // Pass identification, replacement for typeid - InstCombiner() : FunctionPass(ID), TD(0), Builder(0) {} + InstCombiner() : FunctionPass(&ID), TD(0), Builder(0) {} public: virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index a77d70cd1c1..e5cd1f0ef42 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -34,7 +34,7 @@ namespace { bool runOnModule(Module &M); public: static char ID; // Pass identification, replacement for typeid - EdgeProfiler() : ModulePass(ID) {} + EdgeProfiler() : ModulePass(&ID) {} virtual const char *getPassName() const { return "Edge Profiler"; diff --git a/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp b/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp index 8eec9872812..a6de60d2935 100644 --- a/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp @@ -36,7 +36,7 @@ namespace { bool runOnModule(Module &M); public: static char ID; // Pass identification, replacement for typeid - OptimalEdgeProfiler() : ModulePass(ID) {} + OptimalEdgeProfiler() : ModulePass(&ID) {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(ProfileEstimatorPassID); diff --git a/lib/Transforms/Scalar/ABCD.cpp b/lib/Transforms/Scalar/ABCD.cpp index 03187620d3d..20f90839c97 100644 --- a/lib/Transforms/Scalar/ABCD.cpp +++ b/lib/Transforms/Scalar/ABCD.cpp @@ -49,7 +49,7 @@ namespace { class ABCD : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid. - ABCD() : FunctionPass(ID) {} + ABCD() : FunctionPass(&ID) {} void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index ada086e9db7..4df1c7c8b8a 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -33,7 +33,7 @@ STATISTIC(NumRemoved, "Number of instructions removed"); namespace { struct ADCE : public FunctionPass { static char ID; // Pass identification, replacement for typeid - ADCE() : FunctionPass(ID) {} + ADCE() : FunctionPass(&ID) {} virtual bool runOnFunction(Function& F); diff --git a/lib/Transforms/Scalar/BasicBlockPlacement.cpp b/lib/Transforms/Scalar/BasicBlockPlacement.cpp index b144678c6a0..89fb64c58bf 100644 --- a/lib/Transforms/Scalar/BasicBlockPlacement.cpp +++ b/lib/Transforms/Scalar/BasicBlockPlacement.cpp @@ -41,7 +41,7 @@ STATISTIC(NumMoved, "Number of basic blocks moved"); namespace { struct BlockPlacement : public FunctionPass { static char ID; // Pass identification, replacement for typeid - BlockPlacement() : FunctionPass(ID) {} + BlockPlacement() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 823caceb2f8..0c14b521cad 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -54,7 +54,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit CodeGenPrepare(const TargetLowering *tli = 0) - : FunctionPass(ID), TLI(tli) {} + : FunctionPass(&ID), TLI(tli) {} bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index a0ea369d0ca..0e9d68cbe66 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -34,7 +34,7 @@ STATISTIC(NumInstKilled, "Number of instructions killed"); namespace { struct ConstantPropagation : public FunctionPass { static char ID; // Pass identification, replacement for typeid - ConstantPropagation() : FunctionPass(ID) {} + ConstantPropagation() : FunctionPass(&ID) {} bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 87ea8038356..6baeceb5ee2 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -35,7 +35,7 @@ namespace { // struct DeadInstElimination : public BasicBlockPass { static char ID; // Pass identification, replacement for typeid - DeadInstElimination() : BasicBlockPass(ID) {} + DeadInstElimination() : BasicBlockPass(&ID) {} virtual bool runOnBasicBlock(BasicBlock &BB) { bool Changed = false; for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) { @@ -70,7 +70,7 @@ namespace { // struct DCE : public FunctionPass { static char ID; // Pass identification, replacement for typeid - DCE() : FunctionPass(ID) {} + DCE() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index c8fd9d9fa55..ce15f48958d 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -40,7 +40,7 @@ namespace { TargetData *TD; static char ID; // Pass identification, replacement for typeid - DSE() : FunctionPass(ID) {} + DSE() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F) { bool Changed = false; diff --git a/lib/Transforms/Scalar/GEPSplitter.cpp b/lib/Transforms/Scalar/GEPSplitter.cpp index 53dd06d24bb..5894f8ff443 100644 --- a/lib/Transforms/Scalar/GEPSplitter.cpp +++ b/lib/Transforms/Scalar/GEPSplitter.cpp @@ -27,7 +27,7 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const; public: static char ID; // Pass identification, replacement for typeid - explicit GEPSplitter() : FunctionPass(ID) {} + explicit GEPSplitter() : FunctionPass(&ID) {} }; } diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 42afd6d5dbc..646aec317ed 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -665,7 +665,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid explicit GVN(bool noloads = false) - : FunctionPass(ID), NoLoads(noloads), MD(0) { } + : FunctionPass(&ID), NoLoads(noloads), MD(0) { } private: bool NoLoads; diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index af2eafc47cb..13c6a972602 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -77,7 +77,7 @@ namespace { public: static char ID; // Pass identification, replacement for typeid - IndVarSimplify() : LoopPass(ID) {} + IndVarSimplify() : LoopPass(&ID) {} virtual bool runOnLoop(Loop *L, LPPassManager &LPM); diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index c2caf48b761..c826d66813d 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -79,7 +79,7 @@ namespace { #endif public: static char ID; // Pass identification - JumpThreading() : FunctionPass(ID) {} + JumpThreading() : FunctionPass(&ID) {} bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 964a3b2a9a5..da9f0b1e395 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -66,7 +66,7 @@ DisablePromotion("disable-licm-promotion", cl::Hidden, namespace { struct LICM : public LoopPass { static char ID; // Pass identification, replacement for typeid - LICM() : LoopPass(ID) {} + LICM() : LoopPass(&ID) {} virtual bool runOnLoop(Loop *L, LPPassManager &LPM); diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp index 543dfc1cba0..bd0e2071861 100644 --- a/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/lib/Transforms/Scalar/LoopDeletion.cpp @@ -28,7 +28,7 @@ namespace { class LoopDeletion : public LoopPass { public: static char ID; // Pass ID, replacement for typeid - LoopDeletion() : LoopPass(ID) {} + LoopDeletion() : LoopPass(&ID) {} // Possibly eliminate loop L if it is dead. bool runOnLoop(Loop* L, LPPassManager& LPM); diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index a4336743a8f..4f1ac77c8de 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -74,7 +74,7 @@ namespace { class LoopIndexSplit : public LoopPass { public: static char ID; // Pass ID, replacement for typeid - LoopIndexSplit() : LoopPass(ID) {} + LoopIndexSplit() : LoopPass(&ID) {} // Index split Loop L. Return true if loop is split. bool runOnLoop(Loop *L, LPPassManager &LPM); diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 1e4bfa94be5..6fecbb3a280 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -35,7 +35,7 @@ namespace { class LoopRotate : public LoopPass { public: static char ID; // Pass ID, replacement for typeid - LoopRotate() : LoopPass(ID) {} + LoopRotate() : LoopPass(&ID) {} // Rotate Loop L as many times as possible. Return true if // loop is rotated at least once. diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f7b22a0966b..fd11e00df26 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3751,7 +3751,7 @@ Pass *llvm::createLoopStrengthReducePass(const TargetLowering *TLI) { } LoopStrengthReduce::LoopStrengthReduce(const TargetLowering *tli) - : LoopPass(ID), TLI(tli) {} + : LoopPass(&ID), TLI(tli) {} void LoopStrengthReduce::getAnalysisUsage(AnalysisUsage &AU) const { // We split critical edges, so we change the CFG. However, we do update diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index 4ed2d456872..37ab3b0b5bc 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -43,7 +43,7 @@ namespace { class LoopUnroll : public LoopPass { public: static char ID; // Pass ID, replacement for typeid - LoopUnroll() : LoopPass(ID) {} + LoopUnroll() : LoopPass(&ID) {} /// A magic value for use with the Threshold parameter to indicate /// that the loop unroll should be performed regardless of how much diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 717917e2cea..f30d1e850ee 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -92,7 +92,7 @@ namespace { public: static char ID; // Pass ID, replacement for typeid explicit LoopUnswitch(bool Os = false) : - LoopPass(ID), OptimizeForSize(Os), redoLoop(false), + LoopPass(&ID), OptimizeForSize(Os), redoLoop(false), currentLoop(NULL), DF(NULL), DT(NULL), loopHeader(NULL), loopPreheader(NULL) {} diff --git a/lib/Transforms/Scalar/LowerAtomic.cpp b/lib/Transforms/Scalar/LowerAtomic.cpp index 4d193d8136f..11f52570e18 100644 --- a/lib/Transforms/Scalar/LowerAtomic.cpp +++ b/lib/Transforms/Scalar/LowerAtomic.cpp @@ -138,7 +138,7 @@ bool LowerAtomicIntrinsic(CallInst *CI) { struct LowerAtomic : public BasicBlockPass { static char ID; - LowerAtomic() : BasicBlockPass(ID) {} + LowerAtomic() : BasicBlockPass(&ID) {} bool runOnBasicBlock(BasicBlock &BB) { bool Changed = false; for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE; ) { diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 24fae423d2f..7c0563b1758 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -304,7 +304,7 @@ namespace { bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid - MemCpyOpt() : FunctionPass(ID) {} + MemCpyOpt() : FunctionPass(&ID) {} private: // This transformation requires dominator postdominator info diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index b8afcc12d92..e686c52fd8a 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -77,7 +77,7 @@ namespace { bool MadeChange; public: static char ID; // Pass identification, replacement for typeid - Reassociate() : FunctionPass(ID) {} + Reassociate() : FunctionPass(&ID) {} bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp index cf32930dd64..13222ac2200 100644 --- a/lib/Transforms/Scalar/Reg2Mem.cpp +++ b/lib/Transforms/Scalar/Reg2Mem.cpp @@ -36,7 +36,7 @@ STATISTIC(NumPhisDemoted, "Number of phi-nodes demoted"); namespace { struct RegToMem : public FunctionPass { static char ID; // Pass identification, replacement for typeid - RegToMem() : FunctionPass(ID) {} + RegToMem() : FunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(BreakCriticalEdgesID); @@ -124,7 +124,7 @@ bool RegToMem::runOnFunction(Function &F) { // createDemoteRegisterToMemory - Provide an entry point to create this pass. // -char &llvm::DemoteRegisterToMemoryID = RegToMem::ID; +const PassInfo *const llvm::DemoteRegisterToMemoryID = &X; FunctionPass *llvm::createDemoteRegisterToMemoryPass() { return new RegToMem(); } diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 5cf0abca4cc..82294dcd5fb 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1586,7 +1586,7 @@ namespace { /// struct SCCP : public FunctionPass { static char ID; // Pass identification, replacement for typeid - SCCP() : FunctionPass(ID) {} + SCCP() : FunctionPass(&ID) {} // runOnFunction - Run the Sparse Conditional Constant Propagation // algorithm, and return true if the function was modified. @@ -1702,7 +1702,7 @@ namespace { /// struct IPSCCP : public ModulePass { static char ID; - IPSCCP() : ModulePass(ID) {} + IPSCCP() : ModulePass(&ID) {} bool runOnModule(Module &M); }; } // end anonymous namespace diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 68c2df1691e..fa0a6972025 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -51,7 +51,7 @@ STATISTIC(NumGlobals, "Number of allocas copied from constant global"); namespace { struct SROA : public FunctionPass { static char ID; // Pass identification, replacement for typeid - explicit SROA(signed T = -1) : FunctionPass(ID) { + explicit SROA(signed T = -1) : FunctionPass(&ID) { if (T == -1) SRThreshold = 128; else diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp index df6ef2ee75b..dad8f2aaec0 100644 --- a/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -42,7 +42,7 @@ STATISTIC(NumSimpl, "Number of blocks simplified"); namespace { struct CFGSimplifyPass : public FunctionPass { static char ID; // Pass identification, replacement for typeid - CFGSimplifyPass() : FunctionPass(ID) {} + CFGSimplifyPass() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F); }; diff --git a/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp b/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp index 3ec70ec2e02..f8828842e0d 100644 --- a/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp @@ -32,7 +32,7 @@ namespace { const TargetData *TD; public: static char ID; // Pass identification - SimplifyHalfPowrLibCalls() : FunctionPass(ID) {} + SimplifyHalfPowrLibCalls() : FunctionPass(&ID) {} bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp index d7ce53f3671..1fdd6f144a7 100644 --- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -1237,7 +1237,7 @@ namespace { bool Modified; // This is only used by doInitialization. public: static char ID; // Pass identification - SimplifyLibCalls() : FunctionPass(ID), StrCpy(false), StrCpyChk(true) {} + SimplifyLibCalls() : FunctionPass(&ID), StrCpy(false), StrCpyChk(true) {} void InitOptimizations(); bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/Sink.cpp b/lib/Transforms/Scalar/Sink.cpp index 95d3dedfb62..2448312673b 100644 --- a/lib/Transforms/Scalar/Sink.cpp +++ b/lib/Transforms/Scalar/Sink.cpp @@ -35,7 +35,7 @@ namespace { public: static char ID; // Pass identification - Sinking() : FunctionPass(ID) {} + Sinking() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 2e437ac778c..006ce90b376 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -49,7 +49,7 @@ namespace { bool runOnFunction(Function &F); public: static char ID; // Pass identification, replacement for typeid - TailDup() : FunctionPass(ID) {} + TailDup() : FunctionPass(&ID) {} private: inline bool shouldEliminateUnconditionalBranch(TerminatorInst *, unsigned); diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index e197b528f8e..5b105e4c0c2 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -72,7 +72,7 @@ STATISTIC(NumAccumAdded, "Number of accumulators introduced"); namespace { struct TailCallElim : public FunctionPass { static char ID; // Pass identification, replacement for typeid - TailCallElim() : FunctionPass(ID) {} + TailCallElim() : FunctionPass(&ID) {} virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index 424d8785c1d..baa114b099e 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... -char &llvm::BreakCriticalEdgesID = BreakCriticalEdges::ID; +const PassInfo *const llvm::BreakCriticalEdgesID = &X; FunctionPass *llvm::createBreakCriticalEdgesPass() { return new BreakCriticalEdges(); } diff --git a/lib/Transforms/Utils/InstructionNamer.cpp b/lib/Transforms/Utils/InstructionNamer.cpp index 81a7101188e..090af95c4b8 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 { } -char &llvm::InstructionNamerID = InstNamer::ID; +const PassInfo *const llvm::InstructionNamerID = &X; //===----------------------------------------------------------------------===// // // InstructionNamer - Give any unnamed non-void instructions "tmp" names. diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index bf3695d2c83..d380e0dbc10 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(); } -char &llvm::LCSSAID = LCSSA::ID; +const PassInfo *const llvm::LCSSAID = &X; /// 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 16902ff9150..1571fe8f0b3 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... -char &llvm::LoopSimplifyID = LoopSimplify::ID; +const PassInfo *const llvm::LoopSimplifyID = &X; 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 f239a9970d8..2696e6913f3 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"); -char &llvm::LowerInvokePassID = LowerInvoke::ID; +const PassInfo *const llvm::LowerInvokePassID = &X; // 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 1910fd9e520..468a5fe4c5e 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... -char &llvm::LowerSwitchID = LowerSwitch::ID; +const PassInfo *const llvm::LowerSwitchID = &X; // 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 13dda65a6b0..99203b66212 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... -char &llvm::PromoteMemoryToRegisterID = PromotePass::ID; +const PassInfo *const llvm::PromoteMemoryToRegisterID = &X; // 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 81523d3bdc8..62a93e4e991 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); diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index fb23fbfbe15..5a176d59f9b 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -36,7 +36,14 @@ using namespace llvm; // Pass Implementation // -Pass::Pass(PassKind K, char &pid) : Resolver(0), PassID(&pid), Kind(K) { } +Pass::Pass(PassKind K, intptr_t pid) : Resolver(0), PassID(pid), Kind(K) { + assert(pid && "pid cannot be 0"); +} + +Pass::Pass(PassKind K, const void *pid) + : Resolver(0), PassID((intptr_t)pid), Kind(K) { + assert(pid && "pid cannot be 0"); +} // Force out-of-line virtual method. Pass::~Pass() { @@ -55,8 +62,8 @@ PassManagerType ModulePass::getPotentialPassManagerType() const { return PMT_ModulePassManager; } -bool Pass::mustPreserveAnalysisID(char &AID) const { - return Resolver->getAnalysisIfAvailable(&AID, true) != 0; +bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const { + return Resolver->getAnalysisIfAvailable(AnalysisID, true) != 0; } // dumpPassStructure - Implement the -debug-passes=Structure option @@ -69,9 +76,7 @@ void Pass::dumpPassStructure(unsigned Offset) { /// Registration templates, but can be overloaded directly. /// const char *Pass::getPassName() const { - AnalysisID AID = getPassID(); - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(AID); - if (PI) + if (const PassInfo *PI = getPassInfo()) return PI->getPassName(); return "Unnamed pass: implement Pass::getPassName()"; } @@ -97,7 +102,7 @@ void Pass::verifyAnalysis() const { // By default, don't do anything. } -void *Pass::getAdjustedAnalysisPointer(AnalysisID AID) { +void *Pass::getAdjustedAnalysisPointer(const PassInfo *) { return this; } @@ -229,7 +234,13 @@ PassManagerType BasicBlockPass::getPotentialPassManagerType() const { return PMT_BasicBlockPassManager; } -const PassInfo *Pass::lookupPassInfo(const void *TI) { +// getPassInfo - Return the PassInfo data structure that corresponds to this +// pass... +const PassInfo *Pass::getPassInfo() const { + return lookupPassInfo(PassID); +} + +const PassInfo *Pass::lookupPassInfo(intptr_t TI) { return PassRegistry::getPassRegistry()->getPassInfo(TI); } @@ -251,8 +262,8 @@ Pass *PassInfo::createPass() const { // RegisterAGBase implementation // -RegisterAGBase::RegisterAGBase(const char *Name, const void *InterfaceID, - const void *PassID, bool isDefault) +RegisterAGBase::RegisterAGBase(const char *Name, intptr_t InterfaceID, + intptr_t PassID, bool isDefault) : PassInfo(Name, InterfaceID) { PassRegistry::getPassRegistry()->registerAnalysisGroup(InterfaceID, PassID, *this, isDefault); @@ -295,7 +306,7 @@ namespace { void passEnumerate(const PassInfo *P) { if (P->isCFGOnlyPass()) - CFGOnlyList.push_back(P->getTypeInfo()); + CFGOnlyList.push_back(P); } }; } @@ -315,25 +326,15 @@ void AnalysisUsage::setPreservesCFG() { GetCFGOnlyPasses(Preserved).enumeratePasses(); } -AnalysisUsage &AnalysisUsage::addPreserved(StringRef Arg) { - const PassInfo *PI = Pass::lookupPassInfo(Arg); - // If the pass exists, preserve it. Otherwise silently do nothing. - if (PI) Preserved.push_back(PI->getTypeInfo()); - return *this; -} - -AnalysisUsage &AnalysisUsage::addRequiredID(const void *ID) { +AnalysisUsage &AnalysisUsage::addRequiredID(AnalysisID ID) { + assert(ID && "Pass class not registered!"); Required.push_back(ID); return *this; } -AnalysisUsage &AnalysisUsage::addRequiredID(char &ID) { - Required.push_back(&ID); - return *this; -} - -AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(char &ID) { - Required.push_back(&ID); - RequiredTransitive.push_back(&ID); +AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(AnalysisID ID) { + assert(ID && "Pass class not registered!"); + Required.push_back(ID); + RequiredTransitive.push_back(ID); return *this; } diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 75d5503962a..296b0d13a71 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -84,15 +84,13 @@ PrintAfterAll("print-after-all", static bool ShouldPrintBeforeOrAfterPass(Pass *P, PassOptionList &PassesToPrint) { - if (const llvm::PassInfo *PI = - PassRegistry::getPassRegistry()->getPassInfo(P->getPassID())) { - for (unsigned i = 0, ie = PassesToPrint.size(); i < ie; ++i) { - const llvm::PassInfo *PassInf = PassesToPrint[i]; - if (PassInf) - if (PassInf->getPassArgument() == PI->getPassArgument()) { - return true; - } - } + for (unsigned i = 0, ie = PassesToPrint.size(); i < ie; ++i) { + const llvm::PassInfo *PassInf = PassesToPrint[i]; + if (PassInf && P->getPassInfo()) + if (PassInf->getPassArgument() == + P->getPassInfo()->getPassArgument()) { + return true; + } } return false; } @@ -165,7 +163,7 @@ class BBPassManager : public PMDataManager, public FunctionPass { public: static char ID; explicit BBPassManager(int Depth) - : PMDataManager(Depth), FunctionPass(ID) {} + : PMDataManager(Depth), FunctionPass(&ID) {} /// Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the function, and if so, return true. @@ -226,7 +224,7 @@ private: public: static char ID; explicit FunctionPassManagerImpl(int Depth) : - Pass(PT_PassManager, ID), PMDataManager(Depth), + Pass(PT_PassManager, &ID), PMDataManager(Depth), PMTopLevelManager(TLM_Function), wasRun(false) { } /// add - Add a pass to the queue of passes to run. This passes ownership of @@ -300,7 +298,7 @@ class MPPassManager : public Pass, public PMDataManager { public: static char ID; explicit MPPassManager(int Depth) : - Pass(PT_PassManager, ID), PMDataManager(Depth) { } + Pass(PT_PassManager, &ID), PMDataManager(Depth) { } // Delete on the fly managers. virtual ~MPPassManager() { @@ -334,7 +332,7 @@ public: /// Return function pass corresponding to PassInfo PI, that is /// required by module pass MP. Instantiate analysis pass, by using /// its runOnFunction() for function F. - virtual Pass* getOnTheFlyPass(Pass *MP, AnalysisID PI, Function &F); + virtual Pass* getOnTheFlyPass(Pass *MP, const PassInfo *PI, Function &F); virtual const char *getPassName() const { return "Module Pass Manager"; @@ -385,7 +383,7 @@ class PassManagerImpl : public Pass, public: static char ID; explicit PassManagerImpl(int Depth) : - Pass(PT_PassManager, ID), PMDataManager(Depth), + Pass(PT_PassManager, &ID), PMDataManager(Depth), PMTopLevelManager(TLM_Pass) { } /// add - Add a pass to the queue of passes to run. This passes ownership of @@ -570,9 +568,8 @@ void PMTopLevelManager::schedulePass(Pass *P) { // If P is an analysis pass and it is available then do not // generate the analysis again. Stale analysis info should not be // available at this point. - const PassInfo *PI = - PassRegistry::getPassRegistry()->getPassInfo(P->getPassID()); - if (PI && PI->isAnalysis() && findAnalysisPass(P->getPassID())) { + if (P->getPassInfo() && + P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) { delete P; return; } @@ -589,8 +586,7 @@ void PMTopLevelManager::schedulePass(Pass *P) { Pass *AnalysisPass = findAnalysisPass(*I); if (!AnalysisPass) { - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I); - AnalysisPass = PI->createPass(); + AnalysisPass = (*I)->createPass(); if (P->getPotentialPassManagerType () == AnalysisPass->getPotentialPassManagerType()) // Schedule analysis pass that is managed by the same pass manager. @@ -636,21 +632,16 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) { for (SmallVector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); P == NULL && I != E; ++I) { - AnalysisID PI = (*I)->getPassID(); + const PassInfo *PI = (*I)->getPassInfo(); if (PI == AID) P = *I; // If Pass not found then check the interfaces implemented by Immutable Pass if (!P) { - const PassInfo *PassInf = - PassRegistry::getPassRegistry()->getPassInfo(PI); const std::vector &ImmPI = - PassInf->getInterfacesImplemented(); - for (std::vector::const_iterator II = ImmPI.begin(), - EE = ImmPI.end(); II != EE; ++II) { - if ((*II)->getTypeInfo() == AID) - P = *I; - } + PI->getInterfacesImplemented(); + if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end()) + P = *I; } } @@ -733,19 +724,16 @@ PMTopLevelManager::~PMTopLevelManager() { /// Augement AvailableAnalysis by adding analysis made available by pass P. void PMDataManager::recordAvailableAnalysis(Pass *P) { - AnalysisID PI = P->getPassID(); + const PassInfo *PI = P->getPassInfo(); + if (PI == 0) return; AvailableAnalysis[PI] = P; - - assert(AvailableAnalysis.size()); //This pass is the current implementation of all of the interfaces it //implements as well. - const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI); - if (PInf == 0) return; - const std::vector &II = PInf->getInterfacesImplemented(); + const std::vector &II = PI->getInterfacesImplemented(); for (unsigned i = 0, e = II.size(); i != e; ++i) - AvailableAnalysis[II[i]->getTypeInfo()] = P; + AvailableAnalysis[II[i]] = P; } // Return true if P preserves high level analysis used by other @@ -761,7 +749,7 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) { Pass *P1 = *I; if (P1->getAsImmutablePass() == 0 && std::find(PreservedSet.begin(), PreservedSet.end(), - P1->getPassID()) == + P1->getPassInfo()) == PreservedSet.end()) return false; } @@ -811,7 +799,7 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) { AvailableAnalysis.erase(Info); } } - + // Check inherited analysis also. If P is not preserving analysis // provided by parent manager then remove it here. for (unsigned Index = 0; Index < PMT_Last; ++Index) { @@ -873,17 +861,16 @@ void PMDataManager::freePass(Pass *P, StringRef Msg, P->releaseMemory(); } - AnalysisID PI = P->getPassID(); - if (const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI)) { + if (const PassInfo *PI = P->getPassInfo()) { // Remove the pass itself (if it is not already removed). AvailableAnalysis.erase(PI); // Remove all interfaces this pass implements, for which it is also // listed as the available implementation. - const std::vector &II = PInf->getInterfacesImplemented(); + const std::vector &II = PI->getInterfacesImplemented(); for (unsigned i = 0, e = II.size(); i != e; ++i) { std::map::iterator Pos = - AvailableAnalysis.find(II[i]->getTypeInfo()); + AvailableAnalysis.find(II[i]); if (Pos != AvailableAnalysis.end() && Pos->second == P) AvailableAnalysis.erase(Pos); } @@ -954,8 +941,7 @@ void PMDataManager::add(Pass *P, bool ProcessAnalysis) { for (SmallVector::iterator I = ReqAnalysisNotAvailable.begin(), E = ReqAnalysisNotAvailable.end() ;I != E; ++I) { - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I); - Pass *AnalysisPass = PI->createPass(); + Pass *AnalysisPass = (*I)->createPass(); this->addLowerLevelRequiredPass(P, AnalysisPass); } @@ -1058,8 +1044,7 @@ void PMDataManager::dumpPassArguments() const { if (PMDataManager *PMD = (*I)->getAsPMDataManager()) PMD->dumpPassArguments(); else - if (const PassInfo *PI = - PassRegistry::getPassRegistry()->getPassInfo((*I)->getPassID())) + if (const PassInfo *PI = (*I)->getPassInfo()) if (!PI->isAnalysisGroup()) dbgs() << " -" << PI->getPassArgument(); } @@ -1131,8 +1116,7 @@ void PMDataManager::dumpAnalysisUsage(StringRef Msg, const Pass *P, dbgs() << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; for (unsigned i = 0; i != Set.size(); ++i) { if (i) dbgs() << ','; - const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(Set[i]); - dbgs() << ' ' << PInf->getPassName(); + dbgs() << ' ' << Set[i]->getPassName(); } dbgs() << '\n'; } @@ -1163,7 +1147,7 @@ void PMDataManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) { llvm_unreachable("Unable to schedule pass"); } -Pass *PMDataManager::getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F) { +Pass *PMDataManager::getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F) { assert(0 && "Unable to find on the fly pass"); return NULL; } @@ -1182,7 +1166,7 @@ Pass *AnalysisResolver::getAnalysisIfAvailable(AnalysisID ID, bool dir) const { return PM.findAnalysisPass(ID, dir); } -Pass *AnalysisResolver::findImplPass(Pass *P, AnalysisID AnalysisPI, +Pass *AnalysisResolver::findImplPass(Pass *P, const PassInfo *AnalysisPI, Function &F) { return PM.getOnTheFlyPass(P, AnalysisPI, F); } @@ -1577,7 +1561,7 @@ void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) { /// Return function pass corresponding to PassInfo PI, that is /// required by module pass MP. Instantiate analysis pass, by using /// its runOnFunction() for function F. -Pass* MPPassManager::getOnTheFlyPass(Pass *MP, AnalysisID PI, Function &F){ +Pass* MPPassManager::getOnTheFlyPass(Pass *MP, const PassInfo *PI, Function &F){ FunctionPassManagerImpl *FPP = OnTheFlyManagers[MP]; assert(FPP && "Unable to find on the fly pass"); diff --git a/lib/VMCore/PassRegistry.cpp b/lib/VMCore/PassRegistry.cpp index 21dba56aad7..844d82660b4 100644 --- a/lib/VMCore/PassRegistry.cpp +++ b/lib/VMCore/PassRegistry.cpp @@ -60,7 +60,7 @@ ManagedCleanup<&cleanupPassRegistry> registryCleanup ATTRIBUTE_USED; } -const PassInfo *PassRegistry::getPassInfo(const void *TI) const { +const PassInfo *PassRegistry::getPassInfo(intptr_t TI) const { sys::SmartScopedLock Guard(Lock); MapType::const_iterator I = PassInfoMap.find(TI); return I != PassInfoMap.end() ? I->second : 0; @@ -108,8 +108,8 @@ void PassRegistry::enumerateWith(PassRegistrationListener *L) { /// Analysis Group Mechanisms. -void PassRegistry::registerAnalysisGroup(const void *InterfaceID, - const void *PassID, +void PassRegistry::registerAnalysisGroup(intptr_t InterfaceID, + intptr_t PassID, PassInfo& Registeree, bool isDefault) { PassInfo *InterfaceInfo = const_cast(getPassInfo(InterfaceID)); diff --git a/lib/VMCore/PrintModulePass.cpp b/lib/VMCore/PrintModulePass.cpp index 415309e52fa..7baacf71ceb 100644 --- a/lib/VMCore/PrintModulePass.cpp +++ b/lib/VMCore/PrintModulePass.cpp @@ -28,10 +28,10 @@ namespace { bool DeleteStream; // Delete the ostream in our dtor? public: static char ID; - PrintModulePass() : ModulePass(ID), Out(&dbgs()), + PrintModulePass() : ModulePass(&ID), Out(&dbgs()), DeleteStream(false) {} PrintModulePass(const std::string &B, raw_ostream *o, bool DS) - : ModulePass(ID), Banner(B), Out(o), DeleteStream(DS) {} + : ModulePass(&ID), Banner(B), Out(o), DeleteStream(DS) {} ~PrintModulePass() { if (DeleteStream) delete Out; @@ -53,10 +53,10 @@ namespace { bool DeleteStream; // Delete the ostream in our dtor? public: static char ID; - PrintFunctionPass() : FunctionPass(ID), Banner(""), Out(&dbgs()), + PrintFunctionPass() : FunctionPass(&ID), Banner(""), Out(&dbgs()), DeleteStream(false) {} PrintFunctionPass(const std::string &B, raw_ostream *o, bool DS) - : FunctionPass(ID), Banner(B), Out(o), DeleteStream(DS) {} + : FunctionPass(&ID), Banner(B), Out(o), DeleteStream(DS) {} inline ~PrintFunctionPass() { if (DeleteStream) delete Out; diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 52fd134d488..4de1282caf9 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -72,7 +72,7 @@ namespace { // Anonymous namespace for class struct PreVerifier : public FunctionPass { static char ID; // Pass ID, replacement for typeid - PreVerifier() : FunctionPass(ID) { } + PreVerifier() : FunctionPass(&ID) { } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -104,7 +104,7 @@ namespace { // Anonymous namespace for class char PreVerifier::ID = 0; static RegisterPass PreVer("preverify", "Preliminary module verification"); -char &PreVerifyID = PreVerifier::ID; +static const PassInfo *const PreVerifyID = &PreVer; namespace { class TypeSet : public AbstractTypeUser { @@ -182,20 +182,20 @@ namespace { SmallPtrSet MDNodes; Verifier() - : FunctionPass(ID), + : FunctionPass(&ID), Broken(false), RealPass(true), action(AbortProcessAction), Mod(0), Context(0), DT(0), MessagesStr(Messages) {} explicit Verifier(VerifierFailureAction ctn) - : FunctionPass(ID), + : FunctionPass(&ID), Broken(false), RealPass(true), action(ctn), Mod(0), Context(0), DT(0), MessagesStr(Messages) {} explicit Verifier(bool AB) - : FunctionPass(ID), + : FunctionPass(&ID), Broken(false), RealPass(true), action( AB ? AbortProcessAction : PrintMessageAction), Mod(0), Context(0), DT(0), MessagesStr(Messages) {} explicit Verifier(DominatorTree &dt) - : FunctionPass(ID), + : FunctionPass(&ID), Broken(false), RealPass(false), action(PrintMessageAction), Mod(0), Context(0), DT(&dt), MessagesStr(Messages) {} diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index bbdc728890d..6913fd06a93 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -100,8 +100,7 @@ Module *BugDriver::deleteInstructionFromProgram(const Instruction *I, } static const PassInfo *getPI(Pass *P) { - const void *ID = P->getPassID(); - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID); + const PassInfo *PI = P->getPassInfo(); delete P; return PI; } diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp index 4ae23f5b762..900bf632a83 100644 --- a/tools/bugpoint/TestPasses.cpp +++ b/tools/bugpoint/TestPasses.cpp @@ -27,7 +27,7 @@ namespace { class CrashOnCalls : public BasicBlockPass { public: static char ID; // Pass ID, replacement for typeid - CrashOnCalls() : BasicBlockPass(ID) {} + CrashOnCalls() : BasicBlockPass(&ID) {} private: virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -54,7 +54,7 @@ namespace { class DeleteCalls : public BasicBlockPass { public: static char ID; // Pass ID, replacement for typeid - DeleteCalls() : BasicBlockPass(ID) {} + DeleteCalls() : BasicBlockPass(&ID) {} private: bool runOnBasicBlock(BasicBlock &BB) { for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index b4bc455db12..ba5234bdc89 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -90,8 +90,7 @@ namespace { AddToDriver(BugDriver &_D) : D(_D) {} virtual void add(Pass *P) { - const void *ID = P->getPassID(); - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID); + const PassInfo *PI = P->getPassInfo(); D.addPasses(&PI, &PI + 1); } }; diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 0c6c4d7bb78..88adeb43e6d 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -128,7 +128,7 @@ namespace { public: static char ID; // Class identification, replacement for typeinfo. explicit ProfileInfoPrinterPass(ProfileInfoLoader &_PIL) - : ModulePass(ID), PIL(_PIL) {} + : ModulePass(&ID), PIL(_PIL) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index 2fe5d226ec7..a4891d8d767 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -31,7 +31,7 @@ namespace { /// or handle in alias analyses. struct ExternalFunctionsPassedConstants : public ModulePass { static char ID; // Pass ID, replacement for typeid - ExternalFunctionsPassedConstants() : ModulePass(ID) {} + ExternalFunctionsPassedConstants() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (!I->isDeclaration()) continue; @@ -74,7 +74,7 @@ namespace { struct CallGraphPrinter : public ModulePass { static char ID; // Pass ID, replacement for typeid - CallGraphPrinter() : ModulePass(ID) {} + CallGraphPrinter() : ModulePass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp index fa4339a0554..e7c6d1e6af8 100644 --- a/tools/opt/GraphPrinters.cpp +++ b/tools/opt/GraphPrinters.cpp @@ -65,7 +65,7 @@ namespace llvm { namespace { struct CallGraphPrinter : public ModulePass { static char ID; // Pass ID, replacement for typeid - CallGraphPrinter() : ModulePass(ID) {} + CallGraphPrinter() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { WriteGraphToFile(llvm::errs(), "callgraph", &getAnalysis()); @@ -93,7 +93,7 @@ namespace { class DomInfoPrinter : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - DomInfoPrinter() : FunctionPass(ID) {} + DomInfoPrinter() : FunctionPass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp index 067c2038f76..ea486ca2900 100644 --- a/tools/opt/PrintSCC.cpp +++ b/tools/opt/PrintSCC.cpp @@ -36,7 +36,7 @@ using namespace llvm; namespace { struct CFGSCC : public FunctionPass { static char ID; // Pass identification, replacement for typeid - CFGSCC() : FunctionPass(ID) {} + CFGSCC() : FunctionPass(&ID) {} bool runOnFunction(Function& func); void print(raw_ostream &O, const Module* = 0) const { } @@ -48,7 +48,7 @@ namespace { struct CallGraphSCC : public ModulePass { static char ID; // Pass identification, replacement for typeid - CallGraphSCC() : ModulePass(ID) {} + CallGraphSCC() : ModulePass(&ID) {} // run - Print out SCCs in the call graph for the specified module. bool runOnModule(Module &M); diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index f6b829fde93..0878737d34b 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -139,7 +139,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { static char ID; const PassInfo *PassToPrint; CallGraphSCCPassPrinter(const PassInfo *PI) : - CallGraphSCCPass(ID), PassToPrint(PI) {} + CallGraphSCCPass(&ID), PassToPrint(PI) {} virtual bool runOnSCC(CallGraphSCC &SCC) { if (!Quiet) { @@ -148,8 +148,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) { Function *F = (*I)->getFunction(); if (F) - getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), - F->getParent()); + getAnalysisID(PassToPrint).print(outs(), F->getParent()); } } // Get and print pass... @@ -159,7 +158,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint->getTypeInfo()); + AU.addRequiredID(PassToPrint); AU.setPreservesAll(); } }; @@ -169,13 +168,13 @@ char CallGraphSCCPassPrinter::ID = 0; struct ModulePassPrinter : public ModulePass { static char ID; const PassInfo *PassToPrint; - ModulePassPrinter(const PassInfo *PI) : ModulePass(ID), + ModulePassPrinter(const PassInfo *PI) : ModulePass(&ID), PassToPrint(PI) {} virtual bool runOnModule(Module &M) { if (!Quiet) { outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; - getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), &M); + getAnalysisID(PassToPrint).print(outs(), &M); } // Get and print pass... @@ -185,7 +184,7 @@ struct ModulePassPrinter : public ModulePass { virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint->getTypeInfo()); + AU.addRequiredID(PassToPrint); AU.setPreservesAll(); } }; @@ -194,7 +193,7 @@ char ModulePassPrinter::ID = 0; struct FunctionPassPrinter : public FunctionPass { const PassInfo *PassToPrint; static char ID; - FunctionPassPrinter(const PassInfo *PI) : FunctionPass(ID), + FunctionPassPrinter(const PassInfo *PI) : FunctionPass(&ID), PassToPrint(PI) {} virtual bool runOnFunction(Function &F) { @@ -203,15 +202,14 @@ struct FunctionPassPrinter : public FunctionPass { << "' for function '" << F.getName() << "':\n"; } // Get and print pass... - getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), - F.getParent()); + getAnalysisID(PassToPrint).print(outs(), F.getParent()); return false; } virtual const char *getPassName() const { return "FunctionPass Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint->getTypeInfo()); + AU.addRequiredID(PassToPrint); AU.setPreservesAll(); } }; @@ -222,12 +220,12 @@ struct LoopPassPrinter : public LoopPass { static char ID; const PassInfo *PassToPrint; LoopPassPrinter(const PassInfo *PI) : - LoopPass(ID), PassToPrint(PI) {} + LoopPass(&ID), PassToPrint(PI) {} virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { if (!Quiet) { outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; - getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), + getAnalysisID(PassToPrint).print(outs(), L->getHeader()->getParent()->getParent()); } // Get and print pass... @@ -237,7 +235,7 @@ struct LoopPassPrinter : public LoopPass { virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint->getTypeInfo()); + AU.addRequiredID(PassToPrint); AU.setPreservesAll(); } }; @@ -248,7 +246,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass { const PassInfo *PassToPrint; static char ID; BasicBlockPassPrinter(const PassInfo *PI) - : BasicBlockPass(ID), PassToPrint(PI) {} + : BasicBlockPass(&ID), PassToPrint(PI) {} virtual bool runOnBasicBlock(BasicBlock &BB) { if (!Quiet) { @@ -257,15 +255,14 @@ struct BasicBlockPassPrinter : public BasicBlockPass { } // Get and print pass... - getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), - BB.getParent()->getParent()); + getAnalysisID(PassToPrint).print(outs(), BB.getParent()->getParent()); return false; } virtual const char *getPassName() const { return "BasicBlockPass Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint->getTypeInfo()); + AU.addRequiredID(PassToPrint); AU.setPreservesAll(); } }; diff --git a/unittests/VMCore/PassManagerTest.cpp b/unittests/VMCore/PassManagerTest.cpp index 96ee5b45896..cabfc44602c 100644 --- a/unittests/VMCore/PassManagerTest.cpp +++ b/unittests/VMCore/PassManagerTest.cpp @@ -40,7 +40,7 @@ namespace llvm { public: static char run; static char ID; - ModuleNDNM() : ModulePass(ID) {} + ModuleNDNM() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { run++; return false; @@ -56,7 +56,7 @@ namespace llvm { public: static char run; static char ID; - ModuleNDM() : ModulePass(ID) {} + ModuleNDM() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { run++; return true; @@ -70,7 +70,7 @@ namespace llvm { public: static char run; static char ID; - ModuleNDM2() : ModulePass(ID) {} + ModuleNDM2() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { run++; return true; @@ -83,7 +83,7 @@ namespace llvm { public: static char run; static char ID; - ModuleDNM() : ModulePass(ID) {} + ModuleDNM() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { EXPECT_TRUE(getAnalysisIfAvailable()); run++; @@ -119,7 +119,7 @@ namespace llvm { EXPECT_TRUE(finalized); EXPECT_EQ(run, runc); } - PassTestBase() : P(ID), allocated(0) { + PassTestBase() : P(&ID), allocated(0) { initialized = false; finalized = false; runc = 0; @@ -253,7 +253,7 @@ namespace llvm { struct OnTheFlyTest: public ModulePass { public: static char ID; - OnTheFlyTest() : ModulePass(ID) {} + OnTheFlyTest() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { EXPECT_TRUE(getAnalysisIfAvailable()); for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {