From a20b87ca011d70ed25d98634d36302434289d5f4 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Thu, 16 Feb 2017 19:55:52 -0500 Subject: [PATCH] In ego, put both words and double-words in reg_float. The size of a reg_float isn't in the descr file, so ego doesn't know. PowerPC and SPARC are the only arches with floating-point registers in their descr files. PowerPC and SPARC registers can hold both 4-byte and 8-byte floats, so I want ego to do both sizes. This might break our SPARC code expander because ego doesn't know that 8-byte values take 2 registers in SPARC. (So ego might allocate too many registers and deallocate too much stack space.) We don't build the SPARC code expander, and its descr file is already wrong: its list of register save costs is too short, so ego will read past the end of the array. This commit doesn't fix the problem with ego and PowerPC ncg. Right now, ncg refuses to put 4-byte floats in registers, but ego expects them to get registers and deallocates their stack space. So ncg emits programs that use the deallocated space, and the values of 4-byte floats become corrupt. --- util/ego/ra/ra_profits.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/ego/ra/ra_profits.c b/util/ego/ra/ra_profits.c index 9e5f563b5..cfb82bcb7 100644 --- a/util/ego/ra/ra_profits.c +++ b/util/ego/ra/ra_profits.c @@ -69,7 +69,8 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out) cond_p m = (cond_p) 0; if (localtyp == reg_loop) localtyp = reg_any; - if (size == ws || size ==ps && totyp == reg_pointer) { + if (size == ws || size == ps && totyp == reg_pointer || + size == 2 * ws && totyp == reg_float) { switch(itemtyp) { case LOCALVAR: m = alocaltab[localtyp][totyp];