Register AsmPrinter for XCore, MSP430, and PIC16 targets.
 - Switch to standard addAssemblyEmitter logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75854 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PIC16/PIC16TargetMachine.cpp b/lib/Target/PIC16/PIC16TargetMachine.cpp
index 45a61fa..72c117f 100644
--- a/lib/Target/PIC16/PIC16TargetMachine.cpp
+++ b/lib/Target/PIC16/PIC16TargetMachine.cpp
@@ -41,7 +41,12 @@
 Y(TheCooperTarget, "cooper", "PIC16 Cooper [experimental].");
 
 // Force static initialization.
-extern "C" void LLVMInitializePIC16Target() { }
+extern "C" void LLVMInitializePIC16Target() { 
+  TargetRegistry::RegisterAsmPrinter(ThePIC16Target,
+                                     &createPIC16CodePrinterPass);
+  TargetRegistry::RegisterAsmPrinter(TheCooperTarget,
+                                     &createPIC16CodePrinterPass);
+}
 
 // PIC16TargetMachine - Traditional PIC16 Machine.
 PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M, 
@@ -74,8 +79,10 @@
                                             CodeGenOpt::Level OptLevel,
                                             bool Verbose,
                                             formatted_raw_ostream &Out) {
-  // Output assembly language.
-  PM.add(createPIC16CodePrinterPass(Out, *this, Verbose));
+  FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+  if (!Printer)
+    llvm_report_error("unable to create assembly printer");
+  PM.add(Printer);
   return false;
 }