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
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 @@
#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 @@
// 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 @@
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