Added labeldef stuff
This commit is contained in:
parent
e9a6af1a42
commit
be802650ca
2 changed files with 54 additions and 8 deletions
|
@ -57,10 +57,16 @@ string holstr(n) word n; {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef REGVARS
|
||||||
|
full lbytes;
|
||||||
|
#endif
|
||||||
|
|
||||||
prolog(nlocals) full nlocals; {
|
prolog(nlocals) full nlocals; {
|
||||||
|
|
||||||
fputs("push ebp\nmov ebp,esp\n", codefile);
|
fputs("push ebp\nmov ebp,esp\n", codefile);
|
||||||
if (nlocals == 0) return;
|
#ifdef REGVARS
|
||||||
|
lbytes = nlocals;
|
||||||
|
#else
|
||||||
#ifdef NOTDEF
|
#ifdef NOTDEF
|
||||||
probably not better on 386.
|
probably not better on 386.
|
||||||
switch(nlocals) {
|
switch(nlocals) {
|
||||||
|
@ -77,6 +83,7 @@ prolog(nlocals) full nlocals; {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REGVARS
|
#ifdef REGVARS
|
||||||
|
@ -105,6 +112,22 @@ i_regsave()
|
||||||
|
|
||||||
f_regsave()
|
f_regsave()
|
||||||
{
|
{
|
||||||
|
if (si_off == -lbytes) lbytes -= 4;
|
||||||
|
if (di_off == -lbytes) lbytes -= 4;
|
||||||
|
if (si_off == -lbytes) lbytes -= 4;
|
||||||
|
if (lbytes) fprintf(codefile, "\tsub\tesp,%ld\n",(long) lbytes);
|
||||||
|
if (firstreg == 1) {
|
||||||
|
fputs("push edi\n", codefile);
|
||||||
|
if (si_off != -1) fputs("push esi\n", codefile);
|
||||||
|
}
|
||||||
|
else if (firstreg == -1) {
|
||||||
|
fputs("push esi\n", codefile);
|
||||||
|
if (di_off != -1) fputs("push edi\n", codefile);
|
||||||
|
}
|
||||||
|
if (si_off >= 0)
|
||||||
|
fprintf(codefile, "mov esi,%ld(ebp)\n", si_off);
|
||||||
|
if (di_off >= 0)
|
||||||
|
fprintf(codefile, "mov edi,%ld(ebp)\n", di_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
regsave(regstr, off, size)
|
regsave(regstr, off, size)
|
||||||
|
@ -114,16 +137,10 @@ regsave(regstr, off, size)
|
||||||
if (strcmp(regstr, "esi") == 0) {
|
if (strcmp(regstr, "esi") == 0) {
|
||||||
if (! firstreg) firstreg = -1;
|
if (! firstreg) firstreg = -1;
|
||||||
si_off = off;
|
si_off = off;
|
||||||
fputs("push esi\n", codefile);
|
|
||||||
if (off >= 0)
|
|
||||||
fprintf(codefile, "mov esi,%ld(ebp)\n", off);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (! firstreg) firstreg = 1;
|
if (! firstreg) firstreg = 1;
|
||||||
di_off = off;
|
di_off = off;
|
||||||
fputs("push edi\n", codefile);
|
|
||||||
if (off >= 0)
|
|
||||||
fprintf(codefile, "mov edi,%ld(ebp)\n", off);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2062,6 +2062,16 @@ pat cui leaving cuu
|
||||||
|
|
||||||
pat cuu
|
pat cuu
|
||||||
|
|
||||||
|
pat loc loc cii zeq $1==1
|
||||||
|
with GENREG STACK
|
||||||
|
gen test %1.1
|
||||||
|
je {label, $4}
|
||||||
|
|
||||||
|
pat loc loc cii zne $1==1
|
||||||
|
with GENREG STACK
|
||||||
|
gen test %1.1
|
||||||
|
jne {label, $4}
|
||||||
|
|
||||||
pat loc loc cii loc and zeq $4<256 && $4>=0 && $5==4 && $1==1 && $2==4
|
pat loc loc cii loc and zeq $4<256 && $4>=0 && $5==4 && $1==1 && $2==4
|
||||||
leaving loc $4 and $5 zeq $6
|
leaving loc $4 and $5 zeq $6
|
||||||
pat loc loc cii loc and zne $4<256 && $4>=0 && $5==4 && $1==1 && $2==4
|
pat loc loc cii loc and zne $4<256 && $4>=0 && $5==4 && $1==1 && $2==4
|
||||||
|
@ -2620,7 +2630,26 @@ pat loc cmu zne $1<256 && $1>=0 && $2==4 call loccmuzxx("jne")
|
||||||
* Group 13 : Branch Instructions *
|
* Group 13 : Branch Instructions *
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
pat bra
|
pat lab topeltsize($1)==4 && !fallthrough($1)
|
||||||
|
with STACK
|
||||||
|
kills ALL
|
||||||
|
gen labeldef $1 yields eax
|
||||||
|
|
||||||
|
pat lab topeltsize($1)==4 && fallthrough($1)
|
||||||
|
with ACC STACK
|
||||||
|
kills ALL
|
||||||
|
gen labeldef $1 yields eax
|
||||||
|
|
||||||
|
pat lab topeltsize($1)!=4
|
||||||
|
with STACK
|
||||||
|
kills ALL
|
||||||
|
gen labeldef $1
|
||||||
|
|
||||||
|
pat bra topeltsize($1)==4
|
||||||
|
with ACC STACK
|
||||||
|
gen jmp {label,$1}
|
||||||
|
|
||||||
|
pat bra topeltsize($1)!=4
|
||||||
with STACK
|
with STACK
|
||||||
gen jmp {label,$1}
|
gen jmp {label,$1}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue