* src/pic16/glue.c, src/SDCCast.c, src/SDCCast.h, src/SDCCBBlock.c,
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Feb 2008 19:17:50 +0000 (19:17 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Feb 2008 19:17:50 +0000 (19:17 +0000)
  src/SDCCcse.c, src/SDCCglue.c, src/SDCCicode.c, src/SDCCloop.c,
  src/SDCCopt.c,  src/SDCCval.c:
  fixed bug #1890273: SDCC Warning 154 shows wrong filename

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5007 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCBBlock.c
src/SDCCast.c
src/SDCCast.h
src/SDCCcse.c
src/SDCCglue.c
src/SDCCicode.c
src/SDCCloop.c
src/SDCCopt.c
src/SDCCval.c
src/pic16/glue.c

index 51cbdc4a370e81ea12b232b6f534dcd82c4df9d7..32a26929761ff816806cb0ec6f6f6449de9ba6e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 2008-02-13 Borut Razem <borut.razem AT siol.net>
 
        * src/SDCCmain.c, src/SDCCglue.c: fixed --c1mode
 2008-02-13 Borut Razem <borut.razem AT siol.net>
 
        * src/SDCCmain.c, src/SDCCglue.c: fixed --c1mode
+       * src/pic16/glue.c, src/SDCCast.c, src/SDCCast.h, src/SDCCBBlock.c,
+         src/SDCCcse.c, src/SDCCglue.c, src/SDCCicode.c, src/SDCCloop.c,
+         src/SDCCopt.c,  src/SDCCval.c:
+         fixed bug #1890273: SDCC Warning 154 shows wrong filename
 
 2008-02-12 Maarten Brock <sourceforge.brock AT dse.nl>
 
 
 2008-02-12 Maarten Brock <sourceforge.brock AT dse.nl>
 
index 28d56e5a99645bc66c2e046bb167573cb1a65a5c..e7f0fe9e7cdc9c55b539d5a04f966389ee027a7f 100644 (file)
@@ -26,7 +26,7 @@
 #include "common.h"
 
 int eBBNum = 0;
 #include "common.h"
 
 int eBBNum = 0;
-set *graphEdges = NULL;                /* list of edges in this flow graph */
+set *graphEdges = NULL;         /* list of edges in this flow graph */
 
 struct _dumpFiles dumpFiles[] = {
   {DUMP_RAW0, ".dumpraw0", NULL},
 
 struct _dumpFiles dumpFiles[] = {
   {DUMP_RAW0, ".dumpraw0", NULL},
@@ -90,7 +90,7 @@ FILE *createDumpFile (int id) {
   struct _dumpFiles *dumpFilesPtr=dumpFiles;
   static int dumpIndex=0;
   static char dumpIndexStr[32];
   struct _dumpFiles *dumpFilesPtr=dumpFiles;
   static int dumpIndex=0;
   static char dumpIndexStr[32];
-  
+
   while (dumpFilesPtr->id) {
     if (dumpFilesPtr->id==id)
       break;
   while (dumpFilesPtr->id) {
     if (dumpFilesPtr->id==id)
       break;
@@ -116,7 +116,7 @@ FILE *createDumpFile (int id) {
       werror (E_FILE_OPEN_ERR, scratchFileName);
       exit (1);
     }
       werror (E_FILE_OPEN_ERR, scratchFileName);
       exit (1);
     }
-  } 
+  }
 
 #if 0
   fprintf(dumpFilesPtr->filePtr, "Dump file index: %d\n", dumpIndex);
 
 #if 0
   fprintf(dumpFilesPtr->filePtr, "Dump file index: %d\n", dumpIndex);
@@ -141,7 +141,7 @@ void closeDumpFiles() {
 /*-----------------------------------------------------------------*/
 /* dumpLiveRanges - dump liverange information into a file         */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* dumpLiveRanges - dump liverange information into a file         */
 /*-----------------------------------------------------------------*/
-void 
+void
 dumpLiveRanges (int id, hTab * liveRanges)
 {
   FILE *file;
 dumpLiveRanges (int id, hTab * liveRanges)
 {
   FILE *file;
@@ -153,27 +153,27 @@ dumpLiveRanges (int id, hTab * liveRanges)
   } else {
     file = stdout;
   }
   } else {
     file = stdout;
   }
-  
-  if (currFunc) 
+
+  if (currFunc)
       fprintf(file,"------------- Func %s -------------\n",currFunc->name);
   for (sym = hTabFirstItem (liveRanges, &k); sym;
        sym = hTabNextItem (liveRanges, &k))
     {
 
       fprintf (file, "%s [k%d lr%d:%d so:%d]{ re%d rm%d}",
       fprintf(file,"------------- Func %s -------------\n",currFunc->name);
   for (sym = hTabFirstItem (liveRanges, &k); sym;
        sym = hTabNextItem (liveRanges, &k))
     {
 
       fprintf (file, "%s [k%d lr%d:%d so:%d]{ re%d rm%d}",
-              (sym->rname[0] ? sym->rname : sym->name),
-              sym->key,
-              sym->liveFrom, sym->liveTo,
-              sym->stack,
-              sym->isreqv, sym->remat
-       );
+               (sym->rname[0] ? sym->rname : sym->name),
+               sym->key,
+               sym->liveFrom, sym->liveTo,
+               sym->stack,
+               sym->isreqv, sym->remat
+        );
 
       fprintf (file, "{");
       printTypeChain (sym->type, file);
       if (sym->usl.spillLoc)
 
       fprintf (file, "{");
       printTypeChain (sym->type, file);
       if (sym->usl.spillLoc)
-       {
-         fprintf (file, "}{ sir@ %s", sym->usl.spillLoc->rname);
-       }
+        {
+          fprintf (file, "}{ sir@ %s", sym->usl.spillLoc->rname);
+        }
       fprintf (file, "} clashes with ");
       bitVectDebugOn(sym->clashes,file);
       fprintf (file, "\n");
       fprintf (file, "} clashes with ");
       bitVectDebugOn(sym->clashes,file);
       fprintf (file, "\n");
@@ -186,7 +186,7 @@ dumpLiveRanges (int id, hTab * liveRanges)
 /*-----------------------------------------------------------------*/
 /* dumpEbbsToFileExt - writeall the basic blocks to a file         */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* dumpEbbsToFileExt - writeall the basic blocks to a file         */
 /*-----------------------------------------------------------------*/
-void 
+void
 dumpEbbsToFileExt (int id, ebbIndex * ebbi)
 {
   FILE *of;
 dumpEbbsToFileExt (int id, ebbIndex * ebbi)
 {
   FILE *of;
@@ -206,37 +206,37 @@ dumpEbbsToFileExt (int id, ebbIndex * ebbi)
     {
       fprintf (of, "\n----------------------------------------------------------------\n");
       fprintf (of, "Basic Block %s (df:%d bb:%d lvl:%d): loopDepth=%d%s%s%s\n",
     {
       fprintf (of, "\n----------------------------------------------------------------\n");
       fprintf (of, "Basic Block %s (df:%d bb:%d lvl:%d): loopDepth=%d%s%s%s\n",
-              ebbs[i]->entryLabel->name,
-              ebbs[i]->dfnum, ebbs[i]->bbnum, ebbs[i]->entryLabel->level,
-              ebbs[i]->depth,
-              ebbs[i]->noPath ? " noPath" : "",
-              ebbs[i]->partOfLoop ? " partOfLoop" : "",
-              ebbs[i]->isLastInLoop ? " isLastInLoop" : "");
+               ebbs[i]->entryLabel->name,
+               ebbs[i]->dfnum, ebbs[i]->bbnum, ebbs[i]->entryLabel->level,
+               ebbs[i]->depth,
+               ebbs[i]->noPath ? " noPath" : "",
+               ebbs[i]->partOfLoop ? " partOfLoop" : "",
+               ebbs[i]->isLastInLoop ? " isLastInLoop" : "");
 
       // a --nolabelopt makes this more readable
       fprintf (of, "\nsuccessors: ");
 
       // a --nolabelopt makes this more readable
       fprintf (of, "\nsuccessors: ");
-      for (bb=setFirstItem(ebbs[i]->succList); 
-          bb; 
-          bb=setNextItem(ebbs[i]->succList)) {
-       fprintf (of, "%s ", bb->entryLabel->name);
+      for (bb=setFirstItem(ebbs[i]->succList);
+           bb;
+           bb=setNextItem(ebbs[i]->succList)) {
+        fprintf (of, "%s ", bb->entryLabel->name);
       }
       fprintf (of, "\npredecessors: ");
       }
       fprintf (of, "\npredecessors: ");
-      for (bb=setFirstItem(ebbs[i]->predList); 
-          bb; 
-          bb=setNextItem(ebbs[i]->predList)) {
-       fprintf (of, "%s ", bb->entryLabel->name);
+      for (bb=setFirstItem(ebbs[i]->predList);
+           bb;
+           bb=setNextItem(ebbs[i]->predList)) {
+        fprintf (of, "%s ", bb->entryLabel->name);
       }
       {
       }
       {
-       int d;
-       fprintf (of, "\ndominators: ");
-       for (d=0; d<ebbs[i]->domVect->size; d++) {
-         if (bitVectBitValue(ebbs[i]->domVect, d)) {
-           fprintf (of, "%s ", ebbi->bbOrder[d]->entryLabel->name); //ebbs[d]->entryLabel->name);
-         }
-       }
+        int d;
+        fprintf (of, "\ndominators: ");
+        for (d=0; d<ebbs[i]->domVect->size; d++) {
+          if (bitVectBitValue(ebbs[i]->domVect, d)) {
+            fprintf (of, "%s ", ebbi->bbOrder[d]->entryLabel->name); //ebbs[d]->entryLabel->name);
+          }
+        }
       }
       fprintf (of, "\n");
       }
       fprintf (of, "\n");
-  
+
       fprintf (of, "\ndefines bitVector :");
       bitVectDebugOn (ebbs[i]->defSet, of);
       fprintf (of, "\nlocal defines bitVector :");
       fprintf (of, "\ndefines bitVector :");
       bitVectDebugOn (ebbs[i]->defSet, of);
       fprintf (of, "\nlocal defines bitVector :");
@@ -253,10 +253,10 @@ dumpEbbsToFileExt (int id, ebbIndex * ebbi)
 #endif
 
       if (ebbs[i]->isLastInLoop) {
 #endif
 
       if (ebbs[i]->isLastInLoop) {
-             fprintf (of, "\nInductions Set bitvector :");
-             bitVectDebugOn (ebbs[i]->linds, of);
+              fprintf (of, "\nInductions Set bitvector :");
+              bitVectDebugOn (ebbs[i]->linds, of);
       }
       }
-      
+
       fprintf (of, "\ninExprs:");
       for (cseSet = ebbs[i]->inExprs; cseSet; cseSet=cseSet->next) {
         cseDef *item=cseSet->item;
       fprintf (of, "\ninExprs:");
       for (cseSet = ebbs[i]->inExprs; cseSet; cseSet=cseSet->next) {
         cseDef *item=cseSet->item;
@@ -278,7 +278,7 @@ dumpEbbsToFileExt (int id, ebbIndex * ebbi)
         if (item->fromGlobal)
           fprintf (of, "g");
       }
         if (item->fromGlobal)
           fprintf (of, "g");
       }
-      
+
       fprintf (of, "\n----------------------------------------------------------------\n");
       printiCChain (ebbs[i]->sch, of);
     }
       fprintf (of, "\n----------------------------------------------------------------\n");
       printiCChain (ebbs[i]->sch, of);
     }
@@ -292,7 +292,7 @@ eBBlock *
 iCode2eBBlock (iCode * ic)
 {
   iCode *loop;
 iCode2eBBlock (iCode * ic)
 {
   iCode *loop;
-  eBBlock *ebb = neweBBlock ();        /* allocate an entry */
+  eBBlock *ebb = neweBBlock (); /* allocate an entry */
 
   /* put the first one unconditionally */
   ebb->sch = ic;
 
   /* put the first one unconditionally */
   ebb->sch = ic;
@@ -315,13 +315,13 @@ iCode2eBBlock (iCode * ic)
       ebb->ech = ebb->sch;
       return ebb;
     }
       ebb->ech = ebb->sch;
       return ebb;
     }
-  
+
   /* if this is a function call */
   if (ic->op == CALL || ic->op == PCALL)
     {
       ebb->hasFcall = 1;
       if (currFunc)
   /* if this is a function call */
   if (ic->op == CALL || ic->op == PCALL)
     {
       ebb->hasFcall = 1;
       if (currFunc)
-       FUNC_HASFCALL(currFunc->type) = 1;
+        FUNC_HASFCALL(currFunc->type) = 1;
     }
 
   if ((ic->next && ic->next->op == LABEL) ||
     }
 
   if ((ic->next && ic->next->op == LABEL) ||
@@ -337,22 +337,22 @@ iCode2eBBlock (iCode * ic)
 
       /* if this is the last one */
       if (!loop->next)
 
       /* if this is the last one */
       if (!loop->next)
-       break;
+        break;
       /* if this is a function call */
       if (loop->op == CALL || loop->op == PCALL)
       /* if this is a function call */
       if (loop->op == CALL || loop->op == PCALL)
-       {
-         ebb->hasFcall = 1;
-         if (currFunc)
-           FUNC_HASFCALL(currFunc->type) = 1;
-       }
+        {
+          ebb->hasFcall = 1;
+          if (currFunc)
+            FUNC_HASFCALL(currFunc->type) = 1;
+        }
 
       /* if the next one is a label */
       /* if this is a goto or ifx */
       if (loop->next->op == LABEL ||
 
       /* if the next one is a label */
       /* if this is a goto or ifx */
       if (loop->next->op == LABEL ||
-         loop->op == GOTO ||
-         loop->op == JUMPTABLE ||
-         loop->op == IFX)
-       break;
+          loop->op == GOTO ||
+          loop->op == JUMPTABLE ||
+          loop->op == IFX)
+        break;
     }
 
   /* mark the end of the chain */
     }
 
   /* mark the end of the chain */
@@ -374,7 +374,7 @@ eBBWithEntryLabel (ebbIndex * ebbi, symbol * eLabel)
   for (i = 0; i < count; i++)
     {
       if (isSymbolEqual (ebbs[i]->entryLabel, eLabel))
   for (i = 0; i < count; i++)
     {
       if (isSymbolEqual (ebbs[i]->entryLabel, eLabel))
-       return ebbs[i];
+        return ebbs[i];
     }
 
   return NULL;
     }
 
   return NULL;
@@ -416,21 +416,22 @@ edgesTo (eBBlock * to)
 /*-----------------------------------------------------------------*/
 /* addiCodeToeBBlock - will add an iCode to the end of a block     */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* addiCodeToeBBlock - will add an iCode to the end of a block     */
 /*-----------------------------------------------------------------*/
-void 
+void
 addiCodeToeBBlock (eBBlock * ebp, iCode * ic, iCode * ip)
 {
   ic->prev = ic->next = NULL;
   /* if the insert point is given */
   if (ip)
     {
 addiCodeToeBBlock (eBBlock * ebp, iCode * ic, iCode * ip)
 {
   ic->prev = ic->next = NULL;
   /* if the insert point is given */
   if (ip)
     {
+      ic->filename = ip->filename;
       ic->lineno = ip->lineno;
       ic->prev = ip->prev;
       ip->prev = ic;
       ic->next = ip;
       if (!ic->prev)
       ic->lineno = ip->lineno;
       ic->prev = ip->prev;
       ip->prev = ic;
       ic->next = ip;
       if (!ic->prev)
-       ebp->sch = ic;
+        ebp->sch = ic;
       else
       else
-       ic->prev->next = ic;
+        ic->prev->next = ic;
       return;
     }
 
       return;
     }
 
@@ -447,14 +448,15 @@ addiCodeToeBBlock (eBBlock * ebp, iCode * ic, iCode * ip)
   if (ebp->ech->op == GOTO || ebp->ech->op == JUMPTABLE
       || ebp->ech->op == RETURN)
     {
   if (ebp->ech->op == GOTO || ebp->ech->op == JUMPTABLE
       || ebp->ech->op == RETURN)
     {
+      ic->filename = ebp->ech->filename;
       ic->lineno = ebp->ech->lineno;
       ic->prev = ebp->ech->prev;
       ebp->ech->prev = ic;
       ic->next = ebp->ech;
       ic->lineno = ebp->ech->lineno;
       ic->prev = ebp->ech->prev;
       ebp->ech->prev = ic;
       ic->next = ebp->ech;
-      if (!ic->prev)           /* was the last only on in the block */
-       ebp->sch = ic;
+      if (!ic->prev)            /* was the last only on in the block */
+        ebp->sch = ic;
       else
       else
-       ic->prev->next = ic;
+        ic->prev->next = ic;
       return;
     }
 
       return;
     }
 
@@ -481,14 +483,15 @@ addiCodeToeBBlock (eBBlock * ebp, iCode * ic, iCode * ip)
 /*    else */
 /*        ipoint = ebp->ech ; */
       ipoint = ebp->ech;
 /*    else */
 /*        ipoint = ebp->ech ; */
       ipoint = ebp->ech;
+      ic->filename = ipoint->filename;
       ic->lineno = ipoint->lineno;
       ic->prev = ipoint->prev;
       ipoint->prev = ic;
       ic->next = ipoint;
       if (!ic->prev)
       ic->lineno = ipoint->lineno;
       ic->prev = ipoint->prev;
       ipoint->prev = ic;
       ic->next = ipoint;
       if (!ic->prev)
-       ebp->sch = ic;
+        ebp->sch = ic;
       else
       else
-       ic->prev->next = ic;
+        ic->prev->next = ic;
       return;
     }
 
       return;
     }
 
@@ -505,7 +508,7 @@ addiCodeToeBBlock (eBBlock * ebp, iCode * ic, iCode * ip)
 /*-----------------------------------------------------------------*/
 /* remiCodeFromeBBlock - remove an iCode from BBlock               */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* remiCodeFromeBBlock - remove an iCode from BBlock               */
 /*-----------------------------------------------------------------*/
-void 
+void
 remiCodeFromeBBlock (eBBlock * ebb, iCode * ic)
 {
   wassert (ic->seq>=ebb->fSeq && ic->seq<=ebb->lSeq);
 remiCodeFromeBBlock (eBBlock * ebb, iCode * ic)
 {
   wassert (ic->seq>=ebb->fSeq && ic->seq<=ebb->lSeq);
@@ -529,7 +532,7 @@ iCodeBreakDown (iCode * ic)
   eBBlock **ebbs = NULL;
   iCode *loop = ic;
   ebbIndex *ebbi;
   eBBlock **ebbs = NULL;
   iCode *loop = ic;
   ebbIndex *ebbi;
-  
+
   ebbi = Safe_alloc (sizeof (ebbIndex));
   ebbi->count = 0;
   ebbi->dfOrder = NULL; /* no depth first order information yet */
   ebbi = Safe_alloc (sizeof (ebbIndex));
   ebbi->count = 0;
   ebbi->dfOrder = NULL; /* no depth first order information yet */
@@ -546,10 +549,10 @@ iCodeBreakDown (iCode * ic)
       eBBlock *ebb = iCode2eBBlock (loop);
       loop = ebb->ech->next;
 
       eBBlock *ebb = iCode2eBBlock (loop);
       loop = ebb->ech->next;
 
-      ebb->ech->next = NULL;   /* mark the end of this chain */
+      ebb->ech->next = NULL;    /* mark the end of this chain */
       if (loop)
       if (loop)
-       loop->prev = NULL;
-      ebb->bbnum = ebbi->count;        /* save this block number     */
+        loop->prev = NULL;
+      ebb->bbnum = ebbi->count; /* save this block number     */
       /* put it in the array */
       ebbs[(ebbi->count)++] = ebb;
 
       /* put it in the array */
       ebbs[(ebbi->count)++] = ebb;
 
@@ -567,64 +570,65 @@ iCodeBreakDown (iCode * ic)
       /* be a loop, add a preheader to the block it  */
       /* goes to  if it does not already have one    */
       if (ebbs[(ebbi->count) - 1]->ech &&
       /* be a loop, add a preheader to the block it  */
       /* goes to  if it does not already have one    */
       if (ebbs[(ebbi->count) - 1]->ech &&
-         (ebbs[(ebbi->count) - 1]->ech->op == GOTO ||
-          ebbs[(ebbi->count) - 1]->ech->op == IFX))
-       {
-
-         symbol *label;
-         eBBlock *destBlock;
-
-         if (ebbs[(ebbi->count) - 1]->ech->op == GOTO)
-           label = IC_LABEL (ebbs[(ebbi->count) - 1]->ech);
-         else if (!(label = IC_TRUE (ebbs[(ebbi->count) - 1]->ech)))
-           label = IC_FALSE (ebbs[(ebbi->count) - 1]->ech);
-
-         if ((destBlock = eBBWithEntryLabel (ebbi, label)) &&
-             destBlock->preHeader == NULL &&
-             otherPathsPresent (ebbs, destBlock))
-           {
-
-             symbol *preHeaderLabel  = newiTempLoopHeaderLabel (1);
-             int i, j;
-             eBBlock *pBlock;
-
-             /* go thru all block replacing the entryLabel with new label */
-             /* till we reach the block , then we insert a new ebblock    */
-             for (i = 0; i < (ebbi->count); i++)
-               {
-                 if (ebbs[i] == destBlock)
-                   break;
-                 replaceLabel (ebbs[i], label, preHeaderLabel);
-               }
-
-             (ebbi->count)++;
-
-             /* if we have stopped at the block , allocate for an extra one */
-
-             ebbs = Safe_realloc (ebbs, (ebbi->count + 1) * sizeof (eBBlock *));
-             ebbi->bbOrder = ebbs;
-
-             ebbs[ebbi->count] = 0;
-
-             /* then move the block down one count */
-             pBlock = ebbs[j = i];
-             for (i += 1; i < (ebbi->count); i++)
-               {
-                 eBBlock *xBlock;
-
-                 xBlock = ebbs[i];
-                 ebbs[i] = pBlock;
-                 ebbs[i]->bbnum = i;
-                 pBlock = xBlock;
-               }
-
-             destBlock->preHeader = ebbs[j] = neweBBlock ();
-             ebbs[j]->bbnum = j;
-             ebbs[j]->entryLabel = preHeaderLabel;
-             ebbs[j]->sch = ebbs[j]->ech = newiCodeLabelGoto (LABEL, preHeaderLabel);
-             ebbs[j]->sch->lineno = destBlock->sch->lineno;
-           }
-       }
+          (ebbs[(ebbi->count) - 1]->ech->op == GOTO ||
+           ebbs[(ebbi->count) - 1]->ech->op == IFX))
+        {
+
+          symbol *label;
+          eBBlock *destBlock;
+
+          if (ebbs[(ebbi->count) - 1]->ech->op == GOTO)
+            label = IC_LABEL (ebbs[(ebbi->count) - 1]->ech);
+          else if (!(label = IC_TRUE (ebbs[(ebbi->count) - 1]->ech)))
+            label = IC_FALSE (ebbs[(ebbi->count) - 1]->ech);
+
+          if ((destBlock = eBBWithEntryLabel (ebbi, label)) &&
+              destBlock->preHeader == NULL &&
+              otherPathsPresent (ebbs, destBlock))
+            {
+
+              symbol *preHeaderLabel  = newiTempLoopHeaderLabel (1);
+              int i, j;
+              eBBlock *pBlock;
+
+              /* go thru all block replacing the entryLabel with new label */
+              /* till we reach the block , then we insert a new ebblock    */
+              for (i = 0; i < (ebbi->count); i++)
+                {
+                  if (ebbs[i] == destBlock)
+                    break;
+                  replaceLabel (ebbs[i], label, preHeaderLabel);
+                }
+
+              (ebbi->count)++;
+
+              /* if we have stopped at the block , allocate for an extra one */
+
+              ebbs = Safe_realloc (ebbs, (ebbi->count + 1) * sizeof (eBBlock *));
+              ebbi->bbOrder = ebbs;
+
+              ebbs[ebbi->count] = 0;
+
+              /* then move the block down one count */
+              pBlock = ebbs[j = i];
+              for (i += 1; i < (ebbi->count); i++)
+                {
+                  eBBlock *xBlock;
+
+                  xBlock = ebbs[i];
+                  ebbs[i] = pBlock;
+                  ebbs[i]->bbnum = i;
+                  pBlock = xBlock;
+                }
+
+              destBlock->preHeader = ebbs[j] = neweBBlock ();
+              ebbs[j]->bbnum = j;
+              ebbs[j]->entryLabel = preHeaderLabel;
+              ebbs[j]->sch = ebbs[j]->ech = newiCodeLabelGoto (LABEL, preHeaderLabel);
+              ebbs[j]->sch->filename = destBlock->sch->filename;
+              ebbs[j]->sch->lineno = destBlock->sch->lineno;
+            }
+        }
     }
 
   /* mark the end */
     }
 
   /* mark the end */
@@ -637,7 +641,7 @@ iCodeBreakDown (iCode * ic)
 /* replaceSymBySym : - replace operand by operand in blocks        */
 /*                     replaces only left & right in blocks        */
 /*-----------------------------------------------------------------*/
 /* replaceSymBySym : - replace operand by operand in blocks        */
 /*                     replaces only left & right in blocks        */
 /*-----------------------------------------------------------------*/
-void 
+void
 replaceSymBySym (set * sset, operand * src, operand * dest)
 {
   set *loop;
 replaceSymBySym (set * sset, operand * src, operand * dest)
 {
   set *loop;
@@ -651,58 +655,58 @@ replaceSymBySym (set * sset, operand * src, operand * dest)
       rBlock = loop->item;
       /* for all instructions in this block do */
       for (ic = rBlock->sch; ic; ic = ic->next)
       rBlock = loop->item;
       /* for all instructions in this block do */
       for (ic = rBlock->sch; ic; ic = ic->next)
-       {
-
-         /* if we find usage */
-         if (ic->op == IFX && isOperandEqual (src, IC_COND (ic)))
-           {
-             bitVectUnSetBit (OP_USES (IC_COND (ic)), ic->key);
-             IC_COND (ic) = operandFromOperand (dest);
-             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
-             continue;
-           }
-
-         if (isOperandEqual (IC_RIGHT (ic), src))
-           {
-             bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
-             IC_RIGHT (ic) = operandFromOperand (dest);
-             IC_RIGHT (ic)->isaddr = 0;
-             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
-           }
-
-         if (isOperandEqual (IC_LEFT (ic), src))
-           {
-             bitVectUnSetBit (OP_USES (IC_LEFT (ic)), ic->key);
-             if (POINTER_GET (ic) && IS_ITEMP (dest))
-               {
-                 IC_LEFT (ic) = operandFromOperand (dest);
-                 IC_LEFT (ic)->isaddr = 1;
-               }
-             else
-               {
-                 IC_LEFT (ic) = operandFromOperand (dest);
-                 IC_LEFT (ic)->isaddr = 0;
-               }
-             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
-           }
-
-         /* special case for pointer sets */
-         if (POINTER_SET (ic) &&
-             isOperandEqual (IC_RESULT (ic), src))
-           {
-             bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
-             IC_RESULT (ic) = operandFromOperand (dest);
-             IC_RESULT (ic)->isaddr = 1;
-             OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
-           }
-       }
+        {
+
+          /* if we find usage */
+          if (ic->op == IFX && isOperandEqual (src, IC_COND (ic)))
+            {
+              bitVectUnSetBit (OP_USES (IC_COND (ic)), ic->key);
+              IC_COND (ic) = operandFromOperand (dest);
+              OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
+              continue;
+            }
+
+          if (isOperandEqual (IC_RIGHT (ic), src))
+            {
+              bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
+              IC_RIGHT (ic) = operandFromOperand (dest);
+              IC_RIGHT (ic)->isaddr = 0;
+              OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
+            }
+
+          if (isOperandEqual (IC_LEFT (ic), src))
+            {
+              bitVectUnSetBit (OP_USES (IC_LEFT (ic)), ic->key);
+              if (POINTER_GET (ic) && IS_ITEMP (dest))
+                {
+                  IC_LEFT (ic) = operandFromOperand (dest);
+                  IC_LEFT (ic)->isaddr = 1;
+                }
+              else
+                {
+                  IC_LEFT (ic) = operandFromOperand (dest);
+                  IC_LEFT (ic)->isaddr = 0;
+                }
+              OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
+            }
+
+          /* special case for pointer sets */
+          if (POINTER_SET (ic) &&
+              isOperandEqual (IC_RESULT (ic), src))
+            {
+              bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
+              IC_RESULT (ic) = operandFromOperand (dest);
+              IC_RESULT (ic)->isaddr = 1;
+              OP_USES(dest)=bitVectSetBit (OP_USES (dest), ic->key);
+            }
+        }
     }
 }
 
 /*-----------------------------------------------------------------*/
 /* replaceLabel - replace reference to one label by another        */
 /*-----------------------------------------------------------------*/
     }
 }
 
 /*-----------------------------------------------------------------*/
 /* replaceLabel - replace reference to one label by another        */
 /*-----------------------------------------------------------------*/
-void 
+void
 replaceLabel (eBBlock * ebp, symbol * fromLbl, symbol * toLbl)
 {
   iCode *ic;
 replaceLabel (eBBlock * ebp, symbol * fromLbl, symbol * toLbl)
 {
   iCode *ic;
@@ -713,20 +717,20 @@ replaceLabel (eBBlock * ebp, symbol * fromLbl, symbol * toLbl)
   for (ic = ebp->sch; ic; ic = ic->next)
     {
       switch (ic->op)
   for (ic = ebp->sch; ic; ic = ic->next)
     {
       switch (ic->op)
-       {
-
-       case GOTO:
-         if (isSymbolEqual (IC_LABEL (ic), fromLbl))
-           IC_LABEL (ic) = toLbl;
-         break;
-
-       case IFX:
-         if (IC_TRUE (ic) && isSymbolEqual (IC_TRUE (ic), fromLbl))
-           IC_TRUE (ic) = toLbl;
-         else if (isSymbolEqual (IC_FALSE (ic), fromLbl))
-           IC_FALSE (ic) = toLbl;
-         break;
-       }
+        {
+
+        case GOTO:
+          if (isSymbolEqual (IC_LABEL (ic), fromLbl))
+            IC_LABEL (ic) = toLbl;
+          break;
+
+        case IFX:
+          if (IC_TRUE (ic) && isSymbolEqual (IC_TRUE (ic), fromLbl))
+            IC_TRUE (ic) = toLbl;
+          else if (isSymbolEqual (IC_FALSE (ic), fromLbl))
+            IC_FALSE (ic) = toLbl;
+          break;
+        }
     }
 
   return;
     }
 
   return;
@@ -747,12 +751,12 @@ iCodeFromeBBlock (eBBlock ** ebbs, int count)
   for (; i < count; i++)
     {
       if (ebbs[i]->sch == NULL)
   for (; i < count; i++)
     {
       if (ebbs[i]->sch == NULL)
-       continue;
+        continue;
 
       if (ebbs[i]->noPath &&
 
       if (ebbs[i]->noPath &&
-         (ebbs[i]->entryLabel != entryLabel &&
-          ebbs[i]->entryLabel != returnLabel))
-       {
+          (ebbs[i]->entryLabel != entryLabel &&
+           ebbs[i]->entryLabel != returnLabel))
+        {
           iCode *ic = NULL;
           bool foundNonlabel = 0;
           ic=ebbs[i]->sch;
           iCode *ic = NULL;
           bool foundNonlabel = 0;
           ic=ebbs[i]->sch;
@@ -770,10 +774,10 @@ iCodeFromeBBlock (eBBlock ** ebbs, int count)
           while (ic);
           if (foundNonlabel && ic)
             {
           while (ic);
           if (foundNonlabel && ic)
             {
-             werrorfl (ic->filename, ic->lineno, W_CODE_UNREACH);
+              werrorfl (ic->filename, ic->lineno, W_CODE_UNREACH);
               continue;
             }
               continue;
             }
-       }
+        }
 
       lic->next = ebbs[i]->sch;
       lic->next->prev = lic;
 
       lic->next = ebbs[i]->sch;
       lic->next->prev = lic;
@@ -788,7 +792,7 @@ iCodeFromeBBlock (eBBlock ** ebbs, int count)
 /* otherPathsPresent - determines if there is a path from _entry   */
 /*      to this block in a half constructed set of blocks          */
 /*-----------------------------------------------------------------*/
 /* otherPathsPresent - determines if there is a path from _entry   */
 /*      to this block in a half constructed set of blocks          */
 /*-----------------------------------------------------------------*/
-int 
+int
 otherPathsPresent (eBBlock ** ebbs, eBBlock * this)
 {
   int i;
 otherPathsPresent (eBBlock ** ebbs, eBBlock * this)
 {
   int i;
@@ -800,25 +804,25 @@ otherPathsPresent (eBBlock ** ebbs, eBBlock * this)
 
       /* if there is a reference to the entry label of this block */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
 
       /* if there is a reference to the entry label of this block */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
-       {
-         switch (ic->op)
-           {
-           case GOTO:
-             if (IC_LABEL (ic)->key == this->entryLabel->key)
-               return 1;
-             break;
-
-           case IFX:
-             if (IC_TRUE (ic))
-               {
-                 if (IC_TRUE (ic)->key == this->entryLabel->key)
-                   return 1;
-               }
-             else if (IC_FALSE (ic)->key == this->entryLabel->key)
-               return 1;
-             break;
-           }
-       }
+        {
+          switch (ic->op)
+            {
+            case GOTO:
+              if (IC_LABEL (ic)->key == this->entryLabel->key)
+                return 1;
+              break;
+
+            case IFX:
+              if (IC_TRUE (ic))
+                {
+                  if (IC_TRUE (ic)->key == this->entryLabel->key)
+                    return 1;
+                }
+              else if (IC_FALSE (ic)->key == this->entryLabel->key)
+                return 1;
+              break;
+            }
+        }
     }
 
   /* comes here means we have not found it yet */
     }
 
   /* comes here means we have not found it yet */
index 60f5a1d2ea3daf1c514abfb7500da30e8cbd3c21..702d6ec19582a493dbc4acbc28ed4f9cc874f4f8 100644 (file)
@@ -84,12 +84,11 @@ static ast *
 newAst_ (unsigned type)
 {
   ast *ex;
 newAst_ (unsigned type)
 {
   ast *ex;
-  static int oldLineno = 0;
 
   ex = Safe_alloc ( sizeof (ast));
 
   ex->type = type;
 
   ex = Safe_alloc ( sizeof (ast));
 
   ex->type = type;
-  ex->lineno = (noLineno ? oldLineno : lexLineno);
+  ex->lineno = (noLineno ? 0 : lexLineno);
   ex->filename = lexFilename;
   ex->level = NestLevel;
   ex->block = currBlockno;
   ex->filename = lexFilename;
   ex->level = NestLevel;
   ex->block = currBlockno;
@@ -223,6 +222,7 @@ copyAst (ast * src)
   dest = Safe_alloc ( sizeof (ast));
 
   dest->type = src->type;
   dest = Safe_alloc ( sizeof (ast));
 
   dest->type = src->type;
+  dest->filename = src->filename;
   dest->lineno = src->lineno;
   dest->level = src->level;
   dest->funcName = src->funcName;
   dest->lineno = src->lineno;
   dest->level = src->level;
   dest->funcName = src->funcName;
@@ -616,17 +616,18 @@ resolveChildren:
   return tree;
 }
 
   return tree;
 }
 
-/*-----------------------------------------------------------------*/
-/* setAstLineno - walks a ast tree & sets the line number          */
-/*-----------------------------------------------------------------*/
-int setAstLineno (ast * tree, int lineno)
+/*------------------------------------------------------------------------*/
+/* setAstFileLine - walks a ast tree & sets the file name and line number */
+/*------------------------------------------------------------------------*/
+int setAstFileLine (ast * tree, char *filename, int lineno)
 {
   if (!tree)
     return 0;
 
 {
   if (!tree)
     return 0;
 
+  tree->filename = filename;
   tree->lineno = lineno;
   tree->lineno = lineno;
-  setAstLineno (tree->left, lineno);
-  setAstLineno (tree->right, lineno);
+  setAstFileLine (tree->left, filename, lineno);
+  setAstFileLine (tree->right, filename, lineno);
   return 0;
 }
 
   return 0;
 }
 
@@ -886,6 +887,7 @@ processParms (ast *func,
           /* cast required; change this op to a cast. */
           (*actParm)->decorated = 0;
            *actParm = newNode (CAST, newType, *actParm);
           /* cast required; change this op to a cast. */
           (*actParm)->decorated = 0;
            *actParm = newNode (CAST, newType, *actParm);
+          (*actParm)->filename = (*actParm)->right->filename;
           (*actParm)->lineno = (*actParm)->right->lineno;
 
           decorateType (*actParm, RESULT_TYPE_NONE);
           (*actParm)->lineno = (*actParm)->right->lineno;
 
           decorateType (*actParm, RESULT_TYPE_NONE);
@@ -1298,7 +1300,7 @@ gatherAutoInit (symbol * autoChain)
                             list2expr (sym->ival));
           }
 
                             list2expr (sym->ival));
           }
 
-          setAstLineno (work, sym->lineDef);
+          setAstFileLine (work, sym->fileDef, sym->lineDef);
 
           sym->ival = NULL;
           if (staticAutos)
 
           sym->ival = NULL;
           if (staticAutos)
@@ -1319,8 +1321,9 @@ gatherAutoInit (symbol * autoChain)
           }
 
           /* update lineno for error msg */
           }
 
           /* update lineno for error msg */
+          filename = sym->fileDef;
           lineno = sym->lineDef;
           lineno = sym->lineDef;
-          setAstLineno (ilist->init.node, sym->lineDef);
+          setAstFileLine (ilist->init.node, sym->fileDef, sym->lineDef);
 
           if (IS_AGGREGATE (sym->type)) {
             work = initAggregates (sym, sym->ival, NULL);
 
           if (IS_AGGREGATE (sym->type)) {
             work = initAggregates (sym, sym->ival, NULL);
@@ -1335,7 +1338,7 @@ gatherAutoInit (symbol * autoChain)
           }
 
           // just to be sure
           }
 
           // just to be sure
-          setAstLineno (work, sym->lineDef);
+          setAstFileLine (work, sym->fileDef, sym->lineDef);
 
           sym->ival = NULL;
           if (init)
 
           sym->ival = NULL;
           if (init)
@@ -1375,16 +1378,18 @@ stringToSymbol (value * val)
   unsigned int size;
 
   // have we heard this before?
   unsigned int size;
 
   // have we heard this before?
-  for (sp=statsg->syms; sp; sp=sp->next) {
-    sym=sp->item;
-    size = getSize (sym->type);
-    if (sym->isstrlit && size == getSize (val->type) &&
-        !memcmp(SPEC_CVAL(sym->etype).v_char, SPEC_CVAL(val->etype).v_char, size)) {
-      // yes, this is old news. Don't publish it again.
-      sym->isstrlit++; // but raise the usage count
-      return symbolVal(sym);
+  for (sp = statsg->syms; sp; sp = sp->next)
+    {
+      sym = sp->item;
+      size = getSize (sym->type);
+      if (sym->isstrlit && size == getSize (val->type) &&
+          !memcmp (SPEC_CVAL (sym->etype).v_char, SPEC_CVAL (val->etype).v_char, size))
+        {
+          // yes, this is old news. Don't publish it again.
+          sym->isstrlit++; // but raise the usage count
+          return symbolVal (sym);
+        }
     }
     }
-  }
 
   SNPRINTF (name, sizeof(name), "_str_%d", charLbl++);
   sym = newSymbol (name, 0);    /* make it @ level 0 */
 
   SNPRINTF (name, sizeof(name), "_str_%d", charLbl++);
   sym = newSymbol (name, 0);    /* make it @ level 0 */
@@ -2112,7 +2117,7 @@ reverseLoop (ast * loop, symbol * sym, ast * init, ast * end)
                             end));
 
   replLoopSym (loop->left, sym);
                             end));
 
   replLoopSym (loop->left, sym);
-  setAstLineno (rloop, init->lineno);
+  setAstFileLine (rloop, init->filename, init->lineno);
 
   rloop = newNode (NULLOP,
                    newNode ('=',
 
   rloop = newNode (NULLOP,
                    newNode ('=',
@@ -2275,6 +2280,7 @@ addCast (ast *tree, RESULT_TYPE resultType, bool promote)
     }
   tree->decorated = 0;
   tree = newNode (CAST, newAst_LINK (newLink), tree);
     }
   tree->decorated = 0;
   tree = newNode (CAST, newAst_LINK (newLink), tree);
+  tree->filename = tree->right->filename;
   tree->lineno = tree->right->lineno;
   /* keep unsigned type during cast to smaller type,
      but not when promoting from char to int */
   tree->lineno = tree->right->lineno;
   /* keep unsigned type during cast to smaller type,
      but not when promoting from char to int */
@@ -2466,6 +2472,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
 /*----------------------------*/
 /*   leaf has been reached    */
 /*----------------------------*/
 /*----------------------------*/
 /*   leaf has been reached    */
 /*----------------------------*/
+  filename = tree->filename;
   lineno = tree->lineno;
   /* if this is of type value */
   /* just get the type        */
   lineno = tree->lineno;
   /* if this is of type value */
   /* just get the type        */
@@ -3129,6 +3136,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
                   litTree->right = newNode ('*',
                                             litTree->right,
                                             copyAst (tree->right));
                   litTree->right = newNode ('*',
                                             litTree->right,
                                             copyAst (tree->right));
+                  litTree->right->filename = tree->filename;
                   litTree->right->lineno = tree->lineno;
 
                   tree->right->opval.val = constCharVal (1);
                   litTree->right->lineno = tree->lineno;
 
                   tree->right->opval.val = constCharVal (1);
@@ -3676,6 +3684,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
           tree->right = newNode (':',
                                   newAst_VALUE (constCharVal (1)),
                                   newAst_VALUE (constCharVal (0)));
           tree->right = newNode (':',
                                   newAst_VALUE (constCharVal (1)),
                                   newAst_VALUE (constCharVal (0)));
+          tree->right->filename = tree->filename;
           tree->right->lineno = tree->lineno;
           tree->decorated = 0;
           return decorateType (tree, resultType);
           tree->right->lineno = tree->lineno;
           tree->decorated = 0;
           return decorateType (tree, resultType);
@@ -3994,6 +4003,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
           allocGlobal (sym);
 
           newTree->left = newAst_VALUE(symbolVal(sym));
           allocGlobal (sym);
 
           newTree->left = newAst_VALUE(symbolVal(sym));
+          newTree->left->filename = tree->filename;
           newTree->left->lineno = tree->lineno;
           LTYPE (newTree) = sym->type;
           LETYPE (newTree) = sym->etype;
           newTree->left->lineno = tree->lineno;
           LTYPE (newTree) = sym->type;
           LETYPE (newTree) = sym->etype;
@@ -4166,7 +4176,9 @@ decorateType (ast * tree, RESULT_TYPE resultType)
           tree->right = newNode (':',
                                   newAst_VALUE (constCharVal (1)),
                                   tree->right); /* val 0 */
           tree->right = newNode (':',
                                   newAst_VALUE (constCharVal (1)),
                                   tree->right); /* val 0 */
+          tree->right->filename = tree->filename;
           tree->right->lineno = tree->lineno;
           tree->right->lineno = tree->lineno;
+          tree->right->left->filename = tree->filename;
           tree->right->left->lineno = tree->lineno;
           tree->decorated = 0;
           return decorateType (tree, resultType);
           tree->right->left->lineno = tree->lineno;
           tree->decorated = 0;
           return decorateType (tree, resultType);
@@ -4271,6 +4283,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
             tree->opval.op = transformedOp;
             tree->decorated = 0;
             tree = newNode ('!', tree, NULL);
             tree->opval.op = transformedOp;
             tree->decorated = 0;
             tree = newNode ('!', tree, NULL);
+            tree->filename = tree->left->filename;
             tree->lineno = tree->left->lineno;
             return decorateType (tree, resultType);
           }
             tree->lineno = tree->left->lineno;
             return decorateType (tree, resultType);
           }
@@ -4965,6 +4978,7 @@ createBlock (symbol * decl, ast * body)
   ex->values.sym = decl;
 
   ex->level++;
   ex->values.sym = decl;
 
   ex->level++;
+  ex->filename = NULL;
   ex->lineno = 0;
   return ex;
 }
   ex->lineno = 0;
   return ex;
 }
