Now _naked should work for function calls too. In fact it more or less
[fw/sdcc] / src / mcs51 / gen.c
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))
   {