Added funcattr hasStackParms will be set for reentrant functions when there
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 24 Dec 2001 22:11:41 +0000 (22:11 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 24 Dec 2001 22:11:41 +0000 (22:11 +0000)
are paramteres on the stack, this helps in minimizing frame pointer generation
typeFromStr can handle function pointers now

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

src/SDCCsymt.c
src/SDCCsymt.h

index dc7968d45b5911ecd00e76c3cba95014e06d35e7..a58f176d3c4d1366ae3ede9c260be8631739be57 100644 (file)
@@ -1798,7 +1798,7 @@ processFuncArgs (symbol * func)
 
   /* if this function has variable argument list */
   /* then make the function a reentrant one    */
-  if (IFFUNC_HASVARARGS(funcType))
+  if (IFFUNC_HASVARARGS(funcType) || options.stackAuto)
     FUNC_ISREENT(funcType)=1;
 
   /* check if this function is defined as calleeSaves
@@ -1828,6 +1828,8 @@ processFuncArgs (symbol * func)
          (*port->reg_parm) (val->type))
        {
          SPEC_REGPARM (val->etype) = 1;
+       } else if (IFFUNC_ISREENT(funcType)) {
+           FUNC_HASSTACKPARM(funcType) = 1;
        }
 
       if (IS_AGGREGATE (val->type))
@@ -2350,6 +2352,7 @@ _mangleFunctionName(char *in)
 /*                      'x' - xdata                                */
 /*                      'p' - code                                 */
 /*                      'd' - data                                 */                     
+/*                      'F' - function                             */                     
 /* examples : "ig*" - generic int *                               */
 /*            "cx*" - char xdata *                                 */
 /*            "ui" -  unsigned int                                 */
@@ -2396,6 +2399,7 @@ sym_link *typeFromStr (char *s)
        case 'x':
        case 'p':
        case 'd':
+       case 'F':
            assert(*(s+1)=='*');
            nr = newLink();
            nr->next = r;
@@ -2414,6 +2418,14 @@ sym_link *typeFromStr (char *s)
            case 'd':
                DCL_TYPE(r) = POINTER;
                break;
+           case 'F':
+               DCL_TYPE(r) = FUNCTION;
+               nr = newLink();
+               nr->next = r;
+               r = nr;
+               r->class = DECLARATOR ;
+               DCL_TYPE(r) = CPOINTER;
+               break;
            }
            s++;
            break;
index 2d0c80c3daebfcae5e647301510b2b55642d9551..be2c19b9de189b7991c327d058b3add1c7f3a372 100644 (file)
@@ -209,6 +209,7 @@ typedef struct sym_link
       unsigned builtin;                /* is a builtin function      */
       unsigned javaNative;     /* is a JavaNative Function (TININative ONLY) */
       unsigned overlay;        /* force parameters & locals into overlay segment */
+      unsigned hasStackParms;   /* function has parameters on stack */
     } funcAttrs;
 
     struct sym_link *next;     /* next element on the chain  */
@@ -325,6 +326,7 @@ symbol;
 #define IFFUNC_RBANK(x) (IS_FUNC(x) && FUNC_RBANK(x))
 #define FUNC_INTNO(x) (x->funcAttrs.intno)
 #define FUNC_REGBANK(x) (x->funcAttrs.regbank)
+#define FUNC_HASSTACKPARM(x) (x->funcAttrs.hasStackParms)
 
 #define FUNC_ISREENT(x) (x->funcAttrs.reent)
 #define IFFUNC_ISREENT(x) (IS_FUNC(x) && FUNC_ISREENT(x))
@@ -343,6 +345,7 @@ symbol;
 #define FUNC_ISOVERLAY(x) (x->funcAttrs.overlay)
 #define IFFUNC_ISOVERLAY(x) (IS_FUNC(x) && FUNC_ISOVERLAY(x))
 
+
 // jwk: I am not sure about this
 #define IFFUNC_ISBANKEDCALL(x) (!IFFUNC_NONBANKED(x) && \
   (options.model == MODEL_LARGE || \