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
> There is similar code in init_expmed in expmed.c that uses a register
> number of 10000. The number is arbitrary, but high enough to avoid
> matching hard registers. We could use FIRST_PSEUDO_REGISTER here and it
> would probably work just as well. In this case, though, we avoid
> generating any RTL. We create just enough fake RTL to make rtx_cost happy.
>
> In the computation_cost case, a pseudo-reg number is likewise better
> than a hard reg number, but this one creates RTL. So we need to make
> sure we don't accidentally create a pseudo-reg conflict, but since
> gen_raw_REG is used here, it seems safe to use any pseudo register number.
How about this?
2005-01-19 DJ Delorie <dj@redhat.com>
* tree-ssa-loop-ivopts.c (computation_cost): Start register
numbering at FIRST_PSEUDO_REGISTER to avoid possibly using hard
registers in unsupported ways.
* expmed.c (init_expmed): Likewise.
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.41
diff -p -U3 -r2.41 tree-ssa-loop-ivopts.c
--- tree-ssa-loop-ivopts.c 18 Jan 2005 11:36:27 -0000 2.41
+++ tree-ssa-loop-ivopts.c 20 Jan 2005 02:17:55 -0000
@@ -2261,7 +2261,7 @@ computation_cost (tree expr)
rtx seq, rslt;
tree type = TREE_TYPE (expr);
unsigned cost;
- int regno = 0;
+ int regno = FIRST_PSEUDO_REGISTER;
walk_tree (&expr, prepare_decl_rtl, ®no, NULL);
start_sequence ();
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.214
diff -p -U3 -r1.214 expmed.c
--- expmed.c 10 Dec 2004 15:06:52 -0000 1.214
+++ expmed.c 20 Jan 2005 02:17:56 -0000
@@ -145,7 +145,7 @@ init_expmed (void)
memset (&all, 0, sizeof all);
PUT_CODE (&all.reg, REG);
- REGNO (&all.reg) = 10000;
+ REGNO (&all.reg) = FIRST_PSEUDO_REGISTER;
PUT_CODE (&all.plus, PLUS);
XEXP (&all.plus, 0) = &all.reg;