Minor ds390 performance enhancement on generic pointer reads
[fw/sdcc] / src / asm.c
index 66e8d20195a34280569778f7b7d277b99ef9379f..d31b0ea154e871dc96b071ae33243d187be0c732 100644 (file)
--- a/src/asm.c
+++ b/src/asm.c
@@ -130,7 +130,7 @@ tvsprintf (char *buffer, const char *format, va_list ap)
              break;
            case 'F':
              // Source file name.
-             pInto = _appendAt (pInto, newFormat, srcFileName);
+             pInto = _appendAt (pInto, newFormat, fullSrcFileName);
               sz++;
              break;
             case 'N':
@@ -209,16 +209,26 @@ asm_addTree (const ASM_MAPPINGS * pMappings)
 static FILE *inFile=NULL;
 static char inLineString[1024];
 static int inLineNo=0;
+static char lastSrcFile[PATH_MAX];
 int rewinds=0;
 
 char *printCLine (char *srcFile, int lineno) {
   char *ilsP=inLineString;
+
+  if (inFile) {
+    if (strcmp (lastSrcFile, srcFile) != 0) {
+      fclose (inFile);
+      inFile = NULL;
+      inLineNo = 0;
+    }
+  }
   if (!inFile) {
     inFile=fopen(srcFile, "r");
     if (!inFile) {
       perror ("printCLine");
       exit (1);
     }
+    strcpy (lastSrcFile, srcFile);
   }
   if (lineno<inLineNo) {
     fseek (inFile, 0, SEEK_SET);
@@ -402,14 +412,14 @@ static const ASM_MAPPING _xa_asm_mapping[] =
   {"dbs", ".db \"%s\""},
   {"dw", ".dw"},
   {"dws", ".dw %s"},
-  {"constbyte", "0%02xh"},
-  {"constword", "0%04xh"},
-  {"immedword", "#0%04Xh"},
-  {"immedbyte", "#0%02Xh"},
+  {"constbyte", "0x%02x"},
+  {"constword", "0x%04x"},
+  {"immedword", "0x%04x"},
+  {"immedbyte", "0x%02x"},
   {"hashedstr", "#%s"},
   {"lsbimmeds", "#<%s"},
   {"msbimmeds", "#>%s"},
-  {"module", ".module %s"},
+  {"module", ".module %s"},
   {"global", ".globl %s"},
   {"fileprelude", ""},
   {"functionheader",