@@ -5001,6 +5015,7 @@ createLabel (symbol * label, ast * stmnt)
   label->islbl = 1;
   label->key = labelKey++;
   rValue = newNode (LABEL, newAst_VALUE (symbolVal (label)), stmnt);
   label->islbl = 1;
   label->key = labelKey++;
   rValue = newNode (LABEL, newAst_VALUE (symbolVal (label)), stmnt);
+  rValue->filename = NULL;
   rValue->lineno = 0;
 
   return rValue;
   rValue->lineno = 0;
 
   return rValue;
@@ -5088,6 +5103,7 @@ createCase (ast * swStat, ast * caseVal, ast * stmnt)
            (int) ulFromVal (caseVal->opval.val));
 
   rexpr = createLabel (newSymbol (caseLbl, 0), stmnt);
            (int) ulFromVal (caseVal->opval.val));
 
   rexpr = createLabel (newSymbol (caseLbl, 0), stmnt);
+  rexpr->filename = 0;
   rexpr->lineno = 0;
   return rexpr;
 }
   rexpr->lineno = 0;
   return rexpr;
 }
@@ -5323,10 +5339,12 @@ createWhile (symbol * trueLabel, symbol * continueLabel,
   /* put the continue label */
   condExpr = backPatchLabels (condExpr, trueLabel, falseLabel);
   condExpr = createLabel (continueLabel, condExpr);
   /* put the continue label */
   condExpr = backPatchLabels (condExpr, trueLabel, falseLabel);
   condExpr = createLabel (continueLabel, condExpr);
+  condExpr->filename = NULL;
   condExpr->lineno = 0;
 
   /* put the body label in front of the body */
   whileBody = createLabel (trueLabel, whileBody);
   condExpr->lineno = 0;
 
   /* put the body label in front of the body */
   whileBody = createLabel (trueLabel, whileBody);
+  whileBody->filename = NULL;
   whileBody->lineno = 0;
   /* put a jump to continue at the end of the body */
   /* and put break label at the end of the body */
   whileBody->lineno = 0;
   /* put a jump to continue at the end of the body */
   /* and put break label at the end of the body */
@@ -5963,8 +5981,8 @@ fixupInlineLabel (symbol * sym)
 static void
 copyAstLoc (ast * dest, ast * src)
 {
 static void
 copyAstLoc (ast * dest, ast * src)
 {
-  dest->lineno = src->lineno;
   dest->filename = src->filename;
   dest->filename = src->filename;
+  dest->lineno = src->lineno;
   dest->level = src->level;
   dest->block = src->block;
   dest->seqPoint = src->seqPoint;
   dest->level = src->level;
   dest->block = src->block;
   dest->seqPoint = src->seqPoint;
index 4d43b5a00a2452730948f1539b3c1333347f1701..3b8ec6e1fdd7d826fccf5b681ae6c6012a41cf0f 100644 (file)
@@ -7,19 +7,19 @@
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
+
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
+   what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
 #ifndef SDCCEXPR_H
 -------------------------------------------------------------------------*/
 
 #ifndef SDCCEXPR_H
@@ -50,63 +50,63 @@ typedef struct ast
     unsigned lvalue:1;
     unsigned initMode:1;
     unsigned reversed:1;
     unsigned lvalue:1;
     unsigned initMode:1;
     unsigned reversed:1;
-    int level;                 /* level for expr */
-    int block;                 /* block number   */
-    int seqPoint;              /* sequence point */
+    int level;                  /* level for expr */
+    int block;                  /* block number   */
+    int seqPoint;               /* sequence point */
     /* union of values expression can have */
     union
       {
     /* union of values expression can have */
     union
       {
-       value *val;             /* value if type = EX_VALUE */
-       sym_link *lnk;          /* sym_link * if type= EX_LINK  */
-       struct operand *oprnd;  /* used only for side effecting function calls */
-       unsigned op;            /* operator if type= EX_OP  */
+        value *val;             /* value if type = EX_VALUE */
+        sym_link *lnk;          /* sym_link * if type= EX_LINK  */
+        struct operand *oprnd;  /* used only for side effecting function calls */
+        unsigned op;            /* operator if type= EX_OP  */
       }
     opval;
 
     /* union for special processing */
     union
       {
       }
     opval;
 
     /* union for special processing */
     union
       {
-       char *inlineasm;        /* pointer to inline assembler code */
-       literalList *constlist; /* init list for array initializer. */
-       symbol *sym;            /* if block then -> symbols */
-       value *args;            /* if function then args    */
-       /* if switch then switch values */
-       struct
-         {
-           value *swVals;      /* switch comparison values */
-           int swDefault;      /* default if present       */
-           int swNum;          /* switch number            */
-         }
-       switchVals;
-       /* if for then for values */
-       struct
-         {
-           struct ast *initExpr;       /* init portion */
-           struct ast *condExpr;       /* conditional portion */
-           struct ast *loopExpr;       /* iteration portion   */
-           symbol *trueLabel;  /* entry point into body */
-           symbol *falseLabel; /* exit point */
-           symbol *continueLabel;      /* conditional check   */
-           symbol *condLabel;  /* conditional label   */
-         }
-       forVals;
-       unsigned literalFromCast;       /* true if this is an EX_VALUE of LITERAL 
-                                        * type resulting from a typecast.
-                                        */
-       int argreg;                     /* argreg number when operand type == EX_OPERAND */
+        char *inlineasm;        /* pointer to inline assembler code */
+        literalList *constlist; /* init list for array initializer. */
+        symbol *sym;            /* if block then -> symbols */
+        value *args;            /* if function then args    */
+        /* if switch then switch values */
+        struct
+          {
+            value *swVals;      /* switch comparison values */
+            int swDefault;      /* default if present       */
+            int swNum;          /* switch number            */
+          }
+        switchVals;
+        /* if for then for values */
+        struct
+          {
+            struct ast *initExpr;       /* init portion */
+            struct ast *condExpr;       /* conditional portion */
+            struct ast *loopExpr;       /* iteration portion   */
+            symbol *trueLabel;  /* entry point into body */
+            symbol *falseLabel; /* exit point */
+            symbol *continueLabel;      /* conditional check   */
+            symbol *condLabel;  /* conditional label   */
+          }
+        forVals;
+        unsigned literalFromCast;       /* true if this is an EX_VALUE of LITERAL
+                                         * type resulting from a typecast.
+                                         */
+        int argreg;                     /* argreg number when operand type == EX_OPERAND */
       }
     values;
 
       }
     values;
 
-    int lineno;                        /* source file line number     */
-    char *filename;            /* filename of the source file */
+    int lineno;                 /* source file line number     */
+    char *filename;             /* filename of the source file */
 
 
-    sym_link *ftype;           /* start of type chain for this subtree */
-    sym_link *etype;           /* end of type chain for this subtree   */
+    sym_link *ftype;            /* start of type chain for this subtree */
+    sym_link *etype;            /* end of type chain for this subtree   */
 
 
-    struct ast *left;          /* pointer to left tree        */
-    struct ast *right;         /* pointer to right tree       */
-    symbol *trueLabel;         /* if statement trueLabel */
-    symbol *falseLabel;                /* if statement falseLabel */
+    struct ast *left;           /* pointer to left tree        */
+    struct ast *right;          /* pointer to right tree       */
+    symbol *trueLabel;          /* if statement trueLabel */
+    symbol *falseLabel;         /* if statement falseLabel */
   }
 ast;
 
   }
 ast;
 
@@ -121,16 +121,16 @@ ast;
 #define IS_LEFT_OP(x)           (IS_AST_OP(x) && x->opval.op == LEFT_OP)
 #define IS_RIGHT_OP(x)          (IS_AST_OP(x) && x->opval.op == RIGHT_OP)
 #define IS_AST_VALUE(x)         ((x) && (x)->type == EX_VALUE && (x)->opval.val)
 #define IS_LEFT_OP(x)           (IS_AST_OP(x) && x->opval.op == LEFT_OP)
 #define IS_RIGHT_OP(x)          (IS_AST_OP(x) && x->opval.op == RIGHT_OP)
 #define IS_AST_VALUE(x)         ((x) && (x)->type == EX_VALUE && (x)->opval.val)
-#define IS_AST_LINK(x)         (x->type == EX_LINK)
-#define IS_AST_NOT_OPER(x)     (x && IS_AST_OP(x) && x->opval.op == '!')
+#define IS_AST_LINK(x)          (x->type == EX_LINK)
+#define IS_AST_NOT_OPER(x)      (x && IS_AST_OP(x) && x->opval.op == '!')
 #define IS_ARRAY_OP(x)          (IS_AST_OP(x) && x->opval.op == '[')
 #define IS_ARRAY_OP(x)          (IS_AST_OP(x) && x->opval.op == '[')
-#define IS_COMPARE_OP(x)       (IS_AST_OP(x)           &&              \
-                                 (x->opval.op == '>'   ||              \
-                                  x->opval.op == '<'   ||              \
-                                  x->opval.op == LE_OP ||              \
-                                  x->opval.op == GE_OP ||              \
-                                  x->opval.op == EQ_OP ||              \
-                                  x->opval.op == NE_OP ))
+#define IS_COMPARE_OP(x)        (IS_AST_OP(x)           &&              \
+                                  (x->opval.op == '>'   ||              \
+                                   x->opval.op == '<'   ||              \
+                                   x->opval.op == LE_OP ||              \
+                                   x->opval.op == GE_OP ||              \
+                                   x->opval.op == EQ_OP ||              \
+                                   x->opval.op == NE_OP ))
 #define IS_CAST_OP(x)           (IS_AST_OP(x) && (x)->opval.op == CAST)
 #define IS_TERNARY_OP(x)        (IS_AST_OP(x) && x->opval.op == '?')
 #define IS_COLON_OP(x)          (IS_AST_OP(x) && x->opval.op == ':')
 #define IS_CAST_OP(x)           (IS_AST_OP(x) && (x)->opval.op == CAST)
 #define IS_TERNARY_OP(x)        (IS_AST_OP(x) && x->opval.op == '?')
 #define IS_COLON_OP(x)          (IS_AST_OP(x) && x->opval.op == ':')
