]> git.gag.com Git - fw/sdcc/commitdiff
* device/lib/_gptrget.c,
authormaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 8 Sep 2004 05:46:46 +0000 (05:46 +0000)
committermaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 8 Sep 2004 05:46:46 +0000 (05:46 +0000)
* device/lib/_gptrput.c: updated comment
* device/lib/calloc.c,
* device/lib/free.c,
* device/lib/malloc.c,
* device/lib/realloc.c: added LGPL, made them reentrant-safe
* src/SDCCcse.c (cseBBlock),
* src/SDCCicode.c (printOperand, geniCodeArray),
* src/SDCCicode.h (struct operand): fixed bug 868103
* support/regression/tests/bug-868103.c: added
* src/SDCCast.c (searchLitOp),
* src/SDCCcse.h (struct cseDef),
* src/SDCCglue.c (printIvalArray, spacesToUnderscores),
* src/SDCCicode.h (struct operand),
* src/SDCCsymt.h (struct sym_link),
* src/avr/gen.c (hasInc),
* src/ds390/gen.c (hasInc),
* src/hc08/gen.c (genPlusIncr, hasInc),
* src/mcs51/gen.c (hasInc),
* src/pic16/glue.c (pic16_printIvalChar),
* src/pic16/ralloc.c (regWithIdx),
* src/xa51/gen.c (hasInc) : removed warnings
* src/SDCCast.c (createBlock): added comment ???
* src/hc08/ralloc.c: updated comments

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

23 files changed:
ChangeLog
device/lib/_gptrget.c
device/lib/_gptrput.c
device/lib/calloc.c
device/lib/free.c
device/lib/malloc.c
device/lib/realloc.c
src/SDCCast.c
src/SDCCcse.c
src/SDCCcse.h
src/SDCCglue.c
src/SDCCicode.c
src/SDCCicode.h
src/SDCCsymt.h
src/avr/gen.c
src/ds390/gen.c
src/hc08/gen.c
src/hc08/ralloc.c
src/mcs51/gen.c
src/pic16/glue.c
src/pic16/ralloc.c
src/xa51/gen.c
support/regression/tests/bug-868103.c [new file with mode: 0644]

index a2166d66ea67edb6ea9253157ce716f43253689c..b1e84471b3199a05f91e7187c6db8fd216d0f438 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2004-09-08 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * device/lib/_gptrget.c,
+       * device/lib/_gptrput.c: updated comment
+       * device/lib/calloc.c,
+       * device/lib/free.c,
+       * device/lib/malloc.c,
+       * device/lib/realloc.c: added LGPL, made them reentrant-safe
+       * src/SDCCcse.c (cseBBlock),
+       * src/SDCCicode.c (printOperand, geniCodeArray),
+       * src/SDCCicode.h (struct operand): fixed bug 868103
+       * support/regression/tests/bug-868103.c: added
+       * src/SDCCast.c (searchLitOp),
+       * src/SDCCcse.h (struct cseDef),
+       * src/SDCCglue.c (printIvalArray, spacesToUnderscores),
+       * src/SDCCicode.h (struct operand),
+       * src/SDCCsymt.h (struct sym_link),
+       * src/avr/gen.c (hasInc),
+       * src/ds390/gen.c (hasInc),
+       * src/hc08/gen.c (genPlusIncr, hasInc),
+       * src/mcs51/gen.c (hasInc),
+       * src/pic16/glue.c (pic16_printIvalChar),
+       * src/pic16/ralloc.c (regWithIdx),
+       * src/xa51/gen.c (hasInc) : removed warnings
+       * src/SDCCast.c (createBlock): added comment ???
+       * src/hc08/ralloc.c: updated comments
+
 2004-09-07 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * doc/sdccman.lyx: updated section on switch statements, added
 2004-09-07 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * doc/sdccman.lyx: updated section on switch statements, added
index 25a421254558fb0a684733434e39aede44ee381a..30f982976095aed6cfc07e5f95d8fb36dddf36fa 100644 (file)
    what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
    what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
-/* not all devices use P2 to page pdata memory, therefore __XPAGE was 
-   introduced. On some targets __XPAGE itself is a paged SFR so it is 
-   not save for all platforms to set this */
+/* not all devices use P2 to page pdata memory, therefore __XPAGE was
+   introduced. On some targets __XPAGE itself is a paged SFR so it is
+   not safe for all platforms to set this. Furthermore some targets
+   can be configured to behave differently for movx @dptr vs. movx @Ri
+   (don't drive high byte of address bus for movx @Ri only) */
 #define USE_PDATA_PAGING_REGISTER 0
 
 /* the  return value is expected to be in acc, and not in the standard
 #define USE_PDATA_PAGING_REGISTER 0
 
 /* the  return value is expected to be in acc, and not in the standard
@@ -34,36 +36,36 @@ void
 _gptrget (char *gptr)
 {
     gptr; /* hush the compiler */
 _gptrget (char *gptr)
 {
     gptr; /* hush the compiler */
-       
+
     _asm
     ;   save values passed
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
     _asm
     ;   save values passed
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
-        jz      00001$ ; 0 near
-       dec     a
-       jz      00002$  ; 1 far
+        jz      00001$  ; 0 near
+        dec     a
+        jz      00002$  ; 1 far
+        dec     a
+        jz      00003$  ; 2 code
+        dec     a
+        jz      00004$  ; 3 pdata
+        dec     a       ; 4 skip generic pointer
         dec     a
         dec     a
-        jz      00003$ ; 2 code
-       dec     a
-       jz      00004$  ; 3 pdata
-       dec     a       ; 4 skip generic pointer
-       dec     a
-       jz      00001$  ; 5 idata
+        jz      00001$  ; 5 idata
     ;
     ;   any other value for type
     ;   return xFF
     ;
     ;   any other value for type
     ;   return xFF
-       mov     a,#0xff
-       sjmp    00005$
+        mov     a,#0xff
+        sjmp    00005$
     ;
     ;   Pointer to data space
     ;
  00001$:
     ;
     ;   Pointer to data space
     ;
  00001$:
-       push    ar0
+        push    ar0
         ;
         ;
-       mov     r0,dpl     ; use only low order address
-       mov     a,@r0
+        mov     r0,dpl     ; use only low order address
+        mov     a,@r0
         ;
         pop     ar0
         ;
         ;
         pop     ar0
         ;
@@ -78,7 +80,7 @@ _gptrget (char *gptr)
 ;   pointer to code area
 ;
  00003$:
 ;   pointer to code area
 ;
  00003$:
-       ; clr     a  is already 0
+        ; clr     a  is already 0
         movc    a,@a+dptr
         sjmp    00005$
 ;
         movc    a,@a+dptr
         sjmp    00005$
 ;
@@ -89,12 +91,12 @@ _gptrget (char *gptr)
         mov     dph,__XPAGE     ; __XPAGE (usually p2) holds high byte for pdata access
         movx    a,@dptr
 #else
         mov     dph,__XPAGE     ; __XPAGE (usually p2) holds high byte for pdata access
         movx    a,@dptr
 #else
-       push    ar0
-       mov     r0,dpl
+        push    ar0
+        mov     r0,dpl
         movx    a,@r0
         movx    a,@r0
-       pop     ar0
-#endif 
-       
+        pop     ar0
+#endif
+
 ;
 ;   return
 ;
 ;
 ;   return
 ;
@@ -115,69 +117,69 @@ _gptrgetWord (unsigned *gptr)
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
-        jz      00001$ ; 0 near
-       dec     a
-       jz      00002$  ; 1 far
+        jz      00001$  ; 0 near
         dec     a
         dec     a
-        jz      00003$ ; 2 code
-       dec     a
-       jz      00004$  ; 3 pdata
-       dec     a       ; 4 skip generic pointer
-       dec     a
-       jz      00001$  ; 5 idata
+        jz      00002$  ; 1 far
+        dec     a
+        jz      00003$  ; 2 code
+        dec     a
+        jz      00004$  ; 3 pdata
+        dec     a       ; 4 skip generic pointer
+        dec     a
+        jz      00001$  ; 5 idata
     ;
     ;   any other value for type
     ;   return xFF
     ;
     ;   any other value for type
     ;   return xFF
-       mov     a,#0xff
-       sjmp    00006$
+        mov     a,#0xff
+        sjmp    00006$
     ;
     ;   Pointer to data space
     ;
  00001$:
     ;
     ;   Pointer to data space
     ;
  00001$:
-        push   ar0
-       mov     r0,dpl     ; use only low order address
-       mov     _ap,@r0
-       inc     r0
-       mov     a,@r0
-       inc     dpl
+        push    ar0
+        mov     r0,dpl     ; use only low order address
+        mov     _ap,@r0
+        inc     r0
+        mov     a,@r0
+        inc     dpl
         sjmp    00005$
     ;
     ;   pointer to xternal data
     ;
  00002$:
         movx    a,@dptr
         sjmp    00005$
     ;
     ;   pointer to xternal data
     ;
  00002$:
         movx    a,@dptr
-       mov     _ap,a
-       inc     dptr
-       movx    a,@dptr
+        mov     _ap,a
+        inc     dptr
+        movx    a,@dptr
         sjmp    00006$
 ;
 ;   pointer to code area
 ;
  00003$:
         sjmp    00006$
 ;
 ;   pointer to code area
 ;
  00003$:
-       ; clr     a  is already 0
+        ; clr     a  is already 0
+        movc    a,@a+dptr
+        mov     _ap,a
+        clr     a
+        inc     dptr
         movc    a,@a+dptr
         movc    a,@a+dptr
-       mov     _ap,a
-       clr     a
-       inc     dptr
-       movc    a,@a+dptr
         sjmp    00006$
 ;
 ;   pointer to xternal stack
 ;
  00004$:
         sjmp    00006$
 ;
 ;   pointer to xternal stack
 ;
  00004$:
-       push    ar0
-       mov     r0,dpl
+        push    ar0
+        mov     r0,dpl
+        movx    a,@r0
+        mov     _ap,a
+        inc     r0
         movx    a,@r0
         movx    a,@r0
-       mov     _ap,a
-       inc     r0
-       movx    a,@r0
-       inc     dpl
+        inc     dpl
 ;
 ;   restore and return
 ;
 00005$:
     pop ar0
 ;
 ;   restore and return
 ;
 00005$:
     pop ar0
-00006$:        
+00006$:
      _endasm ;
 
 }
      _endasm ;
 
 }
index 242a7f53884442021738cbb337320d666778aee0..f7aadc331f43acb9cc40fb19aac09a77bc8a7502 100644 (file)
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
 
 /*-------------------------------------------------------------------------
 
-  _gptrput.c :- put value for a generic pointer               
+  _gptrput.c :- put value for a generic pointer
 
              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)
 
 
              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1999)
 
@@ -8,24 +8,26 @@
    under the terms of the GNU Library 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 Library General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
-   
+
    This library 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 Library General Public License for more details.
    This library 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 Library General Public License for more details.
-   
+
    You should have received a copy of the GNU Library 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 Library 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!
 -------------------------------------------------------------------------*/
 
 -------------------------------------------------------------------------*/
 
-/* not all devices use P2 to page pdata memory, therefore __XPAGE was 
-   introduced. On some targets __XPAGE itself is a paged SFR so it is 
-   not save for all platforms to set this */
+/* not all devices use P2 to page pdata memory, therefore __XPAGE was
+   introduced. On some targets __XPAGE itself is a paged SFR so it is
+   not safe for all platforms to set this. Furthermore some targets
+   can be configured to behave differently for movx @dptr vs. movx @Ri
+   (don't drive high byte of address bus for movx @Ri only) */
 #define USE_PDATA_PAGING_REGISTER 0
 
 void
 #define USE_PDATA_PAGING_REGISTER 0
 
 void
@@ -34,53 +36,53 @@ _gptrput (char *gptr, char c)
     gptr; c; /* hush the compiler */
 
     _asm
     gptr; c; /* hush the compiler */
 
     _asm
-       push     acc
+        push     acc
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
-       jz      00001$  ; 0 near
+        jz      00001$  ; 0 near
         dec     a
         dec     a
-        jz      00002$ ; 1 far
+        jz      00002$  ; 1 far
         dec     a
         dec     a
-        jz      00003$ ; 2 code
+        jz      00003$  ; 2 code
         dec     a
         jz      00004$  ; 3 pdata
         dec     a
         jz      00004$  ; 3 pdata
-       dec     a       ; 4 skip generic pointer
-       dec     a
-       jz      00001$  ; 5 idata
+        dec     a       ; 4 skip generic pointer
+        dec     a
+        jz      00001$  ; 5 idata
 
  00003$:
 
  00003$:
-       pop     acc    ; do nothing
-       sjmp    00005$
-;  
+        pop     acc    ; do nothing
+        sjmp    00005$
+;
 ;       store into near space
 ;
  00001$:
 ;       store into near space
 ;
  00001$:
-       pop     acc
-       push    ar0
-       mov     r0,dpl
-       mov     @r0,a
-       pop     ar0
-       sjmp    00005$
+        pop     acc
+        push    ar0
+        mov     r0,dpl
+        mov     @r0,a
+        pop     ar0
+        sjmp    00005$
 
  00002$:
 
  00002$:
-       pop     acc
-       movx    @dptr,a
-       sjmp    00005$
+        pop     acc
+        movx    @dptr,a
+        sjmp    00005$
 
  00004$:
 #if USE_PDATA_PAGING_REGISTER
 
  00004$:
 #if USE_PDATA_PAGING_REGISTER
-       pop     acc
-       mov     dph,__XPAGE     ; __XPAGE (usually p2) holds high byte for pdata access
-       movx    @dptr,a
+        pop     acc
+        mov     dph,__XPAGE     ; __XPAGE (usually p2) holds high byte for pdata access
+        movx    @dptr,a
 #else
 #else
-       pop     acc
-       push    ar0
-       mov     r0,dpl
+        pop     acc
+        push    ar0
+        mov     r0,dpl
         movx    @r0,a
         movx    @r0,a
-       pop     ar0
-#endif 
+        pop     ar0
+#endif
 
  00005$:
 _endasm;
 
  00005$:
 _endasm;
@@ -91,60 +93,60 @@ void
 _gptrputWord ()
 {
     _asm
 _gptrputWord ()
 {
     _asm
-       push     acc
+        push     acc
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
         mov     a,b
-       jz      00011$  ; 0 near
+        jz      00011$  ; 0 near
         dec     a
         dec     a
-        jz      00012$ ; 1 far
+        jz      00012$  ; 1 far
         dec     a
         dec     a
-        jz      00013$ ; 2 code
+        jz      00013$  ; 2 code
         dec     a
         jz      00014$  ; 3 pdata
         dec     a
         jz      00014$  ; 3 pdata
-       dec     a       ; 4 skip generic pointer
-       dec     a
-       jz      00011$  ; 5 idata
-       pop     acc
-       sjmp    00016$
+        dec     a       ; 4 skip generic pointer
+        dec     a
+        jz      00011$  ; 5 idata
+        pop     acc
+        sjmp    00016$
 ;
 ;       store into near space
 ;
  00011$:
 ;
 ;       store into near space
 ;
  00011$:
-       pop     acc
-       push    ar0
-       mov     r0,dpl
-       mov     @r0,_ap
-       inc     r0
-       mov     @r0,a
-       sjmp    00015$
+        pop     acc
+        push    ar0
+        mov     r0,dpl
+        mov     @r0,_ap
+        inc     r0
+        mov     @r0,a
+        sjmp    00015$
 
  00012$:
 
  00012$:
-       mov     a, _ap
-       movx    @dptr,a
-       inc     dptr
-       pop     acc
+        mov     a, _ap
         movx    @dptr,a
         movx    @dptr,a
-       sjmp    00016$
+        inc     dptr
+        pop     acc
+        movx    @dptr,a
+        sjmp    00016$
 
  00013$:
 
  00013$:
-       pop     acc    ; do nothing
-       sjmp    00016$
+        pop     acc    ; do nothing
+        sjmp    00016$
 
  00014$:
 
  00014$:
-       pop     acc
-       push    ar0
-       mov     r0,dpl
-       xch     a,_ap
-       movx    @r0,a
-       inc     r0
-       xch     a,_ap
-       movx    @r0, a
- 00015$:       
-        inc    dptr
-       pop     ar0
- 00016$:       
+        pop     acc
+        push    ar0
+        mov     r0,dpl
+        xch     a,_ap
+        movx    @r0,a
+        inc     r0
+        xch     a,_ap
+        movx    @r0, a
+ 00015$:
+        inc     dptr
+        pop     ar0
+ 00016$:
     _endasm;
 }
 
     _endasm;
 }
 
index 6abb424269bd15c7da0b21d84d7680ee8ec4af3b..fa99ac4902607e6755d28a628788e3f0ef6d39c7 100644 (file)
@@ -1,9 +1,27 @@
+/*-------------------------------------------------------------------------
+   calloc.c - allocate cleared memory.
+
+   Copyright (C) 2004 - Maarten Brock, sourceforge.brock@dse.nl
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+-------------------------------------------------------------------------*/
+
 #include <sdcc-lib.h>
 #include <malloc.h>
 #include <string.h>
 
 #include <sdcc-lib.h>
 #include <malloc.h>
 #include <string.h>
 
-//--------------------------------------------------------------------
-//Written by Maarten Brock, 2004
 //--------------------------------------------------------------------
 //calloc function implementation for embedded system
 //Non-ANSI keywords are C51 specific.
 //--------------------------------------------------------------------
 //calloc function implementation for embedded system
 //Non-ANSI keywords are C51 specific.
index ff1c16c4f4511eea2c2eb8c0cec5cf2aad06551e..9634434c7387b05132791dd9c98d47311d408c52 100644 (file)
@@ -1,6 +1,32 @@
+/*-------------------------------------------------------------------------
+   free.c - release allocated memory.
+
+   Copyright (C) 2004 - Maarten Brock, sourceforge.brock@dse.nl
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+-------------------------------------------------------------------------*/
+
 #include <sdcc-lib.h>
 #include <malloc.h>
 
 #include <sdcc-lib.h>
 #include <malloc.h>
 
+#if defined(SDCC_STACK_AUTO) || defined(SDCC_z80) || defined(SDCC_gbz80)
+  #define CRITICAL critical
+#else
+  #define CRITICAL
+#endif
+
 #if _SDCC_MALLOC_TYPE_MLH
 
 typedef struct _MEMHEADER MEMHEADER;
 #if _SDCC_MALLOC_TYPE_MLH
 
 typedef struct _MEMHEADER MEMHEADER;
@@ -42,6 +68,7 @@ free (void *p)
   MEMHEADER *prev_header, *pthis;
 
   if ( p ) //For allocated pointers only!
   MEMHEADER *prev_header, *pthis;
 
   if ( p ) //For allocated pointers only!
+    CRITICAL
     {
       pthis = (MEMHEADER * )((char *)  p - HEADER_SIZE); //to start of header
       if ( pthis->prev ) // For the regular header
     {
       pthis = (MEMHEADER * )((char *)  p - HEADER_SIZE); //to start of header
       if ( pthis->prev ) // For the regular header
@@ -88,16 +115,16 @@ free (void *p)
               register MEMHEADER xdata * cur_header;
 
               if (!p)
               register MEMHEADER xdata * cur_header;
 
               if (!p)
-                  return NULL;
+                return NULL;
               pthis = (MEMHEADER xdata *) p;
               pthis -= 1; //to start of header
               cur_header = _sdcc_first_memheader;
               _sdcc_prev_memheader = NULL;
               while (cur_header && pthis != cur_header)
               pthis = (MEMHEADER xdata *) p;
               pthis -= 1; //to start of header
               cur_header = _sdcc_first_memheader;
               _sdcc_prev_memheader = NULL;
               while (cur_header && pthis != cur_header)
-                {
-                  _sdcc_prev_memheader = cur_header;
-                  cur_header = cur_header->next;
-                }
+              {
+                _sdcc_prev_memheader = cur_header;
+                cur_header = cur_header->next;
+              }
               return (cur_header);
             }
 
               return (cur_header);
             }
 
@@ -105,16 +132,19 @@ free (void *p)
             {
               register MEMHEADER xdata * pthis;
 
             {
               register MEMHEADER xdata * pthis;
 
-              pthis = _sdcc_find_memheader(p);
-              if (pthis) //For allocated pointers only!
+              CRITICAL
               {
               {
-                if (!_sdcc_prev_memheader)
-                {
-                  pthis->len = 0;
-                }
-                else
+                pthis = _sdcc_find_memheader(p);
+                if (pthis) //For allocated pointers only!
                 {
                 {
-                  _sdcc_prev_memheader->next = pthis->next;
+                  if (!_sdcc_prev_memheader)
+                  {
+                    pthis->len = 0;
+                  }
+                  else
+                  {
+                    _sdcc_prev_memheader->next = pthis->next;
+                  }
                 }
               }
             }
                 }
               }
             }
index cf6f905c3c2ad8a6c616529241b71c8de5c3c9bc..4754095cc3149e75810537490d6a157143be309f 100644 (file)
@@ -1,6 +1,32 @@
+/*-------------------------------------------------------------------------
+   malloc.c - allocate memory.
+
+   Copyright (C) 2004 - Maarten Brock, sourceforge.brock@dse.nl
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+-------------------------------------------------------------------------*/
+
 #include <sdcc-lib.h>
 #include <malloc.h>
 
 #include <sdcc-lib.h>
 #include <malloc.h>
 
