[llvm-commits] [llvm] r91768 - /llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp

Sanjiv Gupta sanjiv.gupta at microchip.com
Sat Dec 19 00:26:25 PST 2009


Author: sgupta
Date: Sat Dec 19 02:26:25 2009
New Revision: 91768

URL: http://llvm.org/viewvc/llvm-project?rev=91768&view=rev
Log:


1. In indirect load/store insns , the name of fsr should be emitted as INDF.
2. include standard asmbly headers in generated asmbly.

Modified:
    llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp

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

==============================================================================
--- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Sat Dec 19 02:26:25 2009
@@ -170,7 +170,16 @@
 
   switch (MO.getType()) {
     case MachineOperand::MO_Register:
-      O << getRegisterName(MO.getReg());
+      {
+        // For indirect load/store insns, the fsr name is printed as INDF.
+        std::string RegName = getRegisterName(MO.getReg());
+        if ((MI->getOpcode() == PIC16::load_indirect) ||
+            (MI->getOpcode() == PIC16::store_indirect))
+        {
+          RegName.replace (0, 3, "INDF");
+        }
+        O << RegName;
+      }
       return;
 
     case MachineOperand::MO_Immediate:
@@ -263,10 +272,9 @@
 bool PIC16AsmPrinter::doInitialization(Module &M) {
   bool Result = AsmPrinter::doInitialization(M);
 
-  // FIXME:: This is temporary solution to generate the include file.
-  // The processor should be passed to llc as in input and the header file
-  // should be generated accordingly.
-  O << "\n\t#include P16F1937.INC\n";
+  // Every asmbly contains these std headers. 
+  O << "\n#include p16f1xxx.inc";
+  O << "\n#include stdmacros.inc";
 
   // Set the section names for all globals.
   for (Module::global_iterator I = M.global_begin(), E = M.global_end();





More information about the llvm-commits mailing list