fixed the first parameter push of --int-long-reent
[fw/sdcc] / src / SDCCsymt.c
index 0f532e0fefc6c78bd2edef1fb7b5d29a2bbc80c9..9349511d9f89ec36c717e8c112ad906a43ae8c82 100644 (file)
@@ -435,7 +435,9 @@ mergeSpec (sym_link * dest, sym_link * src)
     SPEC_NOUN (dest) = SPEC_NOUN (src);
 
   /* if destination has no storage class */
-  if (!SPEC_SCLS (dest) || (SPEC_SCLS(dest) == S_CONSTANT && SPEC_SCLS (src)))
+  if (!SPEC_SCLS (dest) || 
+      ((SPEC_SCLS(dest) == S_CONSTANT || SPEC_SCLS(dest) == S_REGISTER) && 
+       SPEC_SCLS (src)))
     SPEC_SCLS (dest) = SPEC_SCLS (src);
   /* special case for const */
   /* copy all the specifications  */
@@ -788,7 +790,7 @@ addSymChain (symbol * symHead)
 
   for (; sym != NULL; sym = sym->next)
     {
-
+      changePointer(sym);
       /* if already exists in the symbol table then check if
          the previous was an extern definition if yes then
          then check if the type match, if the types match then
@@ -1109,7 +1111,7 @@ checkSClass (symbol * sym)
           * control this allcoation, but the code was originally that way, and
           * changing it for non-390 ports breaks the compiler badly.
           */
-         bool useXdata = IS_DS390_PORT ? options.model : options.useXstack;
+         bool useXdata = TARGET_IS_DS390 ? 1 : options.useXstack;
          SPEC_SCLS (sym->etype) = (useXdata ?
                                    S_XDATA : S_FIXED);
        }
@@ -1419,7 +1421,7 @@ aggregateArgToPointer (value * val)
          DCL_TYPE (val->type) = PPOINTER;
          break;
        case S_FIXED:
-         if (IS_DS390_PORT)
+         if (TARGET_IS_DS390)
            {
              /* The AUTO and REGISTER classes should probably
               * also become generic pointers, but I haven't yet
@@ -1592,7 +1594,6 @@ processFuncArgs (symbol * func, int ignoreName)
   value *val;
   int pNum = 1;
 
-
   /* if this function has variable argument list */
   /* then make the function a reentrant one    */
   if (func->hasVargs)
@@ -1622,8 +1623,6 @@ processFuncArgs (symbol * func, int ignoreName)
          and as port dictates
          not inhibited by command line option or #pragma */
       if (!func->hasVargs &&
-         !options.noregparms &&
-         !IS_RENT (func->etype) &&
          (*port->reg_parm) (val->type))
        {
          SPEC_REGPARM (val->etype) = 1;
@@ -1637,10 +1636,19 @@ processFuncArgs (symbol * func, int ignoreName)
       pNum++;
     }
 
-  /* if this function is reentrant or */
-  /* automatics r 2b stacked then nothing */
-  if (IS_RENT (func->etype) || options.stackAuto)
-    return;
+  /* if this is an internal generated function call */
+  if (func->cdef) {
+    /* ignore --stack-auto for this one, we don't know how it is compiled */
+    /* simply trust on --int-long-reent or --float-reent */
+    if (IS_RENT(func->etype)) {
+      return;
+    }
+  } else {
+    /* if this function is reentrant or */
+    /* automatics r 2b stacked then nothing */
+    if (IS_RENT (func->etype) || options.stackAuto)
+      return;
+  }
 
   val = func->args;
   pNum = 1;
@@ -1723,6 +1731,9 @@ printTypeChain (sym_link * type, FILE * of)
     {
       if (IS_DECL (type))
        {
+         if (DCL_PTR_VOLATILE(type)) {
+           fprintf (of, "volatile ");
+         }
          switch (DCL_TYPE (type))
            {
            case FUNCTION:
@@ -1769,7 +1780,6 @@ printTypeChain (sym_link * type, FILE * of)
              if (DCL_PTR_CONST (type))
                fprintf (of, "const ");
              break;
-
            case ARRAY:
              fprintf (of, "array of ");
              break;