@@ -150,26 +150,26 @@ ast;
 
 #define IS_AST_PARAM(x)         (IS_AST_OP(x) && x->opval.op == PARAM)
 
 
 #define IS_AST_PARAM(x)         (IS_AST_OP(x) && x->opval.op == PARAM)
 
-#define  CAN_EVAL(x)   (     x ==  '[' || x == '.' || x == PTR_OP ||   \
-             x ==  '&' || x == '|' || x == '^'    || x == '*' || \
-             x ==  '-' || x == '+' || x == '~'    ||   \
-             x ==  '!' || x == LEFT_OP || x == RIGHT_OP ||       \
-             x ==  '/' || x == '%' || x == '>' || x == '<'    || \
-              x        == LE_OP || x == GE_OP || x == EQ_OP || x == NE_OP || \
-             x == AND_OP || x == OR_OP || x == '='  )
+#define  CAN_EVAL(x)    (     x ==  '[' || x == '.' || x == PTR_OP ||   \
+              x ==  '&' || x == '|' || x == '^'    || x == '*' || \
+              x ==  '-' || x == '+' || x == '~'    ||   \
+              x ==  '!' || x == LEFT_OP || x == RIGHT_OP ||       \
+              x ==  '/' || x == '%' || x == '>' || x == '<'    || \
+              x == LE_OP || x == GE_OP || x == EQ_OP || x == NE_OP || \
+              x == AND_OP || x == OR_OP || x == '='  )
 
 
-#define         LEFT_FIRST(x) ( x  ==  AND_OP  ||      x       ==      OR_OP   )
+#define  LEFT_FIRST(x) ( x  ==  AND_OP  ||      x       ==      OR_OP   )
 
 
-#define SIDE_EFFECTS_CHECK(op,rVal)  if (!sideEffects) {               \
-                                        werror(W_NO_SIDE_EFFECTS,op);  \
-                                        return rVal    ;               \
-                                    }
+#define SIDE_EFFECTS_CHECK(op,rVal)  if (!sideEffects)  {               \
+                                         werror(W_NO_SIDE_EFFECTS,op);  \
+                                         return rVal    ;               \
+                                     }
 #define IS_MODIFYING_OP(x) ( x == INC_OP || x == DEC_OP || x == '=' ||  \
 #define IS_MODIFYING_OP(x) ( x == INC_OP || x == DEC_OP || x == '=' ||  \
