From b12914bfc0f76a7a48357162d5f4c39a1343e69b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 20 Sep 2004 04:48:05 +0000 Subject: 'Pass' should now not be derived from by clients. Instead, they should derive from ModulePass. Instead of implementing Pass::run, then should implement ModulePass::runOnModule. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16436 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/SparcV9/EmitBytecodeToAssembly.cpp | 12 ++++-------- lib/Target/SparcV9/InternalGlobalMapper.cpp | 14 +++++++------- lib/Target/SparcV9/MappingInfo.cpp | 4 ++-- lib/Target/SparcV9/MappingInfo.h | 6 +++--- lib/Target/SparcV9/SparcV9Internals.h | 6 +++--- lib/Target/SparcV9/SparcV9StackSlots.cpp | 2 +- 6 files changed, 20 insertions(+), 24 deletions(-) (limited to 'lib/Target/SparcV9') diff --git a/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp b/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp index 0826f76..26332ca 100644 --- a/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp +++ b/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp @@ -17,10 +17,7 @@ #include "llvm/Pass.h" #include "llvm/Bytecode/Writer.h" #include - -namespace llvm { - -using std::ostream; +using namespace llvm; namespace { @@ -87,14 +84,14 @@ namespace { } // SparcV9BytecodeWriter - Write bytecode out to a stream that is sparc'ified - class SparcV9BytecodeWriter : public Pass { + class SparcV9BytecodeWriter : public ModulePass { std::ostream &Out; public: SparcV9BytecodeWriter(std::ostream &out) : Out(out) {} const char *getPassName() const { return "Emit Bytecode to SparcV9 Assembly";} - virtual bool run(Module &M) { + virtual bool runOnModule(Module &M) { // Write an object containing the bytecode to the SPARC assembly stream writePrologue (Out, "LLVM BYTECODE OUTPUT", "LLVMBytecode"); osparcasmstream OS(Out); @@ -112,8 +109,7 @@ namespace { }; } // end anonymous namespace -Pass *createBytecodeAsmPrinterPass(std::ostream &Out) { +ModulePass *llvm::createBytecodeAsmPrinterPass(std::ostream &Out) { return new SparcV9BytecodeWriter(Out); } -} // End llvm namespace diff --git a/lib/Target/SparcV9/InternalGlobalMapper.cpp b/lib/Target/SparcV9/InternalGlobalMapper.cpp index 0cd2faa..ef870b2 100644 --- a/lib/Target/SparcV9/InternalGlobalMapper.cpp +++ b/lib/Target/SparcV9/InternalGlobalMapper.cpp @@ -27,13 +27,13 @@ namespace llvm { typedef std::vector GVVectorTy; -class InternalGlobalMapper : public Pass { +class InternalGlobalMapper : public ModulePass { public: - bool run (Module &M); + bool runOnModule(Module &M); }; -Pass *llvm::createInternalGlobalMapperPass () { - return new InternalGlobalMapper (); +ModulePass *llvm::createInternalGlobalMapperPass() { + return new InternalGlobalMapper(); } static void maybeAddInternalValueToVector (GVVectorTy &Vector, GlobalValue &GV){ @@ -41,14 +41,14 @@ static void maybeAddInternalValueToVector (GVVectorTy &Vector, GlobalValue &GV){ // be mangled), then put the GV, casted to sbyte*, in the vector. Otherwise // add a null. if (GV.hasInternalLinkage () && GV.hasName ()) - Vector.push_back (ConstantExpr::getCast - (&GV, PointerType::get (Type::SByteTy))); + Vector.push_back(ConstantExpr::getCast(&GV, + PointerType::get(Type::SByteTy))); else Vector.push_back (ConstantPointerNull::get (PointerType::get (Type::SByteTy))); } -bool InternalGlobalMapper::run (Module &M) { +bool InternalGlobalMapper::runOnModule(Module &M) { GVVectorTy gvvector; // Populate the vector with internal global values and their names. diff --git a/lib/Target/SparcV9/MappingInfo.cpp b/lib/Target/SparcV9/MappingInfo.cpp index 1a7212c..58f1937 100644 --- a/lib/Target/SparcV9/MappingInfo.cpp +++ b/lib/Target/SparcV9/MappingInfo.cpp @@ -78,8 +78,8 @@ namespace { /// MappingInfoAsmPrinter Pass object, which uses OUT as its output /// stream for assembly output. /// -Pass *getMappingInfoAsmPrinterPass(std::ostream &out){ - return (new MappingInfoAsmPrinter(out)); +ModulePass *getMappingInfoAsmPrinterPass(std::ostream &out){ + return new MappingInfoAsmPrinter(out); } /// runOnFunction - Builds up the maps for the given function FI and then diff --git a/lib/Target/SparcV9/MappingInfo.h b/lib/Target/SparcV9/MappingInfo.h index 346a5f7..1be2e86 100644 --- a/lib/Target/SparcV9/MappingInfo.h +++ b/lib/Target/SparcV9/MappingInfo.h @@ -21,10 +21,10 @@ namespace llvm { -class Pass; +class ModulePass; -Pass *getMappingInfoAsmPrinterPass(std::ostream &out); -Pass *createInternalGlobalMapperPass(); +ModulePass *getMappingInfoAsmPrinterPass(std::ostream &out); +ModulePass *createInternalGlobalMapperPass(); class MappingInfo { struct byteVector : public std::vector { diff --git a/lib/Target/SparcV9/SparcV9Internals.h b/lib/Target/SparcV9/SparcV9Internals.h index 187d984..1f65998 100644 --- a/lib/Target/SparcV9/SparcV9Internals.h +++ b/lib/Target/SparcV9/SparcV9Internals.h @@ -28,7 +28,7 @@ namespace llvm { class LiveRange; class SparcV9TargetMachine; -class Pass; +class ModulePass; enum SparcV9InstrSchedClass { SPARC_NONE, /* Instructions with no scheduling restrictions */ @@ -91,7 +91,7 @@ protected: /// createStackSlotsPass - External interface to stack-slots pass that enters 2 /// empty slots at the top of each function stack /// -Pass *createStackSlotsPass(const TargetMachine &TM); +FunctionPass *createStackSlotsPass(const TargetMachine &TM); /// Specializes LLVM code for a target machine. /// @@ -111,7 +111,7 @@ FunctionPass* createPrologEpilogInsertionPass(); /// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file. /// -Pass* createBytecodeAsmPrinterPass(std::ostream &Out); +ModulePass* createBytecodeAsmPrinterPass(std::ostream &Out); FunctionPass *createSparcV9MachineCodeDestructionPass(); diff --git a/lib/Target/SparcV9/SparcV9StackSlots.cpp b/lib/Target/SparcV9/SparcV9StackSlots.cpp index 90aca0d..554a476 100644 --- a/lib/Target/SparcV9/SparcV9StackSlots.cpp +++ b/lib/Target/SparcV9/SparcV9StackSlots.cpp @@ -46,7 +46,7 @@ namespace { }; } -Pass *llvm::createStackSlotsPass(const TargetMachine &Target) { +FunctionPass *llvm::createStackSlotsPass(const TargetMachine &Target) { return new StackSlots(Target); } -- cgit v1.1