many fixes; got working afcc with this version
This commit is contained in:
parent
e713e6f8fe
commit
a96f33ef34
5 changed files with 41 additions and 32 deletions
|
@ -51,14 +51,12 @@ C_lxa
|
||||||
|
|
||||||
C_loi
|
C_loi
|
||||||
$1 == 1 ==> "pop ecx";
|
$1 == 1 ==> "pop ecx";
|
||||||
"movzx eax, (ecx)";
|
"movzxb eax, (ecx)";
|
||||||
"push eax".
|
"push eax".
|
||||||
|
|
||||||
$1 == 2 ==> "pop ecx";
|
$1 == 2 ==> "pop ecx";
|
||||||
"xor eax,eax";
|
"movzx eax, (ecx)";
|
||||||
"o16";
|
"push eax".
|
||||||
"mov eax, (ecx)";
|
|
||||||
"push (eax)".
|
|
||||||
|
|
||||||
$1 == 4 ==> "pop eax";
|
$1 == 4 ==> "pop eax";
|
||||||
"push (eax)".
|
"push (eax)".
|
||||||
|
@ -116,8 +114,7 @@ C_sti
|
||||||
|
|
||||||
$1 == 2 ==> "pop eax";
|
$1 == 2 ==> "pop eax";
|
||||||
"pop ecx";
|
"pop ecx";
|
||||||
"o16";
|
"movw (eax),ecx".
|
||||||
"mov (eax),ecx".
|
|
||||||
|
|
||||||
$1 == 4 ==> "pop eax";
|
$1 == 4 ==> "pop eax";
|
||||||
"pop (eax)".
|
"pop (eax)".
|
||||||
|
@ -342,6 +339,11 @@ C_dvf
|
||||||
"add esp,8".
|
"add esp,8".
|
||||||
default ==> arg_error("C_dvf", $1).
|
default ==> arg_error("C_dvf", $1).
|
||||||
|
|
||||||
|
C_ngf
|
||||||
|
$1 == 4 ==> "call .ngf4".
|
||||||
|
$1 == 8 ==> "call .ngf8".
|
||||||
|
default ==> arg_error("C_ngf", $1).
|
||||||
|
|
||||||
C_fif
|
C_fif
|
||||||
$1 == 4 ==> C_lor((arith)1);
|
$1 == 4 ==> C_lor((arith)1);
|
||||||
"call .fif4";
|
"call .fif4";
|
||||||
|
@ -356,7 +358,7 @@ C_fef
|
||||||
"sub eax,4";
|
"sub eax,4";
|
||||||
"push eax";
|
"push eax";
|
||||||
"call .fef4".
|
"call .fef4".
|
||||||
$1 == 8 ==> "mov eax,esp"
|
$1 == 8 ==> "mov eax,esp";
|
||||||
"sub eax,4";
|
"sub eax,4";
|
||||||
"push eax";
|
"push eax";
|
||||||
"call .fef8".
|
"call .fef8".
|
||||||
|
@ -1101,6 +1103,6 @@ C_jump ==> "jmp $1".
|
||||||
C_prolog ==> .
|
C_prolog ==> .
|
||||||
|
|
||||||
C_locals
|
C_locals
|
||||||
$1 < 32767 ==> "enter $1,0".
|
==> "push ebp";
|
||||||
default ==> "enter 0,0";
|
"mov ebp,esp";
|
||||||
"sub esp, $1".
|
"sub esp, $1".
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
EMHOME = ../../..
|
EMHOME = ../../..
|
||||||
CEG = $(EMHOME)/lib/ceg/util
|
CEG = $(EMHOME)/lib/ceg/util
|
||||||
VERSION = make_obj
|
OBJ = obj
|
||||||
|
|
||||||
all:
|
all:
|
||||||
make -f $(CEG)/$(VERSION)
|
make -f $(CEG)/make_asobj "OBJ="$(OBJ)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
make -f $(CEG)/$(VERSION) install
|
make -f $(CEG)/make_asobj "OBJ="$(OBJ) install
|
||||||
|
|
||||||
cmp:
|
cmp:
|
||||||
-make -f $(CEG)/$(VERSION) cmp
|
-make -f $(CEG)/make_asobj "OBJ="$(OBJ) cmp
|
||||||
|
|
||||||
pr:
|
pr:
|
||||||
@pr Makefile EM_table mach.h mach.c as_table as.h as.c
|
@pr Makefile EM_table mach.h mach.c as_table as.h as.c
|
||||||
|
@ -19,8 +19,8 @@ opr:
|
||||||
|
|
||||||
# total cleanup
|
# total cleanup
|
||||||
clean:
|
clean:
|
||||||
make -f $(CEG)/$(VERSION) clean
|
make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
|
||||||
|
|
||||||
# only remove ce, ceg, and back directories
|
# only remove ce, ceg, and back directories
|
||||||
dclean:
|
dclean:
|
||||||
make -f $(CEG)/$(VERSION) dclean
|
make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean
|
||||||
|
|
|
@ -56,11 +56,11 @@ struct t_operand *op;
|
||||||
* expr(reg) -> IS_MEM
|
* expr(reg) -> IS_MEM
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char *ptr, *index();
|
char *ptr, *strindex();
|
||||||
|
|
||||||
op->type = UNKNOWN;
|
op->type = UNKNOWN;
|
||||||
if ( *last( str) == RIGHT) {
|
if ( *last( str) == RIGHT) {
|
||||||
ptr = index( str, LEFT);
|
ptr = strindex( str, LEFT);
|
||||||
*last( str) = '\0';
|
*last( str) = '\0';
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
if ( is_reg( ptr+1, op)) {
|
if ( is_reg( ptr+1, op)) {
|
||||||
|
@ -147,10 +147,10 @@ set_label( str, op)
|
||||||
char *str;
|
char *str;
|
||||||
struct t_operand *op;
|
struct t_operand *op;
|
||||||
{
|
{
|
||||||
char *ptr, *index(), *sprint();
|
char *ptr, *strindex(), *sprint();
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
|
|
||||||
ptr = index( str, '+');
|
ptr = strindex( str, '+');
|
||||||
|
|
||||||
if ( ptr == 0)
|
if ( ptr == 0)
|
||||||
op->off = "0";
|
op->off = "0";
|
||||||
|
@ -167,7 +167,7 @@ struct t_operand *op;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
op->type = IS_LABEL;
|
op->type = IS_LABEL;
|
||||||
if ( index( str, DOLLAR) != 0)
|
if ( strindex( str, DOLLAR) != 0)
|
||||||
op->lab = str;
|
op->lab = str;
|
||||||
else
|
else
|
||||||
op->lab = sprint( buf, "\"%s\"", str);
|
op->lab = sprint( buf, "\"%s\"", str);
|
||||||
|
@ -325,7 +325,7 @@ small_const(opc, src)
|
||||||
@text1(%$(src->expr));
|
@text1(%$(src->expr));
|
||||||
@else
|
@else
|
||||||
@text1(%d(opc));
|
@text1(%d(opc));
|
||||||
@text1(%$(src->expr));
|
@text4(%$(src->expr));
|
||||||
@fi
|
@fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ small_RMconst(opc, reg, dst, src)
|
||||||
@else
|
@else
|
||||||
@text1(%d(opc));
|
@text1(%d(opc));
|
||||||
mod_RM(reg, dst);
|
mod_RM(reg, dst);
|
||||||
@text1(%$(src->expr));
|
@text4(%$(src->expr));
|
||||||
@fi
|
@fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,42 +55,42 @@ jb dst:ILB ==> @text1( 0x72);
|
||||||
@text1( %dist( dst->lab)).
|
@text1( %dist( dst->lab)).
|
||||||
|
|
||||||
... dst:lABEL ==> @text1(0x0f);
|
... dst:lABEL ==> @text1(0x0f);
|
||||||
@text1(0x12);
|
@text1(0x82);
|
||||||
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
||||||
|
|
||||||
je dst:ILB ==> @text1( 0x74);
|
je dst:ILB ==> @text1( 0x74);
|
||||||
@text1( %dist( dst->lab)).
|
@text1( %dist( dst->lab)).
|
||||||
|
|
||||||
... dst:lABEL ==> @text1(0x0f);
|
... dst:lABEL ==> @text1(0x0f);
|
||||||
@text1(0x14);
|
@text1(0x84);
|
||||||
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
||||||
|
|
||||||
jg dst:ILB ==> @text1( 0x7f);
|
jg dst:ILB ==> @text1( 0x7f);
|
||||||
@text1( %dist( dst->lab)).
|
@text1( %dist( dst->lab)).
|
||||||
|
|
||||||
... dst:lABEL ==> @text1(0x0f);
|
... dst:lABEL ==> @text1(0x0f);
|
||||||
@text1(0x1f);
|
@text1(0x8f);
|
||||||
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
||||||
|
|
||||||
jge dst:ILB ==> @text1( 0x7d);
|
jge dst:ILB ==> @text1( 0x7d);
|
||||||
@text1( %dist( dst->lab)).
|
@text1( %dist( dst->lab)).
|
||||||
|
|
||||||
... dst:lABEL ==> @text1(0x0f);
|
... dst:lABEL ==> @text1(0x0f);
|
||||||
@text1(0x1d);
|
@text1(0x8d);
|
||||||
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
||||||
|
|
||||||
jl dst:ILB ==> @text1( 0x7c);
|
jl dst:ILB ==> @text1( 0x7c);
|
||||||
@text1( %dist( dst->lab)).
|
@text1( %dist( dst->lab)).
|
||||||
|
|
||||||
... dst:lABEL ==> @text1(0x0f);
|
... dst:lABEL ==> @text1(0x0f);
|
||||||
@text1(0x1c);
|
@text1(0x8c);
|
||||||
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
||||||
|
|
||||||
jle dst:ILB ==> @text1( 0x7e);
|
jle dst:ILB ==> @text1( 0x7e);
|
||||||
@text1( %dist( dst->lab)).
|
@text1( %dist( dst->lab)).
|
||||||
|
|
||||||
... dst:lABEL ==> @text1(0x0f);
|
... dst:lABEL ==> @text1(0x0f);
|
||||||
@text1(0x1e);
|
@text1(0x8e);
|
||||||
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
@reloc4( %$(dst->lab), %$(dst->off), PC_REL).
|
||||||
|
|
||||||
jmp dst:ILB ==> @text1( 0xeb);
|
jmp dst:ILB ==> @text1( 0xeb);
|
||||||
|
@ -128,9 +128,17 @@ mov dst:REG, src:EADDR ==> mv_RG_EADDR( dst, src).
|
||||||
mod_RM( 0, dst);
|
mod_RM( 0, dst);
|
||||||
@reloc4( %$(src->lab), %$(src->off), ABSOLUTE).
|
@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);
|
movb dst:EADDR, src:REG ==> @text1( 0x88);
|
||||||
mod_RM( src->reg, dst).
|
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);
|
movzx dst:REG, src:EADDR ==> @text1(0x0f);
|
||||||
@text1(0xb7);
|
@text1(0xb7);
|
||||||
mod_RM(dst->reg, src).
|
mod_RM(dst->reg, src).
|
||||||
|
@ -144,8 +152,6 @@ neg dst:EADDR ==> @text1( 0xf7);
|
||||||
not dst:EADDR ==> @text1( 0xf7);
|
not dst:EADDR ==> @text1( 0xf7);
|
||||||
mod_RM( 2, dst).
|
mod_RM( 2, dst).
|
||||||
|
|
||||||
o16 ==> @text1(0x66).
|
|
||||||
|
|
||||||
or dst:REG, src:EADDR ==> @text1( 0x0b);
|
or dst:REG, src:EADDR ==> @text1( 0x0b);
|
||||||
mod_RM( dst->reg, src).
|
mod_RM( dst->reg, src).
|
||||||
|
|
||||||
|
@ -167,7 +173,7 @@ push src:REG ==> R53( 0xa, src->reg).
|
||||||
|
|
||||||
... src:DATA ==> small_const(0x68, src).
|
... src:DATA ==> small_const(0x68, src).
|
||||||
|
|
||||||
... src:lABEL ==> @emit1(0x68);
|
... src:lABEL ==> @text1(0x68);
|
||||||
@reloc4(%$(src->lab), %$(src->off), ABSOLUTE).
|
@reloc4(%$(src->lab), %$(src->off), ABSOLUTE).
|
||||||
|
|
||||||
... src:EADDR ==> @text1( 0xff);
|
... src:EADDR ==> @text1( 0xff);
|
||||||
|
|
|
@ -20,6 +20,7 @@ int val;
|
||||||
return( val >= -128 && val <= 127);
|
return( val >= -128 && val <= 127);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define IEEEFLOAT
|
||||||
#include <con_float>
|
#include <con_float>
|
||||||
|
|
||||||
/* as long as we generate assembler ...
|
/* as long as we generate assembler ...
|
||||||
|
|
Loading…
Reference in a new issue