-                       x == AND_ASSIGN || x== OR_ASSIGN || x == XOR_ASSIGN )
+                        x == AND_ASSIGN || x== OR_ASSIGN || x == XOR_ASSIGN )
 
 #define IS_ASSIGN_OP(x) ( x == '=' || x == ADD_ASSIGN || x == SUB_ASSIGN ||\
 
 #define IS_ASSIGN_OP(x) ( x == '=' || x == ADD_ASSIGN || x == SUB_ASSIGN ||\
-                         x == MUL_ASSIGN || x == DIV_ASSIGN || x == XOR_ASSIGN ||\
-                         x == AND_ASSIGN || x == OR_ASSIGN || x == INC_OP || x == DEC_OP)
+                          x == MUL_ASSIGN || x == DIV_ASSIGN || x == XOR_ASSIGN ||\
+                          x == AND_ASSIGN || x == OR_ASSIGN || x == INC_OP || x == DEC_OP)
 #define IS_DEREF_OP(x) (( x->opval.op == '*' && x->right == NULL) || x->opval.op == '.')
 
 /* forward declarations for global variables */
 #define IS_DEREF_OP(x) (( x->opval.op == '*' && x->right == NULL) || x->opval.op == '.')
 
 /* forward declarations for global variables */
@@ -207,7 +207,7 @@ ast *createFor (symbol *, symbol *, symbol *, symbol *, ast *, ast *, ast *, ast
 void eval2icode (ast *);
 value *constExprValue (ast *, int);
 bool constExprTree (ast *);
 void eval2icode (ast *);
 value *constExprValue (ast *, int);
 bool constExprTree (ast *);
-int setAstLineno (ast *, int);
+int setAstFileLine (ast *, char *, int);
 symbol *funcOfType (char *, sym_link *, sym_link *, int, int);
 symbol * funcOfTypeVarg (char *, char * , int , char **);
 ast *initAggregates (symbol *, initList *, ast *);
 symbol *funcOfType (char *, sym_link *, sym_link *, int, int);
 symbol * funcOfTypeVarg (char *, char * , int , char **);
 ast *initAggregates (symbol *, initList *, ast *);
@@ -218,7 +218,7 @@ DEFSETFUNC(resetParmKey);
 int astErrors(ast *);
 RESULT_TYPE getResultTypeFromType (sym_link *);
 
 int astErrors(ast *);
 RESULT_TYPE getResultTypeFromType (sym_link *);
 
-// exported variables 
+// exported variables
 extern set *operKeyReset;
 extern int noAlloc;
 extern int inInitMode;
 extern set *operKeyReset;
 extern int noAlloc;
 extern int inInitMode;
index f6e6ec03a313cecf33a649478bf3f43e0fca8b15..23f0205085bd2b543e9d8995b11b3db3811ed8a1 100644 (file)
@@ -1135,6 +1135,7 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
             {
               iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
             {
               iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
+              newic->filename = ic->filename;
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
             }
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
             }
@@ -1162,6 +1163,7 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
                 {
                   iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
                   IC_RESULT (newic) = IC_LEFT (ic);
                 {
                   iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
                   IC_RESULT (newic) = IC_LEFT (ic);
+                  newic->filename = ic->filename;
                   newic->lineno = ic->lineno;
                   addiCodeToeBBlock (ebp, newic, ic->next);
                 }
                   newic->lineno = ic->lineno;
                   addiCodeToeBBlock (ebp, newic, ic->next);
                 }
@@ -1209,6 +1211,7 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
             {
               iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
             {
               iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
+              newic->filename = ic->filename;
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
             }
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
             }
@@ -1263,6 +1266,7 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
                 {
                   iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
                   IC_RESULT (newic) = IC_LEFT (ic);
                 {
                   iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
                   IC_RESULT (newic) = IC_LEFT (ic);
+                  newic->filename = ic->filename;
                   newic->lineno = ic->lineno;
                   addiCodeToeBBlock (ebp, newic, ic->next);
                 }
                   newic->lineno = ic->lineno;
                   addiCodeToeBBlock (ebp, newic, ic->next);
                 }
@@ -1283,11 +1287,13 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
             {
               iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
             {
               iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
+              newic->filename = ic->filename;
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
 
               newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
 
               newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
               IC_RESULT (newic) = IC_LEFT (ic);
+              newic->filename = ic->filename;
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
             }
               newic->lineno = ic->lineno;
               addiCodeToeBBlock (ebp, newic, ic->next);
             }
index 2f73b5725f74a97b3c8efeeb5e4d43e8be6af1cd..c35f114acd24e4477aa54cdc20ebf9e0b8922e91 100644 (file)
@@ -293,7 +293,7 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
 
           if (ival) {
             // set ival's lineno to where the symbol was defined
 
           if (ival) {
             // set ival's lineno to where the symbol was defined
-            setAstLineno (ival, lineno=sym->lineDef);
+            setAstFileLine (ival, filename = sym->fileDef, lineno = sym->lineDef);
             // check if this is not a constant expression
             if (!constExprTree(ival)) {
               werror (E_CONST_EXPECTED, "found expression");
             // check if this is not a constant expression
             if (!constExprTree(ival)) {
               werror (E_CONST_EXPECTED, "found expression");
index 1755276415f448ccbe38055e0006959d74ce0014..03da8a0c88f8dc811ee1bb93c4a0ac4895b46af9 100644 (file)
@@ -561,8 +561,8 @@ newiCode (int op, operand * left, operand * right)
   ic = Safe_alloc ( sizeof (iCode));
 
   ic->seqPoint = seqPoint;
   ic = Safe_alloc ( sizeof (iCode));
 
   ic->seqPoint = seqPoint;
-  ic->lineno = lineno;
   ic->filename = filename;
   ic->filename = filename;
+  ic->lineno = lineno;
   ic->block = block;
   ic->level = scopeLevel;
   ic->op = op;
   ic->block = block;
   ic->level = scopeLevel;
   ic->op = op;
@@ -701,8 +701,8 @@ copyiCode (iCode * ic)
 {
   iCode *nic = newiCode (ic->op, NULL, NULL);
 
 {
   iCode *nic = newiCode (ic->op, NULL, NULL);
 
-  nic->lineno = ic->lineno;
   nic->filename = ic->filename;
   nic->filename = ic->filename;
+  nic->lineno = ic->lineno;
   nic->block = ic->block;
   nic->level = ic->level;
   nic->parmBytes = ic->parmBytes;
   nic->block = ic->block;
   nic->level = ic->level;
   nic->parmBytes = ic->parmBytes;
@@ -822,7 +822,7 @@ operandType (operand * op)
 /*-----------------------------------------------------------------*/
 /* operandSize - returns size of an operand in bytes               */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* operandSize - returns size of an operand in bytes               */
 /*-----------------------------------------------------------------*/
-unsigned int 
+unsigned int
 operandSize (operand * op)
 {
   sym_link *type;
 operandSize (operand * op)
 {
   sym_link *type;
@@ -3525,6 +3525,7 @@ geniCodeFunctionBody (ast * tree,int lvl)
   iCode *ic;
   operand *func;
   sym_link *fetype;
   iCode *ic;
   operand *func;
   sym_link *fetype;
+  char *savefilename;
   int savelineno;
 
   /* reset the auto generation */
   int savelineno;
 
   /* reset the auto generation */
@@ -3536,15 +3537,19 @@ geniCodeFunctionBody (ast * tree,int lvl)
   func = ast2iCode (tree->left,lvl+1);
   fetype = getSpec (operandType (func));
 
   func = ast2iCode (tree->left,lvl+1);
   fetype = getSpec (operandType (func));
 
+  savefilename = filename;
   savelineno = lineno;
   savelineno = lineno;
+  filename = OP_SYMBOL (func)->fileDef;
   lineno = OP_SYMBOL (func)->lineDef;
   /* create an entry label */
   geniCodeLabel (entryLabel);
   lineno = OP_SYMBOL (func)->lineDef;
   /* create an entry label */
   geniCodeLabel (entryLabel);
+  filename = savefilename;
   lineno = savelineno;
 
   /* create a proc icode */
   ic = newiCode (FUNCTION, func, NULL);
   lineno = savelineno;
 
   /* create a proc icode */
   ic = newiCode (FUNCTION, func, NULL);
-  lineno=ic->lineno = OP_SYMBOL (func)->lineDef;
+  filename = ic->filename = OP_SYMBOL (func)->fileDef;
+  lineno = ic->lineno = OP_SYMBOL (func)->lineDef;
   ic->tree = tree;
 
   ADDTOCHAIN (ic);
   ic->tree = tree;
 
   ADDTOCHAIN (ic);
index c3e2f7e86be8960b46c8e8f73a2e6f24ee3db83b..07d20ecae821e0470fc3c6e40044dc187f63fc3a 100644 (file)
@@ -35,7 +35,7 @@ STACK_DCL (regionStack, eBBlock *, MAX_NEST_LEVEL * 10);
 /*-----------------------------------------------------------------*/
 static induction *
 newInduction (operand * sym, unsigned int op,
 /*-----------------------------------------------------------------*/
 static induction *
 newInduction (operand * sym, unsigned int op,
-             long constVal, iCode * ic, operand * asym)
+              long constVal, iCode * ic, operand * asym)
 {
   induction *ip;
 
 {
   induction *ip;
 
@@ -143,7 +143,7 @@ intersectLoopSucc (set * lexits, eBBlock ** ebbs)
        exit = setNextItem (lexits))
     {
       succVect = bitVectIntersect (succVect,
        exit = setNextItem (lexits))
     {
       succVect = bitVectIntersect (succVect,
-                                  exit->succVect);
+                                   exit->succVect);
     }
 
   return succVect;
     }
 
   return succVect;
@@ -219,7 +219,7 @@ findLoopEndSeq (region * lreg)
        block = setNextItem (lreg->regBlocks))
     {
       if (block != lblock && block->lSeq > lblock->lSeq)
        block = setNextItem (lreg->regBlocks))
     {
       if (block != lblock && block->lSeq > lblock->lSeq)
-       lblock = block;
+        lblock = block;
     }
 
   return lblock->lSeq;
     }
 
   return lblock->lSeq;
@@ -284,7 +284,7 @@ DEFSETFUNC (createLoop)
       block = STACK_POP (regionStack);
       /* if block != entry */
       if (block != ep->to)
       block = STACK_POP (regionStack);
       /* if block != entry */
       if (block != ep->to)
-       applyToSet (block->predList, insertIntoLoop, &aloop->regBlocks);
+        applyToSet (block->predList, insertIntoLoop, &aloop->regBlocks);
     }
 
   aloop->entry = ep->to;
     }
 
   aloop->entry = ep->to;
@@ -360,19 +360,19 @@ isOperandInvariant (operand * op, region * theLoop, set * lInvars)
   if (op)
     {
       if (IS_OP_LITERAL (op))
   if (op)
     {
       if (IS_OP_LITERAL (op))
-       opin = 1;
+        opin = 1;
       else if (IS_SYMOP (op) &&
       else if (IS_SYMOP (op) &&
-              OP_SYMBOL (op)->addrtaken)
-       opin = 0;
+               OP_SYMBOL (op)->addrtaken)
+        opin = 0;
       else if (ifDefSymIs (theLoop->entry->inExprs, op))
       else if (ifDefSymIs (theLoop->entry->inExprs, op))
-       opin = 1;
+        opin = 1;
       else if (ifDefSymIs (lInvars, op))
       else if (ifDefSymIs (lInvars, op))
-       opin = 1;
+        opin = 1;
       else if (IS_SYMOP (op) &&
       else if (IS_SYMOP (op) &&
-              !IS_OP_GLOBAL (op) &&
-              !IS_OP_VOLATILE (op) &&
-              assignmentsToSym (theLoop->regBlocks, op) == 0)
-       opin = 1;
+               !IS_OP_GLOBAL (op) &&
+               !IS_OP_VOLATILE (op) &&
+               assignmentsToSym (theLoop->regBlocks, op) == 0)
+        opin = 1;
     }
   else
     opin++;
     }
   else
     opin++;
@@ -456,144 +456,144 @@ loopInvariants (region * theLoop, ebbIndex * ebbi)
 
       /* mark the dominates all exits flag */
       domsAllExits = (applyToSet (theLoop->exits, dominatedBy, lBlock) ==
 
       /* mark the dominates all exits flag */
       domsAllExits = (applyToSet (theLoop->exits, dominatedBy, lBlock) ==
-                     elementsInSet (theLoop->exits));
+                      elementsInSet (theLoop->exits));
 
       /* find out if we have a function call in this block */
       for (ic = lBlock->sch, fCallsInBlock=0; ic; ic = ic->next) {
 
       /* find out if we have a function call in this block */
       for (ic = lBlock->sch, fCallsInBlock=0; ic; ic = ic->next) {
-       if (SKIP_IC(ic)) {
-         fCallsInBlock++;
-       }
+        if (SKIP_IC(ic)) {
+          fCallsInBlock++;
+        }
       }
 
       /* now we go thru the instructions of this block and */
       /* collect those instructions with invariant operands */
       for (ic = lBlock->sch; ic; ic = ic->next)
       }
 
       /* now we go thru the instructions of this block and */
       /* collect those instructions with invariant operands */
       for (ic = lBlock->sch; ic; ic = ic->next)
-       {
-
-         int lin, rin;
-         cseDef *ivar;
-
-         /* TODO this is only needed if the call is between
-            here and the definition, but I am too lazy to do that now */
-
-         /* if there are function calls in this block */
-         if (fCallsInBlock) {
-
-           /* if this is a pointer get */
-           if (POINTER_GET(ic)) {
-             continue;
-           }
-
-           /* if this is an assignment from a global */
-           if (ic->op=='=' && isOperandGlobal(IC_RIGHT(ic))) {
-             continue;
-           }
-         }
-
-         if (SKIP_IC (ic) || POINTER_SET (ic) || ic->op == IFX)
-           continue;
-
-         /* iTemp assignment from a literal may be invariant, but it
-            will needlessly increase register pressure if the
-            iCode(s) that use this iTemp are not also invariant */
-         if (ic->op=='=' && IS_ITEMP (IC_RESULT (ic))
-             && IS_OP_LITERAL (IC_RIGHT (ic)))
-           continue;
-
-         /* if result is volatile then skip */
-         if (IC_RESULT (ic) &&
-             (isOperandVolatile (IC_RESULT (ic), TRUE) ||
-              IS_OP_PARM (IC_RESULT (ic))))
-           continue;
-
-         /* if result depends on a volatile then skip */
-         if ((IC_LEFT(ic) && isOperandVolatile(IC_LEFT(ic), TRUE)) ||
-             (IC_RIGHT(ic) && isOperandVolatile(IC_RIGHT(ic), TRUE)))
-           continue;
-
-         lin = rin = 0;
-
-         /* special case */
-         /* if address of then it is an invariant */
-         if (ic->op == ADDRESS_OF &&
-             IS_SYMOP (IC_LEFT (ic)) &&
-             IS_AGGREGATE (operandType (IC_LEFT (ic))))
-           lin++;
-         else {
-           /* check if left operand is an invariant */
-           if ((lin = isOperandInvariant (IC_LEFT (ic), theLoop, lInvars)))
-             /* if this is a pointer get then make sure
-                that the pointer set does not exist in
-                any of the blocks */
-             if (POINTER_GET (ic) &&
-                 (applyToSet (theLoop->regBlocks,
-                              pointerAssigned, IC_LEFT (ic))))
-               lin = 0;
-         }
-
-         /* do the same for right */
-         rin = isOperandInvariant (IC_RIGHT (ic), theLoop, lInvars);
-
-         /* if this is a POINTER_GET then special case, make sure all
-            usages within the loop are POINTER_GET any other usage
-            would mean that this is not an invariant , since the pointer
-            could then be passed as a parameter */
-         if (POINTER_GET (ic) &&
-             applyToSet (theLoop->regBlocks, hasNonPtrUse, IC_LEFT (ic)))
-           continue;
+        {
+
+          int lin, rin;
+          cseDef *ivar;
+
+          /* TODO this is only needed if the call is between
+             here and the definition, but I am too lazy to do that now */
+
+          /* if there are function calls in this block */
+          if (fCallsInBlock) {
+
+            /* if this is a pointer get */
+            if (POINTER_GET(ic)) {
+              continue;
+            }
+
+            /* if this is an assignment from a global */
+            if (ic->op=='=' && isOperandGlobal(IC_RIGHT(ic))) {
+              continue;
+            }
+          }
+
+          if (SKIP_IC (ic) || POINTER_SET (ic) || ic->op == IFX)
+            continue;
+
+          /* iTemp assignment from a literal may be invariant, but it
+             will needlessly increase register pressure if the
+             iCode(s) that use this iTemp are not also invariant */
+          if (ic->op=='=' && IS_ITEMP (IC_RESULT (ic))
+              && IS_OP_LITERAL (IC_RIGHT (ic)))
+            continue;
+
+          /* if result is volatile then skip */
+          if (IC_RESULT (ic) &&
+              (isOperandVolatile (IC_RESULT (ic), TRUE) ||
+               IS_OP_PARM (IC_RESULT (ic))))
+            continue;
+
+          /* if result depends on a volatile then skip */
+          if ((IC_LEFT(ic) && isOperandVolatile(IC_LEFT(ic), TRUE)) ||
+              (IC_RIGHT(ic) && isOperandVolatile(IC_RIGHT(ic), TRUE)))
+            continue;
+
+          lin = rin = 0;
+
+          /* special case */
+          /* if address of then it is an invariant */
+          if (ic->op == ADDRESS_OF &&
+              IS_SYMOP (IC_LEFT (ic)) &&
+              IS_AGGREGATE (operandType (IC_LEFT (ic))))
+            lin++;
+          else {
+            /* check if left operand is an invariant */
+            if ((lin = isOperandInvariant (IC_LEFT (ic), theLoop, lInvars)))
+              /* if this is a pointer get then make sure
+                 that the pointer set does not exist in
+                 any of the blocks */
+              if (POINTER_GET (ic) &&
+                  (applyToSet (theLoop->regBlocks,
+                               pointerAssigned, IC_LEFT (ic))))
+                lin = 0;
+          }
+
+          /* do the same for right */
+          rin = isOperandInvariant (IC_RIGHT (ic), theLoop, lInvars);
+
+          /* if this is a POINTER_GET then special case, make sure all
+             usages within the loop are POINTER_GET any other usage
+             would mean that this is not an invariant , since the pointer
+             could then be passed as a parameter */
+          if (POINTER_GET (ic) &&
+              applyToSet (theLoop->regBlocks, hasNonPtrUse, IC_LEFT (ic)))
+            continue;
 
 
           /* if both the left & right are invariants : then check that */
 
 
           /* if both the left & right are invariants : then check that */
-         /* this definition exists in the out definition of all the   */
-         /* blocks, this will ensure that this is not assigned any    */
-         /* other value in the loop, and not used in this block       */
-         /* prior to this definition which means only this definition */
-         /* is used in this loop                                      */
-         if (lin && rin && IC_RESULT (ic))
-           {
-             eBBlock *sBlock;
-             set *lSet = setFromSet (theLoop->regBlocks);
-
-             /* if this block does not dominate all exits */
-             /* make sure this defintion is not used anywhere else */
-             if (!domsAllExits)
-               {
-
-                 if (isOperandGlobal (IC_RESULT (ic)))
-                   continue;
-                 /* for successors for all exits */
-                 for (sBlock = setFirstItem (theLoop->exits); sBlock;
-                      sBlock = setNextItem (theLoop->exits))
-                   {
-
-                     for (i = 0; i < count; ebbs[i++]->visited = 0);
-                     lBlock->visited = 1;
-                     if (applyToSet (sBlock->succList, isDefAlive, ic))
-                       break;
-                   }
-
-                 /* we have found usage */
-                 if (sBlock)
-                   continue;
-               }
-
-             /* now make sure this is the only definition */
-             for (sBlock = setFirstItem (lSet); sBlock;
-                  sBlock = setNextItem (lSet))
-               {
+          /* this definition exists in the out definition of all the   */
+          /* blocks, this will ensure that this is not assigned any    */
+          /* other value in the loop, and not used in this block       */
+          /* prior to this definition which means only this definition */
+          /* is used in this loop                                      */
+          if (lin && rin && IC_RESULT (ic))
+            {
+              eBBlock *sBlock;
+              set *lSet = setFromSet (theLoop->regBlocks);
+
+              /* if this block does not dominate all exits */
+              /* make sure this defintion is not used anywhere else */
+              if (!domsAllExits)
+                {
+
+                  if (isOperandGlobal (IC_RESULT (ic)))
+                    continue;
+                  /* for successors for all exits */
+                  for (sBlock = setFirstItem (theLoop->exits); sBlock;
+                       sBlock = setNextItem (theLoop->exits))
+                    {
+
+                      for (i = 0; i < count; ebbs[i++]->visited = 0);
+                      lBlock->visited = 1;
+                      if (applyToSet (sBlock->succList, isDefAlive, ic))
+                        break;
+                    }
+
+                  /* we have found usage */
+                  if (sBlock)
+                    continue;
+                }
+
+              /* now make sure this is the only definition */
+              for (sBlock = setFirstItem (lSet); sBlock;
+                   sBlock = setNextItem (lSet))
+                {
                   iCode *ic2;
                   int used;
                   int defDominates;
 
                   iCode *ic2;
                   int used;
                   int defDominates;
 
-                 /* if this is the block make sure the definition */
-                 /* reaches the end of the block */
-                 if (sBlock == lBlock)
-                   {
-                     if (!ifDiCodeIs (sBlock->outExprs, ic))
-                       break;
-                   }
-                 else if (bitVectBitsInCommon (sBlock->defSet, OP_DEFS (IC_RESULT (ic))))
-                   break;
+                  /* if this is the block make sure the definition */
+                  /* reaches the end of the block */
+                  if (sBlock == lBlock)
+                    {
+                      if (!ifDiCodeIs (sBlock->outExprs, ic))
+                        break;
+                    }
+                  else if (bitVectBitsInCommon (sBlock->defSet, OP_DEFS (IC_RESULT (ic))))
+                    break;
 
                   /* Check that this definition is not assigned */
                   /* any other value in this block. Also check */
 
                   /* Check that this definition is not assigned */
                   /* any other value in this block. Also check */
@@ -630,37 +630,37 @@ loopInvariants (region * theLoop, ebbIndex * ebbi)
                     }
                   if (ic2) /* found another definition or a usage before the definition */
                     break;
                     }
                   if (ic2) /* found another definition or a usage before the definition */
                     break;
-               }
+                }
+
+              if (sBlock)
+                continue;       /* another definition present in the block */
 
 
-             if (sBlock)
-               continue;       /* another definition present in the block */
-              
 
               /* now check if it exists in the in of this block */
 
               /* now check if it exists in the in of this block */
-             /* if not then it was killed before this instruction */
-             if (!bitVectBitValue (lBlock->inDefs, ic->key))
-               continue;
+              /* if not then it was killed before this instruction */
+              if (!bitVectBitValue (lBlock->inDefs, ic->key))
+                continue;
 
 
-             /* now we know it is a true invariant */
-             /* remove it from the insts chain & put */
-             /* in the invariant set                */
+              /* now we know it is a true invariant */
+              /* remove it from the insts chain & put */
+              /* in the invariant set                */
 
               OP_SYMBOL (IC_RESULT (ic))->isinvariant = 1;
               SPIL_LOC (IC_RESULT (ic)) = NULL;
 
               OP_SYMBOL (IC_RESULT (ic))->isinvariant = 1;
               SPIL_LOC (IC_RESULT (ic)) = NULL;
-             remiCodeFromeBBlock (lBlock, ic);
-
-             /* maintain the data flow */
-             /* this means removing from definition from the */
-             /* defset of this block and adding it to the    */
-             /* inexpressions of all blocks within the loop  */
-             bitVectUnSetBit (lBlock->defSet, ic->key);
-             bitVectUnSetBit (lBlock->ldefs, ic->key);
-             ivar = newCseDef (IC_RESULT (ic), ic);
-             applyToSet (theLoop->regBlocks, addDefInExprs, ivar, ebbi);
-             addSet (&lInvars, ivar);
-           }
-       }
-    }                          /* for all loop blocks */
+              remiCodeFromeBBlock (lBlock, ic);
+
+              /* maintain the data flow */
+              /* this means removing from definition from the */
+              /* defset of this block and adding it to the    */
+              /* inexpressions of all blocks within the loop  */
+              bitVectUnSetBit (lBlock->defSet, ic->key);
+              bitVectUnSetBit (lBlock->ldefs, ic->key);
+              ivar = newCseDef (IC_RESULT (ic), ic);
+              applyToSet (theLoop->regBlocks, addDefInExprs, ivar, ebbi);
+              addSet (&lInvars, ivar);
+            }
+        }
+    }                           /* for all loop blocks */
 
   /* if we have some invariants then */
   if (lInvars)
 
   /* if we have some invariants then */
   if (lInvars)
@@ -671,28 +671,29 @@ loopInvariants (region * theLoop, ebbIndex * ebbi)
 
       /* create an iCode chain from it */
       for (cdp = setFirstItem (lInvars); cdp; cdp = setNextItem (lInvars))
 
       /* create an iCode chain from it */
       for (cdp = setFirstItem (lInvars); cdp; cdp = setNextItem (lInvars))
-       {
-
-         /* maintain data flow .. add it to the */
-         /* ldefs defSet & outExprs of the preheader  */
-         preHdr->defSet = bitVectSetBit (preHdr->defSet, cdp->diCode->key);
-         preHdr->ldefs = bitVectSetBit (preHdr->ldefs, cdp->diCode->key);
-         cdp->diCode->lineno = preHdr->ech->lineno;
-         addSetHead (&preHdr->outExprs, cdp);
-
-
-         if (!icFirst)
-           icFirst = cdp->diCode;
-         if (icLast)
-           {
-             icLast->next = cdp->diCode;
-             cdp->diCode->prev = icLast;
-             icLast = cdp->diCode;
-           }
-         else
-           icLast = cdp->diCode;
-         change++;
-       }
+        {
+
+          /* maintain data flow .. add it to the */
+          /* ldefs defSet & outExprs of the preheader  */
+          preHdr->defSet = bitVectSetBit (preHdr->defSet, cdp->diCode->key);
+          preHdr->ldefs = bitVectSetBit (preHdr->ldefs, cdp->diCode->key);
+          cdp->diCode->filename = preHdr->ech->filename;
+          cdp->diCode->lineno = preHdr->ech->lineno;
+          addSetHead (&preHdr->outExprs, cdp);
+
+
+          if (!icFirst)
+            icFirst = cdp->diCode;
+          if (icLast)
+            {
+              icLast->next = cdp->diCode;
+              cdp->diCode->prev = icLast;
+              icLast = cdp->diCode;
+            }
+          else
+            icLast = cdp->diCode;
+          change++;
+        }
 
       /* add the instruction chain to the end of the
          preheader for this loop, preheaders will always
 
       /* add the instruction chain to the end of the
          preheader for this loop, preheaders will always
@@ -721,11 +722,11 @@ addressTaken (set * sset, operand * sym)
       ebp = loop->item;
       loop2 = ebp->addrOf;
       while (loop2)
       ebp = loop->item;
       loop2 = ebp->addrOf;
       while (loop2)
-       {
-         if (isOperandEqual ((operand *) loop2->item, sym))
-           return 1;
-         loop2 = loop2->next;
-       }
+        {
+          if (isOperandEqual ((operand *) loop2->item, sym))
+            return 1;
+          loop2 = loop2->next;
+        }
     }
 
   return 0;
     }
 
   return 0;
@@ -766,18 +767,18 @@ findDefInRegion (set * regBlocks, operand * defOp, eBBlock ** owner)
 
       /* if a definition for this exists */
       if (bitVectBitsInCommon (lBlock->defSet, OP_DEFS (defOp)))
 
       /* if a definition for this exists */
       if (bitVectBitsInCommon (lBlock->defSet, OP_DEFS (defOp)))
-       {
-         iCode *ic;
-
-         /* go thru the instruction chain to find it */
-         for (ic = lBlock->sch; ic; ic = ic->next)
-           if (bitVectBitValue (OP_DEFS (defOp), ic->key))
-             {
-               if (owner)
-                 *owner = lBlock;
-               return ic;
-             }
-       }
+        {
+          iCode *ic;
+
+          /* go thru the instruction chain to find it */
+          for (ic = lBlock->sch; ic; ic = ic->next)
+            if (bitVectBitValue (OP_DEFS (defOp), ic->key))
+              {
+                if (owner)
+                  *owner = lBlock;
+                return ic;
+              }
+        }
     }
 
   return NULL;
     }
 
   return NULL;
