diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-25 06:49:55 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-25 06:49:55 +0000 |
commit | 0c795d61878156817cedbac51ec2921f2634c1a5 (patch) | |
tree | 368d6bec69dc60fd9d6fcf8201a1a76500a7546f /lib/Target/Mips | |
parent | 92ccf70ad448eb02f9f273d2c70ae4708b3bd0f2 (diff) | |
download | external_llvm-0c795d61878156817cedbac51ec2921f2634c1a5.zip external_llvm-0c795d61878156817cedbac51ec2921f2634c1a5.tar.gz external_llvm-0c795d61878156817cedbac51ec2921f2634c1a5.tar.bz2 |
Add new helpers for registering targets.
- Less boilerplate == good.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r-- | lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 16 | ||||
-rw-r--r-- | lib/Target/Mips/Mips.h | 3 | ||||
-rw-r--r-- | lib/Target/Mips/MipsTargetMachine.cpp | 15 |
3 files changed, 8 insertions, 26 deletions
diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 132c9b0..9eda5e2 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -87,16 +87,6 @@ namespace { #include "MipsGenAsmWriter.inc" -/// createMipsCodePrinterPass - Returns a pass that prints the MIPS -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -FunctionPass *llvm::createMipsCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - //===----------------------------------------------------------------------===// // // Mips Asm Directives @@ -560,8 +550,6 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { // Force static initialization. extern "C" void LLVMInitializeMipsAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheMipsTarget, createMipsCodePrinterPass); - - TargetRegistry::RegisterAsmPrinter(TheMipselTarget, - createMipsCodePrinterPass); + RegisterAsmPrinter<MipsAsmPrinter> X(TheMipsTarget); + RegisterAsmPrinter<MipsAsmPrinter> Y(TheMipselTarget); } diff --git a/lib/Target/Mips/Mips.h b/lib/Target/Mips/Mips.h index 09a8072..a9ab050 100644 --- a/lib/Target/Mips/Mips.h +++ b/lib/Target/Mips/Mips.h @@ -25,9 +25,6 @@ namespace llvm { FunctionPass *createMipsISelDag(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); - FunctionPass *createMipsCodePrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); extern Target TheMipsTarget; extern Target TheMipselTarget; diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index e82dcee..b5e2da7 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -16,17 +16,14 @@ #include "MipsTargetMachine.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -// Register the target. -static RegisterTarget<MipsTargetMachine> X(TheMipsTarget, "mips", "Mips"); - -static RegisterTarget<MipselTargetMachine> Y(TheMipselTarget, "mipsel", - "Mipsel"); - -// Force static initialization. -extern "C" void LLVMInitializeMipsTarget() { } +extern "C" void LLVMInitializeMipsTarget() { + // Register the target. + RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget); + RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget); +} const TargetAsmInfo *MipsTargetMachine:: createTargetAsmInfo() const |