From b9762c07cb8cb9cb5034ae7dfec9afc299cc00b7 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 5 Aug 2010 23:42:04 +0000 Subject: [PATCH] Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396 --- 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 | 14 ++-- 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, 484 insertions(+), 480 deletions(-) diff --git a/include/llvm/Analysis/DOTGraphTraitsPass.h b/include/llvm/Analysis/DOTGraphTraitsPass.h index 4828eba5b52..d8daf5196fc 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, const void *ID) : FunctionPass(ID) { + DOTGraphTraitsViewer(std::string GraphName, char &ID) : FunctionPass(ID) { Name = GraphName; } @@ -48,7 +48,7 @@ struct DOTGraphTraitsPrinter : public FunctionPass { std::string Name; - DOTGraphTraitsPrinter(std::string GraphName, const void *ID) + DOTGraphTraitsPrinter(std::string GraphName, char &ID) : FunctionPass(ID) { Name = GraphName; } diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index f79afdd1e9c..73c6e6286b5 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(void *ID, bool isPostDom) + DominanceFrontierBase(char &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 1337385848e..8a78eb62497 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 c1214e7427a..75a5cdf1f99 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 f59b2e35322..ac164c19c95 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 37abb77dc2f..c9adf3f36ad 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(const void *ID, LibCallInfo *LC) + explicit LibCallAliasAnalysis(char &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 PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(const void *PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/include/llvm/Analysis/LoopDependenceAnalysis.h b/include/llvm/Analysis/LoopDependenceAnalysis.h index a1a563796f5..94fd9907090 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 2e90a9631fb..462620f7e3c 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 6f77d019b69..3e1c2a94180 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -28,8 +28,7 @@ class PMStack; class LoopPass : public Pass { public: - explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {} - explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {} + explicit LoopPass(char &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 e8e77960ad8..37425ebe835 100644 --- a/include/llvm/Analysis/Passes.h +++ b/include/llvm/Analysis/Passes.h @@ -92,7 +92,7 @@ namespace llvm { // file. // ModulePass *createProfileLoaderPass(); - extern const PassInfo *ProfileLoaderPassID; + extern char &ProfileLoaderPassID; //===--------------------------------------------------------------------===// // @@ -106,7 +106,7 @@ namespace llvm { // instead of loading it from a previous run. // FunctionPass *createProfileEstimatorPass(); - extern const PassInfo *ProfileEstimatorPassID; + extern char &ProfileEstimatorPassID; //===--------------------------------------------------------------------===// // diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 5552017d918..46ce8200f96 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 e11b9677c74..5fa8b0e574a 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -33,8 +33,7 @@ class CallGraphSCC; class CallGraphSCCPass : public Pass { public: - explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {} - explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, pid) {} + explicit CallGraphSCCPass(char &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 2fc03bd41de..e5273c54977 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 8a59bf1428a..b154bf1b051 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 c6af6a1f89c..ad984db1899 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 fc5ea6f968b..c8182e073b9 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 685e86824c3..b7bf0a36c44 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -31,8 +31,7 @@ class MachineFunction; /// override runOnMachineFunction. class MachineFunctionPass : public FunctionPass { protected: - explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {} - explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {} + explicit MachineFunctionPass(char &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 3b3e31e02af..9760eba7b86 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 c881d74c110..5c148536629 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 const PassInfo *const MachineLoopInfoID; + extern char &MachineLoopInfoID; /// MachineDominators pass - This pass is a machine dominators analysis pass. /// - extern const PassInfo *const MachineDominatorsID; + extern char &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 const PassInfo *const PHIEliminationID; + extern char &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 const PassInfo *const StrongPHIEliminationID; + extern char &StrongPHIEliminationID; - extern const PassInfo *const PreAllocSplittingID; + extern char &PreAllocSplittingID; /// SimpleRegisterCoalescing pass. Aggressively coalesces every register /// copy it can. /// - extern const PassInfo *const SimpleRegisterCoalescingID; + extern char &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 const PassInfo *const TwoAddressInstructionPassID; + extern char &TwoAddressInstructionPassID; /// UnreachableMachineBlockElimination pass - This pass removes unreachable /// machine basic blocks. - extern const PassInfo *const UnreachableMachineBlockElimID; + extern char &UnreachableMachineBlockElimID; /// DeadMachineInstructionElim pass - This pass removes dead machine /// instructions. diff --git a/include/llvm/CodeGen/ProcessImplicitDefs.h b/include/llvm/CodeGen/ProcessImplicitDefs.h index 30477b9b80b..1d743c1cba2 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 f150d853fc6..fe3b0e2d5fe 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 5a5893140e0..e5c073cd941 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 PassInfo* AnalysisID; +typedef const void* AnalysisID; /// Different types of internal pass managers. External pass managers /// (PassManager and FunctionPassManager) are not represented here. @@ -82,14 +82,13 @@ enum PassKind { /// class Pass { AnalysisResolver *Resolver; // Used to resolve analysis - intptr_t PassID; + const void *PassID; PassKind Kind; void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(PassKind K, intptr_t pid); - explicit Pass(PassKind K, const void *pid); + explicit Pass(PassKind K, char &pid); virtual ~Pass(); @@ -101,10 +100,10 @@ public: /// virtual const char *getPassName() const; - /// 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; + /// getPassID - Return the PassID number that corresponds to this pass. + virtual AnalysisID getPassID() const { + return PassID; + } /// 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 @@ -159,7 +158,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(const PassInfo *); + virtual void *getAdjustedAnalysisPointer(AnalysisID ID); virtual ImmutablePass *getAsImmutablePass(); virtual PMDataManager *getAsPMDataManager(); @@ -170,14 +169,9 @@ 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(intptr_t TI); + static const PassInfo *lookupPassInfo(const void *TI); // lookupPassInfo - Return the pass info object for the pass with the given // argument string, or null if it is not known. @@ -200,7 +194,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(const PassInfo *AnalysisID) const; + bool mustPreserveAnalysisID(char &AID) const; /// getAnalysis() - This function is used by subclasses to get /// to the analysis information that they claim to use by overriding the @@ -213,10 +207,10 @@ public: AnalysisType &getAnalysis(Function &F); // Defined in PassAnalysisSupport.h template - AnalysisType &getAnalysisID(const PassInfo *PI) const; + AnalysisType &getAnalysisID(AnalysisID PI) const; template - AnalysisType &getAnalysisID(const PassInfo *PI, Function &F); + AnalysisType &getAnalysisID(AnalysisID PI, Function &F); }; @@ -240,8 +234,7 @@ public: /// Return what kind of Pass Manager can manage this pass. virtual PassManagerType getPotentialPassManagerType() const; - explicit ModulePass(intptr_t pid) : Pass(PT_Module, pid) {} - explicit ModulePass(const void *pid) : Pass(PT_Module, pid) {} + explicit ModulePass(char &pid) : Pass(PT_Module, pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -268,8 +261,7 @@ public: /// bool runOnModule(Module &) { return false; } - explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {} - explicit ImmutablePass(const void *pid) + explicit ImmutablePass(char &pid) : ModulePass(pid) {} // Force out-of-line virtual method. @@ -287,8 +279,7 @@ public: /// class FunctionPass : public Pass { public: - explicit FunctionPass(intptr_t pid) : Pass(PT_Function, pid) {} - explicit FunctionPass(const void *pid) : Pass(PT_Function, pid) {} + explicit FunctionPass(char &pid) : Pass(PT_Function, pid) {} /// createPrinterPass - Get a function printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; @@ -340,8 +331,7 @@ public: /// class BasicBlockPass : public Pass { public: - explicit BasicBlockPass(intptr_t pid) : Pass(PT_BasicBlock, pid) {} - explicit BasicBlockPass(const void *pid) : Pass(PT_BasicBlock, pid) {} + explicit BasicBlockPass(char &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 977d4f4e30d..a99a1ae8711 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -49,34 +49,37 @@ public: // addRequired - Add the specified ID to the required set of the usage info // for a pass. // - AnalysisUsage &addRequiredID(AnalysisID ID); + AnalysisUsage &addRequiredID(const void *ID); + AnalysisUsage &addRequiredID(char &ID); template AnalysisUsage &addRequired() { - return addRequiredID(Pass::getClassPassInfo()); + return addRequiredID(PassClass::ID); } - AnalysisUsage &addRequiredTransitiveID(AnalysisID ID); + AnalysisUsage &addRequiredTransitiveID(char &ID); template AnalysisUsage &addRequiredTransitive() { - AnalysisID ID = Pass::getClassPassInfo(); - return addRequiredTransitiveID(ID); + return addRequiredTransitiveID(PassClass::ID); } // addPreserved - Add the specified ID to the set of analyses preserved by // this pass // - AnalysisUsage &addPreservedID(AnalysisID ID) { + AnalysisUsage &addPreservedID(const void *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() { - assert(Pass::getClassPassInfo() && "Pass class not registered!"); - Preserved.push_back(Pass::getClassPassInfo()); + Preserved.push_back(&PassClass::ID); return *this; } @@ -85,12 +88,7 @@ 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) { - const PassInfo *PI = Pass::lookupPassInfo(Arg); - // If the pass exists, preserve it. Otherwise silently do nothing. - if (PI) Preserved.push_back(PI); - return *this; - } + AnalysisUsage &addPreserved(StringRef Arg); // setPreservesAll - Set by analyses that do not transform their input at all void setPreservesAll() { PreservesAll = true; } @@ -130,7 +128,7 @@ public: inline PMDataManager &getPMDataManager() { return PM; } // Find pass that is implementing PI. - Pass *findImplPass(const PassInfo *PI) { + Pass *findImplPass(AnalysisID PI) { Pass *ResultPass = 0; for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) { if (AnalysisImpls[i].first == PI) { @@ -142,10 +140,10 @@ public: } // Find pass that is implementing PI. Initialize pass for Function F. - Pass *findImplPass(Pass *P, const PassInfo *PI, Function &F); + Pass *findImplPass(Pass *P, AnalysisID PI, Function &F); - void addAnalysisImplsPair(const PassInfo *PI, Pass *P) { - std::pair pir = std::make_pair(PI,P); + void addAnalysisImplsPair(AnalysisID PI, Pass *P) { + std::pair pir = std::make_pair(PI,P); AnalysisImpls.push_back(pir); } @@ -160,7 +158,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 @@ -179,8 +177,7 @@ template AnalysisType *Pass::getAnalysisIfAvailable() const { assert(Resolver && "Pass not resident in a PassManager object!"); - const PassInfo *PI = getClassPassInfo(); - if (PI == 0) return 0; + const void *PI = &AnalysisType::ID; Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true); if (ResultPass == 0) return 0; @@ -199,11 +196,11 @@ AnalysisType *Pass::getAnalysisIfAvailable() const { template AnalysisType &Pass::getAnalysis() const { assert(Resolver && "Pass has not been inserted into a PassManager object!"); - return getAnalysisID(getClassPassInfo()); + return getAnalysisID(&AnalysisType::ID); } template -AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { +AnalysisType &Pass::getAnalysisID(AnalysisID 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 @@ -229,11 +226,11 @@ template AnalysisType &Pass::getAnalysis(Function &F) { assert(Resolver &&"Pass has not been inserted into a PassManager object!"); - return getAnalysisID(getClassPassInfo(), F); + return getAnalysisID(&AnalysisType::ID, F); } template -AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) { +AnalysisType &Pass::getAnalysisID(AnalysisID 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 81b7e7af816..1f9b9821d59 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, const PassInfo *PI, Function &F); + virtual Pass *getOnTheFlyPass(Pass *P, AnalysisID 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 193ecfd1b58..59071391520 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(intptr_t TI) const; + const PassInfo *getPassInfo(const void *TI) const; const PassInfo *getPassInfo(StringRef Arg) const; void registerPass(const PassInfo &PI); void unregisterPass(const PassInfo &PI); /// Analysis Group Mechanisms. - void registerAnalysisGroup(intptr_t InterfaceID, intptr_t PassID, + void registerAnalysisGroup(const void *InterfaceID, const void *PassID, PassInfo& Registeree, bool isDefault); void enumerateWith(PassRegistrationListener *L); diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 07dc7f1d15c..ee987131726 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 intptr_t PassID; + const void *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, intptr_t pi, + PassInfo(const char *name, const char *arg, const void *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, intptr_t pi) + PassInfo(const char *name, const void *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 - intptr_t getTypeInfo() const { return PassID; } + const void *getTypeInfo() const { return PassID; } /// Return true if this PassID implements the specified ID pointer. - bool isPassID(void *IDPtr) const { - return PassID == (intptr_t)IDPtr; + bool isPassID(const void *IDPtr) const { + return PassID == 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, intptr_t(&passName::ID), + : PassInfo(Name, PassArg, &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, - intptr_t InterfaceID, - intptr_t PassID = 0, + const void *InterfaceID, + const void *PassID = 0, bool isDefault = false); }; @@ -200,12 +200,12 @@ template struct RegisterAnalysisGroup : public RegisterAGBase { explicit RegisterAnalysisGroup(PassInfo &RPB) : RegisterAGBase(RPB.getPassName(), - intptr_t(&Interface::ID), RPB.getTypeInfo(), + &Interface::ID, RPB.getTypeInfo(), Default) { } explicit RegisterAnalysisGroup(const char *Name) - : RegisterAGBase(Name, intptr_t(&Interface::ID)) { + : RegisterAGBase(Name, &Interface::ID) { } }; diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index cc88dae9fa6..f72461f803b 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 6af7ed7bdbf..3ac4c591c94 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(void *ID); - explicit Inliner(void *ID, int Threshold); + explicit Inliner(char &ID); + explicit Inliner(char &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 4d1d8636f61..bd5b16999f7 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 const PassInfo *const PromoteMemoryToRegisterID; +extern char &PromoteMemoryToRegisterID; //===----------------------------------------------------------------------===// // @@ -158,7 +158,7 @@ extern const PassInfo *const PromoteMemoryToRegisterID; // hacking easier. // FunctionPass *createDemoteRegisterToMemoryPass(); -extern const PassInfo *const DemoteRegisterToMemoryID; +extern char &DemoteRegisterToMemoryID; //===----------------------------------------------------------------------===// // @@ -202,7 +202,7 @@ FunctionPass *createCFGSimplificationPass(); // (set, immediate dominators, tree, and frontier) information. // FunctionPass *createBreakCriticalEdgesPass(); -extern const PassInfo *const BreakCriticalEdgesID; +extern char &BreakCriticalEdgesID; //===----------------------------------------------------------------------===// // @@ -213,7 +213,7 @@ extern const PassInfo *const BreakCriticalEdgesID; // AU.addRequiredID(LoopSimplifyID); // Pass *createLoopSimplifyPass(); -extern const PassInfo *const LoopSimplifyID; +extern char &LoopSimplifyID; //===----------------------------------------------------------------------===// // @@ -228,7 +228,7 @@ FunctionPass *createTailCallEliminationPass(); // chained binary branch instructions. // FunctionPass *createLowerSwitchPass(); -extern const PassInfo *const LowerSwitchID; +extern char &LowerSwitchID; //===----------------------------------------------------------------------===// // @@ -243,7 +243,7 @@ extern const PassInfo *const LowerSwitchID; FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0); FunctionPass *createLowerInvokePass(const TargetLowering *TLI, bool useExpensiveEHSupport); -extern const PassInfo *const LowerInvokePassID; +extern char &LowerInvokePassID; //===----------------------------------------------------------------------===// // @@ -258,7 +258,7 @@ FunctionPass *createBlockPlacementPass(); // optimizations. // Pass *createLCSSAPass(); -extern const PassInfo *const LCSSAID; +extern char &LCSSAID; //===----------------------------------------------------------------------===// // @@ -304,7 +304,7 @@ FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); // InstructionNamer - Give any unnamed non-void instructions "tmp" names. // FunctionPass *createInstructionNamerPass(); -extern const PassInfo *const InstructionNamerID; +extern char &InstructionNamerID; //===----------------------------------------------------------------------===// // diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h index 198fc827bb0..864e1197a9f 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 c2d09935e76..a5060e6f586 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 7631e3655f3..b17804186a6 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(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index 76a452e2e7d..ce363cbc7bb 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 8209bb624a2..b9fe64608c0 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(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 7e11ce6360b..46d8ee6fab3 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 33c04c1d07f..1048f11c255 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(void *PID) : ImmutablePass(PID) { } + NoAA() : ImmutablePass(ID) {} + explicit NoAA(char &PID) : ImmutablePass(PID) { } virtual void getAnalysisUsage(AnalysisUsage &AU) const { } @@ -169,8 +169,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(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } @@ -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) { @@ -240,8 +240,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(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index da2f0a6dbf0..f28b2dc787d 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(void *pid) : FunctionPass(pid) {} + CFGPrinter() : FunctionPass(ID) {} + explicit CFGPrinter(char &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(void *pid) : FunctionPass(pid) {} + CFGOnlyPrinter() : FunctionPass(ID) {} + explicit CFGOnlyPrinter(char &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 aef79787715..bdd9a26feac 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 83e39f1e6fc..9f340942f2c 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 1af0055ce54..b3635283fda 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(const PassInfo *PI) { - if (PI->isPassID(&CallGraph::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &CallGraph::ID) return (CallGraph*)this; return this; } diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index 5c4b2c3a793..b7a27cb288d 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 769e4b177ec..43a61d0f60a 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(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/IVUsers.cpp b/lib/Analysis/IVUsers.cpp index e2b67e8365e..bd43026015b 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 6133b8827b3..dcbcac005a2 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 0f11e34b600..1c9e1488431 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 fe01fd7b222..a9d972435f5 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 3cc58c4feef..0225f4fa254 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 2727d2f9465..717e0169b78 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 e003d643691..d18d5ce0ea4 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 cf8988a403c..2cc1c2aa005 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 03d3059fdbb..07f46824700 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 da4ce476926..062461a87cb 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(const PassInfo *PI) { - if (PI->isPassID(&ProfileInfo::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &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 { - const PassInfo *ProfileEstimatorPassID = &X; + char &ProfileEstimatorPassID = ProfileEstimatorPass::ID; FunctionPass *createProfileEstimatorPass() { return new ProfileEstimatorPass(); diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp index eb33e78af78..fc7f28662c0 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)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &ProfileInfo::ID) return (ProfileInfo*)this; return this; } diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index 8ea4ecf54f9..b6434e72340 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(const PassInfo *PI) { - if (PI->isPassID(&ProfileInfo::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &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); -const PassInfo *llvm::ProfileLoaderPassID = &X; +char &llvm::ProfileLoaderPassID = LoaderPass::ID; ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); } diff --git a/lib/Analysis/ProfileVerifierPass.cpp b/lib/Analysis/ProfileVerifierPass.cpp index dc1f28a95ae..3f01b2d592b 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 5c998522316..27cee76e081 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 67ce05a52f3..fee5c1bae97 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 9aaafafe052..fb5acb91aee 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 91ae98919d4..93b2a8b06fb 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(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/lib/Analysis/TypeBasedAliasAnalysis.cpp b/lib/Analysis/TypeBasedAliasAnalysis.cpp index 3e71f226a05..bbfdcec3f9b 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 PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(const void *PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/lib/Bitcode/Writer/BitcodeWriterPass.cpp index 3a0d3ce0be9..91e115cba6c 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 1ba63100956..6e2098d6f54 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 7f98df0d22e..cb81aa3c88c 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 e0e315c6c67..91a9536e775 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 2f5b6dd31bc..138b83d4b66 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 dfa9622a20a..57f45ec199d 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 8e4b98647fd..d14728d8a36 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 32bc7d785b6..0f6e882a7be 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 b27a420a243..719fa194d8d 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 6c064a74cd0..0ea30d7a792 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 dfd4eaeca66..a1f1a078d61 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 ef4919239b9..60642d46223 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 b5f8fbba99d..36c9d66965a 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); -const PassInfo *const llvm::MachineDominatorsID = &E; +char &llvm::MachineDominatorsID = MachineDominatorTree::ID; 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 07a0f45c0f4..4f84b952e06 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", - intptr_t(&MachineFunctionAnalysis::ID), 0, + &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 547c4febc8d..2aaa798a02c 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 63b145e2455..1a74b747e9f 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 269538b31d0..039edf26a2b 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); -const PassInfo *const llvm::MachineLoopInfoID = &X; +char &llvm::MachineLoopInfoID = MachineLoopInfo::ID; bool MachineLoopInfo::runOnMachineFunction(MachineFunction &) { releaseMemory(); diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index d2e3bf74641..b647a4dcc53 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 d1f91f271b9..1c83176db96 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 20dd246e5ab..7ba7072a5c5 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 586b84c5768..288f58b5083 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 d27cc42319c..edb4eea71b8 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 ea6b094d7ef..7bf0aa23af3 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"); -const PassInfo *const llvm::PHIEliminationID = &X; +char &llvm::PHIEliminationID = PHIElimination::ID; void llvm::PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); diff --git a/lib/CodeGen/PHIElimination.h b/lib/CodeGen/PHIElimination.h index 7dedf0318a8..f183de6149c 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 3005ec1075b..f0bd6d1372b 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 4cbd53a834e..82df6c23793 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"); -const PassInfo *const llvm::PreAllocSplittingID = &X; +char &llvm::PreAllocSplittingID = PreAllocSplitting::ID; /// 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 aa95773596c..e56c36fe908 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 9567308aa73..f0ccd351d2a 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 d10b5d63068..c9c51b361d3 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 594618891de..0dd92148269 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 4d22b34d558..71a613bedaf 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 1731be2be95..700d2cb2e87 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 7bf0fd28f6b..ff591832a39 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); -const PassInfo *const llvm::SimpleRegisterCoalescingID = &X; +char &llvm::SimpleRegisterCoalescingID = SimpleRegisterCoalescing::ID; void SimpleRegisterCoalescing::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesCFG(); diff --git a/lib/CodeGen/SimpleRegisterCoalescing.h b/lib/CodeGen/SimpleRegisterCoalescing.h index e154da60aff..321cef8a38d 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 e90869d600d..b637980f885 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 2b0645dfdcd..a726a7b834f 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 ff20f11e6e6..9f51778da75 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 7da3d17a541..dab6bc3924d 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 59315cf6728..5e2d414a3ee 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"); -const PassInfo *const llvm::StrongPHIEliminationID = &X; +char &llvm::StrongPHIEliminationID = StrongPHIElimination::ID; /// 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 aac8a0a2068..a815b364d54 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 9c280faea0e..2e17ebcf8a5 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"); -const PassInfo *const llvm::TwoAddressInstructionPassID = &X; +char &llvm::TwoAddressInstructionPassID = TwoAddressInstructionPass::ID; /// 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 be1fd23e2fc..ade2ab4ffab 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"); -const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y; +char &llvm::UnreachableMachineBlockElimID = UnreachableMachineBlockElim::ID; void UnreachableMachineBlockElim::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); diff --git a/lib/CodeGen/VirtRegMap.h b/lib/CodeGen/VirtRegMap.h index 87a9b2a7c46..8b6082d1819 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 93f617db64f..089d1c51598 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 63d57b61b46..118b2de7f4f 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 70ed67713e2..e5f8a638eb6 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 af7298a2439..85b0c6c248d 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 f80e316d23e..db580fbf7b1 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 bbdd3c7f7c3..97e54bfaed9 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 f67717cdd56..006a25fb15c 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 445b6a3a09b..45e693744b8 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 ba392f36d94..1451c53112f 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 001656e0121..37681170953 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 a6c6f52704f..3aec07035d7 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 34be470f03e..85fbfd1affe 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 3b4d0a604cf..46f584cb1b5 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 396b569f9d0..3e21cd1de44 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 42fea250733..b551b79b291 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 92a3abe5c0a..87440e22987 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 529fd931f65..b1d6966caeb 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 a2b615d8add..597ea0d6c20 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 241170b11c2..b6aa38f765e 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 e8b5aa45cdc..e7d67ce0962 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 5a2551fabcd..2f611e65de1 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 8c427a1c78b..df24e96b8e8 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 d03cf05a9ce..df9ab52389b 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 9e148ada885..aae5da85600 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 88b0927b355..1423b1e64d6 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 65f514c2647..406d288d183 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 dab070e1feb..13680c592e0 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 4fd034e53ed..ef2255de19c 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 a58c5901478..cd23a7d6b2d 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 98323fa7b07..4ee0c0af835 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 9fd41fdbd5b..9acdc168151 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -1524,7 +1524,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 bf59c044733..838d5505490 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 4cd4e17f3d2..0c77e1fd8cf 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 5c6bc868c93..75282fae18b 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 7202f50a362..47df235424e 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(void *ID) : ModulePass(ID) {} + explicit DAE(char &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 5ff80f72cf4..5dc50c5bef3 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 7f67e48ade8..9eb690d9474 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 d5c35ea59d6..6165ba023f7 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 129cb7c46e0..aa18601b9ae 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 9ea98ec4775..a77af549caa 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 762935e38c2..1b3cf7810cc 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 43b50fcb3d5..ecc60ad0693 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 e609fb6867f..9c6637dfe5a 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 876e80e5371..4983e8e13a3 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(void *ID) +Inliner::Inliner(char &ID) : CallGraphSCCPass(ID), InlineThreshold(InlineLimit) {} -Inliner::Inliner(void *ID, int Threshold) +Inliner::Inliner(char &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 1f861e02e2d..a1d919fd8a0 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 fd60adfc507..f88dff67d7c 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 fa19ea1fa46..6c715de04b7 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 43b08bd9b3e..73aee456763 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 e4a8fc58c2e..eba7b3ae4d1 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 d46879f5093..17245c7acd3 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 7d2968e024b..09ac76f9796 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 32722f1e1e8..ee10ad0b8ba 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 55674614bce..c6c4fde0a2b 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 56896466c93..aa470b954d6 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 24e052881a9..6f9609cf997 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 e5cd1f0ef42..a77d70cd1c1 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 a6de60d2935..8eec9872812 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 20f90839c97..03187620d3d 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 4df1c7c8b8a..ada086e9db7 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 89fb64c58bf..b144678c6a0 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 0c14b521cad..823caceb2f8 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 0e9d68cbe66..a0ea369d0ca 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 6baeceb5ee2..87ea8038356 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 ce15f48958d..c8fd9d9fa55 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 5894f8ff443..53dd06d24bb 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 646aec317ed..42afd6d5dbc 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 13c6a972602..af2eafc47cb 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 c826d66813d..c2caf48b761 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 da9f0b1e395..964a3b2a9a5 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 bd0e2071861..543dfc1cba0 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 4f1ac77c8de..a4336743a8f 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 6fecbb3a280..1e4bfa94be5 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 fd11e00df26..f7b22a0966b 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 37ab3b0b5bc..4ed2d456872 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 f30d1e850ee..717917e2cea 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 11f52570e18..4d193d8136f 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 7c0563b1758..24fae423d2f 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 e686c52fd8a..b8afcc12d92 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 13222ac2200..cf32930dd64 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. // -const PassInfo *const llvm::DemoteRegisterToMemoryID = &X; +char &llvm::DemoteRegisterToMemoryID = RegToMem::ID; FunctionPass *llvm::createDemoteRegisterToMemoryPass() { return new RegToMem(); } diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 82294dcd5fb..5cf0abca4cc 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 fa0a6972025..68c2df1691e 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 dad8f2aaec0..df6ef2ee75b 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 f8828842e0d..3ec70ec2e02 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 1fdd6f144a7..d7ce53f3671 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 2448312673b..95d3dedfb62 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 006ce90b376..2e437ac778c 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 5b105e4c0c2..e197b528f8e 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 baa114b099e..424d8785c1d 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -36,7 +36,7 @@ STATISTIC(NumBroken, "Number of blocks inserted"); namespace { struct BreakCriticalEdges : public FunctionPass { static char ID; // Pass identification, replacement for typeid - BreakCriticalEdges() : FunctionPass(&ID) {} + BreakCriticalEdges() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F); @@ -57,7 +57,7 @@ static RegisterPass X("break-crit-edges", "Break critical edges in CFG"); // Publically exposed interface to pass... -const PassInfo *const llvm::BreakCriticalEdgesID = &X; +char &llvm::BreakCriticalEdgesID = BreakCriticalEdges::ID; FunctionPass *llvm::createBreakCriticalEdgesPass() { return new BreakCriticalEdges(); } diff --git a/lib/Transforms/Utils/InstructionNamer.cpp b/lib/Transforms/Utils/InstructionNamer.cpp index 090af95c4b8..81a7101188e 100644 --- a/lib/Transforms/Utils/InstructionNamer.cpp +++ b/lib/Transforms/Utils/InstructionNamer.cpp @@ -23,7 +23,7 @@ using namespace llvm; namespace { struct InstNamer : public FunctionPass { static char ID; // Pass identification, replacement for typeid - InstNamer() : FunctionPass(&ID) {} + InstNamer() : FunctionPass(ID) {} void getAnalysisUsage(AnalysisUsage &Info) const { Info.setPreservesAll(); @@ -53,7 +53,7 @@ namespace { } -const PassInfo *const llvm::InstructionNamerID = &X; +char &llvm::InstructionNamerID = InstNamer::ID; //===----------------------------------------------------------------------===// // // InstructionNamer - Give any unnamed non-void instructions "tmp" names. diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index d380e0dbc10..bf3695d2c83 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -47,7 +47,7 @@ STATISTIC(NumLCSSA, "Number of live out of a loop variables"); namespace { struct LCSSA : public LoopPass { static char ID; // Pass identification, replacement for typeid - LCSSA() : LoopPass(&ID) {} + LCSSA() : LoopPass(ID) {} // Cached analysis information for the current function. DominatorTree *DT; @@ -93,7 +93,7 @@ char LCSSA::ID = 0; static RegisterPass X("lcssa", "Loop-Closed SSA Form Pass"); Pass *llvm::createLCSSAPass() { return new LCSSA(); } -const PassInfo *const llvm::LCSSAID = &X; +char &llvm::LCSSAID = LCSSA::ID; /// BlockDominatesAnExit - Return true if the specified block dominates at least diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index 1571fe8f0b3..16902ff9150 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -65,7 +65,7 @@ STATISTIC(NumNested , "Number of nested loops split out"); namespace { struct LoopSimplify : public LoopPass { static char ID; // Pass identification, replacement for typeid - LoopSimplify() : LoopPass(&ID) {} + LoopSimplify() : LoopPass(ID) {} // AA - If we have an alias analysis object to update, this is it, otherwise // this is null. @@ -110,7 +110,7 @@ static RegisterPass X("loopsimplify", "Canonicalize natural loops", true); // Publically exposed interface to pass... -const PassInfo *const llvm::LoopSimplifyID = &X; +char &llvm::LoopSimplifyID = LoopSimplify::ID; Pass *llvm::createLoopSimplifyPass() { return new LoopSimplify(); } /// runOnLoop - Run down all loops in the CFG (recursively, but we could do diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 2696e6913f3..f239a9970d8 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -78,7 +78,7 @@ namespace { static char ID; // Pass identification, replacement for typeid explicit LowerInvoke(const TargetLowering *tli = NULL, bool useExpensiveEHSupport = ExpensiveEHSupport) - : FunctionPass(&ID), useExpensiveEHSupport(useExpensiveEHSupport), + : FunctionPass(ID), useExpensiveEHSupport(useExpensiveEHSupport), TLI(tli) { } bool doInitialization(Module &M); bool runOnFunction(Function &F); @@ -103,7 +103,7 @@ char LowerInvoke::ID = 0; static RegisterPass X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators"); -const PassInfo *const llvm::LowerInvokePassID = &X; +char &llvm::LowerInvokePassID = LowerInvoke::ID; // Public Interface To the LowerInvoke pass. FunctionPass *llvm::createLowerInvokePass(const TargetLowering *TLI) { diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index 468a5fe4c5e..1910fd9e520 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -34,7 +34,7 @@ namespace { class LowerSwitch : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - LowerSwitch() : FunctionPass(&ID) {} + LowerSwitch() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F); @@ -85,7 +85,7 @@ static RegisterPass X("lowerswitch", "Lower SwitchInst's to branches"); // Publically exposed interface to pass... -const PassInfo *const llvm::LowerSwitchID = &X; +char &llvm::LowerSwitchID = LowerSwitch::ID; // createLowerSwitchPass - Interface to this file... FunctionPass *llvm::createLowerSwitchPass() { return new LowerSwitch(); diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp index 99203b66212..13dda65a6b0 100644 --- a/lib/Transforms/Utils/Mem2Reg.cpp +++ b/lib/Transforms/Utils/Mem2Reg.cpp @@ -27,7 +27,7 @@ STATISTIC(NumPromoted, "Number of alloca's promoted"); namespace { struct PromotePass : public FunctionPass { static char ID; // Pass identification, replacement for typeid - PromotePass() : FunctionPass(&ID) {} + PromotePass() : FunctionPass(ID) {} // runOnFunction - To run this pass, first we calculate the alloca // instructions that are safe for promotion, then we promote each one. @@ -82,7 +82,7 @@ bool PromotePass::runOnFunction(Function &F) { } // Publically exposed interface to pass... -const PassInfo *const llvm::PromoteMemoryToRegisterID = &X; +char &llvm::PromoteMemoryToRegisterID = PromotePass::ID; // createPromoteMemoryToRegister - Provide an entry point to create this pass. // FunctionPass *llvm::createPromoteMemoryToRegisterPass() { diff --git a/lib/Transforms/Utils/SSI.cpp b/lib/Transforms/Utils/SSI.cpp index 62a93e4e991..81523d3bdc8 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 5a176d59f9b..fb23fbfbe15 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -36,14 +36,7 @@ using namespace llvm; // Pass Implementation // -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"); -} +Pass::Pass(PassKind K, char &pid) : Resolver(0), PassID(&pid), Kind(K) { } // Force out-of-line virtual method. Pass::~Pass() { @@ -62,8 +55,8 @@ PassManagerType ModulePass::getPotentialPassManagerType() const { return PMT_ModulePassManager; } -bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const { - return Resolver->getAnalysisIfAvailable(AnalysisID, true) != 0; +bool Pass::mustPreserveAnalysisID(char &AID) const { + return Resolver->getAnalysisIfAvailable(&AID, true) != 0; } // dumpPassStructure - Implement the -debug-passes=Structure option @@ -76,7 +69,9 @@ void Pass::dumpPassStructure(unsigned Offset) { /// Registration templates, but can be overloaded directly. /// const char *Pass::getPassName() const { - if (const PassInfo *PI = getPassInfo()) + AnalysisID AID = getPassID(); + const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(AID); + if (PI) return PI->getPassName(); return "Unnamed pass: implement Pass::getPassName()"; } @@ -102,7 +97,7 @@ void Pass::verifyAnalysis() const { // By default, don't do anything. } -void *Pass::getAdjustedAnalysisPointer(const PassInfo *) { +void *Pass::getAdjustedAnalysisPointer(AnalysisID AID) { return this; } @@ -234,13 +229,7 @@ PassManagerType BasicBlockPass::getPotentialPassManagerType() const { return PMT_BasicBlockPassManager; } -// 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) { +const PassInfo *Pass::lookupPassInfo(const void *TI) { return PassRegistry::getPassRegistry()->getPassInfo(TI); } @@ -262,8 +251,8 @@ Pass *PassInfo::createPass() const { // RegisterAGBase implementation // -RegisterAGBase::RegisterAGBase(const char *Name, intptr_t InterfaceID, - intptr_t PassID, bool isDefault) +RegisterAGBase::RegisterAGBase(const char *Name, const void *InterfaceID, + const void *PassID, bool isDefault) : PassInfo(Name, InterfaceID) { PassRegistry::getPassRegistry()->registerAnalysisGroup(InterfaceID, PassID, *this, isDefault); @@ -306,7 +295,7 @@ namespace { void passEnumerate(const PassInfo *P) { if (P->isCFGOnlyPass()) - CFGOnlyList.push_back(P); + CFGOnlyList.push_back(P->getTypeInfo()); } }; } @@ -326,15 +315,25 @@ void AnalysisUsage::setPreservesCFG() { GetCFGOnlyPasses(Preserved).enumeratePasses(); } -AnalysisUsage &AnalysisUsage::addRequiredID(AnalysisID ID) { - assert(ID && "Pass class not registered!"); +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) { Required.push_back(ID); return *this; } -AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(AnalysisID ID) { - assert(ID && "Pass class not registered!"); - Required.push_back(ID); - RequiredTransitive.push_back(ID); +AnalysisUsage &AnalysisUsage::addRequiredID(char &ID) { + Required.push_back(&ID); + return *this; +} + +AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(char &ID) { + Required.push_back(&ID); + RequiredTransitive.push_back(&ID); return *this; } diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 296b0d13a71..75d5503962a 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -84,13 +84,15 @@ PrintAfterAll("print-after-all", static bool ShouldPrintBeforeOrAfterPass(Pass *P, PassOptionList &PassesToPrint) { - 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; - } + 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; + } + } } return false; } @@ -163,7 +165,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. @@ -224,7 +226,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 @@ -298,7 +300,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() { @@ -332,7 +334,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, const PassInfo *PI, Function &F); + virtual Pass* getOnTheFlyPass(Pass *MP, AnalysisID PI, Function &F); virtual const char *getPassName() const { return "Module Pass Manager"; @@ -383,7 +385,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 @@ -568,8 +570,9 @@ 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. - if (P->getPassInfo() && - P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) { + const PassInfo *PI = + PassRegistry::getPassRegistry()->getPassInfo(P->getPassID()); + if (PI && PI->isAnalysis() && findAnalysisPass(P->getPassID())) { delete P; return; } @@ -586,7 +589,8 @@ void PMTopLevelManager::schedulePass(Pass *P) { Pass *AnalysisPass = findAnalysisPass(*I); if (!AnalysisPass) { - AnalysisPass = (*I)->createPass(); + const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I); + AnalysisPass = PI->createPass(); if (P->getPotentialPassManagerType () == AnalysisPass->getPotentialPassManagerType()) // Schedule analysis pass that is managed by the same pass manager. @@ -632,16 +636,21 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) { for (SmallVector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); P == NULL && I != E; ++I) { - const PassInfo *PI = (*I)->getPassInfo(); + AnalysisID PI = (*I)->getPassID(); 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 = - PI->getInterfacesImplemented(); - if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end()) - P = *I; + PassInf->getInterfacesImplemented(); + for (std::vector::const_iterator II = ImmPI.begin(), + EE = ImmPI.end(); II != EE; ++II) { + if ((*II)->getTypeInfo() == AID) + P = *I; + } } } @@ -724,16 +733,19 @@ PMTopLevelManager::~PMTopLevelManager() { /// Augement AvailableAnalysis by adding analysis made available by pass P. void PMDataManager::recordAvailableAnalysis(Pass *P) { - const PassInfo *PI = P->getPassInfo(); - if (PI == 0) return; + AnalysisID PI = P->getPassID(); AvailableAnalysis[PI] = P; + + assert(AvailableAnalysis.size()); //This pass is the current implementation of all of the interfaces it //implements as well. - const std::vector &II = PI->getInterfacesImplemented(); + const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI); + if (PInf == 0) return; + const std::vector &II = PInf->getInterfacesImplemented(); for (unsigned i = 0, e = II.size(); i != e; ++i) - AvailableAnalysis[II[i]] = P; + AvailableAnalysis[II[i]->getTypeInfo()] = P; } // Return true if P preserves high level analysis used by other @@ -749,7 +761,7 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) { Pass *P1 = *I; if (P1->getAsImmutablePass() == 0 && std::find(PreservedSet.begin(), PreservedSet.end(), - P1->getPassInfo()) == + P1->getPassID()) == PreservedSet.end()) return false; } @@ -799,7 +811,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) { @@ -861,16 +873,17 @@ void PMDataManager::freePass(Pass *P, StringRef Msg, P->releaseMemory(); } - if (const PassInfo *PI = P->getPassInfo()) { + AnalysisID PI = P->getPassID(); + if (const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI)) { // 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 = PI->getInterfacesImplemented(); + const std::vector &II = PInf->getInterfacesImplemented(); for (unsigned i = 0, e = II.size(); i != e; ++i) { std::map::iterator Pos = - AvailableAnalysis.find(II[i]); + AvailableAnalysis.find(II[i]->getTypeInfo()); if (Pos != AvailableAnalysis.end() && Pos->second == P) AvailableAnalysis.erase(Pos); } @@ -941,7 +954,8 @@ void PMDataManager::add(Pass *P, bool ProcessAnalysis) { for (SmallVector::iterator I = ReqAnalysisNotAvailable.begin(), E = ReqAnalysisNotAvailable.end() ;I != E; ++I) { - Pass *AnalysisPass = (*I)->createPass(); + const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I); + Pass *AnalysisPass = PI->createPass(); this->addLowerLevelRequiredPass(P, AnalysisPass); } @@ -1044,7 +1058,8 @@ void PMDataManager::dumpPassArguments() const { if (PMDataManager *PMD = (*I)->getAsPMDataManager()) PMD->dumpPassArguments(); else - if (const PassInfo *PI = (*I)->getPassInfo()) + if (const PassInfo *PI = + PassRegistry::getPassRegistry()->getPassInfo((*I)->getPassID())) if (!PI->isAnalysisGroup()) dbgs() << " -" << PI->getPassArgument(); } @@ -1116,7 +1131,8 @@ 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() << ','; - dbgs() << ' ' << Set[i]->getPassName(); + const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(Set[i]); + dbgs() << ' ' << PInf->getPassName(); } dbgs() << '\n'; } @@ -1147,7 +1163,7 @@ void PMDataManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) { llvm_unreachable("Unable to schedule pass"); } -Pass *PMDataManager::getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F) { +Pass *PMDataManager::getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F) { assert(0 && "Unable to find on the fly pass"); return NULL; } @@ -1166,7 +1182,7 @@ Pass *AnalysisResolver::getAnalysisIfAvailable(AnalysisID ID, bool dir) const { return PM.findAnalysisPass(ID, dir); } -Pass *AnalysisResolver::findImplPass(Pass *P, const PassInfo *AnalysisPI, +Pass *AnalysisResolver::findImplPass(Pass *P, AnalysisID AnalysisPI, Function &F) { return PM.getOnTheFlyPass(P, AnalysisPI, F); } @@ -1561,7 +1577,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, const PassInfo *PI, Function &F){ +Pass* MPPassManager::getOnTheFlyPass(Pass *MP, AnalysisID 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 844d82660b4..21dba56aad7 100644 --- a/lib/VMCore/PassRegistry.cpp +++ b/lib/VMCore/PassRegistry.cpp @@ -60,7 +60,7 @@ ManagedCleanup<&cleanupPassRegistry> registryCleanup ATTRIBUTE_USED; } -const PassInfo *PassRegistry::getPassInfo(intptr_t TI) const { +const PassInfo *PassRegistry::getPassInfo(const void *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(intptr_t InterfaceID, - intptr_t PassID, +void PassRegistry::registerAnalysisGroup(const void *InterfaceID, + const void *PassID, PassInfo& Registeree, bool isDefault) { PassInfo *InterfaceInfo = const_cast(getPassInfo(InterfaceID)); diff --git a/lib/VMCore/PrintModulePass.cpp b/lib/VMCore/PrintModulePass.cpp index 7baacf71ceb..415309e52fa 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 4de1282caf9..52fd134d488 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"); -static const PassInfo *const PreVerifyID = &PreVer; +char &PreVerifyID = PreVerifier::ID; 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 6913fd06a93..bbdc728890d 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -100,7 +100,8 @@ Module *BugDriver::deleteInstructionFromProgram(const Instruction *I, } static const PassInfo *getPI(Pass *P) { - const PassInfo *PI = P->getPassInfo(); + const void *ID = P->getPassID(); + const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID); delete P; return PI; } diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp index 900bf632a83..4ae23f5b762 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 ba5234bdc89..b4bc455db12 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -90,7 +90,8 @@ namespace { AddToDriver(BugDriver &_D) : D(_D) {} virtual void add(Pass *P) { - const PassInfo *PI = P->getPassInfo(); + const void *ID = P->getPassID(); + const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID); D.addPasses(&PI, &PI + 1); } }; diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 88adeb43e6d..0c6c4d7bb78 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 a4891d8d767..2fe5d226ec7 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 e7c6d1e6af8..fa4339a0554 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 ea486ca2900..067c2038f76 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 0878737d34b..f6b829fde93 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,7 +148,8 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) { Function *F = (*I)->getFunction(); if (F) - getAnalysisID(PassToPrint).print(outs(), F->getParent()); + getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), + F->getParent()); } } // Get and print pass... @@ -158,7 +159,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass { virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); + AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } }; @@ -168,13 +169,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).print(outs(), &M); + getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), &M); } // Get and print pass... @@ -184,7 +185,7 @@ struct ModulePassPrinter : public ModulePass { virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); + AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } }; @@ -193,7 +194,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) { @@ -202,14 +203,15 @@ struct FunctionPassPrinter : public FunctionPass { << "' for function '" << F.getName() << "':\n"; } // Get and print pass... - getAnalysisID(PassToPrint).print(outs(), F.getParent()); + getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), + F.getParent()); return false; } virtual const char *getPassName() const { return "FunctionPass Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); + AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } }; @@ -220,12 +222,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).print(outs(), + getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), L->getHeader()->getParent()->getParent()); } // Get and print pass... @@ -235,7 +237,7 @@ struct LoopPassPrinter : public LoopPass { virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); + AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } }; @@ -246,7 +248,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) { @@ -255,14 +257,15 @@ struct BasicBlockPassPrinter : public BasicBlockPass { } // Get and print pass... - getAnalysisID(PassToPrint).print(outs(), BB.getParent()->getParent()); + getAnalysisID(PassToPrint->getTypeInfo()).print(outs(), + BB.getParent()->getParent()); return false; } virtual const char *getPassName() const { return "BasicBlockPass Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequiredID(PassToPrint); + AU.addRequiredID(PassToPrint->getTypeInfo()); AU.setPreservesAll(); } }; diff --git a/unittests/VMCore/PassManagerTest.cpp b/unittests/VMCore/PassManagerTest.cpp index cabfc44602c..96ee5b45896 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) {