From: sandeep Date: Mon, 24 Dec 2001 22:11:41 +0000 (+0000) Subject: Added funcattr hasStackParms will be set for reentrant functions when there X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5cf0eb5778feb28c1f94a996c444ade546d3f44a;p=fw%2Fsdcc Added funcattr hasStackParms will be set for reentrant functions when there 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 --- diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index dc7968d4..a58f176d 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -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; diff --git a/src/SDCCsymt.h b/src/SDCCsymt.h index 2d0c80c3..be2c19b9 100644 --- a/src/SDCCsymt.h +++ b/src/SDCCsymt.h @@ -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 || \