[llvm-commits] [llvm] r75854 - in /llvm/trunk/lib/Target: MSP430/MSP430.h MSP430/MSP430AsmPrinter.cpp MSP430/MSP430TargetMachine.cpp PIC16/PIC16.h PIC16/PIC16AsmPrinter.cpp PIC16/PIC16AsmPrinter.h PIC16/PIC16TargetMachine.cpp XCore/XCore.h XCore/XCoreAsmPrinter.cpp XCore/XCoreTargetMachine.cpp

Daniel Dunbar daniel at zuster.org
Wed Jul 15 16:17:45 PDT 2009


Author: ddunbar
Date: Wed Jul 15 18:17:20 2009
New Revision: 75854

URL: http://llvm.org/viewvc/llvm-project?rev=75854&view=rev
Log:
Register AsmPrinter for XCore, MSP430, and PIC16 targets.
 - Switch to standard addAssemblyEmitter logic.

Modified:
    llvm/trunk/lib/Target/MSP430/MSP430.h
    llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
    llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp
    llvm/trunk/lib/Target/PIC16/PIC16.h
    llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
    llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h
    llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp
    llvm/trunk/lib/Target/XCore/XCore.h
    llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp
    llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp

Modified: llvm/trunk/lib/Target/MSP430/MSP430.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430.h?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430.h (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430.h Wed Jul 15 18:17:20 2009
@@ -25,7 +25,7 @@
   FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM,
                                     CodeGenOpt::Level OptLevel);
   FunctionPass *createMSP430CodePrinterPass(formatted_raw_ostream &o,
-                                            MSP430TargetMachine &tm,
+                                            TargetMachine &tm,
                                             bool verbose);
 } // end namespace llvm;
 

Modified: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp Wed Jul 15 18:17:20 2009
@@ -40,7 +40,7 @@
 namespace {
   class VISIBILITY_HIDDEN MSP430AsmPrinter : public AsmPrinter {
   public:
-    MSP430AsmPrinter(formatted_raw_ostream &O, MSP430TargetMachine &TM,
+    MSP430AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
                      const TargetAsmInfo *TAI, bool V)
       : AsmPrinter(O, TM, TAI, V) {}
 
@@ -76,7 +76,7 @@
 /// regardless of whether the function is in SSA form.
 ///
 FunctionPass *llvm::createMSP430CodePrinterPass(formatted_raw_ostream &o,
-                                                MSP430TargetMachine &tm,
+                                                TargetMachine &tm,
                                                 bool verbose) {
   return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
 }

Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430TargetMachine.cpp Wed Jul 15 18:17:20 2009
@@ -37,7 +37,10 @@
 X(TheMSP430Target, "msp430", "MSP430 [experimental]");
 
 // Force static initialization.
-extern "C" void LLVMInitializeMSP430Target() { }
+extern "C" void LLVMInitializeMSP430Target() { 
+  TargetRegistry::RegisterAsmPrinter(TheMSP430Target,
+                                     &createMSP430CodePrinterPass);
+}
 
 MSP430TargetMachine::MSP430TargetMachine(const Target &T,
                                          const Module &M,
@@ -64,8 +67,10 @@
                                              CodeGenOpt::Level OptLevel,
                                              bool Verbose,
                                              formatted_raw_ostream &Out) {
-  // Output assembly language.
-  PM.add(createMSP430CodePrinterPass(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;
 }
 

Modified: llvm/trunk/lib/Target/PIC16/PIC16.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16.h?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16.h Wed Jul 15 18:17:20 2009
@@ -344,7 +344,7 @@
 
   FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM);
   FunctionPass *createPIC16CodePrinterPass(formatted_raw_ostream &OS, 
-                                           PIC16TargetMachine &TM,
+                                           TargetMachine &TM,
                                            bool Verbose);
   // Banksel optimzer pass.
   FunctionPass *createPIC16MemSelOptimizerPass();

Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Wed Jul 15 18:17:20 2009
@@ -113,7 +113,7 @@
 /// regardless of whether the function is in SSA form.
 ///
 FunctionPass *llvm::createPIC16CodePrinterPass(formatted_raw_ostream &o,
-                                               PIC16TargetMachine &tm,
+                                               TargetMachine &tm,
                                                bool verbose) {
   return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
 }

Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Wed Jul 15 18:17:20 2009
@@ -29,10 +29,10 @@
 
 namespace llvm {
   struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
-    explicit PIC16AsmPrinter(formatted_raw_ostream &O, PIC16TargetMachine &TM,
+    explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
                              const TargetAsmInfo *T, bool V)
       : AsmPrinter(O, TM, T, V), DbgInfo(O, T) {
-      PTLI = TM.getTargetLowering();
+      PTLI = static_cast<const PIC16TargetLowering *> (TM.getTargetLowering());
       PTAI = static_cast<const PIC16TargetAsmInfo *> (T);
     }
     private :

Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetMachine.cpp Wed Jul 15 18:17:20 2009
@@ -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;
 }
 

Modified: llvm/trunk/lib/Target/XCore/XCore.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCore.h?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/XCore.h (original)
+++ llvm/trunk/lib/Target/XCore/XCore.h Wed Jul 15 18:17:20 2009
@@ -25,7 +25,7 @@
 
   FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM);
   FunctionPass *createXCoreCodePrinterPass(formatted_raw_ostream &OS,
-                                           XCoreTargetMachine &TM,
+                                           TargetMachine &TM,
                                            bool Verbose);
 } // end namespace llvm;
 

Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Wed Jul 15 18:17:20 2009
@@ -52,10 +52,10 @@
     DwarfWriter *DW;
     const XCoreSubtarget &Subtarget;
   public:
-    explicit XCoreAsmPrinter(formatted_raw_ostream &O, XCoreTargetMachine &TM,
+    explicit XCoreAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
                              const TargetAsmInfo *T, bool V)
       : AsmPrinter(O, TM, T, V), DW(0),
-        Subtarget(*TM.getSubtargetImpl()) {}
+      Subtarget(TM.getSubtarget<XCoreSubtarget>()) {}
 
     virtual const char *getPassName() const {
       return "XCore Assembly Printer";
@@ -98,7 +98,7 @@
 /// regardless of whether the function is in SSA form.
 ///
 FunctionPass *llvm::createXCoreCodePrinterPass(formatted_raw_ostream &o,
-                                               XCoreTargetMachine &tm,
+                                               TargetMachine &tm,
                                                bool verbose) {
   return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
 }

Modified: llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp?rev=75854&r1=75853&r2=75854&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreTargetMachine.cpp Wed Jul 15 18:17:20 2009
@@ -33,7 +33,10 @@
 }
 
 // Force static initialization.
-extern "C" void LLVMInitializeXCoreTarget() { }
+extern "C" void LLVMInitializeXCoreTarget() { 
+  TargetRegistry::RegisterAsmPrinter(TheXCoreTarget,
+                                     &createXCoreCodePrinterPass);
+}
 
 const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const {
   return new XCoreTargetAsmInfo(*this);
@@ -62,7 +65,9 @@
                                             CodeGenOpt::Level OptLevel,
                                             bool Verbose,
                                             formatted_raw_ostream &Out) {
-  // Output assembly language.
-  PM.add(createXCoreCodePrinterPass(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;
 }





More information about the llvm-commits mailing list