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/MSP430/MSP430.h b/lib/Target/MSP430/MSP430.h
index 6251a42..d9f5f86 100644
--- a/lib/Target/MSP430/MSP430.h
+++ b/lib/Target/MSP430/MSP430.h
@@ -24,9 +24,6 @@
 
   FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM,
                                     CodeGenOpt::Level OptLevel);
-  FunctionPass *createMSP430CodePrinterPass(formatted_raw_ostream &o,
-                                            TargetMachine &tm,
-                                            bool verbose);
 
   extern Target TheMSP430Target;
 
diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp
index 4905f25..bb112bc 100644
--- a/lib/Target/MSP430/MSP430AsmPrinter.cpp
+++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp
@@ -1,4 +1,4 @@
-//===-- MSP430AsmPrinter.cpp - MSP430 LLVM assembly writer ------------------===//
+//===-- MSP430AsmPrinter.cpp - MSP430 LLVM assembly writer ----------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -27,6 +27,7 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/FormattedStream.h"
@@ -72,17 +73,6 @@
 
 #include "MSP430GenAsmWriter.inc"
 
-/// createMSP430CodePrinterPass - Returns a pass that prints the MSP430
-/// 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::createMSP430CodePrinterPass(formatted_raw_ostream &o,
-                                                TargetMachine &tm,
-                                                bool verbose) {
-  return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
-}
-
 
 void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
   const Function *F = MF.getFunction();
@@ -255,3 +245,9 @@
    break;
   }
 }
+
+extern "C" void LLVMInitializeMSP430Target() { 
+  // Register the target.
+  RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
+  RegisterAsmPrinter<MSP430AsmPrinter> Y(TheMSP430Target);
+}
diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp
index ffd93da..d77b26b 100644
--- a/lib/Target/MSP430/MSP430TargetMachine.cpp
+++ b/lib/Target/MSP430/MSP430TargetMachine.cpp
@@ -18,20 +18,8 @@
 #include "llvm/PassManager.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/TargetMachineRegistry.h"
-
 using namespace llvm;
 
-// Register the targets
-static RegisterTarget<MSP430TargetMachine>
-X(TheMSP430Target, "msp430", "MSP430 [experimental]");
-
-// Force static initialization.
-extern "C" void LLVMInitializeMSP430Target() { 
-  TargetRegistry::RegisterAsmPrinter(TheMSP430Target,
-                                     &createMSP430CodePrinterPass);
-}
-
 MSP430TargetMachine::MSP430TargetMachine(const Target &T,
                                          const Module &M,
                                          const std::string &FS) :