+#if defined(SDCC_STACK_AUTO) || defined(SDCC_z80) || defined(SDCC_gbz80)
+  #define CRITICAL critical
+#else
+  #define CRITICAL
+#endif
+
 #if _SDCC_MALLOC_TYPE_MLH
 
 typedef struct _MEMHEADER MEMHEADER;
 #if _SDCC_MALLOC_TYPE_MLH
 
 typedef struct _MEMHEADER MEMHEADER;
@@ -36,8 +62,9 @@ _sdcc_heap_init(void)
 void *
 malloc (unsigned int size)
 {
 void *
 malloc (unsigned int size)
 {
-  MEMHEADER * current_header;
-  MEMHEADER * new_header;
+  register MEMHEADER * current_header;
+  register MEMHEADER * new_header;
+  register void * ret;
 
   if (size>(0xFFFF-HEADER_SIZE))
     {
 
   if (size>(0xFFFF-HEADER_SIZE))
     {
@@ -47,48 +74,56 @@ malloc (unsigned int size)
   size += HEADER_SIZE; //We need a memory for header too
   current_header = &_sdcc_heap_start;
 
   size += HEADER_SIZE; //We need a memory for header too
   current_header = &_sdcc_heap_start;
 
-  while (1)
+  CRITICAL
     {
     {
-      //    current
-      //    |   len       next
-      //    v   v         v
-      //....*****.........******....
-      //         ^^^^^^^^^
-      //           spare
-
-      if ((((unsigned int)current_header->next) -
-           ((unsigned int)current_header) -
-           current_header->len) >= size)
+      while (1)
         {
         {
-          break; //if spare is more than need
+          //    current
+          //    |   len       next
+          //    v   v         v
+          //....*****.........******....
+          //         ^^^^^^^^^
+          //           spare
+
+          if ((((unsigned int)current_header->next) -
+               ((unsigned int)current_header) -
+               current_header->len) >= size)
+            { //if spare is more than needed
+              ret = &current_header->mem;
+              break;
+            }
+          current_header = current_header->next;    //else try next
+          if (!current_header->next)
+            { //if end_of_list reached
+              ret = NULL;
+              break;
+            }
         }
         }
-      current_header = current_header->next;    //else try next
-      if (!current_header->next)
+
+      if (ret)
         {
         {
-          return NULL;  //if end_of_list reached
+      if (!current_header->len)
+        { //This code works only for first_header in the list and only
+          current_header->len = size; //for first allocation
         }
         }
-    }
-
-  if (!current_header->len)
-    { //This code works only for first_header in the list and only
-      current_header->len = size; //for first allocation
-      return &current_header->mem;
-    }
-  else
-    {
-      //else create new header at the begin of spare
-      new_header = (MEMHEADER * )((char *)current_header + current_header->len);
-      new_header->next = current_header->next; //and plug it into the chain
-      new_header->prev = current_header;
-      current_header->next  = new_header;
-      if (new_header->next)
+      else
         {
         {
-          new_header->next->prev = new_header;
+          //else create new header at the begin of spare
+          new_header = (MEMHEADER * )((char *)current_header + current_header->len);
+          new_header->next = current_header->next; //and plug it into the chain
+          new_header->prev = current_header;
+          current_header->next  = new_header;
+          if (new_header->next)
+            {
+              new_header->next->prev = new_header;
+            }
+          new_header->len  = size; //mark as used
+              ret = &new_header->mem;
         }
         }
-      new_header->len  = size; //mark as used
-      return &new_header->mem;
     }
 }
     }
 }
+    return ret;
+}
 
 #else
 
 
 #else
 
@@ -129,54 +164,72 @@ malloc (unsigned int size)
             //         current_buffer = malloc(0x100);
             //
             //
             //         current_buffer = malloc(0x100);
             //
             //
-              MEMHEADER xdata * array = (MEMHEADER xdata *)heap;
+              char xdata * array = (char xdata *)heap;
 
               if ( !array ) //Reserved memory starts at 0x0000 but that's NULL...
               {             //So, we lost one byte!
 
               if ( !array ) //Reserved memory starts at 0x0000 but that's NULL...
               {             //So, we lost one byte!
-                 array = (MEMHEADER xdata * )((char xdata * ) array + 1) ;
+                 array++;
                  size--;
               }
                  size--;
               }
-              _sdcc_first_memheader = array;
+              _sdcc_first_memheader = (MEMHEADER xdata * ) array;
               //Reserve a mem for last header
               //Reserve a mem for last header
-              array->next = (MEMHEADER xdata * )(((char xdata * ) array) + size - sizeof(MEMHEADER xdata *));
-              array->next->next = (MEMHEADER xdata * ) NULL; //And mark it as last
-              array->len        = 0;    //Empty and ready.
+              _sdcc_first_memheader->next = (MEMHEADER xdata * )(array + size - sizeof(MEMHEADER xdata *));
+              _sdcc_first_memheader->next->next = (MEMHEADER xdata * ) NULL; //And mark it as last
+              _sdcc_first_memheader->len        = 0;    //Empty and ready.
             }
 
             void xdata * malloc (unsigned int size)
             {
               register MEMHEADER xdata * current_header;
               register MEMHEADER xdata * new_header;
             }
 
             void xdata * malloc (unsigned int size)
             {
               register MEMHEADER xdata * current_header;
               register MEMHEADER xdata * new_header;
+              register void xdata * ret;
 
               if (size>(0xFFFF-HEADER_SIZE)) return (void xdata *) NULL; //To prevent overflow in next line
               size += HEADER_SIZE; //We need a memory for header too
               current_header = _sdcc_first_memheader;
 
               if (size>(0xFFFF-HEADER_SIZE)) return (void xdata *) NULL; //To prevent overflow in next line
               size += HEADER_SIZE; //We need a memory for header too
               current_header = _sdcc_first_memheader;
-              while (1)
+              CRITICAL
               {
               {
-
-                //    current
-                //    |   len       next
-                //    v   v         v
-                //....*****.........******....
-                //         ^^^^^^^^^
-                //           spare
-
-                if ((((unsigned int)current_header->next) -
-                     ((unsigned int)current_header) -
-                     current_header->len) >= size) break; //if spare is more than need
-                current_header = current_header->next;    //else try next
-                if (!current_header->next)  return (void xdata *) NULL;  //if end_of_list reached
+                while (1)
+                {
+
+                  //    current
+                  //    |   len       next
+                  //    v   v         v
+                  //....*****.........******....
+                  //         ^^^^^^^^^
+                  //           spare
+
+                  if ((((unsigned int)current_header->next) -
+                       ((unsigned int)current_header) -
+                       current_header->len) >= size)
+                  { //if spare is more than needed
+                    ret = current_header->mem;
+                    break;
+                  }
+                  current_header = current_header->next;    //else try next
+                  if (!current_header->next)
+                  { //if end_of_list reached
+                    ret = (void xdata *) NULL;
+                    break;
+                  }
+                }
+                if (ret)
+                {
+                  if (!current_header->len)
+                  { //This code works only for first_header in the list and only
+                     current_header->len = size; //for first allocation
+                  }
+                  else
+                  { //else create new header at the begin of spare
+                    new_header = (MEMHEADER xdata * )((char xdata *)current_header + current_header->len);
+                    new_header->next = current_header->next; //and plug it into the chain
+                    current_header->next  = new_header;
+                    new_header->len  = size; //mark as used
+                    ret = new_header->mem;
+                  }
+                }
               }
               }
-              if (!current_header->len)
-              { //This code works only for first_header in the list and only
-                 current_header->len = size; //for first allocation
-                 return current_header->mem;
-              } //else create new header at the begin of spare
-              new_header = (MEMHEADER xdata * )((char xdata *)current_header + current_header->len);
-              new_header->next = current_header->next; //and plug it into the chain
-              current_header->next  = new_header;
-              new_header->len  = size; //mark as used
-              return new_header->mem;
+              return ret;
             }
 
             //END OF MODULE
             }
 
             //END OF MODULE
index 54fde7f92f09bfaf164d51317ed4a42e9528df98..c41ff8661006c27ec851c40c8ef68489628003a6 100644 (file)
@@ -1,9 +1,33 @@
+/*-------------------------------------------------------------------------
+   realloc.c - reallocate allocated memory.
+
+   Copyright (C) 2004 - Maarten Brock, sourceforge.brock@dse.nl
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+-------------------------------------------------------------------------*/
+
 #include <sdcc-lib.h>
 #include <malloc.h>
 #include <string.h>
 
 #include <sdcc-lib.h>
 #include <malloc.h>
 #include <string.h>
 
-//--------------------------------------------------------------------
-//Written by Maarten Brock, 2004
+#if defined(SDCC_STACK_AUTO) || defined(SDCC_z80) || defined(SDCC_gbz80)
+  #define CRITICAL critical
+#else
+  #define CRITICAL
+#endif
+
 //--------------------------------------------------------------------
 //realloc function implementation for embedded system
 //Non-ANSI keywords are C51 specific.
 //--------------------------------------------------------------------
 //realloc function implementation for embedded system
 //Non-ANSI keywords are C51 specific.
@@ -25,10 +49,12 @@ struct _MEMHEADER
 };
 
 #define HEADER_SIZE (sizeof(MEMHEADER)-sizeof(char))
 };
 
 #define HEADER_SIZE (sizeof(MEMHEADER)-sizeof(char))
+#define MEM(x)      (&x->mem)
 
 #else
 
 #define HEADER_SIZE sizeof(MEMHEADER)
 
 #else
 
 #define HEADER_SIZE sizeof(MEMHEADER)
+#define MEM(x)      (x->mem)
 
 #endif
 
 
 #endif
 
@@ -42,42 +68,56 @@ void xdata * realloc (void * p, size_t size)
 {
   register MEMHEADER xdata * pthis;
   register MEMHEADER xdata * pnew;
 {
   register MEMHEADER xdata * pthis;
   register MEMHEADER xdata * pnew;
+  register void xdata * ret;
 
 
-  pthis = _sdcc_find_memheader(p);
-  if (pthis)
+  CRITICAL
   {
   {
-    if (size>(0xFFFF-HEADER_SIZE)) return (void xdata *) NULL; //To prevent overflow in next line
-    size += HEADER_SIZE; //We need a memory for header too
-
-    if ((((unsigned int)pthis->next) - ((unsigned int)pthis)) >= size)
-    {//if spare is more than need
-      pthis->len = size;
-      return p;
-    }
-
-    if ((_sdcc_prev_memheader) &&
-        ((((unsigned int)pthis->next) -
-          ((unsigned int)_sdcc_prev_memheader) -
-          _sdcc_prev_memheader->len) >= size))
+    pthis = _sdcc_find_memheader(p);
+    if (pthis)
     {
     {
-      pnew = (MEMHEADER xdata * )((char xdata *)_sdcc_prev_memheader + _sdcc_prev_memheader->len);
-      _sdcc_prev_memheader->next = pnew;
-      memmove(pnew, pthis, pthis->len);
-      pnew->len = size;
-      return pnew->mem;
+      if (size > (0xFFFF-HEADER_SIZE))
+      {
+        ret = (void xdata *) NULL; //To prevent overflow in next line
+      }
+      else
+      {
+        size += HEADER_SIZE; //We need a memory for header too
+
+        if ((((unsigned int)pthis->next) - ((unsigned int)pthis)) >= size)
+        {//if spare is more than needed
+          pthis->len = size;
+          ret = p;
+        }
+        else
+        {
+          if ((_sdcc_prev_memheader) &&
+              ((((unsigned int)pthis->next) -
+                ((unsigned int)_sdcc_prev_memheader) -
+                _sdcc_prev_memheader->len) >= size))
+          {
+            pnew = (MEMHEADER xdata * )((char xdata *)_sdcc_prev_memheader + _sdcc_prev_memheader->len);
+            _sdcc_prev_memheader->next = pnew;
+            memmove(pnew, pthis, pthis->len);
+            pnew->len = size;
+            ret = MEM(pnew);
+          }
+          else
+          {
+            ret = malloc(size - HEADER_SIZE);
+            if (ret)
+            {
+              memcpy(ret, MEM(pthis), pthis->len - HEADER_SIZE);
+              free(p);
+            }
+          }
+        }
+      }
     }
     }
-
-    pnew = malloc(size - HEADER_SIZE);
-    if (pnew)
+    else
     {
     {
-      memcpy(pnew, pthis->mem, pthis->len - HEADER_SIZE);
-      free(p);
+      ret = malloc(size);
     }
     }
-    return pnew;
-  }
-  else
-  {
-       return malloc(size);
   }
   }
+  return ret;
 }
 //END OF MODULE
 }
 //END OF MODULE
index 46b4466e1a60dfd7df216aff84a9d175ff31a4ce..d0898d7e57991ae917bec7466355cc07a7ea8f4c 100644 (file)
@@ -1969,7 +1969,7 @@ reverseLoop (ast * loop, symbol * sym, ast * init, ast * end)
 /* searchLitOp - search tree (*ops only) for an ast with literal */
 /*-----------------------------------------------------------------*/
 static ast *
 /* searchLitOp - search tree (*ops only) for an ast with literal */
 /*-----------------------------------------------------------------*/
 static ast *
-searchLitOp (ast *tree, ast **parent, const char *ops)
+searchLitOp (ast *tree, ast **parent, const unsigned char *ops)
 {
   ast *ret;
 
 {
   ast *ret;
 
@@ -4416,7 +4416,7 @@ createBlock (symbol * decl, ast * body)
   ex = newNode (BLOCK, NULL, body);
   ex->values.sym = decl;
   
   ex = newNode (BLOCK, NULL, body);
   ex->values.sym = decl;
   
-  ex->right = ex->right;
+  ex->right = ex->right;///?????
   ex->level++;
   ex->lineno = 0;
   return ex;
   ex->level++;
   ex->lineno = 0;
   return ex;
index 6094b0444d6a1efd22dfe76234e4dac7968af1e1..51dc99775f283b7a5f0d043f5f108d10f22dcb9f 100644 (file)
@@ -56,7 +56,7 @@ newCseDef (operand * sym, iCode * ic)
           cdp->fromGlobal |= isOperandGlobal (IC_RIGHT (ic));
         }
     }
           cdp->fromGlobal |= isOperandGlobal (IC_RIGHT (ic));
         }
     }
-  
+
   return cdp;
 }
 
   return cdp;
 }
 
@@ -66,7 +66,7 @@ updateCseDefAncestors(cseDef *cdp, set * cseSet)
   cseDef *loop;
   set *sl;
   iCode *ic = cdp->diCode;
   cseDef *loop;
   set *sl;
   iCode *ic = cdp->diCode;
