fixed undefined _ESP in main.c
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 15 Nov 2001 14:14:24 +0000 (14:14 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 15 Nov 2001 14:14:24 +0000 (14:14 +0000)
fixed genPcall() for screwing dptr
optimized genCall for dptr use
fixed/extended funptr.s

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

src/ds390/gen.c
src/ds390/main.c
support/regression/ports/ds390/spec.mk
support/regression/ports/mcs51/spec.mk
support/regression/tests/funptrs.c

index af8ec011652b686201e2d01252da6acfc99b961f..a7bf72eae82cf6f99de6d296a5ad1d0183bb79dd 100644 (file)
@@ -2256,6 +2256,7 @@ genCall (iCode * ic)
        {
          int size, offset = 0;
 
+#if 0
          aopOp (IC_LEFT (sic), sic, FALSE, FALSE);
          size = AOP_SIZE (IC_LEFT (sic));
 
@@ -2291,6 +2292,29 @@ genCall (iCode * ic)
                                    fReturn[size], regs390[size].name);
              }
          }
+#else
+         // we know that dpl(hxb) is the result, so
+         _startLazyDPSEvaluation ();
+         size=getSize(operandType(IC_LEFT(sic)));
+         if (size>1) {
+           aopOp (IC_LEFT (sic), sic, FALSE, TRUE);
+         } else {
+           aopOp (IC_LEFT (sic), sic, FALSE, FALSE);
+         }
+         while (size--)
+           {
+             char *l = aopGet (AOP (IC_LEFT (sic)), offset,
+                               FALSE, FALSE, TRUE);
+             if (strcmp (l, fReturn[offset]))
+               {
+                 emitcode ("mov", "%s,%s",
+                           fReturn[offset],
+                           l);
+               }
+             offset++;
+           }
+         _endLazyDPSEvaluation ();
+#endif
          freeAsmop (IC_LEFT (sic), NULL, sic, TRUE);
        }
       _G.sendSet = NULL;
@@ -2443,9 +2467,14 @@ genPcall (iCode * ic)
        {
          int size, offset = 0;
 
-         aopOp (IC_LEFT (sic), sic, FALSE, FALSE);
-         size = AOP_SIZE (IC_LEFT (sic));
+         // we know that dpl(hxb) is the result, so
          _startLazyDPSEvaluation ();
+         size=getSize(operandType(IC_LEFT(sic)));
+         if (size>1) {
+           aopOp (IC_LEFT (sic), sic, FALSE, TRUE);
+         } else {
+           aopOp (IC_LEFT (sic), sic, FALSE, FALSE);
+         }
          while (size--)
            {
              char *l = aopGet (AOP (IC_LEFT (sic)), offset,
index f343ebaf3031a7940b2c5de95995f4ddcbd53808..0cefd4b725a1c64cb12d768055fe615ee4f2e6cf 100644 (file)
@@ -169,6 +169,7 @@ _ds390_genAssemblerPreamble (FILE * of)
       fputs ("mb = 0xD4\t\t; mb register unknown to assembler\n", of);
       fputs ("mc = 0xD5\t\t; mc register unknown to assembler\n", of);
       fputs ("F1 = 0xD1\t\t; F1 user flag unknown to assembler\n", of);
+      fputs ("_ESP = 0x9B\t\t; ESP user flag unknown to assembler\n", of);
 }
 
 /* Generate interrupt vector table. */
@@ -205,11 +206,11 @@ _ds390_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
 static bool cseCostEstimation (iCode *ic, iCode *pdic)
 {
     operand *result = IC_RESULT(ic);
-    operand *right  = IC_RIGHT(ic);
-    operand *left   = IC_LEFT(ic);
+    //operand *right  = IC_RIGHT(ic);
+    //operand *left   = IC_LEFT(ic);
     sym_link *result_type = operandType(result);
-    sym_link *right_type  = (right ? operandType(right) : 0);
-    sym_link *left_type   = (left  ? operandType(left)  : 0);
+    //sym_link *right_type  = (right ? operandType(right) : 0);
+    //sym_link *left_type   = (left  ? operandType(left)  : 0);
     
     /* if it is a pointer then return ok for now */
     if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
index ff6a68e3c317d27d31dbce9de553de520a0961a5..26d3080045982d28cc639c922c2b28a46bed8053 100644 (file)
@@ -19,10 +19,10 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 %$(OBJEXT): %.c
        $(SDCC) $(SDCCFLAGS) -c $<
 
-# run simulator with 5 seconds timeout
+# run simulator with 10 seconds timeout
 %.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
-       -fwk/lib/timeout 5 $(S51) -tds390f -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd >/dev/null || \
+       -fwk/lib/timeout 10 $(S51) -tds390f -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd >/dev/null || \
           echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
index 91eb9461e5261217e6c2330cd1552dfc103178a2..560f14eb909527d4e6435c275f437625f9f647af 100644 (file)
@@ -21,10 +21,10 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 %$(OBJEXT): %.c
        $(SDCC) $(SDCCFLAGS) -c $<
 
-# run simulator with 5 seconds timeout
+# run simulator with 10 seconds timeout
 %.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
-       -fwk/lib/timeout 6 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
+       -fwk/lib/timeout 10 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
          || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
index 3e584cf5269ebcc60e59bcc23543cdfc0fa9327d..1e2e7e1e73ca7701c4eb71d61c7086533e26b717 100644 (file)
@@ -1,4 +1,6 @@
 /** Function pointer tests.
+
+    type: char, int, long
  */
 #include <testfwk.h>
 
@@ -6,7 +8,7 @@
    on the z80.
 */
 typedef void (*NOARGFUNPTR)(void);
-typedef void (*ONEARGFUNPTR)(int) REENTRANT;
+typedef void (*ONEARGFUNPTR)({type}) REENTRANT;
 
 int count;
 
@@ -17,7 +19,7 @@ incCount(void)
 }
 
 void
-incBy(int a) REENTRANT
+incBy({type} a) REENTRANT
 {
   count += a;
 }
@@ -29,7 +31,7 @@ callViaPtr(NOARGFUNPTR fptr)
 }
 
 void
-callViaPtr2(ONEARGFUNPTR fptr, int arg)
+callViaPtr2(ONEARGFUNPTR fptr, {type} arg)
 {
   (*fptr)(arg);
 }