@@ -793,7 +794,7 @@ addPostLoopBlock (region *loopReg, ebbIndex *ebbi, iCode *ic)
   bitVect *loopSuccs;
   int i;
 
   bitVect *loopSuccs;
   int i;
 
-  /* if the number of exits is greater than one then 
+  /* if the number of exits is greater than one then
      we use another trick: we will create an intersection
      of succesors of the exits, then take those that are not
      part of the loop and have dfNumber greater loop entry (eblock),
      we use another trick: we will create an intersection
      of succesors of the exits, then take those that are not
      part of the loop and have dfNumber greater loop entry (eblock),
@@ -950,6 +951,8 @@ addPostLoopBlock (region *loopReg, ebbIndex *ebbi, iCode *ic)
 
       /* and add it */
       addiCodeToeBBlock (postLoopBlk, newic, NULL);
 
       /* and add it */
       addiCodeToeBBlock (postLoopBlk, newic, NULL);
+      postLoopBlk->sch->filename =
+      postLoopBlk->ech->filename = eblock->sch->filename;
       postLoopBlk->sch->lineno =
       postLoopBlk->ech->lineno = eblock->sch->lineno;
 
       postLoopBlk->sch->lineno =
       postLoopBlk->ech->lineno = eblock->sch->lineno;
 