-  
+
   if (ic->op!=IF && ic->op!=JUMPTABLE)
     {
       if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
   if (ic->op!=IF && ic->op!=JUMPTABLE)
     {
       if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
@@ -104,7 +104,7 @@ updateCseDefAncestors(cseDef *cdp, set * cseSet)
 /*-----------------------------------------------------------------*/
 /* int isCseDefEqual - two definitions are equal                   */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* int isCseDefEqual - two definitions are equal                   */
 /*-----------------------------------------------------------------*/
-int 
+int
 isCseDefEqual (void *vsrc, void *vdest)
 {
   cseDef *src = vsrc;
 isCseDefEqual (void *vsrc, void *vdest)
 {
   cseDef *src = vsrc;
@@ -114,14 +114,14 @@ isCseDefEqual (void *vsrc, void *vdest)
     return 1;
 
   return (src->key == dest->key &&
     return 1;
 
   return (src->key == dest->key &&
-         src->diCode == dest->diCode);
+          src->diCode == dest->diCode);
 
 }
 
 /*-----------------------------------------------------------------*/
 /* pcseDef - in the cseDef                                         */
 /*-----------------------------------------------------------------*/
 
 }
 
 /*-----------------------------------------------------------------*/
 /* pcseDef - in the cseDef                                         */
 /*-----------------------------------------------------------------*/
-int 
+int
 pcseDef (void *item, va_list ap)
 {
   cseDef *cdp = item;
 pcseDef (void *item, va_list ap)
 {
   cseDef *cdp = item;
@@ -140,8 +140,8 @@ pcseDef (void *item, va_list ap)
 void ReplaceOpWithCheaperOp(operand **op, operand *cop) {
 #ifdef RANGEHUNT
   printf ("ReplaceOpWithCheaperOp %s with %s: ",
 void ReplaceOpWithCheaperOp(operand **op, operand *cop) {
 #ifdef RANGEHUNT
   printf ("ReplaceOpWithCheaperOp %s with %s: ",
-         IS_SYMOP((*op)) ? OP_SYMBOL((*op))->name : "!SYM",
-         IS_SYMOP(cop) ? OP_SYMBOL(cop)->name : "!SYM");
+          IS_SYMOP((*op)) ? OP_SYMBOL((*op))->name : "!SYM",
+          IS_SYMOP(cop) ? OP_SYMBOL(cop)->name : "!SYM");
   // if op is a register equivalent
   if (IS_ITEMP(cop) && OP_SYMBOL((*op))->isreqv) {
     operand **rop = &OP_SYMBOL((*op))->usl.spillLoc->reqv;
   // if op is a register equivalent
   if (IS_ITEMP(cop) && OP_SYMBOL((*op))->isreqv) {
     operand **rop = &OP_SYMBOL((*op))->usl.spillLoc->reqv;
@@ -174,84 +174,84 @@ replaceAllSymBySym (iCode * ic, operand * from, operand * to, bitVect ** ndpset)
 
       /* do the special cases first */
       if (lic->op == IFX)
 
       /* do the special cases first */
       if (lic->op == IFX)
-       {
-         if (IS_SYMOP (to) &&
-             IC_COND (lic)->key == from->key)
-           {
+        {
+          if (IS_SYMOP (to) &&
+              IC_COND (lic)->key == from->key)
+            {
 
 
-             bitVectUnSetBit (OP_USES (from), lic->key);
-             OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
-             siaddr = IC_COND (lic)->isaddr;
-             IC_COND (lic) = operandFromOperand (to);
-             IC_COND (lic)->isaddr = siaddr;
+              bitVectUnSetBit (OP_USES (from), lic->key);
+              OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
+              siaddr = IC_COND (lic)->isaddr;
+              IC_COND (lic) = operandFromOperand (to);
+              IC_COND (lic)->isaddr = siaddr;
 
 
-           }
-         continue;
-       }
+            }
+          continue;
+        }
 
       if (lic->op == JUMPTABLE)
 
       if (lic->op == JUMPTABLE)
-       {
-         if (IS_SYMOP (to) &&
-             IC_JTCOND (lic)->key == from->key)
-           {
-
-             bitVectUnSetBit (OP_USES (from), lic->key);
-             OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
-             siaddr = IC_COND (lic)->isaddr;
-             IC_JTCOND (lic) = operandFromOperand (to);
-             IC_JTCOND (lic)->isaddr = siaddr;
-
-           }
-         continue;
-       }
-
-      if (IS_SYMOP(to) && 
-         IC_RESULT (lic) && IC_RESULT (lic)->key == from->key)
-       {
-         /* maintain du chains */
-         if (POINTER_SET (lic))
-           {
-             bitVectUnSetBit (OP_USES (from), lic->key);
-             OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
-
-             /* also check if the "from" was in the non-dominating
-                pointer sets and replace it with "to" in the bitVector */
-             if (bitVectBitValue (*ndpset, from->key))
-               {
-                 bitVectUnSetBit (*ndpset, from->key);
-                 bitVectSetBit (*ndpset, to->key);
-               }
-
-           }
-         else
-           {
-             bitVectUnSetBit (OP_DEFS (from), lic->key);
-             OP_DEFS(to)=bitVectSetBit (OP_DEFS (to), lic->key);
-           }
-         siaddr = IC_RESULT (lic)->isaddr;
-         IC_RESULT (lic) = operandFromOperand (to);
-         IC_RESULT (lic)->isaddr = siaddr;
-       }
+        {
+          if (IS_SYMOP (to) &&
+              IC_JTCOND (lic)->key == from->key)
+            {
+
+              bitVectUnSetBit (OP_USES (from), lic->key);
+              OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
+              siaddr = IC_COND (lic)->isaddr;
+              IC_JTCOND (lic) = operandFromOperand (to);
+              IC_JTCOND (lic)->isaddr = siaddr;
+
+            }
+          continue;
+        }
+
+      if (IS_SYMOP(to) &&
+          IC_RESULT (lic) && IC_RESULT (lic)->key == from->key)
+        {
+          /* maintain du chains */
+          if (POINTER_SET (lic))
+            {
+              bitVectUnSetBit (OP_USES (from), lic->key);
+              OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
+
+              /* also check if the "from" was in the non-dominating
+                 pointer sets and replace it with "to" in the bitVector */
+              if (bitVectBitValue (*ndpset, from->key))
+                {
+                  bitVectUnSetBit (*ndpset, from->key);
+                  bitVectSetBit (*ndpset, to->key);
+                }
+
+            }
+          else
+            {
+              bitVectUnSetBit (OP_DEFS (from), lic->key);
+              OP_DEFS(to)=bitVectSetBit (OP_DEFS (to), lic->key);
+            }
+          siaddr = IC_RESULT (lic)->isaddr;
+          IC_RESULT (lic) = operandFromOperand (to);
+          IC_RESULT (lic)->isaddr = siaddr;
+        }
 
       if (IS_SYMOP (to) &&
 
       if (IS_SYMOP (to) &&
-         IC_RIGHT (lic) && IC_RIGHT (lic)->key == from->key)
-       {
-         bitVectUnSetBit (OP_USES (from), lic->key);
-         OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
-         siaddr = IC_RIGHT (lic)->isaddr;
-         IC_RIGHT (lic) = operandFromOperand (to);
-         IC_RIGHT (lic)->isaddr = siaddr;
-       }
+          IC_RIGHT (lic) && IC_RIGHT (lic)->key == from->key)
+        {
+          bitVectUnSetBit (OP_USES (from), lic->key);
+          OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
+          siaddr = IC_RIGHT (lic)->isaddr;
+          IC_RIGHT (lic) = operandFromOperand (to);
+          IC_RIGHT (lic)->isaddr = siaddr;
+        }
 
       if (IS_SYMOP (to) &&
 
       if (IS_SYMOP (to) &&
-         IC_LEFT (lic) && IC_LEFT (lic)->key == from->key)
-       {
-         bitVectUnSetBit (OP_USES (from), lic->key);
-         OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
-         siaddr = IC_LEFT (lic)->isaddr;
-         IC_LEFT (lic) = operandFromOperand (to);
-         IC_LEFT (lic)->isaddr = siaddr;
-       }
+          IC_LEFT (lic) && IC_LEFT (lic)->key == from->key)
+        {
+          bitVectUnSetBit (OP_USES (from), lic->key);
+          OP_USES(to)=bitVectSetBit (OP_USES (to), lic->key);
+          siaddr = IC_LEFT (lic)->isaddr;
+          IC_LEFT (lic) = operandFromOperand (to);
+          IC_LEFT (lic)->isaddr = siaddr;
+        }
     }
 }
 
     }
 }
 
@@ -295,7 +295,7 @@ DEFSETFUNC (removeFromInExprs)
 /*-----------------------------------------------------------------*/
 /* isGlobalInNearSpace - return TRUE if valriable is a globalin data */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* isGlobalInNearSpace - return TRUE if valriable is a globalin data */
 /*-----------------------------------------------------------------*/
-static bool 
+static bool
 isGlobalInNearSpace (operand * op)
 {
   sym_link *type = getSpec (operandType (op));
 isGlobalInNearSpace (operand * op)
 {
   sym_link *type = getSpec (operandType (op));
@@ -334,41 +334,41 @@ DEFSETFUNC (findCheaperOp)
       /* constant propagation & dead code elim */
       /* for assignments only                 */
       if (cdp->diCode->op == '=') {
       /* constant propagation & dead code elim */
       /* for assignments only                 */
       if (cdp->diCode->op == '=') {
-       /* if the result is volatile then return result */
-       if (IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
-         *opp = IC_RESULT (cdp->diCode);
-       else
-         /* if this is a straight assignment and
-            left is a temp then prefer the temporary to the
-            true symbol */
-         if (!POINTER_SET (cdp->diCode) &&
-             IS_ITEMP (IC_RESULT (cdp->diCode)) &&
-             IS_TRUE_SYMOP (IC_RIGHT (cdp->diCode)))
-           *opp = IC_RESULT (cdp->diCode);
-         else {
-           /* if straight assignement && and both
-              are temps then prefer the one that
-              will not need extra space to spil, also
-              take into consideration if right side
-              an induction variable
-           */
-           if (!POINTER_SET (cdp->diCode) &&
-               IS_ITEMP (IC_RESULT (cdp->diCode)) &&
-               IS_ITEMP (IC_RIGHT (cdp->diCode)) &&
-               !OP_SYMBOL (IC_RIGHT (cdp->diCode))->isind &&
-               !OP_SYMBOL(IC_RIGHT (cdp->diCode))->isreqv &&
-               ((!SPIL_LOC (IC_RIGHT (cdp->diCode)) &&
-                 SPIL_LOC (IC_RESULT (cdp->diCode))) ||
-                (SPIL_LOC (IC_RESULT (cdp->diCode)) &&
-                 SPIL_LOC (IC_RESULT (cdp->diCode)) ==
-                 SPIL_LOC (IC_RIGHT (cdp->diCode)))))
-             *opp = IC_RESULT (cdp->diCode);
-           else
-             *opp = IC_RIGHT (cdp->diCode);
-         }
+        /* if the result is volatile then return result */
+        if (IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
+          *opp = IC_RESULT (cdp->diCode);
+        else
+          /* if this is a straight assignment and
+             left is a temp then prefer the temporary to the
+             true symbol */
+          if (!POINTER_SET (cdp->diCode) &&
+              IS_ITEMP (IC_RESULT (cdp->diCode)) &&
+              IS_TRUE_SYMOP (IC_RIGHT (cdp->diCode)))
+            *opp = IC_RESULT (cdp->diCode);
+          else {
+            /* if straight assignement && and both
+               are temps then prefer the one that
+               will not need extra space to spil, also
+               take into consideration if right side
+               an induction variable
+            */
+            if (!POINTER_SET (cdp->diCode) &&
+                IS_ITEMP (IC_RESULT (cdp->diCode)) &&
+                IS_ITEMP (IC_RIGHT (cdp->diCode)) &&
+                !OP_SYMBOL (IC_RIGHT (cdp->diCode))->isind &&
+                !OP_SYMBOL(IC_RIGHT (cdp->diCode))->isreqv &&
+                ((!SPIL_LOC (IC_RIGHT (cdp->diCode)) &&
+                  SPIL_LOC (IC_RESULT (cdp->diCode))) ||
+                 (SPIL_LOC (IC_RESULT (cdp->diCode)) &&
+                  SPIL_LOC (IC_RESULT (cdp->diCode)) ==
+                  SPIL_LOC (IC_RIGHT (cdp->diCode)))))
+              *opp = IC_RESULT (cdp->diCode);
+            else
+              *opp = IC_RIGHT (cdp->diCode);
+          }
       }
       else
       }
       else
-       *opp = IC_RESULT (cdp->diCode);
+        *opp = IC_RESULT (cdp->diCode);
     }
 
   /* if this is an assign to a temp. then check
     }
 
   /* if this is an assign to a temp. then check
@@ -384,50 +384,50 @@ DEFSETFUNC (findCheaperOp)
   if ((*opp) &&
       (isOperandLiteral(*opp) || !checkSign ||
        (checkSign &&
   if ((*opp) &&
       (isOperandLiteral(*opp) || !checkSign ||
        (checkSign &&
-       IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) &&
-       (SPEC_USIGN(operandType (cop))==SPEC_USIGN(operandType (*opp)) &&
-        (SPEC_LONG(operandType (cop))==SPEC_LONG(operandType (*opp)))))))
+        IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) &&
+        (SPEC_USIGN(operandType (cop))==SPEC_USIGN(operandType (*opp)) &&
+         (SPEC_LONG(operandType (cop))==SPEC_LONG(operandType (*opp)))))))
       {
 
       if ((isGlobalInNearSpace (cop) &&
       {
 
       if ((isGlobalInNearSpace (cop) &&
-          !isOperandLiteral (*opp)) ||
-         isOperandVolatile (*opp, FALSE)
-       )
-       {
-         *opp = NULL;
-         return 0;
-       }
+           !isOperandLiteral (*opp)) ||
+          isOperandVolatile (*opp, FALSE)
+        )
+        {
+          *opp = NULL;
+          return 0;
+        }
 
       if (cop->key == (*opp)->key)
 
       if (cop->key == (*opp)->key)
-       {
-         *opp = NULL;
-         return 0;
-       }
+        {
+          *opp = NULL;
+          return 0;
+        }
 
       if ((*opp)->isaddr != cop->isaddr && IS_ITEMP (cop))
 
       if ((*opp)->isaddr != cop->isaddr && IS_ITEMP (cop))
-       {
-         *opp = operandFromOperand (*opp);
-         (*opp)->isaddr = cop->isaddr;
-       }
+        {
+          *opp = operandFromOperand (*opp);
+          (*opp)->isaddr = cop->isaddr;
+        }
 
       if (IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) &&
 
       if (IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) &&
-         SPEC_NOUN(operandType(cop)) != SPEC_NOUN(operandType(*opp)))
-       {
-           // special case: we can make an unsigned char literal
-           // into an int literal with no cost.
-           if (isOperandLiteral(*opp)
-            && SPEC_NOUN(operandType(*opp)) == V_CHAR
-            && SPEC_NOUN(operandType(cop)) == V_INT)
-           {
-               *opp = operandFromOperand (*opp);
-               SPEC_NOUN(operandType(*opp)) = V_INT;
-           }
-           else
-           {
-               // No clue...
-               *opp = NULL;
-               return 0;
-           }
+          SPEC_NOUN(operandType(cop)) != SPEC_NOUN(operandType(*opp)))
+        {
+            // special case: we can make an unsigned char literal
+            // into an int literal with no cost.
+            if (isOperandLiteral(*opp)
+             && SPEC_NOUN(operandType(*opp)) == V_CHAR
+             && SPEC_NOUN(operandType(cop)) == V_INT)
+            {
+                *opp = operandFromOperand (*opp);
+                SPEC_NOUN(operandType(*opp)) = V_INT;
+            }
+            else
+            {
+                // No clue...
+                *opp = NULL;
+                return 0;
+            }
 
         }
 
 
         }
 
@@ -518,7 +518,7 @@ DEFSETFUNC (ifAssignedFromGlobal)
 DEFSETFUNC (ifFromGlobal)
 {
   cseDef *cdp = item;
 DEFSETFUNC (ifFromGlobal)
 {
   cseDef *cdp = item;
-  
+
   return cdp->fromGlobal;
 }
 
   return cdp->fromGlobal;
 }
 
@@ -554,7 +554,7 @@ DEFSETFUNC (ifOperandsHave)
 
   if (bitVectBitValue(cdp->ancestors, op->key))
     return 1;
 
   if (bitVectBitValue(cdp->ancestors, op->key))
     return 1;
-  
+
   if (IC_LEFT (cdp->diCode) &&
       IS_SYMOP (IC_LEFT (cdp->diCode)) &&
       IC_LEFT (cdp->diCode)->key == op->key)
   if (IC_LEFT (cdp->diCode) &&
       IS_SYMOP (IC_LEFT (cdp->diCode)) &&
       IC_LEFT (cdp->diCode)->key == op->key)
@@ -597,7 +597,7 @@ ifDefSymIs (set * cseSet, operand * sym)
     {
       loop = sl->item;
       if (loop->sym->key == sym->key)
     {
       loop = sl->item;
       if (loop->sym->key == sym->key)
-       return 1;
+        return 1;
     }
   return 0;
 }
     }
   return 0;
 }
@@ -611,7 +611,7 @@ DEFSETFUNC (ifDefSymIsX)
   cseDef *cdp = item;
   V_ARG (operand *, op);
   int match;
   cseDef *cdp = item;
   V_ARG (operand *, op);
   int match;
-  
+
   if (op && cdp->sym)
     match = cdp->sym->key == op->key;
   else
   if (op && cdp->sym)
     match = cdp->sym->key == op->key;
   else
@@ -625,7 +625,7 @@ DEFSETFUNC (ifDefSymIsX)
 
 
 /*-----------------------------------------------------------------*/
 
 
 /*-----------------------------------------------------------------*/
-/* ifDiCodeIs - returns truw if diCode is same                     */
+/* ifDiCodeIs - returns true if diCode is same                     */
 /*-----------------------------------------------------------------*/
 int
 ifDiCodeIs (set * cseSet, iCode * ic)
 /*-----------------------------------------------------------------*/
 int
 ifDiCodeIs (set * cseSet, iCode * ic)
@@ -640,7 +640,7 @@ ifDiCodeIs (set * cseSet, iCode * ic)
     {
       loop = sl->item;
       if (loop->diCode == ic)
     {
       loop = sl->item;
       if (loop->diCode == ic)
-       return 1;
+        return 1;
     }
   return 0;
 
     }
   return 0;
 
@@ -697,8 +697,8 @@ iCode *findBackwardDef(operand *op,iCode *ic)
     iCode *lic;
 
     for (lic = ic; lic ; lic = lic->prev) {
     iCode *lic;
 
     for (lic = ic; lic ; lic = lic->prev) {
-       if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic)))
-           return lic;
+        if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic)))
+            return lic;
     }
     return NULL;
 }
     }
     return NULL;
 }
@@ -731,9 +731,9 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
     {
 
       IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
     {
 
       IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
-                                       IC_RIGHT (ic),
-                                       ic->op,
-                                       operandType (IC_RESULT (ic)));
+                                        IC_RIGHT (ic),
+                                        ic->op,
+                                        operandType (IC_RESULT (ic)));
       ic->op = '=';
       IC_LEFT (ic) = NULL;
       SET_RESULT_RIGHT (ic);
       ic->op = '=';
       IC_LEFT (ic) = NULL;
       SET_RESULT_RIGHT (ic);
@@ -748,9 +748,9 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
     {
 
       IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
     {
 
       IC_RIGHT (ic) = operandOperation (IC_LEFT (ic),
-                                       IC_RIGHT (ic),
-                                       ic->op,
-                                       operandType (IC_RESULT (ic)));
+                                        IC_RIGHT (ic),
+                                        ic->op,
+                                        operandType (IC_RESULT (ic)));
       ic->op = '=';
       IC_LEFT (ic) = NULL;
       SET_RESULT_RIGHT (ic);
       ic->op = '=';
       IC_LEFT (ic) = NULL;
       SET_RESULT_RIGHT (ic);
@@ -764,33 +764,33 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
     {
 
       if (IS_ITEMP (IC_RESULT (ic)) &&
     {
 
       if (IS_ITEMP (IC_RESULT (ic)) &&
-         IS_TRUE_SYMOP (IC_LEFT (ic)))
-       {
-
-         ic->op = '=';
-         IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
-         IC_RIGHT (ic)->isaddr = 0;
-         IC_LEFT (ic) = NULL;
-         IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
-         IC_RESULT (ic)->isaddr = 0;
-         setOperandType (IC_RESULT (ic), operandType (IC_RIGHT (ic)));
-         return;
-       }
+          IS_TRUE_SYMOP (IC_LEFT (ic)))
+        {
+
+          ic->op = '=';
+          IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
+          IC_RIGHT (ic)->isaddr = 0;
+          IC_LEFT (ic) = NULL;
+          IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
+          IC_RESULT (ic)->isaddr = 0;
+          setOperandType (IC_RESULT (ic), operandType (IC_RIGHT (ic)));
+          return;
+        }
 
       if (IS_ITEMP (IC_LEFT (ic)) &&
 
       if (IS_ITEMP (IC_LEFT (ic)) &&
-         IS_ITEMP (IC_RESULT (ic)) &&
+          IS_ITEMP (IC_RESULT (ic)) &&
 /*      !OP_SYMBOL(IC_RESULT(ic))->isreqv && */
 /*      !OP_SYMBOL(IC_LEFT(ic))->isreqv && */
 /*      !OP_SYMBOL(IC_RESULT(ic))->isreqv && */
 /*      !OP_SYMBOL(IC_LEFT(ic))->isreqv && */
-         !IC_LEFT (ic)->isaddr)
-       {
-         ic->op = '=';
-         IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
-         IC_RIGHT (ic)->isaddr = 0;
-         IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
-         IC_RESULT (ic)->isaddr = 0;
-         IC_LEFT (ic) = NULL;
-         return;
-       }
+          !IC_LEFT (ic)->isaddr)
+        {
+          ic->op = '=';
+          IC_RIGHT (ic) = operandFromOperand (IC_LEFT (ic));
+          IC_RIGHT (ic)->isaddr = 0;
+          IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
+          IC_RESULT (ic)->isaddr = 0;
+          IC_LEFT (ic) = NULL;
+          return;
+        }
 
     }
 
 
     }
 
@@ -801,88 +801,88 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
     case '+':
       /* if adding the same thing change to left shift by 1 */
       if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key &&
     case '+':
       /* if adding the same thing change to left shift by 1 */
       if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key &&
-         !IS_FLOAT (operandType (IC_RESULT (ic))))
-       {
-         ic->op = LEFT_OP;
-         IC_RIGHT (ic) = operandFromLit (1);
-         return;
-       }
+          !IS_FLOAT (operandType (IC_RESULT (ic))))
+        {
+          ic->op = LEFT_OP;
+          IC_RIGHT (ic) = operandFromLit (1);
+          return;
+        }
       /* if addition then check if one of them is a zero */
       /* if yes turn it into assignmnt or cast */
       if (IS_OP_LITERAL (IC_LEFT (ic)) &&
       /* if addition then check if one of them is a zero */
       /* if yes turn it into assignmnt or cast */
       if (IS_OP_LITERAL (IC_LEFT (ic)) &&
-         operandLitValue (IC_LEFT (ic)) == 0.0)
-       {
-         if (compareType (operandType (IC_RESULT (ic)),
-                          operandType (IC_RIGHT (ic)))<0)
-           {
-             ic->op = CAST;
-             IC_LEFT (ic) = operandFromLink (operandType (IC_RESULT (ic)));
-           }
-         else
+          operandLitValue (IC_LEFT (ic)) == 0.0)
+        {
+          if (compareType (operandType (IC_RESULT (ic)),
+                           operandType (IC_RIGHT (ic)))<0)
+            {
+              ic->op = CAST;
+              IC_LEFT (ic) = operandFromLink (operandType (IC_RESULT (ic)));
+            }
+          else
             {
             {
-             ic->op = '=';
-             IC_LEFT (ic) = NULL;
+              ic->op = '=';
+              IC_LEFT (ic) = NULL;
             }
             }
-         SET_ISADDR (IC_RESULT (ic), 0);
-         SET_ISADDR (IC_RIGHT (ic), 0);
-         return;
-       }
+          SET_ISADDR (IC_RESULT (ic), 0);
+          SET_ISADDR (IC_RIGHT (ic), 0);
+          return;
+        }
       if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
       if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
-         operandLitValue (IC_RIGHT (ic)) == 0.0)
-       {
-         if (compareType (operandType (IC_RESULT (ic)),
-                          operandType (IC_LEFT (ic)))<0)
-           {
-             ic->op = CAST;
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = operandFromLink (operandType (IC_RESULT (ic)));
-           }
-         else
+          operandLitValue (IC_RIGHT (ic)) == 0.0)
+        {
+          if (compareType (operandType (IC_RESULT (ic)),
+                           operandType (IC_LEFT (ic)))<0)
             {
             {
-             ic->op = '=';
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = NULL;
+              ic->op = CAST;
+              IC_RIGHT (ic) = IC_LEFT (ic);
+              IC_LEFT (ic) = operandFromLink (operandType (IC_RESULT (ic)));
             }
             }
-         SET_ISADDR (IC_RIGHT (ic), 0);
-         SET_ISADDR (IC_RESULT (ic), 0);
-         return;
-       }
+          else
+            {
+              ic->op = '=';
+              IC_RIGHT (ic) = IC_LEFT (ic);
+              IC_LEFT (ic) = NULL;
+            }
+          SET_ISADDR (IC_RIGHT (ic), 0);
+          SET_ISADDR (IC_RESULT (ic), 0);
+          return;
+        }
       break;
     case '-':
       /* if subtracting the the same thing then zero     */
       if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
       break;
     case '-':
       /* if subtracting the the same thing then zero     */
       if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
-       {
-         ic->op = '=';
-         IC_RIGHT (ic) = operandFromLit (0);
-         IC_LEFT (ic) = NULL;
-         IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
-         IC_RESULT (ic)->isaddr = 0;
-         return;
-       }
+        {
+          ic->op = '=';
+          IC_RIGHT (ic) = operandFromLit (0);
+          IC_LEFT (ic) = NULL;
+          IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
+          IC_RESULT (ic)->isaddr = 0;
+          return;
+        }
 
       /* if subtraction then check if one of the operand */
       /* is zero then depending on which operand change  */
       /* to assignment or unary minus                    */
       if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
 
       /* if subtraction then check if one of the operand */
       /* is zero then depending on which operand change  */
       /* to assignment or unary minus                    */
       if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
-         operandLitValue (IC_RIGHT (ic)) == 0.0)
-       {
-         /* right size zero change to assignment */
-         ic->op = '=';
-         IC_RIGHT (ic) = IC_LEFT (ic);
-         IC_LEFT (ic) = NULL;
-         SET_ISADDR (IC_RIGHT (ic), 0);
-         SET_ISADDR (IC_RESULT (ic), 0);
-         return;
-       }
+          operandLitValue (IC_RIGHT (ic)) == 0.0)
+        {
+          /* right size zero change to assignment */
+          ic->op = '=';
+          IC_RIGHT (ic) = IC_LEFT (ic);
+          IC_LEFT (ic) = NULL;
+          SET_ISADDR (IC_RIGHT (ic), 0);
+          SET_ISADDR (IC_RESULT (ic), 0);
+          return;
+        }
       if (IS_OP_LITERAL (IC_LEFT (ic)) &&
       if (IS_OP_LITERAL (IC_LEFT (ic)) &&
-         operandLitValue (IC_LEFT (ic)) == 0.0)
-       {
-         /* left zero turn into an unary minus */
-         ic->op = UNARYMINUS;
-         IC_LEFT (ic) = IC_RIGHT (ic);
-         IC_RIGHT (ic) = NULL;
-         return;
-       }
+          operandLitValue (IC_LEFT (ic)) == 0.0)
+        {
+          /* left zero turn into an unary minus */
+          ic->op = UNARYMINUS;
+          IC_LEFT (ic) = IC_RIGHT (ic);
+          IC_RIGHT (ic) = NULL;
+          return;
+        }
       break;
       /* if multiplication then check if either of */
       /* them is zero then the result is zero      */
       break;
       /* if multiplication then check if either of */
       /* them is zero then the result is zero      */
@@ -890,158 +890,158 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
       /* the other one                             */
     case '*':
       if (IS_OP_LITERAL (IC_LEFT (ic)))
       /* the other one                             */
     case '*':
       if (IS_OP_LITERAL (IC_LEFT (ic)))
