This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: computation_cost too blind to hard regs
- From: DJ Delorie <dj at redhat dot com>
- To: bosch at adacore dot com
- Cc: rth at redhat dot com, gcc at gcc dot gnu dot org, wilson at specifixinc dot com
- Date: Mon, 21 Feb 2005 19:36:33 -0500
- Subject: Re: computation_cost too blind to hard regs
- References: <200501172207.j0HM7uqs024276@greed.delorie.com> <41EF0734.7020208@specifixinc.com> <200501200219.j0K2JwEc001468@greed.delorie.com> <20050120034815.GA15007@redhat.com> <FA1C3022-6A99-11D9-B68A-000393754BEA@adacore.com>
> 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 ();