10 bit stack mode: just a few more tweaks...
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 9 Mar 2000 21:04:52 +0000 (21:04 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 9 Mar 2000 21:04:52 +0000 (21:04 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@183 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/include/stdarg.h
src/SDCCmain.c
src/mcs51/gen.c

index aa2a8615a344a36d59b631350ae5d65c0e0abb3f..4802a8fdd43c3efb292830e2d7672489a7696dfb 100644 (file)
@@ -5,7 +5,15 @@
 #ifndef __SDC51_STDARG_H
 #define __SDC51_STDARG_H 1
 
-#ifdef SDCC_USE_XSTACK
+#if defined(SDCC_STACK_TENBIT)
+
+#error Foo!
+
+typedef        unsigned char _xdata * va_list ;
+#define va_arg(marker,type)   *((type _xdata * )(marker -= sizeof(type)))
+#define        va_start(marker,first)  { marker = (va_list) ((char _xdata * )&first) ; }
+
+#elif defined(SDCC_USE_XSTACK)
 
 typedef        unsigned char _pdata * va_list ;
 #define va_arg(marker,type)   *((type _data * )(marker -= sizeof(type)))
index b7b6a354031d0281991f5f081c729c7a3e67035e..1324cb449444319994f77ca7d724161c787d7984 100644 (file)
@@ -1197,6 +1197,10 @@ static int preProcess (char **envp)
        /* set the macro for stack autos        */
        if ( options.stackAuto )
            _addToList(preArgv, "-DSDCC_STACK_AUTO");
+           
+       /* set the macro for stack autos        */
+       if ( options.stack10bit )
+           _addToList(preArgv, "-DSDCC_STACK_TENBIT"); 
     
        /* set the macro for large model        */
        switch(options.model)
index 0f2a60b52d5cb0eff7422917be777b63edea6040..770fc08457ba8de3b3aecf14534af18bdf110006 100644 (file)
@@ -7058,26 +7058,13 @@ static void genAssign (iCode *ic)
     aopOp(right,ic,FALSE);
     
     /* special case both in far space */
-    /* However, if we are using 10 bit stack mode,
-     * the result should be held in DPTR2,
-     * so we can operate without the special case.
-     *
-     * I think.
-     */
-    if (AOP_TYPE(right) == AOP_DPTR &&
+    if ((AOP_TYPE(right) == AOP_DPTR ||
+         AOP_TYPE(right) == AOP_DPTR2) &&
        IS_TRUE_SYMOP(result)       &&
        isOperandInFarSpace(result)) {
        
-       if (!options.stack10bit)
-       {
-           genFarFarAssign (result,right,ic);
-            return ;
-        }
-        else
-        {
-            fprintf(stderr, "*** 10bit stack opt 1\n");
-            emitcode(";", "look at me: optimization possible?\n");
-        }
+       genFarFarAssign (result,right,ic);
+       return ;
     }
 
     aopOp(result,ic,TRUE);