-       {
-
-         if (operandLitValue (IC_LEFT (ic)) == 0.0)
-           {
-             ic->op = '=';
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
-           }
-         if (operandLitValue (IC_LEFT (ic)) == 1.0)
-           {
-             /* '*' can have two unsigned chars as operands */
-             /* and an unsigned int as result.              */
-             if (compareType (operandType (IC_RESULT (ic)),
-                              operandType (IC_RIGHT (ic))) == 1)
-               {
-                 ic->op = '=';
-                 IC_LEFT (ic) = NULL;
-                 SET_RESULT_RIGHT (ic);
-               }
-             else
-               {
-                 ic->op = CAST;
-                 IC_LEFT (ic) = operandFromOperand (IC_LEFT (ic));
-                 IC_LEFT (ic)->type = TYPE;
-                 IC_LEFT (ic)->isLiteral = 0;
-                 setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
-               }
-             return;
-           }
-       }
+        {
+
+          if (operandLitValue (IC_LEFT (ic)) == 0.0)
+            {
+              ic->op = '=';
+              IC_RIGHT (ic) = IC_LEFT (ic);
+              IC_LEFT (ic) = NULL;
+              SET_RESULT_RIGHT (ic);
+              return;
+            }
+          if (operandLitValue (IC_LEFT (ic)) == 1.0)
+            {
+              /* '*' can have two unsigned chars as operands */
+              /* and an unsigned int as result.              */
+              if (compareType (operandType (IC_RESULT (ic)),
+                               operandType (IC_RIGHT (ic))) == 1)
+                {
+                  ic->op = '=';
+                  IC_LEFT (ic) = NULL;
+                  SET_RESULT_RIGHT (ic);
+                }
+              else
+                {
+                  ic->op = CAST;
+                  IC_LEFT (ic) = operandFromOperand (IC_LEFT (ic));
+                  IC_LEFT (ic)->type = TYPE;
+                  IC_LEFT (ic)->isLiteral = 0;
+                  setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
+                }
+              return;
+            }
+        }
 
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
 
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
-       {
-
-         if (operandLitValue (IC_RIGHT (ic)) == 0.0)
-           {
-             ic->op = '=';
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
-           }
-
-         if (operandLitValue (IC_RIGHT (ic)) == 1.0)
-           {
-             /* '*' can have two unsigned chars as operands */
-             /* and an unsigned int as result.              */
-             if (compareType (operandType (IC_RESULT (ic)),
-                              operandType (IC_LEFT (ic))) == 1)
-               {
-                 ic->op = '=';
-                 IC_RIGHT (ic) = IC_LEFT (ic);
-                 IC_LEFT (ic) = NULL;
-                 SET_RESULT_RIGHT (ic);
-               }
-             else
-               {
+        {
+
+          if (operandLitValue (IC_RIGHT (ic)) == 0.0)
+            {
+              ic->op = '=';
+              IC_LEFT (ic) = NULL;
+              SET_RESULT_RIGHT (ic);
+              return;
+            }
+
+          if (operandLitValue (IC_RIGHT (ic)) == 1.0)
+            {
+              /* '*' can have two unsigned chars as operands */
+              /* and an unsigned int as result.              */
+              if (compareType (operandType (IC_RESULT (ic)),
+                               operandType (IC_LEFT (ic))) == 1)
+                {
+                  ic->op = '=';
+                  IC_RIGHT (ic) = IC_LEFT (ic);
+                  IC_LEFT (ic) = NULL;
+                  SET_RESULT_RIGHT (ic);
+                }
+              else
+                {
                   operand *op;
 
                   operand *op;
 
-                 ic->op = CAST;
-                 op = IC_RIGHT (ic);
-                 IC_RIGHT (ic) = IC_LEFT (ic);
-                 IC_LEFT (ic) = operandFromOperand (op);
-                 IC_LEFT (ic)->type = TYPE;
-                 IC_LEFT (ic)->isLiteral = 0;
-                 setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
-               }
-             return;
-           }
-       }
+                  ic->op = CAST;
+                  op = IC_RIGHT (ic);
+                  IC_RIGHT (ic) = IC_LEFT (ic);
+                  IC_LEFT (ic) = operandFromOperand (op);
+                  IC_LEFT (ic)->type = TYPE;
+                  IC_LEFT (ic)->isLiteral = 0;
+                  setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
+                }
+              return;
+            }
+        }
       break;
     case '/':
       /* if division by self then 1 */
       if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
       break;
     case '/':
       /* if division by self then 1 */
       if (IC_LEFT (ic)->key == IC_RIGHT (ic)->key)
-       {
-         ic->op = '=';
-         IC_RIGHT (ic) = operandFromLit (1);
-         IC_LEFT (ic) = NULL;
-         IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
-         IC_RESULT (ic)->isaddr = 0;
-         break;
-       }
+        {
+          ic->op = '=';
+          IC_RIGHT (ic) = operandFromLit (1);
+          IC_LEFT (ic) = NULL;
+          IC_RESULT (ic) = operandFromOperand (IC_RESULT (ic));
+          IC_RESULT (ic)->isaddr = 0;
+          break;
+        }
       /* if this is a division then check if right */
       /* is one then change it to an assignment    */
       if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
       /* if this is a division then check if right */
       /* is one then change it to an assignment    */
       if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
-         operandLitValue (IC_RIGHT (ic)) == 1.0)
-       {
-
-         ic->op = '=';
-         IC_RIGHT (ic) = IC_LEFT (ic);
-         IC_LEFT (ic) = NULL;
-         SET_RESULT_RIGHT (ic);
-         return;
-       }
+          operandLitValue (IC_RIGHT (ic)) == 1.0)
+        {
+
+          ic->op = '=';
+          IC_RIGHT (ic) = IC_LEFT (ic);
+          IC_LEFT (ic) = NULL;
+          SET_RESULT_RIGHT (ic);
+          return;
+        }
       break;
       /* if both are the same for an comparison operators */
     case EQ_OP:
     case LE_OP:
     case GE_OP:
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
       break;
       /* if both are the same for an comparison operators */
     case EQ_OP:
     case LE_OP:
     case GE_OP:
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
-       {
-         ic->op = '=';
-         IC_RIGHT (ic) = operandFromLit (1);
-         IC_LEFT (ic) = NULL;
-         SET_RESULT_RIGHT (ic);
-       }
+        {
+          ic->op = '=';
+          IC_RIGHT (ic) = operandFromLit (1);
+          IC_LEFT (ic) = NULL;
+          SET_RESULT_RIGHT (ic);
+        }
       break;
     case NE_OP:
     case '>':
     case '<':
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
       break;
     case NE_OP:
     case '>':
     case '<':
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
-       {
-         ic->op = '=';
-         IC_RIGHT (ic) = operandFromLit (0);
-         IC_LEFT (ic) = NULL;
-         SET_RESULT_RIGHT (ic);
-       }
+        {
+          ic->op = '=';
+          IC_RIGHT (ic) = operandFromLit (0);
+          IC_LEFT (ic) = NULL;
+          SET_RESULT_RIGHT (ic);
+        }
       break;
     case CAST:
       break;
     case CAST:
-           {
-                   sym_link *otype = operandType(IC_RIGHT(ic));
-                   sym_link *ctype = operandType(IC_LEFT(ic));
-                   /* if this is a cast of a literal value */
-                   if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
-                       !(IS_GENPTR(ctype) && (IS_PTR(otype) && !IS_GENPTR(otype)))) {
-                           ic->op = '=';
-                           IC_RIGHT (ic) =
-                                   operandFromValue (valCastLiteral (operandType (IC_LEFT (ic)),
-                                                                     operandLitValue (IC_RIGHT (ic))));
-                           IC_LEFT (ic) = NULL;
-                           SET_ISADDR (IC_RESULT (ic), 0);
-                   }
-                   /* if casting to the same */
-                   if (compareType (operandType (IC_RESULT (ic)),
-                                    operandType (IC_RIGHT (ic))) == 1) {
-                           ic->op = '=';
-                           IC_LEFT (ic) = NULL;
-                           SET_ISADDR (IC_RESULT (ic), 0);
-                   }
-           }
-           break;
+            {
+                    sym_link *otype = operandType(IC_RIGHT(ic));
+                    sym_link *ctype = operandType(IC_LEFT(ic));
+                    /* if this is a cast of a literal value */
+                    if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
+                        !(IS_GENPTR(ctype) && (IS_PTR(otype) && !IS_GENPTR(otype)))) {
+                            ic->op = '=';
+                            IC_RIGHT (ic) =
+                                    operandFromValue (valCastLiteral (operandType (IC_LEFT (ic)),
+                                                                      operandLitValue (IC_RIGHT (ic))));
+                            IC_LEFT (ic) = NULL;
+                            SET_ISADDR (IC_RESULT (ic), 0);
+                    }
+                    /* if casting to the same */
+                    if (compareType (operandType (IC_RESULT (ic)),
+                                     operandType (IC_RIGHT (ic))) == 1) {
+                            ic->op = '=';
+                            IC_LEFT (ic) = NULL;
+                            SET_ISADDR (IC_RESULT (ic), 0);
+                    }
+            }
+            break;
     case '!':
       if (IS_OP_LITERAL (IC_LEFT (ic)))
     case '!':
       if (IS_OP_LITERAL (IC_LEFT (ic)))
-       {
-         ic->op = '=';
-         IC_RIGHT (ic) =
-           (operandLitValue (IC_LEFT (ic)) == 0 ?
-            operandFromLit (1) : operandFromLit (0));
-         IC_LEFT (ic) = NULL;
-         SET_ISADDR (IC_RESULT (ic), 0);
-       }
+        {
+          ic->op = '=';
+          IC_RIGHT (ic) =
+            (operandLitValue (IC_LEFT (ic)) == 0 ?
+             operandFromLit (1) : operandFromLit (0));
+          IC_LEFT (ic) = NULL;
+          SET_ISADDR (IC_RESULT (ic), 0);
+        }
       break;
     case BITWISEAND:
       /* if both operands are equal */
       break;
     case BITWISEAND:
       /* if both operands are equal */
@@ -1049,73 +1049,73 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
         {
           if (IS_OP_VOLATILE (IC_LEFT (ic)))
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
         {
           if (IS_OP_VOLATILE (IC_LEFT (ic)))
-           {
-             iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
-             IC_RESULT (newic) = IC_LEFT (ic);
-             newic->lineno = ic->lineno;
-             addiCodeToeBBlock (ebp, newic, ic->next);
-           }
-         ic->op = '=';
-         IC_LEFT (ic) = NULL;
-         SET_RESULT_RIGHT (ic);
-         return;
-       }
+            {
+              iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
+              IC_RESULT (newic) = IC_LEFT (ic);
+              newic->lineno = ic->lineno;
+              addiCodeToeBBlock (ebp, newic, ic->next);
+            }
+          ic->op = '=';
+          IC_LEFT (ic) = NULL;
+          SET_RESULT_RIGHT (ic);
+          return;
+        }
       /* swap literal to right ic */
       if (IS_OP_LITERAL (IC_LEFT (ic)))
         {
       /* swap literal to right ic */
       if (IS_OP_LITERAL (IC_LEFT (ic)))
         {
-         operand *op;
+          operand *op;
 
 
-         op = IC_LEFT (ic);
-         IC_LEFT (ic) = IC_RIGHT (ic);
-         IC_RIGHT (ic) = op;
-       }
+          op = IC_LEFT (ic);
+          IC_LEFT (ic) = IC_RIGHT (ic);
+          IC_RIGHT (ic) = op;
+        }
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
         {
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
         {
-         /* if BITWISEAND then check if one of them is a zero */
-         /* if yes turn it into 0 assignment */
-         if (operandLitValue (IC_RIGHT (ic)) == 0.0)
-           {
-             if (IS_OP_VOLATILE (IC_LEFT (ic)))
-               {
-                 iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
-                 IC_RESULT (newic) = IC_LEFT (ic);
-                 newic->lineno = ic->lineno;
-                 addiCodeToeBBlock (ebp, newic, ic->next);
-               }
-             ic->op = '=';
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
-           }
-         /* if BITWISEAND then check if one of them is 0xff... */
-         /* if yes turn it into assignment */
-         {
-           unsigned val;
-
-           switch (getSize (operandType (IC_RIGHT (ic))))
-             {
-             case 1:
-               val = 0xff;
-               break;
-             case 2:
-               val = 0xffff;
-               break;
-             case 4:
-               val = 0xffffffff;
-               break;
-             default:
-               return;
-             }
-           if (((unsigned) operandLitValue (IC_RIGHT (ic)) & val) == val)
-           {
-             ic->op = '=';
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
-           }
-         }
-       }
+          /* if BITWISEAND then check if one of them is a zero */
+          /* if yes turn it into 0 assignment */
+          if (operandLitValue (IC_RIGHT (ic)) == 0.0)
+            {
+              if (IS_OP_VOLATILE (IC_LEFT (ic)))
+                {
+                  iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
+                  IC_RESULT (newic) = IC_LEFT (ic);
+                  newic->lineno = ic->lineno;
+                  addiCodeToeBBlock (ebp, newic, ic->next);
+                }
+              ic->op = '=';
+              IC_LEFT (ic) = NULL;
+              SET_RESULT_RIGHT (ic);
+              return;
+            }
+          /* if BITWISEAND then check if one of them is 0xff... */
+          /* if yes turn it into assignment */
+          {
+            unsigned val;
+
+            switch (getSize (operandType (IC_RIGHT (ic))))
+              {
+              case 1:
+                val = 0xff;
+                break;
+              case 2:
+                val = 0xffff;
+                break;
+              case 4:
+                val = 0xffffffff;
+                break;
+              default:
+                return;
+              }
+            if (((unsigned) operandLitValue (IC_RIGHT (ic)) & val) == val)
+            {
+              ic->op = '=';
+              IC_RIGHT (ic) = IC_LEFT (ic);
+              IC_LEFT (ic) = NULL;
+              SET_RESULT_RIGHT (ic);
+              return;
+            }
+          }
+        }
       break;
     case '|':
       /* if both operands are equal */
       break;
     case '|':
       /* if both operands are equal */
@@ -1123,73 +1123,73 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
         {
           if (IS_OP_VOLATILE (IC_LEFT (ic)))
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
         {
           if (IS_OP_VOLATILE (IC_LEFT (ic)))
-           {
-             iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
-             IC_RESULT (newic) = IC_LEFT (ic);
-             newic->lineno = ic->lineno;
-             addiCodeToeBBlock (ebp, newic, ic->next);
-           }
-           ic->op = '=';
-           IC_LEFT (ic) = NULL;
-           SET_RESULT_RIGHT (ic);
-           return;
-       }
+            {
+              iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
+              IC_RESULT (newic) = IC_LEFT (ic);
+              newic->lineno = ic->lineno;
+              addiCodeToeBBlock (ebp, newic, ic->next);
+            }
+            ic->op = '=';
+            IC_LEFT (ic) = NULL;
+            SET_RESULT_RIGHT (ic);
+            return;
+        }
       /* swap literal to right ic */
       if (IS_OP_LITERAL (IC_LEFT (ic)))
         {
       /* swap literal to right ic */
       if (IS_OP_LITERAL (IC_LEFT (ic)))
         {
-         operand *op;
+          operand *op;
 
 
-         op = IC_LEFT (ic);
-         IC_LEFT (ic) = IC_RIGHT (ic);
-         IC_RIGHT (ic) = op;
-       }
+          op = IC_LEFT (ic);
+          IC_LEFT (ic) = IC_RIGHT (ic);
+          IC_RIGHT (ic) = op;
+        }
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
         {
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
         {
-         /* if BITWISEOR then check if one of them is a zero */
-         /* if yes turn it into assignment */
-         if (operandLitValue (IC_RIGHT (ic)) == 0.0)
-           {
-             ic->op = '=';
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
-           }
-         /* if BITWISEOR then check if one of them is 0xff... */
-         /* if yes turn it into 0xff... assignment */
-         {
-           unsigned val;
-
-           switch (getSize (operandType (IC_RIGHT (ic))))
-             {
-             case 1:
-               val = 0xff;
-               break;
-             case 2:
-               val = 0xffff;
-               break;
-             case 4:
-               val = 0xffffffff;
-               break;
-             default:
-               return;
-             }
-           if (((unsigned) operandLitValue (IC_RIGHT (ic)) & val) == val)
-             {
-               if (IS_OP_VOLATILE (IC_LEFT (ic)))
-               {
-                 iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
-                 IC_RESULT (newic) = IC_LEFT (ic);
-                 newic->lineno = ic->lineno;
-                 addiCodeToeBBlock (ebp, newic, ic->next);
-               }
-               ic->op = '=';
-               IC_LEFT (ic) = NULL;
-               SET_RESULT_RIGHT (ic);
-               return;
-             }
-         }
-       }
+          /* if BITWISEOR then check if one of them is a zero */
+          /* if yes turn it into assignment */
+          if (operandLitValue (IC_RIGHT (ic)) == 0.0)
+            {
+              ic->op = '=';
+              IC_RIGHT (ic) = IC_LEFT (ic);
+              IC_LEFT (ic) = NULL;
+              SET_RESULT_RIGHT (ic);
+              return;
+            }
+          /* if BITWISEOR then check if one of them is 0xff... */
+          /* if yes turn it into 0xff... assignment */
+          {
+            unsigned val;
+
+            switch (getSize (operandType (IC_RIGHT (ic))))
+              {
+              case 1:
+                val = 0xff;
+                break;
+              case 2:
+                val = 0xffff;
+                break;
+              case 4:
+                val = 0xffffffff;
+                break;
+              default:
+                return;
+              }
+            if (((unsigned) operandLitValue (IC_RIGHT (ic)) & val) == val)
+              {
+                if (IS_OP_VOLATILE (IC_LEFT (ic)))
+                {
+                  iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
+                  IC_RESULT (newic) = IC_LEFT (ic);
+                  newic->lineno = ic->lineno;
+                  addiCodeToeBBlock (ebp, newic, ic->next);
+                }
+                ic->op = '=';
+                IC_LEFT (ic) = NULL;
+                SET_RESULT_RIGHT (ic);
+                return;
+              }
+          }
+        }
       break;
     case '^':
       /* if both operands are equal */
       break;
     case '^':
       /* if both operands are equal */
@@ -1197,45 +1197,45 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
         {
           if (IS_OP_VOLATILE (IC_LEFT (ic)))
       if (isOperandEqual (IC_LEFT (ic), IC_RIGHT (ic)))
         {
           if (IS_OP_VOLATILE (IC_LEFT (ic)))
-           {
-             iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
-             IC_RESULT (newic) = IC_LEFT (ic);
-             newic->lineno = ic->lineno;
-             addiCodeToeBBlock (ebp, newic, ic->next);
-
-             newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
-             IC_RESULT (newic) = IC_LEFT (ic);
-             newic->lineno = ic->lineno;
-             addiCodeToeBBlock (ebp, newic, ic->next);
-           }
-           ic->op = '=';
-           IC_RIGHT (ic) = operandFromLit (0);
-           IC_LEFT (ic) = NULL;
-           SET_RESULT_RIGHT (ic);
-           return;
-       }
+            {
+              iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
+              IC_RESULT (newic) = IC_LEFT (ic);
+              newic->lineno = ic->lineno;
+              addiCodeToeBBlock (ebp, newic, ic->next);
+
+              newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
+              IC_RESULT (newic) = IC_LEFT (ic);
+              newic->lineno = ic->lineno;
+              addiCodeToeBBlock (ebp, newic, ic->next);
+            }
+            ic->op = '=';
+            IC_RIGHT (ic) = operandFromLit (0);
+            IC_LEFT (ic) = NULL;
+            SET_RESULT_RIGHT (ic);
+            return;
+        }
       /* swap literal to right ic */
       if (IS_OP_LITERAL (IC_LEFT (ic)))
         {
       /* swap literal to right ic */
       if (IS_OP_LITERAL (IC_LEFT (ic)))
         {
-         operand *op;
+          operand *op;
 
 
-         op = IC_LEFT (ic);
-         IC_LEFT (ic) = IC_RIGHT (ic);
-         IC_RIGHT (ic) = op;
-       }
+          op = IC_LEFT (ic);
+          IC_LEFT (ic) = IC_RIGHT (ic);
+          IC_RIGHT (ic) = op;
+        }
       /* if XOR then check if one of them is a zero */
       /* if yes turn it into assignment */
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
       /* if XOR then check if one of them is a zero */
       /* if yes turn it into assignment */
       if (IS_OP_LITERAL (IC_RIGHT (ic)))
-       {
-         if (operandLitValue (IC_RIGHT (ic)) == 0.0)
-           {
-             ic->op = '=';
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
-           }
-       }
+        {
+          if (operandLitValue (IC_RIGHT (ic)) == 0.0)
+            {
+              ic->op = '=';
+              IC_RIGHT (ic) = IC_LEFT (ic);
+              IC_LEFT (ic) = NULL;
+              SET_RESULT_RIGHT (ic);
+              return;
+            }
+        }
       break;
     }
 
       break;
     }
 
