diff options
author | Devang Patel <dpatel@apple.com> | 2007-05-01 21:15:47 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-05-01 21:15:47 +0000 |
commit | 794fd75c67a2cdc128d67342c6d88a504d186896 (patch) | |
tree | 6b805aa4a576e9de6cbf096d2fb85063b3fb8fca /lib/CodeGen | |
parent | e50fb9ac174b791047ffa8648443ab94b2097cd9 (diff) | |
download | external_llvm-794fd75c67a2cdc128d67342c6d88a504d186896.zip external_llvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.gz external_llvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.bz2 |
Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/BranchFolding.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/ELFWriter.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/ELFWriter.h | 2 | ||||
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/LiveVariables.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/MachOWriter.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/MachOWriter.h | 1 | ||||
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 11 | ||||
-rw-r--r-- | lib/CodeGen/MachineModuleInfo.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/PHIElimination.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/PrologEpilogInserter.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocLinearScan.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocLocal.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/RegAllocSimple.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/UnreachableBlockElim.cpp | 4 |
18 files changed, 66 insertions, 7 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index aa71ee0..4ce379c 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -32,9 +32,10 @@ using namespace llvm; static cl::opt<bool> AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives.")); +const int AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T) -: FunctionNumber(0), O(o), TM(tm), TAI(T) + : MachineFunctionPass((intptr_t)&ID), FunctionNumber(0), O(o), TM(tm), TAI(T) {} std::string AsmPrinter::getSectionForFunction(const Function &F) const { diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp index 33f96df..394fe7b 100644 --- a/lib/CodeGen/BranchFolding.cpp +++ b/lib/CodeGen/BranchFolding.cpp @@ -39,6 +39,9 @@ static cl::opt<bool> EnableTailMerge("enable-tail-merge", cl::Hidden); namespace { struct BranchFolder : public MachineFunctionPass { + static const int ID; + BranchFolder() : MachineFunctionPass((intptr_t)&ID) {} + virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { return "Control Flow Optimizer"; } const TargetInstrInfo *TII; @@ -64,6 +67,7 @@ namespace { MachineBasicBlock *TBB, MachineBasicBlock *FBB, const std::vector<MachineOperand> &Cond); }; + const int BranchFolder::ID = 0; } FunctionPass *llvm::createBranchFoldingPass() { return new BranchFolder(); } diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index ffc0a92..ce53409 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -47,6 +47,7 @@ #include <list> using namespace llvm; +const int ELFWriter::ID = 0; /// AddELFWriter - Concrete function to add the ELF writer to the function pass /// manager. MachineCodeEmitter *llvm::AddELFWriter(FunctionPassManager &FPM, @@ -176,7 +177,8 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &F) { // ELFWriter Implementation //===----------------------------------------------------------------------===// -ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) { +ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) + : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) { e_flags = 0; // e_flags defaults to 0, no flags. is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; diff --git a/lib/CodeGen/ELFWriter.h b/lib/CodeGen/ELFWriter.h index e64a9c9..8b577a0 100644 --- a/lib/CodeGen/ELFWriter.h +++ b/lib/CodeGen/ELFWriter.h @@ -30,6 +30,8 @@ namespace llvm { class ELFWriter : public MachineFunctionPass { friend class ELFCodeEmitter; public: + static const int ID; + MachineCodeEmitter &getMachineCodeEmitter() const { return *(MachineCodeEmitter*)MCE; } diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index c542033..cc6c23f 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -45,6 +45,7 @@ STATISTIC(numFolded , "Number of loads/stores folded into instructions"); STATISTIC(numAborts , "Number of times interval joining aborted"); namespace { + const int LiveIntervals::ID = 0; RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis"); static cl::opt<bool> diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 4816cc1..3ea60bc 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -37,6 +37,7 @@ #include <algorithm> using namespace llvm; +const int LiveVariables::ID = 0; static RegisterPass<LiveVariables> X("livevars", "Live Variable Analysis"); void LiveVariables::VarInfo::dump() const { diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp index 5164103..f8dccc1 100644 --- a/lib/CodeGen/MachOWriter.cpp +++ b/lib/CodeGen/MachOWriter.cpp @@ -317,7 +317,9 @@ void MachOCodeEmitter::emitJumpTables(MachineJumpTableInfo *MJTI) { // MachOWriter Implementation //===----------------------------------------------------------------------===// -MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) { +const int MachOWriter::ID = 0; +MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm) + : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) { is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; isLittleEndian = TM.getTargetData()->isLittleEndian(); diff --git a/lib/CodeGen/MachOWriter.h b/lib/CodeGen/MachOWriter.h index 0792ac8..d4c146d 100644 --- a/lib/CodeGen/MachOWriter.h +++ b/lib/CodeGen/MachOWriter.h @@ -84,6 +84,7 @@ namespace llvm { class MachOWriter : public MachineFunctionPass { friend class MachOCodeEmitter; public: + static const int ID; MachineCodeEmitter &getMachineCodeEmitter() const { return *(MachineCodeEmitter*)MCE; } diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 29eee36..9b43e65 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -44,11 +44,13 @@ void MachineFunctionPass::virtfn() {} namespace { struct VISIBILITY_HIDDEN Printer : public MachineFunctionPass { + static const int ID; + std::ostream *OS; const std::string Banner; - Printer (std::ostream *_OS, const std::string &_Banner) : - OS (_OS), Banner (_Banner) { } + Printer (std::ostream *_OS, const std::string &_Banner) + : MachineFunctionPass((intptr_t)&ID), OS (_OS), Banner (_Banner) { } const char *getPassName() const { return "MachineFunction Printer"; } @@ -62,6 +64,7 @@ namespace { return false; } }; + const int Printer::ID = 0; } /// Returns a newly-created MachineFunction Printer pass. The default output @@ -74,6 +77,9 @@ FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS, namespace { struct VISIBILITY_HIDDEN Deleter : public MachineFunctionPass { + static const int ID; + Deleter() : MachineFunctionPass((intptr_t)&ID) {} + const char *getPassName() const { return "Machine Code Deleter"; } bool runOnMachineFunction(MachineFunction &MF) { @@ -82,6 +88,7 @@ namespace { return true; } }; + const int Deleter::ID = 0; } /// MachineCodeDeletion Pass - This pass deletes all of the machine code for diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index d37021e..6421396 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -28,6 +28,7 @@ using namespace llvm::dwarf; // Handle the Pass registration stuff necessary to use TargetData's. namespace { + const int MachineModuleInfo::ID = 0; RegisterPass<MachineModuleInfo> X("machinemoduleinfo", "Module Information"); } @@ -1462,7 +1463,8 @@ DebugScope::~DebugScope() { //===----------------------------------------------------------------------===// MachineModuleInfo::MachineModuleInfo() -: DR() +: ImmutablePass((intptr_t)&ID) +, DR() , VR() , CompileUnits() , Directories() @@ -1749,10 +1751,15 @@ Function *MachineModuleInfo::getPersonality() const { namespace llvm { struct DebugLabelFolder : public MachineFunctionPass { + static const int ID; + DebugLabelFolder() : MachineFunctionPass((intptr_t)&ID) {} + virtual bool runOnMachineFunction(MachineFunction &MF); virtual const char *getPassName() const { return "Label Folder"; } }; +const int DebugLabelFolder::ID = 0; + bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { // Get machine module info. MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>(); diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index 0b77fe2..f26819d 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -33,6 +33,9 @@ STATISTIC(NumAtomic, "Number of atomic phis lowered"); namespace { struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + PNE() : MachineFunctionPass((intptr_t)&ID) {} + bool runOnMachineFunction(MachineFunction &Fn) { analyzePHINodes(Fn); @@ -73,6 +76,7 @@ namespace { VRegPHIUse VRegPHIUseCount; }; + const int PNE::ID = 0; RegisterPass<PNE> X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 98c2085..927f7d1 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -32,6 +32,9 @@ using namespace llvm; namespace { struct VISIBILITY_HIDDEN PEI : public MachineFunctionPass { + static const int ID; + PEI() : MachineFunctionPass((intptr_t)&ID) {} + const char *getPassName() const { return "Prolog/Epilog Insertion & Frame Finalization"; } @@ -98,6 +101,7 @@ namespace { void replaceFrameIndices(MachineFunction &Fn); void insertPrologEpilogCode(MachineFunction &Fn); }; + const int PEI::ID = 0; } diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 8ad347b..b45d983 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -48,6 +48,9 @@ namespace { static unsigned numIntervals = 0; struct VISIBILITY_HIDDEN RA : public MachineFunctionPass { + static const int ID; + RA() : MachineFunctionPass((intptr_t)&ID) {} + typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr; typedef std::vector<IntervalPtr> IntervalPtrs; private: @@ -146,6 +149,7 @@ namespace { } } }; + const int RA::ID = 0; } void RA::ComputeRelatedRegClasses() { diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index d3d5796..4494552 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -43,6 +43,10 @@ namespace { class VISIBILITY_HIDDEN RA : public MachineFunctionPass { + public: + static const int ID; + RA() : MachineFunctionPass((intptr_t)&ID) {} + private: const TargetMachine *TM; MachineFunction *MF; const MRegisterInfo *RegInfo; @@ -224,6 +228,7 @@ namespace { void reloadPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I, unsigned PhysReg); }; + const int RA::ID = 0; } /// getStackSpaceFor - This allocates space for the specified virtual register diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp index 576d2b4..771c68b 100644 --- a/lib/CodeGen/RegAllocSimple.cpp +++ b/lib/CodeGen/RegAllocSimple.cpp @@ -38,6 +38,10 @@ namespace { createSimpleRegisterAllocator); class VISIBILITY_HIDDEN RegAllocSimple : public MachineFunctionPass { + public: + static const int ID; + RegAllocSimple() : MachineFunctionPass((intptr_t)&ID) {} + private: MachineFunction *MF; const TargetMachine *TM; const MRegisterInfo *RegInfo; @@ -90,7 +94,7 @@ namespace { void spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned VirtReg, unsigned PhysReg); }; - + const int RegAllocSimple::ID = 0; } /// getStackSpaceFor - This allocates space for the specified virtual diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 7f71004..c83eb5b 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -5011,3 +5011,5 @@ SelectInlineAsmMemoryOperands(std::vector<SDOperand> &Ops, SelectionDAG &DAG) { if (e != InOps.size()) Ops.push_back(InOps.back()); } + +const int SelectionDAGISel::ID = 0; diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index b14a95e..455993c 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -50,12 +50,16 @@ STATISTIC(NumConvertedTo3Addr, "Number of instructions promoted to 3-address"); namespace { struct VISIBILITY_HIDDEN TwoAddressInstructionPass : public MachineFunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + TwoAddressInstructionPass() : MachineFunctionPass((intptr_t)&ID) {} + virtual void getAnalysisUsage(AnalysisUsage &AU) const; /// runOnMachineFunction - pass entry point bool runOnMachineFunction(MachineFunction&); }; + const int TwoAddressInstructionPass::ID = 0; RegisterPass<TwoAddressInstructionPass> X("twoaddressinstruction", "Two-Address instruction pass"); } diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp index 951deb6..f66a771 100644 --- a/lib/CodeGen/UnreachableBlockElim.cpp +++ b/lib/CodeGen/UnreachableBlockElim.cpp @@ -34,7 +34,11 @@ using namespace llvm; namespace { class VISIBILITY_HIDDEN UnreachableBlockElim : public FunctionPass { virtual bool runOnFunction(Function &F); + public: + static const int ID; // Pass identifcation, replacement for typeid + UnreachableBlockElim() : FunctionPass((intptr_t)&ID) {} }; + const int UnreachableBlockElim::ID = 0; RegisterPass<UnreachableBlockElim> X("unreachableblockelim", "Remove unreachable blocks from the CFG"); } |