@@ -982,17 +985,17 @@ basicInduction (region * loopReg, ebbIndex * ebbi)
 
       /* for all instructions in the blocks do */
       for (ic = lBlock->sch; ic; ic = ic->next)
 
       /* for all instructions in the blocks do */
       for (ic = lBlock->sch; ic; ic = ic->next)
-       {
-
-         operand *aSym;
-         long litValue;
-         induction *ip;
-         iCode *indIc;
-         eBBlock *owner = NULL;
-         int nexits;
+        {
+
+          operand *aSym;
+          long litValue;
+          induction *ip;
+          iCode *indIc;
+          eBBlock *owner = NULL;
+          int nexits;
           sym_link *optype;
 
           sym_link *optype;
 
-         /* To find an induction variable, we need to */
+          /* To find an induction variable, we need to */
           /* find within the loop three iCodes in this */
           /* general form:                             */
           /*                                           */
           /* find within the loop three iCodes in this */
           /* general form:                             */
           /*                                           */
@@ -1004,29 +1007,29 @@ basicInduction (region * loopReg, ebbIndex * ebbi)
           /*                                           */
           /* (symbolVar may also be an iTemp if it is  */
           /*  register equivalent)                     */
           /*                                           */
           /* (symbolVar may also be an iTemp if it is  */
           /*  register equivalent)                     */
-          
+
           /* look for assignments of the form */
           /* look for assignments of the form */
-         /*   symbolVar := iTempNN */
-         if (ic->op != '=')
-           continue;
+          /*   symbolVar := iTempNN */
+          if (ic->op != '=')
+            continue;
 
 
-         if (!IS_TRUE_SYMOP (IC_RESULT (ic)) &&
-             !OP_SYMBOL (IC_RESULT (ic))->isreqv)
-           continue;
+          if (!IS_TRUE_SYMOP (IC_RESULT (ic)) &&
+              !OP_SYMBOL (IC_RESULT (ic))->isreqv)
+            continue;
 
 
-         if (isOperandGlobal (IC_RESULT (ic)))
-           continue;
+          if (isOperandGlobal (IC_RESULT (ic)))
+            continue;
 
 
-         if (!IS_ITEMP (IC_RIGHT (ic)))
-           continue;
+          if (!IS_ITEMP (IC_RIGHT (ic)))
+            continue;
 
 
-         /* if it has multiple assignments within the loop then skip */
-         if (assignmentsToSym (loopReg->regBlocks, IC_RESULT (ic)) > 1)
-           continue;
+          /* if it has multiple assignments within the loop then skip */
+          if (assignmentsToSym (loopReg->regBlocks, IC_RESULT (ic)) > 1)
+            continue;
 
 
-         /* if the address of this was taken inside the loop then continue */
-         if (addressTaken (loopReg->regBlocks, IC_RESULT (ic)))
-           continue;
+          /* if the address of this was taken inside the loop then continue */
+          if (addressTaken (loopReg->regBlocks, IC_RESULT (ic)))
+            continue;
 
           /* Only consider variables with integral type. */
           /* (2004/12/06 - EEP - ds390 fails regression tests unless */
 
           /* Only consider variables with integral type. */
           /* (2004/12/06 - EEP - ds390 fails regression tests unless */
@@ -1037,24 +1040,24 @@ basicInduction (region * loopReg, ebbIndex * ebbi)
           if (!IS_INTEGRAL (optype) && !IS_PTR (optype))
             continue;
 
           if (!IS_INTEGRAL (optype) && !IS_PTR (optype))
             continue;
 
-         /* find the definition for the result in the block */
-         if (!(dic = findDefInRegion (setFromSet (loopReg->regBlocks),
-                                      IC_RIGHT (ic), &owner)))
-           continue;
-
-         /* if not +/- continue */
-         if (dic->op != '+' && dic->op != '-')
-           continue;
-         
-         /* make sure definition is of the form  a +/- c */
-         if (!IS_OP_LITERAL (IC_LEFT (dic)) && !IS_OP_LITERAL (IC_RIGHT (dic)))
-           continue;
-          
+          /* find the definition for the result in the block */
+          if (!(dic = findDefInRegion (setFromSet (loopReg->regBlocks),
+                                       IC_RIGHT (ic), &owner)))
+            continue;
+
+          /* if not +/- continue */
+          if (dic->op != '+' && dic->op != '-')
+            continue;
+
+          /* make sure definition is of the form  a +/- c */
+          if (!IS_OP_LITERAL (IC_LEFT (dic)) && !IS_OP_LITERAL (IC_RIGHT (dic)))
+            continue;
+
           /* make sure the definition found is the only one */
           if (assignmentsToSym (loopReg->regBlocks, IC_RIGHT (ic)) > 1)
           /* make sure the definition found is the only one */
           if (assignmentsToSym (loopReg->regBlocks, IC_RIGHT (ic)) > 1)
-           continue;
+            continue;
 
 
-         if (IS_OP_LITERAL (IC_RIGHT (dic)))
+          if (IS_OP_LITERAL (IC_RIGHT (dic)))
             {
               aSym = IC_LEFT (dic);
               litValue = (long) operandLitValue (IC_RIGHT (dic));
             {
               aSym = IC_LEFT (dic);
               litValue = (long) operandLitValue (IC_RIGHT (dic));
@@ -1070,45 +1073,46 @@ basicInduction (region * loopReg, ebbIndex * ebbi)
               litValue = (long) operandLitValue (IC_LEFT (dic));
             }
 
               litValue = (long) operandLitValue (IC_LEFT (dic));
             }
 
-         if (!isOperandEqual (IC_RESULT (ic), aSym) &&
-             !isOperandEqual (IC_RIGHT (ic), aSym))
-           {
-             iCode *ddic;
-             /* find the definition for this and check */
-             if (!(ddic = findDefInRegion (setFromSet (loopReg->regBlocks),
-                                           aSym, &owner)))
-               continue;
-
-             if (ddic->op != '=')
-               continue;
-
-             if (!isOperandEqual (IC_RESULT (ddic), aSym) ||
-                 !isOperandEqual (IC_RIGHT (ddic), IC_RESULT (ic)))
-               continue;
-           }
-
-         /* if the right hand side has more than one usage then
-            don't make it an induction (will have to think some more) */
-         if (bitVectnBitsOn (OP_USES (IC_RIGHT (ic))) > 1)
-           continue;
-
-         /* if the definition is volatile then it cannot be
-            an induction object */
-         if (isOperandVolatile (IC_RIGHT (ic), FALSE) ||
-             isOperandVolatile (IC_RESULT (ic), FALSE))
-           continue;
-
-         /* whew !! that was a lot of work to find the definition */
-         /* create an induction object */
-         indIc = newiCode ('=', NULL, IC_RESULT (ic));
-         indIc->lineno = ic->lineno;
-         IC_RESULT (indIc) = operandFromOperand (IC_RIGHT (ic));
-         IC_RESULT (indIc)->isaddr = 0;
-         OP_SYMBOL (IC_RESULT (indIc))->isind = 1;
-         ip = newInduction (IC_RIGHT (ic), dic->op, litValue, indIc, NULL);
-
-         /* replace the inducted variable by the iTemp */
-         replaceSymBySym (loopReg->regBlocks, IC_RESULT (ic), IC_RIGHT (ic));
+          if (!isOperandEqual (IC_RESULT (ic), aSym) &&
+              !isOperandEqual (IC_RIGHT (ic), aSym))
+            {
+              iCode *ddic;
+              /* find the definition for this and check */
+              if (!(ddic = findDefInRegion (setFromSet (loopReg->regBlocks),
+                                            aSym, &owner)))
+                continue;
+
+              if (ddic->op != '=')
+                continue;
+
+              if (!isOperandEqual (IC_RESULT (ddic), aSym) ||
+                  !isOperandEqual (IC_RIGHT (ddic), IC_RESULT (ic)))
+                continue;
+            }
+
+          /* if the right hand side has more than one usage then
+             don't make it an induction (will have to think some more) */
+          if (bitVectnBitsOn (OP_USES (IC_RIGHT (ic))) > 1)
+            continue;
+
+          /* if the definition is volatile then it cannot be
+             an induction object */
+          if (isOperandVolatile (IC_RIGHT (ic), FALSE) ||
+              isOperandVolatile (IC_RESULT (ic), FALSE))
+            continue;
+
+          /* whew !! that was a lot of work to find the definition */
+          /* create an induction object */
+          indIc = newiCode ('=', NULL, IC_RESULT (ic));
+          indIc->filename = ic->filename;
+          indIc->lineno = ic->lineno;
+          IC_RESULT (indIc) = operandFromOperand (IC_RIGHT (ic));
+          IC_RESULT (indIc)->isaddr = 0;
+          OP_SYMBOL (IC_RESULT (indIc))->isind = 1;
+          ip = newInduction (IC_RIGHT (ic), dic->op, litValue, indIc, NULL);
+
+          /* replace the inducted variable by the iTemp */
+          replaceSymBySym (loopReg->regBlocks, IC_RESULT (ic), IC_RIGHT (ic));
           /* ic should now be moved to the exit block(s) */
 
           nexits = elementsInSet (loopReg->exits);
           /* ic should now be moved to the exit block(s) */
 
           nexits = elementsInSet (loopReg->exits);
@@ -1166,32 +1170,32 @@ loopInduction (region * loopReg, ebbIndex * ebbi)
       /* last block is the one with the highest block
          number */
       if (lastBlock->bbnum < lBlock->bbnum)
       /* last block is the one with the highest block
          number */
       if (lastBlock->bbnum < lBlock->bbnum)
-       lastBlock = lBlock;
+        lastBlock = lBlock;
 
       for (ic = lBlock->sch; ic; ic = ic->next)
 
       for (ic = lBlock->sch; ic; ic = ic->next)
-       {
-         operand *aSym;
-         long litVal;
+        {
+          operand *aSym;
+          long litVal;
 
 
-         /* consider only * & / */
-         if (ic->op != '*' && ic->op != '/')
-           continue;
+          /* consider only * & / */
+          if (ic->op != '*' && ic->op != '/')
+            continue;
 
           /* only consider variables with integral type */
           if (!IS_INTEGRAL (operandType (IC_RESULT (ic))))
             continue;
 
           /* only consider variables with integral type */
           if (!IS_INTEGRAL (operandType (IC_RESULT (ic))))
             continue;
-         
+
           /* if the result has more definitions then */
           /* if the result has more definitions then */
-         if (assignmentsToSym (loopReg->regBlocks, IC_RESULT (ic)) > 1)
-           continue;
+          if (assignmentsToSym (loopReg->regBlocks, IC_RESULT (ic)) > 1)
+            continue;
 
 
-         /* check if the operands are what we want */
-         /* i.e. one of them an symbol the other a literal */
-         if (!((IS_SYMOP (IC_LEFT (ic)) && IS_OP_LITERAL (IC_RIGHT (ic))) ||
-               (IS_OP_LITERAL (IC_LEFT (ic)) && IS_SYMOP (IC_RIGHT (ic)))))
-           continue;
+          /* check if the operands are what we want */
+          /* i.e. one of them an symbol the other a literal */
+          if (!((IS_SYMOP (IC_LEFT (ic)) && IS_OP_LITERAL (IC_RIGHT (ic))) ||
+                (IS_OP_LITERAL (IC_LEFT (ic)) && IS_SYMOP (IC_RIGHT (ic)))))
+            continue;
 
 
-         if (IS_SYMOP (IC_LEFT (ic)))
+          if (IS_SYMOP (IC_LEFT (ic)))
             {
               aSym = IC_LEFT (ic);
               litVal = (long) operandLitValue (IC_RIGHT (ic));
             {
               aSym = IC_LEFT (ic);
               litVal = (long) operandLitValue (IC_RIGHT (ic));
@@ -1205,42 +1209,43 @@ loopInduction (region * loopReg, ebbIndex * ebbi)
               litVal = (long) operandLitValue (IC_LEFT (ic));
             }
 
               litVal = (long) operandLitValue (IC_LEFT (ic));
             }
 
-         ip = NULL;
-         /* check if this is an induction variable */
-         if (!applyToSetFTrue (basicInd, findInduction, aSym, &ip))
-           continue;
-
-         /* ask port for size not worth if native instruction
-            exist for multiply & divide */
-         if (getSize (operandType (IC_LEFT (ic))) <= (unsigned long) port->support.muldiv ||
-         getSize (operandType (IC_RIGHT (ic))) <= (unsigned long) port->support.muldiv)
-           continue;
-
-         /* if this is a division then the remainder should be zero
-            for it to be inducted */
-         if (ic->op == '/' && (ip->cval % litVal))
-           continue;
-
-         /* create the iCode to be placed in the loop header */
-         /* and create the induction object */
-
-         /* create an instruction */
-         /* this will be put on the loop header */
-         indIc = newiCode (ic->op,
-                           operandFromOperand (aSym),
-                           operandFromLit (litVal));
-         indIc->lineno = ic->lineno;
-         IC_RESULT (indIc) = operandFromOperand (IC_RESULT (ic));
-         OP_SYMBOL (IC_RESULT (indIc))->isind = 1;
-
-         /* keep track of the inductions */
-         litVal = (ic->op == '*' ? (litVal * ip->cval) :
-                   (ip->cval / litVal));
-
-         addSet (&indVars,
-               newInduction (IC_RESULT (ic), ip->op, litVal, indIc, NULL));
-
-         /* Replace mul/div with assignment to self; killDeadCode() will */
+          ip = NULL;
+          /* check if this is an induction variable */
+          if (!applyToSetFTrue (basicInd, findInduction, aSym, &ip))
+            continue;
+
+          /* ask port for size not worth if native instruction
+             exist for multiply & divide */
+          if (getSize (operandType (IC_LEFT (ic))) <= (unsigned long) port->support.muldiv ||
+          getSize (operandType (IC_RIGHT (ic))) <= (unsigned long) port->support.muldiv)
+            continue;
+
+          /* if this is a division then the remainder should be zero
+             for it to be inducted */
+          if (ic->op == '/' && (ip->cval % litVal))
+            continue;
+
+          /* create the iCode to be placed in the loop header */
+          /* and create the induction object */
+
+          /* create an instruction */
+          /* this will be put on the loop header */
+          indIc = newiCode (ic->op,
+                            operandFromOperand (aSym),
+                            operandFromLit (litVal));
+          indIc->filename = ic->filename;
+          indIc->lineno = ic->lineno;
+          IC_RESULT (indIc) = operandFromOperand (IC_RESULT (ic));
+          OP_SYMBOL (IC_RESULT (indIc))->isind = 1;
+
+          /* keep track of the inductions */
+          litVal = (ic->op == '*' ? (litVal * ip->cval) :
+                    (ip->cval / litVal));
+
+          addSet (&indVars,
+                newInduction (IC_RESULT (ic), ip->op, litVal, indIc, NULL));
+
+          /* Replace mul/div with assignment to self; killDeadCode() will */
           /* clean this up since we can't use remiCodeFromeBBlock() here. */
           ic->op = '=';
           IC_LEFT (ic) = NULL;
           /* clean this up since we can't use remiCodeFromeBBlock() here. */
           ic->op = '=';
           IC_LEFT (ic) = NULL;
@@ -1252,12 +1257,12 @@ loopInduction (region * loopReg, ebbIndex * ebbi)
                             operandFromOperand (IC_RESULT (ic)),
                             operandFromLit (litVal));
           IC_RESULT (indIc) = operandFromOperand (IC_RESULT (ic));
                             operandFromOperand (IC_RESULT (ic)),
                             operandFromLit (litVal));
           IC_RESULT (indIc) = operandFromOperand (IC_RESULT (ic));
-         owner = NULL;
+          owner = NULL;
           dic = findDefInRegion (setFromSet (loopReg->regBlocks), aSym, &owner);
           assert (dic);
           dic = findDefInRegion (setFromSet (loopReg->regBlocks), aSym, &owner);
           assert (dic);
-         addiCodeToeBBlock (owner, indIc, dic);
+          addiCodeToeBBlock (owner, indIc, dic);
 
 
-       }
+        }
     }
 
   /* if we have some induction variables then */
     }
 
   /* if we have some induction variables then */