@@ -1248,79 +1248,79 @@ algebraicOpts (iCode * ic, eBBlock * ebp)
 void
 updateSpillLocation (iCode * ic, int induction)
 {
 void
 updateSpillLocation (iCode * ic, int induction)
 {
-       sym_link *setype;
+        sym_link *setype;
 
 
-       if (POINTER_SET (ic))
-               return;
+        if (POINTER_SET (ic))
+                return;
 
 
-       if (ic->nosupdate)
-               return;
+        if (ic->nosupdate)
+                return;
 
 #if 0
 
 #if 0
-       /* for the form true_symbol := iTempNN */
-       if (ASSIGN_ITEMP_TO_SYM (ic) && 
-           !SPIL_LOC (IC_RIGHT (ic))) {
-
-               setype = getSpec (operandType (IC_RESULT (ic)));
-
-               if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
-                   !IS_VOLATILE (setype) &&
-                   !IN_FARSPACE (SPEC_OCLS (setype)) &&
-                   !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
-               {
-                   wassert(IS_SYMOP(IC_RESULT (ic)));
-                   wassert(IS_SYMOP(IC_RIGHT (ic)));
-                       SPIL_LOC (IC_RIGHT (ic)) =
-                               IC_RESULT (ic)->operand.symOperand;
-               }
-           
-       }
+        /* for the form true_symbol := iTempNN */
+        if (ASSIGN_ITEMP_TO_SYM (ic) &&
+            !SPIL_LOC (IC_RIGHT (ic))) {
+
+                setype = getSpec (operandType (IC_RESULT (ic)));
+
+                if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
+                    !IS_VOLATILE (setype) &&
+                    !IN_FARSPACE (SPEC_OCLS (setype)) &&
+                    !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))))
+                {
+                    wassert(IS_SYMOP(IC_RESULT (ic)));
+                    wassert(IS_SYMOP(IC_RIGHT (ic)));
+                        SPIL_LOC (IC_RIGHT (ic)) =
+                                IC_RESULT (ic)->operand.symOperand;
+                }
+
+        }
 #endif
 
 #if 0 /* this needs furthur investigation can save a lot of code */
 #endif
 
 #if 0 /* this needs furthur investigation can save a lot of code */
-       if (ASSIGN_SYM_TO_ITEMP(ic) &&
-           !SPIL_LOC(IC_RESULT(ic))) {
-           if (!OTHERS_PARM (OP_SYMBOL (IC_RIGHT (ic))))
-               SPIL_LOC (IC_RESULT (ic)) =
-                   IC_RIGHT (ic)->operand.symOperand;
-       }
+        if (ASSIGN_SYM_TO_ITEMP(ic) &&
+            !SPIL_LOC(IC_RESULT(ic))) {
+            if (!OTHERS_PARM (OP_SYMBOL (IC_RIGHT (ic))))
+                SPIL_LOC (IC_RESULT (ic)) =
+                    IC_RIGHT (ic)->operand.symOperand;
+        }
 #endif
 #endif
-       if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
-         
-               if (!SPIL_LOC (IC_RIGHT (ic)) &&
-                   !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) &&
-                   OP_SYMBOL (IC_RESULT (ic))->isreqv) {
-
-                       setype = getSpec (operandType (IC_RESULT (ic)));
-             
-                       if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
-                           !IS_VOLATILE (setype) &&
-                           !IN_FARSPACE (SPEC_OCLS (setype)) &&
-                           !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) {
-
-                               SPIL_LOC (IC_RIGHT (ic)) =
-                                       SPIL_LOC (IC_RESULT (ic));
-                               OP_SYMBOL (IC_RIGHT (ic))->prereqv =
-                                       OP_SYMBOL (IC_RESULT (ic))->prereqv;
-                       }
-               }
-               /* special case for inductions */
-               if (induction && 
-                   OP_SYMBOL(IC_RIGHT(ic))->isreqv && 
-                   !OP_SYMBOL(IC_RESULT (ic))->noSpilLoc &&
-                   !SPIL_LOC(IC_RESULT(ic))) {
-                       SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
-                       OP_SYMBOL (IC_RESULT (ic))->prereqv =
-                               OP_SYMBOL (IC_RIGHT (ic))->prereqv;
-               }
-       }
+        if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
+
+                if (!SPIL_LOC (IC_RIGHT (ic)) &&
+                    !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) &&
+                    OP_SYMBOL (IC_RESULT (ic))->isreqv) {
+
+                        setype = getSpec (operandType (IC_RESULT (ic)));
+
+                        if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
+                            !IS_VOLATILE (setype) &&
+                            !IN_FARSPACE (SPEC_OCLS (setype)) &&
+                            !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) {
+
+                                SPIL_LOC (IC_RIGHT (ic)) =
+                                        SPIL_LOC (IC_RESULT (ic));
+                                OP_SYMBOL (IC_RIGHT (ic))->prereqv =
+                                        OP_SYMBOL (IC_RESULT (ic))->prereqv;
+                        }
+                }
+                /* special case for inductions */
+                if (induction &&
+                    OP_SYMBOL(IC_RIGHT(ic))->isreqv &&
+                    !OP_SYMBOL(IC_RESULT (ic))->noSpilLoc &&
+                    !SPIL_LOC(IC_RESULT(ic))) {
+                        SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic));
+                        OP_SYMBOL (IC_RESULT (ic))->prereqv =
+                                OP_SYMBOL (IC_RIGHT (ic))->prereqv;
+                }
+        }
 }
 /*-----------------------------------------------------------------*/
 /* setUsesDef - sets the uses def bitvector for a given operand    */
 /*-----------------------------------------------------------------*/
 }
 /*-----------------------------------------------------------------*/
 /* setUsesDef - sets the uses def bitvector for a given operand    */
 /*-----------------------------------------------------------------*/
