dos cvs had problem with .lnk file
[fw/sdcc] / src / SDCCpeeph.c
index 37b8634bcba38368d5878972564024889f53c83e..0a5a8d2394d0a65a388d7182362481aa35848211 100644 (file)
@@ -48,6 +48,10 @@ static bool matchLine (char *, char *, hTab **);
 #define FBYNAME(x) int x (hTab *vars, lineNode *currPl, lineNode *head, \
         const char *cmdLine)
 
+#if !OPT_DISABLE_PIC
+void  peepRules2pCode(peepRule *);
+#endif
+
 /*-----------------------------------------------------------------*/
 /* pcDistance - afinds a label back ward or forward                */
 /*-----------------------------------------------------------------*/
@@ -272,10 +276,15 @@ printLine (lineNode * head, FILE * of)
       /* don't indent comments & labels */
       if (head->line &&
          (*head->line == ';' ||
-          head->line[strlen (head->line) - 1] == ':'))
+          head->line[strlen (head->line) - 1] == ':')) {
        fprintf (of, "%s\n", head->line);
-      else
+      } else {
+       if (head->isInline && *head->line=='#') {
+         // comment out preprocessor directives in inline asm
+         fprintf (of, ";");
+       }
        fprintf (of, "\t%s\n", head->line);
+      }
       head = head->next;
     }
 }
@@ -1045,7 +1054,7 @@ readFileIntoBuffer (char *fname)
 }
 
 /*-----------------------------------------------------------------*/
-/* initPeepHole - initiaises the peep hole optimizer stuff         */
+/* initPeepHole - initialises the peep hole optimizer stuff        */
 /*-----------------------------------------------------------------*/
 void 
 initPeepHole ()
@@ -1061,4 +1070,15 @@ initPeepHole ()
       readRules (s = readFileIntoBuffer (options.peep_file));
       setToNull ((void **) &s);
     }
+
+
+#if !OPT_DISABLE_PIC
+  /* Convert the peep rules into pcode.
+     NOTE: this is only support in the PIC port (at the moment)
+  */
+  if (TARGET_IS_PIC) {
+    peepRules2pCode(rootRules);
+  }
+#endif
+
 }