Register Target's TargetMachine and AsmPrinter in the new registry.
 - This abuses TargetMachineRegistry's constructor for now, this will get
   cleaned up in time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75762 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
index f0d8a36..0c36457 100644
--- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
+++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
@@ -37,6 +37,7 @@
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringExtras.h"
 #include <set>
@@ -289,7 +290,7 @@
   class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter {
     DwarfWriter *DW;
   public:
-    explicit LinuxAsmPrinter(formatted_raw_ostream &O, SPUTargetMachine &TM,
+    explicit LinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
                              const TargetAsmInfo *T, bool V)
       : SPUAsmPrinter(O, TM, T, V), DW(0) {}
 
@@ -599,14 +600,11 @@
 /// that the Linux SPU assembler can deal with.
 ///
 FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o,
-                                            SPUTargetMachine &tm,
+                                            TargetMachine &tm,
                                             bool verbose) {
   return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
 }
 
-// Force static initialization.
-extern "C" void LLVMInitializeCellSPUAsmPrinter() { }
-
 namespace {
   static struct Register {
     Register() {
@@ -614,3 +612,9 @@
     }
   } Registrator;
 }
+
+// Force static initialization.
+extern "C" void LLVMInitializeCellSPUAsmPrinter() { 
+  extern Target TheCellSPUTarget;
+  TargetRegistry::RegisterAsmPrinter(TheCellSPUTarget, createSPUAsmPrinterPass);
+}
diff --git a/lib/Target/CellSPU/SPU.h b/lib/Target/CellSPU/SPU.h
index 0262348..f76fc82 100644
--- a/lib/Target/CellSPU/SPU.h
+++ b/lib/Target/CellSPU/SPU.h
@@ -25,7 +25,7 @@
 
   FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
   FunctionPass *createSPUAsmPrinterPass(formatted_raw_ostream &o,
-                                        SPUTargetMachine &tm,
+                                        TargetMachine &tm,
                                         bool verbose);
 
   /*--== Utility functions/predicates/etc used all over the place: --==*/
diff --git a/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp
index 5c794c9..29bc705 100644
--- a/lib/Target/CellSPU/SPUTargetMachine.cpp
+++ b/lib/Target/CellSPU/SPUTargetMachine.cpp
@@ -23,10 +23,11 @@
 
 using namespace llvm;
 
+extern Target TheCellSPUTarget;
 namespace {
   // Register the targets
   RegisterTarget<SPUTargetMachine>
-  CELLSPU("cellspu", "STI CBEA Cell SPU [experimental]");
+  CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]");
 }
 
 // No assembler printer by default
diff --git a/lib/Target/CellSPU/SPUTargetMachine.h b/lib/Target/CellSPU/SPUTargetMachine.h
index ce8e550..83ce9e7 100644
--- a/lib/Target/CellSPU/SPUTargetMachine.h
+++ b/lib/Target/CellSPU/SPUTargetMachine.h
@@ -42,7 +42,7 @@
   // To avoid having target depend on the asmprinter stuff libraries, asmprinter
   // set this functions to ctor pointer at startup time if they are linked in.
   typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
-                                            SPUTargetMachine &tm,
+                                            TargetMachine &tm,
                                             bool verbose);
   static AsmPrinterCtorFn AsmPrinterCtor;