-void 
+void
 setUsesDefs (operand * op, bitVect * bdefs,
 setUsesDefs (operand * op, bitVect * bdefs,
-            bitVect * idefs, bitVect ** oud)
+             bitVect * idefs, bitVect ** oud)
 {
   /* compute the definitions alive at this point */
   bitVect *adefs = bitVectUnion (bdefs, idefs);
 {
   /* compute the definitions alive at this point */
   bitVect *adefs = bitVectUnion (bdefs, idefs);
@@ -1339,7 +1339,7 @@ setUsesDefs (operand * op, bitVect * bdefs,
 /*-----------------------------------------------------------------*/
 /* unsetDefsAndUses - clear this operation for the operands        */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* unsetDefsAndUses - clear this operation for the operands        */
 /*-----------------------------------------------------------------*/
-void 
+void
 unsetDefsAndUses (iCode * ic)
 {
   if (ic->op == JUMPTABLE)
 unsetDefsAndUses (iCode * ic)
 {
   if (ic->op == JUMPTABLE)
@@ -1351,18 +1351,18 @@ unsetDefsAndUses (iCode * ic)
     {
       /* turn off def set */
       if (IS_SYMOP (IC_RESULT (ic)))
     {
       /* turn off def set */
       if (IS_SYMOP (IC_RESULT (ic)))
-       {
-         if (!POINTER_SET (ic))
-           bitVectUnSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
-         else
-           bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
-       }
+        {
+          if (!POINTER_SET (ic))
+            bitVectUnSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
+          else
+            bitVectUnSetBit (OP_USES (IC_RESULT (ic)), ic->key);
+        }
       /* turn off the useSet for the operands */
       if (IS_SYMOP (IC_LEFT (ic)))
       /* turn off the useSet for the operands */
       if (IS_SYMOP (IC_LEFT (ic)))
-       bitVectUnSetBit (OP_USES (IC_LEFT (ic)), ic->key);
+        bitVectUnSetBit (OP_USES (IC_LEFT (ic)), ic->key);
 
       if (IS_SYMOP (IC_RIGHT (ic)))
 
       if (IS_SYMOP (IC_RIGHT (ic)))
-       bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
+        bitVectUnSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
     }
   else
     /* must be ifx turn off the use */ if (IS_SYMOP (IC_COND (ic)))
     }
   else
     /* must be ifx turn off the use */ if (IS_SYMOP (IC_COND (ic)))
@@ -1372,11 +1372,11 @@ unsetDefsAndUses (iCode * ic)
 /*-----------------------------------------------------------------*/
 /* ifxOptimize - changes ifx conditions if it can                  */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* ifxOptimize - changes ifx conditions if it can                  */
 /*-----------------------------------------------------------------*/
-void 
+void
 ifxOptimize (iCode * ic, set * cseSet,
 ifxOptimize (iCode * ic, set * cseSet,
-            int computeOnly,
-            eBBlock * ebb, int *change,
-            eBBlock ** ebbs, int count)
+             int computeOnly,
+             eBBlock * ebb, int *change,
+             eBBlock ** ebbs, int count)
 {
   operand *pdop;
   symbol *label;
 {
   operand *pdop;
   symbol *label;
@@ -1387,10 +1387,10 @@ ifxOptimize (iCode * ic, set * cseSet,
       pdop = NULL;
       applyToSetFTrue (cseSet, findCheaperOp, IC_COND (ic), &pdop, 0);
       if (pdop)
       pdop = NULL;
       applyToSetFTrue (cseSet, findCheaperOp, IC_COND (ic), &pdop, 0);
       if (pdop)
-       {
-         ReplaceOpWithCheaperOp(&IC_COND (ic), pdop);
-         (*change)++;
-       }
+        {
+          ReplaceOpWithCheaperOp(&IC_COND (ic), pdop);
+          (*change)++;
+        }
     }
 
   /* if the conditional is a literal then */
     }
 
   /* if the conditional is a literal then */
@@ -1398,30 +1398,30 @@ ifxOptimize (iCode * ic, set * cseSet,
     {
 
       if ((operandLitValue (IC_COND (ic)) != 0.0) && IC_TRUE (ic))
     {
 
       if ((operandLitValue (IC_COND (ic)) != 0.0) && IC_TRUE (ic))
-       {
+        {
 
 
-         /* change to a goto */
-         ic->op = GOTO;
-         IC_LABEL (ic) = IC_TRUE (ic);
-         (*change)++;
+          /* change to a goto */
+          ic->op = GOTO;
+          IC_LABEL (ic) = IC_TRUE (ic);
+          (*change)++;
 
 
-       }
+        }
       else
       else
-       {
-
-         if (!operandLitValue (IC_COND (ic)) && IC_FALSE (ic))
-           {
-             ic->op = GOTO;
-             IC_LABEL (ic) = IC_FALSE (ic);
-             (*change)++;
-
-           }
-         else
-           {
-             /* then kill this if condition */
-             remiCodeFromeBBlock (ebb, ic);
-           }
-       }
+        {
+
+          if (!operandLitValue (IC_COND (ic)) && IC_FALSE (ic))
+            {
+              ic->op = GOTO;
+              IC_LABEL (ic) = IC_FALSE (ic);
+              (*change)++;
+
+            }
+          else
+            {
+              /* then kill this if condition */
+              remiCodeFromeBBlock (ebb, ic);
+            }
+        }
 
       /* now we need to recompute the control flow */
       /* since the control flow has changed        */
 
       /* now we need to recompute the control flow */
       /* since the control flow has changed        */
@@ -1430,7 +1430,7 @@ ifxOptimize (iCode * ic, set * cseSet,
       /* the price */
       computeControlFlow (ebbs, count, 1);
       if (!options.lessPedantic) {
       /* the price */
       computeControlFlow (ebbs, count, 1);
       if (!options.lessPedantic) {
-       werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
+        werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
       }
       return;
     }
       }
       return;
     }
@@ -1444,21 +1444,21 @@ ifxOptimize (iCode * ic, set * cseSet,
     {
 
       if (!options.lessPedantic) {
     {
 
       if (!options.lessPedantic) {
-       werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
+        werrorfl (ic->filename, ic->lineno, W_CONTROL_FLOW);
       }
       if (IS_OP_VOLATILE (IC_COND (ic)))
       }
       if (IS_OP_VOLATILE (IC_COND (ic)))
-       {
-         IC_RIGHT (ic) = IC_COND (ic);
-         IC_LEFT (ic) = NULL;
-         IC_RESULT (ic) = NULL;
-         ic->op = DUMMY_READ_VOLATILE;
-       }
+        {
+          IC_RIGHT (ic) = IC_COND (ic);
+          IC_LEFT (ic) = NULL;
+          IC_RESULT (ic) = NULL;
+          ic->op = DUMMY_READ_VOLATILE;
+        }
       else
         {
       else
         {
-         remiCodeFromeBBlock (ebb, ic);
-         computeControlFlow (ebbs, count, 1);
-         return;
-       }      
+          remiCodeFromeBBlock (ebb, ic);
+          computeControlFlow (ebbs, count, 1);
+          return;
+        }
     }
 
 
     }
 
 
@@ -1502,7 +1502,7 @@ DEFSETFUNC (diCodeForSym)
 /*-----------------------------------------------------------------*/
 /* constFold - does some constant folding                          */
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 /* constFold - does some constant folding                          */
 /*-----------------------------------------------------------------*/
-int 
+int
 constFold (iCode * ic, set * cseSet)
 {
   iCode *dic = NULL;
 constFold (iCode * ic, set * cseSet)
 {
   iCode *dic = NULL;
@@ -1555,10 +1555,10 @@ constFold (iCode * ic, set * cseSet)
   IC_LEFT (ic) = operandFromOperand (IC_LEFT (dic));
   if (ic->op == dic->op)
     IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) +
   IC_LEFT (ic) = operandFromOperand (IC_LEFT (dic));
   if (ic->op == dic->op)
     IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) +
-                                   operandLitValue (IC_RIGHT (dic)));
+                                    operandLitValue (IC_RIGHT (dic)));
   else
     IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) -
   else
     IC_RIGHT (ic) = operandFromLit (operandLitValue (IC_RIGHT (ic)) -
-                                   operandLitValue (IC_RIGHT (dic)));
+                                    operandLitValue (IC_RIGHT (dic)));
 
   if (IS_ITEMP (IC_RESULT (ic)))
     {
 
   if (IS_ITEMP (IC_RESULT (ic)))
     {
@@ -1575,7 +1575,7 @@ constFold (iCode * ic, set * cseSet)
 /* will delete from cseSet all get pointers computed from this     */
 /* pointer. A simple ifOperandsHave is not good enough here        */
 /*-----------------------------------------------------------------*/
 /* will delete from cseSet all get pointers computed from this     */
 /* pointer. A simple ifOperandsHave is not good enough here        */
 /*-----------------------------------------------------------------*/
-static void 
+static void
 deleteGetPointers (set ** cseSet, set ** pss, operand * op, eBBlock * ebb)
 {
   set *compItems = NULL;
 deleteGetPointers (set ** cseSet, set ** pss, operand * op, eBBlock * ebb)
 {
   set *compItems = NULL;
@@ -1588,7 +1588,7 @@ deleteGetPointers (set ** cseSet, set ** pss, operand * op, eBBlock * ebb)
     return;
 
   addSet (&compItems, op);
     return;
 
   addSet (&compItems, op);
-  
+
   /* Recursively find all items computed from this operand .
      This done fairly simply go thru the list and find
      those that are computed by arthimetic with these
   /* Recursively find all items computed from this operand .
      This done fairly simply go thru the list and find
      those that are computed by arthimetic with these
@@ -1601,26 +1601,26 @@ deleteGetPointers (set ** cseSet, set ** pss, operand * op, eBBlock * ebb)
     {
       changes = 0;
       for (cdp = setFirstItem (*cseSet); cdp; cdp = setNextItem (*cseSet))
     {
       changes = 0;
       for (cdp = setFirstItem (*cseSet); cdp; cdp = setNextItem (*cseSet))
-       {
-         if (IS_ARITHMETIC_OP (cdp->diCode) || POINTER_GET(cdp->diCode))
-           {
-             if (isinSetWith (compItems, (void*)IC_LEFT (cdp->diCode),
-                              (insetwithFunc)isOperandEqual) ||
-                 isinSetWith (compItems, (void*)IC_RIGHT (cdp->diCode),
-                              (insetwithFunc)isOperandEqual))
-               {
-                 if (!isinSetWith (compItems, (void*)IC_RESULT (cdp->diCode),
-                                   (insetwithFunc)isOperandEqual))
-                   {
-                 addSet (&compItems, IC_RESULT (cdp->diCode));
-                 changes++;
-                   }
-               }
-           }
-       }
+        {
+          if (IS_ARITHMETIC_OP (cdp->diCode) || POINTER_GET(cdp->diCode))
+            {
+              if (isinSetWith (compItems, (void*)IC_LEFT (cdp->diCode),
+                               (insetwithFunc)isOperandEqual) ||
+                  isinSetWith (compItems, (void*)IC_RIGHT (cdp->diCode),
+                               (insetwithFunc)isOperandEqual))
+                {
+                  if (!isinSetWith (compItems, (void*)IC_RESULT (cdp->diCode),
+                                    (insetwithFunc)isOperandEqual))
+                    {
+                  addSet (&compItems, IC_RESULT (cdp->diCode));
+                  changes++;
+                    }
+                }
+            }
+        }
     }
   while (changes);
     }
   while (changes);
-  
+
   /* now for the computed items */
   for (cop = setFirstItem (compItems); cop; cop = setNextItem (compItems))
     {
   /* now for the computed items */
   for (cop = setFirstItem (compItems); cop; cop = setNextItem (compItems))
     {
@@ -1706,7 +1706,7 @@ static int isSignedOp (iCode *ic)
     case IFX:
     case RECEIVE:
     case SEND:
     case IFX:
     case RECEIVE:
     case SEND:
-       return 0;
+        return 0;
     case '*':
     case '/':
     case '%':
     case '*':
     case '/':
     case '%':
@@ -1721,9 +1721,9 @@ static int isSignedOp (iCode *ic)
     case RIGHT_OP:
     case CAST:
     case ARRAYINIT:
     case RIGHT_OP:
     case CAST:
     case ARRAYINIT:
-       return 1;
+        return 1;
     default:
     default:
-       return 0;
+        return 0;
     }
  }
 
     }
  }
 
@@ -1751,7 +1751,7 @@ dumpCseSet(set *cseSet)
 /*-----------------------------------------------------------------*/
 int
 cseBBlock (eBBlock * ebb, int computeOnly,
 /*-----------------------------------------------------------------*/
 int
 cseBBlock (eBBlock * ebb, int computeOnly,
-          eBBlock ** ebbs, int count)
+           eBBlock ** ebbs, int count)
 {
   set *cseSet;
   iCode *ic;
 {
   set *cseSet;
   iCode *ic;
@@ -1791,157 +1791,179 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       ic->eBBlockNum = ebb->bbnum;
 
       if (SKIP_IC2 (ic))
       ic->eBBlockNum = ebb->bbnum;
 
       if (SKIP_IC2 (ic))
-       continue;
+        continue;
 
       /* if this is an assignment from true symbol
          to a temp then do pointer post inc/dec optimzation */
       if (ic->op == '=' && !POINTER_SET (ic) &&
 
       /* if this is an assignment from true symbol
          to a temp then do pointer post inc/dec optimzation */
       if (ic->op == '=' && !POINTER_SET (ic) &&
-         IS_PTR (operandType (IC_RESULT (ic))))
-       {
-         ptrPostIncDecOpt (ic);
-       }        
+          IS_PTR (operandType (IC_RESULT (ic))))
+        {
+          ptrPostIncDecOpt (ic);
+        }
 
       /* clear the def & use chains for the operands involved */
       /* in this operation . since it can change due to opts  */
       unsetDefsAndUses (ic);
 
       if (ic->op == PCALL || ic->op == CALL || ic->op == RECEIVE)
 
       /* clear the def & use chains for the operands involved */
       /* in this operation . since it can change due to opts  */
       unsetDefsAndUses (ic);
 
       if (ic->op == PCALL || ic->op == CALL || ic->op == RECEIVE)
-       {
-         /* add to defSet of the symbol */
-         OP_DEFS(IC_RESULT (ic))=
-           bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
-         /* add to the definition set of this block */
-         ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
-         ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
-         ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
-         setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
-         /* delete global variables from the cseSet
-            since they can be modified by the function call */
-         deleteItemIf (&cseSet, ifDefGlobal);
-
-         /* and also itemps derived from globals */
-         deleteItemIf (&cseSet, ifFromGlobal);
-
-         /* delete all getpointer iCodes from cseSet, this should
-            be done only for global arrays & pointers but at this
-            point we don't know if globals, so to be safe do all */
-         deleteItemIf (&cseSet, ifAnyGetPointer);
-          
+        {
+          /* add to defSet of the symbol */
+          OP_DEFS(IC_RESULT (ic))=
+            bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
+          /* add to the definition set of this block */
+          ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
+          ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
+          ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
+          setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+          /* delete global variables from the cseSet
+             since they can be modified by the function call */
+          deleteItemIf (&cseSet, ifDefGlobal);
+
+          /* and also itemps derived from globals */
+          deleteItemIf (&cseSet, ifFromGlobal);
+
+          /* delete all getpointer iCodes from cseSet, this should
+             be done only for global arrays & pointers but at this
+             point we don't know if globals, so to be safe do all */
+          deleteItemIf (&cseSet, ifAnyGetPointer);
+
           /* can't cache pointer set/get operations across a call */
           deleteSet (&ptrSetSet);
           /* can't cache pointer set/get operations across a call */
           deleteSet (&ptrSetSet);
-       }
+        }
 
       /* for pcall & ipush we need to add to the useSet */
       if ((ic->op == PCALL ||
 
       /* for pcall & ipush we need to add to the useSet */
       if ((ic->op == PCALL ||
-          ic->op == IPUSH ||
-          ic->op == IPOP ||
-          ic->op == SEND) &&
-         IS_SYMOP (IC_LEFT (ic)))
-       {
-
-         /* check if they can be replaced */
-         if (!computeOnly)
-           {
-             pdop = NULL;
-             applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop, 0);
-             if (pdop)
-               ReplaceOpWithCheaperOp(&IC_LEFT(ic), pdop);
-           }
-         /* the lookup could have changed it */
-         if (IS_SYMOP (IC_LEFT (ic)))
-           {
-             OP_USES(IC_LEFT (ic))=
-               bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
-             setUsesDefs (IC_LEFT (ic), ebb->defSet,
-                          ebb->outDefs, &ebb->usesDefs);
-           }
-
-
-         /* if we a sending a pointer as a parameter
-            then kill all cse since the pointed to item
-            might be changed in the function being called */
-         if ((ic->op == IPUSH || ic->op == SEND) &&
-             IS_PTR (operandType (IC_LEFT (ic))))
-           {
-             deleteGetPointers (&cseSet, &ptrSetSet, IC_LEFT (ic), ebb);
-             ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_LEFT (ic)->key);
-             for (i = 0; i < count; ebbs[i++]->visited = 0);
-             applyToSet (ebb->succList, delGetPointerSucc,
-                         IC_LEFT (ic), ebb->dfnum);
-           }
-         continue;
-       }
+           ic->op == IPUSH ||
+           ic->op == IPOP ||
+           ic->op == SEND) &&
+          IS_SYMOP (IC_LEFT (ic)))
+        {
+
+          /* check if they can be replaced */
+          if (!computeOnly)
+            {
+              pdop = NULL;
+              applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop, 0);
+              if (pdop)
+                ReplaceOpWithCheaperOp(&IC_LEFT(ic), pdop);
+            }
+          /* the lookup could have changed it */
+          if (IS_SYMOP (IC_LEFT (ic)))
+            {
+              OP_USES(IC_LEFT (ic))=
+                bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
+              setUsesDefs (IC_LEFT (ic), ebb->defSet,
+                           ebb->outDefs, &ebb->usesDefs);
+            }
+
+
+          /* if we a sending a pointer as a parameter
+             then kill all cse since the pointed to item
+             might be changed in the function being called */
+          if ((ic->op == IPUSH || ic->op == SEND) &&
+              IS_PTR (operandType (IC_LEFT (ic))))
+            {
+              deleteGetPointers (&cseSet, &ptrSetSet, IC_LEFT (ic), ebb);
+              ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_LEFT (ic)->key);
+              for (i = 0; i < count; ebbs[i++]->visited = 0);
+              applyToSet (ebb->succList, delGetPointerSucc,
+                          IC_LEFT (ic), ebb->dfnum);
+            }
+          continue;
+        }
 
       /* if jumptable then mark the usage */
       if (ic->op == JUMPTABLE)
 
       /* if jumptable then mark the usage */
       if (ic->op == JUMPTABLE)
-       {
+        {
           if (IS_SYMOP (IC_JTCOND (ic)))
           if (IS_SYMOP (IC_JTCOND (ic)))
-           {
-             OP_USES(IC_JTCOND (ic)) =
-               bitVectSetBit (OP_USES (IC_JTCOND (ic)), ic->key);
-             setUsesDefs (IC_JTCOND (ic), ebb->defSet,
-                          ebb->outDefs, &ebb->usesDefs);
-           }
-         continue;
-       }
+            {
+              OP_USES(IC_JTCOND (ic)) =
+                bitVectSetBit (OP_USES (IC_JTCOND (ic)), ic->key);
+              setUsesDefs (IC_JTCOND (ic), ebb->defSet,
+                           ebb->outDefs, &ebb->usesDefs);
+            }
+          continue;
+        }
 
       if (SKIP_IC (ic))
 
       if (SKIP_IC (ic))
-       continue;
+        continue;
 
 
-      if (!computeOnly) {
-       /* do some algebraic optimizations if possible */
-       algebraicOpts (ic, ebb);
-       while (constFold (ic, cseSet));
-      }
+      if (!computeOnly)
+        {
+          /* do some algebraic optimizations if possible */
+          algebraicOpts (ic, ebb);
+          while (constFold (ic, cseSet));
+        }
 
 
-      /* small klugde */
-      if (POINTER_GET (ic) && !IS_PTR (operandType (IC_LEFT (ic))))
-       {
-         setOperandType (IC_LEFT (ic),
-                         aggrToPtr (operandType (IC_LEFT (ic)), FALSE));
-         fixUpTypes (ic);
+      /* small kludge */
+      if (POINTER_GET (ic))
+        {
+          if (!IS_PTR (operandType (IC_LEFT (ic))))
+            {
+              setOperandType (IC_LEFT (ic),
+                              aggrToPtr (operandType (IC_LEFT (ic)), FALSE));
+              IC_LEFT (ic)->aggr2ptr = 0;
+              fixUpTypes (ic);
+            }
+          else if (IC_LEFT (ic)->aggr2ptr)
+            {/* band aid for kludge */
+              setOperandType (IC_LEFT (ic),
+                              aggrToPtr (operandType (IC_LEFT (ic)), TRUE));
+              IC_LEFT (ic)->aggr2ptr = 0;
+              fixUpTypes (ic);
+            }
+        }
 
 
-       }
-      if (POINTER_SET (ic) && !IS_PTR (operandType (IC_RESULT (ic))))
-       {
-         setOperandType (IC_RESULT (ic),
-                         aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
-       }
+      if (POINTER_SET (ic))
+        {
+          if (!IS_PTR (operandType (IC_RESULT (ic))))
+            {
+              setOperandType (IC_RESULT (ic),
+                              aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
+              IC_RESULT (ic)->aggr2ptr = 0;
+            }
+          else if (IC_RESULT (ic)->aggr2ptr)
+            {/* band aid for kludge */
+              setOperandType (IC_RESULT (ic),
+                              aggrToPtr (operandType (IC_RESULT (ic)), TRUE));
+              IC_RESULT (ic)->aggr2ptr = 0;
+            }
+        }
 
       /* if this is a condition statement then */
       /* check if the condition can be replaced */
       if (ic->op == IFX)
 
       /* if this is a condition statement then */
       /* check if the condition can be replaced */
       if (ic->op == IFX)
-       {
-         ifxOptimize (ic, cseSet, computeOnly,
-                      ebb, &change,
-                      ebbs, count);
-         continue;
-       }
+        {
+          ifxOptimize (ic, cseSet, computeOnly,
+                       ebb, &change,
+                       ebbs, count);
+          continue;
+        }
 
       /* if the assignment & result is a temp */
       /* see if we can replace it             */
       if (!computeOnly && ic->op == '=')
 
       /* if the assignment & result is a temp */
       /* see if we can replace it             */
       if (!computeOnly && ic->op == '=')
-       {
-
-         /* update the spill location for this */
-         updateSpillLocation (ic,0);
-
-         if (POINTER_SET (ic) &&
-             !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))
-           {
-             pdop = NULL;
-             applyToSetFTrue (cseSet, findCheaperOp, IC_RESULT (ic), &pdop, 0);
-             if (pdop && !computeOnly && IS_ITEMP (pdop))
-               {
-                 ReplaceOpWithCheaperOp (&IC_RESULT(ic), pdop);
-                 if (!IS_PTR (operandType (IC_RESULT (ic))))
-                   {
-                     setOperandType (IC_RESULT (ic),
-                                     aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
-                   }
-               }
-           }
-       }
+        {
+
+          /* update the spill location for this */
+          updateSpillLocation (ic,0);
+
+          if (POINTER_SET (ic) &&
+              !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))
+            {
+              pdop = NULL;
+              applyToSetFTrue (cseSet, findCheaperOp, IC_RESULT (ic), &pdop, 0);
+              if (pdop && !computeOnly && IS_ITEMP (pdop))
+                {
+                  ReplaceOpWithCheaperOp (&IC_RESULT(ic), pdop);
+                  if (!IS_PTR (operandType (IC_RESULT (ic))))
+                    {
+                      setOperandType (IC_RESULT (ic),
+                                      aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
+                    }
+                }
+            }
+        }
 
       checkSign = isSignedOp(ic);
 
 
       checkSign = isSignedOp(ic);
 
@@ -1952,72 +1974,72 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       /* left operand */
       /* and left is a symbol  */
       if (IS_SYMOP (IC_LEFT (ic)) &&
       /* left operand */
       /* and left is a symbol  */
       if (IS_SYMOP (IC_LEFT (ic)) &&
-         !computeOnly && ic->op != ADDRESS_OF)
-       {
-
-         pdop = NULL;
-         applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop, checkSign);
-         if (pdop)
-           {
-             if (POINTER_GET (ic))
-               {
-                 if (IS_ITEMP (pdop) || IS_OP_LITERAL (pdop))
-                   {
-                       /* some non dominating block does POINTER_SET with
-                          this variable .. unsafe to remove any POINTER_GETs */
-                       if (bitVectBitValue(ebb->ndompset,IC_LEFT(ic)->key))
-                           ebb->ptrsSet = bitVectSetBit(ebb->ptrsSet,pdop->key);
-                       ReplaceOpWithCheaperOp(&IC_LEFT(ic), pdop);
-                     change = 1;
-                   }
-                 /* check if there is a pointer set
-                    for the same pointer visible if yes
-                    then change this into an assignment */
-                 pdop = NULL;
-                 if (applyToSetFTrue (cseSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic)) &&
-                     !bitVectBitValue (ebb->ptrsSet, pdop->key))
-                   {
-                     ic->op = '=';
-                     IC_LEFT (ic) = NULL;
-                     ReplaceOpWithCheaperOp(&IC_RIGHT(ic), pdop);
-                     SET_ISADDR (IC_RESULT (ic), 0);
-                   }
-
-               }
-             else
-               {
-                 ReplaceOpWithCheaperOp(&IC_LEFT(ic), pdop);
-                 change = 1;
-               }
-           }
-       }
+          !computeOnly && ic->op != ADDRESS_OF)
+        {
+
+          pdop = NULL;
+          applyToSetFTrue (cseSet, findCheaperOp, IC_LEFT (ic), &pdop, checkSign);
+          if (pdop)
+            {
+              if (POINTER_GET (ic))
+                {
+                  if (IS_ITEMP (pdop) || IS_OP_LITERAL (pdop))
+                    {
+                        /* some non dominating block does POINTER_SET with
+                           this variable .. unsafe to remove any POINTER_GETs */
+                        if (bitVectBitValue(ebb->ndompset,IC_LEFT(ic)->key))
+                            ebb->ptrsSet = bitVectSetBit(ebb->ptrsSet,pdop->key);
+                        ReplaceOpWithCheaperOp(&IC_LEFT(ic), pdop);
+                      change = 1;
+                    }
+                  /* check if there is a pointer set
+                     for the same pointer visible if yes
+                     then change this into an assignment */
+                  pdop = NULL;
+                  if (applyToSetFTrue (cseSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic)) &&
+                      !bitVectBitValue (ebb->ptrsSet, pdop->key))
+                    {
+                      ic->op = '=';
+                      IC_LEFT (ic) = NULL;
+                      ReplaceOpWithCheaperOp(&IC_RIGHT(ic), pdop);
+                      SET_ISADDR (IC_RESULT (ic), 0);
+                    }
+
+                }
+              else
+                {
+                  ReplaceOpWithCheaperOp(&IC_LEFT(ic), pdop);
+                  change = 1;
+                }
+            }
+        }
 
       /*right operand */
       if (IS_SYMOP (IC_RIGHT (ic)) && !computeOnly)
 
       /*right operand */
       if (IS_SYMOP (IC_RIGHT (ic)) && !computeOnly)
-       {
+        {
 
 
-         pdop = NULL;
-         applyToSetFTrue (cseSet, findCheaperOp, IC_RIGHT (ic), &pdop, checkSign);
-         if (pdop) {
-           ReplaceOpWithCheaperOp(&IC_RIGHT(ic), pdop);
-           change = 1;
-         }
-       }
+          pdop = NULL;
+          applyToSetFTrue (cseSet, findCheaperOp, IC_RIGHT (ic), &pdop, checkSign);
+          if (pdop) {
+            ReplaceOpWithCheaperOp(&IC_RIGHT(ic), pdop);
+            change = 1;
+          }
+        }
 
       /* if left or right changed then do algebraic */
       if (!computeOnly && change)
 
       /* if left or right changed then do algebraic */
       if (!computeOnly && change)
-       {
-         algebraicOpts (ic, ebb);
-         while (constFold (ic, cseSet));
-       }
+        {
+          algebraicOpts (ic, ebb);
+          while (constFold (ic, cseSet));
+        }
 
       /* if after all this it becomes an assignment to self
          then delete it and continue */
       if (ASSIGNMENT_TO_SELF (ic))
 
       /* if after all this it becomes an assignment to self
          then delete it and continue */
       if (ASSIGNMENT_TO_SELF (ic))
-       {
-         remiCodeFromeBBlock (ebb, ic);
-         continue;
-       }
+        {
+          remiCodeFromeBBlock (ebb, ic);
+          continue;
+        }
 
       /* now we will check to see if the entire */
       /* operation has been performed before    */
 
       /* now we will check to see if the entire */
       /* operation has been performed before    */
@@ -2027,43 +2049,43 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       /* it only if result is a temporary         */
       pdic = NULL;
       if (!(POINTER_GET (ic) &&
       /* it only if result is a temporary         */
       pdic = NULL;
       if (!(POINTER_GET (ic) &&
-           (IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
-            isOperandVolatile (IC_LEFT (ic), TRUE) ||
-            bitVectBitValue (ebb->ndompset, IC_LEFT (ic)->key))) &&
-         !ASSIGNMENT (ic) &&
-         IS_ITEMP (IC_RESULT (ic)) &&
-         !computeOnly)
-       {
-           applyToSet (cseSet, findPrevIc, ic, &pdic);
-         if (pdic && compareType (operandType (IC_RESULT (pdic)),
-                                operandType (IC_RESULT (ic))) != 1)
-           pdic = NULL;
-         if (pdic && port->cseOk && (*port->cseOk)(ic,pdic) == 0)
-             pdic = NULL;
-       }
+            (IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
+             isOperandVolatile (IC_LEFT (ic), TRUE) ||
+             bitVectBitValue (ebb->ndompset, IC_LEFT (ic)->key))) &&
+          !ASSIGNMENT (ic) &&
+          IS_ITEMP (IC_RESULT (ic)) &&
+          !computeOnly)
+        {
+            applyToSet (cseSet, findPrevIc, ic, &pdic);
+          if (pdic && compareType (operandType (IC_RESULT (pdic)),
+                                 operandType (IC_RESULT (ic))) != 1)
+            pdic = NULL;
+          if (pdic && port->cseOk && (*port->cseOk)(ic,pdic) == 0)
+              pdic = NULL;
+        }
 
       /* Alternate code */
       if (pdic && IS_ITEMP(IC_RESULT(ic))) {
 
       /* Alternate code */
       if (pdic && IS_ITEMP(IC_RESULT(ic))) {
-       if (POINTER_GET(ic) && bitVectBitValue(ebb->ptrsSet,IC_LEFT(ic)->key)) {
-         /* Mmm, found an equivalent pointer get at a lower level.
-            This could be a loop however with the same pointer set
-            later on */
-       } else {
-         /* if previous definition found change this to an assignment */
-         ic->op = '=';
-         IC_LEFT(ic) = NULL;
-         IC_RIGHT(ic) = operandFromOperand(IC_RESULT(pdic));
-         SET_ISADDR(IC_RESULT(ic),0);
-         SET_ISADDR(IC_RIGHT (ic),0);
-       }
+        if (POINTER_GET(ic) && bitVectBitValue(ebb->ptrsSet,IC_LEFT(ic)->key)) {
+          /* Mmm, found an equivalent pointer get at a lower level.
+             This could be a loop however with the same pointer set
+             later on */
+        } else {
+          /* if previous definition found change this to an assignment */
+          ic->op = '=';
+          IC_LEFT(ic) = NULL;
+          IC_RIGHT(ic) = operandFromOperand(IC_RESULT(pdic));
+          SET_ISADDR(IC_RESULT(ic),0);
+          SET_ISADDR(IC_RIGHT (ic),0);
+        }
       }
 
       if (!(POINTER_SET (ic)) && IC_RESULT (ic)) {
           cseDef *csed;
       }
 
       if (!(POINTER_SET (ic)) && IC_RESULT (ic)) {
           cseDef *csed;
-         deleteItemIf (&cseSet, ifDefSymIsX, IC_RESULT (ic));
+          deleteItemIf (&cseSet, ifDefSymIsX, IC_RESULT (ic));
           csed = newCseDef (IC_RESULT (ic), ic);
           updateCseDefAncestors (csed, cseSet);
           csed = newCseDef (IC_RESULT (ic), ic);
           updateCseDefAncestors (csed, cseSet);
-         addSetHead (&cseSet, csed);
+          addSetHead (&cseSet, csed);
       }
       defic = ic;
 
       }
       defic = ic;
 
@@ -2071,98 +2093,98 @@ cseBBlock (eBBlock * ebb, int computeOnly,
          mine and type is a pointer then delete
          pointerGets to take care of aliasing */
       if (ASSIGNMENT (ic) &&
          mine and type is a pointer then delete
          pointerGets to take care of aliasing */
       if (ASSIGNMENT (ic) &&
-         OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))) &&
-         IS_PTR (operandType (IC_RESULT (ic))))
-       {
-         deleteGetPointers (&cseSet, &ptrSetSet, IC_RIGHT (ic), ebb);
-         for (i = 0; i < count; ebbs[i++]->visited = 0);
-         applyToSet (ebb->succList, delGetPointerSucc, IC_RIGHT (ic), ebb->dfnum);
-         ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RIGHT (ic)->key);
-       }
+          OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))) &&
+          IS_PTR (operandType (IC_RESULT (ic))))
+        {
+          deleteGetPointers (&cseSet, &ptrSetSet, IC_RIGHT (ic), ebb);
+          for (i = 0; i < count; ebbs[i++]->visited = 0);
+          applyToSet (ebb->succList, delGetPointerSucc, IC_RIGHT (ic), ebb->dfnum);
+          ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RIGHT (ic)->key);
+        }
 
       /* if this is a pointerget then see if we can replace
          this with a previously assigned pointer value */
       if (POINTER_GET (ic) &&
 
       /* if this is a pointerget then see if we can replace
          this with a previously assigned pointer value */
       if (POINTER_GET (ic) &&
-         !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
-           isOperandVolatile (IC_LEFT (ic), TRUE)))
-       {
-         pdop = NULL;
-         applyToSet (ptrSetSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic));
-         /* if we find it then locally replace all
-            references to the result with what we assigned */
-         if (pdop)
-           {
-             replaceAllSymBySym (ic->next, IC_RESULT (ic), pdop, &ebb->ndompset);
-           }
-       }
+          !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype) ||
+            isOperandVolatile (IC_LEFT (ic), TRUE)))
+        {
+          pdop = NULL;
+          applyToSet (ptrSetSet, findPointerSet, IC_LEFT (ic), &pdop, IC_RESULT (ic));
+          /* if we find it then locally replace all
+             references to the result with what we assigned */
+          if (pdop)
+            {
+              replaceAllSymBySym (ic->next, IC_RESULT (ic), pdop, &ebb->ndompset);
+            }
+        }
 
       /* delete from the cseSet anything that has */
       /* operands matching the result of this     */
       /* except in case of pointer access         */
       if (!(POINTER_SET (ic)) && IC_RESULT (ic))
 
       /* delete from the cseSet anything that has */
       /* operands matching the result of this     */
       /* except in case of pointer access         */
       if (!(POINTER_SET (ic)) && IC_RESULT (ic))
-       {
-         deleteItemIf (&cseSet, ifOperandsHave, IC_RESULT (ic));
-         /* delete any previous definitions */
-         ebb->defSet = bitVectCplAnd (ebb->defSet, OP_DEFS (IC_RESULT (ic)));
+        {
+          deleteItemIf (&cseSet, ifOperandsHave, IC_RESULT (ic));
+          /* delete any previous definitions */
+          ebb->defSet = bitVectCplAnd (ebb->defSet, OP_DEFS (IC_RESULT (ic)));
 
 
-       }
+        }
 
       /* add the left & right to the defUse set */
       if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
 
       /* add the left & right to the defUse set */
       if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)))
-       {
-         OP_USES(IC_LEFT (ic))=
-           bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
-         setUsesDefs (IC_LEFT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+        {
+          OP_USES(IC_LEFT (ic))=
+            bitVectSetBit (OP_USES (IC_LEFT (ic)), ic->key);
+          setUsesDefs (IC_LEFT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
 
 
-       }
+        }
 
       if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)))
 
       if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)))
-       {
-         OP_USES(IC_RIGHT (ic))=
-           bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
-         setUsesDefs (IC_RIGHT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+        {
+          OP_USES(IC_RIGHT (ic))=
+            bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
+          setUsesDefs (IC_RIGHT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
 
 
-       }
+        }
 
       /* for the result it is special case, put the result */
       /* in the defuseSet if it a pointer or array access  */
       if (POINTER_SET (defic))
 
       /* for the result it is special case, put the result */
       /* in the defuseSet if it a pointer or array access  */
       if (POINTER_SET (defic))
-       {
-         OP_USES(IC_RESULT (ic))=
-           bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key);
-         setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
-         deleteItemIf (&cseSet, ifPointerGet, IC_RESULT (ic));
-         ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RESULT (ic)->key);
-         /* delete from inexpressions of all successors which
-            have dfNum > than this block */
-         for (i = 0; i < count; ebbs[i++]->visited = 0);
-         applyToSet (ebb->succList, delGetPointerSucc, IC_RESULT (ic), ebb->dfnum);
-
-         /* delete from cseSet all other pointer sets
-            for this operand */
-         deleteItemIf (&ptrSetSet, ifPointerSet, IC_RESULT (ic));
-         /* add to the local pointerset set */
-         addSetHead (&ptrSetSet, newCseDef (IC_RESULT (ic), ic));
-       }
+        {
+          OP_USES(IC_RESULT (ic))=
+            bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key);
+          setUsesDefs (IC_RESULT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+          deleteItemIf (&cseSet, ifPointerGet, IC_RESULT (ic));
+          ebb->ptrsSet = bitVectSetBit (ebb->ptrsSet, IC_RESULT (ic)->key);
+          /* delete from inexpressions of all successors which
+             have dfNum > than this block */
+          for (i = 0; i < count; ebbs[i++]->visited = 0);
+          applyToSet (ebb->succList, delGetPointerSucc, IC_RESULT (ic), ebb->dfnum);
+
+          /* delete from cseSet all other pointer sets
+             for this operand */
+          deleteItemIf (&ptrSetSet, ifPointerSet, IC_RESULT (ic));
+          /* add to the local pointerset set */
+          addSetHead (&ptrSetSet, newCseDef (IC_RESULT (ic), ic));
+        }
       else
       else
