X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCpeeph.c;h=0a5a8d2394d0a65a388d7182362481aa35848211;hb=1f6bc72d8c57790f692bbc3ffa9451993e6a51c5;hp=37b8634bcba38368d5878972564024889f53c83e;hpb=c7ba656fd5992b1efd1a724255f23381ace27174;p=fw%2Fsdcc diff --git a/src/SDCCpeeph.c b/src/SDCCpeeph.c index 37b8634b..0a5a8d23 100644 --- a/src/SDCCpeeph.c +++ b/src/SDCCpeeph.c @@ -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 + }