fixed the pointers alive across function calls
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Sep 2000 16:34:18 +0000 (16:34 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Sep 2000 16:34:18 +0000 (16:34 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@355 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCcse.c

index 72129a291e2a34ff0a73cce002c24b3b20d77534..952a3050d61066e45386c411547151537c878f06 100644 (file)
@@ -376,6 +376,17 @@ DEFSETFUNC(ifDefGlobal)
     return (isOperandGlobal(cdp->sym));
 }
 
+/*-----------------------------------------------------------------*/
+/* ifAnyGetPointer - if get pointer icode                          */
+/*-----------------------------------------------------------------*/
+DEFSETFUNC(ifAnyGetPointer)
+{
+    cseDef *cdp = item;
+    
+    if (cdp->diCode && POINTER_GET(cdp->diCode)) return 1;
+    return 0;
+}
+
 /*-----------------------------------------------------------------*/
 /* ifOperandsHave - if any of the operand are the same as this     */
 /*-----------------------------------------------------------------*/
@@ -1199,6 +1210,10 @@ int cseBBlock ( eBBlock *ebb, int computeOnly,
            /* delete global variables from the cseSet
               since they can be modified by the function call */
            deleteItemIf(&cseSet,ifDefGlobal);
+           /* 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);
        }
 
        /* for pcall & ipush we need to add to the useSet */