link instruction does not work for more than 32768 bytes locals on M68000
authorceriel <none@none>
Wed, 15 Nov 1989 16:10:18 +0000 (16:10 +0000)
committerceriel <none@none>
Wed, 15 Nov 1989 16:10:18 +0000 (16:10 +0000)
mach/m68020/ncg/mach.c
mach/m68k2/ncg/mach.c
mach/m68k4/ncg/mach.c
mach/moon3/ncg/mach.c

index f2e5274..2693b1e 100644 (file)
@@ -125,7 +125,10 @@ f_regsave()
 #ifdef TBL68020
        fprintf(codefile,"link\ta6,#-%ld\n",nlocals);
 #else
-       fprintf(codefile,"tst.b -%ld(sp)\nlink\ta6,#-%ld\n",nlocals+40,nlocals);
+       if (nlocals > 32768) {
+               fprintf(codefile, "move.l a6,-(sp)\nmove.l sp,a6\nsub #%ld,sp\ntst.b -40(sp)\n", nlocals);
+       }
+       else    fprintf(codefile,"link\ta6,#-%ld\ntst.b -40(sp)\n",nlocals);
 #endif
        if (regnr > 1) {
                fputs("movem.l ", codefile);
index f2e5274..2693b1e 100644 (file)
@@ -125,7 +125,10 @@ f_regsave()
 #ifdef TBL68020
        fprintf(codefile,"link\ta6,#-%ld\n",nlocals);
 #else
-       fprintf(codefile,"tst.b -%ld(sp)\nlink\ta6,#-%ld\n",nlocals+40,nlocals);
+       if (nlocals > 32768) {
+               fprintf(codefile, "move.l a6,-(sp)\nmove.l sp,a6\nsub #%ld,sp\ntst.b -40(sp)\n", nlocals);
+       }
+       else    fprintf(codefile,"link\ta6,#-%ld\ntst.b -40(sp)\n",nlocals);
 #endif
        if (regnr > 1) {
                fputs("movem.l ", codefile);
index f2e5274..2693b1e 100644 (file)
@@ -125,7 +125,10 @@ f_regsave()
 #ifdef TBL68020
        fprintf(codefile,"link\ta6,#-%ld\n",nlocals);
 #else
-       fprintf(codefile,"tst.b -%ld(sp)\nlink\ta6,#-%ld\n",nlocals+40,nlocals);
+       if (nlocals > 32768) {
+               fprintf(codefile, "move.l a6,-(sp)\nmove.l sp,a6\nsub #%ld,sp\ntst.b -40(sp)\n", nlocals);
+       }
+       else    fprintf(codefile,"link\ta6,#-%ld\ntst.b -40(sp)\n",nlocals);
 #endif
        if (regnr > 1) {
                fputs("movem.l ", codefile);
index f2e5274..2693b1e 100644 (file)
@@ -125,7 +125,10 @@ f_regsave()
 #ifdef TBL68020
        fprintf(codefile,"link\ta6,#-%ld\n",nlocals);
 #else
-       fprintf(codefile,"tst.b -%ld(sp)\nlink\ta6,#-%ld\n",nlocals+40,nlocals);
+       if (nlocals > 32768) {
+               fprintf(codefile, "move.l a6,-(sp)\nmove.l sp,a6\nsub #%ld,sp\ntst.b -40(sp)\n", nlocals);
+       }
+       else    fprintf(codefile,"link\ta6,#-%ld\ntst.b -40(sp)\n",nlocals);
 #endif
        if (regnr > 1) {
                fputs("movem.l ", codefile);