From 23f26467047ad1e521a5e2c0a931c1f8352992c0 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 7 Mar 1989 10:24:32 +0000 Subject: [PATCH] use general as pointer flag added --- util/ego/descr/i86.descr | 1 + util/ego/descr/m68020.descr | 5 +++-- util/ego/descr/m68k2.descr | 1 + util/ego/descr/m68k4.descr | 1 + util/ego/descr/pdp.descr | 1 + util/ego/descr/vax4.descr | 1 + util/ego/ra/ra.c | 3 +++ util/ego/ra/ra.h | 3 +++ util/ego/ra/ra_profits.c | 13 +++++++------ 9 files changed, 21 insertions(+), 8 deletions(-) diff --git a/util/ego/descr/i86.descr b/util/ego/descr/i86.descr index 3ac0f92e2..1d2217e72 100644 --- a/util/ego/descr/i86.descr +++ b/util/ego/descr/i86.descr @@ -4,6 +4,7 @@ pointersize: 2 general registers: 2 address registers: 0 floating point registers: 0 +use general as pointer: yes register score parameters: local variable: diff --git a/util/ego/descr/m68020.descr b/util/ego/descr/m68020.descr index bff86c0af..8fe2c56ab 100644 --- a/util/ego/descr/m68020.descr +++ b/util/ego/descr/m68020.descr @@ -4,6 +4,7 @@ pointersize: 4 general registers: 5 address registers: 4 floating point registers: 0 +use general as pointer: no register score parameters: local variable: @@ -69,7 +70,7 @@ opening cost parameters: register save costs: (11 cases) 0 -> (0,0) - 1 -> (12,4) + 1 -> (12,6) 2 -> (24,8) 3 -> (34,8) 4 -> (42,8) @@ -102,4 +103,4 @@ do not eliminate sli if index on shiftcounts: 1 2 3 -1 1 2 3 -1 forbidden operators: -1 -1 %%SP -global stack pollution allowed?: no +global stack pollution allowed?: yes diff --git a/util/ego/descr/m68k2.descr b/util/ego/descr/m68k2.descr index bd4bf4365..9f525d46a 100644 --- a/util/ego/descr/m68k2.descr +++ b/util/ego/descr/m68k2.descr @@ -4,6 +4,7 @@ pointersize: 4 general registers: 5 address registers: 4 floating point registers: 0 +use general as pointer: no register score parameters: local variable: diff --git a/util/ego/descr/m68k4.descr b/util/ego/descr/m68k4.descr index d834b7ddf..3c0ffd7e0 100644 --- a/util/ego/descr/m68k4.descr +++ b/util/ego/descr/m68k4.descr @@ -4,6 +4,7 @@ pointersize: 4 general registers: 5 address registers: 4 floating point registers: 0 +use general as pointer: no register score parameters: local variable: diff --git a/util/ego/descr/pdp.descr b/util/ego/descr/pdp.descr index f47f222f4..dbdbb0281 100644 --- a/util/ego/descr/pdp.descr +++ b/util/ego/descr/pdp.descr @@ -4,6 +4,7 @@ pointersize: 2 general registers: 2 address registers: 0 floating point registers: 0 +use general as pointer: yes register score parameters: local variable: diff --git a/util/ego/descr/vax4.descr b/util/ego/descr/vax4.descr index 94eebceb4..389d94e15 100644 --- a/util/ego/descr/vax4.descr +++ b/util/ego/descr/vax4.descr @@ -4,6 +4,7 @@ pointersize: 4 general registers: 8 address registers: 0 floating point registers: 0 +use general as pointer: yes register score parameters: local variable: diff --git a/util/ego/ra/ra.c b/util/ego/ra/ra.c index 844efbf2d..ef13c7376 100644 --- a/util/ego/ra/ra.c +++ b/util/ego/ra/ra.c @@ -52,6 +52,8 @@ short regs_available[] = { 0 /* reg_float */ } ; +short use_any_as_pointer = 0; + STATIC cond_p getcondtab(f) FILE *f; { @@ -114,6 +116,7 @@ STATIC ra_machinit(f) fscanf(f,"%hd",®s_available[reg_any]); fscanf(f,"%hd",®s_available[reg_pointer]); fscanf(f,"%hd",®s_available[reg_float]); + fscanf(f,"%hd",&use_any_as_pointer); get_atab(f,alocaltab); get_atab(f,alocaddrtab); aconsttab = getcondtab(f); diff --git a/util/ego/ra/ra.h b/util/ego/ra/ra.h index 5b8511539..fc9bfdbb4 100644 --- a/util/ego/ra/ra.h +++ b/util/ego/ra/ra.h @@ -36,6 +36,9 @@ typedef struct time *time_p; extern short regs_available[]; /* contains #registers of every type */ +extern short use_any_as_pointer;/* indicates whether general registers + can be used as pointers + */ /* A thing that can be put in a register is called an "item". The are several diff --git a/util/ego/ra/ra_profits.c b/util/ego/ra/ra_profits.c index 1d0717c1d..ab17fa789 100644 --- a/util/ego/ra/ra_profits.c +++ b/util/ego/ra/ra_profits.c @@ -65,7 +65,7 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out) offset off; short *time_out, *space_out; { - cond_p m; + cond_p m = (cond_p) 0; if (localtyp == reg_loop) localtyp = reg_any; if (size == ws || size ==ps && totyp == reg_pointer) { @@ -74,7 +74,8 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out) m = alocaltab[localtyp][totyp]; break; case LOCAL_ADDR: - m = alocaddrtab[localtyp][totyp]; + if (use_any_as_pointer || totyp == reg_pointer) + m = alocaddrtab[localtyp][totyp]; break; case CONST: m = aconsttab; @@ -83,14 +84,14 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out) m = aconsttab; break; case GLOBL_ADDR: - m = aglobaltab; + if (use_any_as_pointer || totyp == reg_pointer) + m = aglobaltab; break; case PROC_ADDR: - m = aproctab; + if (use_any_as_pointer || totyp == reg_pointer) + m = aproctab; break; } - } else { - m = (cond_p) 0; } *time_out = (m == (cond_p) 0 ? -1 : map_value(m,off,TRUE)); *space_out = (m == (cond_p) 0 ? -1 : map_value(m,off,FALSE));