On 09/27/2012 04:58 PM, Vladimir Makarov wrote:
The following patch modifies some code in the rest of compiler for
correct work of LRA. The code works the same way when LRA is not
used. It is achieved by checking a new variable lra_in_progress.
2012-09-27 Vladimir Makarov <vmaka...@redhat.com>
* rtlanal.c (simplify_subreg_regno): Permit ARG_POINTER_REGNUM and
STACK_POINTER_REGNU for LRA.
* jump.c (true_regnum): Always use hard_regno for subreg_get_info when
lra is in progress.
* expr.c (emit_move_insn_1): Pass an additional argument to
emit_move_via_integer. Use emit_move_via_integer for LRA only if
the insn is recognized.
* recog.c (general_operand, register_operand): Accept paradoxical
FLOAD_MODE
subregs for LRA.
(scratch_operand): Accept pseudos for LRA.
* emit-rtl.c (gen_rtx_REG): Add lra_in_progress.
(validate_subreg): Don't check offset for LRA and
floating point modes.
* rtl.h (lra_in_progress): New external.
* ira.c (lra_in_progress): Define.
s/FLOAD/FLOAT/ to fix ChangeLog typo.
Index: jump.c
===================================================================
--- jump.c (revision 191771)
+++ jump.c (working copy)
@@ -1868,7 +1868,8 @@ true_regnum (const_rtx x)
{
if (REG_P (x))
{
- if (REGNO (x) >= FIRST_PSEUDO_REGISTER && reg_renumber[REGNO (x)] >= 0)
+ if (REGNO (x) >= FIRST_PSEUDO_REGISTER
+ && (lra_in_progress || reg_renumber[REGNO (x)] >= 0))
return reg_renumber[REGNO (x)];
return REGNO (x);
}
This hunk doesn't make any sense to me, unless you want true_regnum to
return a negative value during LRA for cases where the pseudo is still
unassigned. Is that what's you're intending here? If that's what you
want, then I think it's worth a quick comment.
@@ -1880,7 +1881,8 @@ true_regnum (const_rtx x)
{
struct subreg_info info;
- subreg_get_info (REGNO (SUBREG_REG (x)),
+ subreg_get_info (lra_in_progress
+ ? (unsigned) base : REGNO (SUBREG_REG (x)),
GET_MODE (SUBREG_REG (x)),
SUBREG_BYTE (x), GET_MODE (x), &info);
I'd be good to indicate why you want to do something different for LRA
here.
Index: rtlanal.c
===================================================================
--- rtlanal.c (revision 191771)
+++ rtlanal.c (working copy)
@@ -3465,7 +3465,9 @@ simplify_subreg_regno (unsigned int xreg
/* Give the backend a chance to disallow the mode change. */
if (GET_MODE_CLASS (xmode) != MODE_COMPLEX_INT
&& GET_MODE_CLASS (xmode) != MODE_COMPLEX_FLOAT
- && REG_CANNOT_CHANGE_MODE_P (xregno, xmode, ymode))
+ && REG_CANNOT_CHANGE_MODE_P (xregno, xmode, ymode)
+ /* We can use mode change in LRA for some transformations. */
+ && ! lra_in_progress)
return -1;
#endif
I don't think this change is reflected in the ChangeLog.
I think just the minor ChangeLog updates and clarification of the
changes to jump.c are all that's needed for this patch to be approved.
jeff