From: kvigor Date: Thu, 9 Mar 2000 21:04:52 +0000 (+0000) Subject: 10 bit stack mode: just a few more tweaks... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=17ac14c727bd7466b5ac78709231fafbb7f18e59;p=fw%2Fsdcc 10 bit stack mode: just a few more tweaks... git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@183 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/include/stdarg.h b/device/include/stdarg.h index aa2a8615..4802a8fd 100644 --- a/device/include/stdarg.h +++ b/device/include/stdarg.h @@ -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))) diff --git a/src/SDCCmain.c b/src/SDCCmain.c index b7b6a354..1324cb44 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -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) diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 0f2a60b5..770fc084 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -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);