use general as pointer flag added

This commit is contained in:
ceriel 1989-03-07 10:24:32 +00:00
parent 15449606d1
commit 23f2646704
9 changed files with 21 additions and 8 deletions

View file

@ -4,6 +4,7 @@ pointersize: 2
general registers: 2 general registers: 2
address registers: 0 address registers: 0
floating point registers: 0 floating point registers: 0
use general as pointer: yes
register score parameters: register score parameters:
local variable: local variable:

View file

@ -4,6 +4,7 @@ pointersize: 4
general registers: 5 general registers: 5
address registers: 4 address registers: 4
floating point registers: 0 floating point registers: 0
use general as pointer: no
register score parameters: register score parameters:
local variable: local variable:
@ -69,7 +70,7 @@ opening cost parameters:
register save costs: register save costs:
(11 cases) (11 cases)
0 -> (0,0) 0 -> (0,0)
1 -> (12,4) 1 -> (12,6)
2 -> (24,8) 2 -> (24,8)
3 -> (34,8) 3 -> (34,8)
4 -> (42,8) 4 -> (42,8)
@ -102,4 +103,4 @@ do not eliminate sli if index on shiftcounts: 1 2 3 -1
1 2 3 -1 1 2 3 -1
forbidden operators: -1 -1 forbidden operators: -1 -1
%%SP %%SP
global stack pollution allowed?: no global stack pollution allowed?: yes

View file

@ -4,6 +4,7 @@ pointersize: 4
general registers: 5 general registers: 5
address registers: 4 address registers: 4
floating point registers: 0 floating point registers: 0
use general as pointer: no
register score parameters: register score parameters:
local variable: local variable:

View file

@ -4,6 +4,7 @@ pointersize: 4
general registers: 5 general registers: 5
address registers: 4 address registers: 4
floating point registers: 0 floating point registers: 0
use general as pointer: no
register score parameters: register score parameters:
local variable: local variable:

View file

@ -4,6 +4,7 @@ pointersize: 2
general registers: 2 general registers: 2
address registers: 0 address registers: 0
floating point registers: 0 floating point registers: 0
use general as pointer: yes
register score parameters: register score parameters:
local variable: local variable:

View file

@ -4,6 +4,7 @@ pointersize: 4
general registers: 8 general registers: 8
address registers: 0 address registers: 0
floating point registers: 0 floating point registers: 0
use general as pointer: yes
register score parameters: register score parameters:
local variable: local variable:

View file

@ -52,6 +52,8 @@ short regs_available[] = {
0 /* reg_float */ 0 /* reg_float */
} ; } ;
short use_any_as_pointer = 0;
STATIC cond_p getcondtab(f) STATIC cond_p getcondtab(f)
FILE *f; FILE *f;
{ {
@ -114,6 +116,7 @@ STATIC ra_machinit(f)
fscanf(f,"%hd",&regs_available[reg_any]); fscanf(f,"%hd",&regs_available[reg_any]);
fscanf(f,"%hd",&regs_available[reg_pointer]); fscanf(f,"%hd",&regs_available[reg_pointer]);
fscanf(f,"%hd",&regs_available[reg_float]); fscanf(f,"%hd",&regs_available[reg_float]);
fscanf(f,"%hd",&use_any_as_pointer);
get_atab(f,alocaltab); get_atab(f,alocaltab);
get_atab(f,alocaddrtab); get_atab(f,alocaddrtab);
aconsttab = getcondtab(f); aconsttab = getcondtab(f);

View file

@ -36,6 +36,9 @@ typedef struct time *time_p;
extern short regs_available[]; /* contains #registers of every type */ 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 /* A thing that can be put in a register is called an "item". The are several

View file

@ -65,7 +65,7 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out)
offset off; offset off;
short *time_out, *space_out; short *time_out, *space_out;
{ {
cond_p m; cond_p m = (cond_p) 0;
if (localtyp == reg_loop) localtyp = reg_any; if (localtyp == reg_loop) localtyp = reg_any;
if (size == ws || size ==ps && totyp == reg_pointer) { 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]; m = alocaltab[localtyp][totyp];
break; break;
case LOCAL_ADDR: case LOCAL_ADDR:
m = alocaddrtab[localtyp][totyp]; if (use_any_as_pointer || totyp == reg_pointer)
m = alocaddrtab[localtyp][totyp];
break; break;
case CONST: case CONST:
m = aconsttab; m = aconsttab;
@ -83,14 +84,14 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out)
m = aconsttab; m = aconsttab;
break; break;
case GLOBL_ADDR: case GLOBL_ADDR:
m = aglobaltab; if (use_any_as_pointer || totyp == reg_pointer)
m = aglobaltab;
break; break;
case PROC_ADDR: case PROC_ADDR:
m = aproctab; if (use_any_as_pointer || totyp == reg_pointer)
m = aproctab;
break; break;
} }
} else {
m = (cond_p) 0;
} }
*time_out = (m == (cond_p) 0 ? -1 : map_value(m,off,TRUE)); *time_out = (m == (cond_p) 0 ? -1 : map_value(m,off,TRUE));
*space_out = (m == (cond_p) 0 ? -1 : map_value(m,off,FALSE)); *space_out = (m == (cond_p) 0 ? -1 : map_value(m,off,FALSE));