* src/SDCC.lex (doPragma): added pragma disable_warning <nnn>
authormaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 27 Jul 2004 20:30:32 +0000 (20:30 +0000)
committermaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 27 Jul 2004 20:30:32 +0000 (20:30 +0000)
* src/SDCCmain.c (parseCmdLine): added option --disable-warning <nnn>
* src/ds390/gen.c (genPlusIncr): fixed bug when incrementing generic pointers
* support/Util/SDCCerr.c (vwerror): suppress disabled warnings and output
  error/warning numbers,
  added function setWarningDisabled()
* support/Util/SDCCerr.h: added setWarningDisabled() and MAX_ERROR_WARNING
* support/regression/ports/mcs51-stack-auto/spec.mk: added dependencies
  _memcmp.c _memmove.c calloc.c realloc.c free.c
* support/regression/tests/malloc.c: added tests for new functionality
* support/regression/tests/zeropad.c: added tests for truncated initializers
  and initialized char arrays starting with '\\x0'
* src/mcs51/peeph.def: fixed regression, added peephole 177.f

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

12 files changed:
ChangeLog
src/SDCC.lex
src/SDCCmain.c
src/ds390/gen.c
src/ds390/main.c
src/ds390/ralloc.c
src/mcs51/peeph.def
support/Util/SDCCerr.c
support/Util/SDCCerr.h
support/regression/ports/mcs51-stack-auto/spec.mk
support/regression/tests/malloc.c
support/regression/tests/zeropad.c

index 53a488801485a42d925364ec736972e4119a1b97..a699d7e29c704bd6b1a619da0390516f89223626 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2004-07-27 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * added lib/calloc.c, lib/free.c, lib/realloc.c, include/stddef.h
+       * updated lib/malloc.c, lib/libsdcc.lib, lib/Makefile.in, include/malloc.h
+       * src/SDCC.lex (doPragma): added pragma disable_warning <nnn>
+       * src/SDCCmain.c (parseCmdLine): added option --disable-warning <nnn>
+       * src/ds390/gen.c (genPlusIncr): fixed bug when incrementing generic pointers
+       * support/Util/SDCCerr.c (vwerror): suppress disabled warnings and output
+         error/warning numbers,
+         added function setWarningDisabled()
+       * support/Util/SDCCerr.h: added setWarningDisabled() and MAX_ERROR_WARNING
+       * support/regression/ports/mcs51-stack-auto/spec.mk: added dependencies
+         _memcmp.c _memmove.c calloc.c realloc.c free.c
+       * support/regression/tests/malloc.c: added tests for new functionality
+       * support/regression/tests/zeropad.c: added tests for truncated initializers
+         and initialized char arrays starting with '\x0'
+       * src/mcs51/peeph.def: fixed regression, added peephole 177.f
+
 2004-07-26 Bernhard Held <bernhard AT bernhardheld.de>
 
        * support/valdiag/tests/overflow.c: fixed warning on (1 >> 40)
 2004-07-26 Bernhard Held <bernhard AT bernhardheld.de>
 
        * support/valdiag/tests/overflow.c: fixed warning on (1 >> 40)
@@ -5,7 +23,7 @@
 2004-07-26 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * doc/sdccman.lyx: updated example in section "Absolute Addressing"
 2004-07-26 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * doc/sdccman.lyx: updated example in section "Absolute Addressing"
-       * src/mcs51/peeph.def: added contributed fix for "bug" #995347 as 
+       * src/mcs51/peeph.def: added contributed fix for "bug" #995347 as
        peephole 177.e. Thanks to anonymous
 
 2004-07-25 Vangelis Rokas <vrokas AT otenet.gr>
        peephole 177.e. Thanks to anonymous
 
 2004-07-25 Vangelis Rokas <vrokas AT otenet.gr>
index 7f64c9768f10698a667e50bfcae03054f6117145..5f05a2a8ce6ce42257ba2f0e8141eb7bc9c7139b 100644 (file)
@@ -414,8 +414,9 @@ enum pragma_id {
      P_EXCLUDE,
      P_NOIV,
      P_LOOPREV,
      P_EXCLUDE,
      P_NOIV,
      P_LOOPREV,
-     P_OVERLAY_      /* I had a strange conflict with P_OVERLAY while */
+     P_OVERLAY_,     /* I had a strange conflict with P_OVERLAY while */
                      /* cross-compiling for MINGW32 with gcc 3.2 */
                      /* cross-compiling for MINGW32 with gcc 3.2 */
+     P_DISABLEWARN
 };
 
 
 };
 
 
@@ -484,6 +485,8 @@ static void copyAndFreeOptimize(struct optimize *dest, struct optimize *src)
 
 static void doPragma(int op, char *cp)
 {
 
 static void doPragma(int op, char *cp)
 {
+  int i;
+
   switch (op) {
   case P_SAVE:
     {
   switch (op) {
   case P_SAVE:
     {
@@ -560,6 +563,13 @@ static void doPragma(int op, char *cp)
 
   case P_OVERLAY_:
     break; /* notyet */
 
   case P_OVERLAY_:
     break; /* notyet */
+
+  case P_DISABLEWARN:
+    if (sscanf(cp, "%d", &i) && (i<MAX_ERROR_WARNING))
+      {
+        setWarningDisabled(i);
+      }
+    break;
   }
 }
 
   }
 }
 
@@ -590,6 +600,7 @@ static int process_pragma(char *s)
     { "noiv",           P_NOIV,         0 },
     { "overlay",        P_OVERLAY_,     0 },
     { "less_pedantic",  P_LESSPEDANTIC, 0 },
     { "noiv",           P_NOIV,         0 },
     { "overlay",        P_OVERLAY_,     0 },
     { "less_pedantic",  P_LESSPEDANTIC, 0 },
+    { "disable_warning",P_DISABLEWARN,  0 },
 
     /*
      * The following lines are deprecated pragmas,
 
     /*
      * The following lines are deprecated pragmas,
index 4fef51b961e975bc47ba310f287e30ffcbeda982..784f2913ced4504c09b9e25911367bb08c9a8df5 100644 (file)
 /* REMOVE ME!!! */
 extern int yyparse (void);
 
 /* REMOVE ME!!! */
 extern int yyparse (void);
 
-FILE *srcFile;                 /* source file          */
-char *fullSrcFileName;         /* full name for the source file; */
-                               /* can be NULL while c1mode or linking without compiling */
-char *fullDstFileName;         /* full name for the output file; */
-                               /* only given by -o, otherwise NULL */
-char *dstFileName;             /* destination file name without extension */
-char *dstPath = "";            /* path for the output files; */
-                               /* "" is equivalent with cwd */
-char *moduleNameBase;          /* module name base is source file without path and extension */
+FILE *srcFile;                  /* source file          */
+char *fullSrcFileName;          /* full name for the source file; */
+                                /* can be NULL while c1mode or linking without compiling */
+char *fullDstFileName;          /* full name for the output file; */
+                                /* only given by -o, otherwise NULL */
+char *dstFileName;              /* destination file name without extension */
+char *dstPath = "";             /* path for the output files; */
+                                /* "" is equivalent with cwd */
+char *moduleNameBase;           /* module name base is source file without path and extension */
                                 /* can be NULL while linking without compiling */
                                 /* can be NULL while linking without compiling */
-char *moduleName;              /* module name is same as module name base, but with all */
-                               /* non-alphanumeric characters replaced with underscore */
+char *moduleName;               /* module name is same as module name base, but with all */
+                                /* non-alphanumeric characters replaced with underscore */
 int currRegBank = 0;
 int RegBankUsed[4] = {1, 0, 0, 0}; /*JCF: Reg Bank 0 used by default*/
 struct optimize optimize;
 int currRegBank = 0;
 int RegBankUsed[4] = {1, 0, 0, 0}; /*JCF: Reg Bank 0 used by default*/
 struct optimize optimize;
@@ -89,46 +89,47 @@ int ds390_jammed = 0;
 char scratchFileName[PATH_MAX];
 char buffer[PATH_MAX * 2];
 
 char scratchFileName[PATH_MAX];
 char buffer[PATH_MAX * 2];
 
-#define OPTION_HELP    "-help"
-
-#define LENGTH(_a)     (sizeof(_a)/sizeof(*(_a)))
-
-#define OPTION_STACK_8BIT      "--stack-8bit"
-#define OPTION_OUT_FMT_IHX     "--out-fmt-ihx"
-#define OPTION_LARGE_MODEL     "--model-large"
-#define OPTION_MEDIUM_MODEL    "--model-medium"
-#define OPTION_SMALL_MODEL     "--model-small"
-#define OPTION_FLAT24_MODEL    "--model-flat24"
-#define OPTION_DUMP_ALL                "--dumpall"
-#define OPTION_PEEP_FILE       "--peep-file"
-#define OPTION_LIB_PATH                "--lib-path"
-#define OPTION_XSTACK_LOC      "--xstack-loc"
-#define OPTION_CALLEE_SAVES    "--callee-saves"
-#define OPTION_STACK_LOC       "--stack-loc"
-#define OPTION_XRAM_LOC                "--xram-loc"
-#define OPTION_IRAM_SIZE       "--iram-size"
-#define OPTION_VERSION         "--version"
-#define OPTION_DATA_LOC                "--data-loc"
-#define OPTION_CODE_LOC                "--code-loc"
-#define OPTION_IDATA_LOC       "--idata-loc"
+#define OPTION_HELP     "-help"
+
+#define LENGTH(_a)      (sizeof(_a)/sizeof(*(_a)))
+
+#define OPTION_STACK_8BIT       "--stack-8bit"
+#define OPTION_OUT_FMT_IHX      "--out-fmt-ihx"
+#define OPTION_LARGE_MODEL      "--model-large"
+#define OPTION_MEDIUM_MODEL     "--model-medium"
+#define OPTION_SMALL_MODEL      "--model-small"
+#define OPTION_FLAT24_MODEL     "--model-flat24"
+#define OPTION_DUMP_ALL         "--dumpall"
+#define OPTION_PEEP_FILE        "--peep-file"
+#define OPTION_LIB_PATH         "--lib-path"
+#define OPTION_XSTACK_LOC       "--xstack-loc"
+#define OPTION_CALLEE_SAVES     "--callee-saves"
+#define OPTION_STACK_LOC        "--stack-loc"
+#define OPTION_XRAM_LOC         "--xram-loc"
+#define OPTION_IRAM_SIZE        "--iram-size"
+#define OPTION_VERSION          "--version"
+#define OPTION_DATA_LOC         "--data-loc"
+#define OPTION_CODE_LOC         "--code-loc"
+#define OPTION_IDATA_LOC        "--idata-loc"
 #define OPTION_NO_LABEL_OPT     "--nolabelopt"
 #define OPTION_NO_LABEL_OPT     "--nolabelopt"
-#define OPTION_NO_LOOP_INV     "--noinvariant"
-#define OPTION_NO_LOOP_IND     "--noinduction"
-#define OPTION_LESS_PEDANTIC   "--less-pedantic"
-#define OPTION_NO_GCSE         "--nogcse"
-#define OPTION_SHORT_IS_8BITS  "--short-is-8bits"
-#define OPTION_TINI_LIBID      "--tini-libid"
+#define OPTION_NO_LOOP_INV      "--noinvariant"
+#define OPTION_NO_LOOP_IND      "--noinduction"
+#define OPTION_LESS_PEDANTIC    "--less-pedantic"
+#define OPTION_DISABLE_WARNING  "--disable-warning"
+#define OPTION_NO_GCSE          "--nogcse"
+#define OPTION_SHORT_IS_8BITS   "--short-is-8bits"
+#define OPTION_TINI_LIBID       "--tini-libid"
 #define OPTION_NO_XINIT_OPT     "--no-xinit-opt"
 #define OPTION_NO_XINIT_OPT     "--no-xinit-opt"
-#define OPTION_XRAM_SIZE       "--xram-size"
-#define OPTION_CODE_SIZE       "--code-size"
-#define OPTION_NO_CCODE_IN_ASM "--no-c-code-in-asm"
-#define OPTION_ICODE_IN_ASM    "--i-code-in-asm"
+#define OPTION_XRAM_SIZE        "--xram-size"
+#define OPTION_CODE_SIZE        "--code-size"
+#define OPTION_NO_CCODE_IN_ASM  "--no-c-code-in-asm"
+#define OPTION_ICODE_IN_ASM     "--i-code-in-asm"
 #define OPTION_PRINT_SEARCH_DIRS "--print-search-dirs"
 #define OPTION_MSVC_ERROR_STYLE "--vc"
 #define OPTION_USE_STDOUT       "--use-stdout"
 #define OPTION_PRINT_SEARCH_DIRS "--print-search-dirs"
 #define OPTION_MSVC_ERROR_STYLE "--vc"
 #define OPTION_USE_STDOUT       "--use-stdout"
-#define OPTION_STACK_SIZE      "--stack-size"
-#define OPTION_PACK_IRAM       "--pack-iram"
-#define OPTION_NO_PEEP_COMMENTS        "--no-peep-comments"
+#define OPTION_STACK_SIZE       "--stack-size"
+#define OPTION_PACK_IRAM        "--pack-iram"
+#define OPTION_NO_PEEP_COMMENTS "--no-peep-comments"
 
 static const OPTION
 optionsTable[] = {
 
 static const OPTION
 optionsTable[] = {
@@ -207,24 +208,25 @@ optionsTable[] = {
     { 0,    "--nostdinc",           &options.nostdinc, "Do not include the standard include directory in the search path" },
     { 0,    "--verbose",            &options.verbose, "Trace calls to the preprocessor, assembler, and linker" },
     { 0,    OPTION_LESS_PEDANTIC,   NULL, "Disable some of the more pedantic warnings" },
     { 0,    "--nostdinc",           &options.nostdinc, "Do not include the standard include directory in the search path" },
     { 0,    "--verbose",            &options.verbose, "Trace calls to the preprocessor, assembler, and linker" },
     { 0,    OPTION_LESS_PEDANTIC,   NULL, "Disable some of the more pedantic warnings" },
-    { 0,    OPTION_SHORT_IS_8BITS,   NULL, "Make short 8bits (for old times sake)" },
+    { 0,    OPTION_DISABLE_WARNING, NULL, "<nnnn> Disable specific warning" },
+    { 0,    OPTION_SHORT_IS_8BITS,  NULL, "Make short 8bits (for old times sake)" },
     { 0,    "--profile",            &options.profile, "On supported ports, generate extra profiling information" },
     { 0,    "--fommit-frame-pointer", &options.ommitFramePtr, "Leave out the frame pointer." },
     { 0,    "--all-callee-saves",   &options.all_callee_saves, "callee will always save registers used" },
 #if !OPT_DISABLE_DS390
     { 0,    "--use-accelerator",    &options.useAccelerator,"generate code for  DS390 Arithmetic Accelerator"},
 #endif
     { 0,    "--profile",            &options.profile, "On supported ports, generate extra profiling information" },
     { 0,    "--fommit-frame-pointer", &options.ommitFramePtr, "Leave out the frame pointer." },
     { 0,    "--all-callee-saves",   &options.all_callee_saves, "callee will always save registers used" },
 #if !OPT_DISABLE_DS390
     { 0,    "--use-accelerator",    &options.useAccelerator,"generate code for  DS390 Arithmetic Accelerator"},
 #endif
-    { 0,    "--stack-probe",               &options.stack_probe,"insert call to function __stack_probe at each function prologue"},
+    { 0,    "--stack-probe",        &options.stack_probe,"insert call to function __stack_probe at each function prologue"},
 #if !OPT_DISABLE_TININative
 #if !OPT_DISABLE_TININative
-    { 0,    "--tini-libid",        NULL,"<nnnn> LibraryID used in -mTININative"},
+    { 0,    "--tini-libid",         NULL,"<nnnn> LibraryID used in -mTININative"},
 #endif
 #if !OPT_DISABLE_DS390
     { 0,    "--protect-sp-update",  &options.protect_sp_update,"DS390 - will disable interrupts during ESP:SP updates"},
 #endif
 #if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51
 #endif
 #if !OPT_DISABLE_DS390
     { 0,    "--protect-sp-update",  &options.protect_sp_update,"DS390 - will disable interrupts during ESP:SP updates"},
 #endif
 #if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51
-    { 0,    "--parms-in-bank1",            &options.parms_in_bank1,"MCS51/DS390 - use Bank1 for parameter passing"},
-    { 0,    OPTION_STACK_SIZE,     NULL,"MCS51/DS390 - Tells the linker to allocate this space for stack"},
-    { 0,    OPTION_PACK_IRAM,      &options.pack_iram,"MCS51/DS390 - Tells the linker to pack variables in internal ram"},
+    { 0,    "--parms-in-bank1",     &options.parms_in_bank1,"MCS51/DS390 - use Bank1 for parameter passing"},
+    { 0,    OPTION_STACK_SIZE,      NULL,"MCS51/DS390 - Tells the linker to allocate this space for stack"},
+    { 0,    OPTION_PACK_IRAM,       &options.pack_iram,"MCS51/DS390 - Tells the linker to pack variables in internal ram"},
 #endif
     { 0,    OPTION_NO_XINIT_OPT,    &options.noXinitOpt, "don't memcpy initialized xram from code"},
     { 0,    OPTION_NO_CCODE_IN_ASM, &options.noCcodeInAsm, "don't include c-code as comments in the asm file"},
 #endif
     { 0,    OPTION_NO_XINIT_OPT,    &options.noXinitOpt, "don't memcpy initialized xram from code"},
     { 0,    OPTION_NO_CCODE_IN_ASM, &options.noCcodeInAsm, "don't include c-code as comments in the asm file"},
@@ -253,14 +255,14 @@ typedef struct {
     const char *message;
 } UNSUPPORTEDOPT;
 
     const char *message;
 } UNSUPPORTEDOPT;
 
-static const UNSUPPORTEDOPT 
+static const UNSUPPORTEDOPT
 unsupportedOptTable[] = {
 unsupportedOptTable[] = {
-    { 'X',  NULL,      "use --xstack-loc instead" },
-    { 'x',  NULL,      "use --xstack instead" },
-    { 'i',  NULL,      "use --idata-loc instead" },
-    { 'r',  NULL,      "use --xdata-loc instead" },
-    { 's',  NULL,      "use --code-loc instead" },
-    { 'Y',  NULL,      "use -I instead" }
+    { 'X',  NULL,       "use --xstack-loc instead" },
+    { 'x',  NULL,       "use --xstack instead" },
+    { 'i',  NULL,       "use --idata-loc instead" },
+    { 'r',  NULL,       "use --xdata-loc instead" },
+    { 's',  NULL,       "use --code-loc instead" },
+    { 'Y',  NULL,       "use -I instead" }
 };
 
 /** List of all default constant macros.
 };
 
 /** List of all default constant macros.
@@ -307,7 +309,7 @@ static PORT *_ports[] =
   &xa51_port,
 #endif
 #if !OPT_DISABLE_DS400
   &xa51_port,
 #endif
 #if !OPT_DISABLE_DS400
-  &ds400_port, 
+  &ds400_port,
 #endif
 #if !OPT_DISABLE_HC08
   &hc08_port,
 #endif
 #if !OPT_DISABLE_HC08
   &hc08_port,
@@ -327,17 +329,17 @@ _setPort (const char *name)
   for (i = 0; i < NUM_PORTS; i++)
     {
       if (!strcmp (_ports[i]->target, name))
   for (i = 0; i < NUM_PORTS; i++)
     {
       if (!strcmp (_ports[i]->target, name))
-       {
-         port = _ports[i];
-         return;
-       }
+        {
+          port = _ports[i];
+          return;
+        }
     }
   /* Error - didnt find */
   werror (E_UNKNOWN_TARGET, name);
   exit (1);
 }
 
     }
   /* Error - didnt find */
   werror (E_UNKNOWN_TARGET, name);
   exit (1);
 }
 
-/* Override the default processor with the one specified 
+/* Override the default processor with the one specified
  * on the command line */
 static void
 _setProcessor (char *_processor)
  * on the command line */
 static void
 _setProcessor (char *_processor)
@@ -353,13 +355,13 @@ _validatePorts (void)
   for (i = 0; i < NUM_PORTS; i++)
     {
       if (_ports[i]->magic != PORT_MAGIC)
   for (i = 0; i < NUM_PORTS; i++)
     {
       if (_ports[i]->magic != PORT_MAGIC)
-       {
-         /* Uncomment this line to debug which port is causing the problem
-          * (the target name is close to the beginning of the port struct 
-          * and probably can be accessed just fine). */
-         fprintf(stderr,"%s :",_ports[i]->target);
-         wassertl (0, "Port definition structure is incomplete");
-       }
+        {
+          /* Uncomment this line to debug which port is causing the problem
+           * (the target name is close to the beginning of the port struct
+           * and probably can be accessed just fine). */
+          fprintf(stderr,"%s :",_ports[i]->target);
+          wassertl (0, "Port definition structure is incomplete");
+        }
     }
 }
 
     }
 }
 
@@ -372,15 +374,15 @@ _findPort (int argc, char **argv)
   while (argc--)
     {
       if (!strncmp (*argv, "-m", 2))
   while (argc--)
     {
       if (!strncmp (*argv, "-m", 2))
-       {
-         _setPort (*argv + 2);
-         return;
-       }
+        {
+          _setPort (*argv + 2);
+          return;
+        }
       argv++;
     }
 
   /* Use the first in the list */
       argv++;
     }
 
   /* Use the first in the list */
-       port = _ports[0];
+        port = _ports[0];
 }
 
 /* search through the command line options for the processor */
 }
 
 /* search through the command line options for the processor */
@@ -390,17 +392,16 @@ _findProcessor (int argc, char **argv)
   while (argc--)
     {
       if (!strncmp (*argv, "-p", 2))
   while (argc--)
     {
       if (!strncmp (*argv, "-p", 2))
-       {
-         _setProcessor (*argv + 2);
-         return;
-       }
+        {
+          _setProcessor (*argv + 2);
+          return;
+        }
       argv++;
     }
 
   /* no error if processor was not specified. */
 }
 
       argv++;
     }
 
   /* no error if processor was not specified. */
 }
 
-
 /*-----------------------------------------------------------------*/
 /* printVersionInfo - prints the version info        */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* printVersionInfo - prints the version info        */
 /*-----------------------------------------------------------------*/
@@ -410,27 +411,27 @@ printVersionInfo (void)
   int i;
 
   fprintf (stderr,
   int i;
 
   fprintf (stderr,
-          "SDCC : ");
+           "SDCC : ");
   for (i = 0; i < NUM_PORTS; i++)
     fprintf (stderr, "%s%s", i == 0 ? "" : "/", _ports[i]->target);
   for (i = 0; i < NUM_PORTS; i++)
     fprintf (stderr, "%s%s", i == 0 ? "" : "/", _ports[i]->target);
-  
+
   fprintf (stderr, " " SDCC_VERSION_STR
 #ifdef SDCC_SUB_VERSION_STR
   fprintf (stderr, " " SDCC_VERSION_STR
 #ifdef SDCC_SUB_VERSION_STR
-          "/" SDCC_SUB_VERSION_STR
+           "/" SDCC_SUB_VERSION_STR
 #endif
            " #%s (" __DATE__ ")"
 #ifdef __CYGWIN__
 #endif
            " #%s (" __DATE__ ")"
 #ifdef __CYGWIN__
-          " (CYGWIN)\n"
+           " (CYGWIN)\n"
 #elif defined __MINGW32__
 #elif defined __MINGW32__
-          " (MINGW32)\n"
+           " (MINGW32)\n"
 #elif defined __DJGPP__
 #elif defined __DJGPP__
-          " (DJGPP)\n"
+           " (DJGPP)\n"
 #elif defined(_MSC_VER)
 #elif defined(_MSC_VER)
-          " (MSVC)\n"
+           " (MSVC)\n"
 #elif defined(__BORLANDC__)
 #elif defined(__BORLANDC__)
-          " (BORLANDC)\n"
+           " (BORLANDC)\n"
 #else
 #else
-          " (UNIX) \n"
+           " (UNIX) \n"
 #endif
     , getBuildNumber() );
 }
 #endif
     , getBuildNumber() );
 }
@@ -439,14 +440,14 @@ static void
 printOptions(const OPTION *optionsTable)
 {
   int i;
 printOptions(const OPTION *optionsTable)
 {
   int i;
-  for (i = 0; optionsTable[i].shortOpt != 0 || optionsTable[i].longOpt != NULL; i++) 
+  for (i = 0; optionsTable[i].shortOpt != 0 || optionsTable[i].longOpt != NULL; i++)
     {
     {
-      fprintf(stdout, "  %c%c  %-20s  %s\n", 
-             optionsTable[i].shortOpt !=0 ? '-' : ' ',
-             optionsTable[i].shortOpt !=0 ? optionsTable[i].shortOpt : ' ',
-             optionsTable[i].longOpt != NULL ? optionsTable[i].longOpt : "",
-             optionsTable[i].help != NULL ? optionsTable[i].help : ""
-             );
+      fprintf(stdout, "  %c%c  %-20s  %s\n",
+              optionsTable[i].shortOpt !=0 ? '-' : ' ',
+              optionsTable[i].shortOpt !=0 ? optionsTable[i].shortOpt : ' ',
+              optionsTable[i].longOpt != NULL ? optionsTable[i].longOpt : "",
+              optionsTable[i].help != NULL ? optionsTable[i].help : ""
+              );
     }
 }
 
     }
 }
 
@@ -467,11 +468,11 @@ printUsage (void)
 
     for (i = 0; i < NUM_PORTS; i++)
       {
 
     for (i = 0; i < NUM_PORTS; i++)
       {
-       if (_ports[i]->poptions != NULL)
-         {
-           fprintf (stdout, "\nSpecial options for the %s port:\n", _ports[i]->target);
-           printOptions (_ports[i]->poptions);
-         }
+        if (_ports[i]->poptions != NULL)
+          {
+            fprintf (stdout, "\nSpecial options for the %s port:\n", _ports[i]->target);
+            printOptions (_ports[i]->poptions);
+          }
       }
 
     exit (0);
       }
 
     exit (0);
@@ -489,7 +490,7 @@ setParseWithComma (set **dest, char *src)
   /* skip the initial white spaces */
   while (isspace(*src))
     src++;
   /* skip the initial white spaces */
   while (isspace(*src))
     src++;
-  
+
   /* skip the trailing white spaces */
   length = strlen(src);
   while (length && isspace(src[length-1]))
   /* skip the trailing white spaces */
   length = strlen(src);
   while (length && isspace(src[length-1]))
@@ -506,10 +507,10 @@ static void
 setDefaultOptions (void)
 {
   /* first the options part */
 setDefaultOptions (void)
 {
   /* first the options part */
-  options.stack_loc = 0;       /* stack pointer initialised to 0 */
-  options.xstack_loc = 0;      /* xternal stack starts at 0 */
-  options.code_loc = 0;                /* code starts at 0 */
-  options.data_loc = 0;                /* JCF: By default let the linker locate data */
+  options.stack_loc = 0;        /* stack pointer initialised to 0 */
+  options.xstack_loc = 0;       /* xternal stack starts at 0 */
+  options.code_loc = 0;         /* code starts at 0 */
+  options.data_loc = 0;         /* JCF: By default let the linker locate data */
   options.xdata_loc = 0;
   options.idata_loc = 0x80;
   options.nopeep = 0;
   options.xdata_loc = 0;
   options.idata_loc = 0x80;
   options.nopeep = 0;
@@ -562,18 +563,18 @@ processFile (char *s)
       /* source file name : not if we already have a
          source file */
       if (fullSrcFileName)
       /* source file name : not if we already have a
          source file */
       if (fullSrcFileName)
-       {
-         werror (W_TOO_MANY_SRC, s);
-         return;
-       }
+        {
+          werror (W_TOO_MANY_SRC, s);
+          return;
+        }
 
       /* the only source file */
       fullSrcFileName = s;
       if (!(srcFile = fopen (fullSrcFileName, "r")))
 
       /* the only source file */
       fullSrcFileName = s;
       if (!(srcFile = fopen (fullSrcFileName, "r")))
-       {
-         werror (E_FILE_OPEN_ERR, s);
-         exit (1);
-       }
+        {
+          werror (E_FILE_OPEN_ERR, s);
+          exit (1);
+        }
 
       /* copy the file name into the buffer */
       strncpyz (buffer, s, sizeof(buffer));
 
       /* copy the file name into the buffer */
       strncpyz (buffer, s, sizeof(buffer));
@@ -595,26 +596,26 @@ processFile (char *s)
       /* do this by going backwards till we
          get '\' or ':' or start of buffer */
       while (fext != buffer &&
       /* do this by going backwards till we
          get '\' or ':' or start of buffer */
       while (fext != buffer &&
-            *(fext - 1) != DIR_SEPARATOR_CHAR &&
-            *(fext - 1) != ':')
+             *(fext - 1) != DIR_SEPARATOR_CHAR &&
+             *(fext - 1) != ':')
         {
         {
-       fext--;
+        fext--;
         }
 #else
       /* do this by going backwards till we
          get '/' or start of buffer */
       while (fext != buffer &&
         }
 #else
       /* do this by going backwards till we
          get '/' or start of buffer */
       while (fext != buffer &&
-            *(fext - 1) != DIR_SEPARATOR_CHAR)
+             *(fext - 1) != DIR_SEPARATOR_CHAR)
         {
           fext--;
         }
 #endif
       moduleNameBase = Safe_strdup ( fext );
       moduleName = Safe_strdup ( fext );
         {
           fext--;
         }
 #endif
       moduleNameBase = Safe_strdup ( fext );
       moduleName = Safe_strdup ( fext );
-      
+
       for (fext = moduleName; *fext; fext++)
         if (!isalnum (*fext))
       for (fext = moduleName; *fext; fext++)
         if (!isalnum (*fext))
-         *fext = '_';
+          *fext = '_';
       return;
     }
 
       return;
     }
 
@@ -680,7 +681,7 @@ getStringArg(const char *szStart, char **argv, int *pi, int argc)
 int
 getIntArg(const char *szStart, char **argv, int *pi, int argc)
 {
 int
 getIntArg(const char *szStart, char **argv, int *pi, int argc)
 {
-    return (int)floatFromVal(constVal(getStringArg(szStart, argv, pi, argc)));
+  return (int)floatFromVal(constVal(getStringArg(szStart, argv, pi, argc)));
 }
 
 static void
 }
 
 static void
@@ -695,31 +696,31 @@ verifyShortOption(const char *opt)
 static bool
 tryHandleUnsupportedOpt(char **argv, int *pi)
 {
 static bool
 tryHandleUnsupportedOpt(char **argv, int *pi)
 {
-    if (argv[*pi][0] == '-') 
+    if (argv[*pi][0] == '-')
         {
             const char *longOpt = "";
             char shortOpt = -1;
             int i;
 
         {
             const char *longOpt = "";
             char shortOpt = -1;
             int i;
 
-            if (argv[*pi][1] == '-') 
+            if (argv[*pi][1] == '-')
                 {
                     /* Long option. */
                     longOpt = argv[*pi];
                 }
                 {
                     /* Long option. */
                     longOpt = argv[*pi];
                 }
-            else 
+            else
                 {
                     shortOpt = argv[*pi][1];
                 }
                 {
                     shortOpt = argv[*pi][1];
                 }
-            for (i = 0; i < LENGTH(unsupportedOptTable); i++) 
+            for (i = 0; i < LENGTH(unsupportedOptTable); i++)
                 {
                 {
-                    if (unsupportedOptTable[i].shortOpt == shortOpt || 
+                    if (unsupportedOptTable[i].shortOpt == shortOpt ||
                         (longOpt && unsupportedOptTable[i].longOpt && !strcmp(unsupportedOptTable[i].longOpt, longOpt))) {
                         /* Found an unsupported opt. */
                         char buffer[100];
                         (longOpt && unsupportedOptTable[i].longOpt && !strcmp(unsupportedOptTable[i].longOpt, longOpt))) {
                         /* Found an unsupported opt. */
                         char buffer[100];
-                        SNPRINTF(buffer, sizeof(buffer), 
-                                "%s%c%c", 
-                                longOpt ? longOpt : "", 
-                                shortOpt ? '-' : ' ', shortOpt ? shortOpt : ' ');
+                        SNPRINTF(buffer, sizeof(buffer),
+                                 "%s%c%c",
+                                 longOpt ? longOpt : "",
+                                 shortOpt ? '-' : ' ', shortOpt ? shortOpt : ' ');
                         werror (W_UNSUPP_OPTION, buffer, unsupportedOptTable[i].message);
                         return 1;
                     }
                         werror (W_UNSUPP_OPTION, buffer, unsupportedOptTable[i].message);
                         return 1;
                     }
@@ -727,7 +728,7 @@ tryHandleUnsupportedOpt(char **argv, int *pi)
             /* Didn't find in the table */
             return 0;
         }
             /* Didn't find in the table */
             return 0;
         }
-    else 
+    else
         {
             /* Not an option, so can't be unsupported :) */
             return 0;
         {
             /* Not an option, so can't be unsupported :) */
             return 0;
@@ -741,26 +742,26 @@ scanOptionsTable(const OPTION *optionsTable, char shortOpt, const char *longOpt,
   for (i = 0; optionsTable[i].shortOpt != 0 || optionsTable[i].longOpt != NULL; i++)
     {
       if (optionsTable[i].shortOpt == shortOpt ||
   for (i = 0; optionsTable[i].shortOpt != 0 || optionsTable[i].longOpt != NULL; i++)
     {
       if (optionsTable[i].shortOpt == shortOpt ||
-         (longOpt && optionsTable[i].longOpt && 
-          strcmp(optionsTable[i].longOpt, longOpt) == 0))
-       {
-
-         /* If it is a flag then we can handle it here */
-         if (optionsTable[i].pparameter != NULL) 
-           {
-             if (optionsTable[i].shortOpt == shortOpt)
-               {
-                 verifyShortOption(argv[*pi]);
-               }
-
-             (*optionsTable[i].pparameter)++;
-             return 1;
-           }
-         else {
-           /* Not a flag.  Handled manually later. */
-           return 0;
-         }
-       }
+          (longOpt && optionsTable[i].longOpt &&
+           strcmp(optionsTable[i].longOpt, longOpt) == 0))
+        {
+
+          /* If it is a flag then we can handle it here */
+          if (optionsTable[i].pparameter != NULL)
+            {
+              if (optionsTable[i].shortOpt == shortOpt)
+                {
+                  verifyShortOption(argv[*pi]);
+                }
+
+              (*optionsTable[i].pparameter)++;
+              return 1;
+            }
+          else {
+            /* Not a flag.  Handled manually later. */
+            return 0;
+          }
+        }
     }
   /* Didn't find in the table */
   return 0;
     }
   /* Didn't find in the table */
   return 0;
@@ -769,36 +770,36 @@ scanOptionsTable(const OPTION *optionsTable, char shortOpt, const char *longOpt,
 static bool
 tryHandleSimpleOpt(char **argv, int *pi)
 {
 static bool
 tryHandleSimpleOpt(char **argv, int *pi)
 {
-    if (argv[*pi][0] == '-') 
+    if (argv[*pi][0] == '-')
         {
             const char *longOpt = "";
             char shortOpt = -1;
 
         {
             const char *longOpt = "";
             char shortOpt = -1;
 
-            if (argv[*pi][1] == '-') 
+            if (argv[*pi][1] == '-')
                 {
                     /* Long option. */
                     longOpt = argv[*pi];
                 }
                 {
                     /* Long option. */
                     longOpt = argv[*pi];
                 }
-            else 
+            else
                 {
                     shortOpt = argv[*pi][1];
                 }
 
                 {
                     shortOpt = argv[*pi][1];
                 }
 
-           if (scanOptionsTable(optionsTable, shortOpt, longOpt, argv, pi))
-             {
-               return 1;
-             }
-           else if (port && port->poptions &&
-                    scanOptionsTable(port->poptions, shortOpt, longOpt, argv, pi))
-             {
-               return 1;
-             }
-           else
-             {
-               return 0;
-             }
+            if (scanOptionsTable(optionsTable, shortOpt, longOpt, argv, pi))
+              {
+                return 1;
+              }
+            else if (port && port->poptions &&
+                     scanOptionsTable(port->poptions, shortOpt, longOpt, argv, pi))
+              {
+                return 1;
+              }
+            else
+              {
+                return 0;
+              }
         }
         }
-    else 
+    else
         {
             /* Not an option, so can't be handled. */
             return 0;
         {
             /* Not an option, so can't be handled. */
             return 0;
@@ -817,257 +818,267 @@ parseCmdLine (int argc, char **argv)
   for (i = 1; i < argc; i++)
     {
       if (i >= argc)
   for (i = 1; i < argc; i++)
     {
       if (i >= argc)
-       break;
+        break;
 
 
-      if (tryHandleUnsupportedOpt(argv, &i) == TRUE) 
-          {
-              continue;
-          }
+      if (tryHandleUnsupportedOpt(argv, &i) == TRUE)
+        {
+          continue;
+        }
 
       if (tryHandleSimpleOpt(argv, &i) == TRUE)
 
       if (tryHandleSimpleOpt(argv, &i) == TRUE)
-          {
-              continue;
-          }
+        {
+          continue;
+        }
 
       /* options */
       if (argv[i][0] == '-' && argv[i][1] == '-')
 
       /* options */
       if (argv[i][0] == '-' && argv[i][1] == '-')
-       {
-         if (strcmp (argv[i], OPTION_HELP) == 0)
-           {
-             printUsage ();
-             exit (0);
-           }
-
-         if (strcmp (argv[i], OPTION_STACK_8BIT) == 0)
-           {
-             options.stack10bit = 0;
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_OUT_FMT_IHX) == 0)
-           {
-             options.out_fmt = 0;
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_LARGE_MODEL) == 0)
-           {
-             _setModel (MODEL_LARGE, argv[i]);
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_MEDIUM_MODEL) == 0)
-           {
-             _setModel (MODEL_MEDIUM, argv[i]);
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_SMALL_MODEL) == 0)
-           {
-             _setModel (MODEL_SMALL, argv[i]);
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_FLAT24_MODEL) == 0)
-           {
-             _setModel (MODEL_FLAT24, argv[i]);
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_DUMP_ALL) == 0)
-           {
-             options.dump_rassgn =
-               options.dump_pack =
-               options.dump_range =
-               options.dump_kill =
-               options.dump_loop =
-               options.dump_gcse =
-               options.dump_raw = 1;
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_PEEP_FILE) == 0)
-           {
-                options.peep_file = getStringArg(OPTION_PEEP_FILE, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_LIB_PATH) == 0)
+        {
+          if (strcmp (argv[i], OPTION_HELP) == 0)
+            {
+              printUsage ();
+              exit (0);
+            }
+
+          if (strcmp (argv[i], OPTION_STACK_8BIT) == 0)
+            {
+              options.stack10bit = 0;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_OUT_FMT_IHX) == 0)
+            {
+              options.out_fmt = 0;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_LARGE_MODEL) == 0)
+            {
+              _setModel (MODEL_LARGE, argv[i]);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_MEDIUM_MODEL) == 0)
             {
             {
-                addSet(&libPathsSet, Safe_strdup(getStringArg(OPTION_LIB_PATH, argv, &i, argc)));
-                continue;
-           }
+              _setModel (MODEL_MEDIUM, argv[i]);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_SMALL_MODEL) == 0)
+            {
+              _setModel (MODEL_SMALL, argv[i]);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_FLAT24_MODEL) == 0)
+            {
+              _setModel (MODEL_FLAT24, argv[i]);
+              continue;
+            }
 
 
-         if (strcmp (argv[i], OPTION_VERSION) == 0)
-           {
-             printVersionInfo ();
+          if (strcmp (argv[i], OPTION_DUMP_ALL) == 0)
+            {
+              options.dump_rassgn =
+                options.dump_pack =
+                options.dump_range =
+                options.dump_kill =
+                options.dump_loop =
+                options.dump_gcse =
+                options.dump_raw = 1;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_PEEP_FILE) == 0)
+            {
+              options.peep_file = getStringArg(OPTION_PEEP_FILE, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_LIB_PATH) == 0)
+            {
+              addSet(&libPathsSet, Safe_strdup(getStringArg(OPTION_LIB_PATH, argv, &i, argc)));
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_VERSION) == 0)
+            {
+              printVersionInfo ();
               exit (0);
               exit (0);
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_CALLEE_SAVES) == 0)
-           {
-                setParseWithComma(&options.calleeSavesSet, getStringArg(OPTION_CALLEE_SAVES, argv, &i, argc));
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_XSTACK_LOC) == 0)
-           {
-                options.xstack_loc = getIntArg(OPTION_XSTACK_LOC, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_STACK_LOC) == 0)
-           {
-                options.stack_loc = getIntArg(OPTION_STACK_LOC, argv, &i, argc);
-                continue;
-           }
-         
-      if (strcmp (argv[i], OPTION_STACK_SIZE) == 0)
-           {
-                options.stack_size = getIntArg(OPTION_STACK_SIZE, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_XRAM_LOC) == 0)
-           {
-                options.xdata_loc = getIntArg(OPTION_XRAM_LOC, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_IRAM_SIZE) == 0)
-           {
-                options.iram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_XRAM_SIZE) == 0)
-           {
-                options.xram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
-                options.xram_size_set = TRUE;
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_CODE_SIZE) == 0)
-           {
-                options.code_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_DATA_LOC) == 0)
-           {
-                options.data_loc = getIntArg(OPTION_DATA_LOC, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_IDATA_LOC) == 0)
-           {
-                options.idata_loc = getIntArg(OPTION_IDATA_LOC, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_CODE_LOC) == 0)
-           {
-                options.code_loc = getIntArg(OPTION_CODE_LOC, argv, &i, argc);
-                continue;
-           }
-
-         if (strcmp (argv[i], OPTION_NO_GCSE) == 0)
-           {
-             optimize.global_cse = 0;
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_NO_LOOP_INV) == 0)
-           {
-             optimize.loopInvariant = 0;
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_NO_LABEL_OPT) == 0)
-           {
-             optimize.label4 = 0;
-             continue;
-           }
-
-         if (strcmp (argv[i], OPTION_NO_LOOP_IND) == 0)
-           {
-             optimize.loopInduction = 0;
-             continue;
-           }
-
-          if (strcmp (argv[i], OPTION_LESS_PEDANTIC) == 0) 
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_CALLEE_SAVES) == 0)
+            {
+              setParseWithComma(&options.calleeSavesSet, getStringArg(OPTION_CALLEE_SAVES, argv, &i, argc));
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_XSTACK_LOC) == 0)
             {
             {
-             options.lessPedantic = 1;
+              options.xstack_loc = getIntArg(OPTION_XSTACK_LOC, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_STACK_LOC) == 0)
+            {
+              options.stack_loc = getIntArg(OPTION_STACK_LOC, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_STACK_SIZE) == 0)
+            {
+              options.stack_size = getIntArg(OPTION_STACK_SIZE, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_XRAM_LOC) == 0)
+            {
+              options.xdata_loc = getIntArg(OPTION_XRAM_LOC, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_IRAM_SIZE) == 0)
+            {
+              options.iram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_XRAM_SIZE) == 0)
+            {
+              options.xram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
+              options.xram_size_set = TRUE;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_CODE_SIZE) == 0)
+            {
+              options.code_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_DATA_LOC) == 0)
+            {
+              options.data_loc = getIntArg(OPTION_DATA_LOC, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_IDATA_LOC) == 0)
+            {
+              options.idata_loc = getIntArg(OPTION_IDATA_LOC, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_CODE_LOC) == 0)
+            {
+              options.code_loc = getIntArg(OPTION_CODE_LOC, argv, &i, argc);
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_NO_GCSE) == 0)
+            {
+              optimize.global_cse = 0;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_NO_LOOP_INV) == 0)
+            {
+              optimize.loopInvariant = 0;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_NO_LABEL_OPT) == 0)
+            {
+              optimize.label4 = 0;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_NO_LOOP_IND) == 0)
+            {
+              optimize.loopInduction = 0;
+              continue;
+            }
+
+          if (strcmp (argv[i], OPTION_LESS_PEDANTIC) == 0)
+            {
+              options.lessPedantic = 1;
               setErrorLogLevel(ERROR_LEVEL_WARNING);
               continue;
             }
 
               setErrorLogLevel(ERROR_LEVEL_WARNING);
               continue;
             }
 
-         if (strcmp (&argv[i][1], OPTION_SHORT_IS_8BITS) == 0) 
+          if (strcmp (argv[i], OPTION_DISABLE_WARNING) == 0)
+            {
+              int w = getIntArg(OPTION_DISABLE_WARNING, argv, &i, argc);
+              if (w < MAX_ERROR_WARNING)
+                {
+                  setWarningDisabled(w);
+                }
+              continue;
+            }
+
+          if (strcmp (&argv[i][1], OPTION_SHORT_IS_8BITS) == 0)
             {
               options.shortis8bits=1;
               continue;
             }
 
             {
               options.shortis8bits=1;
               continue;
             }
 
-         if (strcmp (argv[i], OPTION_TINI_LIBID) == 0)
-           {
-                options.tini_libid = getIntArg(OPTION_TINI_LIBID, argv, &i, argc);
-                continue;
-           }
-          
-         if (!port->parseOption (&argc, argv, &i))
-           {
-             werror (W_UNKNOWN_OPTION, argv[i]);
-             continue;
-           }
-         else
-           {
-             continue;
-           }
-       }
+          if (strcmp (argv[i], OPTION_TINI_LIBID) == 0)
+            {
+              options.tini_libid = getIntArg(OPTION_TINI_LIBID, argv, &i, argc);
+              continue;
+            }
+
+          if (!port->parseOption (&argc, argv, &i))
+            {
+              werror (W_UNKNOWN_OPTION, argv[i]);
+              continue;
+            }
+          else
+            {
+              continue;
+            }
+        }
 
       /* if preceded by  '-' then option */
       if (*argv[i] == '-')
 
       /* if preceded by  '-' then option */
       if (*argv[i] == '-')
-       {
-         switch (argv[i][1])
-           {
-           case 'h':
+        {
+          switch (argv[i][1])
+            {
+            case 'h':
               verifyShortOption(argv[i]);
 
               verifyShortOption(argv[i]);
 
-             printUsage ();
-             exit (0);
-             break;
+              printUsage ();
+              exit (0);
+              break;
 
 
-           case 'm':
-             /* Used to select the port. But this has already been done. */
-             break;
+            case 'm':
+              /* Used to select the port. But this has already been done. */
+              break;
 
 
-           case 'p':
-             /* Used to select the processor in port. But this has
-              * already been done. */
-             break;
+            case 'p':
+              /* Used to select the processor in port. But this has
+               * already been done. */
+              break;
 
 
-           case 'c':
+            case 'c':
               verifyShortOption(argv[i]);
 
               verifyShortOption(argv[i]);
 
-             options.cc_only = 1;
-             break;
+              options.cc_only = 1;
+              break;
 
 
-           case 'L':
+            case 'L':
                 addSet(&libPathsSet, Safe_strdup(getStringArg("-L", argv, &i, argc)));
                 break;
 
             case 'l':
                 addSet(&libFilesSet, Safe_strdup(getStringArg("-l", argv, &i, argc)));
                 break;
                 addSet(&libPathsSet, Safe_strdup(getStringArg("-L", argv, &i, argc)));
                 break;
 
             case 'l':
                 addSet(&libFilesSet, Safe_strdup(getStringArg("-l", argv, &i, argc)));
                 break;
-            
+
             case 'o':
               {
                 char *p;
 
                 /* copy the file name into the buffer */
             case 'o':
               {
                 char *p;
 
                 /* copy the file name into the buffer */
-                strncpyz(buffer, getStringArg("-o", argv, &i, argc), 
-                        sizeof(buffer));
+                strncpyz(buffer, getStringArg("-o", argv, &i, argc),
+                         sizeof(buffer));
                 /* point to last character */
                 p = buffer + strlen (buffer) - 1;
                 if (*p == DIR_SEPARATOR_CHAR)
                 /* point to last character */
                 p = buffer + strlen (buffer) - 1;
                 if (*p == DIR_SEPARATOR_CHAR)
@@ -1102,19 +1113,19 @@ parseCmdLine (int argc, char **argv)
                 break;
               }
 
                 break;
               }
 
-           case 'W':
+            case 'W':
               /* pre-processer options */
               if (argv[i][2] == 'p')
                 {
                   setParseWithComma(&preArgvSet, getStringArg("-Wp", argv, &i, argc));
                 }
               /* pre-processer options */
               if (argv[i][2] == 'p')
                 {
                   setParseWithComma(&preArgvSet, getStringArg("-Wp", argv, &i, argc));
                 }
-             /* linker options */
-             else if (argv[i][2] == 'l')
-               {
+              /* linker options */
+              else if (argv[i][2] == 'l')
+                {
                   setParseWithComma(&linkOptionsSet, getStringArg("-Wl", argv, &i, argc));
                   setParseWithComma(&linkOptionsSet, getStringArg("-Wl", argv, &i, argc));
-               }
+                }
               /* assembler options */
               /* assembler options */
-             else if (argv[i][2] == 'a')
+              else if (argv[i][2] == 'a')
                 {
                   setParseWithComma(&asmOptionsSet, getStringArg("-Wa", argv, &i, argc));
                 }
                 {
                   setParseWithComma(&asmOptionsSet, getStringArg("-Wa", argv, &i, argc));
                 }
@@ -1122,86 +1133,86 @@ parseCmdLine (int argc, char **argv)
                 {
                   werror (W_UNKNOWN_OPTION, argv[i]);
                 }
                 {
                   werror (W_UNKNOWN_OPTION, argv[i]);
                 }
-             break;
+              break;
 
 
-           case 'v':
+            case 'v':
               verifyShortOption(argv[i]);
 
               verifyShortOption(argv[i]);
 
-             printVersionInfo ();
-             exit (0);
-             break;
+              printVersionInfo ();
+              exit (0);
+              break;
 
 
-             /* preprocessor options */
-           case 'M':
-             {
-               preProcOnly = 1;
+              /* preprocessor options */
+            case 'M':
+              {
+                preProcOnly = 1;
                 if (argv[i][2] == 'M')
                 if (argv[i][2] == 'M')
-                 addSet(&preArgvSet, Safe_strdup("-MM"));
+                  addSet(&preArgvSet, Safe_strdup("-MM"));
                 else
                 else
-                 addSet(&preArgvSet, Safe_strdup("-M"));
-               break;
-             }
-           case 'C':
-             {
-               addSet(&preArgvSet, Safe_strdup("-C"));
-               break;
-             }
-
-           case 'd':
-           case 'D':
-           case 'I':
-           case 'A':
-           case 'U':
-             {
-               char sOpt = argv[i][1];
-               char *rest;
-
-               if (argv[i][2] == ' ' || argv[i][2] == '\0')
-                 {
-                   i++;
+                  addSet(&preArgvSet, Safe_strdup("-M"));
+                break;
+              }
+            case 'C':
+              {
+                addSet(&preArgvSet, Safe_strdup("-C"));
+                break;
+              }
+
+            case 'd':
+            case 'D':
+            case 'I':
+            case 'A':
+            case 'U':
+              {
+                char sOpt = argv[i][1];
+                char *rest;
+
+                if (argv[i][2] == ' ' || argv[i][2] == '\0')
+                  {
+                    i++;
                     if (i >= argc)
                       {
                     if (i >= argc)
                       {
-                          /* No argument. */
-                          werror(E_ARGUMENT_MISSING, argv[i-1]);
-                          break;
+                        /* No argument. */
+                        werror(E_ARGUMENT_MISSING, argv[i-1]);
+                        break;
                       }
                     else
                       {
                       }
                     else
                       {
-                          rest = argv[i];
+                        rest = argv[i];
                       }
                       }
-                 }
-               else
-                 rest = &argv[i][2];
+                  }
+                else
+                  rest = &argv[i][2];
 
 
-               if (sOpt == 'Y')
-                 sOpt = 'I';
+                if (sOpt == 'Y')
+                  sOpt = 'I';
 
                 SNPRINTF (buffer, sizeof(buffer),
                   ((sOpt == 'I') ? "-%c\"%s\"": "-%c%s"), sOpt, rest);
 
                 SNPRINTF (buffer, sizeof(buffer),
                   ((sOpt == 'I') ? "-%c\"%s\"": "-%c%s"), sOpt, rest);
-               addSet(&preArgvSet, Safe_strdup(buffer));
-               if(sOpt == 'I')addSet(&includeDirsSet, Safe_strdup(rest));
-             }
-             break;
-
-           default:
-             if (!port->parseOption (&argc, argv, &i))
-               werror (W_UNKNOWN_OPTION, argv[i]);
-           }
-         continue;
-       }
+                addSet(&preArgvSet, Safe_strdup(buffer));
+                if(sOpt == 'I')addSet(&includeDirsSet, Safe_strdup(rest));
+              }
+              break;
+
+            default:
+              if (!port->parseOption (&argc, argv, &i))
+                werror (W_UNKNOWN_OPTION, argv[i]);
+            }
+          continue;
+        }
 
       if (!port->parseOption (&argc, argv, &i))
 
       if (!port->parseOption (&argc, argv, &i))
-       {
-          /* no option must be a filename */
-          if (options.c1mode)
-            {
-               werror (W_NO_FILE_ARG_IN_C1, argv[i]);
-            }
-        else
-            {
-               processFile (argv[i]);
-            }
-       }
+        {
+          /* no option must be a filename */
+          if (options.c1mode)
+            {
+              werror (W_NO_FILE_ARG_IN_C1, argv[i]);
+            }
+          else
+            {
+              processFile (argv[i]);
+            }
+        }
     }
 
   /* some sanity checks in c1 mode */
     }
 
   /* some sanity checks in c1 mode */
@@ -1210,32 +1221,32 @@ parseCmdLine (int argc, char **argv)
       const char *s;
 
       if (fullSrcFileName)
       const char *s;
 
       if (fullSrcFileName)
-       {
-         fclose (srcFile);
-         werror (W_NO_FILE_ARG_IN_C1, fullSrcFileName);
-       }
+        {
+          fclose (srcFile);
+          werror (W_NO_FILE_ARG_IN_C1, fullSrcFileName);
+        }
       fullSrcFileName = NULL;
       for (s = setFirstItem(relFilesSet); s != NULL; s = setNextItem(relFilesSet))
       fullSrcFileName = NULL;
       for (s = setFirstItem(relFilesSet); s != NULL; s = setNextItem(relFilesSet))
-       {
-         werror (W_NO_FILE_ARG_IN_C1, s);
-       }
+        {
+          werror (W_NO_FILE_ARG_IN_C1, s);
+        }
       for (s = setFirstItem(libFilesSet); s != NULL; s = setNextItem(libFilesSet))
       for (s = setFirstItem(libFilesSet); s != NULL; s = setNextItem(libFilesSet))
-       {
-         werror (W_NO_FILE_ARG_IN_C1, s);
-       }
+        {
+          werror (W_NO_FILE_ARG_IN_C1, s);
+        }
       deleteSet(&relFilesSet);
       deleteSet(&libFilesSet);
 
       deleteSet(&relFilesSet);
       deleteSet(&libFilesSet);
 
-        if (options.cc_only || noAssemble || preProcOnly)
-       {
-         werror (W_ILLEGAL_OPT_COMBINATION);
-       }
+      if (options.cc_only || noAssemble || preProcOnly)
+        {
+          werror (W_ILLEGAL_OPT_COMBINATION);
+        }
       options.cc_only = noAssemble = preProcOnly = 0;
       if (!dstFileName)
       options.cc_only = noAssemble = preProcOnly = 0;
       if (!dstFileName)
-       {
-         werror (E_NEED_OPT_O_IN_C1);
-         exit (1);
-       }
+        {
+          werror (E_NEED_OPT_O_IN_C1);
+          exit (1);
+        }
     }
   /* if no dstFileName given with -o, we've to find one: */
   if (!dstFileName)
     }
   /* if no dstFileName given with -o, we've to find one: */
   if (!dstFileName)
@@ -1245,9 +1256,9 @@ parseCmdLine (int argc, char **argv)
       /* use the modulename from the C-source */
       if (fullSrcFileName)
         {
       /* use the modulename from the C-source */
       if (fullSrcFileName)
         {
-         size_t bufSize = strlen (dstPath) + strlen (moduleNameBase) + 1;
+          size_t bufSize = strlen (dstPath) + strlen (moduleNameBase) + 1;
 
 
-         dstFileName = Safe_alloc (bufSize);
+          dstFileName = Safe_alloc (bufSize);
           strncpyz (dstFileName, dstPath, bufSize);
           strncatz (dstFileName, moduleNameBase, bufSize);
         }
           strncpyz (dstFileName, dstPath, bufSize);
           strncatz (dstFileName, moduleNameBase, bufSize);
         }
@@ -1255,7 +1266,7 @@ parseCmdLine (int argc, char **argv)
       else if ((s = peekSet(relFilesSet)) != NULL)
         {
           char *objectName;
       else if ((s = peekSet(relFilesSet)) != NULL)
         {
           char *objectName;
-         size_t bufSize;
+          size_t bufSize;
 
           strncpyz (buffer, s, sizeof(buffer));
           /* remove extension (it must be .rel) */
 
           strncpyz (buffer, s, sizeof(buffer));
           /* remove extension (it must be .rel) */
@@ -1270,7 +1281,7 @@ parseCmdLine (int argc, char **argv)
             {
               objectName = buffer;
             }
             {
               objectName = buffer;
             }
-         bufSize = strlen (dstPath) + strlen (objectName) + 1;  
+          bufSize = strlen (dstPath) + strlen (objectName) + 1;
           dstFileName = Safe_alloc (bufSize);
           strncpyz (dstFileName, dstPath, bufSize);
           strncatz (dstFileName, objectName, bufSize);
           dstFileName = Safe_alloc (bufSize);
           strncpyz (dstFileName, dstPath, bufSize);
           strncatz (dstFileName, objectName, bufSize);
@@ -1286,11 +1297,11 @@ parseCmdLine (int argc, char **argv)
   if (options.debug && fullSrcFileName)
     {
       SNPRINTF (scratchFileName, sizeof(scratchFileName),
   if (options.debug && fullSrcFileName)
     {
       SNPRINTF (scratchFileName, sizeof(scratchFileName),
-               "%s.adb", dstFileName); /*JCF: Nov 30, 2002*/
+                "%s.adb", dstFileName); /*JCF: Nov 30, 2002*/
       if(debugFile->openFile(scratchFileName))
       if(debugFile->openFile(scratchFileName))
-       debugFile->writeModule(moduleName);
+        debugFile->writeModule(moduleName);
       else
       else
-       werror (E_FILE_OPEN_ERR, scratchFileName);
+        werror (E_FILE_OPEN_ERR, scratchFileName);
     }
   MSVC_style(options.vc_err_style);
   if(options.use_stdout) dup2(STDOUT_FILENO, STDERR_FILENO);
     }
   MSVC_style(options.vc_err_style);
   if(options.use_stdout) dup2(STDOUT_FILENO, STDERR_FILENO);
@@ -1313,22 +1324,22 @@ linkEdit (char **envp)
   if(port->linker.needLinkerScript)
     {
       char out_fmt;
   if(port->linker.needLinkerScript)
     {
       char out_fmt;
-      
+
       switch (options.out_fmt)
         {
       switch (options.out_fmt)
         {
-       case 0:
-         out_fmt = 'i';        /* Intel hex */
-         break;
-       case 1:
-         out_fmt = 's';        /* Motorola S19 */
-         break;
-       case 2:
-         out_fmt = 't';        /* Elf */
-         break;
-       default:
-         out_fmt = 'i';
-       }
-      
+        case 0:
+          out_fmt = 'i';        /* Intel hex */
+          break;
+        case 1:
+          out_fmt = 's';        /* Motorola S19 */
+          break;
+        case 2:
+          out_fmt = 't';        /* Elf */
+          break;
+        default:
+          out_fmt = 'i';
+        }
+
       /* first we need to create the <filename>.lnk file */
       SNPRINTF (scratchFileName, sizeof(scratchFileName),
         "%s.lnk", dstFileName);
       /* first we need to create the <filename>.lnk file */
       SNPRINTF (scratchFileName, sizeof(scratchFileName),
         "%s.lnk", dstFileName);
@@ -1414,7 +1425,7 @@ linkEdit (char **envp)
           WRITE_SEG_LOC ("_CODE", options.code_loc);
           WRITE_SEG_LOC ("_DATA", options.data_loc);
         }
           WRITE_SEG_LOC ("_CODE", options.code_loc);
           WRITE_SEG_LOC ("_DATA", options.data_loc);
         }
-  
+
       /* If the port has any special linker area declarations, get 'em */
       if (port->extraAreas.genExtraAreaLinkOptions)
         {
       /* If the port has any special linker area declarations, get 'em */
       if (port->extraAreas.genExtraAreaLinkOptions)
         {
@@ -1453,7 +1464,7 @@ linkEdit (char **envp)
                     }
                   else
                     {
                     }
                   else
                     {
-                      fprintf(stderr, 
+                      fprintf(stderr,
                         "Add support for your FLAT24 target in %s @ line %d\n",
                         __FILE__, __LINE__);
                       exit(-1);
                         "Add support for your FLAT24 target in %s @ line %d\n",
                         __FILE__, __LINE__);
                       exit(-1);
@@ -1501,7 +1512,7 @@ linkEdit (char **envp)
                 }
               else
                 {
                 }
               else
                 {
-                  fprintf(stderr, 
+                  fprintf(stderr,
                     "Add support for your FLAT24 target in %s @ line %d\n",
                     __FILE__, __LINE__);
                   exit(-1);
                     "Add support for your FLAT24 target in %s @ line %d\n",
                     __FILE__, __LINE__);
                   exit(-1);
@@ -1509,7 +1520,7 @@ linkEdit (char **envp)
               }
 #endif
 
               }
 #endif
 
-#if !OPT_DISABLE_XA51 
+#if !OPT_DISABLE_XA51
 #ifdef STD_XA51_LIB
           if (options.model == MODEL_PAGE0)
             {
 #ifdef STD_XA51_LIB
           if (options.model == MODEL_PAGE0)
             {
@@ -1518,10 +1529,10 @@ linkEdit (char **envp)
 #endif
 #endif
           if (TARGET_IS_MCS51)
 #endif
 #endif
           if (TARGET_IS_MCS51)
-           {
+            {
               fprintf (lnkfile, "-l mcs51\n");
               fprintf (lnkfile, "-l mcs51\n");
-           }
-         if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80
+            }
+          if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80
             || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
             { /*Why the z80 port is not using the standard libraries?*/
               fprintf (lnkfile, "-l %s\n", STD_LIB);
             || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
             { /*Why the z80 port is not using the standard libraries?*/
               fprintf (lnkfile, "-l %s\n", STD_LIB);
@@ -1614,7 +1625,7 @@ linkEdit (char **envp)
           /* strip ".rel" extension */
           *strrchr (scratchFileName, '.') = '\0';
         }
           /* strip ".rel" extension */
           *strrchr (scratchFileName, '.') = '\0';
         }
-      strncatz (scratchFileName, 
+      strncatz (scratchFileName,
         options.out_fmt ? ".S19" : ".ihx",
         sizeof(scratchFileName));
     }
         options.out_fmt ? ".S19" : ".ihx",
         sizeof(scratchFileName));
     }
@@ -1627,11 +1638,11 @@ linkEdit (char **envp)
 
       strcpy(buffer3, dstFileName);
       if(TARGET_IS_PIC16) {
 
       strcpy(buffer3, dstFileName);
       if(TARGET_IS_PIC16) {
-        
+
          /* use $l to set the linker include directories */
          tempSet = appendStrSet(libDirsSet, "-I\"", "\"");
          mergeSets(&linkOptionsSet, tempSet);
          /* use $l to set the linker include directories */
          tempSet = appendStrSet(libDirsSet, "-I\"", "\"");
          mergeSets(&linkOptionsSet, tempSet);
-         
+
          tempSet = appendStrSet(libPathsSet, "-I\"", "\"");
          mergeSets(&linkOptionsSet, tempSet);
 
          tempSet = appendStrSet(libPathsSet, "-I\"", "\"");
          mergeSets(&linkOptionsSet, tempSet);
 
@@ -1642,15 +1653,15 @@ linkEdit (char **envp)
          mergeSets(&libSet, tempSet);
 //         libSet = reverseSet(libSet);
 
          mergeSets(&libSet, tempSet);
 //         libSet = reverseSet(libSet);
 
-       if(fullSrcFileName) {
-//             strcpy(buffer3, strrchr(fullSrcFileName, DIR_SEPARATOR_CHAR)+1);
-               /* if it didn't work, revert to old behaviour */
-               if(!strlen(buffer3))strcpy(buffer3, dstFileName);
-               strcat(buffer3, port->linker.rel_ext);
-               
-       } else strcpy(buffer3, "");
+        if(fullSrcFileName) {
+//              strcpy(buffer3, strrchr(fullSrcFileName, DIR_SEPARATOR_CHAR)+1);
+                /* if it didn't work, revert to old behaviour */
+                if(!strlen(buffer3))strcpy(buffer3, dstFileName);
+                strcat(buffer3, port->linker.rel_ext);
+
+        } else strcpy(buffer3, "");
       }
       }
-      
+
       buildCmdLine (buffer2, port->linker.cmd, buffer3, scratchFileName, (libSet?joinStrSet(libSet):NULL), linkOptionsSet);
 
       buildCmdLine2 (buffer, sizeof(buffer), buffer2);
       buildCmdLine (buffer2, port->linker.cmd, buffer3, scratchFileName, (libSet?joinStrSet(libSet):NULL), linkOptionsSet);
 
       buildCmdLine2 (buffer, sizeof(buffer), buffer2);
@@ -1754,34 +1765,34 @@ assemble (char **envp)
     } else {
         /* the assembled file gets the name of the first modul */
         strncpyz (scratchFileName, dstFileName, sizeof(scratchFileName));
     } else {
         /* the assembled file gets the name of the first modul */
         strncpyz (scratchFileName, dstFileName, sizeof(scratchFileName));
-        strncatz (scratchFileName, port->linker.rel_ext, 
-                 sizeof(scratchFileName));
+        strncatz (scratchFileName, port->linker.rel_ext,
+                  sizeof(scratchFileName));
     }
 
     if (port->assembler.do_assemble) {
     }
 
     if (port->assembler.do_assemble) {
-       port->assembler.do_assemble(asmOptionsSet);
-       return ;
+        port->assembler.do_assemble(asmOptionsSet);
+        return ;
     } else if (port->assembler.cmd) {
         buildCmdLine (buffer, port->assembler.cmd, dstFileName, scratchFileName,
     } else if (port->assembler.cmd) {
         buildCmdLine (buffer, port->assembler.cmd, dstFileName, scratchFileName,
-                     options.debug ? port->assembler.debug_opts : port->assembler.plain_opts,
-                     asmOptionsSet);
+                      options.debug ? port->assembler.debug_opts : port->assembler.plain_opts,
+                      asmOptionsSet);
     } else {
     } else {
-       buildCmdLine2 (buffer, sizeof(buffer), port->assembler.mcmd);
+        buildCmdLine2 (buffer, sizeof(buffer), port->assembler.mcmd);
     }
 
     if (my_system (buffer)) {
     }
 
     if (my_system (buffer)) {
-       /* either system() or the assembler itself has reported an error
-          perror ("Cannot exec assembler");
-       */
-       exit (1);
+        /* either system() or the assembler itself has reported an error
+           perror ("Cannot exec assembler");
+        */
+        exit (1);
     }
     /* TODO: most assembler don't have a -o parameter */
     /* -o option overrides default name? */
     if (options.cc_only && fullDstFileName) {
         strncpyz (scratchFileName, dstFileName, sizeof(scratchFileName));
     }
     /* TODO: most assembler don't have a -o parameter */
     /* -o option overrides default name? */
     if (options.cc_only && fullDstFileName) {
         strncpyz (scratchFileName, dstFileName, sizeof(scratchFileName));
-        strncatz (scratchFileName, 
-                 port->linker.rel_ext,
-                 sizeof(scratchFileName));
+        strncatz (scratchFileName,
+                  port->linker.rel_ext,
+                  sizeof(scratchFileName));
         if (strcmp (scratchFileName, fullDstFileName))
           unlink (fullDstFileName);
         rename (scratchFileName, fullDstFileName);
         if (strcmp (scratchFileName, fullDstFileName))
           unlink (fullDstFileName);
         rename (scratchFileName, fullDstFileName);
@@ -1805,15 +1816,15 @@ preProcess (char **envp)
 
       /* if using external stack define the macro */
       if (options.useXstack)
 
       /* if using external stack define the macro */
       if (options.useXstack)
-       addSet(&preArgvSet, Safe_strdup("-DSDCC_USE_XSTACK"));
+        addSet(&preArgvSet, Safe_strdup("-DSDCC_USE_XSTACK"));
 
       /* set the macro for stack autos  */
       if (options.stackAuto)
 
       /* set the macro for stack autos  */
       if (options.stackAuto)
-       addSet(&preArgvSet, Safe_strdup("-DSDCC_STACK_AUTO"));
+        addSet(&preArgvSet, Safe_strdup("-DSDCC_STACK_AUTO"));
 
       /* set the macro for stack autos  */
       if (options.stack10bit)
 
       /* set the macro for stack autos  */
       if (options.stack10bit)
-       addSet(&preArgvSet, Safe_strdup("-DSDCC_STACK_TENBIT"));
+        addSet(&preArgvSet, Safe_strdup("-DSDCC_STACK_TENBIT"));
 
       /* set the macro for no overlay  */
       if (options.noOverlay)
 
       /* set the macro for no overlay  */
       if (options.noOverlay)
@@ -1821,29 +1832,29 @@ preProcess (char **envp)
 
       /* set the macro for large model  */
       switch (options.model)
 
       /* set the macro for large model  */
       switch (options.model)
-       {
-       case MODEL_LARGE:
-         addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_LARGE"));
-         break;
-       case MODEL_SMALL:
-         addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_SMALL"));
-         break;
-       case MODEL_COMPACT:
-         addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_COMPACT"));
-         break;
-       case MODEL_MEDIUM:
-         addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_MEDIUM"));
-         break;
-       case MODEL_FLAT24:
-         addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_FLAT24"));
-         break;
-       case MODEL_PAGE0:
-         addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_PAGE0"));
-         break;
-       default:
-         werror (W_UNKNOWN_MODEL, __FILE__, __LINE__);
-         break;
-       }
+        {
+        case MODEL_LARGE:
+          addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_LARGE"));
+          break;
+        case MODEL_SMALL:
+          addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_SMALL"));
+          break;
+        case MODEL_COMPACT:
+          addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_COMPACT"));
+          break;
+        case MODEL_MEDIUM:
+          addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_MEDIUM"));
+          break;
+        case MODEL_FLAT24:
+          addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_FLAT24"));
+          break;
+        case MODEL_PAGE0:
+          addSet(&preArgvSet, Safe_strdup("-DSDCC_MODEL_PAGE0"));
+          break;
+        default:
+          werror (W_UNKNOWN_MODEL, __FILE__, __LINE__);
+          break;
+        }
 
       /* add port (processor information to processor */
       addSet(&preArgvSet, Safe_strdup("-DSDCC_{port}"));
 
       /* add port (processor information to processor */
       addSet(&preArgvSet, Safe_strdup("-DSDCC_{port}"));
@@ -1861,25 +1872,25 @@ preProcess (char **envp)
         deleteSet(&inclList);
 
       if (preProcOnly && fullDstFileName)
         deleteSet(&inclList);
 
       if (preProcOnly && fullDstFileName)
-       {
-         /* -E and -o given */
-         setMainValue ("cppoutfilename", fullDstFileName);
-       }
+        {
+          /* -E and -o given */
+          setMainValue ("cppoutfilename", fullDstFileName);
+        }
       else
       else
-       {
-         /* Piping: set cppoutfilename to NULL, to avoid empty quotes */
-         setMainValue ("cppoutfilename", NULL);
-       }
+        {
+          /* Piping: set cppoutfilename to NULL, to avoid empty quotes */
+          setMainValue ("cppoutfilename", NULL);
+        }
 
       if (options.verbose)
 
       if (options.verbose)
-       printf ("sdcc: Calling preprocessor...\n");
+        printf ("sdcc: Calling preprocessor...\n");
 
       buildCmdLine2 (buffer, sizeof(buffer), _preCmd);
 
       if (preProcOnly) {
         if (my_system (buffer)) {
 
       buildCmdLine2 (buffer, sizeof(buffer), _preCmd);
 
       if (preProcOnly) {
         if (my_system (buffer)) {
-         exit (1);
-       }
+          exit (1);
+        }
 
         exit (0);
       }
 
         exit (0);
       }
@@ -2148,7 +2159,7 @@ main (int argc, char **argv, char **envp)
 #ifdef JAMIN_DS390
   if (strcmp(port->target, "mcs51") == 0) {
     printf("DS390 jammed in A\n");
 #ifdef JAMIN_DS390
   if (strcmp(port->target, "mcs51") == 0) {
     printf("DS390 jammed in A\n");
-         _setPort ("ds390");
+          _setPort ("ds390");
     ds390_jammed = 1;
   }
 #endif
     ds390_jammed = 1;
   }
 #endif
@@ -2173,10 +2184,10 @@ main (int argc, char **argv, char **envp)
   setDataPaths(argv[0]);
 
   if(port->initPaths)
   setDataPaths(argv[0]);
 
   if(port->initPaths)
-       port->initPaths();
-  
+        port->initPaths();
+
   if(options.printSearchDirs)
   if(options.printSearchDirs)
-       doPrintSearchDirs();
+        doPrintSearchDirs();
 
   /* if no input then printUsage & exit */
   if (!options.c1mode && !fullSrcFileName && peekSet(relFilesSet) == NULL) {
 
   /* if no input then printUsage & exit */
   if (!options.c1mode && !fullSrcFileName && peekSet(relFilesSet) == NULL) {
@@ -2204,7 +2215,7 @@ main (int argc, char **argv, char **envp)
       initPeepHole ();
 
       if (options.verbose)
       initPeepHole ();
 
       if (options.verbose)
-       printf ("sdcc: Generating code...\n");
+        printf ("sdcc: Generating code...\n");
 
       yyparse ();
 
 
       yyparse ();
 
@@ -2249,9 +2260,9 @@ main (int argc, char **argv, char **envp)
       (fullSrcFileName || peekSet(relFilesSet) != NULL))
     {
       if (port->linker.do_link)
       (fullSrcFileName || peekSet(relFilesSet) != NULL))
     {
       if (port->linker.do_link)
-       port->linker.do_link ();
+        port->linker.do_link ();
       else
       else
-       linkEdit (envp);
+        linkEdit (envp);
     }
 
   return 0;
     }
 
   return 0;
index 6abd6a6db6e9c3fda2ded067eec6a7b0c0ef6341..8301d4c4a39876fd8d756cc052b0e0c11b36f6a6 100644 (file)
@@ -140,51 +140,49 @@ static int _lazyDPS = 0;        /* if non-zero, we are doing lazy evaluation of
 /* emitcode - writes the code into a file : for now it is simple    */
 /*-----------------------------------------------------------------*/
 static void
 /* emitcode - writes the code into a file : for now it is simple    */
 /*-----------------------------------------------------------------*/
 static void
-emitcode (char *inst, char *fmt,...)
+emitcode (char *inst, const char *fmt,...)
 {
 {
-    va_list ap;
-    char lb[INITIAL_INLINEASM];
-    char *lbp = lb;
+  va_list ap;
+  char lb[INITIAL_INLINEASM];
+  char *lbp = lb;
 
 
-    va_start (ap, fmt);
+  va_start (ap, fmt);
 
 
-    if (inst && *inst)
+  if (inst && *inst)
     {
     {
-        if (fmt && *fmt)
+      if (fmt && *fmt)
         {
         {
-            SNPRINTF (lb, sizeof(lb), "%s\t", inst);
+          SNPRINTF (lb, sizeof(lb), "%s\t", inst);
         }
         }
-        else
+      else
         {
         {
-            SNPRINTF (lb, sizeof(lb), "%s", inst);
+          SNPRINTF (lb, sizeof(lb), "%s", inst);
         }
 
         }
 
-        tvsprintf (lb + strlen(lb), sizeof(lb) - strlen(lb),
-                   fmt, ap);
+      tvsprintf (lb + strlen(lb), sizeof(lb) - strlen(lb), fmt, ap);
     }
     }
-    else
+  else
     {
     {
-        tvsprintf (lb, sizeof(lb), fmt, ap);
+      tvsprintf (lb, sizeof(lb), fmt, ap);
     }
 
     }
 
-
-    while (isspace (*lbp))
+  while (isspace (*lbp))
     {
     {
-        lbp++;
+      lbp++;
     }
 
     }
 
-    if (lbp && *lbp)
+  if (lbp && *lbp)
     {
     {
-        lineCurr = (lineCurr ?
-                    connectLine (lineCurr, newLineNode (lb)) :
-                    (lineHead = newLineNode (lb)));
+      lineCurr = (lineCurr ?
+                  connectLine (lineCurr, newLineNode (lb)) :
+                  (lineHead = newLineNode (lb)));
     }
 
     }
 
-    lineCurr->isInline = _G.inLine;
-    lineCurr->isDebug = _G.debugLine;
-    lineCurr->ic = _G.current_iCode;
-    lineCurr->aln = ds390newAsmLineNode(_currentDPS);
-    va_end (ap);
+  lineCurr->isInline = _G.inLine;
+  lineCurr->isDebug = _G.debugLine;
+  lineCurr->ic = _G.current_iCode;
+  lineCurr->aln = ds390newAsmLineNode(_currentDPS);
+  va_end (ap);
 }
 
 /*-----------------------------------------------------------------*/
 }
 
 /*-----------------------------------------------------------------*/
@@ -730,7 +728,7 @@ aopForRemat (symbol * sym)
 {
   iCode *ic = sym->rematiCode;
   asmop *aop = newAsmop (AOP_IMMD);
 {
   iCode *ic = sym->rematiCode;
   asmop *aop = newAsmop (AOP_IMMD);
-  int ptr_type =0;
+  int ptr_type = 0;
   int val = 0;
 
   for (;;)
   int val = 0;
 
   for (;;)
@@ -870,7 +868,6 @@ operandsEqu (operand * op1, operand * op2)
       && strcmp (sym1->rname, sym2->rname) == 0)
     return TRUE;
 
       && strcmp (sym1->rname, sym2->rname) == 0)
     return TRUE;
 
-
   /* if left is a tmp & right is not */
   if (IS_ITEMP (op1) &&
       !IS_ITEMP (op2) &&
   /* if left is a tmp & right is not */
   if (IS_ITEMP (op1) &&
       !IS_ITEMP (op2) &&
@@ -988,7 +985,6 @@ aopOp (operand * op, iCode * ic, bool result, bool useDP2)
 
   sym = OP_SYMBOL (op);
 
 
   sym = OP_SYMBOL (op);
 
-
   /* if the type is a conditional */
   if (sym->regType == REG_CND)
     {
   /* if the type is a conditional */
   if (sym->regType == REG_CND)
     {
@@ -2536,12 +2532,12 @@ saveRBank (int bank, iCode * ic, bool pushPsw)
 
   if (aop)
   {
 
   if (aop)
   {
-       freeAsmop (NULL, aop, ic, TRUE);
+    freeAsmop (NULL, aop, ic, TRUE);
   }
 
   if (ic)
   {
   }
 
   if (ic)
   {
-      ic->bankSaved = 1;
+    ic->bankSaved = 1;
   }
 }
 
   }
 }
 
@@ -3791,54 +3787,55 @@ genPlusIncr (iCode * ic)
 
       if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
           IS_AOP_PREG (IC_RESULT (ic)))
 
       if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
           IS_AOP_PREG (IC_RESULT (ic)))
-      {
-        emitcode ("cjne", "%s,#0,!tlabel", l, tlbl->key + 100);
-      }
+        {
+          emitcode ("cjne", "%s,#0,!tlabel", l, tlbl->key + 100);
+        }
       else
       else
-      {
+        {
           emitcode ("clr", "a");
           emitcode ("cjne", "a,%s,!tlabel", l, tlbl->key + 100);
           emitcode ("clr", "a");
           emitcode ("cjne", "a,%s,!tlabel", l, tlbl->key + 100);
-      }
+        }
 
       l = aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE, NULL);
       emitcode ("inc", "%s", l);
       if (size > 2)
         {
 
       l = aopGet (AOP (IC_RESULT (ic)), MSB16, FALSE, FALSE, NULL);
       emitcode ("inc", "%s", l);
       if (size > 2)
         {
-            if (!strcmp(l, "acc"))
+          if (!strcmp(l, "acc"))
             {
                 emitcode("jnz", "!tlabel", tlbl->key + 100);
             }
             {
                 emitcode("jnz", "!tlabel", tlbl->key + 100);
             }
-            else if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
-                     IS_AOP_PREG (IC_RESULT (ic)))
+          else if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
+                   IS_AOP_PREG (IC_RESULT (ic)))
             {
                 emitcode ("cjne", "%s,#0,!tlabel", l, tlbl->key + 100);
             }
             {
                 emitcode ("cjne", "%s,#0,!tlabel", l, tlbl->key + 100);
             }
-            else
+          else
             {
                 emitcode ("cjne", "a,%s,!tlabel", l, tlbl->key + 100);
             }
 
             {
                 emitcode ("cjne", "a,%s,!tlabel", l, tlbl->key + 100);
             }
 
-            l = aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE, NULL);
-            emitcode ("inc", "%s", l);
+          l = aopGet (AOP (IC_RESULT (ic)), MSB24, FALSE, FALSE, NULL);
+          emitcode ("inc", "%s", l);
         }
       if (size > 3)
         {
         }
       if (size > 3)
         {
-            if (!strcmp(l, "acc"))
+          if (!strcmp(l, "acc"))
             {
                 emitcode("jnz", "!tlabel", tlbl->key + 100);
             }
             {
                 emitcode("jnz", "!tlabel", tlbl->key + 100);
             }
-            else if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
-                     IS_AOP_PREG (IC_RESULT (ic)))
+          else if (AOP_TYPE (IC_RESULT (ic)) == AOP_REG ||
+                   IS_AOP_PREG (IC_RESULT (ic)))
             {
                 emitcode ("cjne", "%s,#0,!tlabel", l, tlbl->key + 100);
             }
             {
                 emitcode ("cjne", "%s,#0,!tlabel", l, tlbl->key + 100);
             }
-            else
+          else
             {
                 emitcode ("cjne", "a,%s,!tlabel", l, tlbl->key + 100);
             }
 
             {
                 emitcode ("cjne", "a,%s,!tlabel", l, tlbl->key + 100);
             }
 
-            l = aopGet (AOP (IC_RESULT (ic)), MSB32, FALSE, FALSE, NULL);
-            emitcode ("inc", "%s", l);  }
+          l = aopGet (AOP (IC_RESULT (ic)), MSB32, FALSE, FALSE, NULL);
+          emitcode ("inc", "%s", l);
+        }
 
       if (emitTlbl)
         {
 
       if (emitTlbl)
         {
@@ -3849,8 +3846,12 @@ genPlusIncr (iCode * ic)
 
   if (AOP_TYPE(IC_RESULT(ic))==AOP_STR && IS_ITEMP(IC_RESULT(ic)) &&
       !AOP_USESDPTR(IC_LEFT(ic)) && icount <= 5 && size <= 3 &&
 
   if (AOP_TYPE(IC_RESULT(ic))==AOP_STR && IS_ITEMP(IC_RESULT(ic)) &&
       !AOP_USESDPTR(IC_LEFT(ic)) && icount <= 5 && size <= 3 &&
-      options.model == MODEL_FLAT24 ) {
-
+      options.model == MODEL_FLAT24 )
+    {
+      if (IC_RESULT(ic)->isGptr)
+        {
+          emitcode ("mov","b,%s",aopGet(AOP (IC_LEFT (ic)), 3, FALSE, FALSE, NULL));
+        }
       switch (size) {
       case 3:
           emitcode ("mov","dpx,%s",aopGet(AOP (IC_LEFT (ic)), 2, FALSE, FALSE, NULL));
       switch (size) {
       case 3:
           emitcode ("mov","dpx,%s",aopGet(AOP (IC_LEFT (ic)), 2, FALSE, FALSE, NULL));
@@ -10185,31 +10186,31 @@ genGenPointerGet (operand * left,
      then we do nothing else we move the value to dptr */
   if (AOP_TYPE (left) != AOP_STR)
     {
      then we do nothing else we move the value to dptr */
   if (AOP_TYPE (left) != AOP_STR)
     {
-      /* if this is remateriazable */
+      /* if this is rematerializable */
       if (AOP_TYPE (left) == AOP_IMMD)
         {
           emitcode ("mov", "dptr,%s", aopGet (AOP (left), 0, TRUE, FALSE, NULL));
           if (AOP(left)->aopu.aop_immd.from_cast_remat)
             {
       if (AOP_TYPE (left) == AOP_IMMD)
         {
           emitcode ("mov", "dptr,%s", aopGet (AOP (left), 0, TRUE, FALSE, NULL));
           if (AOP(left)->aopu.aop_immd.from_cast_remat)
             {
-                MOVB(aopGet(AOP (left), AOP_SIZE(left)-1, FALSE, FALSE, NULL));
+              MOVB(aopGet(AOP (left), AOP_SIZE(left)-1, FALSE, FALSE, NULL));
             }
             }
-            else
+          else
             {
             {
-                emitcode ("mov", "b,#%d", pointerCode (retype));
+              emitcode ("mov", "b,#%d", pointerCode (retype));
             }
         }
       else
         {                       /* we need to get it byte by byte */
             }
         }
       else
         {                       /* we need to get it byte by byte */
-            _startLazyDPSEvaluation ();
-            emitcode ("mov", "dpl,%s", aopGet (AOP(left),0,FALSE,FALSE,NULL));
-            emitcode ("mov", "dph,%s", aopGet (AOP(left),1,FALSE,FALSE,NULL));
-            if (options.model == MODEL_FLAT24) {
-                emitcode ("mov", "dpx,%s", aopGet (AOP(left),2,FALSE,FALSE,NULL));
-                emitcode ("mov", "b,%s", aopGet (AOP(left),3,FALSE,FALSE,NULL));
-            } else {
-                emitcode ("mov", "b,%s", aopGet (AOP(left),2,FALSE,FALSE,NULL));
-            }
-            _endLazyDPSEvaluation ();
+          _startLazyDPSEvaluation ();
+          emitcode ("mov", "dpl,%s", aopGet (AOP(left),0,FALSE,FALSE,NULL));
+          emitcode ("mov", "dph,%s", aopGet (AOP(left),1,FALSE,FALSE,NULL));
+          if (options.model == MODEL_FLAT24) {
+              emitcode ("mov", "dpx,%s", aopGet (AOP(left),2,FALSE,FALSE,NULL));
+              emitcode ("mov", "b,%s", aopGet (AOP(left),3,FALSE,FALSE,NULL));
+          } else {
+              emitcode ("mov", "b,%s", aopGet (AOP(left),2,FALSE,FALSE,NULL));
+          }
+          _endLazyDPSEvaluation ();
         }
     }
 
         }
     }
 
@@ -10311,11 +10312,12 @@ genPointerGet (iCode * ic, iCode *pi)
     }
   /* special case when cast remat */
   if (p_type == GPOINTER && OP_SYMBOL(left)->remat &&
     }
   /* special case when cast remat */
   if (p_type == GPOINTER && OP_SYMBOL(left)->remat &&
-      IS_CAST_ICODE(OP_SYMBOL(left)->rematiCode)) {
-          left = IC_RIGHT(OP_SYMBOL(left)->rematiCode);
-          type = operandType (left);
-          p_type = DCL_TYPE (type);
-  }
+      IS_CAST_ICODE(OP_SYMBOL(left)->rematiCode))
+    {
+      left = IC_RIGHT(OP_SYMBOL(left)->rematiCode);
+      type = operandType (left);
+      p_type = DCL_TYPE (type);
+    }
   /* now that we have the pointer type we assign
      the pointer values */
   switch (p_type)
   /* now that we have the pointer type we assign
      the pointer values */
   switch (p_type)
@@ -13432,7 +13434,6 @@ gen390Code (iCode * lic)
 
   for (ic = lic; ic; ic = ic->next)
     {
 
   for (ic = lic; ic; ic = ic->next)
     {
-
       _G.current_iCode = ic;
 
       if (ic->lineno && cln != ic->lineno)
       _G.current_iCode = ic;
 
       if (ic->lineno && cln != ic->lineno)
index 6ffe1f231ed04619b90facd2f48e59c9ed8a4748..65af1a65c5f4c308b656b5d64cf2706c8dbcdbe6 100644 (file)
@@ -58,7 +58,7 @@ static builtins __ds390_builtins[] = {
     { "__builtin_memcmp_x2x","c",3,{"cx*","cx*","i"}}, /* void __builtin_memcmp_x2x (xdata char *,xdata char *,int) */
     { "__builtin_memcmp_c2x","c",3,{"cx*","cp*","i"}}, /* void __builtin_memcmp_c2x (xdata char *,code  char *,int) */
     { NULL , NULL,0, {NULL}}                      /* mark end of table */
     { "__builtin_memcmp_x2x","c",3,{"cx*","cx*","i"}}, /* void __builtin_memcmp_x2x (xdata char *,xdata char *,int) */
     { "__builtin_memcmp_c2x","c",3,{"cx*","cp*","i"}}, /* void __builtin_memcmp_c2x (xdata char *,code  char *,int) */
     { NULL , NULL,0, {NULL}}                      /* mark end of table */
-};    
+};
 void ds390_assignRegisters (eBBlock ** ebbs, int count);
 
 static int regParmFlg = 0;     /* determine if we can register a parameter */
 void ds390_assignRegisters (eBBlock ** ebbs, int count);
 
 static int regParmFlg = 0;     /* determine if we can register a parameter */
@@ -78,7 +78,6 @@ _ds390_reset_regparm ()
 static int
 _ds390_regparm (sym_link * l)
 {
 static int
 _ds390_regparm (sym_link * l)
 {
-
     if (options.parms_in_bank1 == 0) {
        /* simple can pass only the first parameter in a register */
        if (regParmFlg)
     if (options.parms_in_bank1 == 0) {
        /* simple can pass only the first parameter in a register */
        if (regParmFlg)
@@ -102,7 +101,7 @@ _ds390_regparm (sym_link * l)
            return 0;
        }
        regParmFlg += size ;
            return 0;
        }
        regParmFlg += size ;
-       return regParmFlg - size + 1;   
+       return regParmFlg - size + 1;
     }
 }
 
     }
 }
 
@@ -145,9 +144,9 @@ _ds390_finaliseOptions (void)
 
     port->stack.isr_overhead += 2;     /* Will save dpx on ISR entry. */
 
 
     port->stack.isr_overhead += 2;     /* Will save dpx on ISR entry. */
 
-    port->stack.call_overhead += 2;    /* This acounts for the extra byte 
+    port->stack.call_overhead += 2;    /* This acounts for the extra byte
                                 * of return addres on the stack.
                                 * of return addres on the stack.
-                                * but is ugly. There must be a 
+                                * but is ugly. There must be a
                                 * better way.
                                 */
 
                                 * better way.
                                 */
 
@@ -161,11 +160,11 @@ _ds390_finaliseOptions (void)
     } else {
        if (!options.stack_loc) options.stack_loc = 0x400008;
     }
     } else {
        if (!options.stack_loc) options.stack_loc = 0x400008;
     }
-    
+
     /* generate native code 16*16 mul/div */
     /* generate native code 16*16 mul/div */
-    if (options.useAccelerator) 
+    if (options.useAccelerator)
            port->support.muldiv=2;
            port->support.muldiv=2;
-    else 
+    else
            port->support.muldiv=1;
 
      /* Fixup the memory map for the stack; it is now in
            port->support.muldiv=1;
 
      /* Fixup the memory map for the stack; it is now in
@@ -298,11 +297,11 @@ static bool cseCostEstimation (iCode *ic, iCode *pdic)
     sym_link *result_type = operandType(result);
     //sym_link *right_type  = (right ? operandType(right) : 0);
     //sym_link *left_type   = (left  ? operandType(left)  : 0);
     sym_link *result_type = operandType(result);
     //sym_link *right_type  = (right ? operandType(right) : 0);
     //sym_link *left_type   = (left  ? operandType(left)  : 0);
-    
+
     /* if it is a pointer then return ok for now */
     if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
     /* if it is a pointer then return ok for now */
     if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
-    
-    /* if bitwise | add & subtract then no since mcs51 is pretty good at it 
+
+    /* if bitwise | add & subtract then no since mcs51 is pretty good at it
        so we will cse only if they are local (i.e. both ic & pdic belong to
        the same basic block */
     if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
        so we will cse only if they are local (i.e. both ic & pdic belong to
        the same basic block */
     if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
@@ -310,7 +309,7 @@ static bool cseCostEstimation (iCode *ic, iCode *pdic)
        if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
        else return 0;
     }
        if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
        else return 0;
     }
-       
+
     /* for others it is cheaper to do the cse */
     return 1;
 }
     /* for others it is cheaper to do the cse */
     return 1;
 }
@@ -340,7 +339,7 @@ oclsExpense (struct memmap *oclass)
 {
   if (IN_FARSPACE(oclass))
     return 1;
 {
   if (IN_FARSPACE(oclass))
     return 1;
-    
+
   return 0;
 }
 
   return 0;
 }
 
@@ -348,7 +347,7 @@ static int
 instructionSize(char *inst, char *op1, char *op2)
 {
   int isflat24 = (options.model == MODEL_FLAT24);
 instructionSize(char *inst, char *op1, char *op2)
 {
   int isflat24 = (options.model == MODEL_FLAT24);
-  
+
   #define ISINST(s) (strncmp(inst, (s), sizeof(s)-1) == 0)
   #define IS_A(s) (*(s) == 'a' && *(s+1) == '\0')
   #define IS_C(s) (*(s) == 'c' && *(s+1) == '\0')
   #define ISINST(s) (strncmp(inst, (s), sizeof(s)-1) == 0)
   #define IS_A(s) (*(s) == 'a' && *(s+1) == '\0')
   #define IS_C(s) (*(s) == 'c' && *(s+1) == '\0')
@@ -357,7 +356,7 @@ instructionSize(char *inst, char *op1, char *op2)
 
   /* Based on the current (2003-08-22) code generation for the
      small library, the top instruction probability is:
 
   /* Based on the current (2003-08-22) code generation for the
      small library, the top instruction probability is:
-   
+
        57% mov/movx/movc
         6% push
         6% pop
        57% mov/movx/movc
         6% push
         6% pop
@@ -387,7 +386,7 @@ instructionSize(char *inst, char *op1, char *op2)
       if (IS_A (op2) || IS_Rn (op2) || IS_atRi (op2)) return 2;
       return 3;
     }
       if (IS_A (op2) || IS_Rn (op2) || IS_atRi (op2)) return 2;
       return 3;
     }
-  
+
   if (ISINST ("push")) return 2;
   if (ISINST ("pop")) return 2;
 
   if (ISINST ("push")) return 2;
   if (ISINST ("pop")) return 2;
 
@@ -418,7 +417,7 @@ instructionSize(char *inst, char *op1, char *op2)
   if (ISINST ("acall")) return 2+isflat24;
   if (ISINST ("ajmp")) return 2+isflat24;
 
   if (ISINST ("acall")) return 2+isflat24;
   if (ISINST ("ajmp")) return 2+isflat24;
 
-    
+
   if (ISINST ("add") || ISINST ("addc") || ISINST ("subb") || ISINST ("xch"))
     {
       if (IS_Rn(op2) || IS_atRi(op2)) return 1;
   if (ISINST ("add") || ISINST ("addc") || ISINST ("subb") || ISINST ("xch"))
     {
       if (IS_Rn(op2) || IS_atRi(op2)) return 1;
@@ -471,7 +470,7 @@ ds390newAsmLineNode (int currentDPS)
   aln->regsWritten = NULL;
   aln->initialized = 0;
   aln->currentDPS = currentDPS;
   aln->regsWritten = NULL;
   aln->initialized = 0;
   aln->currentDPS = currentDPS;
-  
+
   return aln;
 }
 
   return aln;
 }
 
@@ -535,7 +534,7 @@ ds390operandCompare (const void *key, const void *member)
   return strcmp((const char *)key, ((ds390operanddata *)member)->name);
 }
 
   return strcmp((const char *)key, ((ds390operanddata *)member)->name);
 }
 
-static void      
+static void
 updateOpRW (asmLineNode *aln, char *op, char *optype, int currentDPS)
 {
   ds390operanddata *opdat;
 updateOpRW (asmLineNode *aln, char *op, char *optype, int currentDPS)
 {
   ds390operanddata *opdat;
@@ -543,7 +542,7 @@ updateOpRW (asmLineNode *aln, char *op, char *optype, int currentDPS)
   int regIdx1 = -1;
   int regIdx2 = -1;
   int regIdx3 = -1;
   int regIdx1 = -1;
   int regIdx2 = -1;
   int regIdx3 = -1;
-  
+
   dot = strchr(op, '.');
   if (dot)
     *dot = '\0';
   dot = strchr(op, '.');
   if (dot)
     *dot = '\0';
@@ -551,7 +550,7 @@ updateOpRW (asmLineNode *aln, char *op, char *optype, int currentDPS)
   opdat = bsearch (op, ds390operandDataTable,
                   sizeof(ds390operandDataTable)/sizeof(ds390operanddata),
                   sizeof(ds390operanddata), ds390operandCompare);
   opdat = bsearch (op, ds390operandDataTable,
                   sizeof(ds390operandDataTable)/sizeof(ds390operanddata),
                   sizeof(ds390operanddata), ds390operandCompare);
-  
+
   if (opdat)
     {
       regIdx1 = opdat->regIdx1;
   if (opdat)
     {
       regIdx1 = opdat->regIdx1;
@@ -572,7 +571,7 @@ updateOpRW (asmLineNode *aln, char *op, char *optype, int currentDPS)
          regIdx3 = DPX1_IDX;
        }
     }
          regIdx3 = DPX1_IDX;
        }
     }
-    
+
   if (strchr(optype,'r'))
     {
       if (regIdx1 >= 0)
   if (strchr(optype,'r'))
     {
       if (regIdx1 >= 0)
@@ -674,7 +673,7 @@ static ds390opcodedata ds390opcodeDataTable[] =
     {"xchd", "",  "",   "rw", "rw"},
     {"xrl",  "",  "",   "rw", "r"},
   };
     {"xchd", "",  "",   "rw", "rw"},
     {"xrl",  "",  "",   "rw", "r"},
   };
-  
+
 static int
 ds390opcodeCompare (const void *key, const void *member)
 {
 static int
 ds390opcodeCompare (const void *key, const void *member)
 {
@@ -692,9 +691,9 @@ asmLineNodeFromLineNode (lineNode *ln, int currentDPS)
   ds390opcodedata *opdat;
 
   aln->initialized = 1;
   ds390opcodedata *opdat;
 
   aln->initialized = 1;
-  
+
   p = ln->line;
   p = ln->line;
-  
+
   while (*p && isspace(*p)) p++;
   for (op = inst, opsize=1; *p; p++)
     {
   while (*p && isspace(*p)) p++;
   for (op = inst, opsize=1; *p; p++)
     {
@@ -708,7 +707,7 @@ asmLineNodeFromLineNode (lineNode *ln, int currentDPS)
 
   if (*p == ';' || *p == ':' || *p == '=')
     return aln;
 
   if (*p == ';' || *p == ':' || *p == '=')
     return aln;
-    
+
   while (*p && isspace(*p)) p++;
   if (*p == '=')
     return aln;
   while (*p && isspace(*p)) p++;
   if (*p == '=')
     return aln;
@@ -719,7 +718,7 @@ asmLineNodeFromLineNode (lineNode *ln, int currentDPS)
         *op++ = tolower(*p), opsize++;
     }
   *op = '\0';
         *op++ = tolower(*p), opsize++;
     }
   *op = '\0';
-  
+
   if (*p == ',') p++;
   for (op = op2, opsize=1; *p && *p != ','; p++)
     {
   if (*p == ',') p++;
   for (op = op2, opsize=1; *p && *p != ','; p++)
     {
@@ -796,7 +795,8 @@ static const char *_linkCmd[] =
   "aslink", "-nf", "\"$1\"", NULL
 };
 
   "aslink", "-nf", "\"$1\"", NULL
 };
 
-/* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */   static const char *_asmCmd[] =
+/* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
+static const char *_asmCmd[] =
 {
   "asx8051", "$l", "$3", "\"$1.asm\"", NULL
 };
 {
   "asx8051", "$l", "$3", "\"$1.asm\"", NULL
 };
@@ -940,31 +940,31 @@ static void _tininative_finaliseOptions (void)
     }
     port->s.fptr_size = 3;
     port->s.gptr_size = 4;
     }
     port->s.fptr_size = 3;
     port->s.gptr_size = 4;
-    
+
     port->stack.isr_overhead += 2;     /* Will save dpx on ISR entry. */
     port->stack.isr_overhead += 2;     /* Will save dpx on ISR entry. */
-    
-    port->stack.call_overhead += 2;    /* This acounts for the extra byte 
+
+    port->stack.call_overhead += 2;    /* This acounts for the extra byte
                                         * of return addres on the stack.
                                         * of return addres on the stack.
-                                        * but is ugly. There must be a 
+                                        * but is ugly. There must be a
                                         * better way.
                                         */
                                         * better way.
                                         */
-    
+
     port->mem.default_local_map = xdata;
     port->mem.default_globl_map = xdata;
     port->mem.default_local_map = xdata;
     port->mem.default_globl_map = xdata;
-    
+
     if (!options.stack10bit) {
        options.stack10bit = 1;
        fprintf(stderr,"TININative supports only stack10bit \n");
     }
     if (!options.stack10bit) {
        options.stack10bit = 1;
        fprintf(stderr,"TININative supports only stack10bit \n");
     }
-    
+
     if (!options.stack_loc) options.stack_loc = 0x400008;
     if (!options.stack_loc) options.stack_loc = 0x400008;
-    
+
     /* generate native code 16*16 mul/div */
     /* generate native code 16*16 mul/div */
-    if (options.useAccelerator) 
+    if (options.useAccelerator)
        port->support.muldiv=2;
        port->support.muldiv=2;
-    else 
+    else
        port->support.muldiv=1;
        port->support.muldiv=1;
-    
+
     /* Fixup the memory map for the stack; it is now in
      * far space and requires a FPOINTER to access it.
      */
     /* Fixup the memory map for the stack; it is now in
      * far space and requires a FPOINTER to access it.
      */
@@ -973,7 +973,7 @@ static void _tininative_finaliseOptions (void)
     options.cc_only =1;
 }
 
     options.cc_only =1;
 }
 
-static int _tininative_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts) 
+static int _tininative_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
 {
     return 1;
 }
 {
     return 1;
 }
@@ -1024,7 +1024,7 @@ static void _tininative_do_assemble (set *asmOptions)
     buildCmdLine(buffer,a390Cmd,dstFileName,NULL,NULL,asmOptions);
     if (my_system(buffer)) {
        exit(1);
     buildCmdLine(buffer,a390Cmd,dstFileName,NULL,NULL,asmOptions);
     if (my_system(buffer)) {
        exit(1);
-    }    
+    }
 }
 
 /* list of key words used by TININative */
 }
 
 /* list of key words used by TININative */
@@ -1099,7 +1099,7 @@ static builtins __tininative_builtins[] = {
     { "System_GetCurrentProcessId","c",0,{NULL}},      /* char System_GetCurrentProcessId() */
     { "System_GetCurrentThreadId","c",0,{NULL}},       /* char System_GetCurrentThreadId() */
     { NULL , NULL,0, {NULL}}                      /* mark end of table */
     { "System_GetCurrentProcessId","c",0,{NULL}},      /* char System_GetCurrentProcessId() */
     { "System_GetCurrentThreadId","c",0,{NULL}},       /* char System_GetCurrentThreadId() */
     { NULL , NULL,0, {NULL}}                      /* mark end of table */
-};    
+};
 
 static const char *_a390Cmd[] =
 {
 
 static const char *_a390Cmd[] =
 {
@@ -1217,7 +1217,7 @@ _ds400_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
 {
     /* We can't generate a static IVT, since the boot rom creates one
      * for us in rom_init.
 {
     /* We can't generate a static IVT, since the boot rom creates one
      * for us in rom_init.
-     * 
+     *
      * we must patch it as part of the C startup.
      */
      fprintf (of, ";\tDS80C400 IVT must be generated at runtime.\n");
      * we must patch it as part of the C startup.
      */
      fprintf (of, ";\tDS80C400 IVT must be generated at runtime.\n");
@@ -1228,7 +1228,7 @@ _ds400_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
      return TRUE;
 }
 
      return TRUE;
 }
 
-    
+
 
 static void
 _ds400_finaliseOptions (void)
 
 static void
 _ds400_finaliseOptions (void)
@@ -1240,7 +1240,7 @@ _ds400_finaliseOptions (void)
   // hackhack: we're a superset of the 390.
   addSet(&preArgvSet, Safe_strdup("-DSDCC_ds390"));
   addSet(&preArgvSet, Safe_strdup("-D__ds390"));
   // hackhack: we're a superset of the 390.
   addSet(&preArgvSet, Safe_strdup("-DSDCC_ds390"));
   addSet(&preArgvSet, Safe_strdup("-D__ds390"));
-    
+
   /* Hack-o-matic: if we are using the flat24 model,
    * adjust pointer sizes.
    */
   /* Hack-o-matic: if we are using the flat24 model,
    * adjust pointer sizes.
    */
@@ -1264,9 +1264,9 @@ _ds400_finaliseOptions (void)
 
     port->stack.isr_overhead += 2;     /* Will save dpx on ISR entry. */
 
 
     port->stack.isr_overhead += 2;     /* Will save dpx on ISR entry. */
 
-    port->stack.call_overhead += 2;    /* This acounts for the extra byte 
+    port->stack.call_overhead += 2;    /* This acounts for the extra byte
                                 * of return addres on the stack.
                                 * of return addres on the stack.
-                                * but is ugly. There must be a 
+                                * but is ugly. There must be a
                                 * better way.
                                 */
 
                                 * better way.
                                 */
 
@@ -1281,11 +1281,11 @@ _ds400_finaliseOptions (void)
        if (!options.stack_loc) options.stack_loc = 0xffdc00;
        // assumes IDM1:0 = 1:0, CMA = 1.
     }
        if (!options.stack_loc) options.stack_loc = 0xffdc00;
        // assumes IDM1:0 = 1:0, CMA = 1.
     }
-    
+
     /* generate native code 16*16 mul/div */
     /* generate native code 16*16 mul/div */
-    if (options.useAccelerator) 
+    if (options.useAccelerator)
            port->support.muldiv=2;
            port->support.muldiv=2;
-    else 
+    else
            port->support.muldiv=1;
 
      /* Fixup the memory map for the stack; it is now in
            port->support.muldiv=1;
 
      /* Fixup the memory map for the stack; it is now in
@@ -1297,10 +1297,10 @@ _ds400_finaliseOptions (void)
     if (options.parms_in_bank1) {
        addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1"));
     }
     if (options.parms_in_bank1) {
        addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1"));
     }
-     
+
     // the DS400 rom calling interface uses register bank 3.
     RegBankUsed[3] = 1;
     // the DS400 rom calling interface uses register bank 3.
     RegBankUsed[3] = 1;
-      
+
   }  /* MODEL_FLAT24 */
 }
 
   }  /* MODEL_FLAT24 */
 }
 
index 618c16516e75d82156e9e5b6bd22091f5958eb65..1bb265e9d067bd5940b25cb962f36ae8649d3f5d 100644 (file)
@@ -1,6 +1,6 @@
 /*------------------------------------------------------------------------
 
 /*------------------------------------------------------------------------
 
-  SDCCralloc.c - source file for register allocation. (8051) specific
+  SDCCralloc.c - source file for register allocation. (DS80C390) specific
 
                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
 
                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
@@ -8,19 +8,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!
 -------------------------------------------------------------------------*/
 
 #include "common.h"
 -------------------------------------------------------------------------*/
 
 #include "common.h"
@@ -47,14 +47,14 @@ static struct
     bitVect *totRegAssigned;    /* final set of LRs that got into registers */
     short blockSpil;
     int slocNum;
     bitVect *totRegAssigned;    /* final set of LRs that got into registers */
     short blockSpil;
     int slocNum;
-    bitVect *funcrUsed;                /* registers used in a function */
+    bitVect *funcrUsed;         /* registers used in a function */
     int stackExtend;
     int dataExtend;
   }
 _G;
 
 /* Shared with gen.c */
     int stackExtend;
     int dataExtend;
   }
 _G;
 
 /* Shared with gen.c */
-int ds390_ptrRegReq;           /* one byte pointer register required */
+int ds390_ptrRegReq;            /* one byte pointer register required */
 
 /* 8051 registers */
 regs regs390[] =
 
 /* 8051 registers */
 regs regs390[] =
@@ -89,7 +89,7 @@ int ds390_nRegs = 13;
 static void spillThis (symbol *);
 static void freeAllRegs ();
 static iCode * packRegsDPTRuse (operand *);
 static void spillThis (symbol *);
 static void freeAllRegs ();
 static iCode * packRegsDPTRuse (operand *);
-static int packRegsDPTRnuse (operand *,int);
+static int packRegsDPTRnuse (operand *,unsigned);
 
 /*-----------------------------------------------------------------*/
 /* allocReg - allocates register of given type                     */
 
 /*-----------------------------------------------------------------*/
 /* allocReg - allocates register of given type                     */
@@ -105,31 +105,31 @@ allocReg (short type)
       /* if type is given as 0 then any
          free register will do */
       if (!type &&
       /* if type is given as 0 then any
          free register will do */
       if (!type &&
-         regs390[i].isFree)
-       {
-         regs390[i].isFree = 0;
-         if (currFunc)
-           currFunc->regsUsed =
-             bitVectSetBit (currFunc->regsUsed, i);
-         return &regs390[i];
-       }
+          regs390[i].isFree)
+        {
+          regs390[i].isFree = 0;
+          if (currFunc)
+            currFunc->regsUsed =
+              bitVectSetBit (currFunc->regsUsed, i);
+          return &regs390[i];
+        }
       /* other wise look for specific type
          of register */
       if (regs390[i].isFree &&
       /* other wise look for specific type
          of register */
       if (regs390[i].isFree &&
-         regs390[i].type == type)
-       {
-         regs390[i].isFree = 0;
-         if (currFunc)
-           currFunc->regsUsed =
-             bitVectSetBit (currFunc->regsUsed, i);
-         return &regs390[i];
-       }
+          regs390[i].type == type)
+        {
+          regs390[i].isFree = 0;
+          if (currFunc)
+            currFunc->regsUsed =
+              bitVectSetBit (currFunc->regsUsed, i);
+          return &regs390[i];
+        }
     }
   return NULL;
 }
 
 /*-----------------------------------------------------------------*/
     }
   return NULL;
 }
 
 /*-----------------------------------------------------------------*/
-/* ds390_regWithIdx - returns pointer to register wit index number       */
+/* ds390_regWithIdx - returns pointer to register with index number*/
 /*-----------------------------------------------------------------*/
 regs *
 ds390_regWithIdx (int idx)
 /*-----------------------------------------------------------------*/
 regs *
 ds390_regWithIdx (int idx)
@@ -141,7 +141,7 @@ ds390_regWithIdx (int idx)
       return &regs390[i];
 
   werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
       return &regs390[i];
 
   werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
-         "regWithIdx not found");
+          "regWithIdx not found");
   exit (1);
 }
 
   exit (1);
 }
 
@@ -151,6 +151,13 @@ ds390_regWithIdx (int idx)
 static void
 freeReg (regs * reg)
 {
 static void
 freeReg (regs * reg)
 {
+  if (!reg)
+    {
+      werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
+              "freeReg - Freeing NULL register");
+      exit (1);
+    }
+
   reg->isFree = 1;
 }
 
   reg->isFree = 1;
 }
 
@@ -189,7 +196,7 @@ nfreeRegsType (int type)
   if (type == REG_PTR)
     {
       if ((nfr = nFreeRegs (type)) == 0)
   if (type == REG_PTR)
     {
       if ((nfr = nFreeRegs (type)) == 0)
-       return nFreeRegs (REG_GPR);
+        return nFreeRegs (REG_GPR);
     }
 
   return nFreeRegs (type);
     }
 
   return nFreeRegs (type);
@@ -217,18 +224,18 @@ computeSpillable (iCode * ic)
 {
   bitVect *spillable;
 
 {
   bitVect *spillable;
 
-  /* spillable live ranges are those that are live at this 
+  /* spillable live ranges are those that are live at this
      point . the following categories need to be subtracted
      point . the following categories need to be subtracted
-     from this set. 
+     from this set.
      a) - those that are already spilt
      b) - if being used by this one
      c) - defined by this one */
 
   spillable = bitVectCopy (ic->rlive);
   spillable =
      a) - those that are already spilt
      b) - if being used by this one
      c) - defined by this one */
 
   spillable = bitVectCopy (ic->rlive);
   spillable =
-    bitVectCplAnd (spillable, _G.spiltSet);    /* those already spilt */
+    bitVectCplAnd (spillable, _G.spiltSet);     /* those already spilt */
   spillable =
   spillable =
-    bitVectCplAnd (spillable, ic->uses);       /* used in this one */
+    bitVectCplAnd (spillable, ic->uses);        /* used in this one */
   bitVectUnSetBit (spillable, ic->defKey);
   spillable = bitVectIntersect (spillable, _G.regAssigned);
   return spillable;
   bitVectUnSetBit (spillable, ic->defKey);
   spillable = bitVectIntersect (spillable, _G.regAssigned);
   return spillable;
@@ -292,7 +299,7 @@ static int
 notUsedInRemaining (symbol * sym, eBBlock * ebp, iCode * ic)
 {
   return ((usedInRemaining (operandFromSymbol (sym), ic) ? 0 : 1) &&
 notUsedInRemaining (symbol * sym, eBBlock * ebp, iCode * ic)
 {
   return ((usedInRemaining (operandFromSymbol (sym), ic) ? 0 : 1) &&
-         allDefsOutOfRange (sym->defs, ebp->fSeq, ebp->lSeq));
+          allDefsOutOfRange (sym->defs, ebp->fSeq, ebp->lSeq));
 }
 
 /*-----------------------------------------------------------------*/
 }
 
 /*-----------------------------------------------------------------*/
@@ -309,7 +316,7 @@ allLRs (symbol * sym, eBBlock * ebp, iCode * ic)
 /*-----------------------------------------------------------------*/
 static set *
 liveRangesWith (bitVect * lrs, int (func) (symbol *, eBBlock *, iCode *),
 /*-----------------------------------------------------------------*/
 static set *
 liveRangesWith (bitVect * lrs, int (func) (symbol *, eBBlock *, iCode *),
-               eBBlock * ebp, iCode * ic)
+                eBBlock * ebp, iCode * ic)
 {
   set *rset = NULL;
   int i;
 {
   set *rset = NULL;
   int i;
@@ -321,19 +328,19 @@ liveRangesWith (bitVect * lrs, int (func) (symbol *, eBBlock *, iCode *),
     {
       symbol *sym;
       if (!bitVectBitValue (lrs, i))
     {
       symbol *sym;
       if (!bitVectBitValue (lrs, i))
-       continue;
+        continue;
 
 
-      /* if we don't find it in the live range 
+      /* if we don't find it in the live range
          hash table we are in serious trouble */
       if (!(sym = hTabItemWithKey (liveRanges, i)))
          hash table we are in serious trouble */
       if (!(sym = hTabItemWithKey (liveRanges, i)))
-       {
-         werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
-                 "liveRangesWith could not find liveRange");
-         exit (1);
-       }
+        {
+          werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
+                  "liveRangesWith could not find liveRange");
+          exit (1);
+        }
 
       if (func (sym, ebp, ic) && bitVectBitValue (_G.regAssigned, sym->key))
 
       if (func (sym, ebp, ic) && bitVectBitValue (_G.regAssigned, sym->key))
-       addSetHead (&rset, sym);
+        addSetHead (&rset, sym);
     }
 
   return rset;
     }
 
   return rset;
@@ -359,12 +366,12 @@ leastUsedLR (set * sset)
       /* if usage is the same then prefer
          the spill the smaller of the two */
       if (lsym->used == sym->used)
       /* if usage is the same then prefer
          the spill the smaller of the two */
       if (lsym->used == sym->used)
-       if (getSize (lsym->type) < getSize (sym->type))
-         sym = lsym;
+        if (getSize (lsym->type) < getSize (sym->type))
+          sym = lsym;
 
       /* if less usage */
       if (lsym->used < sym->used)
 
       /* if less usage */
       if (lsym->used < sym->used)
-       sym = lsym;
+        sym = lsym;
 
     }
 
 
     }
 
@@ -384,7 +391,7 @@ noOverLap (set * itmpStack, symbol * fsym)
   for (sym = setFirstItem (itmpStack); sym;
        sym = setNextItem (itmpStack))
     {
   for (sym = setFirstItem (itmpStack); sym;
        sym = setNextItem (itmpStack))
     {
-       if (bitVectBitValue(sym->clashes,fsym->key)) return 0;
+        if (bitVectBitValue(sym->clashes,fsym->key)) return 0;
     }
   return 1;
 }
     }
   return 1;
 }
@@ -441,24 +448,23 @@ spillLRWithPtrReg (symbol * forSym)
     {
       int j;
 
     {
       int j;
 
-      /* if no registers assigned to it or
-         spilt */
-      /* if it does not overlap with this then 
-         not need to spill it */
+      /* if no registers assigned to it or spilt */
+      /* if it does not overlap this then
+         no need to spill it */
 
       if (lrsym->isspilt || !lrsym->nRegs ||
 
       if (lrsym->isspilt || !lrsym->nRegs ||
-         (lrsym->liveTo < forSym->liveFrom))
-       continue;
+          (lrsym->liveTo < forSym->liveFrom))
+        continue;
 
       /* go thru the registers : if it is either
 
       /* go thru the registers : if it is either
-         r0 or r1 then spil it */
+         r0 or r1 then spill it */
       for (j = 0; j < lrsym->nRegs; j++)
       for (j = 0; j < lrsym->nRegs; j++)
-       if (lrsym->regs[j] == r0 ||
-           lrsym->regs[j] == r1)
-         {
-           spillThis (lrsym);
-           break;
-         }
+        if (lrsym->regs[j] == r0 ||
+            lrsym->regs[j] == r1)
+          {
+            spillThis (lrsym);
+            break;
+          }
     }
 
 }
     }
 
 }
@@ -474,12 +480,12 @@ createStackSpil (symbol * sym)
 
   char slocBuffer[30];
 
 
   char slocBuffer[30];
 
-  /* first go try and find a free one that is already 
+  /* first go try and find a free one that is already
      existing on the stack */
   if (applyToSet (_G.stackSpil, isFree, &sloc, sym))
     {
       /* found a free one : just update & return */
      existing on the stack */
   if (applyToSet (_G.stackSpil, isFree, &sloc, sym))
     {
       /* found a free one : just update & return */
-      sym->usl.spillLoc = sloc;      
+      sym->usl.spillLoc = sloc;
       sym->stackSpil = 1;
       sloc->isFree = 0;
       addSetHead (&sloc->usl.itmpStack, sym);
       sym->stackSpil = 1;
       sloc->isFree = 0;
       addSetHead (&sloc->usl.itmpStack, sym);
@@ -490,11 +496,11 @@ createStackSpil (symbol * sym)
      we need to allocate this on the stack : this is really a
      hack!! but cannot think of anything better at this time */
 
      we need to allocate this on the stack : this is really a
      hack!! but cannot think of anything better at this time */
 
-  if (SNPRINTF (slocBuffer, sizeof(slocBuffer), 
-               "sloc%d", _G.slocNum++) >= sizeof (slocBuffer))
+  if (SNPRINTF (slocBuffer, sizeof(slocBuffer),
+                "sloc%d", _G.slocNum++) >= sizeof (slocBuffer))
     {
       fprintf (stderr, "***Internal error: slocBuffer overflowed: %s:%d\n",
     {
       fprintf (stderr, "***Internal error: slocBuffer overflowed: %s:%d\n",
-              __FILE__, __LINE__);
+               __FILE__, __LINE__);
       exit (1);
     }
 
       exit (1);
     }
 
@@ -518,7 +524,7 @@ createStackSpil (symbol * sym)
      temporarily turn it off ; we also
      turn off memory model to prevent
      the spil from going to the external storage
      temporarily turn it off ; we also
      turn off memory model to prevent
      the spil from going to the external storage
-     and turn off overlaying 
+     and turn off overlaying
    */
 
   useXstack = options.useXstack;
    */
 
   useXstack = options.useXstack;
@@ -533,7 +539,7 @@ createStackSpil (symbol * sym)
   options.useXstack = useXstack;
   options.model = model;
   options.noOverlay = noOverlay;
   options.useXstack = useXstack;
   options.model = model;
   options.noOverlay = noOverlay;
-  sloc->isref = 1;             /* to prevent compiler warning */
+  sloc->isref = 1;              /* to prevent compiler warning */
 
   /* if it is on the stack then update the stack */
   if (IN_STACK (sloc->etype))
 
   /* if it is on the stack then update the stack */
   if (IN_STACK (sloc->etype))
@@ -549,7 +555,7 @@ createStackSpil (symbol * sym)
   sym->usl.spillLoc = sloc;
   sym->stackSpil = 1;
 
   sym->usl.spillLoc = sloc;
   sym->stackSpil = 1;
 
-  /* add it to the set of itempStack set 
+  /* add it to the set of itempStack set
      of the spill location */
   addSetHead (&sloc->usl.itmpStack, sym);
   return sym;
      of the spill location */
   addSetHead (&sloc->usl.itmpStack, sym);
   return sym;
@@ -595,7 +601,6 @@ spillThis (symbol * sym)
   if (!(sym->remat || sym->usl.spillLoc))
     createStackSpil (sym);
 
   if (!(sym->remat || sym->usl.spillLoc))
     createStackSpil (sym);
 
-
   /* mark it has spilt & put it in the spilt set */
   sym->isspilt = sym->spillA = 1;
   _G.spiltSet = bitVectSetBit (_G.spiltSet, sym->key);
   /* mark it has spilt & put it in the spilt set */
   sym->isspilt = sym->spillA = 1;
   _G.spiltSet = bitVectSetBit (_G.spiltSet, sym->key);
@@ -607,8 +612,8 @@ spillThis (symbol * sym)
 
     if (sym->regs[i])
       {
 
     if (sym->regs[i])
       {
-       freeReg (sym->regs[i]);
-       sym->regs[i] = NULL;
+        freeReg (sym->regs[i]);
+        sym->regs[i] = NULL;
       }
 
   /* if spilt on stack then free up r0 & r1
       }
 
   /* if spilt on stack then free up r0 & r1
@@ -651,9 +656,9 @@ selectSpil (iCode * ic, eBBlock * ebp, symbol * forSym)
     {
       sym = leastUsedLR (selectS);
       strncpyz (sym->rname,
     {
       sym = leastUsedLR (selectS);
       strncpyz (sym->rname,
-               sym->usl.spillLoc->rname[0] ?
-                  sym->usl.spillLoc->rname : sym->usl.spillLoc->name,
-               sizeof(sym->rname));
+                sym->usl.spillLoc->rname[0] ?
+                   sym->usl.spillLoc->rname : sym->usl.spillLoc->name,
+                sizeof(sym->rname));
       sym->spildir = 1;
       /* mark it as allocation required */
       sym->usl.spillLoc->allocreq++;
       sym->spildir = 1;
       /* mark it as allocation required */
       sym->usl.spillLoc->allocreq++;
@@ -667,32 +672,32 @@ selectSpil (iCode * ic, eBBlock * ebp, symbol * forSym)
       /* check if there are any live ranges allocated
          to registers that are not used in this block */
       if (!_G.blockSpil && (selectS = liveRangesWith (lrcs, notUsedInBlock, ebp, ic)))
       /* check if there are any live ranges allocated
          to registers that are not used in this block */
       if (!_G.blockSpil && (selectS = liveRangesWith (lrcs, notUsedInBlock, ebp, ic)))
-       {
-         sym = leastUsedLR (selectS);
-         /* if this is not rematerializable */
-         if (!sym->remat)
-           {
-             _G.blockSpil++;
-             sym->blockSpil = 1;
-           }
-         return sym;
-       }
+        {
+          sym = leastUsedLR (selectS);
+          /* if this is not rematerializable */
+          if (!sym->remat)
+            {
+              _G.blockSpil++;
+              sym->blockSpil = 1;
+            }
+          return sym;
+        }
 
       /* check if there are any live ranges that not
          used in the remainder of the block */
       if (!_G.blockSpil && (selectS = liveRangesWith (lrcs, notUsedInRemaining, ebp, ic)))
 
       /* check if there are any live ranges that not
          used in the remainder of the block */
       if (!_G.blockSpil && (selectS = liveRangesWith (lrcs, notUsedInRemaining, ebp, ic)))
-       {
-         sym = leastUsedLR (selectS);
-         if (sym != forSym)
-           {
-             if (!sym->remat)
-               {
-                 sym->remainSpil = 1;
-                 _G.blockSpil++;
-               }
-             return sym;
-           }
-       }
+        {
+          sym = leastUsedLR (selectS);
+          if (sym != forSym)
+            {
+              if (!sym->remat)
+                {
+                  sym->remainSpil = 1;
+                  _G.blockSpil++;
+                }
+              return sym;
+            }
+        }
     }
 
   /* find live ranges with spillocation && not used as pointers */
     }
 
   /* find live ranges with spillocation && not used as pointers */
@@ -759,22 +764,22 @@ spilSomething (iCode * ic, eBBlock * ebp, symbol * forSym)
     if (ssym->regs[i])
       freeReg (ssym->regs[i]);
 
     if (ssym->regs[i])
       freeReg (ssym->regs[i]);
 
-  /* if spilt on stack then free up r0 & r1 
+  /* if spilt on stack then free up r0 & r1
      if they could have been assigned to as gprs */
   if (!ds390_ptrRegReq && isSpiltOnStack (ssym) && !options.stack10bit)
     {
      if they could have been assigned to as gprs */
   if (!ds390_ptrRegReq && isSpiltOnStack (ssym) && !options.stack10bit)
     {
-           ds390_ptrRegReq++;
+            ds390_ptrRegReq++;
       spillLRWithPtrReg (ssym);
     }
 
       spillLRWithPtrReg (ssym);
     }
 
-  /* if this was a block level spil then insert push & pop 
+  /* if this was a block level spil then insert push & pop
      at the start & end of block respectively */
   if (ssym->blockSpil)
     {
       iCode *nic = newiCode (IPUSH, operandFromSymbol (ssym), NULL);
       /* add push to the start of the block */
       addiCodeToeBBlock (ebp, nic, (ebp->sch->op == LABEL ?
      at the start & end of block respectively */
   if (ssym->blockSpil)
     {
       iCode *nic = newiCode (IPUSH, operandFromSymbol (ssym), NULL);
       /* add push to the start of the block */
       addiCodeToeBBlock (ebp, nic, (ebp->sch->op == LABEL ?
-                                   ebp->sch->next : ebp->sch));
+                                    ebp->sch->next : ebp->sch));
       nic = newiCode (IPOP, operandFromSymbol (ssym), NULL);
       /* add pop to the end of the block */
       addiCodeToeBBlock (ebp, nic, NULL);
       nic = newiCode (IPOP, operandFromSymbol (ssym), NULL);
       /* add pop to the end of the block */
       addiCodeToeBBlock (ebp, nic, NULL);
@@ -827,8 +832,8 @@ tryAgain:
   for (j=0; j<=sym->nRegs; j++)
     if (sym->regs[j])
       sym->regs[j]->isFree = 0;
   for (j=0; j<=sym->nRegs; j++)
     if (sym->regs[j])
       sym->regs[j]->isFree = 0;
-      
-  /* this looks like an infinite loop but 
+
+  /* this looks like an infinite loop but
      in really selectSpil will abort  */
   goto tryAgain;
 }
      in really selectSpil will abort  */
   goto tryAgain;
 }
@@ -859,8 +864,8 @@ tryAgain:
   for (j=0; j<=sym->nRegs; j++)
     if (sym->regs[j])
       sym->regs[j]->isFree = 0;
   for (j=0; j<=sym->nRegs; j++)
     if (sym->regs[j])
       sym->regs[j]->isFree = 0;
-      
-  /* this looks like an infinite loop but 
+
+  /* this looks like an infinite loop but
      in really selectSpil will abort  */
   goto tryAgain;
 }
      in really selectSpil will abort  */
   goto tryAgain;
 }
@@ -939,88 +944,88 @@ deassignLRs (iCode * ic, eBBlock * ebp)
       symbol *psym = NULL;
       /* if it does not end here */
       if (sym->liveTo > ic->seq)
       symbol *psym = NULL;
       /* if it does not end here */
       if (sym->liveTo > ic->seq)
-       continue;
+        continue;
 
 
-      /* if it was spilt on stack then we can 
+      /* if it was spilt on stack then we can
          mark the stack spil location as free */
       if (sym->isspilt)
          mark the stack spil location as free */
       if (sym->isspilt)
-       {
-         if (sym->stackSpil)
-           {
-             sym->usl.spillLoc->isFree = 1;
-             sym->stackSpil = 0;
-           }
-         continue;
-       }
+        {
+          if (sym->stackSpil)
+            {
+              sym->usl.spillLoc->isFree = 1;
+              sym->stackSpil = 0;
+            }
+          continue;
+        }
 
       if (!bitVectBitValue (_G.regAssigned, sym->key))
 
       if (!bitVectBitValue (_G.regAssigned, sym->key))
-       continue;
+        continue;
 
       /* special case check if this is an IFX &
 
       /* special case check if this is an IFX &
-         the privious one was a pop and the 
+         the privious one was a pop and the
          previous one was not spilt then keep track
          of the symbol */
       if (ic->op == IFX && ic->prev &&
          previous one was not spilt then keep track
          of the symbol */
       if (ic->op == IFX && ic->prev &&
-         ic->prev->op == IPOP &&
-         !ic->prev->parmPush &&
-         !OP_SYMBOL (IC_LEFT (ic->prev))->isspilt)
-       psym = OP_SYMBOL (IC_LEFT (ic->prev));
+          ic->prev->op == IPOP &&
+          !ic->prev->parmPush &&
+          !OP_SYMBOL (IC_LEFT (ic->prev))->isspilt)
+        psym = OP_SYMBOL (IC_LEFT (ic->prev));
 
       if (sym->nRegs)
 
       if (sym->nRegs)
-       {
-         int i = 0;
-
-         bitVectUnSetBit (_G.regAssigned, sym->key);
-
-         /* if the result of this one needs registers
-            and does not have it then assign it right
-            away */
-         if (IC_RESULT (ic) &&
-             !(SKIP_IC2 (ic) ||        /* not a special icode */
-               ic->op == JUMPTABLE ||
-               ic->op == IFX ||
-               ic->op == IPUSH ||
-               ic->op == IPOP ||
-               ic->op == RETURN ||
-               POINTER_SET (ic)) &&
-             (result = OP_SYMBOL (IC_RESULT (ic))) &&  /* has a result */
-             result->liveTo > ic->seq &&       /* and will live beyond this */
-             result->liveTo <= ebp->lSeq &&    /* does not go beyond this block */
-             result->regType == sym->regType &&        /* same register types */
-             result->nRegs &&  /* which needs registers */
-             !result->isspilt &&       /* and does not already have them */
-             !result->remat &&
-             !bitVectBitValue (_G.regAssigned, result->key) &&
-         /* the number of free regs + number of regs in this LR
-            can accomodate the what result Needs */
-             ((nfreeRegsType (result->regType) +
-               sym->nRegs) >= result->nRegs)
-           )
-           {
-
-             for (i = 0; i < result->nRegs; i++)
-               if (i < sym->nRegs)
-                 result->regs[i] = sym->regs[i];
-               else
-                 result->regs[i] = getRegGpr (ic, ebp, result);
-
-             _G.regAssigned = bitVectSetBit (_G.regAssigned, result->key);
-             _G.totRegAssigned = bitVectSetBit (_G.totRegAssigned, result->key);
-
-           }
-
-         /* free the remaining */
-         for (; i < sym->nRegs; i++)
-           {
-             if (psym)
-               {
-                 if (!symHasReg (psym, sym->regs[i]))
-                   freeReg (sym->regs[i]);
-               }
-             else
-               freeReg (sym->regs[i]);
-           }
-       }
+        {
+          int i = 0;
+
+          bitVectUnSetBit (_G.regAssigned, sym->key);
+
+          /* if the result of this one needs registers
+             and does not have it then assign it right
+             away */
+          if (IC_RESULT (ic) &&
+              !(SKIP_IC2 (ic) ||        /* not a special icode */
+                ic->op == JUMPTABLE ||
+                ic->op == IFX ||
+                ic->op == IPUSH ||
+                ic->op == IPOP ||
+                ic->op == RETURN ||
+                POINTER_SET (ic)) &&
+              (result = OP_SYMBOL (IC_RESULT (ic))) &&  /* has a result */
+              result->liveTo > ic->seq &&       /* and will live beyond this */
+              result->liveTo <= ebp->lSeq &&    /* does not go beyond this block */
+              result->regType == sym->regType &&        /* same register types */
+              result->nRegs &&  /* which needs registers */
+              !result->isspilt &&       /* and does not already have them */
+              !result->remat &&
+              !bitVectBitValue (_G.regAssigned, result->key) &&
+          /* the number of free regs + number of regs in this LR
+             can accomodate the what result Needs */
+              ((nfreeRegsType (result->regType) +
+                sym->nRegs) >= result->nRegs)
+            )
+            {
+
+              for (i = 0; i < result->nRegs; i++)
+                if (i < sym->nRegs)
+                  result->regs[i] = sym->regs[i];
+                else
+                  result->regs[i] = getRegGpr (ic, ebp, result);
+
+              _G.regAssigned = bitVectSetBit (_G.regAssigned, result->key);
+              _G.totRegAssigned = bitVectSetBit (_G.totRegAssigned, result->key);
+
+            }
+
+          /* free the remaining */
+          for (; i < sym->nRegs; i++)
+            {
+              if (psym)
+                {
+                  if (!symHasReg (psym, sym->regs[i]))
+                    freeReg (sym->regs[i]);
+                }
+              else
+                freeReg (sym->regs[i]);
+            }
+        }
     }
 }
 
     }
 }
 
@@ -1057,27 +1062,27 @@ willCauseSpill (int nr, int rt)
      of te type required */
   if (rt == REG_PTR)
     {
      of te type required */
   if (rt == REG_PTR)
     {
-      /* special case for pointer type 
-         if pointer type not avlb then 
+      /* special case for pointer type
+         if pointer type not avlb then
          check for type gpr */
       if (nFreeRegs (rt) >= nr)
          check for type gpr */
       if (nFreeRegs (rt) >= nr)
-       return 0;
+        return 0;
       if (nFreeRegs (REG_GPR) >= nr)
       if (nFreeRegs (REG_GPR) >= nr)
-       return 0;
+        return 0;
     }
   else
     {
       if (ds390_ptrRegReq)
     }
   else
     {
       if (ds390_ptrRegReq)
-       {
-         if (nFreeRegs (rt) >= nr)
-           return 0;
-       }
+        {
+          if (nFreeRegs (rt) >= nr)
+            return 0;
+        }
       else
       else
-       {
-         if (nFreeRegs (REG_PTR) +
-             nFreeRegs (REG_GPR) >= nr)
-           return 0;
-       }
+        {
+          if (nFreeRegs (REG_PTR) +
+              nFreeRegs (REG_GPR) >= nr)
+            return 0;
+        }
     }
 
   /* it will cause a spil */
     }
 
   /* it will cause a spil */
@@ -1105,13 +1110,13 @@ again:
   for (i = 0; i < count; i++)
     {
       for (j = 0; j < count; j++)
   for (i = 0; i < count; i++)
     {
       for (j = 0; j < count; j++)
-       {
-         if (result->regs[i] == opsym->regs[j] && i != j)
-           {
-             shared = 1;
-             goto xchgPositions;
-           }
-       }
+        {
+          if (result->regs[i] == opsym->regs[j] && i != j)
+            {
+              shared = 1;
+              goto xchgPositions;
+            }
+        }
     }
 xchgPositions:
   if (shared)
     }
 xchgPositions:
   if (shared)
@@ -1122,25 +1127,25 @@ xchgPositions:
       change ++;
       goto again;
     }
       change ++;
       goto again;
     }
-  return change ;
+  return change;
 }
 
 /*-----------------------------------------------------------------*/
 /* unusedLRS - returns a bitVector of liveranges not used in 'ebp' */
 /*-----------------------------------------------------------------*/
 }
 
 /*-----------------------------------------------------------------*/
 /* unusedLRS - returns a bitVector of liveranges not used in 'ebp' */
 /*-----------------------------------------------------------------*/
-bitVect *unusedLRs (eBBlock *ebp) 
+bitVect *unusedLRs (eBBlock *ebp)
 {
     bitVect *ret = NULL;
     symbol *sym;
     int key;
 {
     bitVect *ret = NULL;
     symbol *sym;
     int key;
-    
+
     if (!ebp) return NULL;
     if (!ebp) return NULL;
-    for (sym = hTabFirstItem(liveRanges,&key); sym ; 
-        sym = hTabNextItem(liveRanges,&key)) {
-       
-       if (notUsedInBlock(sym,ebp,NULL)) {
-           ret = bitVectSetBit(ret,sym->key);
-       }
+    for (sym = hTabFirstItem(liveRanges,&key); sym ;
+         sym = hTabNextItem(liveRanges,&key)) {
+
+        if (notUsedInBlock(sym,ebp,NULL)) {
+            ret = bitVectSetBit(ret,sym->key);
+        }
     }
 
     return ret;
     }
 
     return ret;
@@ -1148,7 +1153,7 @@ bitVect *unusedLRs (eBBlock *ebp)
 
 /*-----------------------------------------------------------------*/
 /* deassignUnsedLRs - if this baisc block ends in a return then    */
 
 /*-----------------------------------------------------------------*/
 /* deassignUnsedLRs - if this baisc block ends in a return then    */
-/*                   deassign symbols not used in this block      */
+/*                    deassign symbols not used in this block      */
 /*-----------------------------------------------------------------*/
 bitVect *deassignUnsedLRs(eBBlock *ebp)
 {
 /*-----------------------------------------------------------------*/
 bitVect *deassignUnsedLRs(eBBlock *ebp)
 {
@@ -1157,36 +1162,36 @@ bitVect *deassignUnsedLRs(eBBlock *ebp)
 
     switch (returnAtEnd(ebp)) {
     case 2: /* successor block ends in a return */
 
     switch (returnAtEnd(ebp)) {
     case 2: /* successor block ends in a return */
-       unused = unusedLRs((eBBlock *) setFirstItem(ebp->succList));
-       /* fall thru */
+        unused = unusedLRs((eBBlock *) setFirstItem(ebp->succList));
+        /* fall thru */
     case 1: /* this block ends in a return */
     case 1: /* this block ends in a return */
-       unused = bitVectIntersect(unused,unusedLRs(ebp));
-       break;
+        unused = bitVectIntersect(unused,unusedLRs(ebp));
+        break;
     }
     }
-    
+
     if (unused) {
     if (unused) {
-       for (i = 0 ; i < unused->size ; i++ ) {
-
-           /* if unused  */
-           if (bitVectBitValue(unused,i)) {
-
-               /* if assigned to registers */
-               if (bitVectBitValue(_G.regAssigned,i)) {
-                   symbol *sym;
-                   int j;
-                   
-                   sym = hTabItemWithKey(liveRanges,i);
-                   /* remove it from regassigned & mark the
-                      register free */
-                   bitVectUnSetBit(_G.regAssigned,i);
-                   for (j = 0 ; j < sym->nRegs; j++)
-                       freeReg(sym->regs[j]);
-               } else {
-                   /* not assigned to registers : remove from set*/
-                   bitVectUnSetBit(unused,i);
-               }
-           }
-       }
+        for (i = 0 ; i < unused->size ; i++ ) {
+
+            /* if unused  */
+            if (bitVectBitValue(unused,i)) {
+
+                /* if assigned to registers */
+                if (bitVectBitValue(_G.regAssigned,i)) {
+                    symbol *sym;
+                    int j;
+
+                    sym = hTabItemWithKey(liveRanges,i);
+                    /* remove it from regassigned & mark the
+                       register free */
+                    bitVectUnSetBit(_G.regAssigned,i);
+                    for (j = 0 ; j < sym->nRegs; j++)
+                        freeReg(sym->regs[j]);
+                } else {
+                    /* not assigned to registers : remove from set*/
+                    bitVectUnSetBit(unused,i);
+                }
+            }
+        }
     }
     return unused;
 }
     }
     return unused;
 }
@@ -1200,19 +1205,19 @@ void reassignUnusedLRs (bitVect *unused)
     if (!unused) return ;
 
     for (i = 0 ; i < unused->size ; i++ ) {
     if (!unused) return ;
 
     for (i = 0 ; i < unused->size ; i++ ) {
-       /* if unused : means it was assigned to registers before */
-       if (bitVectBitValue(unused,i)) {
-           symbol *sym;
-           int j;
-           
-           /* put it back into reg set*/
-           bitVectSetBit(_G.regAssigned,i) ;
-
-           sym = hTabItemWithKey(liveRanges,i);
-           /* makr registers busy */
-           for (j = 0 ; j < sym->nRegs; j++)
-               sym->regs[j]->isFree = 0;
-       }
+        /* if unused : means it was assigned to registers before */
+        if (bitVectBitValue(unused,i)) {
+            symbol *sym;
+            int j;
+
+            /* put it back into reg set*/
+            bitVectSetBit(_G.regAssigned,i) ;
+
+            sym = hTabItemWithKey(liveRanges,i);
+            /* makr registers busy */
+            for (j = 0 ; j < sym->nRegs; j++)
+                sym->regs[j]->isFree = 0;
+        }
     }
 }
 
     }
 }
 
@@ -1226,17 +1231,17 @@ static void
 verifyRegsAssigned (operand *op, iCode * ic)
 {
   symbol * sym;
 verifyRegsAssigned (operand *op, iCode * ic)
 {
   symbol * sym;
-  
+
   if (!op) return;
   if (!IS_ITEMP (op)) return;
   if (!op) return;
   if (!IS_ITEMP (op)) return;
-  
+
   sym = OP_SYMBOL (op);
   if (sym->isspilt) return;
   if (!sym->nRegs) return;
   if (sym->regs[0]) return;
   sym = OP_SYMBOL (op);
   if (sym->isspilt) return;
   if (!sym->nRegs) return;
   if (sym->regs[0]) return;
-  
-  werrorfl (ic->filename, ic->lineno, W_LOCAL_NOINIT, 
-           sym->prereqv ? sym->prereqv->name : sym->name);
+
+  werrorfl (ic->filename, ic->lineno, W_LOCAL_NOINIT,
+            sym->prereqv ? sym->prereqv->name : sym->name);
   spillThis (sym);
 }
 
   spillThis (sym);
 }
 
@@ -1257,204 +1262,203 @@ serialRegAssign (eBBlock ** ebbs, int count)
       bitVect *unusedLRs = NULL;
 
       if (ebbs[i]->noPath &&
       bitVect *unusedLRs = NULL;
 
       if (ebbs[i]->noPath &&
-         (ebbs[i]->entryLabel != entryLabel &&
-          ebbs[i]->entryLabel != returnLabel))
-       continue;
-      
+          (ebbs[i]->entryLabel != entryLabel &&
+           ebbs[i]->entryLabel != returnLabel))
+        continue;
+
       unusedLRs = deassignUnsedLRs(ebbs[i]);
       unusedLRs = deassignUnsedLRs(ebbs[i]);
-      
+
       /* of all instructions do */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
       /* of all instructions do */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
-       {
-
-         /* if this is an ipop that means some live
-            range will have to be assigned again */
-         if (ic->op == IPOP)
-           reassignLR (IC_LEFT (ic));
-
-         /* if result is present && is a true symbol */
-         if (IC_RESULT (ic) && ic->op != IFX &&
-             IS_TRUE_SYMOP (IC_RESULT (ic)))
-           OP_SYMBOL (IC_RESULT (ic))->allocreq++;
-
-         /* take away registers from live
-            ranges that end at this instruction */
-         deassignLRs (ic, ebbs[i]);
-
-         /* some don't need registers */
-         if (SKIP_IC2 (ic) ||
-             ic->op == JUMPTABLE ||
-             ic->op == IFX ||
-             ic->op == IPUSH ||
-             ic->op == IPOP ||
-             (IC_RESULT (ic) && POINTER_SET (ic)))
-           continue;
-
-         /* now we need to allocate registers
-            only for the result */
-         if (IC_RESULT (ic))
-           {
-             symbol *sym = OP_SYMBOL (IC_RESULT (ic));
-             bitVect *spillable;
-             int willCS;
-             int j;
-             int ptrRegSet = 0;
-
-             /* if it does not need or is spilt 
-                or is already assigned to registers
-                or will not live beyond this instructions */
-             if (!sym->nRegs ||
-                 sym->isspilt ||
-                 bitVectBitValue (_G.regAssigned, sym->key) ||
-                 sym->liveTo <= ic->seq)
-               continue;
-
-             /* if some liverange has been spilt at the block level
-                and this one live beyond this block then spil this
-                to be safe */
-             if (_G.blockSpil && sym->liveTo > ebbs[i]->lSeq)
-               {
-                 spillThis (sym);
-                 continue;
-               }
-             /* if trying to allocate this will cause
-                a spill and there is nothing to spill 
-                or this one is rematerializable then
-                spill this one */
-             willCS = willCauseSpill (sym->nRegs, sym->regType);
-             spillable = computeSpillable (ic);
-             if (sym->remat ||
-                 (willCS && bitVectIsZero (spillable)))
-               {
-
-                 spillThis (sym);
-                 continue;
-
-               }
-
-             /* If the live range preceeds the point of definition 
-                then ideally we must take into account registers that 
-                have been allocated after sym->liveFrom but freed
-                before ic->seq. This is complicated, so spill this
-                symbol instead and let fillGaps handle the allocation. */
-             if (sym->liveFrom < ic->seq)
-               {
-                   spillThis (sym);
-                   continue;                 
-               }
-
-             /* if it has a spillocation & is used less than
-                all other live ranges then spill this */
-               if (willCS) {
-                   if (sym->usl.spillLoc) {
-                       symbol *leastUsed = leastUsedLR (liveRangesWith (spillable,
-                                                                        allLRs, ebbs[i], ic));
-                       if (leastUsed && leastUsed->used > sym->used) {
-                           spillThis (sym);
-                           continue;
-                       }
-                   } else {
-                       /* if none of the liveRanges have a spillLocation then better
-                          to spill this one than anything else already assigned to registers */
-                       if (liveRangesWith(spillable,noSpilLoc,ebbs[i],ic)) {
-                           /* if this is local to this block then we might find a block spil */
-                           if (!(sym->liveFrom >= ebbs[i]->fSeq && sym->liveTo <= ebbs[i]->lSeq)) {
-                               spillThis (sym);
-                               continue;
-                           }
-                       }
-                   }
-               }
-
-             /* if we need ptr regs for the right side
-                then mark it */
-             if (POINTER_GET (ic) && IS_SYMOP (IC_LEFT (ic))
-                 && getSize (OP_SYMBOL (IC_LEFT (ic))->type)
-                 <= (unsigned) PTRSIZE)
-               {
-                 ds390_ptrRegReq++;
-                 ptrRegSet = 1;
-               }
-             /* else we assign registers to it */
-             _G.regAssigned = bitVectSetBit (_G.regAssigned, sym->key);
-             _G.totRegAssigned = bitVectSetBit (_G.totRegAssigned, sym->key);
-
-             for (j = 0; j < sym->nRegs; j++)
-               {
-                 if (sym->regType == REG_PTR)
-                   sym->regs[j] = getRegPtr (ic, ebbs[i], sym);
-                 else
-                   sym->regs[j] = getRegGpr (ic, ebbs[i], sym);
-
-                 /* if the allocation falied which means
-                    this was spilt then break */
-                 if (!sym->regs[j])
-                   break;
-               }
-             
+        {
+
+          /* if this is an ipop that means some live
+             range will have to be assigned again */
+          if (ic->op == IPOP)
+            reassignLR (IC_LEFT (ic));
+
+          /* if result is present && is a true symbol */
+          if (IC_RESULT (ic) && ic->op != IFX &&
+              IS_TRUE_SYMOP (IC_RESULT (ic)))
+            OP_SYMBOL (IC_RESULT (ic))->allocreq++;
+
+          /* take away registers from live
+             ranges that end at this instruction */
+          deassignLRs (ic, ebbs[i]);
+
+          /* some don't need registers */
+          if (SKIP_IC2 (ic) ||
+              ic->op == JUMPTABLE ||
+              ic->op == IFX ||
+              ic->op == IPUSH ||
+              ic->op == IPOP ||
+              (IC_RESULT (ic) && POINTER_SET (ic)))
+            continue;
+
+          /* now we need to allocate registers
+             only for the result */
+          if (IC_RESULT (ic))
+            {
+              symbol *sym = OP_SYMBOL (IC_RESULT (ic));
+              bitVect *spillable;
+              int willCS;
+              int j;
+              int ptrRegSet = 0;
+
+              /* if it does not need or is spilt
+                 or is already assigned to registers
+                 or will not live beyond this instructions */
+              if (!sym->nRegs ||
+                  sym->isspilt ||
+                  bitVectBitValue (_G.regAssigned, sym->key) ||
+                  sym->liveTo <= ic->seq)
+                continue;
+
+              /* if some liverange has been spilt at the block level
+                 and this one live beyond this block then spil this
+                 to be safe */
+              if (_G.blockSpil && sym->liveTo > ebbs[i]->lSeq)
+                {
+                  spillThis (sym);
+                  continue;
+                }
+              /* if trying to allocate this will cause
+                 a spill and there is nothing to spill
+                 or this one is rematerializable then
+                 spill this one */
+              willCS = willCauseSpill (sym->nRegs, sym->regType);
+              spillable = computeSpillable (ic);
+              if (sym->remat ||
+                  (willCS && bitVectIsZero (spillable)))
+                {
+
+                  spillThis (sym);
+                  continue;
+
+                }
+
+              /* If the live range preceeds the point of definition
+                 then ideally we must take into account registers that
+                 have been allocated after sym->liveFrom but freed
+                 before ic->seq. This is complicated, so spill this
+                 symbol instead and let fillGaps handle the allocation. */
+              if (sym->liveFrom < ic->seq)
+                {
+                    spillThis (sym);
+                    continue;
+                }
+
+              /* if it has a spillocation & is used less than
+                 all other live ranges then spill this */
+                if (willCS) {
+                    if (sym->usl.spillLoc) {
+                        symbol *leastUsed = leastUsedLR (liveRangesWith (spillable,
+                                                                         allLRs, ebbs[i], ic));
+                        if (leastUsed && leastUsed->used > sym->used) {
+                            spillThis (sym);
+                            continue;
+                        }
+                    } else {
+                        /* if none of the liveRanges have a spillLocation then better
+                           to spill this one than anything else already assigned to registers */
+                        if (liveRangesWith(spillable,noSpilLoc,ebbs[i],ic)) {
+                            /* if this is local to this block then we might find a block spil */
+                            if (!(sym->liveFrom >= ebbs[i]->fSeq && sym->liveTo <= ebbs[i]->lSeq)) {
+                                spillThis (sym);
+                                continue;
+                            }
+                        }
+                    }
+                }
+
+              /* if we need ptr regs for the right side
+                 then mark it */
+              if (POINTER_GET (ic) && IS_SYMOP (IC_LEFT (ic))
+                  && getSize (OP_SYMBOL (IC_LEFT (ic))->type)
+                  <= (unsigned) PTRSIZE)
+                {
+                  ds390_ptrRegReq++;
+                  ptrRegSet = 1;
+                }
+              /* else we assign registers to it */
+              _G.regAssigned = bitVectSetBit (_G.regAssigned, sym->key);
+              _G.totRegAssigned = bitVectSetBit (_G.totRegAssigned, sym->key);
+
+              for (j = 0; j < sym->nRegs; j++)
+                {
+                  if (sym->regType == REG_PTR)
+                    sym->regs[j] = getRegPtr (ic, ebbs[i], sym);
+                  else
+                    sym->regs[j] = getRegGpr (ic, ebbs[i], sym);
+
+                  /* if the allocation falied which means
+                     this was spilt then break */
+                  if (!sym->regs[j])
+                    break;
+                }
+
               /* if it shares registers with operands make sure
               /* if it shares registers with operands make sure
-                that they are in the same position */
-             if (!POINTER_SET(ic) && !POINTER_GET(ic))
+                 that they are in the same position */
+              if (!POINTER_SET(ic) && !POINTER_GET(ic))
                 {
                 {
-                 if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) &&
-                     OP_SYMBOL (IC_LEFT (ic))->nRegs)
+                  if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) &&
+                      OP_SYMBOL (IC_LEFT (ic))->nRegs)
                     {
                     {
-                     positionRegs (OP_SYMBOL (IC_RESULT (ic)),
-                                   OP_SYMBOL (IC_LEFT (ic)));
-                   }
-                 /* do the same for the right operand */
-                 if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) &&
-                     OP_SYMBOL (IC_RIGHT (ic))->nRegs)
+                      positionRegs (OP_SYMBOL (IC_RESULT (ic)),
+                                    OP_SYMBOL (IC_LEFT (ic)));
+                    }
+                  /* do the same for the right operand */
+                  if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) &&
+                      OP_SYMBOL (IC_RIGHT (ic))->nRegs)
                     {
                     {
-                     positionRegs (OP_SYMBOL (IC_RESULT (ic)),
-                                   OP_SYMBOL (IC_RIGHT (ic)));
-                   }
+                      positionRegs (OP_SYMBOL (IC_RESULT (ic)),
+                                    OP_SYMBOL (IC_RIGHT (ic)));
+                    }
                 }
 
                 }
 
-             if (ptrRegSet)
-               {
-                 ds390_ptrRegReq--;
-                 ptrRegSet = 0;
-               }
+              if (ptrRegSet)
+                {
+                  ds390_ptrRegReq--;
+                  ptrRegSet = 0;
+                }
 
 
-           }
-       }
+            }
+        }
       reassignUnusedLRs(unusedLRs);
     }
 
     /* Check for and fix any problems with uninitialized operands */
     for (i = 0; i < count; i++)
       {
       reassignUnusedLRs(unusedLRs);
     }
 
     /* Check for and fix any problems with uninitialized operands */
     for (i = 0; i < count; i++)
       {
-       iCode *ic;
-
-       if (ebbs[i]->noPath &&
-           (ebbs[i]->entryLabel != entryLabel &&
-            ebbs[i]->entryLabel != returnLabel))
-           continue;
-
-       for (ic = ebbs[i]->sch; ic; ic = ic->next)
-         {
-           if (SKIP_IC2 (ic))
-             continue;
-
-           if (ic->op == IFX)
-             {
-               verifyRegsAssigned (IC_COND (ic), ic);
-               continue;
-             }
-
-           if (ic->op == JUMPTABLE)
-             {
-               verifyRegsAssigned (IC_JTCOND (ic), ic);
-               continue;
-             }
-
-           verifyRegsAssigned (IC_RESULT (ic), ic);
-           verifyRegsAssigned (IC_LEFT (ic), ic);
-           verifyRegsAssigned (IC_RIGHT (ic), ic);
+        iCode *ic;
+
+        if (ebbs[i]->noPath &&
+            (ebbs[i]->entryLabel != entryLabel &&
+             ebbs[i]->entryLabel != returnLabel))
+            continue;
+
+        for (ic = ebbs[i]->sch; ic; ic = ic->next)
+          {
+            if (SKIP_IC2 (ic))
+              continue;
+
+            if (ic->op == IFX)
+              {
+                verifyRegsAssigned (IC_COND (ic), ic);
+                continue;
+              }
+
+            if (ic->op == JUMPTABLE)
+              {
+                verifyRegsAssigned (IC_JTCOND (ic), ic);
+                continue;
+              }
+
+            verifyRegsAssigned (IC_RESULT (ic), ic);
+            verifyRegsAssigned (IC_LEFT (ic), ic);
+            verifyRegsAssigned (IC_RIGHT (ic), ic);
           }
           }
-      }    
-    
+      }
 }
 
 /*-----------------------------------------------------------------*/
 }
 
 /*-----------------------------------------------------------------*/
@@ -1463,170 +1467,170 @@ serialRegAssign (eBBlock ** ebbs, int count)
 static void fillGaps()
 {
     symbol *sym =NULL;
 static void fillGaps()
 {
     symbol *sym =NULL;
-    int key =0;    
+    int key =0;
     int loop = 0, change;
     int pass;
 
     if (getenv("DISABLE_FILL_GAPS")) return;
     int loop = 0, change;
     int pass;
 
     if (getenv("DISABLE_FILL_GAPS")) return;
-    
+
     /* First try to do DPTRuse once more since now we know what got into
     /* First try to do DPTRuse once more since now we know what got into
-       registers */ 
-    
+       registers */
+
     while (loop++ < 10) {
     while (loop++ < 10) {
-       change = 0;
-
-       for (sym = hTabFirstItem(liveRanges,&key) ; sym ; 
-            sym = hTabNextItem(liveRanges,&key)) {
-           int size = getSize(sym->type);
-
-           if (sym->liveFrom == sym->liveTo) continue;
-
-           if (sym->uptr && sym->dptr==0 && !sym->ruonly && 
-               size < 4 && size > 1) {
-
-               if (packRegsDPTRuse(operandFromSymbol(sym))) {
-                   
-                   /* if this was ssigned to registers then */
-                   if (bitVectBitValue(_G.totRegAssigned,sym->key)) {
-                       /* take it out of the register assigned set */
-                       bitVectUnSetBit(_G.totRegAssigned,sym->key);
-                   } else if (sym->usl.spillLoc) {
-                       sym->usl.spillLoc->allocreq--;
-                       sym->usl.spillLoc = NULL;
-                   }
-                   
-                   sym->nRegs = 0;                 
-                   sym->isspilt = sym->spillA = 0;
-                   continue ;
-               }
-
-               /* try assigning other dptrs */
-               if (sym->dptr == 0 && packRegsDPTRnuse(operandFromSymbol(sym),1) && !getenv("DPTRnDISABLE")) {
-                   /* if this was ssigned to registers then */
-                   if (bitVectBitValue(_G.totRegAssigned,sym->key)) {
-                       /* take it out of the register assigned set */
-                       bitVectUnSetBit(_G.totRegAssigned,sym->key);
-                   } else if (sym->usl.spillLoc) {
-                       sym->usl.spillLoc->allocreq--;
-                       sym->usl.spillLoc = NULL;
-                   }
-                   sym->nRegs = 0;                 
-                   sym->isspilt = sym->spillA = 0;                 
-               }
-           }
-       }
-       
-       /* look for livernages that was spilt by the allocator */
-       for (sym = hTabFirstItem(liveRanges,&key) ; sym ; 
-            sym = hTabNextItem(liveRanges,&key)) {
-           
-           int i;
-           int pdone = 0;
-           
-           if (!sym->spillA || !sym->clashes || sym->remat) continue ;
-           if (!sym->uses || !sym->defs) continue ;
-           /* find the liveRanges this one clashes with, that are
-              still assigned to registers & mark the registers as used*/
-           for ( i = 0 ; i < sym->clashes->size ; i ++) {
-               int k;
-               symbol *clr;
-               
-               if (bitVectBitValue(sym->clashes,i) == 0 ||    /* those that clash with this */
-                   bitVectBitValue(_G.totRegAssigned,i) == 0) /* and are still assigned to registers */
-                   continue ;
-               
-               clr = hTabItemWithKey(liveRanges,i);
-               assert(clr);
-               
-               /* mark these registers as used */
-               for (k = 0 ; k < clr->nRegs ; k++ ) 
-                   useReg(clr->regs[k]);
-           }
-           
-           if (willCauseSpill(sym->nRegs,sym->regType)) {
-               /* NOPE :( clear all registers & and continue */
-               freeAllRegs();
-               continue ;
-           }
-           
-           /* THERE IS HOPE !!!! */
-           for (i=0; i < sym->nRegs ; i++ ) {
-               if (sym->regType == REG_PTR)
-                   sym->regs[i] = getRegPtrNoSpil ();
-               else
-                   sym->regs[i] = getRegGprNoSpil ();            
-           }
-           
-           /* For all its definitions check if the registers
-              allocated needs positioning NOTE: we can position
-              only ONCE if more than One positioning required 
-              then give up.
-              We may need to perform the checks twice; once to
-              position the registers as needed, the second to
-              verify any register repositioning is still
-              compatible.
+        change = 0;
+
+        for (sym = hTabFirstItem(liveRanges,&key) ; sym ;
+             sym = hTabNextItem(liveRanges,&key)) {
+            int size = getSize(sym->type);
+
+            if (sym->liveFrom == sym->liveTo) continue;
+
+            if (sym->uptr && sym->dptr==0 && !sym->ruonly &&
+                size < 4 && size > 1) {
+
+                if (packRegsDPTRuse(operandFromSymbol(sym))) {
+
+                    /* if this was assigned to registers then */
+                    if (bitVectBitValue(_G.totRegAssigned,sym->key)) {
+                        /* take it out of the register assigned set */
+                        bitVectUnSetBit(_G.totRegAssigned,sym->key);
+                    } else if (sym->usl.spillLoc) {
+                        sym->usl.spillLoc->allocreq--;
+                        sym->usl.spillLoc = NULL;
+                    }
+
+                    sym->nRegs = 0;
+                    sym->isspilt = sym->spillA = 0;
+                    continue ;
+                }
+
+                /* try assigning other dptrs */
+                if (sym->dptr == 0 && packRegsDPTRnuse(operandFromSymbol(sym),1) && !getenv("DPTRnDISABLE")) {
+                    /* if this was ssigned to registers then */
+                    if (bitVectBitValue(_G.totRegAssigned,sym->key)) {
+                        /* take it out of the register assigned set */
+                        bitVectUnSetBit(_G.totRegAssigned,sym->key);
+                    } else if (sym->usl.spillLoc) {
+                        sym->usl.spillLoc->allocreq--;
+                        sym->usl.spillLoc = NULL;
+                    }
+                    sym->nRegs = 0;
+                    sym->isspilt = sym->spillA = 0;
+                }
+            }
+        }
+
+        /* look for livernages that was spilt by the allocator */
+        for (sym = hTabFirstItem(liveRanges,&key) ; sym ;
+             sym = hTabNextItem(liveRanges,&key)) {
+
+            int i;
+            int pdone = 0;
+
+            if (!sym->spillA || !sym->clashes || sym->remat) continue ;
+            if (!sym->uses || !sym->defs) continue ;
+            /* find the liveRanges this one clashes with, that are
+               still assigned to registers & mark the registers as used*/
+            for ( i = 0 ; i < sym->clashes->size ; i ++) {
+                int k;
+                symbol *clr;
+
+                if (bitVectBitValue(sym->clashes,i) == 0 ||    /* those that clash with this */
+                    bitVectBitValue(_G.totRegAssigned,i) == 0) /* and are still assigned to registers */
+                    continue ;
+
+                clr = hTabItemWithKey(liveRanges,i);
+                assert(clr);
+
+                /* mark these registers as used */
+                for (k = 0 ; k < clr->nRegs ; k++ )
+                    useReg(clr->regs[k]);
+            }
+
+            if (willCauseSpill(sym->nRegs,sym->regType)) {
+                /* NOPE :( clear all registers & and continue */
+                freeAllRegs();
+                continue ;
+            }
+
+            /* THERE IS HOPE !!!! */
+            for (i=0; i < sym->nRegs ; i++ ) {
+                if (sym->regType == REG_PTR)
+                    sym->regs[i] = getRegPtrNoSpil ();
+                else
+                    sym->regs[i] = getRegGprNoSpil ();
+            }
+
+            /* For all its definitions check if the registers
+               allocated needs positioning NOTE: we can position
+               only ONCE if more than One positioning required
+               then give up.
+               We may need to perform the checks twice; once to
+               position the registers as needed, the second to
+               verify any register repositioning is still
+               compatible.
               */
               */
-           sym->isspilt = 0;
+            sym->isspilt = 0;
             for (pass=0; pass<2; pass++) {
             for (pass=0; pass<2; pass++) {
-               for (i = 0 ; i < sym->defs->size ; i++ ) {
-                   if (bitVectBitValue(sym->defs,i)) {
-                       iCode *ic;
-                       if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
-                       if (SKIP_IC(ic)) continue;
-                       assert(isSymbolEqual(sym,OP_SYMBOL(IC_RESULT(ic)))); /* just making sure */
+                for (i = 0 ; i < sym->defs->size ; i++ ) {
+                    if (bitVectBitValue(sym->defs,i)) {
+                        iCode *ic;
+                        if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
+                        if (SKIP_IC(ic)) continue;
+                        assert(isSymbolEqual(sym,OP_SYMBOL(IC_RESULT(ic)))); /* just making sure */
                         /* if left is assigned to registers */
                         /* if left is assigned to registers */
-                        if (IS_SYMOP(IC_LEFT(ic)) && 
-                         bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_LEFT(ic))->key)) {
-                           pdone += (positionRegs(sym,OP_SYMBOL(IC_LEFT(ic)))>0);
-                       }
-                       if (IS_SYMOP(IC_RIGHT(ic)) && 
-                         bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RIGHT(ic))->key)) {
-                           pdone += (positionRegs(sym,OP_SYMBOL(IC_RIGHT(ic)))>0);
-                       }
-                       if (pdone > 1) break;
-                   }
-               }
-               for (i = 0 ; i < sym->uses->size ; i++ ) {
-                   if (bitVectBitValue(sym->uses,i)) {
-                       iCode *ic;
-                       if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
-                       if (SKIP_IC(ic)) continue;
-                       if (POINTER_SET(ic) || POINTER_GET(ic)) continue ;
-
-                       /* if result is assigned to registers */
-                       if (IS_SYMOP(IC_RESULT(ic)) && 
-                         bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RESULT(ic))->key)) {
-                           pdone += (positionRegs(sym,OP_SYMBOL(IC_RESULT(ic)))>0);
-                       }
-                       if (pdone > 1) break;
-                   }
-               }
+                        if (IS_SYMOP(IC_LEFT(ic)) &&
+                          bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_LEFT(ic))->key)) {
+                            pdone += (positionRegs(sym,OP_SYMBOL(IC_LEFT(ic)))>0);
+                        }
+                        if (IS_SYMOP(IC_RIGHT(ic)) &&
+                          bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RIGHT(ic))->key)) {
+                            pdone += (positionRegs(sym,OP_SYMBOL(IC_RIGHT(ic)))>0);
+                        }
+                        if (pdone > 1) break;
+                    }
+                }
+                for (i = 0 ; i < sym->uses->size ; i++ ) {
+                    if (bitVectBitValue(sym->uses,i)) {
+                        iCode *ic;
+                        if (!(ic = hTabItemWithKey(iCodehTab,i))) continue ;
+                        if (SKIP_IC(ic)) continue;
+                        if (POINTER_SET(ic) || POINTER_GET(ic)) continue ;
+
+                        /* if result is assigned to registers */
+                        if (IS_SYMOP(IC_RESULT(ic)) &&
+                          bitVectBitValue(_G.totRegAssigned,OP_SYMBOL(IC_RESULT(ic))->key)) {
+                            pdone += (positionRegs(sym,OP_SYMBOL(IC_RESULT(ic)))>0);
+                        }
+                        if (pdone > 1) break;
+                    }
+                }
                 if (pdone == 0) break; /* second pass only if regs repositioned */
                 if (pdone == 0) break; /* second pass only if regs repositioned */
-               if (pdone > 1) break;
+                if (pdone > 1) break;
+            }
+            /* had to position more than once GIVE UP */
+            if (pdone > 1) {
+                /* UNDO all the changes we made to try this */
+                sym->isspilt = 1;
+                for (i=0; i < sym->nRegs ; i++ ) {
+                    sym->regs[i] = NULL;
+                }
+                freeAllRegs();
+                D (fprintf (stderr, "Fill Gap gave up due to positioning for "
+                            "%s in function %s\n",
+                            sym->name, currFunc ? currFunc->name : "UNKNOWN"));
+                continue ;
             }
             }
-           /* had to position more than once GIVE UP */
-           if (pdone > 1) {
-               /* UNDO all the changes we made to try this */
-               sym->isspilt = 1;
-               for (i=0; i < sym->nRegs ; i++ ) {
-                   sym->regs[i] = NULL;
-               }
-               freeAllRegs();
-               D (fprintf (stderr, "Fill Gap gave up due to positioning for "
-                           "%s in function %s\n",
-                           sym->name, currFunc ? currFunc->name : "UNKNOWN"));
-               continue ;          
-           }
-           D (fprintf (stderr, "FILLED GAP for %s in function %s\n",
-                       sym->name, currFunc ? currFunc->name : "UNKNOWN"));
-           _G.totRegAssigned = bitVectSetBit(_G.totRegAssigned,sym->key);
-           sym->isspilt = sym->spillA = 0 ;
-           sym->usl.spillLoc->allocreq--;
-           sym->usl.spillLoc = NULL;
-           freeAllRegs();
-           change ++;
-       }
-       if (!change) break;
+            D (fprintf (stderr, "FILLED GAP for %s in function %s\n",
+                        sym->name, currFunc ? currFunc->name : "UNKNOWN"));
+            _G.totRegAssigned = bitVectSetBit(_G.totRegAssigned,sym->key);
+            sym->isspilt = sym->spillA = 0 ;
+            sym->usl.spillLoc->allocreq--;
+            sym->usl.spillLoc = NULL;
+            freeAllRegs();
+            change ++;
+        }
+        if (!change) break;
     }
 }
 
     }
 }
 
@@ -1656,7 +1660,7 @@ ds390_rUmaskForOp (operand * op)
   for (j = 0; j < sym->nRegs; j++)
     {
       rumask = bitVectSetBit (rumask,
   for (j = 0; j < sym->nRegs; j++)
     {
       rumask = bitVectSetBit (rumask,
-                             sym->regs[j]->rIdx);
+                              sym->regs[j]->rIdx);
     }
 
   return rumask;
     }
 
   return rumask;
@@ -1674,7 +1678,7 @@ regsUsedIniCode (iCode * ic)
   if (ic->op == IFX)
     {
       rmask = bitVectUnion (rmask,
   if (ic->op == IFX)
     {
       rmask = bitVectUnion (rmask,
-                           ds390_rUmaskForOp (IC_COND (ic)));
+                            ds390_rUmaskForOp (IC_COND (ic)));
       goto ret;
     }
 
       goto ret;
     }
 
@@ -1682,7 +1686,7 @@ regsUsedIniCode (iCode * ic)
   if (ic->op == JUMPTABLE)
     {
       rmask = bitVectUnion (rmask,
   if (ic->op == JUMPTABLE)
     {
       rmask = bitVectUnion (rmask,
-                           ds390_rUmaskForOp (IC_JTCOND (ic)));
+                            ds390_rUmaskForOp (IC_JTCOND (ic)));
 
       goto ret;
     }
 
       goto ret;
     }
@@ -1690,16 +1694,16 @@ regsUsedIniCode (iCode * ic)
   /* of all other cases */
   if (IC_LEFT (ic))
     rmask = bitVectUnion (rmask,
   /* of all other cases */
   if (IC_LEFT (ic))
     rmask = bitVectUnion (rmask,
-                         ds390_rUmaskForOp (IC_LEFT (ic)));
+                          ds390_rUmaskForOp (IC_LEFT (ic)));
 
 
   if (IC_RIGHT (ic))
     rmask = bitVectUnion (rmask,
 
 
   if (IC_RIGHT (ic))
     rmask = bitVectUnion (rmask,
-                         ds390_rUmaskForOp (IC_RIGHT (ic)));
+                          ds390_rUmaskForOp (IC_RIGHT (ic)));
 
   if (IC_RESULT (ic))
     rmask = bitVectUnion (rmask,
 
   if (IC_RESULT (ic))
     rmask = bitVectUnion (rmask,
-                         ds390_rUmaskForOp (IC_RESULT (ic)));
+                          ds390_rUmaskForOp (IC_RESULT (ic)));
 
 ret:
   return rmask;
 
 ret:
   return rmask;
@@ -1719,67 +1723,68 @@ createRegMask (eBBlock ** ebbs, int count)
       iCode *ic;
 
       if (ebbs[i]->noPath &&
       iCode *ic;
 
       if (ebbs[i]->noPath &&
-         (ebbs[i]->entryLabel != entryLabel &&
-          ebbs[i]->entryLabel != returnLabel))
-       continue;
+          (ebbs[i]->entryLabel != entryLabel &&
+           ebbs[i]->entryLabel != returnLabel))
+        continue;
 
       /* for all instructions */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
 
       /* for all instructions */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
-       {
-
-         int j;
-
-         if (SKIP_IC2 (ic) || !ic->rlive)
-           continue;
-
-         /* first mark the registers used in this
-            instruction */
-         ic->rUsed = regsUsedIniCode (ic);
-         _G.funcrUsed = bitVectUnion (_G.funcrUsed, ic->rUsed);
-
-         /* now create the register mask for those 
-            registers that are in use : this is a
-            super set of ic->rUsed */
-         ic->rMask = newBitVect (ds390_nRegs + 1);
-
-         /* for all live Ranges alive at this point */
-         for (j = 1; j < ic->rlive->size; j++)
-           {
-             symbol *sym;
-             int k;
-
-             /* if not alive then continue */
-             if (!bitVectBitValue (ic->rlive, j))
-               continue;
-
-             /* find the live range we are interested in */
-             if (!(sym = hTabItemWithKey (liveRanges, j)))
-               {
-                 werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
-                         "createRegMask cannot find live range");
-                 exit (0);
-               }
+        {
+
+          int j;
+
+          if (SKIP_IC2 (ic) || !ic->rlive)
+            continue;
+
+          /* first mark the registers used in this
+             instruction */
+          ic->rUsed = regsUsedIniCode (ic);
+          _G.funcrUsed = bitVectUnion (_G.funcrUsed, ic->rUsed);
+
+          /* now create the register mask for those
+             registers that are in use : this is a
+             super set of ic->rUsed */
+          ic->rMask = newBitVect (ds390_nRegs + 1);
+
+          /* for all live Ranges alive at this point */
+          for (j = 1; j < ic->rlive->size; j++)
+            {
+              symbol *sym;
+              int k;
+
+              /* if not alive then continue */
+              if (!bitVectBitValue (ic->rlive, j))
+                continue;
+
+              /* find the live range we are interested in */
+              if (!(sym = hTabItemWithKey (liveRanges, j)))
+                {
+                  werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
+                          "createRegMask cannot find live range");
+                  fprintf(stderr, "\tmissing live range: key=%d\n", j);
+                  exit (0);
+                }
 #if 0
 #if 0
-             /* special case for ruonly */
-             if (sym->ruonly && sym->liveFrom != sym->liveTo) {
-                 int size = getSize(sym->type);
-                 int j = DPL_IDX;
-                 for (k = 0 ; k < size; k++ )
-                     ic->rMask = bitVectSetBit (ic->rMask, j++);
-                 continue ;
-             }
+              /* special case for ruonly */
+              if (sym->ruonly && sym->liveFrom != sym->liveTo) {
+                  int size = getSize(sym->type);
+                  int j = DPL_IDX;
+                  for (k = 0 ; k < size; k++ )
+                      ic->rMask = bitVectSetBit (ic->rMask, j++);
+                  continue ;
+              }
 #endif
 #endif
-             /* if no register assigned to it */
-             if (!sym->nRegs || sym->isspilt)
-               continue;
-
-             /* for all the registers allocated to it */
-             for (k = 0; k < sym->nRegs; k++)
-               if (sym->regs[k])
-                 ic->rMask =
-                   bitVectSetBit (ic->rMask, sym->regs[k]->rIdx);
-           }
-       }
+              /* if no register assigned to it */
+              if (!sym->nRegs || sym->isspilt)
+                continue;
+
+              /* for all the registers allocated to it */
+              for (k = 0; k < sym->nRegs; k++)
+                if (sym->regs[k])
+                  ic->rMask =
+                    bitVectSetBit (ic->rMask, sym->regs[k]->rIdx);
+            }
+        }
     }
 }
 
     }
 }
 
@@ -1793,28 +1798,29 @@ rematStr (symbol * sym)
   iCode *ic = sym->rematiCode;
 
   *s = 0;
   iCode *ic = sym->rematiCode;
 
   *s = 0;
-    
+
   while (1)
     {
 
       /* if plus or minus print the right hand side */
       if (ic->op == '+' || ic->op == '-')
   while (1)
     {
 
       /* if plus or minus print the right hand side */
       if (ic->op == '+' || ic->op == '-')
-       {
-         SNPRINTF (s, sizeof(buffer) - strlen(buffer), 
-                   "0x%04x %c ", (int) operandLitValue (IC_RIGHT (ic)),
-                   ic->op);
-         s += strlen (s);
-         ic = OP_SYMBOL (IC_LEFT (ic))->rematiCode;
-         continue;
-       }
+        {
+          SNPRINTF (s, sizeof(buffer) - strlen(buffer),
+                    "0x%04x %c ", (int) operandLitValue (IC_RIGHT (ic)),
+                    ic->op);
+          s += strlen (s);
+          ic = OP_SYMBOL (IC_LEFT (ic))->rematiCode;
+          continue;
+        }
+
       /* cast then continue */
       if (IS_CAST_ICODE(ic)) {
       /* cast then continue */
       if (IS_CAST_ICODE(ic)) {
-         ic = OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
-         continue;
+          ic = OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
+          continue;
       }
       /* we reached the end */
       }
       /* we reached the end */
-      SNPRINTF (s, sizeof(buffer) - strlen(buffer), 
-               "%s", OP_SYMBOL (IC_LEFT (ic))->rname);
+      SNPRINTF (s, sizeof(buffer) - strlen(buffer),
+                "%s", OP_SYMBOL (IC_LEFT (ic))->rname);
       break;
     }
 
       break;
     }
 
@@ -1838,73 +1844,73 @@ regTypeNum ()
 
       /* if used zero times then no registers needed */
       if ((sym->liveTo - sym->liveFrom) == 0)
 
       /* if used zero times then no registers needed */
       if ((sym->liveTo - sym->liveFrom) == 0)
-       continue;
+        continue;
 
 
       /* if the live range is a temporary */
       if (sym->isitmp)
 
 
       /* if the live range is a temporary */
       if (sym->isitmp)
-       {
-
-         /* if the type is marked as a conditional */
-         if (sym->regType == REG_CND)
-           continue;
-
-         /* if used in return only then we don't 
-            need registers */
-         if (sym->ruonly || sym->accuse)
-           {
-             if (IS_AGGREGATE (sym->type) || sym->isptr)
-               sym->type = aggrToPtr (sym->type, FALSE);
-             continue;
-           }
-
-         /* if the symbol has only one definition &
-            that definition is a get_pointer */
-         if (bitVectnBitsOn (sym->defs) == 1 &&
-             (ic = hTabItemWithKey (iCodehTab,
-                                    bitVectFirstBit (sym->defs))) &&
-             POINTER_GET (ic) &&
-             !IS_BITVAR (sym->etype) &&
-             (aggrToPtrDclType (operandType (IC_LEFT (ic)), FALSE) == POINTER))
-           {
-
-             if (ptrPseudoSymSafe (sym, ic))
-               {
-                 ptrPseudoSymConvert (sym, ic, rematStr (OP_SYMBOL (IC_LEFT (ic))));
-                 continue;
-               }
-
-             /* if in data space or idata space then try to
-                allocate pointer register */
-
-           }
-
-         /* if not then we require registers */
-         sym->nRegs = ((IS_AGGREGATE (sym->type) || sym->isptr) ?
-                       getSize (sym->type = aggrToPtr (sym->type, FALSE)) :
-                       getSize (sym->type));
-
-         if (sym->nRegs > 4)
-           {
-             fprintf (stderr, "allocated more than 4 or 0 registers for type ");
-             printTypeChain (sym->type, stderr);
-             fprintf (stderr, "\n");
-           }
-
-         /* determine the type of register required */
-         if (sym->nRegs == 1 &&
-             IS_PTR (sym->type) &&
-             sym->uptr)
-           sym->regType = REG_PTR;
-         else
-           sym->regType = REG_GPR;
-
-       }
+        {
+
+          /* if the type is marked as a conditional */
+          if (sym->regType == REG_CND)
+            continue;
+
+          /* if used in return only then we don't
+             need registers */
+          if (sym->ruonly || sym->accuse)
+            {
+              if (IS_AGGREGATE (sym->type) || sym->isptr)
+                sym->type = aggrToPtr (sym->type, FALSE);
+              continue;
+            }
+
+          /* if the symbol has only one definition &
+             that definition is a get_pointer */
+          if (bitVectnBitsOn (sym->defs) == 1 &&
+              (ic = hTabItemWithKey (iCodehTab,
+                                     bitVectFirstBit (sym->defs))) &&
+              POINTER_GET (ic) &&
+              !IS_BITVAR (sym->etype) &&
+              (aggrToPtrDclType (operandType (IC_LEFT (ic)), FALSE) == POINTER))
+            {
+
+              if (ptrPseudoSymSafe (sym, ic))
+                {
+                  ptrPseudoSymConvert (sym, ic, rematStr (OP_SYMBOL (IC_LEFT (ic))));
+                  continue;
+                }
+
+              /* if in data space or idata space then try to
+                 allocate pointer register */
+
+            }
+
+          /* if not then we require registers */
+          sym->nRegs = ((IS_AGGREGATE (sym->type) || sym->isptr) ?
+                        getSize (sym->type = aggrToPtr (sym->type, FALSE)) :
+                        getSize (sym->type));
+
+          if (sym->nRegs > 4)
+            {
+              fprintf (stderr, "allocated more than 4 or 0 registers for type ");
+              printTypeChain (sym->type, stderr);
+              fprintf (stderr, "\n");
+            }
+
+          /* determine the type of register required */
+          if (sym->nRegs == 1 &&
+              IS_PTR (sym->type) &&
+              sym->uptr)
+            sym->regType = REG_PTR;
+          else
+            sym->regType = REG_GPR;
+
+        }
       else
       else
-       /* for the first run we don't provide */
-       /* registers for true symbols we will */
-       /* see how things go                  */
-       sym->nRegs = 0;
+        /* for the first run we don't provide */
+        /* registers for true symbols we will */
+        /* see how things go                  */
+        sym->nRegs = 0;
     }
 
 }
     }
 
 }
@@ -1945,56 +1951,55 @@ farSpacePackable (iCode * ic)
      symbol on the right */
   for (dic = ic->prev; dic; dic = dic->prev)
     {
      symbol on the right */
   for (dic = ic->prev; dic; dic = dic->prev)
     {
-
       /* if the definition is a call then no */
       if ((dic->op == CALL || dic->op == PCALL) &&
       /* if the definition is a call then no */
       if ((dic->op == CALL || dic->op == PCALL) &&
-         IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
-       {
-         return NULL;
-       }
+          IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
+        {
+          return NULL;
+        }
 
       /* if shift by unknown amount then not */
       if ((dic->op == LEFT_OP || dic->op == RIGHT_OP) &&
 
       /* if shift by unknown amount then not */
       if ((dic->op == LEFT_OP || dic->op == RIGHT_OP) &&
-         IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
-       return NULL;
+          IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
+        return NULL;
 
       /* if pointer get and size > 1 */
       if (POINTER_GET (dic) &&
 
       /* if pointer get and size > 1 */
       if (POINTER_GET (dic) &&
-         getSize (aggrToPtr (operandType (IC_LEFT (dic)), FALSE)) > 1)
-       return NULL;
+          getSize (aggrToPtr (operandType (IC_LEFT (dic)), FALSE)) > 1)
+        return NULL;
 
       if (POINTER_SET (dic) &&
 
       if (POINTER_SET (dic) &&
-         getSize (aggrToPtr (operandType (IC_RESULT (dic)), FALSE)) > 1)
-       return NULL;
+          getSize (aggrToPtr (operandType (IC_RESULT (dic)), FALSE)) > 1)
+        return NULL;
 
 
-      /* if any three is a true symbol in far space */
+      /* if any tree is a true symbol in far space */
       if (IC_RESULT (dic) &&
       if (IC_RESULT (dic) &&
-         IS_TRUE_SYMOP (IC_RESULT (dic)) &&
-         isOperandInFarSpace (IC_RESULT (dic)))
-       return NULL;
+          IS_TRUE_SYMOP (IC_RESULT (dic)) &&
+          isOperandInFarSpace (IC_RESULT (dic)))
+        return NULL;
 
       if (IC_RIGHT (dic) &&
 
       if (IC_RIGHT (dic) &&
-         IS_TRUE_SYMOP (IC_RIGHT (dic)) &&
-         isOperandInFarSpace (IC_RIGHT (dic)) &&
-         !isOperandEqual (IC_RIGHT (dic), IC_RESULT (ic)))
-       return NULL;
+          IS_TRUE_SYMOP (IC_RIGHT (dic)) &&
+          isOperandInFarSpace (IC_RIGHT (dic)) &&
+          !isOperandEqual (IC_RIGHT (dic), IC_RESULT (ic)))
+        return NULL;
 
       if (IC_LEFT (dic) &&
 
       if (IC_LEFT (dic) &&
-         IS_TRUE_SYMOP (IC_LEFT (dic)) &&
-         isOperandInFarSpace (IC_LEFT (dic)) &&
-         !isOperandEqual (IC_LEFT (dic), IC_RESULT (ic)))
-       return NULL;
+          IS_TRUE_SYMOP (IC_LEFT (dic)) &&
+          isOperandInFarSpace (IC_LEFT (dic)) &&
+          !isOperandEqual (IC_LEFT (dic), IC_RESULT (ic)))
+        return NULL;
 
       if (isOperandEqual (IC_RIGHT (ic), IC_RESULT (dic)))
 
       if (isOperandEqual (IC_RIGHT (ic), IC_RESULT (dic)))
-       {
-         if ((dic->op == LEFT_OP ||
-              dic->op == RIGHT_OP ||
-              dic->op == '-') &&
-             IS_OP_LITERAL (IC_RIGHT (dic)))
-           return NULL;
-         else
-           return dic;
-       }
+        {
+          if ((dic->op == LEFT_OP ||
+               dic->op == RIGHT_OP ||
+               dic->op == '-') &&
+              IS_OP_LITERAL (IC_RIGHT (dic)))
+            return NULL;
+          else
+            return dic;
+        }
     }
 
   return NULL;
     }
 
   return NULL;
@@ -2021,9 +2026,9 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
   if (isOperandInFarSpace (IC_RESULT (ic)))
     {
       if ((dic = farSpacePackable (ic)))
   if (isOperandInFarSpace (IC_RESULT (ic)))
     {
       if ((dic = farSpacePackable (ic)))
-       goto pack;
+        goto pack;
       else
       else
-       return 0;
+        return 0;
     }
 #else
   if (isOperandInFarSpace(IC_RESULT(ic)) && !farSpacePackable(ic)) {
     }
 #else
   if (isOperandInFarSpace(IC_RESULT(ic)) && !farSpacePackable(ic)) {
@@ -2031,63 +2036,63 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
   }
 #endif
 
   }
 #endif
 
-  /* find the definition of iTempNN scanning backwards if we find a 
-     a use of the true symbol in before we find the definition then 
+  /* find the definition of iTempNN scanning backwards if we find a
+     a use of the true symbol in before we find the definition then
      we cannot */
   for (dic = ic->prev; dic; dic = dic->prev)
     {
       /* if there is a function call then don't pack it */
       if ((dic->op == CALL || dic->op == PCALL))
      we cannot */
   for (dic = ic->prev; dic; dic = dic->prev)
     {
       /* if there is a function call then don't pack it */
       if ((dic->op == CALL || dic->op == PCALL))
-       {
-         dic = NULL;
-         break;
-       }
+        {
+          dic = NULL;
+          break;
+        }
 
       if (SKIP_IC2 (dic))
 
       if (SKIP_IC2 (dic))
-       continue;
+        continue;
 
       if (IS_TRUE_SYMOP (IC_RESULT (dic)) &&
 
       if (IS_TRUE_SYMOP (IC_RESULT (dic)) &&
-         IS_OP_VOLATILE (IC_RESULT (dic)))
-       {
-         dic = NULL;
-         break;
-       }
+          IS_OP_VOLATILE (IC_RESULT (dic)))
+        {
+          dic = NULL;
+          break;
+        }
 
       if (IS_SYMOP (IC_RESULT (dic)) &&
 
       if (IS_SYMOP (IC_RESULT (dic)) &&
-         IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
-       {
-         if (POINTER_SET (dic))
-           dic = NULL;
+          IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
+        {
+          if (POINTER_SET (dic))
+            dic = NULL;
 
 
-         break;
-       }
+          break;
+        }
 
       if (IS_SYMOP (IC_RIGHT (dic)) &&
 
       if (IS_SYMOP (IC_RIGHT (dic)) &&
-         (IC_RIGHT (dic)->key == IC_RESULT (ic)->key ||
-          IC_RIGHT (dic)->key == IC_RIGHT (ic)->key))
-       {
-         dic = NULL;
-         break;
-       }
+          (IC_RIGHT (dic)->key == IC_RESULT (ic)->key ||
+           IC_RIGHT (dic)->key == IC_RIGHT (ic)->key))
+        {
+          dic = NULL;
+          break;
+        }
 
       if (IS_SYMOP (IC_LEFT (dic)) &&
 
       if (IS_SYMOP (IC_LEFT (dic)) &&
-         (IC_LEFT (dic)->key == IC_RESULT (ic)->key ||
-          IC_LEFT (dic)->key == IC_RIGHT (ic)->key))
-       {
-         dic = NULL;
-         break;
-       }
+          (IC_LEFT (dic)->key == IC_RESULT (ic)->key ||
+           IC_LEFT (dic)->key == IC_RIGHT (ic)->key))
+        {
+          dic = NULL;
+          break;
+        }
 
       if (POINTER_SET (dic) &&
 
       if (POINTER_SET (dic) &&
-         IC_RESULT (dic)->key == IC_RESULT (ic)->key)
-       {
-         dic = NULL;
-         break;
-       }
+          IC_RESULT (dic)->key == IC_RESULT (ic)->key)
+        {
+          dic = NULL;
+          break;
+        }
     }
 
   if (!dic)
     }
 
   if (!dic)
-    return 0;                  /* did not find */
+    return 0;                   /* did not find */
 
   /* if the result is on stack or iaccess then it must be
      the same atleast one of the operands */
 
   /* if the result is on stack or iaccess then it must be
      the same atleast one of the operands */
@@ -2098,14 +2103,14 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
       /* the operation has only one symbol
          operator then we can pack */
       if ((IC_LEFT (dic) && !IS_SYMOP (IC_LEFT (dic))) ||
       /* the operation has only one symbol
          operator then we can pack */
       if ((IC_LEFT (dic) && !IS_SYMOP (IC_LEFT (dic))) ||
-         (IC_RIGHT (dic) && !IS_SYMOP (IC_RIGHT (dic))))
-       goto pack;
+          (IC_RIGHT (dic) && !IS_SYMOP (IC_RIGHT (dic))))
+        goto pack;
 
       if (!((IC_LEFT (dic) &&
 
       if (!((IC_LEFT (dic) &&
-            IC_RESULT (ic)->key == IC_LEFT (dic)->key) ||
-           (IC_RIGHT (dic) &&
-            IC_RESULT (ic)->key == IC_RIGHT (dic)->key)))
-       return 0;
+             IC_RESULT (ic)->key == IC_LEFT (dic)->key) ||
+            (IC_RIGHT (dic) &&
+             IC_RESULT (ic)->key == IC_RIGHT (dic)->key)))
+        return 0;
     }
 pack:
   /* found the definition */
     }
 pack:
   /* found the definition */
@@ -2119,14 +2124,14 @@ pack:
     {
       OP_SYMBOL (IC_RESULT (dic))->liveFrom = dic->seq;
     }
     {
       OP_SYMBOL (IC_RESULT (dic))->liveFrom = dic->seq;
     }
-  /* delete from liverange table also 
+  /* delete from liverange table also
      delete from all the points inbetween and the new
      one */
   for (sic = dic; sic != ic; sic = sic->next)
     {
       bitVectUnSetBit (sic->rlive, IC_RESULT (ic)->key);
       if (IS_ITEMP (IC_RESULT (dic)))
      delete from all the points inbetween and the new
      one */
   for (sic = dic; sic != ic; sic = sic->next)
     {
       bitVectUnSetBit (sic->rlive, IC_RESULT (ic)->key);
       if (IS_ITEMP (IC_RESULT (dic)))
-       bitVectSetBit (sic->rlive, IC_RESULT (dic)->key);
+        bitVectSetBit (sic->rlive, IC_RESULT (dic)->key);
     }
 
   remiCodeFromeBBlock (ebp, ic);
     }
 
   remiCodeFromeBBlock (ebp, ic);
@@ -2134,67 +2139,75 @@ pack:
   hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
   OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
   return 1;
   hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
   OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
   return 1;
-
 }
 
 }
 
-/*-----------------------------------------------------------------*/
+/*------------------------------------------------------------------*/
 /* findAssignToSym : scanning backwards looks for first assig found */
 /* findAssignToSym : scanning backwards looks for first assig found */
-/*-----------------------------------------------------------------*/
+/*------------------------------------------------------------------*/
 static iCode *
 findAssignToSym (operand * op, iCode * ic)
 {
   iCode *dic;
 
 static iCode *
 findAssignToSym (operand * op, iCode * ic)
 {
   iCode *dic;
 
+  /* This routine is used to find sequences like
+     iTempAA = FOO;
+     ...;  (intervening ops don't use iTempAA or modify FOO)
+     blah = blah + iTempAA;
+
+     and eliminate the use of iTempAA, freeing up its register for
+     other uses.
+  */
+
   for (dic = ic->prev; dic; dic = dic->prev)
     {
 
       /* if definition by assignment */
       if (dic->op == '=' &&
   for (dic = ic->prev; dic; dic = dic->prev)
     {
 
       /* if definition by assignment */
       if (dic->op == '=' &&
-         !POINTER_SET (dic) &&
-         IC_RESULT (dic)->key == op->key
+          !POINTER_SET (dic) &&
+          IC_RESULT (dic)->key == op->key
 /*          &&  IS_TRUE_SYMOP(IC_RIGHT(dic)) */
 /*          &&  IS_TRUE_SYMOP(IC_RIGHT(dic)) */
-       )
-       {
-
-         /* we are interested only if defined in far space */
-         /* or in stack space in case of + & - */
-
-         /* if assigned to a non-symbol then return
-            FALSE */
-         if (!IS_SYMOP (IC_RIGHT (dic)))
-           return NULL;
-
-         /* if the symbol is in far space then
-            we should not */
-         if (isOperandInFarSpace (IC_RIGHT (dic)))
-           return NULL;
-
-         /* for + & - operations make sure that
-            if it is on the stack it is the same
-            as one of the three operands */
-         if ((ic->op == '+' || ic->op == '-') &&
-             OP_SYMBOL (IC_RIGHT (dic))->onStack)
-           {
-
-             if (IC_RESULT (ic)->key != IC_RIGHT (dic)->key &&
-                 IC_LEFT (ic)->key != IC_RIGHT (dic)->key &&
-                 IC_RIGHT (ic)->key != IC_RIGHT (dic)->key)
-               return NULL;
-           }
+        )
+        {
+
+          /* we are interested only if defined in far space */
+          /* or in stack space in case of + & - */
+
+          /* if assigned to a non-symbol then return
+             FALSE */
+          if (!IS_SYMOP (IC_RIGHT (dic)))
+            return NULL;
+
+          /* if the symbol is in far space then
+             we should not */
+          if (isOperandInFarSpace (IC_RIGHT (dic)))
+            return NULL;
+
+          /* for + & - operations make sure that
+             if it is on the stack it is the same
+             as one of the three operands */
+          if ((ic->op == '+' || ic->op == '-') &&
+              OP_SYMBOL (IC_RIGHT (dic))->onStack)
+            {
+
+              if (IC_RESULT (ic)->key != IC_RIGHT (dic)->key &&
+                  IC_LEFT (ic)->key != IC_RIGHT (dic)->key &&
+                  IC_RIGHT (ic)->key != IC_RIGHT (dic)->key)
+                return NULL;
+            }
 
 
-         break;
+          break;
 
 
-       }
+        }
 
       /* if we find an usage then we cannot delete it */
       if (IC_LEFT (dic) && IC_LEFT (dic)->key == op->key)
 
       /* if we find an usage then we cannot delete it */
       if (IC_LEFT (dic) && IC_LEFT (dic)->key == op->key)
-       return NULL;
+        return NULL;
 
       if (IC_RIGHT (dic) && IC_RIGHT (dic)->key == op->key)
 
       if (IC_RIGHT (dic) && IC_RIGHT (dic)->key == op->key)
-       return NULL;
+        return NULL;
 
       if (POINTER_SET (dic) && IC_RESULT (dic)->key == op->key)
 
       if (POINTER_SET (dic) && IC_RESULT (dic)->key == op->key)
-       return NULL;
+        return NULL;
     }
 
   /* now make sure that the right side of dic
     }
 
   /* now make sure that the right side of dic
@@ -2204,9 +2217,9 @@ findAssignToSym (operand * op, iCode * ic)
       iCode *sic = dic->next;
 
       for (; sic != ic; sic = sic->next)
       iCode *sic = dic->next;
 
       for (; sic != ic; sic = sic->next)
-       if (IC_RESULT (sic) &&
-           IC_RESULT (sic)->key == IC_RIGHT (dic)->key)
-         return NULL;
+        if (IC_RESULT (sic) &&
+            IC_RESULT (sic)->key == IC_RIGHT (dic)->key)
+          return NULL;
     }
 
   return dic;
     }
 
   return dic;
@@ -2219,9 +2232,9 @@ findAssignToSym (operand * op, iCode * ic)
 /*-----------------------------------------------------------------*/
 static int
 packRegsForSupport (iCode * ic, eBBlock * ebp)
 /*-----------------------------------------------------------------*/
 static int
 packRegsForSupport (iCode * ic, eBBlock * ebp)
-{    
+{
   int change = 0;
   int change = 0;
-  
+
   /* for the left & right operand :- look to see if the
      left was assigned a true symbol in far space in that
      case replace them */
   /* for the left & right operand :- look to see if the
      left was assigned a true symbol in far space in that
      case replace them */
@@ -2232,19 +2245,19 @@ packRegsForSupport (iCode * ic, eBBlock * ebp)
       iCode *sic;
 
       if (!dic)
       iCode *sic;
 
       if (!dic)
-       goto right;
+        goto right;
 
       /* found it we need to remove it from the
          block */
       for (sic = dic; sic != ic; sic = sic->next) {
 
       /* found it we need to remove it from the
          block */
       for (sic = dic; sic != ic; sic = sic->next) {
-       bitVectUnSetBit (sic->rlive, IC_LEFT (ic)->key);
-       sic->rlive = bitVectSetBit (sic->rlive, IC_RIGHT (dic)->key);
+        bitVectUnSetBit (sic->rlive, IC_LEFT (ic)->key);
+        sic->rlive = bitVectSetBit (sic->rlive, IC_RIGHT (dic)->key);
       }
 
       wassert(IS_SYMOP(IC_LEFT (ic)));
       wassert(IS_SYMOP(IC_RIGHT (dic)));
       IC_LEFT (ic)->operand.symOperand =
       }
 
       wassert(IS_SYMOP(IC_LEFT (ic)));
       wassert(IS_SYMOP(IC_RIGHT (dic)));
       IC_LEFT (ic)->operand.symOperand =
-       IC_RIGHT (dic)->operand.symOperand;
+        IC_RIGHT (dic)->operand.symOperand;
       OP_SYMBOL(IC_LEFT(ic))->liveTo = ic->seq;
       IC_LEFT (ic)->key = IC_RIGHT (dic)->operand.symOperand->key;
       bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
       OP_SYMBOL(IC_LEFT(ic))->liveTo = ic->seq;
       IC_LEFT (ic)->key = IC_RIGHT (dic)->operand.symOperand->key;
       bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
@@ -2263,27 +2276,27 @@ right:
       iCode *sic;
 
       if (!dic)
       iCode *sic;
 
       if (!dic)
-       return change;
+        return change;
 
       /* if this is a subtraction & the result
          is a true symbol in far space then don't pack */
       if (ic->op == '-' && IS_TRUE_SYMOP (IC_RESULT (dic)))
 
       /* if this is a subtraction & the result
          is a true symbol in far space then don't pack */
       if (ic->op == '-' && IS_TRUE_SYMOP (IC_RESULT (dic)))
-       {
-         sym_link *etype = getSpec (operandType (IC_RESULT (dic)));
-         if (IN_FARSPACE (SPEC_OCLS (etype)))
-           return change;
-       }
+        {
+          sym_link *etype = getSpec (operandType (IC_RESULT (dic)));
+          if (IN_FARSPACE (SPEC_OCLS (etype)))
+            return change;
+        }
       /* found it we need to remove it from the
          block */
       for (sic = dic; sic != ic; sic = sic->next) {
       /* found it we need to remove it from the
          block */
       for (sic = dic; sic != ic; sic = sic->next) {
-       bitVectUnSetBit (sic->rlive, IC_RIGHT (ic)->key);
-       sic->rlive = bitVectSetBit (sic->rlive, IC_RIGHT (dic)->key);
+        bitVectUnSetBit (sic->rlive, IC_RIGHT (ic)->key);
+        sic->rlive = bitVectSetBit (sic->rlive, IC_RIGHT (dic)->key);
       }
 
       wassert(IS_SYMOP(IC_RIGHT (ic)));
       }
 
       wassert(IS_SYMOP(IC_RIGHT (ic)));
-      wassert(IS_SYMOP(IC_RIGHT (dic)));       
+      wassert(IS_SYMOP(IC_RIGHT (dic)));
       IC_RIGHT (ic)->operand.symOperand =
       IC_RIGHT (ic)->operand.symOperand =
-       IC_RIGHT (dic)->operand.symOperand;
+        IC_RIGHT (dic)->operand.symOperand;
       IC_RIGHT (ic)->key = IC_RIGHT (dic)->operand.symOperand->key;
       OP_SYMBOL(IC_RIGHT(ic))->liveTo = ic->seq;
       remiCodeFromeBBlock (ebp, dic);
       IC_RIGHT (ic)->key = IC_RIGHT (dic)->operand.symOperand->key;
       OP_SYMBOL(IC_RIGHT(ic))->liveTo = ic->seq;
       remiCodeFromeBBlock (ebp, dic);
@@ -2301,122 +2314,122 @@ right:
 /*-----------------------------------------------------------------*/
 /* packRegsDPTRnuse - color live ranges that can go into extra DPTRS */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* packRegsDPTRnuse - color live ranges that can go into extra DPTRS */
 /*-----------------------------------------------------------------*/
-static int packRegsDPTRnuse( operand *op , int dptr)
+static int packRegsDPTRnuse( operand *op , unsigned dptr)
 {
     int i,key;
     iCode *ic;
 
     if (!IS_SYMOP(op) || !IS_ITEMP(op)) return 0;
 {
     int i,key;
     iCode *ic;
 
     if (!IS_SYMOP(op) || !IS_ITEMP(op)) return 0;
-    if (OP_SYMBOL(op)->remat || OP_SYMBOL(op)->ruonly || OP_SYMBOL(op)->dptr) 
-       return 0; 
-    
+    if (OP_SYMBOL(op)->remat || OP_SYMBOL(op)->ruonly || OP_SYMBOL(op)->dptr)
+        return 0;
+
     /* first check if any overlapping liverange has already been
        assigned to this DPTR */
     if (OP_SYMBOL(op)->clashes) {
     /* first check if any overlapping liverange has already been
        assigned to this DPTR */
     if (OP_SYMBOL(op)->clashes) {
-       for (i = 0 ; i < OP_SYMBOL(op)->clashes->size ; i++ ) {
-           symbol *sym;
-           if (bitVectBitValue(OP_SYMBOL(op)->clashes,i)) {
-               sym = hTabItemWithKey(liveRanges,i);
-               if (sym->dptr == dptr) return 0;
-           }
-       }
+        for (i = 0 ; i < OP_SYMBOL(op)->clashes->size ; i++ ) {
+            symbol *sym;
+            if (bitVectBitValue(OP_SYMBOL(op)->clashes,i)) {
+                sym = hTabItemWithKey(liveRanges,i);
+                if (sym->dptr == dptr) return 0;
+            }
+        }
     }
     }
-   
+
     /* future for more dptrs */
     if (dptr > 1) {
     /* future for more dptrs */
     if (dptr > 1) {
-       OP_SYMBOL(op)->dptr = dptr;
-       return 1;
+        OP_SYMBOL(op)->dptr = dptr;
+        return 1;
     }
 
     /* DPTR1 is special since it is also used as a scratch by the backend .
        so we walk thru the entire live range of this operand and make sure
     }
 
     /* DPTR1 is special since it is also used as a scratch by the backend .
        so we walk thru the entire live range of this operand and make sure
-       DPTR1 will not be used by the backed . The logic here is to find out if 
-       more than one operand in an icode is in far space then we give up : we 
+       DPTR1 will not be used by the backed . The logic here is to find out if
+       more than one operand in an icode is in far space then we give up : we
        don't keep it live across functions for now
     */
        don't keep it live across functions for now
     */
-    
+
     ic = hTabFirstItemWK(iCodeSeqhTab,OP_SYMBOL(op)->liveFrom);
     for (; ic && ic->seq <= OP_SYMBOL(op)->liveTo;
     ic = hTabFirstItemWK(iCodeSeqhTab,OP_SYMBOL(op)->liveFrom);
     for (; ic && ic->seq <= OP_SYMBOL(op)->liveTo;
-        ic = hTabNextItem(iCodeSeqhTab,&key)) {
-       int nfs =0;
-       
-       if (ic->op == CALL || ic->op == PCALL) return 0;
-
-       /* single operand icode are ok */
-       if (ic->op == IFX || ic->op == IPUSH)
-           continue ;
-
-       if (ic->op == SEND ) {
-           if (ic->argreg != 1 ) return 0;
-           else continue ;
-       }
-       /* two special cases first */
-       if (POINTER_GET(ic) && !isOperandEqual(IC_LEFT(ic),op)  && /* pointer get */
-           !OP_SYMBOL(IC_LEFT(ic))->ruonly                     && /* with result in far space */
-           (isOperandInFarSpace(IC_RESULT(ic)) &&              
-            !isOperandInReg(IC_RESULT(ic)))) {
-           return 0;
-       }
-
-       if (POINTER_SET(ic) && !isOperandEqual(IC_RESULT(ic),op)        && /* pointer set */
-           !OP_SYMBOL(IC_RESULT(ic))->ruonly                           && /* with right in far space */
-           (isOperandInFarSpace(IC_RIGHT(ic)) &&               
-            !isOperandInReg(IC_RIGHT(ic)))) {
-           return 0;
-       }
-
-       if (IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic))    && /* if symbol operand */
-           !isOperandEqual(IC_RESULT(ic),op)           && /* not the same as this */
-           ((isOperandInFarSpace(IC_RESULT(ic)) ||        /* in farspace or */
-             OP_SYMBOL(IC_RESULT(ic))->onStack)        && /* on the stack   */
-            !isOperandInReg(IC_RESULT(ic)))) {            /* and not in register */
-           nfs++;
-       }
-       /* same for left */
-       if (IC_LEFT(ic) && IS_SYMOP(IC_LEFT(ic))        && /* if symbol operand */
-           !isOperandEqual(IC_LEFT(ic),op)             && /* not the same as this */
-           ((isOperandInFarSpace(IC_LEFT(ic)) ||          /* in farspace or */
-             OP_SYMBOL(IC_LEFT(ic))->onStack)          && /* on the stack   */
-            !isOperandInReg(IC_LEFT(ic)))) {              /* and not in register */
-           nfs++;
-       }
-       /* same for right */
-       if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic))      && /* if symbol operand */
-           !isOperandEqual(IC_RIGHT(ic),op)            && /* not the same as this */
-           ((isOperandInFarSpace(IC_RIGHT(ic)) ||         /* in farspace or */
-             OP_SYMBOL(IC_RIGHT(ic))->onStack)         && /* on the stack   */
-            !isOperandInReg(IC_RIGHT(ic)))) {             /* and not in register */
-           nfs++;
-       }
-       
-       // Check that no other ops in this range have been assigned to dptr1.
-       // I don't understand why this is not caught by the first check, above.
-       // But it isn't always, see bug 769624.
-       if (IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic)) &&
-           (OP_SYMBOL(IC_RESULT(ic))->dptr == 1))
-       {           
-           //fprintf(stderr, "dptr1 already in use in live range #1\n");
-           return 0;
-       }
-       
-       if (IC_LEFT(ic) && IS_SYMOP(IC_LEFT(ic)) &&
-           (OP_SYMBOL(IC_LEFT(ic))->dptr == 1))
-       {           
-           //fprintf(stderr, "dptr1 already in use in live range # 2\n");
-           return 0;
-       }
-       
-       if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic)) &&
-           (OP_SYMBOL(IC_RIGHT(ic))->dptr == 1))
-       {           
-           //fprintf(stderr, "dptr1 already in use in live range # 3\n");
-           return 0;
-       }       
-       
-       if (nfs && IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic)) &&
-           OP_SYMBOL(IC_RESULT(ic))->ruonly) return 0;
-
-       if (nfs > 1) return 0;
+         ic = hTabNextItem(iCodeSeqhTab,&key)) {
+        int nfs =0;
+
+        if (ic->op == CALL || ic->op == PCALL) return 0;
+
+        /* single operand icode are ok */
+        if (ic->op == IFX || ic->op == IPUSH)
+            continue ;
+
+        if (ic->op == SEND ) {
+            if (ic->argreg != 1 ) return 0;
+            else continue ;
+        }
+        /* two special cases first */
+        if (POINTER_GET(ic) && !isOperandEqual(IC_LEFT(ic),op)  && /* pointer get */
+            !OP_SYMBOL(IC_LEFT(ic))->ruonly                     && /* with result in far space */
+            (isOperandInFarSpace(IC_RESULT(ic)) &&
+             !isOperandInReg(IC_RESULT(ic)))) {
+            return 0;
+        }
+
+        if (POINTER_SET(ic) && !isOperandEqual(IC_RESULT(ic),op)        && /* pointer set */
+            !OP_SYMBOL(IC_RESULT(ic))->ruonly                           && /* with right in far space */
+            (isOperandInFarSpace(IC_RIGHT(ic)) &&
+             !isOperandInReg(IC_RIGHT(ic)))) {
+            return 0;
+        }
+
+        if (IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic))    && /* if symbol operand */
+            !isOperandEqual(IC_RESULT(ic),op)           && /* not the same as this */
+            ((isOperandInFarSpace(IC_RESULT(ic)) ||        /* in farspace or */
+              OP_SYMBOL(IC_RESULT(ic))->onStack)        && /* on the stack   */
+             !isOperandInReg(IC_RESULT(ic)))) {            /* and not in register */
+            nfs++;
+        }
+        /* same for left */
+        if (IC_LEFT(ic) && IS_SYMOP(IC_LEFT(ic))        && /* if symbol operand */
+            !isOperandEqual(IC_LEFT(ic),op)             && /* not the same as this */
+            ((isOperandInFarSpace(IC_LEFT(ic)) ||          /* in farspace or */
+              OP_SYMBOL(IC_LEFT(ic))->onStack)          && /* on the stack   */
+             !isOperandInReg(IC_LEFT(ic)))) {              /* and not in register */
+            nfs++;
+        }
+        /* same for right */
+        if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic))      && /* if symbol operand */
+            !isOperandEqual(IC_RIGHT(ic),op)            && /* not the same as this */
+            ((isOperandInFarSpace(IC_RIGHT(ic)) ||         /* in farspace or */
+              OP_SYMBOL(IC_RIGHT(ic))->onStack)         && /* on the stack   */
+             !isOperandInReg(IC_RIGHT(ic)))) {             /* and not in register */
+            nfs++;
+        }
+
+        // Check that no other ops in this range have been assigned to dptr1.
+        // I don't understand why this is not caught by the first check, above.
+        // But it isn't always, see bug 769624.
+        if (IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic)) &&
+            (OP_SYMBOL(IC_RESULT(ic))->dptr == 1))
+        {
+            //fprintf(stderr, "dptr1 already in use in live range #1\n");
+            return 0;
+        }
+
+        if (IC_LEFT(ic) && IS_SYMOP(IC_LEFT(ic)) &&
+            (OP_SYMBOL(IC_LEFT(ic))->dptr == 1))
+        {
+            //fprintf(stderr, "dptr1 already in use in live range # 2\n");
+            return 0;
+        }
+
+        if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic)) &&
+            (OP_SYMBOL(IC_RIGHT(ic))->dptr == 1))
+        {
+            //fprintf(stderr, "dptr1 already in use in live range # 3\n");
+            return 0;
+        }
+
+        if (nfs && IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic)) &&
+            OP_SYMBOL(IC_RESULT(ic))->ruonly) return 0;
+
+        if (nfs > 1) return 0;
     }
     OP_SYMBOL(op)->dptr = dptr;
     return 1;
     }
     OP_SYMBOL(op)->dptr = dptr;
     return 1;
@@ -2436,111 +2449,111 @@ packRegsDPTRuse (operand * op)
     symbol *sym;
     iCode *ic, *dic;
     sym_link *type, *etype;
     symbol *sym;
     iCode *ic, *dic;
     sym_link *type, *etype;
-    
+
     if (!IS_SYMOP(op) || !IS_ITEMP(op)) return NULL;
     if (!IS_SYMOP(op) || !IS_ITEMP(op)) return NULL;
-    if (OP_SYMBOL(op)->remat || OP_SYMBOL(op)->ruonly) return NULL; 
+    if (OP_SYMBOL(op)->remat || OP_SYMBOL(op)->ruonly) return NULL;
 
     /* first check if any overlapping liverange has already been
        assigned to DPTR */
     if (OP_SYMBOL(op)->clashes) {
 
     /* first check if any overlapping liverange has already been
        assigned to DPTR */
     if (OP_SYMBOL(op)->clashes) {
-       for (i = 0 ; i < OP_SYMBOL(op)->clashes->size ; i++ ) {
-           if (bitVectBitValue(OP_SYMBOL(op)->clashes,i)) {
-               sym = hTabItemWithKey(liveRanges,i);
-               if (sym->ruonly) return NULL ;
-           }
-       }
+        for (i = 0 ; i < OP_SYMBOL(op)->clashes->size ; i++ ) {
+            if (bitVectBitValue(OP_SYMBOL(op)->clashes,i)) {
+                sym = hTabItemWithKey(liveRanges,i);
+                if (sym->ruonly) return NULL ;
+            }
+        }
     }
 
     /* no then go thru this guys live range */
     dic = ic = hTabFirstItemWK(iCodeSeqhTab,OP_SYMBOL(op)->liveFrom);
     for (; ic && ic->seq <= OP_SYMBOL(op)->liveTo;
     }
 
     /* no then go thru this guys live range */
     dic = ic = hTabFirstItemWK(iCodeSeqhTab,OP_SYMBOL(op)->liveFrom);
     for (; ic && ic->seq <= OP_SYMBOL(op)->liveTo;
-        ic = hTabNextItem(iCodeSeqhTab,&key)) {
-
-       if (SKIP_IC3(ic)) continue;
-
-       /* if PCALL cannot be sure give up */
-       if (ic->op == PCALL) return NULL;
-
-       /* if SEND & not the first parameter then giveup */
-       if (ic->op == SEND && ic->argreg != 1 &&
-           ((isOperandInFarSpace(IC_LEFT(ic))  && !isOperandInReg(IC_LEFT(ic))) || 
-            isOperandEqual(op,IC_LEFT(ic)))) return NULL;
-
-       /* if CALL then make sure it is VOID || return value not used 
-          or the return value is assigned to this one */
-       if (ic->op == CALL) {
-           if (OP_SYMBOL(IC_RESULT(ic))->liveTo == 
-               OP_SYMBOL(IC_RESULT(ic))->liveFrom) continue ;
-           etype = getSpec(type = operandType(IC_RESULT(ic)));
-           if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic))) 
-               continue ;
-           return NULL ;
-       }
-
-       /* special case of add with a [remat] */
-       if (ic->op == '+' && 
-           OP_SYMBOL(IC_LEFT(ic))->remat &&
-           (isOperandInFarSpace(IC_RIGHT(ic)) &&
-            !isOperandInReg(IC_RIGHT(ic)))) return NULL ;
-
-       /* special cases  */
-       /* pointerGet */
-       if (POINTER_GET(ic) && !isOperandEqual(IC_LEFT(ic),op) &&
-           getSize(operandType(IC_LEFT(ic))) > 1 ) return NULL ;
-
-       /* pointerSet */
-       if (POINTER_SET(ic) && !isOperandEqual(IC_RESULT(ic),op) &&
-           getSize(operandType(IC_RESULT(ic))) > 1 ) return NULL;
-
-       /* conditionals can destroy 'b' - make sure B wont 
-          be used in this one*/
-       if ((IS_CONDITIONAL(ic) || ic->op == '*' || ic->op == '/'  || 
-            ic->op == LEFT_OP || ic->op == RIGHT_OP ) && 
-           getSize(operandType(op)) > 3) return NULL;
-
-       /* if this is a cast to a bigger type */
-       if (ic->op==CAST) {
-         if (!IS_PTR(OP_SYM_TYPE(IC_RESULT(ic))) && 
-             getSize(OP_SYM_TYPE(IC_RESULT(ic))) >
-             getSize(OP_SYM_TYPE(IC_RIGHT(ic)))) {
-           return 0;
-         }
-       }
-
-       /* general case */
-       if (IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic)) && 
-           !isOperandEqual(IC_RESULT(ic),op) &&
-           ( ( ( isOperandInFarSpace(IC_RESULT(ic)) || OP_SYMBOL(IC_RESULT(ic))->onStack) && 
-               !isOperandInReg(IC_RESULT(ic))) || 
-            OP_SYMBOL(IC_RESULT(ic))->ruonly)) return NULL;
-
-       if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic)) && 
-           !isOperandEqual(IC_RIGHT(ic),op) &&
-           (OP_SYMBOL(IC_RIGHT(ic))->liveTo >= ic->seq || 
-            IS_TRUE_SYMOP(IC_RIGHT(ic))               ||
-            OP_SYMBOL(IC_RIGHT(ic))->ruonly) &&
-           ( ( isOperandInFarSpace(IC_RIGHT(ic)) || OP_SYMBOL(IC_RIGHT(ic))->onStack) && 
-               !isOperandInReg(IC_RIGHT(ic))) ) return NULL;
-
-       if (IC_LEFT(ic) && IS_SYMOP(IC_LEFT(ic)) && 
-           !isOperandEqual(IC_LEFT(ic),op) &&
-           (OP_SYMBOL(IC_LEFT(ic))->liveTo >= ic->seq || 
-            IS_TRUE_SYMOP(IC_LEFT(ic))               ||
-            OP_SYMBOL(IC_LEFT(ic))->ruonly) &&
-           ( ( isOperandInFarSpace(IC_LEFT(ic)) || OP_SYMBOL(IC_LEFT(ic))->onStack) && 
-               !isOperandInReg(IC_LEFT(ic))) ) return NULL;
-       
-       if (IC_LEFT(ic) && IC_RIGHT(ic) && 
-           IS_ITEMP(IC_LEFT(ic)) && IS_ITEMP(IC_RIGHT(ic)) &&
-           (isOperandInFarSpace(IC_LEFT(ic)) && !isOperandInReg(IC_LEFT(ic))) && 
-           (isOperandInFarSpace(IC_RIGHT(ic)) && !isOperandInReg(IC_RIGHT(ic))))
-           return NULL;
+         ic = hTabNextItem(iCodeSeqhTab,&key)) {
+
+        if (SKIP_IC3(ic)) continue;
+
+        /* if PCALL cannot be sure give up */
+        if (ic->op == PCALL) return NULL;
+
+        /* if SEND & not the first parameter then giveup */
+        if (ic->op == SEND && ic->argreg != 1 &&
+            ((isOperandInFarSpace(IC_LEFT(ic))  && !isOperandInReg(IC_LEFT(ic))) ||
+             isOperandEqual(op,IC_LEFT(ic)))) return NULL;
+
+        /* if CALL then make sure it is VOID || return value not used
+           or the return value is assigned to this one */
+        if (ic->op == CALL) {
+            if (OP_SYMBOL(IC_RESULT(ic))->liveTo ==
+                OP_SYMBOL(IC_RESULT(ic))->liveFrom) continue ;
+            etype = getSpec(type = operandType(IC_RESULT(ic)));
+            if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic)))
+                continue ;
+            return NULL ;
+        }
+
+        /* special case of add with a [remat] */
+        if (ic->op == '+' &&
+            OP_SYMBOL(IC_LEFT(ic))->remat &&
+            (isOperandInFarSpace(IC_RIGHT(ic)) &&
+             !isOperandInReg(IC_RIGHT(ic)))) return NULL ;
+
+        /* special cases  */
+        /* pointerGet */
+        if (POINTER_GET(ic) && !isOperandEqual(IC_LEFT(ic),op) &&
+            getSize(operandType(IC_LEFT(ic))) > 1 ) return NULL ;
+
+        /* pointerSet */
+        if (POINTER_SET(ic) && !isOperandEqual(IC_RESULT(ic),op) &&
+            getSize(operandType(IC_RESULT(ic))) > 1 ) return NULL;
+
+        /* conditionals can destroy 'b' - make sure B wont
+           be used in this one*/
+        if ((IS_CONDITIONAL(ic) || ic->op == '*' || ic->op == '/'  ||
+             ic->op == LEFT_OP || ic->op == RIGHT_OP ) &&
+            getSize(operandType(op)) > 3) return NULL;
+
+        /* if this is a cast to a bigger type */
+        if (ic->op==CAST) {
+          if (!IS_PTR(OP_SYM_TYPE(IC_RESULT(ic))) &&
+              getSize(OP_SYM_TYPE(IC_RESULT(ic))) >
+              getSize(OP_SYM_TYPE(IC_RIGHT(ic)))) {
+            return 0;
+          }
+        }
+
+        /* general case */
+        if (IC_RESULT(ic) && IS_SYMOP(IC_RESULT(ic)) &&
+            !isOperandEqual(IC_RESULT(ic),op) &&
+            ( ( ( isOperandInFarSpace(IC_RESULT(ic)) || OP_SYMBOL(IC_RESULT(ic))->onStack) &&
+                !isOperandInReg(IC_RESULT(ic))) ||
+             OP_SYMBOL(IC_RESULT(ic))->ruonly)) return NULL;
+
+        if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic)) &&
+            !isOperandEqual(IC_RIGHT(ic),op) &&
+            (OP_SYMBOL(IC_RIGHT(ic))->liveTo >= ic->seq ||
+             IS_TRUE_SYMOP(IC_RIGHT(ic))               ||
+             OP_SYMBOL(IC_RIGHT(ic))->ruonly) &&
+            ( ( isOperandInFarSpace(IC_RIGHT(ic)) || OP_SYMBOL(IC_RIGHT(ic))->onStack) &&
+                !isOperandInReg(IC_RIGHT(ic))) ) return NULL;
+
+        if (IC_LEFT(ic) && IS_SYMOP(IC_LEFT(ic)) &&
+            !isOperandEqual(IC_LEFT(ic),op) &&
+            (OP_SYMBOL(IC_LEFT(ic))->liveTo >= ic->seq ||
+             IS_TRUE_SYMOP(IC_LEFT(ic))               ||
+             OP_SYMBOL(IC_LEFT(ic))->ruonly) &&
+            ( ( isOperandInFarSpace(IC_LEFT(ic)) || OP_SYMBOL(IC_LEFT(ic))->onStack) &&
+                !isOperandInReg(IC_LEFT(ic))) ) return NULL;
+
+        if (IC_LEFT(ic) && IC_RIGHT(ic) &&
+            IS_ITEMP(IC_LEFT(ic)) && IS_ITEMP(IC_RIGHT(ic)) &&
+            (isOperandInFarSpace(IC_LEFT(ic)) && !isOperandInReg(IC_LEFT(ic))) &&
+            (isOperandInFarSpace(IC_RIGHT(ic)) && !isOperandInReg(IC_RIGHT(ic))))
+            return NULL;
     }
     OP_SYMBOL(op)->ruonly = 1;
     if (OP_SYMBOL(op)->usl.spillLoc) {
     }
     OP_SYMBOL(op)->ruonly = 1;
     if (OP_SYMBOL(op)->usl.spillLoc) {
-       if (OP_SYMBOL(op)->spillA)
-           OP_SYMBOL(op)->usl.spillLoc->allocreq--;
-       OP_SYMBOL(op)->usl.spillLoc = NULL;
+        if (OP_SYMBOL(op)->spillA)
+            OP_SYMBOL(op)->usl.spillLoc->allocreq--;
+        OP_SYMBOL(op)->usl.spillLoc = NULL;
     }
     return dic;
 }
     }
     return dic;
 }
@@ -2555,7 +2568,7 @@ isBitwiseOptimizable (iCode * ic)
   sym_link *rtype = getSpec (operandType (IC_RIGHT (ic)));
 
   /* bitwise operations are considered optimizable
   sym_link *rtype = getSpec (operandType (IC_RIGHT (ic)));
 
   /* bitwise operations are considered optimizable
-     under the following conditions (Jean-Louis VERN) 
+     under the following conditions (Jean-Louis VERN)
 
      x & lit
      bit & bit
 
      x & lit
      bit & bit
@@ -2567,7 +2580,7 @@ isBitwiseOptimizable (iCode * ic)
      bit | bit
      bit | x
    */
      bit | bit
      bit | x
    */
-  if ( IS_LITERAL (rtype) ||
+  if (IS_LITERAL (rtype) ||
       (IS_BITVAR (ltype) && IN_BITSPACE (SPEC_OCLS (ltype))))
     return TRUE;
   else
       (IS_BITVAR (ltype) && IN_BITSPACE (SPEC_OCLS (ltype))))
     return TRUE;
   else
@@ -2629,7 +2642,7 @@ packRegsForAccUse (iCode * ic)
 
   /* and the usage immediately follows this iCode */
   if (!(uic = hTabItemWithKey (iCodehTab,
 
   /* and the usage immediately follows this iCode */
   if (!(uic = hTabItemWithKey (iCodehTab,
-                              bitVectFirstBit (OP_USES (IC_RESULT (ic))))))
+                               bitVectFirstBit (OP_USES (IC_RESULT (ic))))))
     return;
 
   if (ic->next != uic)
     return;
 
   if (ic->next != uic)
@@ -2655,7 +2668,7 @@ packRegsForAccUse (iCode * ic)
       uic->op != RIGHT_OP)
     return;
 
       uic->op != RIGHT_OP)
     return;
 
-  /* if used in ^ operation then make sure right is not a 
+  /* if used in ^ operation then make sure right is not a
      literl */
   if (uic->op == '^' && isOperandLiteral (IC_RIGHT (uic)))
     return;
      literl */
   if (uic->op == '^' && isOperandLiteral (IC_RIGHT (uic)))
     return;
@@ -2698,13 +2711,13 @@ packRegsForAccUse (iCode * ic)
   if (IC_LEFT (uic)->key == IC_RESULT (ic)->key &&
       (IS_ITEMP (IC_RIGHT (uic)) ||
        (IS_TRUE_SYMOP (IC_RIGHT (uic)) &&
   if (IC_LEFT (uic)->key == IC_RESULT (ic)->key &&
       (IS_ITEMP (IC_RIGHT (uic)) ||
        (IS_TRUE_SYMOP (IC_RIGHT (uic)) &&
-       !OP_SYMBOL (IC_RIGHT (uic))->onStack)))
+        !OP_SYMBOL (IC_RIGHT (uic))->onStack)))
     goto accuse;
 
   if (IC_RIGHT (uic)->key == IC_RESULT (ic)->key &&
       (IS_ITEMP (IC_LEFT (uic)) ||
        (IS_TRUE_SYMOP (IC_LEFT (uic)) &&
     goto accuse;
 
   if (IC_RIGHT (uic)->key == IC_RESULT (ic)->key &&
       (IS_ITEMP (IC_LEFT (uic)) ||
        (IS_TRUE_SYMOP (IC_LEFT (uic)) &&
-       !OP_SYMBOL (IC_LEFT (uic))->onStack)))
+        !OP_SYMBOL (IC_LEFT (uic))->onStack)))
     goto accuse;
 
   return;
     goto accuse;
 
   return;
@@ -2712,7 +2725,6 @@ packRegsForAccUse (iCode * ic)
 accuse:
   OP_SYMBOL (IC_RESULT (ic))->accuse = 1;
 
 accuse:
   OP_SYMBOL (IC_RESULT (ic))->accuse = 1;
 
-
 }
 
 /*-----------------------------------------------------------------*/
 }
 
 /*-----------------------------------------------------------------*/
@@ -2734,19 +2746,19 @@ packForPush (iCode * ic, eBBlock * ebp)
 
   /* find the definition */
   if (!(dic = hTabItemWithKey (iCodehTab,
 
   /* find the definition */
   if (!(dic = hTabItemWithKey (iCodehTab,
-                              bitVectFirstBit (OP_DEFS (IC_LEFT (ic))))))
+                               bitVectFirstBit (OP_DEFS (IC_LEFT (ic))))))
     return;
 
   if (dic->op != '=' || POINTER_SET (dic))
     return;
     return;
 
   if (dic->op != '=' || POINTER_SET (dic))
     return;
-  
+
   if (dic->eBBlockNum != ic->eBBlockNum) return ;
 
   /* make sure the right side does not have any definitions
      inbetween */
   dbv = OP_DEFS(IC_RIGHT(dic));
   for (lic = ic; lic && lic != dic ; lic = lic->prev) {
   if (dic->eBBlockNum != ic->eBBlockNum) return ;
 
   /* make sure the right side does not have any definitions
      inbetween */
   dbv = OP_DEFS(IC_RIGHT(dic));
   for (lic = ic; lic && lic != dic ; lic = lic->prev) {
-         if (bitVectBitValue(dbv,lic->key)) return ;
+          if (bitVectBitValue(dbv,lic->key)) return ;
   }
   /* make sure they have the same type */
   if (IS_SPEC(operandType(IC_LEFT(ic))))
   }
   /* make sure they have the same type */
   if (IS_SPEC(operandType(IC_LEFT(ic))))
@@ -2755,21 +2767,21 @@ packForPush (iCode * ic, eBBlock * ebp)
     sym_link *ditype=operandType(IC_RIGHT(dic));
 
     if (SPEC_USIGN(itype)!=SPEC_USIGN(ditype) ||
     sym_link *ditype=operandType(IC_RIGHT(dic));
 
     if (SPEC_USIGN(itype)!=SPEC_USIGN(ditype) ||
-       SPEC_LONG(itype)!=SPEC_LONG(ditype))
+        SPEC_LONG(itype)!=SPEC_LONG(ditype))
       return;
   }
   /* extend the live range of replaced operand if needed */
   if (OP_SYMBOL(IC_RIGHT(dic))->liveTo < OP_SYMBOL(IC_LEFT(ic))->liveTo) {
       return;
   }
   /* extend the live range of replaced operand if needed */
   if (OP_SYMBOL(IC_RIGHT(dic))->liveTo < OP_SYMBOL(IC_LEFT(ic))->liveTo) {
-         OP_SYMBOL(IC_RIGHT(dic))->liveTo = OP_SYMBOL(IC_LEFT(ic))->liveTo;
-         OP_SYMBOL(IC_RIGHT(dic))->clashes =
-             bitVectUnion(OP_SYMBOL(IC_RIGHT(dic))->clashes,
-                          OP_SYMBOL(IC_LEFT(ic))->clashes);
+          OP_SYMBOL(IC_RIGHT(dic))->liveTo = OP_SYMBOL(IC_LEFT(ic))->liveTo;
+          OP_SYMBOL(IC_RIGHT(dic))->clashes =
+              bitVectUnion(OP_SYMBOL(IC_RIGHT(dic))->clashes,
+                           OP_SYMBOL(IC_LEFT(ic))->clashes);
   }
   for (lic = ic; lic && lic != dic; lic = lic->prev)
     {
       bitVectUnSetBit (lic->rlive, IC_LEFT (ic)->key);
       if (IS_ITEMP (IC_RIGHT (dic)))
   }
   for (lic = ic; lic && lic != dic; lic = lic->prev)
     {
       bitVectUnSetBit (lic->rlive, IC_LEFT (ic)->key);
       if (IS_ITEMP (IC_RIGHT (dic)))
-       bitVectSetBit (lic->rlive, IC_RIGHT (dic)->key);
+        bitVectSetBit (lic->rlive, IC_RIGHT (dic)->key);
     }
   /* we now we know that it has one & only one def & use
      and the that the definition is an assignment */
     }
   /* we now we know that it has one & only one def & use
      and the that the definition is an assignment */
@@ -2800,273 +2812,270 @@ packRegisters (eBBlock * ebp)
       /*       ....                       */
       /* TrueSym := iTempNN:1             */
       for (ic = ebp->sch; ic; ic = ic->next)
       /*       ....                       */
       /* TrueSym := iTempNN:1             */
       for (ic = ebp->sch; ic; ic = ic->next)
-       {
-
-
-         /* find assignment of the form TrueSym := iTempNN:1 */
-         if (ic->op == '=' && !POINTER_SET (ic))
-           change += packRegsForAssign (ic, ebp);
-       }
+        {
+          /* find assignment of the form TrueSym := iTempNN:1 */
+          if (ic->op == '=' && !POINTER_SET (ic))
+            change += packRegsForAssign (ic, ebp);
+        }
 
       if (!change)
 
       if (!change)
-       break;
+        break;
     }
 
   for (ic = ebp->sch; ic; ic = ic->next)
     {
     }
 
   for (ic = ebp->sch; ic; ic = ic->next)
     {
-
-      /* if this is an itemp & result of a address of a true sym 
+      /* if this is an itemp & result of an address of a true sym
          then mark this as rematerialisable   */
       if (ic->op == ADDRESS_OF &&
          then mark this as rematerialisable   */
       if (ic->op == ADDRESS_OF &&
-         IS_ITEMP (IC_RESULT (ic)) &&
-         IS_TRUE_SYMOP (IC_LEFT (ic)) &&
-         bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
-         !OP_SYMBOL (IC_LEFT (ic))->onStack)
-       {
-
-         OP_SYMBOL (IC_RESULT (ic))->remat = 1;
-         OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
-         OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
-
-       }
-
-       /* if this is an itemp & used as a pointer
-          & assigned to a literal then remat */
-       if (IS_ASSIGN_ICODE(ic) && 
-           IS_ITEMP(IC_RESULT(ic)) &&
-           bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
-           isOperandLiteral(IC_RIGHT(ic))) 
-       {
-         OP_SYMBOL (IC_RESULT (ic))->remat = 1;
-         OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
-         OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;          
-       }
+          IS_ITEMP (IC_RESULT (ic)) &&
+          IS_TRUE_SYMOP (IC_LEFT (ic)) &&
+          bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
+          !OP_SYMBOL (IC_LEFT (ic))->onStack)
+        {
+
+          OP_SYMBOL (IC_RESULT (ic))->remat = 1;
+          OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
+          OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
+
+        }
+
+        /* if this is an itemp & used as a pointer
+           & assigned to a literal then remat */
+        if (IS_ASSIGN_ICODE(ic) &&
+            IS_ITEMP(IC_RESULT(ic)) &&
+            bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
+            isOperandLiteral(IC_RIGHT(ic)))
+        {
+          OP_SYMBOL (IC_RESULT (ic))->remat = 1;
+          OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
+          OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
+        }
 
       /* if straight assignment then carry remat flag if
          this is the only definition */
       if (ic->op == '=' &&
 
       /* if straight assignment then carry remat flag if
          this is the only definition */
       if (ic->op == '=' &&
-         !POINTER_SET (ic) &&
-         IS_SYMOP (IC_RIGHT (ic)) &&
-         OP_SYMBOL (IC_RIGHT (ic))->remat &&
-         !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode) &&
-         bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1)
-       {
-
-         OP_SYMBOL (IC_RESULT (ic))->remat =
-           OP_SYMBOL (IC_RIGHT (ic))->remat;
-         OP_SYMBOL (IC_RESULT (ic))->rematiCode =
-           OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
-       }
-      
+          !POINTER_SET (ic) &&
+          IS_SYMOP (IC_RIGHT (ic)) &&
+          OP_SYMBOL (IC_RIGHT (ic))->remat &&
+          !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode) &&
+          bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1)
+        {
+
+          OP_SYMBOL (IC_RESULT (ic))->remat =
+            OP_SYMBOL (IC_RIGHT (ic))->remat;
+          OP_SYMBOL (IC_RESULT (ic))->rematiCode =
+            OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
+        }
+
       /* if cast to a generic pointer & the pointer being
       /* if cast to a generic pointer & the pointer being
-        cast is remat, then we can remat this cast as well */
-      if (ic->op == CAST && 
-         IS_SYMOP(IC_RIGHT(ic)) &&
-         !OP_SYMBOL(IC_RESULT(ic))->isreqv &&
-         OP_SYMBOL(IC_RIGHT(ic))->remat ) {
-             sym_link *to_type = operandType(IC_LEFT(ic));
-             sym_link *from_type = operandType(IC_RIGHT(ic));
-             if (IS_GENPTR(to_type) && IS_PTR(from_type)) {                  
-                     OP_SYMBOL (IC_RESULT (ic))->remat = 1;
-                     OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
-                     OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
-             }
+         cast is remat, then we can remat this cast as well */
+      if (ic->op == CAST &&
+          IS_SYMOP(IC_RIGHT(ic)) &&
+          !OP_SYMBOL(IC_RESULT(ic))->isreqv &&
+          OP_SYMBOL(IC_RIGHT(ic))->remat ) {
+              sym_link *to_type = operandType(IC_LEFT(ic));
+              sym_link *from_type = operandType(IC_RIGHT(ic));
+              if (IS_GENPTR(to_type) && IS_PTR(from_type)) {
+                      OP_SYMBOL (IC_RESULT (ic))->remat = 1;
+                      OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
+                      OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
+              }
       }
 
       }
 
-      /* if this is a +/- operation with a rematerizable 
+      /* if this is a +/- operation with a rematerizable
          then mark this as rematerializable as well */
       if ((ic->op == '+' || ic->op == '-') &&
          then mark this as rematerializable as well */
       if ((ic->op == '+' || ic->op == '-') &&
-         (IS_SYMOP (IC_LEFT (ic)) &&
-          IS_ITEMP (IC_RESULT (ic)) &&
-          OP_SYMBOL (IC_LEFT (ic))->remat &&
-          (!IS_SYMOP (IC_RIGHT (ic)) || !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode)) &&
-          bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
-          IS_OP_LITERAL (IC_RIGHT (ic))))
-       {
-
-         //int i = operandLitValue(IC_RIGHT(ic));
-         OP_SYMBOL (IC_RESULT (ic))->remat = 1;
-         OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
-         OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
-       }
+          (IS_SYMOP (IC_LEFT (ic)) &&
+           IS_ITEMP (IC_RESULT (ic)) &&
+           OP_SYMBOL (IC_LEFT (ic))->remat &&
+           (!IS_SYMOP (IC_RIGHT (ic)) || !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode)) &&
+           bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
+           IS_OP_LITERAL (IC_RIGHT (ic))))
+        {
+
+          //int i = operandLitValue(IC_RIGHT(ic));
+          OP_SYMBOL (IC_RESULT (ic))->remat = 1;
+          OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
+          OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
+        }
 
       /* mark the pointer usages */
       if (POINTER_SET (ic) && IS_SYMOP (IC_RESULT (ic)))
 
       /* mark the pointer usages */
       if (POINTER_SET (ic) && IS_SYMOP (IC_RESULT (ic)))
-       OP_SYMBOL (IC_RESULT (ic))->uptr = 1;
+        OP_SYMBOL (IC_RESULT (ic))->uptr = 1;
 
       if (POINTER_GET (ic) && IS_SYMOP (IC_LEFT (ic)))
 
       if (POINTER_GET (ic) && IS_SYMOP (IC_LEFT (ic)))
-       OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
+        OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
 
       if (ic->op == RETURN && IS_SYMOP (IC_LEFT(ic)))
 
       if (ic->op == RETURN && IS_SYMOP (IC_LEFT(ic)))
-         OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
+          OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
 
       if (ic->op == RECEIVE && ic->argreg == 1 &&
 
       if (ic->op == RECEIVE && ic->argreg == 1 &&
-         IS_SYMOP (IC_RESULT (ic)) &&
-         getSize (operandType(IC_RESULT(ic))) <= 3)
-         OP_SYMBOL (IC_RESULT(ic))->uptr = 1;
+          IS_SYMOP (IC_RESULT (ic)) &&
+          getSize (operandType(IC_RESULT(ic))) <= 3)
+          OP_SYMBOL (IC_RESULT(ic))->uptr = 1;
 
       if (ic->op == SEND && ic->argreg == 1 &&
 
       if (ic->op == SEND && ic->argreg == 1 &&
-         IS_SYMOP(IC_LEFT(ic)) &&
-         getSize (aggrToPtr(operandType(IC_LEFT(ic)),FALSE)) <= 3)
-         OP_SYMBOL (IC_LEFT(ic))->uptr = 1;
+          IS_SYMOP(IC_LEFT(ic)) &&
+          getSize (aggrToPtr(operandType(IC_LEFT(ic)),FALSE)) <= 3)
+          OP_SYMBOL (IC_LEFT(ic))->uptr = 1;
 
       if (!SKIP_IC2 (ic))
 
       if (!SKIP_IC2 (ic))
-       {
-         /* if we are using a symbol on the stack
-            then we should say ds390_ptrRegReq */
-         if (options.useXstack && ic->parmPush
-             && (ic->op == IPUSH || ic->op == IPOP))
-           ds390_ptrRegReq++;
-         if (ic->op == IFX && IS_SYMOP (IC_COND (ic)))
-                 ds390_ptrRegReq += ((OP_SYMBOL (IC_COND (ic))->onStack ? !options.stack10bit : 0) +
-                                     OP_SYMBOL (IC_COND (ic))->iaccess +
-                                     (SPEC_OCLS(OP_SYMBOL (IC_COND (ic))->etype) == idata));
-         else if (ic->op == JUMPTABLE && IS_SYMOP (IC_JTCOND (ic)))
-                 ds390_ptrRegReq += ((OP_SYMBOL (IC_JTCOND (ic))->onStack ? !options.stack10bit : 0) +
-                                     OP_SYMBOL (IC_JTCOND (ic))->iaccess +
-                                     (SPEC_OCLS(OP_SYMBOL (IC_JTCOND (ic))->etype) == idata));
-         else
-           {
-             if (IS_SYMOP (IC_LEFT (ic)))
-                     ds390_ptrRegReq += ((OP_SYMBOL (IC_LEFT (ic))->onStack ? !options.stack10bit : 0) +
-                                         OP_SYMBOL (IC_LEFT (ic))->iaccess +
-                                         (SPEC_OCLS(OP_SYMBOL (IC_LEFT (ic))->etype) == idata));
-             if (IS_SYMOP (IC_RIGHT (ic)))
-                     ds390_ptrRegReq += ((OP_SYMBOL (IC_RIGHT (ic))->onStack ? !options.stack10bit : 0) +
-                                         OP_SYMBOL (IC_RIGHT (ic))->iaccess +
-                                         (SPEC_OCLS(OP_SYMBOL (IC_RIGHT (ic))->etype) == idata));
-             if (IS_SYMOP (IC_RESULT (ic)))
-                     ds390_ptrRegReq += ((OP_SYMBOL (IC_RESULT (ic))->onStack ? !options.stack10bit : 0) +
-                                         OP_SYMBOL (IC_RESULT (ic))->iaccess +
-                                         (SPEC_OCLS(OP_SYMBOL (IC_RESULT (ic))->etype) == idata));
-           }
-       }
+        {
+          /* if we are using a symbol on the stack
+             then we should say ds390_ptrRegReq */
+          if (options.useXstack && ic->parmPush
+              && (ic->op == IPUSH || ic->op == IPOP))
+            ds390_ptrRegReq++;
+          if (ic->op == IFX && IS_SYMOP (IC_COND (ic)))
+                  ds390_ptrRegReq += ((OP_SYMBOL (IC_COND (ic))->onStack ? !options.stack10bit : 0) +
+                                      OP_SYMBOL (IC_COND (ic))->iaccess +
+                                      (SPEC_OCLS(OP_SYMBOL (IC_COND (ic))->etype) == idata));
+          else if (ic->op == JUMPTABLE && IS_SYMOP (IC_JTCOND (ic)))
+                  ds390_ptrRegReq += ((OP_SYMBOL (IC_JTCOND (ic))->onStack ? !options.stack10bit : 0) +
+                                      OP_SYMBOL (IC_JTCOND (ic))->iaccess +
+                                      (SPEC_OCLS(OP_SYMBOL (IC_JTCOND (ic))->etype) == idata));
+          else
+            {
+              if (IS_SYMOP (IC_LEFT (ic)))
+                      ds390_ptrRegReq += ((OP_SYMBOL (IC_LEFT (ic))->onStack ? !options.stack10bit : 0) +
+                                          OP_SYMBOL (IC_LEFT (ic))->iaccess +
+                                          (SPEC_OCLS(OP_SYMBOL (IC_LEFT (ic))->etype) == idata));
+              if (IS_SYMOP (IC_RIGHT (ic)))
+                      ds390_ptrRegReq += ((OP_SYMBOL (IC_RIGHT (ic))->onStack ? !options.stack10bit : 0) +
+                                          OP_SYMBOL (IC_RIGHT (ic))->iaccess +
+                                          (SPEC_OCLS(OP_SYMBOL (IC_RIGHT (ic))->etype) == idata));
+              if (IS_SYMOP (IC_RESULT (ic)))
+                      ds390_ptrRegReq += ((OP_SYMBOL (IC_RESULT (ic))->onStack ? !options.stack10bit : 0) +
+                                          OP_SYMBOL (IC_RESULT (ic))->iaccess +
+                                          (SPEC_OCLS(OP_SYMBOL (IC_RESULT (ic))->etype) == idata));
+            }
+        }
 
       /* if the condition of an if instruction
          is defined in the previous instruction and
 
       /* if the condition of an if instruction
          is defined in the previous instruction and
-        this is the only usage then
+         this is the only usage then
          mark the itemp as a conditional */
       if ((IS_CONDITIONAL (ic) ||
          mark the itemp as a conditional */
       if ((IS_CONDITIONAL (ic) ||
-          (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic))) &&
-         ic->next && ic->next->op == IFX &&
-         bitVectnBitsOn (OP_USES(IC_RESULT(ic)))==1 &&
-         isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) &&
-         OP_SYMBOL (IC_RESULT (ic))->liveTo <= ic->next->seq)
-       {
-         OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND;
-         continue;
-       }
+           (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic))) &&
+          ic->next && ic->next->op == IFX &&
+          bitVectnBitsOn (OP_USES(IC_RESULT(ic)))==1 &&
+          isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) &&
+          OP_SYMBOL (IC_RESULT (ic))->liveTo <= ic->next->seq)
+        {
+          OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND;
+          continue;
+        }
 #if 1
       /* reduce for support function calls */
       if (ic->supportRtn || ic->op == '+' || ic->op == '-')
 #if 1
       /* reduce for support function calls */
       if (ic->supportRtn || ic->op == '+' || ic->op == '-')
-       packRegsForSupport (ic, ebp);
+        packRegsForSupport (ic, ebp);
 #endif
       /* some cases the redundant moves can
 #endif
       /* some cases the redundant moves can
-         can be eliminated for return statements . Can be elminated for the first SEND */      
-      if ((ic->op == RETURN || 
-          ((ic->op == SEND || ic->op == RECEIVE)&& ic->argreg == 1)) &&          
-         !isOperandInFarSpace (IC_LEFT (ic)) &&
-         !options.model) {
-        
-         packRegsDPTRuse (IC_LEFT (ic));
+         can be eliminated for return statements . Can be elminated for the first SEND */
+      if ((ic->op == RETURN ||
+           ((ic->op == SEND || ic->op == RECEIVE)&& ic->argreg == 1)) &&
+          !isOperandInFarSpace (IC_LEFT (ic)) &&
+          !options.model) {
+
+          packRegsDPTRuse (IC_LEFT (ic));
       }
 
       if (ic->op == CALL) {
       }
 
       if (ic->op == CALL) {
-         sym_link *ftype = operandType(IC_LEFT(ic));
-         if (getSize(operandType(IC_RESULT(ic))) <= 4 &&
-             !IFFUNC_ISBUILTIN(ftype)) {
-             packRegsDPTRuse (IC_RESULT (ic));   
-         }
+          sym_link *ftype = operandType(IC_LEFT(ic));
+          if (getSize(operandType(IC_RESULT(ic))) <= 4 &&
+              !IFFUNC_ISBUILTIN(ftype)) {
+              packRegsDPTRuse (IC_RESULT (ic));
+          }
       }
 
       /* if pointer set & left has a size more than
          one and right is not in far space */
       if (POINTER_SET (ic) &&
       }
 
       /* if pointer set & left has a size more than
          one and right is not in far space */
       if (POINTER_SET (ic) &&
-         !isOperandInFarSpace (IC_RIGHT (ic)) &&
-         IS_SYMOP (IC_RESULT (ic)) &&
-         !OP_SYMBOL (IC_RESULT (ic))->remat &&
-         !IS_OP_RUONLY (IC_RIGHT (ic)) &&
-         getSize (aggrToPtr (operandType (IC_RESULT (ic)), FALSE)) > 1) {
-         
-         packRegsDPTRuse (IC_RESULT (ic));
+          !isOperandInFarSpace (IC_RIGHT (ic)) &&
+          IS_SYMOP (IC_RESULT (ic)) &&
+          !OP_SYMBOL (IC_RESULT (ic))->remat &&
+          !IS_OP_RUONLY (IC_RIGHT (ic)) &&
+          getSize (aggrToPtr (operandType (IC_RESULT (ic)), FALSE)) > 1) {
+
+          packRegsDPTRuse (IC_RESULT (ic));
       }
 
       /* if pointer get */
       if (POINTER_GET (ic) &&
       }
 
       /* if pointer get */
       if (POINTER_GET (ic) &&
-         !isOperandInFarSpace (IC_RESULT (ic)) &&
-         IS_SYMOP (IC_LEFT (ic)) &&
-         !OP_SYMBOL (IC_LEFT (ic))->remat &&
-         !IS_OP_RUONLY (IC_RESULT (ic)) &&
-         getSize (aggrToPtr (operandType (IC_LEFT (ic)), FALSE)) > 1) {
+          !isOperandInFarSpace (IC_RESULT (ic)) &&
+          IS_SYMOP (IC_LEFT (ic)) &&
+          !OP_SYMBOL (IC_LEFT (ic))->remat &&
+          !IS_OP_RUONLY (IC_RESULT (ic)) &&
+          getSize (aggrToPtr (operandType (IC_LEFT (ic)), FALSE)) > 1) {
 
 
-         packRegsDPTRuse (IC_LEFT (ic));
+          packRegsDPTRuse (IC_LEFT (ic));
       }
 
       /* if this is cast for intergral promotion then
       }
 
       /* if this is cast for intergral promotion then
-         check if only use of  the definition of the 
+         check if only use of  the definition of the
          operand being casted/ if yes then replace
          operand being casted/ if yes then replace
-         the result of that arithmetic operation with 
+         the result of that arithmetic operation with
          this result and get rid of the cast */
       if (ic->op == CAST)
          this result and get rid of the cast */
       if (ic->op == CAST)
-       {
-         sym_link *fromType = operandType (IC_RIGHT (ic));
-         sym_link *toType = operandType (IC_LEFT (ic));
-
-         if (IS_INTEGRAL (fromType) && IS_INTEGRAL (toType) &&
-             getSize (fromType) != getSize (toType) &&
-             SPEC_USIGN (fromType) == SPEC_USIGN (toType))
-           {
-
-             iCode *dic = packRegsDPTRuse (IC_RIGHT (ic));
-             if (dic)
-               {
-                 if (IS_ARITHMETIC_OP (dic))
-                   {
-                     bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
-                     IC_RESULT (dic) = IC_RESULT (ic);
-                     remiCodeFromeBBlock (ebp, ic);
-                     bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
-                     hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
-                     OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
-                     ic = ic->prev;
-                   }
-                 else
-                   OP_SYMBOL (IC_RIGHT (ic))->ruonly = 0;
-               }
-           }
-         else
-           {
-
-             /* if the type from and type to are the same
-                then if this is the only use then packit */
-             if (compareType (operandType (IC_RIGHT (ic)),
-                            operandType (IC_LEFT (ic))) == 1)
-               {
-                 iCode *dic = packRegsDPTRuse (IC_RIGHT (ic));
-                 if (dic)
-                   {
-                     bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
-                     IC_RESULT (dic) = IC_RESULT (ic);
-                     remiCodeFromeBBlock (ebp, ic);
-                     bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
-                     hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
-                     OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
-                     ic = ic->prev;
-                   }
-               }
-           }
-       }
-
-      /* pack for PUSH 
+        {
+          sym_link *fromType = operandType (IC_RIGHT (ic));
+          sym_link *toType = operandType (IC_LEFT (ic));
+
+          if (IS_INTEGRAL (fromType) && IS_INTEGRAL (toType) &&
+              getSize (fromType) != getSize (toType) &&
+              SPEC_USIGN (fromType) == SPEC_USIGN (toType))
+            {
+
+              iCode *dic = packRegsDPTRuse (IC_RIGHT (ic));
+              if (dic)
+                {
+                  if (IS_ARITHMETIC_OP (dic))
+                    {
+                      bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
+                      IC_RESULT (dic) = IC_RESULT (ic);
+                      remiCodeFromeBBlock (ebp, ic);
+                      bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
+                      hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
+                      OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
+                      ic = ic->prev;
+                    }
+                  else
+                    OP_SYMBOL (IC_RIGHT (ic))->ruonly = 0;
+                }
+            }
+          else
+            {
+
+              /* if the type from and type to are the same
+                 then if this is the only use then packit */
+              if (compareType (operandType (IC_RIGHT (ic)),
+                             operandType (IC_LEFT (ic))) == 1)
+                {
+                  iCode *dic = packRegsDPTRuse (IC_RIGHT (ic));
+                  if (dic)
+                    {
+                      bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
+                      IC_RESULT (dic) = IC_RESULT (ic);
+                      remiCodeFromeBBlock (ebp, ic);
+                      bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
+                      hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
+                      OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
+                      ic = ic->prev;
+                    }
+                }
+            }
+        }
+
+      /* pack for PUSH
          iTempNN := (some variable in farspace) V1
          push iTempNN ;
          -------------
          push V1
        */
       if (ic->op == IPUSH || ic->op == SEND)
          iTempNN := (some variable in farspace) V1
          push iTempNN ;
          -------------
          push V1
        */
       if (ic->op == IPUSH || ic->op == SEND)
-       {
-         packForPush (ic, ebp);
-       }
+        {
+          packForPush (ic, ebp);
+        }
 
 
       /* pack registers for accumulator use, when the
 
 
       /* pack registers for accumulator use, when the
@@ -3078,16 +3087,16 @@ packRegisters (eBBlock * ebp)
          we can leave the result of this operation in acc:b
          combination */
       if ((IS_ARITHMETIC_OP (ic)
          we can leave the result of this operation in acc:b
          combination */
       if ((IS_ARITHMETIC_OP (ic)
-          || IS_CONDITIONAL(ic)
-          || IS_BITWISE_OP (ic)
-          || ic->op == LEFT_OP || ic->op == RIGHT_OP 
-          || (ic->op == ADDRESS_OF && isOperandOnStack (IC_LEFT (ic)))
-         ) &&
-         IS_ITEMP (IC_RESULT (ic)) &&
-         getSize (operandType (IC_RESULT (ic))) <= 2)
-
-       packRegsForAccUse (ic);
-      
+           || IS_CONDITIONAL(ic)
+           || IS_BITWISE_OP (ic)
+           || ic->op == LEFT_OP || ic->op == RIGHT_OP
+           || (ic->op == ADDRESS_OF && isOperandOnStack (IC_LEFT (ic)))
+          ) &&
+          IS_ITEMP (IC_RESULT (ic)) &&
+          getSize (operandType (IC_RESULT (ic))) <= 2)
+
+        packRegsForAccUse (ic);
+
     }
 }
 
     }
 }
 
@@ -3100,10 +3109,10 @@ ds390_assignRegisters (eBBlock ** ebbs, int count)
   iCode *ic;
   int i;
 
   iCode *ic;
   int i;
 
-  setToNull ((void *) &_G.funcrUsed);  
-  setToNull ((void *) &_G.regAssigned);  
-  setToNull ((void *) &_G.totRegAssigned);  
-  setToNull ((void *) &_G.funcrUsed);  
+  setToNull ((void *) &_G.funcrUsed);
+  setToNull ((void *) &_G.regAssigned);
+  setToNull ((void *) &_G.totRegAssigned);
+  setToNull ((void *) &_G.funcrUsed);
   ds390_ptrRegReq = _G.stackExtend = _G.dataExtend = 0;
   ds390_nRegs = 12;
   if (options.model != MODEL_FLAT24) options.stack10bit = 0;
   ds390_ptrRegReq = _G.stackExtend = _G.dataExtend = 0;
   ds390_nRegs = 12;
   if (options.model != MODEL_FLAT24) options.stack10bit = 0;
@@ -3119,7 +3128,7 @@ ds390_assignRegisters (eBBlock ** ebbs, int count)
   if (options.dump_pack)
     dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
 
   if (options.dump_pack)
     dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
 
-  /* first determine for each live range the number of 
+  /* first determine for each live range the number of
      registers & the type of registers required for each */
   regTypeNum ();
 
      registers & the type of registers required for each */
   regTypeNum ();
 
@@ -3161,7 +3170,7 @@ ds390_assignRegisters (eBBlock ** ebbs, int count)
       currFunc->regsUsed = bitVectSetBit (currFunc->regsUsed, R0_IDX);
       currFunc->regsUsed = bitVectSetBit (currFunc->regsUsed, R1_IDX);
     }
       currFunc->regsUsed = bitVectSetBit (currFunc->regsUsed, R0_IDX);
       currFunc->regsUsed = bitVectSetBit (currFunc->regsUsed, R1_IDX);
     }
-    
+
   if (options.dump_rassgn) {
     dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
     dumpLiveRanges (DUMP_LRANGE, liveRanges);
   if (options.dump_rassgn) {
     dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
     dumpLiveRanges (DUMP_LRANGE, liveRanges);
@@ -3173,7 +3182,6 @@ ds390_assignRegisters (eBBlock ** ebbs, int count)
   /* now get back the chain */
   ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));
 
   /* now get back the chain */
   ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));
 
-
   gen390Code (ic);
 
   /* free up any _G.stackSpil locations allocated */
   gen390Code (ic);
 
   /* free up any _G.stackSpil locations allocated */
index 7c2e11997b5fba8c68ab1a380cdb280de30edeae..e1a7bb8dc20f619474f64a4728b714ac81522d58 100644 (file)
@@ -263,7 +263,7 @@ replace {
 %3:
        jnz     %4
 } by {
 %3:
        jnz     %4
 } by {
-       ;       Peephole 115    jump optimization 
+       ;       Peephole 115    jump optimization
        cjne    %1,%2,%3
        sjmp    %4
 %3:
        cjne    %1,%2,%3
        sjmp    %4
 %3:
@@ -477,22 +477,22 @@ replace {
        jc      %1
 }
 
        jc      %1
 }
 
-replace { 
+replace {
        mov     r%1,@r%2
 } by {
        ;       Peephole 130    changed target address mode r%1 to ar%1
        mov     ar%1,@r%2
 }
 
        mov     r%1,@r%2
 } by {
        ;       Peephole 130    changed target address mode r%1 to ar%1
        mov     ar%1,@r%2
 }
 
-replace { 
+replace {
        mov     a,%1
        subb    a,#0x01
        mov     %2,a
        mov     %1,%2
 } by {
        ;       Peephole 131    optimized decrement (not caring for c)
        mov     a,%1
        subb    a,#0x01
        mov     %2,a
        mov     %1,%2
 } by {
        ;       Peephole 131    optimized decrement (not caring for c)
-       dec     %1         
-       mov     %2,%1      
+       dec     %1
+       mov     %2,%1
 }
 
 replace {
 }
 
 replace {
@@ -1033,13 +1033,22 @@ replace {
 } if notVolatile %1 %2
 
 // applies to f.e. bug-607243.c
 } if notVolatile %1 %2
 
 // applies to f.e. bug-607243.c
+// also check notVolatile %3, as it will return FALSE if it's @r%1
 replace {
        mov     r%1,%2
        mov     ar%1,%3
 } by {
        ;       peephole 177.e  removed redundant move
        mov     ar%1,%3
 replace {
        mov     r%1,%2
        mov     ar%1,%3
 } by {
        ;       peephole 177.e  removed redundant move
        mov     ar%1,%3
-}
+} if notVolatile %2 %3
+
+replace {
+       mov     ar%1,%2
+       mov     r%1,%3
+} by {
+       ;       peephole 177.f  removed redundant move
+       mov     r%1,%3
+} if notVolatile %2
 
 replace {
        mov     a,%1
 
 replace {
        mov     a,%1
@@ -1227,7 +1236,7 @@ replace {
        movc    a,@a+dptr
        mov     %2,a
        mov     acc,b
        movc    a,@a+dptr
        mov     %2,a
        mov     acc,b
-       inc     dptr    
+       inc     dptr
        movc    a,@a+dptr
        mov     %3,a
        mov     acc,b
        movc    a,@a+dptr
        mov     %3,a
        mov     acc,b
@@ -1255,7 +1264,7 @@ replace {
        inc     dptr
 }
 
        inc     dptr
 }
 
-// char indexed access to: char code table[] = {4,3,2,1}; 
+// char indexed access to: char code table[] = {4,3,2,1};
 replace {
        add     a,#%1
        mov     dpl,a
 replace {
        add     a,#%1
        mov     dpl,a
@@ -1270,7 +1279,7 @@ replace {
        movc    a,@a+dptr
 }
 
        movc    a,@a+dptr
 }
 
-// char indexed access to: int code table[] = {4,3,2,1}; 
+// char indexed access to: int code table[] = {4,3,2,1};
 replace {
        mov     b,#0x02
        mul     ab
 replace {
        mov     b,#0x02
        mul     ab
@@ -1538,14 +1547,14 @@ replace {
        cjne    %5,%6,%3
        sjmp    %7
 %3:
        cjne    %5,%6,%3
        sjmp    %7
 %3:
-       sjmp    %8 
+       sjmp    %8
 } by {
        ;       Peephole 197.a  optimized misc jump sequence
        jnz     %8
        mov     a,%4
        cjne    %5,%6,%8
        sjmp    %7
 } by {
        ;       Peephole 197.a  optimized misc jump sequence
        jnz     %8
        mov     a,%4
        cjne    %5,%6,%8
        sjmp    %7
-;%3:    
+;%3:
 } if labelRefCount %3 2
 
 replace {
 } if labelRefCount %3 2
 
 replace {
@@ -1711,8 +1720,8 @@ replace {
        push    %1
        pop     %1
 } by {
        push    %1
        pop     %1
 } by {
-       ;       Peephole 211    removed redundant push %1 pop %1  
-} 
+       ;       Peephole 211    removed redundant push %1 pop %1
+}
 
 replace {
        mov     a,_bp
 
 replace {
        mov     a,_bp
@@ -1735,7 +1744,7 @@ replace {
 replace {
        mov     %1,#(( %2 + %3 >> 8 ) ^ 0x80)
 } by {
 replace {
        mov     %1,#(( %2 + %3 >> 8 ) ^ 0x80)
 } by {
-       ;       Peephole 213.b  inserted fix     
+       ;       Peephole 213.b  inserted fix
        mov     %1,#((%2 + %3) >> 8)
        xrl     %1,#0x80
 }
        mov     %1,#((%2 + %3) >> 8)
        xrl     %1,#0x80
 }
@@ -2227,7 +2236,7 @@ replace {
        mov     %2,%10
        mov     %3,%11
        mov     %4,%12
        mov     %2,%10
        mov     %3,%11
        mov     %4,%12
-       
+
        mov     %5,%13
        mov     %6,%14
        mov     %7,%15
        mov     %5,%13
        mov     %6,%14
        mov     %7,%15
@@ -2242,7 +2251,7 @@ replace {
        mov     %2,%10
        mov     %3,%11
        mov     %4,%12
        mov     %2,%10
        mov     %3,%11
        mov     %4,%12
-       
+
        mov     %5,%13
        mov     %6,%14
        mov     %7,%15
        mov     %5,%13
        mov     %6,%14
        mov     %7,%15
@@ -2256,7 +2265,7 @@ replace {
        mov     %2,%6
        mov     %3,%7
        mov     %4,%8
        mov     %2,%6
        mov     %3,%7
        mov     %4,%8
-       
+
        mov     %5,%1
        mov     %6,%2
        mov     %7,%3
        mov     %5,%1
        mov     %6,%2
        mov     %7,%3
@@ -2272,7 +2281,7 @@ replace {
 replace {
        mov     %1,%5
        mov     %2,%6
 replace {
        mov     %1,%5
        mov     %2,%6
-       
+
        mov     %3,%7
        mov     %4,%8
 
        mov     %3,%7
        mov     %4,%8
 
@@ -2281,7 +2290,7 @@ replace {
 } by {
        mov     %1,%5
        mov     %2,%6
 } by {
        mov     %1,%5
        mov     %2,%6
-       
+
        mov     %3,%7
        mov     %4,%8
        ;       Peephole 238.c  removed 2 redundant moves
        mov     %3,%7
        mov     %4,%8
        ;       Peephole 238.c  removed 2 redundant moves
@@ -2301,7 +2310,7 @@ replace {
        mov     %2,%5
        mov     %3,%6
        ;       Peephole 238.d  removed 3 redundant moves
        mov     %2,%5
        mov     %3,%6
        ;       Peephole 238.d  removed 3 redundant moves
-} if operandsNotSame6 %1 %2 %3 %4 %5 %6 
+} if operandsNotSame6 %1 %2 %3 %4 %5 %6
 
 // applies to f.e. ser_ir.asm
 replace {
 
 // applies to f.e. ser_ir.asm
 replace {
@@ -2327,10 +2336,10 @@ replace {
        cjne    r%6,#%7,%3
        cjne    r%8,#%9,%3
        mov     a,#0x01
        cjne    r%6,#%7,%3
        cjne    r%8,#%9,%3
        mov     a,#0x01
-       sjmp    %10      
-%3:    
+       sjmp    %10
+%3:
        clr     a
        clr     a
-%10:    
+%10:
 } by {
        ;       Peephole 241.a  optimized compare
        clr     a
 } by {
        ;       Peephole 241.a  optimized compare
        clr     a
@@ -2341,17 +2350,17 @@ replace {
        inc     a
 %3:
 %10:
        inc     a
 %3:
 %10:
-} 
+}
 
 // applies to f.e. time.c
 replace {
        cjne    r%1,#%2,%3
        cjne    r%4,#%5,%3
        mov     a,#0x01
 
 // applies to f.e. time.c
 replace {
        cjne    r%1,#%2,%3
        cjne    r%4,#%5,%3
        mov     a,#0x01
-       sjmp    %6      
-%3:    
+       sjmp    %6
+%3:
        clr     a
        clr     a
-%6:    
+%6:
 } by {
        ;       Peephole 241.b  optimized compare
        clr     a
 } by {
        ;       Peephole 241.b  optimized compare
        clr     a
@@ -2360,7 +2369,7 @@ replace {
        inc     a
 %3:
 %6:
        inc     a
 %3:
 %6:
-} 
+}
 
 // applies to f.e. malloc.c
 replace {
 
 // applies to f.e. malloc.c
 replace {
@@ -2369,7 +2378,7 @@ replace {
        sjmp    %4
 %3:
        clr     a
        sjmp    %4
 %3:
        clr     a
-%4:    
+%4:
 } by {
        ;       Peephole 241.c  optimized compare
        clr     a
 } by {
        ;       Peephole 241.c  optimized compare
        clr     a
@@ -2377,21 +2386,21 @@ replace {
        inc     a
 %3:
 %4:
        inc     a
 %3:
 %4:
-} 
+}
 
 
-// applies to f.e. j = (k!=0x1000); 
+// applies to f.e. j = (k!=0x1000);
 // with volatile idata long k;
 replace {
        cjne    @r%1,#%2,%3
 // with volatile idata long k;
 replace {
        cjne    @r%1,#%2,%3
-       inc     r%1     
+       inc     r%1
        cjne    @r%1,#%4,%3
        cjne    @r%1,#%4,%3
-       inc     r%1     
+       inc     r%1
        cjne    @r%1,#%5,%3
        cjne    @r%1,#%5,%3
-       inc     r%1     
+       inc     r%1
        cjne    @r%1,#%6,%3
        mov     a,#0x01
        cjne    @r%1,#%6,%3
        mov     a,#0x01
-       sjmp    %7      
-%3:    
+       sjmp    %7
+%3:
        clr     a
 %7:
 } by {
        clr     a
 %7:
 } by {
@@ -2407,19 +2416,19 @@ replace {
        inc     a
 %3:
 %7:
        inc     a
 %3:
 %7:
-} 
+}
 
 // applies to f.e. j = (k!=0x1000);
 // with volatile idata int k;
 replace {
        cjne    @r%1,#%2,%3
 
 // applies to f.e. j = (k!=0x1000);
 // with volatile idata int k;
 replace {
        cjne    @r%1,#%2,%3
-       inc     r%1     
+       inc     r%1
        cjne    @r%1,#%4,%3
        mov     a,#0x01
        cjne    @r%1,#%4,%3
        mov     a,#0x01
-       sjmp    %7      
-%3:    
+       sjmp    %7
+%3:
        clr     a
        clr     a
-%7:    
+%7:
 } by {
        ;       Peephole 241.e  optimized compare
        clr     a
 } by {
        ;       Peephole 241.e  optimized compare
        clr     a
@@ -2429,7 +2438,7 @@ replace {
        inc     a
 %3:
 %7:
        inc     a
 %3:
 %7:
-} 
+}
 
 // applies to f.e. vprintf.asm (--stack-auto)
 replace {
 
 // applies to f.e. vprintf.asm (--stack-auto)
 replace {
@@ -2438,7 +2447,7 @@ replace {
        sjmp    %7
 %3:
        clr     a
        sjmp    %7
 %3:
        clr     a
-%7:    
+%7:
 } by {
        ;       Peephole 241.f  optimized compare
        clr     a
 } by {
        ;       Peephole 241.f  optimized compare
        clr     a
@@ -2446,7 +2455,7 @@ replace {
        inc     a
 %3:
 %7:
        inc     a
 %3:
 %7:
-} 
+}
 
 // applies to f.e. scott-bool1.c
 replace {
 
 // applies to f.e. scott-bool1.c
 replace {
@@ -2504,13 +2513,13 @@ replace {
        cjne    %1,%2,%3
        inc     %4
 %3:
        cjne    %1,%2,%3
        inc     %4
 %3:
-       sjmp    %5      
+       sjmp    %5
 } by {
        ;       Peephole 243    avoided branch to sjmp
        cjne    %1,%2,%5
        inc     %4
 %3:
 } by {
        ;       Peephole 243    avoided branch to sjmp
        cjne    %1,%2,%5
        inc     %4
 %3:
-       sjmp    %5      
+       sjmp    %5
 } if labelInRange
 
 // applies to f.e. simplefloat.c (saving 1 cycle)
 } if labelInRange
 
 // applies to f.e. simplefloat.c (saving 1 cycle)
@@ -2561,7 +2570,7 @@ replace {
        rlc     a
        mov     r%1,a
        cjne    a,#0x01,%2
        rlc     a
        mov     r%1,a
        cjne    a,#0x01,%2
-%2:    
+%2:
        clr     a
        rlc     a
        mov     r%1,a
        clr     a
        rlc     a
        mov     r%1,a
@@ -2570,7 +2579,7 @@ replace {
        cpl     c
        clr     a
        rlc     a
        cpl     c
        clr     a
        rlc     a
-       mov     r%1,a   
+       mov     r%1,a
 } if labelRefCount %2 1
 
 // this one will not be triggered if 245 is present
 } if labelRefCount %2 1
 
 // this one will not be triggered if 245 is present
@@ -2581,7 +2590,7 @@ replace {
        rlc     a
        mov     r%1,a
        cjne    a,#0x01,%2
        rlc     a
        mov     r%1,a
        cjne    a,#0x01,%2
-%2:    
+%2:
        clr     a
        rlc     a
        mov     r%1,a
        clr     a
        rlc     a
        mov     r%1,a
@@ -2599,7 +2608,7 @@ replace {
        rlc     a
        mov     r%1,a
        cjne    a,#0x01,%2
        rlc     a
        mov     r%1,a
        cjne    a,#0x01,%2
-%2:    
+%2:
        clr     a
        rlc     a
        mov     r%1,a
        clr     a
        rlc     a
        mov     r%1,a
@@ -2621,7 +2630,7 @@ replace {
        anl     a,#%3
        movx    @dptr,a
 } by {
        anl     a,#%3
        movx    @dptr,a
 } by {
-       ;       Peephole 246.a  combined clr/clr 
+       ;       Peephole 246.a  combined clr/clr
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2&%3
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2&%3
@@ -2638,7 +2647,7 @@ replace {
        orl     a,#%3
        movx    @dptr,a
 } by {
        orl     a,#%3
        movx    @dptr,a
 } by {
-       ;       Peephole 246.b  combined set/set 
+       ;       Peephole 246.b  combined set/set
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2|%3
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2|%3
@@ -2655,7 +2664,7 @@ replace {
        anl     a,#%3
        movx    @dptr,a
 } by {
        anl     a,#%3
        movx    @dptr,a
 } by {
-       ;       Peephole 246.c  combined set/clr 
+       ;       Peephole 246.c  combined set/clr
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2
@@ -2673,7 +2682,7 @@ replace {
        orl     a,#%3
        movx    @dptr,a
 } by {
        orl     a,#%3
        movx    @dptr,a
 } by {
-       ;       Peephole 246.d  combined clr/set 
+       ;       Peephole 246.d  combined clr/set
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2
@@ -2692,7 +2701,7 @@ replace {
        anl     a,#%4
        movx    @dptr,a
 } by {
        anl     a,#%4
        movx    @dptr,a
 } by {
-       ;       Peephole 246.e  combined set/clr/clr 
+       ;       Peephole 246.e  combined set/clr/clr
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2
@@ -2711,7 +2720,7 @@ replace {
        orl     a,#%4
        movx    @dptr,a
 } by {
        orl     a,#%4
        movx    @dptr,a
 } by {
-       ;       Peephole 246.f  combined set/clr/set 
+       ;       Peephole 246.f  combined set/clr/set
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2
        mov     dptr,#%1
        movx    a,@dptr
        orl     a,#%2
@@ -2731,7 +2740,7 @@ replace {
        anl     a,#%4
        movx    @dptr,a
 } by {
        anl     a,#%4
        movx    @dptr,a
 } by {
-       ;       Peephole 246.g  combined clr/set/clr 
+       ;       Peephole 246.g  combined clr/set/clr
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2
@@ -2751,7 +2760,7 @@ replace {
        orl     a,#%4
        movx    @dptr,a
 } by {
        orl     a,#%4
        movx    @dptr,a
 } by {
-       ;       Peephole 246.h  combined clr/set/set 
+       ;       Peephole 246.h  combined clr/set/set
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2
        mov     dptr,#%1
        movx    a,@dptr
        anl     a,#%2
@@ -2773,7 +2782,7 @@ replace {
        anl     a,#%3
        mov     @r%5,a
 } by {
        anl     a,#%3
        mov     @r%5,a
 } by {
-       ;       Peephole 247.a  combined clr/clr 
+       ;       Peephole 247.a  combined clr/clr
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2&%3
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2&%3
@@ -2790,7 +2799,7 @@ replace {
        orl     a,#%3
        mov     @r%5,a
 } by {
        orl     a,#%3
        mov     @r%5,a
 } by {
-       ;       Peephole 247.b  combined set/set 
+       ;       Peephole 247.b  combined set/set
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2|%3
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2|%3
@@ -2807,7 +2816,7 @@ replace {
        anl     a,#%3
        mov     @r%5,a
 } by {
        anl     a,#%3
        mov     @r%5,a
 } by {
-       ;       Peephole 247.c  combined set/clr 
+       ;       Peephole 247.c  combined set/clr
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2
@@ -2825,7 +2834,7 @@ replace {
        orl     a,#%3
        mov     @r%5,a
 } by {
        orl     a,#%3
        mov     @r%5,a
 } by {
-       ;       Peephole 247.d  combined clr/set 
+       ;       Peephole 247.d  combined clr/set
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2
@@ -2844,7 +2853,7 @@ replace {
        anl     a,#%4
        mov     @r%5,a
 } by {
        anl     a,#%4
        mov     @r%5,a
 } by {
-       ;       Peephole 247.e  combined set/clr/clr 
+       ;       Peephole 247.e  combined set/clr/clr
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2
@@ -2863,7 +2872,7 @@ replace {
        orl     a,#%4
        mov     @r%5,a
 } by {
        orl     a,#%4
        mov     @r%5,a
 } by {
-       ;       Peephole 247.f  combined set/clr/set 
+       ;       Peephole 247.f  combined set/clr/set
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2
        mov     r%5,#%1
        mov     a,@r%5
        orl     a,#%2
@@ -2883,7 +2892,7 @@ replace {
        anl     a,#%4
        mov     @r%5,a
 } by {
        anl     a,#%4
        mov     @r%5,a
 } by {
-       ;       Peephole 247.g  combined clr/set/clr 
+       ;       Peephole 247.g  combined clr/set/clr
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2
@@ -2903,7 +2912,7 @@ replace {
        orl     a,#%4
        mov     @r%5,a
 } by {
        orl     a,#%4
        mov     @r%5,a
 } by {
-       ;       Peephole 247.h  combined clr/set/set 
+       ;       Peephole 247.h  combined clr/set/set
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2
        mov     r%5,#%1
        mov     a,@r%5
        anl     a,#%2
@@ -2914,7 +2923,7 @@ replace {
 
 // Peepholes 248.x have to be compatible with the keyword volatile.
 // They optimize typical accesses to memory mapped I/O devices:
 
 // Peepholes 248.x have to be compatible with the keyword volatile.
 // They optimize typical accesses to memory mapped I/O devices:
-// volatile xdata char t; t|=0x01; 
+// volatile xdata char t; t|=0x01;
 replace {
        mov     dptr,%1
        movx    a,@dptr
 replace {
        mov     dptr,%1
        movx    a,@dptr
@@ -2932,7 +2941,7 @@ replace {
        movx    @dptr,a
 }
 
        movx    @dptr,a
 }
 
-// volatile xdata char t; t&=0x01; 
+// volatile xdata char t; t&=0x01;
 replace {
        mov     dptr,%1
        movx    a,@dptr
 replace {
        mov     dptr,%1
        movx    a,@dptr
@@ -2950,7 +2959,7 @@ replace {
        movx    @dptr,a
 }
 
        movx    @dptr,a
 }
 
-// volatile xdata char t; t^=0x01; 
+// volatile xdata char t; t^=0x01;
 replace {
        mov     dptr,%1
        movx    a,@dptr
 replace {
        mov     dptr,%1
        movx    a,@dptr
@@ -3261,7 +3270,7 @@ replace {
 }
 
 // applies to f.e. jump tables and scott-bool1.c.
 }
 
 // applies to f.e. jump tables and scott-bool1.c.
-// similar peepholes can be constructed for other instructions 
+// similar peepholes can be constructed for other instructions
 // after which a flag or a register is known (like: djnz, cjne, jnc)
 replace {
        jc      %1
 // after which a flag or a register is known (like: djnz, cjne, jnc)
 replace {
        jc      %1
@@ -3313,7 +3322,7 @@ replace {
        addc    a,%1
        mov     %1,a
 %4:
        addc    a,%1
        mov     %1,a
 %4:
-%3:       
+%3:
 } if notVolatile %1
 
 // in_byte<<=1; if(in_bit) in_byte|=1;
 } if notVolatile %1
 
 // in_byte<<=1; if(in_bit) in_byte|=1;
@@ -3390,7 +3399,7 @@ replace {
        add     a,%1
        mov     %2,c
        mov     %1,a
        add     a,%1
        mov     %2,c
        mov     %1,a
-} if notVolatile %1 
+} if notVolatile %1
 
 // out_bit=out_byte&0x01; out_byte>>=1;
 replace {
 
 // out_bit=out_byte&0x01; out_byte>>=1;
 replace {
index ac00fa6cd2abe0b327cc1164f605ee85a0d84fcf..43391455abb6e17d5df1f643ff179842f8948c43 100644 (file)
@@ -32,7 +32,8 @@
 static struct {
     ERROR_LOG_LEVEL logLevel;
     FILE *out;
 static struct {
     ERROR_LOG_LEVEL logLevel;
     FILE *out;
-    int style; /* 1=MSVC */
+    int style;                        /* 1=MSVC */
+    char disabled[MAX_ERROR_WARNING]; /* 1=warning disabled*/
 } _SDCCERRG;
 
 extern char *filename ;
 } _SDCCERRG;
 
 extern char *filename ;
@@ -350,7 +351,7 @@ struct
 { E_TWO_OR_MORE_STORAGE_CLASSES, ERROR_LEVEL_ERROR,
     "two or more storage classes in declaration for '%s'" },
 { W_EXCESS_INITIALIZERS, ERROR_LEVEL_WARNING,
 { E_TWO_OR_MORE_STORAGE_CLASSES, ERROR_LEVEL_ERROR,
     "two or more storage classes in declaration for '%s'" },
 { W_EXCESS_INITIALIZERS, ERROR_LEVEL_WARNING,
-    "excess elements in %s initializer after `%s'" },
+    "excess elements in %s initializer after '%s'" },
 { E_ARGUMENT_MISSING, ERROR_LEVEL_ERROR,
    "Option %s requires an argument." },
 { W_STRAY_BACKSLASH, ERROR_LEVEL_WARNING,
 { E_ARGUMENT_MISSING, ERROR_LEVEL_ERROR,
    "Option %s requires an argument." },
 { W_STRAY_BACKSLASH, ERROR_LEVEL_WARNING,
@@ -421,15 +422,13 @@ SetErrorOut - Set the error output file
 */
 
 FILE *SetErrorOut(FILE *NewErrorOut)
 */
 
 FILE *SetErrorOut(FILE *NewErrorOut)
-
 {
     _SDCCERRG.out = NewErrorOut ;
 
 {
     _SDCCERRG.out = NewErrorOut ;
 
-return NewErrorOut ;
+    return NewErrorOut ;
 }
 
 }
 
-void
-setErrorLogLevel (ERROR_LOG_LEVEL level)
+void setErrorLogLevel (ERROR_LOG_LEVEL level)
 {
     _SDCCERRG.logLevel = level;
 }
 {
     _SDCCERRG.logLevel = level;
 }
@@ -447,39 +446,37 @@ void vwerror (int errNum, va_list marker)
         _SDCCERRG.out = DEFAULT_ERROR_OUT;
     }
 
         _SDCCERRG.out = DEFAULT_ERROR_OUT;
     }
 
-    if (ErrTab[errNum].errIndex != errNum)
-    {
+    if (ErrTab[errNum].errIndex != errNum) {
         fprintf(_SDCCERRG.out, 
         fprintf(_SDCCERRG.out, 
-               "Internal error: error table entry for %d inconsistent.", errNum);
+                "Internal error: error table entry for %d inconsistent.", errNum);
     }
 
     }
 
-
-    if (ErrTab[errNum].errType >= _SDCCERRG.logLevel) {
+    if ((ErrTab[errNum].errType >= _SDCCERRG.logLevel) && (!_SDCCERRG.disabled[errNum])) {
         if ( ErrTab[errNum].errType == ERROR_LEVEL_ERROR )
             fatalError++ ;
   
         if ( filename && lineno ) {
         if ( ErrTab[errNum].errType == ERROR_LEVEL_ERROR )
             fatalError++ ;
   
         if ( filename && lineno ) {
-                       if(_SDCCERRG.style)
-                               fprintf(_SDCCERRG.out, "%s(%d) : ",filename,lineno);
-                       else
-                               fprintf(_SDCCERRG.out, "%s:%d: ",filename,lineno);
-         } else if (lineno) {
+            if(_SDCCERRG.style)
+                fprintf(_SDCCERRG.out, "%s(%d) : ",filename,lineno);
+            else
+                fprintf(_SDCCERRG.out, "%s:%d: ",filename,lineno);
+        } else if (lineno) {
             fprintf(_SDCCERRG.out, "at %d: ", lineno);
         } else {
             fprintf(_SDCCERRG.out, "-:0: ");
         }
             fprintf(_SDCCERRG.out, "at %d: ", lineno);
         } else {
             fprintf(_SDCCERRG.out, "-:0: ");
         }
-    
+
         switch(ErrTab[errNum].errType)
         {
             case ERROR_LEVEL_ERROR:
         switch(ErrTab[errNum].errType)
         {
             case ERROR_LEVEL_ERROR:
-               fprintf(_SDCCERRG.out, "error: ");
+               fprintf(_SDCCERRG.out, "error %d: ", errNum);
                break;
             case ERROR_LEVEL_WARNING:
             case ERROR_LEVEL_PEDANTIC:
                break;
             case ERROR_LEVEL_WARNING:
             case ERROR_LEVEL_PEDANTIC:
-               fprintf(_SDCCERRG.out, "warning: ");
+                fprintf(_SDCCERRG.out, "warning %d: ", errNum);
                break;
             case ERROR_LEVEL_INFO:
                break;
             case ERROR_LEVEL_INFO:
-               fprintf(_SDCCERRG.out, "info: ");
+               fprintf(_SDCCERRG.out, "info %d: ", errNum);
                break;
            default:
                break;                  
                break;
            default:
                break;                  
@@ -487,8 +484,7 @@ void vwerror (int errNum, va_list marker)
     
         vfprintf(_SDCCERRG.out, ErrTab[errNum].errText,marker);
         fprintf(_SDCCERRG.out, "\n");
     
         vfprintf(_SDCCERRG.out, ErrTab[errNum].errText,marker);
         fprintf(_SDCCERRG.out, "\n");
-    }
-    else {
+    } else {
         /* Below the logging level, drop. */
     }
 }
         /* Below the logging level, drop. */
     }
 }
@@ -555,7 +551,19 @@ style - Change the output error style to MSVC
 -------------------------------------------------------------------------------
 */
 
 -------------------------------------------------------------------------------
 */
 
-void    MSVC_style (int style)
+void MSVC_style (int style)
 {
     _SDCCERRG.style = style;
 }
 {
     _SDCCERRG.style = style;
 }
+
+/*
+-------------------------------------------------------------------------------
+disabled - Disable output of specified warning
+-------------------------------------------------------------------------------
+*/
+
+void setWarningDisabled (int errNum)
+{
+    if ((errNum < MAX_ERROR_WARNING) && (ErrTab[errNum].errType <= ERROR_LEVEL_WARNING))
+        _SDCCERRG.disabled[errNum] = 1;
+}
index f1c3a14038c001783dd10f41044eaa5bfbdb6f6c..7a9fe583e66e3ccbcf25320e594138c64f445fbc 100644 (file)
@@ -15,184 +15,186 @@ SDCCERR - SDCC Standard error handler
 
 /* ERROR Message Definition */
 
 
 /* ERROR Message Definition */
 
-#define E_DUPLICATE       0         /* Duplicate variable   */
-#define E_SYNTAX_ERROR    1         /* Syntax Error         */
-#define E_CONST_EXPECTED  2         /* constant expected    */
-#define E_OUT_OF_MEM      3         /* malloc failed        */
-#define E_FILE_OPEN_ERR   4         /* File open failed     */
-#define E_INVALID_OCLASS  5         /* output class invalid */
-#define E_CANNOT_ALLOC    6         /* cannot allocate space*/
-#define E_OLD_STYLE       7         /* old style C ! allowed*/
-#define E_STACK_OUT       8         /* v r out of stack     */
-#define E_INTERNAL_ERROR  9         /* unable to alloc tvar */
-#define E_LVALUE_REQUIRED 10        /* lvalue required      */
-#define E_TMPFILE_FAILED  11        /* tmpfile creation failed */
-#define E_FUNCTION_EXPECTED 12      /* function expected    */
-#define E_USING_ERROR     13        /* using in error       */
-#define E_SFR_INIT        14        /* init error for sbit  */
-#define W_INIT_IGNORED    15        /* initialiser ignored  */
-#define E_AUTO_ASSUMED    16        /* sclass auto assumed  */
-#define E_AUTO_ABSA       17        /* abs addr for auto var*/
-#define W_INIT_WRONG      18        /* initializer type !=  */
-#define E_FUNC_REDEF      19        /* func name redefined  */
-#define E_ID_UNDEF        20        /* identifer undefined  */
-#define W_STACK_OVERFLOW  21        /* stack overflow       */
-#define E_NEED_ARRAY_PTR  22        /* array or pointer reqd*/
-#define E_IDX_NOT_INT     23        /* index not an integer */
-#define W_IDX_OUT_OF_BOUNDS 24      /* array index out of bounds */
-#define E_STRUCT_UNION    25        /* struct,union expected*/
-#define E_NOT_MEMBER      26        /* !struct/union member */
-#define E_PTR_REQD        27        /* pointer required     */
-#define E_UNARY_OP        28        /* unary operator bad op*/
-#define E_CONV_ERR        29        /* conversion error     */
-#define E_INT_REQD        30        /* bit field must be int*/
-#define E_BITFLD_SIZE     31        /* bit field size > 16  */
-#define W_TRUNCATION      32        /* high order trucation */
-#define E_CODE_WRITE      33        /* trying 2 write to code */
-#define E_LVALUE_CONST    34        /* lvalue is a const   */
-#define E_ILLEGAL_ADDR    35        /* address of bit      */
-#define E_CAST_ILLEGAL    36        /* cast illegal        */
-#define E_MULT_INTEGRAL   37        /* mult opernd must b integral */
-#define E_ARG_ERROR       38        /* argument count error*/
-#define E_ARG_COUNT       39        /* func expecting more */
-#define E_FUNC_EXPECTED   40        /* func name expected  */
-#define E_PLUS_INVALID    41        /* plus invalid        */
-#define E_PTR_PLUS_PTR    42        /* pointer + pointer   */
-#define E_SHIFT_OP_INVALID 43       /* shft op op invalid  */
-#define E_COMPARE_OP      44        /* compare operand     */
-#define E_BITWISE_OP      45        /* bit op invalid op   */
-#define E_ANDOR_OP        46        /* && || op invalid    */
-#define E_TYPE_MISMATCH   47        /* type mismatch       */
-#define E_AGGR_ASSIGN     48        /* aggr assign         */
-#define E_ARRAY_DIRECT    49        /* array indexing in   */
-#define E_BIT_ARRAY       50        /* bit array not allowed  */
-#define E_DUPLICATE_TYPEDEF 51      /* typedef name duplicate */
-#define E_ARG_TYPE        52        /* arg type mismatch   */
-#define E_RET_VALUE       53        /* return value mismatch */
-#define E_FUNC_AGGR       54        /* function returing aggr */
-#define E_FUNC_DEF        55        /* ANSI Style def neede */
-#define E_DUPLICATE_LABEL 56        /* duplicate label name */
-#define E_LABEL_UNDEF     57        /* undefined label used */
-#define E_FUNC_VOID       58        /* void func ret value  */
-#define W_VOID_FUNC       59        /* func must return value */
-#define W_RETURN_MISMATCH 60        /* return value mismatch */
-#define E_CASE_CONTEXT    61        /* case stmnt without switch */
-#define E_CASE_CONSTANT   62        /* case expression ! const */
-#define E_BREAK_CONTEXT   63        /* break statement invalid */
-#define E_SWITCH_AGGR     64        /* non integral for switch */
-#define E_FUNC_BODY       65        /* func has body already */
-#define E_UNKNOWN_SIZE    66        /* variable has unknown size */
-#define E_AUTO_AGGR_INIT  67        /* auto aggregates no init */
-#define E_INIT_COUNT      68        /* too many initializers */
-#define E_INIT_STRUCT     69        /* struct init wrong   */
-#define E_INIT_NON_ADDR   70        /* non address xpr for init */
-#define E_INT_DEFINED     71        /* interrupt already over */
-#define E_INT_ARGS        72        /* interrupt rtn cannot have args */
-#define E_INCLUDE_MISSING 73        /* compiler include missing */
-#define E_NO_MAIN         74        /* main function undefined */
-#define E_EXTERN_INIT     75        /* extern variable initialised */
-#define E_PRE_PROC_FAILED 76        /* preprocessor failed */
-#define E_DUP_FAILED      77        /* file DUP failed     */
-#define E_INCOMPAT_TYPES  78        /* incompatible types casting */
-#define W_LOOP_ELIMINATE  79        /* loop eliminated     */
-#define W_NO_SIDE_EFFECTS 80        /* expression has no side effects */
-#define W_CONST_TOO_LARGE 81        /* constant out of range */
-#define W_BAD_COMPARE     82        /* bad comparison      */
-#define E_TERMINATING     83        /* compiler terminating */
-#define W_LOCAL_NOINIT    84        /* local reference before assignment */
-#define W_NO_REFERENCE    85        /* no reference to local variable */
-#define E_OP_UNKNOWN_SIZE 86        /* unknown size for operand */
-#define W_LONG_UNSUPPORTED 87       /* 'long' not supported yet */
-#define E_LITERAL_GENERIC 88        /* literal being cast to generic pointer */
-#define E_SFR_ADDR_RANGE  89        /* sfr address out of range */
-#define E_BITVAR_STORAGE  90        /* storage given for 'bit' variable */
-#define E_EXTERN_MISMATCH 91        /* extern declaration mismatches */
-#define W_NONRENT_ARGS    92        /* fptr non reentrant has args */
-#define W_DOUBLE_UNSUPPORTED 93     /* 'double' not supported yet */
-#define W_IF_NEVER_TRUE   94        /* if always false     */
-#define W_FUNC_NO_RETURN  95        /* no return statement found */
-#define W_PRE_PROC_WARNING 96       /* preprocessor generated warning */
-#define W_STRUCT_AS_ARG   97        /* structure passed as argument */
-#define E_PREV_DEF_CONFLICT 98      /* previous definition conflicts with current */
-#define E_CODE_NO_INIT    99        /* vars in code space must have initializer */
-#define E_OPS_INTEGRAL    100       /* operans must be integral for certian assignments */
-#define E_TOO_MANY_PARMS  101       /* too many parameters */
-#define E_TOO_FEW_PARMS   102       /* to few parameters   */
-#define E_FUNC_NO_CODE    103       /* fatalError          */
-#define E_TYPE_MISMATCH_PARM 104    /* type mismatch for parameter */
-#define E_INVALID_FLOAT_CONST 105   /* invalid floating point literal string */
-#define E_INVALID_OP      106       /* invalid operand for some operation */
-#define E_SWITCH_NON_INTEGER 107    /* switch value not integer */
-#define E_CASE_NON_INTEGER 108      /* case value not integer */
-#define W_FUNC_TOO_LARGE  109       /* function too large  */
-#define W_CONTROL_FLOW    110       /* control flow changed due to optimization */
-#define W_PTR_TYPE_INVALID 111      /* invalid type specifier for pointer */
-#define W_IMPLICIT_FUNC   112       /* function declared implicitly */
-#define W_CONTINUE        113       /* more than one line  */
-#define I_EXTENDED_STACK_SPILS 114  /* too many spils occured */
-#define W_UNKNOWN_PRAGMA  115       /* #pragma directive unsupported */
-#define W_SHIFT_CHANGED   116       /* shift changed to zero */
-#define W_UNKNOWN_OPTION  117       /* don't know the option */
-#define W_UNSUPP_OPTION   118       /* processor reset has been redifned */
-#define W_UNKNOWN_FEXT    119       /* unknown file extension */
-#define W_TOO_MANY_SRC    120       /* can only compile one .c file at a time */
-#define I_CYCLOMATIC      121       /* information message */
-#define E_DIVIDE_BY_ZERO  122       /* / 0 */
-#define E_FUNC_BIT        123       /* function cannot return bit */
-#define E_CAST_ZERO       124       /* casting to from size zero */
-#define W_CONST_RANGE     125       /* constant too large  */
-#define W_CODE_UNREACH    126       /* unreachable code    */
-#define E_NONPTR2_GENPTR  127       /* non pointer cast to generic pointer */
-#define W_POSSBUG         128       /* possible code generation error */
-#define E_INCOMPAT_PTYPES 129       /* incampatible pointer assignment */
-#define W_UNKNOWN_MODEL   130       /* Unknown memory model */
-#define E_UNKNOWN_TARGET  131       /* target not defined  */
-#define W_INDIR_BANKED    132       /* Indirect call to a banked fun */
-#define W_UNSUPPORTED_MODEL 133     /* Unsupported model, ignored */
-#define W_BANKED_WITH_NONBANKED 134 /* banked and nonbanked attributes mixed */
-#define W_BANKED_WITH_STATIC 135    /* banked and static mixed */
-#define W_INT_TO_GEN_PTR_CAST 136   /* Converting integer type to generic pointer. */
-#define W_ESC_SEQ_OOR_FOR_CHAR 137  /* Escape sequence of of range for char */
-#define E_INVALID_HEX     138       /* \x used with no following hex digits */
-#define W_FUNCPTR_IN_USING_ISR 139  /* Call via function pointer in ISR with using attribute. */
-#define E_NO_SUCH_BANK    140       /* 'using' attribute specifies non-existant register bank. */
-#define E_TWO_OR_MORE_DATA_TYPES 141
-#define E_LONG_OR_SHORT_INVALID 142 /* long or short invalid for .. */
-#define E_SIGNED_OR_UNSIGNED_INVALID 143 /* signed or unsigned invalid for .. */
-#define E_LONG_AND_SHORT_INVALID 144 /* long and short invalid for .. */
+#define E_DUPLICATE                     0 /* Duplicate variable   */
+#define E_SYNTAX_ERROR                  1 /* Syntax Error         */
+#define E_CONST_EXPECTED                2 /* constant expected    */
+#define E_OUT_OF_MEM                    3 /* malloc failed        */
+#define E_FILE_OPEN_ERR                 4 /* File open failed     */
+#define E_INVALID_OCLASS                5 /* output class invalid */
+#define E_CANNOT_ALLOC                  6 /* cannot allocate space*/
+#define E_OLD_STYLE                     7 /* old style C ! allowed*/
+#define E_STACK_OUT                     8 /* v r out of stack     */
+#define E_INTERNAL_ERROR                9 /* unable to alloc tvar */
+#define E_LVALUE_REQUIRED              10 /* lvalue required      */
+#define E_TMPFILE_FAILED               11 /* tmpfile creation failed */
+#define E_FUNCTION_EXPECTED            12 /* function expected    */
+#define E_USING_ERROR                  13 /* using in error       */
+#define E_SFR_INIT                     14 /* init error for sbit  */
+#define W_INIT_IGNORED                 15 /* initialiser ignored  */
+#define E_AUTO_ASSUMED                 16 /* sclass auto assumed  */
+#define E_AUTO_ABSA                    17 /* abs addr for auto var*/
+#define W_INIT_WRONG                   18 /* initializer type !=  */
+#define E_FUNC_REDEF                   19 /* func name redefined  */
+#define E_ID_UNDEF                     20 /* identifer undefined  */
+#define W_STACK_OVERFLOW               21 /* stack overflow       */
+#define E_NEED_ARRAY_PTR               22 /* array or pointer reqd*/
+#define E_IDX_NOT_INT                  23 /* index not an integer */
+#define W_IDX_OUT_OF_BOUNDS            24 /* array index out of bounds */
+#define E_STRUCT_UNION                 25 /* struct,union expected*/
+#define E_NOT_MEMBER                   26 /* !struct/union member */
+#define E_PTR_REQD                     27 /* pointer required     */
+#define E_UNARY_OP                     28 /* unary operator bad op*/
+#define E_CONV_ERR                     29 /* conversion error     */
+#define E_INT_REQD                     30 /* bit field must be int*/
+#define E_BITFLD_SIZE                  31 /* bit field size > 16  */
+#define W_TRUNCATION                   32 /* high order trucation */
+#define E_CODE_WRITE                   33 /* trying 2 write to code */
+#define E_LVALUE_CONST                 34 /* lvalue is a const   */
+#define E_ILLEGAL_ADDR                 35 /* address of bit      */
+#define E_CAST_ILLEGAL                 36 /* cast illegal        */
+#define E_MULT_INTEGRAL                37 /* mult opernd must b integral */
+#define E_ARG_ERROR                    38 /* argument count error*/
+#define E_ARG_COUNT                    39 /* func expecting more */
+#define E_FUNC_EXPECTED                40 /* func name expected  */
+#define E_PLUS_INVALID                 41 /* plus invalid        */
+#define E_PTR_PLUS_PTR                 42 /* pointer + pointer   */
+#define E_SHIFT_OP_INVALID             43 /* shft op op invalid  */
+#define E_COMPARE_OP                   44 /* compare operand     */
+#define E_BITWISE_OP                   45 /* bit op invalid op   */
+#define E_ANDOR_OP                     46 /* && || op invalid    */
+#define E_TYPE_MISMATCH                47 /* type mismatch       */
+#define E_AGGR_ASSIGN                  48 /* aggr assign         */
+#define E_ARRAY_DIRECT                 49 /* array indexing in   */
+#define E_BIT_ARRAY                    50 /* bit array not allowed  */
+#define E_DUPLICATE_TYPEDEF            51 /* typedef name duplicate */
+#define E_ARG_TYPE                     52 /* arg type mismatch   */
+#define E_RET_VALUE                    53 /* return value mismatch */
+#define E_FUNC_AGGR                    54 /* function returing aggr */
+#define E_FUNC_DEF                     55 /* ANSI Style def neede */
+#define E_DUPLICATE_LABEL              56 /* duplicate label name */
+#define E_LABEL_UNDEF                  57 /* undefined label used */
+#define E_FUNC_VOID                    58 /* void func ret value  */
+#define W_VOID_FUNC                    59 /* func must return value */
+#define W_RETURN_MISMATCH              60 /* return value mismatch */
+#define E_CASE_CONTEXT                 61 /* case stmnt without switch */
+#define E_CASE_CONSTANT                62 /* case expression ! const */
+#define E_BREAK_CONTEXT                63 /* break statement invalid */
+#define E_SWITCH_AGGR                  64 /* non integral for switch */
+#define E_FUNC_BODY                    65 /* func has body already */
+#define E_UNKNOWN_SIZE                 66 /* variable has unknown size */
+#define E_AUTO_AGGR_INIT               67 /* auto aggregates no init */
+#define E_INIT_COUNT                   68 /* too many initializers */
+#define E_INIT_STRUCT                  69 /* struct init wrong   */
+#define E_INIT_NON_ADDR                70 /* non address xpr for init */
+#define E_INT_DEFINED                  71 /* interrupt already over */
+#define E_INT_ARGS                     72 /* interrupt rtn cannot have args */
+#define E_INCLUDE_MISSING              73 /* compiler include missing */
+#define E_NO_MAIN                      74 /* main function undefined */
+#define E_EXTERN_INIT                  75 /* extern variable initialised */
+#define E_PRE_PROC_FAILED              76 /* preprocessor failed */
+#define E_DUP_FAILED                   77 /* file DUP failed     */
+#define E_INCOMPAT_TYPES               78 /* incompatible types casting */
+#define W_LOOP_ELIMINATE               79 /* loop eliminated     */
+#define W_NO_SIDE_EFFECTS              80 /* expression has no side effects */
+#define W_CONST_TOO_LARGE              81 /* constant out of range */
+#define W_BAD_COMPARE                  82 /* bad comparison      */
+#define E_TERMINATING                  83 /* compiler terminating */
+#define W_LOCAL_NOINIT                 84 /* local reference before assignment */
+#define W_NO_REFERENCE                 85 /* no reference to local variable */
+#define E_OP_UNKNOWN_SIZE              86 /* unknown size for operand */
+#define W_LONG_UNSUPPORTED             87 /* 'long' not supported yet */
+#define E_LITERAL_GENERIC              88 /* literal being cast to generic pointer */
+#define E_SFR_ADDR_RANGE               89 /* sfr address out of range */
+#define E_BITVAR_STORAGE               90 /* storage given for 'bit' variable */
+#define E_EXTERN_MISMATCH              91 /* extern declaration mismatches */
+#define W_NONRENT_ARGS                 92 /* fptr non reentrant has args */
+#define W_DOUBLE_UNSUPPORTED           93 /* 'double' not supported yet */
+#define W_IF_NEVER_TRUE                94 /* if always false     */
+#define W_FUNC_NO_RETURN               95 /* no return statement found */
+#define W_PRE_PROC_WARNING             96 /* preprocessor generated warning */
+#define W_STRUCT_AS_ARG                97 /* structure passed as argument */
+#define E_PREV_DEF_CONFLICT            98 /* previous definition conflicts with current */
+#define E_CODE_NO_INIT                 99 /* vars in code space must have initializer */
+#define E_OPS_INTEGRAL                100 /* operans must be integral for certian assignments */
+#define E_TOO_MANY_PARMS              101 /* too many parameters */
+#define E_TOO_FEW_PARMS               102 /* to few parameters   */
+#define E_FUNC_NO_CODE                103 /* fatalError          */
+#define E_TYPE_MISMATCH_PARM          104 /* type mismatch for parameter */
+#define E_INVALID_FLOAT_CONST         105 /* invalid floating point literal string */
+#define E_INVALID_OP                  106 /* invalid operand for some operation */
+#define E_SWITCH_NON_INTEGER          107 /* switch value not integer */
+#define E_CASE_NON_INTEGER            108 /* case value not integer */
+#define W_FUNC_TOO_LARGE              109 /* function too large  */
+#define W_CONTROL_FLOW                110 /* control flow changed due to optimization */
+#define W_PTR_TYPE_INVALID            111 /* invalid type specifier for pointer */
+#define W_IMPLICIT_FUNC               112 /* function declared implicitly */
+#define W_CONTINUE                    113 /* more than one line  */
+#define I_EXTENDED_STACK_SPILS        114 /* too many spils occured */
+#define W_UNKNOWN_PRAGMA              115 /* #pragma directive unsupported */
+#define W_SHIFT_CHANGED               116 /* shift changed to zero */
+#define W_UNKNOWN_OPTION              117 /* don't know the option */
+#define W_UNSUPP_OPTION               118 /* processor reset has been redifned */
+#define W_UNKNOWN_FEXT                119 /* unknown file extension */
+#define W_TOO_MANY_SRC                120 /* can only compile one .c file at a time */
+#define I_CYCLOMATIC                  121 /* information message */
+#define E_DIVIDE_BY_ZERO              122 /* / 0 */
+#define E_FUNC_BIT                    123 /* function cannot return bit */
+#define E_CAST_ZERO                   124 /* casting to from size zero */
+#define W_CONST_RANGE                 125 /* constant too large  */
+#define W_CODE_UNREACH                126 /* unreachable code    */
+#define E_NONPTR2_GENPTR              127 /* non pointer cast to generic pointer */
+#define W_POSSBUG                     128 /* possible code generation error */
+#define E_INCOMPAT_PTYPES             129 /* incampatible pointer assignment */
+#define W_UNKNOWN_MODEL               130 /* Unknown memory model */
+#define E_UNKNOWN_TARGET              131 /* target not defined  */
+#define W_INDIR_BANKED                132 /* Indirect call to a banked fun */
+#define W_UNSUPPORTED_MODEL           133 /* Unsupported model, ignored */
+#define W_BANKED_WITH_NONBANKED       134 /* banked and nonbanked attributes mixed */
+#define W_BANKED_WITH_STATIC          135 /* banked and static mixed */
+#define W_INT_TO_GEN_PTR_CAST         136 /* Converting integer type to generic pointer. */
+#define W_ESC_SEQ_OOR_FOR_CHAR        137 /* Escape sequence of of range for char */
+#define E_INVALID_HEX                 138 /* \x used with no following hex digits */
+#define W_FUNCPTR_IN_USING_ISR        139 /* Call via function pointer in ISR with using attribute. */
+#define E_NO_SUCH_BANK                140 /* 'using' attribute specifies non-existant register bank. */
+#define E_TWO_OR_MORE_DATA_TYPES      141
+#define E_LONG_OR_SHORT_INVALID       142 /* long or short invalid for .. */
+#define E_SIGNED_OR_UNSIGNED_INVALID  143 /* signed or unsigned invalid for .. */
+#define E_LONG_AND_SHORT_INVALID      144 /* long and short invalid for .. */
 #define E_SIGNED_AND_UNSIGNED_INVALID 145 /* signed and unsigned invalid for .. */
 #define E_TWO_OR_MORE_STORAGE_CLASSES 146
 #define E_SIGNED_AND_UNSIGNED_INVALID 145 /* signed and unsigned invalid for .. */
 #define E_TWO_OR_MORE_STORAGE_CLASSES 146
-#define W_EXCESS_INITIALIZERS 147   /* too much initializers for array */
-#define E_ARGUMENT_MISSING 148      /* Option requires an argument. */
-#define W_STRAY_BACKSLASH 149
-#define W_NEWLINE_IN_STRING 150
-#define E_CANNOT_USE_GENERIC_POINTER 151
-#define W_EXCESS_SHORT_OPTIONS 152
-#define E_VOID_VALUE_USED 153
-#define W_INTEGRAL2PTR_NOCAST 154
-#define W_PTR2INTEGRAL_NOCAST 155
-#define W_SYMBOL_NAME_TOO_LONG 156
-#define W_CAST_STRUCT_PTR 157       /* pointer to different structure types */
-#define W_IF_ALWAYS_TRUE  158
-#define E_PARAM_NAME_OMITTED 159
-#define W_NO_FILE_ARG_IN_C1 160
-#define E_NEED_OPT_O_IN_C1 161
-#define W_ILLEGAL_OPT_COMBINATION 162
-#define E_DUPLICATE_MEMBER 163
-#define E_STACK_VIOLATION 164       /* internal stack violation */
-#define W_INT_OVL 165               /* integer overflow in expression */
-#define W_USELESS_DECL 166         /* useless declaration */
-#define E_INT_BAD_INTNO 167         /* invalid interrupt number */
-#define W_BITFLD_NAMED 168          /* declarator used with 0 length bitfield */
-#define E_FUNC_ATTR 169             /* function attribute without function */
-#define W_SAVE_RESTORE 170          /* unmatched #pragma SAVE and #pragma RESTORE */
-#define E_INVALID_CRITICAL 171     /* operation invalid in critical sequence */
-#define E_NOT_ALLOWED 172          /* %s not allowed here */
-#define E_BAD_TAG 173               /* '%s' is not a %s tag */
-#define E_ENUM_NON_INTEGER 174      /* enumeration constant not an integer */
-#define W_DEPRECATED_PRAGMA 175     /* deprecated pragma */
-#define E_SIZEOF_INCOMPLETE_TYPE 176 /* sizeof applied to an incomplete type */
-#define E_PREVIOUS_DEF 177          /* previously defined here */
+#define W_EXCESS_INITIALIZERS         147 /* too much initializers for array */
+#define E_ARGUMENT_MISSING            148 /* Option requires an argument. */
+#define W_STRAY_BACKSLASH             149
+#define W_NEWLINE_IN_STRING           150
+#define E_CANNOT_USE_GENERIC_POINTER  151
+#define W_EXCESS_SHORT_OPTIONS        152
+#define E_VOID_VALUE_USED             153
+#define W_INTEGRAL2PTR_NOCAST         154
+#define W_PTR2INTEGRAL_NOCAST         155
+#define W_SYMBOL_NAME_TOO_LONG        156
+#define W_CAST_STRUCT_PTR             157 /* pointer to different structure types */
+#define W_IF_ALWAYS_TRUE              158
+#define E_PARAM_NAME_OMITTED          159
+#define W_NO_FILE_ARG_IN_C1           160
+#define E_NEED_OPT_O_IN_C1            161
+#define W_ILLEGAL_OPT_COMBINATION     162
+#define E_DUPLICATE_MEMBER            163
+#define E_STACK_VIOLATION             164 /* internal stack violation */
+#define W_INT_OVL                     165 /* integer overflow in expression */
+#define W_USELESS_DECL                166 /* useless declaration */
+#define E_INT_BAD_INTNO               167 /* invalid interrupt number */
+#define W_BITFLD_NAMED                168 /* declarator used with 0 length bitfield */
+#define E_FUNC_ATTR                   169 /* function attribute without function */
+#define W_SAVE_RESTORE                170 /* unmatched #pragma SAVE and #pragma RESTORE */
+#define E_INVALID_CRITICAL            171 /* operation invalid in critical sequence */
+#define E_NOT_ALLOWED                 172 /* %s not allowed here */
+#define E_BAD_TAG                     173 /* '%s' is not a %s tag */
+#define E_ENUM_NON_INTEGER            174 /* enumeration constant not an integer */
+#define W_DEPRECATED_PRAGMA           175 /* deprecated pragma */
+#define E_SIZEOF_INCOMPLETE_TYPE      176 /* sizeof applied to an incomplete type */
+#define E_PREVIOUS_DEF                177 /* previously defined here */
+
+#define MAX_ERROR_WARNING             256 /* size of disable warnings array */
 
 /** Describes the maximum error level that will be logged.  Any level
  *  includes all of the levels listed after it.
 
 /** Describes the maximum error level that will be logged.  Any level
  *  includes all of the levels listed after it.
@@ -218,8 +220,7 @@ typedef enum _ERROR_LOG_LEVEL ERROR_LOG_LEVEL;
 /** Sets the maximum error level to log.
     See MAX_ERROR_LEVEL.  The default is ERROR_LEVEL_ALL.
 */
 /** Sets the maximum error level to log.
     See MAX_ERROR_LEVEL.  The default is ERROR_LEVEL_ALL.
 */
-void
-setErrorLogLevel (ERROR_LOG_LEVEL level);
+void setErrorLogLevel (ERROR_LOG_LEVEL level);
 
 /*
 -------------------------------------------------------------------------------
 
 /*
 -------------------------------------------------------------------------------
@@ -237,7 +238,7 @@ vwerror - Output a standard eror message with variable number of arguements
 -------------------------------------------------------------------------------
 */
 
 -------------------------------------------------------------------------------
 */
 
-void   vwerror (int errNum, va_list marker) ;
+void vwerror (int errNum, va_list marker) ;
 
 /*
 -------------------------------------------------------------------------------
 
 /*
 -------------------------------------------------------------------------------
@@ -246,7 +247,7 @@ werror - Output a standard eror message with variable number of arguements
 -------------------------------------------------------------------------------
 */
 
 -------------------------------------------------------------------------------
 */
 
-void   werror (int errNum, ... ) ;
+void werror (int errNum, ... ) ;
 
 /*
 -------------------------------------------------------------------------------
 
 /*
 -------------------------------------------------------------------------------
@@ -265,7 +266,7 @@ fatal - Output a standard eror message with variable number of arguements and
 -------------------------------------------------------------------------------
 */
 
 -------------------------------------------------------------------------------
 */
 
-void    fatal (int exitCode, int errNum, ... ) ;
+void fatal (int exitCode, int errNum, ... ) ;
 
 /*
 -------------------------------------------------------------------------------
 
 /*
 -------------------------------------------------------------------------------
@@ -273,6 +274,14 @@ style - Change the output error style to MSVC
 -------------------------------------------------------------------------------
 */
 
 -------------------------------------------------------------------------------
 */
 
-void    MSVC_style (int style) ;
+void MSVC_style (int style) ;
+
+/*
+-------------------------------------------------------------------------------
+disabled - Disable output of specified warning
+-------------------------------------------------------------------------------
+*/
+
+void setWarningDisabled (int errNum) ;
 
 #endif
 
 #endif
index c0e396965d5c019a4ef548c9a289471f079b7bc6..b94a4bc07a28cf7c505b22448d7959eb48462cb3 100644 (file)
@@ -25,15 +25,18 @@ SOURCES = _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
           _fsneq.c _fssub.c _gptrget.c _gptrput.c \
           _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
           _islower.c _isprint.c _ispunct.c _isspace.c \
           _fsneq.c _fssub.c _gptrget.c _gptrput.c \
           _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
           _islower.c _isprint.c _ispunct.c _isspace.c \
-          _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
-          _memcpy.c _memset.c _modsint.c _modslong.c \
-          _moduint.c _modulong.c _mulint.c _mullong.c \
+          _isupper.c _isxdigit.c _slong2fs.c \
+          _memcmp.c _memcpy.c _memmove.c _memset.c \
+          _modsint.c _modslong.c _moduint.c _modulong.c \
+          _mulint.c _mullong.c \
           _ser.c _setjmp.c \
           _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
           _strcspn.c _strlen.c _strncat.c _strncmp.c \
           _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
           _ser.c _setjmp.c \
           _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
           _strcspn.c _strlen.c _strncat.c _strncmp.c \
           _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
-          _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
-          _ulong2fs.c malloc.c serial.c ser_ir.c printfl.c \
+          _strstr.c _strtok.c \
+          _uchar2fs.c _uint2fs.c _ulong2fs.c \
+          calloc.c malloc.c realloc.c free.c \
+          serial.c ser_ir.c printfl.c \
           printf_large.c vprintf.c puts.c gets.c \
           assert.c _strcat.c time.c printf_fast.c bpx.c
 
           printf_large.c vprintf.c puts.c gets.c \
           assert.c _strcat.c time.c printf_fast.c bpx.c
 
index 1f19501d95a0c1c82c674a913bffefd919419c76..6659b949df114dd2e6e9143e868abc1210821289 100644 (file)
@@ -16,9 +16,15 @@ void
 testMalloc(void)
 {
   void XDATA *p1, *p2, *p3;
 testMalloc(void)
 {
   void XDATA *p1, *p2, *p3;
-  
+  char *p;
+  unsigned char i;
+
 #if !defined(__gbz80) && !defined(__z80) && !defined(__GNUC__)
 #if !defined(__gbz80) && !defined(__z80) && !defined(__GNUC__)
-  init_dynamic_memory((MEMHEADER xdata *)heap, sizeof(heap));
+  init_dynamic_memory((MEMHEADER XDATA *)heap, sizeof(heap));
+
+  p1 = malloc(200);
+  ASSERT(p1 == NULL);
+  LOG(("p1 == NULL when out of memory\n"));
 #endif
 
   p1 = malloc(5);
 #endif
 
   p1 = malloc(5);
@@ -37,6 +43,34 @@ testMalloc(void)
   LOG(("p2: %u\n", (unsigned) p2));
 #endif
 
   LOG(("p2: %u\n", (unsigned) p2));
 #endif
 
+  p = (char*)p2;
+  for (i=0; i<20; i++, p++)
+    *p = i;
+
+  p2 = realloc(p2, 25);
+  ASSERT(p2 != NULL);
+#ifdef PORT_HOST
+  LOG(("p2, after expanding realloc: %p\n", p2));
+#else
+  LOG(("p2, after expanding realloc: %u\n", (unsigned) p2));
+#endif
+
+  p = (char*)p2;
+  for (i=0; i<20; i++, p++)
+    ASSERT(*p == i);
+
+  p2 = realloc(p2, 15);
+  ASSERT(p2 != NULL);
+#ifdef PORT_HOST
+  LOG(("p2, after shrinking realloc: %p\n", p2));
+#else
+  LOG(("p2, after shrinking realloc: %u\n", (unsigned) p2));
+#endif
+
+  p = (char*)p2;
+  for (i=0; i<15; i++, p++)
+    ASSERT(*p == i);
+
   free(p2);
 
   p3 = malloc(10);
   free(p2);
 
   p3 = malloc(10);
index f791859d106c7d56ce64ff639cef397779f35584..4cef5c4d2fe499cbe972a6c83e64d4df5e18db65 100644 (file)
@@ -26,6 +26,16 @@ typedef unsigned int size_t;
 # define code
 #endif
 
 # define code
 #endif
 
+const char *string1 = "\x00\x01";
+const char string2[] = "\x00\x01";
+
+#ifndef PORT_HOST
+#pragma disable_warning 147 //no warning about excess initializers (W_EXCESS_INITIALIZERS)
+//array will be truncated but warning will be suppressed
+//if truncation is incorrect, other ASSERTs will fail with high probability
+char STORAGE trunc[2] = {'a', 'b', 'c'};
+#endif
+
 char STORAGE array[5] = {'a', 'b', 'c'};
 
 #if TEST_G
 char STORAGE array[5] = {'a', 'b', 'c'};
 
 #if TEST_G
@@ -64,6 +74,9 @@ struct y STORAGE incompletestruct = {
 void
 testZeropad(void)
 {
 void
 testZeropad(void)
 {
+  ASSERT(string1[1] == '\x01');
+  ASSERT(string2[1] == '\x01');
+
   ASSERT(array[2] == 'c');
   ASSERT(array[4] == 0);
 
   ASSERT(array[2] == 'c');
   ASSERT(array[4] == 0);