@@ -1270,23 +1275,24 @@ loopInduction (region * loopReg, ebbIndex * ebbi)
 
       /* create an iCode chain from it */
       for (ip = setFirstItem (indVars);
 
       /* create an iCode chain from it */
       for (ip = setFirstItem (indVars);
-          ip;
-          ip = setNextItem (indVars))
-       {
-         indVect = bitVectSetBit (indVect, ip->ic->key);
-         ip->ic->lineno = preHdr->ech->lineno;
-         if (!icFirst)
-           icFirst = ip->ic;
-         if (icLast)
-           {
-             icLast->next = ip->ic;
-             ip->ic->prev = icLast;
-             icLast = ip->ic;
-           }
-         else
-           icLast = ip->ic;
-         change++;
-       }
+           ip;
+           ip = setNextItem (indVars))
+        {
+          indVect = bitVectSetBit (indVect, ip->ic->key);
+          ip->ic->filename = preHdr->ech->filename;
+          ip->ic->lineno = preHdr->ech->lineno;
+          if (!icFirst)
+            icFirst = ip->ic;
+          if (icLast)
+            {
+              icLast->next = ip->ic;
+              ip->ic->prev = icLast;
+              icLast = ip->ic;
+            }
+          else
+            icLast = ip->ic;
+          change++;
+        }
 
       /* add the instruction chain to the end of the */
       /* preheader for this loop                     */
 
       /* add the instruction chain to the end of the */
       /* preheader for this loop                     */
