> On Jan 19, 2005, at 22:48, Richard Henderson wrote:
> > On Wed, Jan 19, 2005 at 09:19:58PM -0500, DJ Delorie wrote:
> >> - int regno = 0;
> >> + int regno = FIRST_PSEUDO_REGISTER;
> >
> > To be totally safe, you need LAST_VIRTUAL_REGISTER+1.
>
> Also, this definitely needs a comment.
Ok, I'm back. How's this?
* tree-ssa-loop-ivopts.c (computation_cost): Start register
numbering at LAST_VIRTUAL_REGISTER+1 to avoid possibly using hard
registers in unsupported ways.
* expmed.c (init_expmed): Likewise.
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.224
diff -p -U3 -r1.224 expmed.c
--- expmed.c 18 Feb 2005 12:06:00 -0000 1.224
+++ expmed.c 22 Feb 2005 00:35:19 -0000
@@ -145,7 +145,8 @@ init_expmed (void)
memset (&all, 0, sizeof all);
PUT_CODE (&all.reg, REG);
- REGNO (&all.reg) = 10000;
+ /* Avoid using hard regs in ways which may be unsupported. */
+ REGNO (&all.reg) = LAST_VIRTUAL_REGISTER + 1;
PUT_CODE (&all.plus, PLUS);
XEXP (&all.plus, 0) = &all.reg;
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.48
diff -p -U3 -r2.48 tree-ssa-loop-ivopts.c
--- tree-ssa-loop-ivopts.c 17 Feb 2005 16:19:45 -0000 2.48
+++ tree-ssa-loop-ivopts.c 22 Feb 2005 00:35:19 -0000
@@ -2427,7 +2427,8 @@ computation_cost (tree expr)
rtx seq, rslt;
tree type = TREE_TYPE (expr);
unsigned cost;
- int regno = 0;
+ /* Avoid using hard regs in ways which may be unsupported. */
+ int regno = LAST_VIRTUAL_REGISTER + 1;
walk_tree (&expr, prepare_decl_rtl, ®no, NULL);
start_sequence ();