Now _naked should work for function calls too. In fact it more or less
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 17 Jun 2001 12:30:39 +0000 (12:30 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 17 Jun 2001 12:30:39 +0000 (12:30 +0000)
makes calleesaves and "#pragma EXCLUDE" obsolete. Note however that you
have to ret or reti yourself!

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

src/SDCCsymt.c
src/ds390/gen.c
src/ds390/ralloc.c
src/mcs51/gen.c

index b70f3af3df49a1b27133e237a2d4a213b11da0a6..34fe08a3fd65e5471b60814d8cc7cc0661d46887 100644 (file)
@@ -1488,7 +1488,7 @@ checkType (sym_link * dest, sym_link * src)
 }
 
 /*------------------------------------------------------------------*/
-/* inCalleeSaveList - return 1 if found in calle save list          */
+/* inCalleeSaveList - return 1 if found in callee save list          */
 /*------------------------------------------------------------------*/
 bool 
 inCalleeSaveList (char *s)
@@ -1649,13 +1649,16 @@ checkFunction (symbol * sym)
   if (SPEC_INTRTN (csym->etype) != SPEC_INTRTN (sym->etype))
     {
       werror (E_PREV_DEF_CONFLICT, csym->name, "interrupt");
-      return 0;
     }
 
   if (SPEC_BANK (csym->etype) != SPEC_BANK (sym->etype))
     {
       werror (E_PREV_DEF_CONFLICT, csym->name, "using");
-      return 0;
+    }
+
+  if (SPEC_NAKED (csym->etype) != SPEC_NAKED (sym->etype))
+    {
+      werror (E_PREV_DEF_CONFLICT, csym->name, "_naked");
     }
 
   /* compare expected agrs with actual args */
index 4affec9a231441511e23431cf907eac220dd3718..60f2df10e91d3a04ed0cd77e408e151e4ea6f24a 100644 (file)
@@ -1758,7 +1758,8 @@ saveRegisters (iCode * lic)
 
   /* if the registers have been saved already then
      do nothing */
-  if (ic->regsSaved || (OP_SYMBOL (IC_LEFT (ic))->calleeSave))
+  if (ic->regsSaved || (OP_SYMBOL (IC_LEFT (ic))->calleeSave) ||
+      SPEC_NAKED(OP_SYM_ETYPE(IC_LEFT(ic))))
     return;
 
   /* find the registers in use at this time
@@ -1796,16 +1797,8 @@ saveRegisters (iCode * lic)
       }
 
   detype = getSpec (operandType (IC_LEFT (ic)));
-
-#if 0 // why should we do this here??? jwk20011105
-  if (detype &&
-      (SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
-      IS_ISR (currFunc->etype) &&
-      !ic->bankSaved)
-    saveRBank (SPEC_BANK (detype), ic, TRUE);
-#endif
-
 }
+
 /*-----------------------------------------------------------------*/
 /* unsaveRegisters - pop the pushed registers                      */
 /*-----------------------------------------------------------------*/
@@ -2183,11 +2176,11 @@ genCall (iCode * ic)
 
   D (emitcode (";", "genCall "););
 
-  /* if we are calling a function that is not using
+  /* if we are calling a not _naked function that is not using
      the same register bank then we need to save the
      destination registers on the stack */
   detype = getSpec (operandType (IC_LEFT (ic)));
-  if (detype &&
+  if (detype && !SPEC_NAKED(detype) &&
       (SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
       IS_ISR (currFunc->etype))
   {
index cdffd0028e905f1051d01ee3e4b0bc27e20be442..b2aa0866c80bbe948e11d831c408ecc3dccebd6c 100644 (file)
@@ -2210,7 +2210,7 @@ packForPush (iCode * ic, eBBlock * ebp)
   /* make sure the right side does not have any definitions
      inbetween */
   dbv = OP_DEFS(IC_RIGHT(dic));
-  for (lic = ic; lic != dic ; lic = lic->prev) {
+  for (lic = ic; lic && lic != dic ; lic = lic->prev) {
          if (bitVectBitValue(dbv,lic->key)) return ;
   }
   /* make sure they have the same type */
index 8a97a2ec59840c869a0cf93a546c53c161bbdd2b..94f8ad07509db025408dbd796dd195f638155f04 100644 (file)
@@ -1443,9 +1443,10 @@ saveRegisters (iCode * lic)
       return;
     }
 
-  /* if the registers have been saved already then
+  /* if the registers have been saved already or don't need to be then
      do nothing */
-  if (ic->regsSaved || (OP_SYMBOL (IC_LEFT (ic))->calleeSave))
+  if (ic->regsSaved || (OP_SYMBOL (IC_LEFT (ic))->calleeSave) ||
+      SPEC_NAKED(OP_SYM_ETYPE(IC_LEFT (ic))))
     return;
 
   /* find the registers in use at this time
@@ -1484,14 +1485,6 @@ saveRegisters (iCode * lic)
 
   detype = getSpec (operandType (IC_LEFT (ic)));
 
-#if 0 // why should we do this here??? jwk20011105
-  if (detype &&
-      (SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
-      IS_ISR (currFunc->etype) &&
-      !ic->bankSaved)
-    saveRBank (SPEC_BANK (detype), ic, TRUE);
-#endif
-
 }
 /*-----------------------------------------------------------------*/
 /* unsaveRegisters - pop the pushed registers                      */
@@ -1872,11 +1865,11 @@ genCall (iCode * ic)
       _G.sendSet = NULL;
     }
 
-  /* if we are calling a function that is not using
+  /* if we are calling a not _naked function that is not using
      the same register bank then we need to save the
      destination registers on the stack */
   detype = getSpec (operandType (IC_LEFT (ic)));
-  if (detype &&
+  if (detype && !SPEC_NAKED(detype) &&
       (SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
       IS_ISR (currFunc->etype))
   {