@@ -1325,14 +1331,14 @@ DEFSETFUNC (mergeRegions)
     {
 
       if (lp == theLoop)
     {
 
       if (lp == theLoop)
-       continue;
+        continue;
 
       if (lp->entry == theLoop->entry)
 
       if (lp->entry == theLoop->entry)
-       {
-         theLoop->regBlocks = unionSets (theLoop->regBlocks,
-                                         lp->regBlocks, THROW_DEST);
-         lp->merged = 1;
-       }
+        {
+          theLoop->regBlocks = unionSets (theLoop->regBlocks,
+                                          lp->regBlocks, THROW_DEST);
+          lp->merged = 1;
+        }
     }
 
   return 1;
     }
 
   return 1;
@@ -1366,17 +1372,17 @@ DEFSETFUNC (mergeInnerLoops)
     {
 
       if (lp == theLoop)
     {
 
       if (lp == theLoop)
-       continue;
+        continue;
 
       if (isinSet (lp->regBlocks, theLoop->entry))
 
       if (isinSet (lp->regBlocks, theLoop->entry))
-       {
-         lp->containsLoops += theLoop->containsLoops + 1;
-         if (lp->containsLoops > (*maxDepth))
-           *maxDepth = lp->containsLoops;
-
-         lp->regBlocks = unionSets (lp->regBlocks,
-                                    theLoop->regBlocks, THROW_DEST);
-       }
+        {
+          lp->containsLoops += theLoop->containsLoops + 1;
+          if (lp->containsLoops > (*maxDepth))
+            *maxDepth = lp->containsLoops;
+
+          lp->regBlocks = unionSets (lp->regBlocks,
+                                     theLoop->regBlocks, THROW_DEST);
+        }
     }
 
   return 1;
     }
 
   return 1;
@@ -1389,7 +1395,7 @@ DEFSETFUNC (mergeInnerLoops)
 hTab *
 createLoopRegions (ebbIndex * ebbi)
 {
 hTab *
 createLoopRegions (ebbIndex * ebbi)
 {
-  set *allRegion = NULL;       /* set of all loops */
+  set *allRegion = NULL;        /* set of all loops */
   hTab *orderedLoops = NULL;
   set *bEdges = NULL;
   int maxDepth = 0;
   hTab *orderedLoops = NULL;
   set *bEdges = NULL;
   int maxDepth = 0;
@@ -1397,7 +1403,7 @@ createLoopRegions (ebbIndex * ebbi)
 
   /* get all the back edges in the graph */
   if (!applyToSet (graphEdges, backEdges, &bEdges))
 
   /* get all the back edges in the graph */
   if (!applyToSet (graphEdges, backEdges, &bEdges))
-    return 0;                  /* found no loops */
+    return 0;                   /* found no loops */
 
   /* for each of these back edges get the blocks that */
   /* constitute the loops                             */
 
   /* for each of these back edges get the blocks that */
   /* constitute the loops                             */
@@ -1422,8 +1428,8 @@ createLoopRegions (ebbIndex * ebbi)
   for (lp = setFirstItem (allRegion); lp; lp = setNextItem (allRegion))
     {
       applyToSet (lp->regBlocks, addToExitsMarkDepth,
   for (lp = setFirstItem (allRegion); lp; lp = setNextItem (allRegion))
     {
       applyToSet (lp->regBlocks, addToExitsMarkDepth,
-                 lp->regBlocks, &lp->exits,
-                 (maxDepth - lp->containsLoops), lp);
+                  lp->regBlocks, &lp->exits,
+                  (maxDepth - lp->containsLoops), lp);
 
       hTabAddItem (&orderedLoops, lp->containsLoops, lp);
 
 
       hTabAddItem (&orderedLoops, lp->containsLoops, lp);
 
@@ -1455,10 +1461,10 @@ loopOptimizations (hTab * orderedLoops, ebbIndex * ebbi)
     {
 
       if (optimize.loopInvariant)
     {
 
       if (optimize.loopInvariant)
-       change += loopInvariants (lp, ebbi);
+        change += loopInvariants (lp, ebbi);
 
       if (optimize.loopInduction)
 
       if (optimize.loopInduction)
-       change += loopInduction (lp, ebbi);
+        change += loopInduction (lp, ebbi);
     }
 
   return change;
     }
 
   return change;
index 1adb1461301fca7b0cd207fdcd76ca8d114830fb..d5b3965011e2e1fb8df77bf7699b15dd273e0328 100644 (file)
@@ -58,6 +58,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp)
   operand *left;
   operand *right;
   symbol *func = NULL;
   operand *left;
   operand *right;
   symbol *func = NULL;
+  char *filename = ic->filename;
   int lineno = ic->lineno;
   int bytesPushed=0;
 
   int lineno = ic->lineno;
   int bytesPushed=0;
 
@@ -162,6 +163,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp)
         }
 
       addiCodeToeBBlock (ebp, newic, ip);
         }
 
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
       if (IS_SYMOP (left))
           OP_USES (left) = bitVectSetBit (OP_USES (left), newic->key);
       newic->lineno = lineno;
       if (IS_SYMOP (left))
           OP_USES (left) = bitVectSetBit (OP_USES (left), newic->key);
@@ -178,6 +180,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp)
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type)->next);
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type)->next);
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
       if (IS_SYMOP (right))
           OP_USES (right) = bitVectSetBit (OP_USES (right), newic->key);
       newic->lineno = lineno;
       if (IS_SYMOP (right))
           OP_USES (right) = bitVectSetBit (OP_USES (right), newic->key);
@@ -200,6 +203,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp)
         }
 
       addiCodeToeBBlock (ebp, newic, ip);
         }
 
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
       if (IS_SYMOP (right))
           OP_USES (right) = bitVectSetBit (OP_USES (right), newic->key);
       newic->lineno = lineno;
       if (IS_SYMOP (right))
           OP_USES (right) = bitVectSetBit (OP_USES (right), newic->key);
@@ -217,6 +221,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp)
           bytesPushed += getSize(operandType(left));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           bytesPushed += getSize(operandType(left));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
       if (IS_SYMOP (left))
           OP_USES (left) = bitVectSetBit (OP_USES (left), newic->key);
       newic->lineno = lineno;
       if (IS_SYMOP (left))
           OP_USES (left) = bitVectSetBit (OP_USES (left), newic->key);
@@ -227,6 +232,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp)
   IC_RESULT (newic) = IC_RESULT (ic);
   bitVectUnSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
   OP_USES (IC_RESULT (newic)) = bitVectSetBit (OP_USES (IC_RESULT (newic)), newic->key);
   IC_RESULT (newic) = IC_RESULT (ic);
   bitVectUnSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
   OP_USES (IC_RESULT (newic)) = bitVectSetBit (OP_USES (IC_RESULT (newic)), newic->key);
+  newic->filename = filename;
   newic->lineno = lineno;
   newic->parmBytes += bytesPushed;
   ebp->hasFcall = 1;
   newic->lineno = lineno;
   newic->parmBytes += bytesPushed;
   ebp->hasFcall = 1;
@@ -301,6 +307,7 @@ found:
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = linenno;
 
     }
       newic->lineno = linenno;
 
     }
@@ -318,8 +325,8 @@ found:
         bytesPushed += getSize(operandType(IC_RIGHT(ic)));
       }
       addiCodeToeBBlock (ebp, newic, ip);
         bytesPushed += getSize(operandType(IC_RIGHT(ic)));
       }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = linenno;
       newic->lineno = linenno;
-
     }
 
   /* make the call */
     }
 
   /* make the call */
@@ -344,6 +351,7 @@ found:
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
+  newic->filename = filename;
   newic->lineno = linenno;
 }
 
   newic->lineno = linenno;
 }
 
@@ -393,6 +401,7 @@ found:
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = linenno;
 
     }
       newic->lineno = linenno;
 
     }
@@ -410,8 +419,8 @@ found:
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = linenno;
       newic->lineno = linenno;
-
     }
 
   /* make the call */
     }
 
   /* make the call */
@@ -436,6 +445,7 @@ found:
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
+  newic->filename = filename;
   newic->lineno = linenno;
 }
 
   newic->lineno = linenno;
 }
 
@@ -448,6 +458,7 @@ cnvFromFloatCast (iCode * ic, eBBlock * ebp)
   iCode *ip, *newic;
   symbol *func = NULL;
   sym_link *type = operandType (IC_LEFT (ic));
   iCode *ip, *newic;
   symbol *func = NULL;
   sym_link *type = operandType (IC_LEFT (ic));
+  char *filename = ic->filename;
   int lineno = ic->lineno;
   int bwd, su;
   int bytesPushed=0;
   int lineno = ic->lineno;
   int bwd, su;
   int bytesPushed=0;
@@ -485,6 +496,7 @@ found:
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
 
     }
       newic->lineno = lineno;
 
     }
@@ -503,6 +515,7 @@ found:
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
 
     }
       newic->lineno = lineno;
 
     }
@@ -529,6 +542,7 @@ found:
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
+  newic->filename = filename;
   newic->lineno = lineno;
 }
 
   newic->lineno = lineno;
 }
 
@@ -541,6 +555,7 @@ cnvFromFixed16x16Cast (iCode * ic, eBBlock * ebp)
   iCode *ip, *newic;
   symbol *func = NULL;
   sym_link *type = operandType (IC_LEFT (ic));
   iCode *ip, *newic;
   symbol *func = NULL;
   sym_link *type = operandType (IC_LEFT (ic));
+  char *filename = ic->filename;
   int lineno = ic->lineno;
   int bwd, su;
   int bytesPushed=0;
   int lineno = ic->lineno;
   int bwd, su;
   int bytesPushed=0;
@@ -585,8 +600,8 @@ found:
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
       newic->lineno = lineno;
-
     }
   else
     {
     }
   else
     {
@@ -603,8 +618,8 @@ found:
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
       newic->lineno = lineno;
-
     }
 
   /* make the call */
     }
 
   /* make the call */
@@ -629,6 +644,7 @@ found:
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
   }
 
   addiCodeToeBBlock (ebp, newic, ip);
+  newic->filename = filename;
   newic->lineno = lineno;
 }
 
   newic->lineno = lineno;
 }
 
@@ -643,6 +659,7 @@ convilong (iCode * ic, eBBlock * ebp, sym_link * type, int op)
   symbol *func = NULL;
   iCode *ip = ic->next;
   iCode *newic;
   symbol *func = NULL;
   iCode *ip = ic->next;
   iCode *newic;
+  char *filename = ic->filename;
   int lineno = ic->lineno;
   int bwd;
   int su;
   int lineno = ic->lineno;
   int bwd;
   int su;
@@ -693,6 +710,7 @@ found:
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
 
       /* second one */
       newic->lineno = lineno;
 
       /* second one */
@@ -706,6 +724,7 @@ found:
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type)->next);
         }
       addiCodeToeBBlock (ebp, newic, ip);
           IC_RESULT (newic) = operandFromValue (FUNC_ARGS(func->type)->next);
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
 
     }
       newic->lineno = lineno;
 
     }
@@ -726,6 +745,7 @@ found:
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           bytesPushed += getSize(operandType(IC_RIGHT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
 
       /* insert push left */
       newic->lineno = lineno;
 
       /* insert push left */
@@ -742,6 +762,7 @@ found:
           bytesPushed += getSize(operandType(IC_LEFT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
           bytesPushed += getSize(operandType(IC_LEFT(ic)));
         }
       addiCodeToeBBlock (ebp, newic, ip);
+      newic->filename = filename;
       newic->lineno = lineno;
 
     }
       newic->lineno = lineno;
 
     }
@@ -749,6 +770,7 @@ found:
   /* for the result */
   newic = newiCode (CALL, operandFromSymbol (func), NULL);
   IC_RESULT (newic) = IC_RESULT (ic);
   /* for the result */
   newic = newiCode (CALL, operandFromSymbol (func), NULL);
   IC_RESULT (newic) = IC_RESULT (ic);
+  newic->filename = filename;
   newic->lineno = lineno;
   newic->parmBytes+=bytesPushed; // to clear the stack after the call
   ebp->hasFcall = 1;
   newic->lineno = lineno;
   newic->parmBytes+=bytesPushed; // to clear the stack after the call
   ebp->hasFcall = 1;
index 88fa5470d8b09f3bc3a55ec53689e2e76f7d2f7e..9a1b2537c6bc9b80520fc6ccf738f936e1c3a1fb 100644 (file)
@@ -57,8 +57,8 @@ newiList (int type, void *ilist)
   nilist = Safe_alloc (sizeof (initList));
 
   nilist->type = type;
   nilist = Safe_alloc (sizeof (initList));
 
   nilist->type = type;
-  nilist->lineno = lexLineno;
   nilist->filename = lexFilename;
   nilist->filename = lexFilename;
+  nilist->lineno = lexLineno;
 
   switch (type)
     {
 
   switch (type)
     {
index d2a25e369b563b5a0830ba6953ba21520525eb83..63ee1c71c37bd65376759e9f348439ddb0ef18f1 100644 (file)
@@ -360,7 +360,7 @@ pic16emitRegularMap (memmap * map, bool addPublics, bool arFlag)
                         }
 
                         if(ival) {
                         }
 
                         if(ival) {
-                                setAstLineno(ival, sym->lineDef);
+                                setAstFileLine (ival, sym->fileDef, sym->lineDef);
                                 codeOutBuf = &statsg->oBuf;
                                 GcurMemmap = statsg;
                                 eBBlockFromiCode (iCodeFromAst (ival));
                                 codeOutBuf = &statsg->oBuf;
                                 GcurMemmap = statsg;
                                 eBBlockFromiCode (iCodeFromAst (ival));