diff --git a/util/ego/descr/descr.sed b/util/ego/descr/descr.sed new file mode 100644 index 000000000..993a63d84 --- /dev/null +++ b/util/ego/descr/descr.sed @@ -0,0 +1,22 @@ +s/.*:// +s/(// +s/)// +s/,/ / +s/cases// +s/case// +s/sizes// +s/size// +s/\-\>// +s/pointer/2/g +s/general/0/g +s/fitbyte/1/ +s/default/0/ +s/in_0_63/2/ +s/in_0_8/3/ +s/no/0/g +s/yes/1/g +s/ //g +s/ +/ /g +s/^ // +s/ $// +/^$/d diff --git a/util/ego/descr/i86.descr b/util/ego/descr/i86.descr new file mode 100644 index 000000000..4dc7545cd --- /dev/null +++ b/util/ego/descr/i86.descr @@ -0,0 +1,15 @@ + +wordsize: 2 +pointersize: 2 +%%UD +access costs of global variables: + (1 size) + default -> (4,2) +access costs of local variables: + (1 size) + default -> (4,2) +%%SR +overflow harmful?: no +array bound harmful?: no +%%SP +global stack pollution allowed?: yes diff --git a/util/ego/descr/m68k2.descr b/util/ego/descr/m68k2.descr new file mode 100644 index 000000000..893312feb --- /dev/null +++ b/util/ego/descr/m68k2.descr @@ -0,0 +1,103 @@ +wordsize: 2 +pointersize: 4 +%%RA +general registers: 5 +address registers: 4 +floating point registers: 0 + +register score parameters: + local variable: + (2 cases) + pointer,pointer + (1 size) + default -> (6,3) + general,general + (1 size) + default -> (4,2) + address of local variable: + (2 cases) + pointer,pointer + (1 size) + default -> (0,0) + general,pointer + (1 size) + default -> (2,2) + constant: + (2 sizes) + in_0_8 -> (0,0) + default -> (2,2) + double constant: + (1 size) + default -> (-1,-1) + address of global variable: + (1 size) + default -> (4,4) + address of procedure: + (1 size) + default -> (2,4) + +opening cost parameters: + local variable: + (2 cases) + pointer + (1 size) + default -> (6,4) + general + (1 size) + default -> (8,4) + address of local variable: + (2 cases) + pointer + (1 size) + default -> (4,2) + general + (1 size) + general -> (4,2) + constant: + (1 size) + default -> (4,4) + double constant: + (1 size) + default -> (1000,1000) + address of global variable: + (1 size) + default -> (6,6) + address of procedure: + (1 size) + default -> (6,6) + +register save costs: + (11 cases) + 0 -> (0,0) + 1 -> (12,4) + 2 -> (24,8) + 3 -> (34,8) + 4 -> (42,8) + 5 -> (50,8) + 6 -> (58,8) + 7 -> (66,8) + 8 -> (84,8) + 9 -> (92,8) + 0 -> (0,0) +%%UD +access costs of global variables: + (1 size) + default -> (7,4) +access costs of local variables: + (1 size) + default -> (4,2) +%%SR +overflow harmful?: no +array bound harmful?: no +%%CS +#include "../../../h/em_mnem.h" +first time then space: +addressing modes: op_adp op_lof op_ldf op_loi op_dch op_lpb -1 + op_adp op_lof op_ldf op_loi op_dch op_lpb -1 +cheap operations: -1 -1 +lexical tresholds: 1 1 +indirection limit: 8 +do sli if index?: yes yes +forbidden operators: -1 -1 +%%SP +global stack pollution allowed?: no diff --git a/util/ego/descr/pdp.descr b/util/ego/descr/pdp.descr new file mode 100644 index 000000000..c8bd382d5 --- /dev/null +++ b/util/ego/descr/pdp.descr @@ -0,0 +1,96 @@ +wordsize: 2 +pointersize: 2 +%%RA +general registers: 2 +address registers: 0 +floating point registers: 0 + +register score parameters: + local variable: + (2 cases) + pointer,general + (1 size) + default -> (6,3) + general,general + (1 size) + default -> (4,2) + address of local variable: + (2 cases) + pointer,general + (1 size) + default -> (0,0) + general,general + (1 size) + default -> (2,2) + constant: + (1 sizes) + default -> (2,2) + double constant: + (1 size) + default -> (-1,-1) + address of global variable: + (1 size) + default -> (4,2) + address of procedure: + (1 size) + default -> (2,2) + +opening cost parameters: + local variable: + (2 cases) + pointer + (1 size) + default -> (6,4) + general + (1 size) + default -> (6,4) + address of local variable: + (2 cases) + pointer + (1 size) + default -> (10,6) + general + (1 size) + general -> (10,6) + constant: + (1 size) + default -> (4,4) + double constant: + (1 size) + default -> (1000,1000) + address of global variable: + (1 size) + default -> (6,4) + address of procedure: + (1 size) + default -> (6,4) + +register save costs: + (4 cases) + 0 -> (0,0) + 1 -> (12,0) + 2 -> (24,0) + 0 -> (0,0) +%%UD +access costs of global variables: + (1 size) + default -> (4,2) +access costs of local variables: + (1 size) + default -> (4,2) +%%SR +overflow harmful?: no +array bound harmful?: no +%%CS +#include "../../../h/em_mnem.h" +first time then space: +addressing modes: op_adp op_lof op_ldf op_loi op_dch op_lpb -1 + op_adp op_lof op_ldf op_loi op_dch op_lpb -1 +cheap operations: op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif -1 + op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif -1 +lexical tresholds: 1 1 +indirection limit: 8 +do sli if index?: yes yes +forbidden operators: -1 -1 +%%SP +global stack pollution allowed?: no diff --git a/util/ego/descr/vax2.descr b/util/ego/descr/vax2.descr new file mode 100644 index 000000000..ae82dda2a --- /dev/null +++ b/util/ego/descr/vax2.descr @@ -0,0 +1,116 @@ +wordsize: 2 +pointersize: 4 +%%RA +general registers: 3 +address registers: 5 +floating point registers: 0 + +register score parameters: + local variable: + (2 cases) + pointer,pointer + (2 sizes) + fitbyte -> (5,2) + default -> (4,3) + general,general + (2 sizes) + fitbyte -> (3,1) + default -> (2,2) + address of local variable: + (2 cases) + pointer,pointer + (2 sizes) + fitbyte -> (0,1) + default -> (0,2) + general,pointer + (2 sizes) + fitbyte -> (0,1) + default -> (0,2) + constant: + (3 sizes) + in_0_63 -> (0,0) + fitbyte -> (0,1) + default -> (1,2) + double constant: + (1 size) + default -> (-1,-1) + address of global variable: + (1 size) + default -> (2,4) + address of procedure: + (1 size) + default -> (2,4) + +opening cost parameters: + local variable: + (2 cases) + pointer + (2 sizes) + fitbyte -> (10,4) + default -> (9,5) + general + (2 sizes) + fitbyte -> (8,4) + default -> (7,5) + address of local variable: + (2 cases) + pointer + (2 sizes) + fitbyte -> (0,4) + default -> (0,5) + general + (2 sizes) + fitbyte -> (0,4) + general -> (0,5) + constant: + (3 sizes) + in_0_63 -> (4,2) + fitbyte -> (5,3) + default -> (6,4) + double constant: + (1 size) + default -> (1000,1000) + address of global variable: + (1 size) + default -> (6,7) + address of procedure: + (1 size) + default -> (6,7) + +register save costs: + (10 cases) + 0 -> (0,0) + 1 -> (3,0) + 2 -> (20,0) + 3 -> (20,0) + 4 -> (20,0) + 5 -> (20,0) + 6 -> (20,0) + 7 -> (20,0) + 8 -> (20,0) + 0 -> (0,0) +%%UD +access costs of global variables: + (1 size) + default -> (7,4) +access costs of local variables: + (2 sizes) + fitbyte -> (3,1) + default -> (2,2) +%%SR +overflow harmful?: no +array bound harmful?: no + +%%CS +#include "../../../h/em_mnem.h" +first time then space: +addressing modes: op_adp op_lof op_ldf op_loi op_dch op_lpb -1 + op_adp op_lof op_ldf op_loi op_dch op_lpb -1 +cheap operations: op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif -1 + op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif -1 +lexical tresholds: 1 1 +indirection limit: 8 +do sli if index?: no no +forbidden operators: -1 -1 +%%SP +global stack pollution allowed?: yes diff --git a/util/ego/descr/vax4.descr b/util/ego/descr/vax4.descr new file mode 100644 index 000000000..524c5f873 --- /dev/null +++ b/util/ego/descr/vax4.descr @@ -0,0 +1,114 @@ +wordsize: 4 +pointersize: 4 +%%RA +general registers: 8 +address registers: 0 +floating point registers: 0 + +register score parameters: + local variable: + (2 cases) + pointer,general + (2 sizes) + fitbyte -> (5,2) + default -> (4,3) + general,general + (2 sizes) + fitbyte -> (3,1) + default -> (2,2) + address of local variable: + (2 cases) + pointer,general + (2 sizes) + fitbyte -> (0,1) + default -> (0,2) + general,general + (2 sizes) + fitbyte -> (0,1) + default -> (0,2) + constant: + (3 sizes) + in_0_63 -> (0,0) + fitbyte -> (0,1) + default -> (1,2) + double constant: + (1 size) + default -> (-1,-1) + address of global variable: + (1 size) + default -> (2,4) + address of procedure: + (1 size) + default -> (2,4) + +opening cost parameters: + local variable: + (2 cases) + pointer + (2 sizes) + fitbyte -> (10,4) + default -> (9,5) + general + (2 sizes) + fitbyte -> (8,4) + default -> (7,5) + address of local variable: + (2 cases) + pointer + (2 sizes) + fitbyte -> (0,4) + default -> (0,5) + general + (2 sizes) + fitbyte -> (0,4) + general -> (0,5) + constant: + (3 sizes) + in_0_63 -> (4,2) + fitbyte -> (5,3) + default -> (6,4) + double constant: + (1 size) + default -> (1000,1000) + address of global variable: + (1 size) + default -> (6,7) + address of procedure: + (1 size) + default -> (6,7) + +register save costs: + (8 cases) + 0 -> (0,0) + 1 -> (3,1) + 2 -> (7,3) + 3 -> (20,4) + 4 -> (20,4) + 5 -> (20,4) + 6 -> (20,4) + 0 -> (0,0) +%%UD +access costs of global variables: + (1 size) + default -> (7,4) +access costs of local variables: + (2 sizes) + fitbyte -> (3,1) + default -> (2,2) +%%SR +overflow harmful?: no +array bound harmful?: no + +%%CS +#include "../../../h/em_mnem.h" +first time then space: +addressing modes: op_adp op_lof op_ldf op_loi op_dch op_lpb -1 + op_adp op_lof op_ldf op_loi op_dch op_lpb -1 +cheap operations: op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif -1 + op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif -1 +lexical tresholds: 1 1 +indirection limit: 8 +do sli if index?: no no +forbidden operators: -1 -1 +%%SP +global stack pollution allowed?: no diff --git a/util/ego/share/Makefile b/util/ego/share/Makefile new file mode 100644 index 000000000..ae24af349 --- /dev/null +++ b/util/ego/share/Makefile @@ -0,0 +1,134 @@ +EM=../../.. +EMH=$(EM)/h +EML=$(EM)/lib +CFLAGS=-DVERBOSE -DNOTCOMPACT -O +SRC=types.h def.h debug.h debug.c global.h global.c files.h files.c go.h go.c map.h map.c aux.h aux.c get.h get.c put.h put.c alloc.h alloc.c lset.h lset.c cset.h cset.c parser.h parser.c stack_chg.h stack_chg.c locals.h locals.c init_glob.h init_glob.c + +.SUFFIXES: .m +.c.m: + ack -O -L -c.m $(CFLAGS) $< +all: classdefs.h alloc.o cset.o debug.o files.o go.o global.o lset.o map.o parser.o get.o put.o aux.o stack_chg.o locals.o init_glob.o +optim: classdefs.h alloc.m cset.m debug.m files.m global.m lset.m map.m parser.m get.m put.m stack_chg.m locals.m init_globl.m +classdefs.h: \ + makeclassdef \ + cldefs.src + makeclassdef $(EMH)/em_mnem.h cldefs.src > classdefs.h +makeclassdef: \ + makecldef.c + cc -o makeclassdef makecldef.c +pop_push.h: \ + $(EM)/etc/em_table pop_push.awk + awk -f pop_push.awk < $(EM)/etc/em_table > pop_push.h +lpr: + pr $(SRC) | lpr +opr: + pr $(SRC) | opr +dumpflop: + tar -uf ../../../ego/share/share.tarf $(SRC) Makefile show.c +show: \ + show.c + cc -o show show.c $(EML)/em_data.a +# the next lines are generated automatically +# AUTOAUTOAUTOAUTOAUTOAUTO +alloc.o: alloc.h +alloc.o: debug.h +alloc.o: types.h +aux.o: ../../../h/em_mes.h +aux.o: ../../../h/em_pseu.h +aux.o: ../share/alloc.h +aux.o: ../share/aux.h +aux.o: ../share/debug.h +aux.o: ../share/global.h +aux.o: ../share/map.h +aux.o: ../share/types.h +cset.o: alloc.h +cset.o: cset.h +cset.o: debug.h +cset.o: global.h +cset.o: types.h +debug.o: ../../../h/em_spec.h +debug.o: debug.h +debug.o: def.h +debug.o: global.h +debug.o: types.h +get.o: ../../../h/em_flag.h +get.o: ../../../h/em_mes.h +get.o: ../../../h/em_mnem.h +get.o: ../../../h/em_pseu.h +get.o: ../../../h/em_spec.h +get.o: alloc.h +get.o: aux.h +get.o: cset.h +get.o: debug.h +get.o: def.h +get.o: get.h +get.o: global.h +get.o: lset.h +get.o: map.h +get.o: types.h +global.o: types.h +go.o: ../share/alloc.h +go.o: ../share/debug.h +go.o: ../share/files.h +go.o: ../share/get.h +go.o: ../share/global.h +go.o: ../share/lset.h +go.o: ../share/map.h +go.o: ../share/put.h +go.o: ../share/types.h +init_glob.o: ../share/alloc.h +init_glob.o: ../share/debug.h +init_glob.o: ../share/global.h +init_glob.o: ../share/map.h +init_glob.o: ../share/types.h +locals.o: ../../../h/em_mes.h +locals.o: ../../../h/em_mnem.h +locals.o: ../../../h/em_pseu.h +locals.o: ../../../h/em_spec.h +locals.o: alloc.h +locals.o: aux.h +locals.o: cset.h +locals.o: debug.h +locals.o: def.h +locals.o: get.h +locals.o: global.h +locals.o: locals.h +locals.o: lset.h +locals.o: types.h +lset.o: alloc.h +lset.o: debug.h +lset.o: lset.h +lset.o: types.h +map.o: map.h +map.o: types.h +parser.o: ../../../h/em_mnem.h +parser.o: ../../../h/em_spec.h +parser.o: alloc.h +parser.o: aux.h +parser.o: classdefs.h +parser.o: debug.h +parser.o: global.h +parser.o: lset.h +parser.o: types.h +put.o: ../../../h/em_pseu.h +put.o: ../../../h/em_spec.h +put.o: alloc.h +put.o: debug.h +put.o: def.h +put.o: global.h +put.o: lset.h +put.o: map.h +put.o: put.h +put.o: types.h +show.o: ../../../h/em_flag.h +show.o: ../../../h/em_pseu.h +show.o: ../../../h/em_spec.h +show.o: ../share/def.h +show.o: ../share/global.h +show.o: ../share/types.h +stack_chg.o: ../share/debug.h +stack_chg.o: ../share/global.h +stack_chg.o: ../share/types.h +stack_chg.o: ../../../h/em_mnem.h +stack_chg.o: ../../../h/em_spec.h +stack_chg.o: pop_push.h diff --git a/util/ego/share/cldefs.src b/util/ego/share/cldefs.src new file mode 100644 index 000000000..1ab30b25c --- /dev/null +++ b/util/ego/share/cldefs.src @@ -0,0 +1,69 @@ +op_aar 11 7 +op_adf 2 1 +op_adi 2 1 +op_adp 7 7 +op_ads 4 7 +op_adu 2 1 +op_and 2 1 +op_cff 10 1 +op_cfi 10 1 +op_cfu 10 1 +op_cif 10 1 +op_cii 10 1 +op_ciu 10 1 +op_cmf 2 5 +op_cmi 2 5 +op_cmp 8 5 +op_cms 2 5 +op_cmu 2 5 +op_com 1 1 +op_cuf 10 1 +op_cui 10 1 +op_cuu 10 1 +op_dec 5 5 +op_dup 1 2 +op_dvf 2 1 +op_dvi 2 1 +op_dvu 2 1 +op_fef 2 2 +op_fif 2 2 +op_inc 5 5 +op_ior 2 1 +op_lae 9 7 +op_lal 9 7 +op_ldc 9 6 +op_lde 9 6 +op_ldf 7 6 +op_ldl 9 6 +op_lil 9 5 +op_loc 9 5 +op_loe 9 5 +op_lof 7 5 +op_loi 7 1 +op_lol 9 5 +op_mlf 2 1 +op_mli 2 1 +op_mlu 2 1 +op_ngf 1 1 +op_ngi 1 1 +op_rmi 2 1 +op_rmu 2 1 +op_rol 3 1 +op_ror 3 1 +op_sbf 2 1 +op_sbi 2 1 +op_sbs 6 1 +op_sbu 2 1 +op_sli 3 1 +op_slu 3 1 +op_sri 3 1 +op_sru 3 1 +op_teq 5 5 +op_tge 5 5 +op_tgt 5 5 +op_tle 5 5 +op_tlt 5 5 +op_tne 5 5 +op_xor 2 1 +op_zer 9 1 +op_zrf 9 1 diff --git a/util/ego/share/makedepend b/util/ego/share/makedepend new file mode 100755 index 000000000..733f55b6f --- /dev/null +++ b/util/ego/share/makedepend @@ -0,0 +1,11 @@ +for file in *.c +do ofile=`basename $file .c`.o + grep '^# *include.*"' $file|sed "s/.*\"\(.*\)\".*/$ofile: \1/" +done | sort -u >depend +ed - Makefile <<'!' +/AUTOAUTOAUTO/+,$d +$r depend +w +q +! +rm depend diff --git a/util/ego/share/pop_push.awk b/util/ego/share/pop_push.awk new file mode 100644 index 000000000..3c9a977c1 --- /dev/null +++ b/util/ego/share/pop_push.awk @@ -0,0 +1,15 @@ +BEGIN { + print "char *pop_push[]=" + print "{" + print "\"\"," + switch = 0 +} +/aar/ { + switch = 1 +} + { + if (switch) printf("\"%s\",\n",$3) +} +END { + print "};" +}