many fixes; got working afcc with this version

This commit is contained in:
ceriel 1989-10-10 10:58:30 +00:00
parent e713e6f8fe
commit a96f33ef34
5 changed files with 41 additions and 32 deletions

View file

@ -51,14 +51,12 @@ C_lxa
C_loi
$1 == 1 ==> "pop ecx";
"movzx eax, (ecx)";
"movzxb eax, (ecx)";
"push eax".
$1 == 2 ==> "pop ecx";
"xor eax,eax";
"o16";
"mov eax, (ecx)";
"push (eax)".
"movzx eax, (ecx)";
"push eax".
$1 == 4 ==> "pop eax";
"push (eax)".
@ -116,8 +114,7 @@ C_sti
$1 == 2 ==> "pop eax";
"pop ecx";
"o16";
"mov (eax),ecx".
"movw (eax),ecx".
$1 == 4 ==> "pop eax";
"pop (eax)".
@ -342,6 +339,11 @@ C_dvf
"add esp,8".
default ==> arg_error("C_dvf", $1).
C_ngf
$1 == 4 ==> "call .ngf4".
$1 == 8 ==> "call .ngf8".
default ==> arg_error("C_ngf", $1).
C_fif
$1 == 4 ==> C_lor((arith)1);
"call .fif4";
@ -356,7 +358,7 @@ C_fef
"sub eax,4";
"push eax";
"call .fef4".
$1 == 8 ==> "mov eax,esp"
$1 == 8 ==> "mov eax,esp";
"sub eax,4";
"push eax";
"call .fef8".
@ -1101,6 +1103,6 @@ C_jump ==> "jmp $1".
C_prolog ==> .
C_locals
$1 < 32767 ==> "enter $1,0".
default ==> "enter 0,0";
==> "push ebp";
"mov ebp,esp";
"sub esp, $1".

View file

@ -1,15 +1,15 @@
EMHOME = ../../..
CEG = $(EMHOME)/lib/ceg/util
VERSION = make_obj
OBJ = obj
all:
make -f $(CEG)/$(VERSION)
make -f $(CEG)/make_asobj "OBJ="$(OBJ)
install:
make -f $(CEG)/$(VERSION) install
make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
cmp:
-make -f $(CEG)/$(VERSION) cmp
-make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
pr:
@pr Makefile EM_table mach.h mach.c as_table as.h as.c
@ -19,8 +19,8 @@ opr:
# total cleanup
clean:
make -f $(CEG)/$(VERSION) clean
make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
# only remove ce, ceg, and back directories
dclean:
make -f $(CEG)/$(VERSION) dclean
make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean

View file

@ -56,11 +56,11 @@ struct t_operand *op;
* expr(reg) -> IS_MEM
*/
{
char *ptr, *index();
char *ptr, *strindex();
op->type = UNKNOWN;
if ( *last( str) == RIGHT) {
ptr = index( str, LEFT);
ptr = strindex( str, LEFT);
*last( str) = '\0';
*ptr = '\0';
if ( is_reg( ptr+1, op)) {
@ -147,10 +147,10 @@ set_label( str, op)
char *str;
struct t_operand *op;
{
char *ptr, *index(), *sprint();
char *ptr, *strindex(), *sprint();
static char buf[256];
ptr = index( str, '+');
ptr = strindex( str, '+');
if ( ptr == 0)
op->off = "0";
@ -167,7 +167,7 @@ struct t_operand *op;
}
else {
op->type = IS_LABEL;
if ( index( str, DOLLAR) != 0)
if ( strindex( str, DOLLAR) != 0)
op->lab = str;
else
op->lab = sprint( buf, "\"%s\"", str);
@ -325,7 +325,7 @@ small_const(opc, src)
@text1(%$(src->expr));
@else
@text1(%d(opc));
@text1(%$(src->expr));
@text4(%$(src->expr));
@fi
}
}
@ -356,7 +356,7 @@ small_RMconst(opc, reg, dst, src)
@else
@text1(%d(opc));
mod_RM(reg, dst);
@text1(%$(src->expr));
@text4(%$(src->expr));
@fi
}
}

View file

@ -55,42 +55,42 @@ jb dst:ILB ==> @text1( 0x72);
@text1( %dist( dst->lab)).
... dst:lABEL ==> @text1(0x0f);
@text1(0x12);
@text1(0x82);
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
je dst:ILB ==> @text1( 0x74);
@text1( %dist( dst->lab)).
... dst:lABEL ==> @text1(0x0f);
@text1(0x14);
@text1(0x84);
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
jg dst:ILB ==> @text1( 0x7f);
@text1( %dist( dst->lab)).
... dst:lABEL ==> @text1(0x0f);
@text1(0x1f);
@text1(0x8f);
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
jge dst:ILB ==> @text1( 0x7d);
@text1( %dist( dst->lab)).
... dst:lABEL ==> @text1(0x0f);
@text1(0x1d);
@text1(0x8d);
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
jl dst:ILB ==> @text1( 0x7c);
@text1( %dist( dst->lab)).
... dst:lABEL ==> @text1(0x0f);
@text1(0x1c);
@text1(0x8c);
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
jle dst:ILB ==> @text1( 0x7e);
@text1( %dist( dst->lab)).
... dst:lABEL ==> @text1(0x0f);
@text1(0x1e);
@text1(0x8e);
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
jmp dst:ILB ==> @text1( 0xeb);
@ -128,9 +128,17 @@ mov dst:REG, src:EADDR ==> mv_RG_EADDR( dst, src).
mod_RM( 0, dst);
@reloc4( %$(src->lab), %$(src->off), ABSOLUTE).
movw dst:EADDR, src:REG ==> @text1( 0x66); /* operand size prefix */
@text1( 0x89);
mod_RM( src->reg, dst).
movb dst:EADDR, src:REG ==> @text1( 0x88);
mod_RM( src->reg, dst).
movzxb dst:REG, src:EADDR ==> @text1(0x0f);
@text1(0xb6);
mod_RM(dst->reg, src).
movzx dst:REG, src:EADDR ==> @text1(0x0f);
@text1(0xb7);
mod_RM(dst->reg, src).
@ -144,8 +152,6 @@ neg dst:EADDR ==> @text1( 0xf7);
not dst:EADDR ==> @text1( 0xf7);
mod_RM( 2, dst).
o16 ==> @text1(0x66).
or dst:REG, src:EADDR ==> @text1( 0x0b);
mod_RM( dst->reg, src).
@ -167,7 +173,7 @@ push src:REG ==> R53( 0xa, src->reg).
... src:DATA ==> small_const(0x68, src).
... src:lABEL ==> @emit1(0x68);
... src:lABEL ==> @text1(0x68);
@reloc4(%$(src->lab), %$(src->off), ABSOLUTE).
... src:EADDR ==> @text1( 0xff);

View file

@ -20,6 +20,7 @@ int val;
return( val >= -128 && val <= 127);
}
#define IEEEFLOAT
#include <con_float>
/* as long as we generate assembler ...