-       /* add the result to defintion set */ if (IC_RESULT (ic))
-       {
-         OP_DEFS(IC_RESULT (ic))=
-           bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
-         ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
-         ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
-         ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
-       }
+        /* add the result to defintion set */ if (IC_RESULT (ic))
+        {
+          OP_DEFS(IC_RESULT (ic))=
+            bitVectSetBit (OP_DEFS (IC_RESULT (ic)), ic->key);
+          ebb->defSet = bitVectSetBit (ebb->defSet, ic->key);
+          ebb->outDefs = bitVectCplAnd (ebb->outDefs, OP_DEFS (IC_RESULT (ic)));
+          ebb->ldefs = bitVectSetBit (ebb->ldefs, ic->key);
+        }
 
 
       /* if this is an addressof instruction then */
       /* put the symbol in the address of list &  */
       /* delete it from the cseSet                */
       if (defic->op == ADDRESS_OF)
 
 
       /* if this is an addressof instruction then */
       /* put the symbol in the address of list &  */
       /* delete it from the cseSet                */
       if (defic->op == ADDRESS_OF)
-       {
-         addSetHead (&ebb->addrOf, IC_LEFT (ic));
-         deleteItemIf (&cseSet, ifDefSymIsX, IC_LEFT (ic));
-       }
+        {
+          addSetHead (&ebb->addrOf, IC_LEFT (ic));
+          deleteItemIf (&cseSet, ifDefSymIsX, IC_LEFT (ic));
+        }
     }
 
   for (expr=setFirstItem (ebb->inExprs); expr; expr=setNextItem (ebb->inExprs))
     }
 
   for (expr=setFirstItem (ebb->inExprs); expr; expr=setNextItem (ebb->inExprs))
index 8868437882a772b9e32a2c8dc507952997ef996f..0074f75eb9098dd29dc13502c76b2ed025b5a845 100644 (file)
@@ -31,7 +31,7 @@
 typedef struct cseDef
   {
 
 typedef struct cseDef
   {
 
-    unsigned int key;
+    int key;
     operand *sym;              /* defining symbol */
     iCode *diCode;             /* defining instruction */
     bitVect *ancestors;                /* keys of the symbol's ancestors */
     operand *sym;              /* defining symbol */
     iCode *diCode;             /* defining instruction */
     bitVect *ancestors;                /* keys of the symbol's ancestors */
index c4acdfe5e96c3322465e7c106d989cc653095cbc..1c463a294e25e1eea047a5f106164b86de3afa1c 100644 (file)
@@ -825,7 +825,7 @@ printIvalArray (symbol * sym, sym_link * type, initList * ilist,
                 FILE * oFile)
 {
   initList *iloop;
                 FILE * oFile)
 {
   initList *iloop;
-  int size = 0;
+  unsigned int size = 0;
 
   if (ilist) {
     /* take care of the special   case  */
 
   if (ilist) {
     /* take care of the special   case  */
@@ -1571,7 +1571,7 @@ emitOverlay (FILE * afile)
 static char *
 spacesToUnderscores (char *dest, const char *src, size_t len)
 {
 static char *
 spacesToUnderscores (char *dest, const char *src, size_t len)
 {
-  int i;
+  unsigned int i;
   char *p;
 
   assert(dest != NULL);
   char *p;
 
   assert(dest != NULL);
index b46ab97629d3589885978001322625e8962b3ee2..c024091a67f105c2a90d3aa5c7c956126e5b6975 100644 (file)
@@ -234,12 +234,12 @@ printOperand (operand * op, FILE * file)
     case SYMBOL:
 #define REGA 1
 #ifdef REGA
     case SYMBOL:
 #define REGA 1
 #ifdef REGA
-      fprintf (file, "%s [k%d lr%d:%d so:%d]{ ia%d re%d rm%d nos%d ru%d dp%d}",                /*{ar%d rm%d ru%d p%d a%d u%d i%d au%d k%d ks%d}"  , */
+      fprintf (file, "%s [k%d lr%d:%d so:%d]{ ia%d a2p%d re%d rm%d nos%d ru%d dp%d}",          /*{ar%d rm%d ru%d p%d a%d u%d i%d au%d k%d ks%d}"  , */
               (OP_SYMBOL (op)->rname[0] ? OP_SYMBOL (op)->rname : OP_SYMBOL (op)->name),
               op->key,
               OP_LIVEFROM (op), OP_LIVETO (op),
               OP_SYMBOL (op)->stack,
               (OP_SYMBOL (op)->rname[0] ? OP_SYMBOL (op)->rname : OP_SYMBOL (op)->name),
               op->key,
               OP_LIVEFROM (op), OP_LIVETO (op),
               OP_SYMBOL (op)->stack,
-              op->isaddr, OP_SYMBOL (op)->isreqv, 
+              op->isaddr, op->aggr2ptr, OP_SYMBOL (op)->isreqv, 
               OP_SYMBOL (op)->remat,OP_SYMBOL(op)->noSpilLoc,
               OP_SYMBOL(op)->ruonly,OP_SYMBOL(op)->dptr
        );
               OP_SYMBOL (op)->remat,OP_SYMBOL(op)->noSpilLoc,
               OP_SYMBOL(op)->ruonly,OP_SYMBOL(op)->dptr
        );
@@ -2307,7 +2307,7 @@ geniCodeAdd (operand * left, operand * right, RESULT_TYPE resultType, int lvl)
 }
 
 /*-----------------------------------------------------------------*/
 }
 
 /*-----------------------------------------------------------------*/
-/* aggrToPtr - changes an aggregate to pointer to an aggregate     */
+/* aggrToPtr - changes an "aggregate" to a "pointer to aggregate"  */
 /*-----------------------------------------------------------------*/
 sym_link *
 aggrToPtr (sym_link * type, bool force)
 /*-----------------------------------------------------------------*/
 sym_link *
 aggrToPtr (sym_link * type, bool force)
@@ -2416,7 +2416,11 @@ geniCodeArray (operand * left, operand * right, int lvl)
                                      !IS_PTR (ltype->next))
                                     ? ltype : ltype->next), 0);
 
                                      !IS_PTR (ltype->next))
                                     ? ltype : ltype->next), 0);
 
-  IC_RESULT (ic)->isaddr = (!IS_AGGREGATE (ltype->next));
+  if (!IS_AGGREGATE (ltype->next))
+    {
+      IC_RESULT (ic)->isaddr = 1;
+      IC_RESULT (ic)->aggr2ptr = 1;
+    }
   ADDTOCHAIN (ic);
 
   return IC_RESULT (ic);
   ADDTOCHAIN (ic);
 
   return IC_RESULT (ic);
@@ -2436,7 +2440,7 @@ geniCodeStruct (operand * left, operand * right, bool islval)
                                      right->operand.symOperand);
 
   wassert(IS_SYMOP(right));
                                      right->operand.symOperand);
 
   wassert(IS_SYMOP(right));
-    
+
   /* add the offset */
   ic = newiCode ('+', left, operandFromLit (element->offset));
 
   /* add the offset */
   ic = newiCode ('+', left, operandFromLit (element->offset));
 
@@ -2449,10 +2453,10 @@ geniCodeStruct (operand * left, operand * right, bool islval)
   SPEC_OCLS (retype) = SPEC_OCLS (etype);
   SPEC_VOLATILE (retype) |= SPEC_VOLATILE (etype);
   SPEC_CONST (retype) |= SPEC_CONST (etype);
   SPEC_OCLS (retype) = SPEC_OCLS (etype);
   SPEC_VOLATILE (retype) |= SPEC_VOLATILE (etype);
   SPEC_CONST (retype) |= SPEC_CONST (etype);
-  
+
   if (IS_PTR (element->type))
     setOperandType (IC_RESULT (ic), aggrToPtr (operandType (IC_RESULT (ic)), TRUE));
   if (IS_PTR (element->type))
     setOperandType (IC_RESULT (ic), aggrToPtr (operandType (IC_RESULT (ic)), TRUE));
-  
+
   IC_RESULT (ic)->isaddr = (!IS_AGGREGATE (element->type));
 
   ADDTOCHAIN (ic);
   IC_RESULT (ic)->isaddr = (!IS_AGGREGATE (element->type));
 
   ADDTOCHAIN (ic);
@@ -3495,18 +3499,18 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
   /* inserts jumps to the default label for the missing numbers */
   /* and decides later whether it is worth it */
   min = (int) floatFromVal (vch = caseVals);
   /* inserts jumps to the default label for the missing numbers */
   /* and decides later whether it is worth it */
   min = (int) floatFromVal (vch = caseVals);
-  
+
   while (vch->next)
     {
       cnt++;
       vch = vch->next;
     }
   max = (int) floatFromVal (vch);
   while (vch->next)
     {
       cnt++;
       vch = vch->next;
     }
   max = (int) floatFromVal (vch);
-  
+
   /* Exit if the range is too large to handle with a jump table. */
   if (1 + max - min > port->jumptableCost.maxCount)
     return 0;
   /* Exit if the range is too large to handle with a jump table. */
   if (1 + max - min > port->jumptableCost.maxCount)
     return 0;
-  
+
   switch (getSize (operandType (cond)))
     {
     case 1: sizeIndex = 0; break;
   switch (getSize (operandType (cond)))
     {
     case 1: sizeIndex = 0; break;
@@ -3536,7 +3540,7 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
       if (1 + max <= port->jumptableCost.maxCount)
         min = 0;
     }
       if (1 + max <= port->jumptableCost.maxCount)
         min = 0;
     }
-  
+    
   /* Compute the total size cost of a jump table. */
   sizeofJumpTable = (1 + max - min) * port->jumptableCost.sizeofElement
                      + port->jumptableCost.sizeofDispatch
   /* Compute the total size cost of a jump table. */
   sizeofJumpTable = (1 + max - min) * port->jumptableCost.sizeofElement
                      + port->jumptableCost.sizeofDispatch
@@ -3548,7 +3552,7 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
   /* If the size cost of the jump table is uneconomical then exit */
   if (sizeofMatchJump <  sizeofJumpTable)
     return 0;
   /* If the size cost of the jump table is uneconomical then exit */
   if (sizeofMatchJump <  sizeofJumpTable)
     return 0;
-    
+
   /* The jump table is preferable. */
   
   /* First, a label for the default or missing cases. */
   /* The jump table is preferable. */
   
   /* First, a label for the default or missing cases. */
@@ -3565,7 +3569,7 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
                 tree->values.switchVals.swNum);
     }
   falseLabel = newiTempLabel (buffer);
                 tree->values.switchVals.swNum);
     }
   falseLabel = newiTempLabel (buffer);
-      
+
   /* Build the list of labels for the jump table. */
   vch = caseVals;
   t = (int) floatFromVal (vch);
   /* Build the list of labels for the jump table. */
   vch = caseVals;
   t = (int) floatFromVal (vch);
index 3069ff1004c71c08e00e7854887f091f324f9780..e5dbe9d8b542e1a6dae10ece03a81e3e9276935b 100644 (file)
@@ -1,25 +1,25 @@
 /*-------------------------------------------------------------------------
 
 /*-------------------------------------------------------------------------
 
-  SDCCicode.h - intermediate code generation etc.                 
+  SDCCicode.h - intermediate code generation etc.
                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
    This program is free software; you can redistribute it and/or modify it
    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.
                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
    This program is free software; you can redistribute it and/or modify it
    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 "SDCCbitv.h"
 #include "SDCCset.h"
 -------------------------------------------------------------------------*/
 #include "SDCCbitv.h"
 #include "SDCCset.h"
@@ -73,35 +73,36 @@ OPTYPE;
 /* typedef for operand */
 typedef struct operand
   {
 /* typedef for operand */
 typedef struct operand
   {
-    OPTYPE type;               /* type of operand */
-    unsigned int isaddr:1;     /* is an address   */
-    unsigned int isvolatile:1; /* is a volatile operand */
-    unsigned int isGlobal:1;   /* is a global operand */
-    unsigned int isPtr:1;      /* is assigned a pointer */
-    unsigned int isGptr:1;     /* is a generic pointer  */
-    unsigned int isParm:1;     /* is a parameter        */
-    unsigned int isLiteral:1;  /* operand is literal    */
-
-    unsigned key;
+    OPTYPE type;                /* type of operand */
+    unsigned int isaddr:1;      /* is an address   */
+    unsigned int aggr2ptr:1;    /* must change aggregate to pointer to aggregate */
+    unsigned int isvolatile:1;  /* is a volatile operand */
+    unsigned int isGlobal:1;    /* is a global operand */
+    unsigned int isPtr:1;       /* is assigned a pointer */
+    unsigned int isGptr:1;      /* is a generic pointer  */
+    unsigned int isParm:1;      /* is a parameter        */
+    unsigned int isLiteral:1;   /* operand is literal    */
+
+    int key;
     union
       {
     union
       {
-       struct symbol *symOperand;      /* operand is of type symbol */
-       struct value *valOperand;       /* operand is of type value  */
-       struct sym_link *typeOperand;   /* operand is of type typechain */
+        struct symbol *symOperand;      /* operand is of type symbol */
+        struct value *valOperand;       /* operand is of type value  */
+        struct sym_link *typeOperand;   /* operand is of type typechain */
       }
     operand;
 
       }
     operand;
 
-    bitVect *usesDefs;         /* which definitions are used by this */
-    struct asmop *aop;         /* asm op for this operand */
+    bitVect *usesDefs;          /* which definitions are used by this */
+    struct asmop *aop;          /* asm op for this operand */
   }
 operand;
 
   }
 operand;
 
-extern operand *validateOpType(operand                 *op, 
-                              const char       *macro,
-                              const char       *args,
-                              OPTYPE           type,
-                              const char       *file, 
-                              unsigned         line);
+extern operand *validateOpType(operand          *op,
+                               const char       *macro,
+                               const char       *args,
+                               OPTYPE           type,
+                               const char       *file,
+                               unsigned         line);
 
 #define OP_SYMBOL(op) validateOpType(op, "OP_SYMBOL", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand
 #define OP_VALUE(op)  validateOpType(op, "OP_VALUE", #op, VALUE, __FILE__, __LINE__)->operand.valOperand
 
 #define OP_SYMBOL(op) validateOpType(op, "OP_SYMBOL", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand
 #define OP_VALUE(op)  validateOpType(op, "OP_VALUE", #op, VALUE, __FILE__, __LINE__)->operand.valOperand
@@ -127,71 +128,71 @@ extern operand *validateOpType(operand            *op,
 
 typedef struct iCode
   {
 
 typedef struct iCode
   {
-    unsigned int op;           /* operation defined */
-    int key;                   /* running key for this iCode */
-    int seq;                   /* sequence number within routine */
-    int seqPoint;              /* sequence point */
-    short depth;               /* loop depth of this iCode */
-    short level;               /* scope level */
-    short block;               /* sequential block number */
-    unsigned nosupdate:1;      /* don't update spillocation with this */
-    unsigned generated:1;      /* code generated for this one */
-    unsigned parmPush:1;       /* parameter push Vs spill push */
-    unsigned supportRtn:1;     /* will cause a call to a support routine */
-    unsigned regsSaved:1;      /* registers have been saved */
-    unsigned bankSaved:1;      /* register bank has been saved */
+    unsigned int op;            /* operation defined */
+    int key;                    /* running key for this iCode */
+    int seq;                    /* sequence number within routine */
+    int seqPoint;               /* sequence point */
+    short depth;                /* loop depth of this iCode */
+    short level;                /* scope level */
+    short block;                /* sequential block number */
+    unsigned nosupdate:1;       /* don't update spillocation with this */
+    unsigned generated:1;       /* code generated for this one */
+    unsigned parmPush:1;        /* parameter push Vs spill push */
+    unsigned supportRtn:1;      /* will cause a call to a support routine */
+    unsigned regsSaved:1;       /* registers have been saved */
+    unsigned bankSaved:1;       /* register bank has been saved */
     unsigned builtinSEND:1;     /* SEND for parameter of builtin function */
 
     unsigned builtinSEND:1;     /* SEND for parameter of builtin function */
 
-    struct iCode *next;                /* next in chain */
-    struct iCode *prev;                /* previous in chain */
-    set *movedFrom;            /* if this iCode gets moved to another block */
-    bitVect *rlive;            /* ranges that are live at this point */
-    int defKey;                        /* key for the operand being defined  */
-    bitVect *uses;             /* vector of key of used symbols      */
-    bitVect *rUsed;            /* registers used by this instruction */
-    bitVect *rMask;            /* registers in use during this instruction */
+    struct iCode *next;         /* next in chain */
+    struct iCode *prev;         /* previous in chain */
+    set *movedFrom;             /* if this iCode gets moved to another block */
+    bitVect *rlive;             /* ranges that are live at this point */
+    int defKey;                 /* key for the operand being defined  */
+    bitVect *uses;              /* vector of key of used symbols      */
+    bitVect *rUsed;             /* registers used by this instruction */
+    bitVect *rMask;             /* registers in use during this instruction */
     union
       {
     union
       {
-       struct
-         {
-           operand *left;      /* left if any   */
-           operand *right;     /* right if any  */
-           operand *result;    /* result of this op */
-         }
-       lrr;
-
-       struct
-         {
-           operand *condition; /* if this is a conditional */
-           symbol *trueLabel;  /* true for conditional     */
-           symbol *falseLabel; /* false for conditional    */
-         }
-       cnd;
-
-       struct
-         {
-           operand *condition; /* condition for the jump */
-           set *labels;        /* ordered set of labels  */
-         }
-       jmpTab;
+        struct
+          {
+            operand *left;      /* left if any   */
+            operand *right;     /* right if any  */
+            operand *result;    /* result of this op */
+          }
+        lrr;
+
+        struct
+          {
+            operand *condition; /* if this is a conditional */
+            symbol *trueLabel;  /* true for conditional     */
+            symbol *falseLabel; /* false for conditional    */
+          }
+        cnd;
+
+        struct
+          {
+            operand *condition; /* condition for the jump */
+            set *labels;        /* ordered set of labels  */
+          }
+        jmpTab;
 
       }
     ulrrcnd;
 
 
       }
     ulrrcnd;
 
-    symbol *label;             /* for a goto statement     */
+    symbol *label;              /* for a goto statement     */
 
 
-    char *inlineAsm;           /* pointer to inline assembler code */
+    char *inlineAsm;            /* pointer to inline assembler code */
     literalList *arrayInitList; /* point to array initializer list. */
 
     literalList *arrayInitList; /* point to array initializer list. */
 
-    int lineno;                        /* file & lineno for debug information */
+    int lineno;                 /* file & lineno for debug information */
     char *filename;
     char *filename;
-    
-    int parmBytes;             /* if call/pcall, count of parameter bytes 
-                                  on stack */
-    int argreg;                        /* argument regno for SEND/RECEIVE */
+
+    int parmBytes;              /* if call/pcall, count of parameter bytes
+                                   on stack */
+    int argreg;                 /* argument regno for SEND/RECEIVE */
     int eBBlockNum;             /* belongs to which eBBlock */
     int eBBlockNum;             /* belongs to which eBBlock */
-    char riu;                  /* after ralloc, the registers in use */
-    struct ast * tree;         /* ast node for this iCode (if not NULL) */
+    char riu;                   /* after ralloc, the registers in use */
+    struct ast * tree;          /* ast node for this iCode (if not NULL) */
   }
 iCode;
 
   }
 iCode;
 
@@ -207,37 +208,37 @@ iCodeTable;
 
 /* useful macros */
 #define SKIP_IC2(x)  (x->op == GOTO     ||     \
 
 /* useful macros */
 #define SKIP_IC2(x)  (x->op == GOTO     ||     \
-                     x->op == LABEL    ||     \
-                     x->op == FUNCTION ||     \
+                      x->op == LABEL    ||     \
+                      x->op == FUNCTION ||     \
                       x->op == INLINEASM ||    \
                       x->op == INLINEASM ||    \
-                     x->op == ENDFUNCTION   )
+                      x->op == ENDFUNCTION   )
 
 #define SKIP_IC1(x)  (x->op == CALL     ||     \
 
 #define SKIP_IC1(x)  (x->op == CALL     ||     \
-                     SKIP_IC2(x) )
+                      SKIP_IC2(x) )
 
 #define SKIP_IC(x)   (x->op == PCALL    ||     \
 
 #define SKIP_IC(x)   (x->op == PCALL    ||     \
-                     x->op == IPUSH    ||     \
+                      x->op == IPUSH    ||     \
                       x->op == IPOP     ||     \
                       x->op == JUMPTABLE ||    \
                       x->op == RECEIVE  ||     \
                       x->op == IPOP     ||     \
                       x->op == JUMPTABLE ||    \
                       x->op == RECEIVE  ||     \
-                     x->op == ARRAYINIT ||    \
-                     SKIP_IC1(x)||  \
-                     x->op == SEND         )
+                      x->op == ARRAYINIT ||    \
+                      SKIP_IC1(x)||  \
+                      x->op == SEND         )
 
 
-#define SKIP_IC3(x) (SKIP_IC2(x) ||    \
-                    x->op == JUMPTABLE )
+#define SKIP_IC3(x) (SKIP_IC2(x) ||     \
+                     x->op == JUMPTABLE )
 
 #define IS_CONDITIONAL(x) (x->op == EQ_OP || \
 
 #define IS_CONDITIONAL(x) (x->op == EQ_OP || \
-                          x->op == '<'   || \
-                          x->op == '>'   || \
-                          x->op == LE_OP || \
-                          x->op == GE_OP || \
-                          x->op == NE_OP )
+                           x->op == '<'   || \
+                           x->op == '>'   || \
+                           x->op == LE_OP || \
+                           x->op == GE_OP || \
+                           x->op == NE_OP )
 
 #define IS_TRUE_SYMOP(op) (op && IS_SYMOP(op) && !IS_ITEMP(op))
 
 #define POINTER_SET(ic) ( ic && ic->op == '='           \
 
 #define IS_TRUE_SYMOP(op) (op && IS_SYMOP(op) && !IS_ITEMP(op))
 
 #define POINTER_SET(ic) ( ic && ic->op == '='           \
-                            && IS_ITEMP(IC_RESULT(ic)) \
+                             && IS_ITEMP(IC_RESULT(ic)) \
                              && IC_RESULT(ic)->isaddr )
 
 #define POINTER_GET(ic) ( ic && ic->op == GET_VALUE_AT_ADDRESS  \
                              && IC_RESULT(ic)->isaddr )
 
 #define POINTER_GET(ic) ( ic && ic->op == GET_VALUE_AT_ADDRESS  \
@@ -245,10 +246,10 @@ iCodeTable;
                              &&  IC_LEFT(ic)->isaddr )
 
 #define IS_ARITHMETIC_OP(x) (x && (x->op == '+' || \
                              &&  IC_LEFT(ic)->isaddr )
 
 #define IS_ARITHMETIC_OP(x) (x && (x->op == '+' || \
-                                  x->op == '-' || \
-                                  x->op == '/' || \
-                                  x->op == '*' || \
-                                  x->op == '%'))
+                                   x->op == '-' || \
+                                   x->op == '/' || \
+                                   x->op == '*' || \
+                                   x->op == '%'))
 #define IS_BITWISE_OP(x) (x && (x->op == BITWISEAND || \
                                 x->op == '|'        || \
                                 x->op == '^'))
 #define IS_BITWISE_OP(x) (x && (x->op == BITWISEAND || \
                                 x->op == '|'        || \
                                 x->op == '^'))
@@ -256,25 +257,25 @@ iCodeTable;
 #define ASSIGNMENT(ic) ( ic && ic->op == '=')
 
 #define ASSIGN_SYM_TO_ITEMP(ic) (ic && ic->op == '=' && \
 #define ASSIGNMENT(ic) ( ic && ic->op == '=')
 
 #define ASSIGN_SYM_TO_ITEMP(ic) (ic && ic->op == '=' && \
-                            IS_TRUE_SYMOP(IC_RIGHT(ic)) && \
+                             IS_TRUE_SYMOP(IC_RIGHT(ic)) && \
                              IS_ITEMP(IC_RESULT(ic)))
 
 #define ASSIGN_ITEMP_TO_SYM(ic) (ic && ic->op == '=' && \
                              IS_ITEMP(IC_RESULT(ic)))
 
 #define ASSIGN_ITEMP_TO_SYM(ic) (ic && ic->op == '=' && \
-                            IS_TRUE_SYMOP(IC_RESULT(ic)) && \
+                             IS_TRUE_SYMOP(IC_RESULT(ic)) && \
                              IS_ITEMP(IC_RIGHT(ic)))
 
 #define ASSIGN_ITEMP_TO_ITEMP(ic) (ic && ic->op == '=' &&\
                              IS_ITEMP(IC_RIGHT(ic)))
 
 #define ASSIGN_ITEMP_TO_ITEMP(ic) (ic && ic->op == '=' &&\
-                                  !POINTER_SET(ic)    &&\
-                                  IS_ITEMP(IC_RIGHT(ic)) &&\
-                                  IS_ITEMP(IC_RESULT(ic)))
+                                   !POINTER_SET(ic)    &&\
+                                   IS_ITEMP(IC_RIGHT(ic)) &&\
+                                   IS_ITEMP(IC_RESULT(ic)))
 
 #define ADD_SUBTRACT_ITEMP(ic) (ic && (ic->op == '+' || ic->op == '-') && \
 
 #define ADD_SUBTRACT_ITEMP(ic) (ic && (ic->op == '+' || ic->op == '-') && \
-                               IS_ITEMP(IC_RESULT(ic)) && \
-                               ( ( IS_ITEMP(IC_LEFT(ic)) ) ||  ( IS_SYMOP(IC_LEFT(ic)) ) ) && \
+                                IS_ITEMP(IC_RESULT(ic)) && \
+                                ( ( IS_ITEMP(IC_LEFT(ic)) ) ||  ( IS_SYMOP(IC_LEFT(ic)) ) ) && \
                                   IS_OP_LITERAL(IC_RIGHT(ic)))
 
 #define ASSIGNMENT_TO_SELF(ic) (!POINTER_SET(ic) && !POINTER_GET(ic) && \
                                   IS_OP_LITERAL(IC_RIGHT(ic)))
 
 #define ASSIGNMENT_TO_SELF(ic) (!POINTER_SET(ic) && !POINTER_GET(ic) && \
-                               ic->op == '=' && IC_RESULT(ic)->key == IC_RIGHT(ic)->key )
+                                ic->op == '=' && IC_RESULT(ic)->key == IC_RIGHT(ic)->key )
 
 #define IS_CAST_ICODE(ic) (ic && ic->op == CAST)
 #define SET_ISADDR(op,v) {op = operandFromOperand(op); op->isaddr = v;}
 
 #define IS_CAST_ICODE(ic) (ic && ic->op == CAST)
 #define SET_ISADDR(op,v) {op = operandFromOperand(op); op->isaddr = v;}
index c24d6d99304fc7a7fc926ce1178bce390fe2d225..68992145a7fe1c95eaaa00055ffa9f3fc7e8c3a2 100644 (file)
@@ -224,7 +224,7 @@ typedef struct sym_link
       unsigned intrtn:1;       /* this is an interrupt routin */
       unsigned rbank:1;                /* seperate register bank     */
       unsigned intno;          /* 1=Interrupt svc routine    */
       unsigned intrtn:1;       /* this is an interrupt routin */
       unsigned rbank:1;                /* seperate register bank     */
       unsigned intno;          /* 1=Interrupt svc routine    */
-      unsigned regbank;                /* register bank 2b used      */
+      short    regbank;                /* register bank 2b used      */
       unsigned builtin;                /* is a builtin function      */
       unsigned javaNative;     /* is a JavaNative Function (TININative ONLY) */
       unsigned overlay;        /* force parameters & locals into overlay segment */
       unsigned builtin;                /* is a builtin function      */
       unsigned javaNative;     /* is a JavaNative Function (TININative ONLY) */
       unsigned overlay;        /* force parameters & locals into overlay segment */
index 5993a46c7f2aaa02915370ac52bd9b4d7799a293..08b68b1c52b861bf3e4e1cccd137fad6187536ff 100644 (file)
@@ -296,7 +296,7 @@ hasInc (operand *op, iCode *ic)
                        return lic;
                }
                /* if the operand used or deffed */
                        return lic;
                }
                /* if the operand used or deffed */
-               if (bitVectBitValue(OP_USES(op),lic->key) || ((unsigned) lic->defKey == op->key)) {
+               if (bitVectBitValue(OP_USES(op),lic->key) || (lic->defKey == op->key)) {
                        return NULL;
                }
                lic = lic->next;
                        return NULL;
                }
                lic = lic->next;
@@ -1545,7 +1545,7 @@ static void
 genCall (iCode * ic)
 {
 
 genCall (iCode * ic)
 {
 
-       /* if send set is not empty the assign */
+       /* if send set is not empty then assign */
        if (_G.sendSet) {
                iCode *sic;
                int rnum = 16;
        if (_G.sendSet) {
                iCode *sic;
                int rnum = 16;
index 8301d4c4a39876fd8d756cc052b0e0c11b36f6a6..518e36ccd0355eb121f7039a5d44e15e9effa3ca 100644 (file)
@@ -2638,7 +2638,7 @@ genCall (iCode * ic)
     if (!ic->regsSaved)
       saveRegisters (ic);
 
     if (!ic->regsSaved)
       saveRegisters (ic);
 
-  /* if send set is not empty the assign */
+  /* if send set is not empty then assign */
   /* We've saved all the registers we care about;
   * therefore, we may clobber any register not used
   * in the calling convention (i.e. anything not in
   /* We've saved all the registers we care about;
   * therefore, we may clobber any register not used
   * in the calling convention (i.e. anything not in
@@ -6394,7 +6394,7 @@ hasInc (operand *op, iCode *ic, int osize)
           return lic;
       }
       /* if the operand used or deffed */
           return lic;
       }
       /* if the operand used or deffed */
-      if (bitVectBitValue(OP_USES(op),lic->key) || (unsigned) lic->defKey == op->key) {
+      if (bitVectBitValue(OP_USES(op),lic->key) || lic->defKey == op->key) {
           return NULL;
       }
       /* if GOTO or IFX */
           return NULL;
       }
       /* if GOTO or IFX */
index 3d2101b566e885940e9115f67a9ad499c7083a89..f799360b5a302291ffa2ed501ab45a6a361427ea 100644 (file)
@@ -651,7 +651,7 @@ loadRegFromAop (regs *reg, asmop *aop, int loffset)
     }
 
 forceload:
     }
 
 forceload:
-  
+
   switch (regidx)
     {
       case A_IDX:
   switch (regidx)
     {
       case A_IDX:
@@ -1123,7 +1123,7 @@ storeRegToFullAop (regs *reg, asmop *aop, bool isSigned)
 
 /*--------------------------------------------------------------------------*/
 /* transferAopAop - Transfer the value at logical offset srcofs of asmop    */
 
 /*--------------------------------------------------------------------------*/
 /* transferAopAop - Transfer the value at logical offset srcofs of asmop    */
-/*                  srcaop to logical offset dstofs of asmop dstofs.        */
+/*                  srcaop to logical offset dstofs of asmop dstaop.        */
 /*--------------------------------------------------------------------------*/
 static void
 transferAopAop (asmop *srcaop, int srcofs, asmop *dstaop, int dstofs)
 /*--------------------------------------------------------------------------*/
 static void
 transferAopAop (asmop *srcaop, int srcofs, asmop *dstaop, int dstofs)
@@ -1329,10 +1329,10 @@ rmwWithAop (char *rmwop, asmop *aop, int loffset)
         break;
       case AOP_EXT:
         needpula = pushRegIfUsed (hc08_reg_a);
         break;
       case AOP_EXT:
         needpula = pushRegIfUsed (hc08_reg_a);
-       loadRegFromAop (hc08_reg_a, aop, loffset);
+        loadRegFromAop (hc08_reg_a, aop, loffset);
         rmwWithReg (rmwop, hc08_reg_a);
         if (strcmp ("tst", rmwop))
         rmwWithReg (rmwop, hc08_reg_a);
         if (strcmp ("tst", rmwop))
-         storeRegToAop (hc08_reg_a, aop, loffset);
+          storeRegToAop (hc08_reg_a, aop, loffset);
         pullOrFreeReg (hc08_reg_a, needpula);
         break;
       case AOP_DUMMY:
         pullOrFreeReg (hc08_reg_a, needpula);
         break;
       case AOP_DUMMY:
@@ -2658,7 +2658,7 @@ static void genSend(set *sendSet)
     iCode *sic;
 
     for (sic = setFirstItem (sendSet); sic;
     iCode *sic;
 
     for (sic = setFirstItem (sendSet); sic;
-        sic = setNextItem (sendSet)) {
+         sic = setNextItem (sendSet)) {
          int size, offset = 0;
          aopOp (IC_LEFT (sic), sic, FALSE);
          size = AOP_SIZE (IC_LEFT (sic));
          int size, offset = 0;
          aopOp (IC_LEFT (sic), sic, FALSE);
          size = AOP_SIZE (IC_LEFT (sic));
@@ -2688,7 +2688,7 @@ genCall (iCode * ic)
   D(emitcode(";     genCall",""));
 
   dtype = operandType (IC_LEFT (ic));
   D(emitcode(";     genCall",""));
 
   dtype = operandType (IC_LEFT (ic));
-  /* if send set is not empty the assign */
+  /* if send set is not empty then assign */
   if (_G.sendSet)
     {
        if (IFFUNC_ISREENT(dtype)) { /* need to reverse the send set */
   if (_G.sendSet)
     {
        if (IFFUNC_ISREENT(dtype)) { /* need to reverse the send set */
@@ -3218,7 +3218,7 @@ genPlusIncr (iCode * ic)
   bool needpulh;
   bool needpula;
   unsigned int size = getDataSize (IC_RESULT (ic));
   bool needpulh;
   bool needpula;
   unsigned int size = getDataSize (IC_RESULT (ic));
-  int offset;
+  unsigned int offset;
   symbol *tlbl = NULL;
   
   left = IC_LEFT (ic);
   symbol *tlbl = NULL;
   
   left = IC_LEFT (ic);
@@ -4647,7 +4647,7 @@ hasInc (operand *op, iCode *ic,int osize)
       return lic;
     }
     /* if the operand used or deffed */
       return lic;
     }
     /* if the operand used or deffed */
-    if (bitVectBitValue(OP_USES(op),lic->key) || (unsigned) lic->defKey == op->key) {
+    if (bitVectBitValue(OP_USES(op),lic->key) || lic->defKey == op->key) {
       return NULL;
     }
     /* if GOTO or IFX */
       return NULL;
     }
     /* if GOTO or IFX */
index fdb71ba6422a3db1db57868927702abad57ecd63..a4dc8526695e6d8fe730c6b18078e2b05866e6a8 100644 (file)
@@ -1,6 +1,6 @@
 /*------------------------------------------------------------------------
 
 /*------------------------------------------------------------------------
 
-  SDCCralloc.c - source file for register allocation. (8051) specific
+  SDCCralloc.c - source file for register allocation. 68HC08 specific
 
                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
 
                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
@@ -655,7 +655,7 @@ 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 */
+  /* mark it as spilt & put it in the spilt set */
   sym->isspilt = sym->spillA = 1;
   _G.spiltSet = bitVectSetBit (_G.spiltSet, sym->key);
 
   sym->isspilt = sym->spillA = 1;
   _G.spiltSet = bitVectSetBit (_G.spiltSet, sym->key);
 
@@ -1414,7 +1414,7 @@ static void fillGaps()
 
     if (getenv("DISABLE_FILL_GAPS")) return;
 
 
     if (getenv("DISABLE_FILL_GAPS")) return;
 
-    /* look for livernages that was spilt by the allocator */
+    /* look for liveranges that were spilt by the allocator */
     for (sym = hTabFirstItem(liveRanges,&key) ; sym ;
         sym = hTabNextItem(liveRanges,&key)) {
 
     for (sym = hTabFirstItem(liveRanges,&key) ; sym ;
         sym = hTabNextItem(liveRanges,&key)) {
 
index 83cadf84ea92165b8b94e7b586a88ca4d6af4870..a19a133b921859cddfd02b56f157707a21560b29 100644 (file)
@@ -137,8 +137,6 @@ emitcode (char *inst, const char *fmt,...)
   while (isspace (*lbp))
     lbp++;
 
   while (isspace (*lbp))
     lbp++;
 
-  //printf ("%s\n", lb);
-
   if (lbp && *lbp)
     lineCurr = (lineCurr ?
                 connectLine (lineCurr, newLineNode (lb)) :
   if (lbp && *lbp)
     lineCurr = (lineCurr ?
                 connectLine (lineCurr, newLineNode (lb)) :
@@ -181,8 +179,8 @@ mova (const char *x)
 static regs *
 getFreePtr (iCode * ic, asmop ** aopp, bool result)
 {
 static regs *
 getFreePtr (iCode * ic, asmop ** aopp, bool result)
 {
-  bool r0iu = FALSE, r1iu = FALSE;
-  bool r0ou = FALSE, r1ou = FALSE;
+  bool r0iu, r1iu;
+  bool r0ou, r1ou;
 
   /* the logic: if r0 & r1 used in the instruction
      then we are in trouble otherwise */
 
   /* the logic: if r0 & r1 used in the instruction
      then we are in trouble otherwise */
@@ -633,7 +631,7 @@ operandsEqu (operand * op1, operand * op2)
 {
   symbol *sym1, *sym2;
 
 {
   symbol *sym1, *sym2;
 
-  /* if they not symbols */
+  /* if they're not symbols */
   if (!IS_SYMOP (op1) || !IS_SYMOP (op2))
     return FALSE;
 
   if (!IS_SYMOP (op1) || !IS_SYMOP (op2))
     return FALSE;
 
@@ -650,6 +648,7 @@ operandsEqu (operand * op1, operand * op2)
   if (sym1 == sym2)
     return TRUE;
 
   if (sym1 == sym2)
     return TRUE;
 
+  /* if they have the same rname */
   if (sym1->rname[0] && sym2->rname[0]
       && strcmp (sym1->rname, sym2->rname) == 0)
     return TRUE;
   if (sym1->rname[0] && sym2->rname[0]
       && strcmp (sym1->rname, sym2->rname) == 0)
     return TRUE;
@@ -2222,7 +2221,7 @@ genCall (iCode * ic)
   D(emitcode(";     genCall",""));
 
   dtype = operandType (IC_LEFT (ic));
   D(emitcode(";     genCall",""));
 
   dtype = operandType (IC_LEFT (ic));
-  /* if send set is not empty the assign */
+  /* if send set is not empty then assign */
   if (_G.sendSet)
     {
         if (IFFUNC_ISREENT(dtype)) { /* need to reverse the send set */
   if (_G.sendSet)
     {
         if (IFFUNC_ISREENT(dtype)) { /* need to reverse the send set */
@@ -5226,7 +5225,7 @@ hasInc (operand *op, iCode *ic,int osize)
       return lic;
     }
     /* if the operand used or deffed */
       return lic;
     }
     /* if the operand used or deffed */
-    if (bitVectBitValue(OP_USES(op),lic->key) || (unsigned) lic->defKey == op->key) {
+    if (bitVectBitValue(OP_USES(op),lic->key) || lic->defKey == op->key) {
       return NULL;
     }
     /* if GOTO or IFX */
       return NULL;
     }
     /* if GOTO or IFX */
index 17767c4e45bfda45b3aacd64d49fcd469ace9400..f78f83a3cd12b805923474c1b2cb2681a87e57f1 100644 (file)
@@ -640,7 +640,7 @@ static int
 pic16_printIvalChar (sym_link * type, initList * ilist, char *s, char ptype, void *p)
 {
   value *val;
 pic16_printIvalChar (sym_link * type, initList * ilist, char *s, char ptype, void *p)
 {
   value *val;
-  int remain;
+  unsigned int remain;
 
   if(!p)
     return 0;
 
   if(!p)
     return 0;
index 4a026fcc1a7c31b13d80fb89bcc518a78ce0c08f..ffd938c280661f06c77a545a721495b884a0c8cd 100644 (file)
@@ -401,7 +401,7 @@ regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alia
 /* regWithIdx - Search through a set of registers that matches idx */
 /*-----------------------------------------------------------------*/
 static regs *
 /* regWithIdx - Search through a set of registers that matches idx */
 /*-----------------------------------------------------------------*/
 static regs *
-regWithIdx (set *dRegs, int idx, int fixed)
+regWithIdx (set *dRegs, int idx, unsigned fixed)
 {
   regs *dReg;
 
 {
   regs *dReg;
 
index f30aed63336070f666a7aa870ab154c5f8ee1d2a..2eace67994a3c2b8faf960cdc1c2b2406b4d05b0 100755 (executable)
@@ -1207,7 +1207,7 @@ static iCode *hasInc (operand *op, iCode *ic, int osize) {
       }
     }
     /* if the operand used or deffed */
       }
     }
     /* if the operand used or deffed */
-    if (bitVectBitValue(OP_USES(op),lic->key) || (unsigned) lic->defKey == op->key) {
+    if (bitVectBitValue(OP_USES(op),lic->key) || lic->defKey == op->key) {
       return NULL;
     }
     /* if GOTO or IFX */
       return NULL;
     }
     /* if GOTO or IFX */
diff --git a/support/regression/tests/bug-868103.c b/support/regression/tests/bug-868103.c
new file mode 100644 (file)
index 0000000..ed2c04e
--- /dev/null
@@ -0,0 +1,34 @@
+/** Bug 868103 tests.
+
+    storage1: near, far, code,
+    storage2: near, far,
+*/
+
+#ifndef STORAGE1
+#define STORAGE1 {storage1}
+#endif
+
+#ifndef STORAGE2
+#define STORAGE2 {storage2}
+#endif
+
+#include <testfwk.h>
+
+#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
+# define near
+# define far
+# define code
+#endif
+
+typedef struct {
+  STORAGE1 char * bar[2];
+} foo;
+
+STORAGE1 char c = 'x';
+STORAGE2 foo f;
+
+void bug868103(void)
+{
+  f.bar[1] = &c;
+  ASSERT(f.bar[1] == &c);
+}