This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
match_operator and cleanup_subreg_operands
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard dot Earnshaw at arm dot com
- Date: Sat, 08 Dec 2001 10:56:26 +0000
- Subject: match_operator and cleanup_subreg_operands
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
If we have a match_operator operand in a pattern that matches PLUS, MULT
or MEM, then any subregs within that will be cleaned up by
walk_alter_subreg. However, this doesn't update recog_data.operand, so we
abort if any operand within that operator expression is a subreg
(alter_subreg expects to be passed a subreg, but we don't). The fix is to
test the underlying expression directly, rather than the operand as cached
in recog_data.
2001-12-08 Richard Earnshaw <rearnsha@arm.com>
* final.c (cleanup_subreg_operands): Use recog_data.operand_loc
in test for a subreg.
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.230
diff -p -r1.230 final.c
*** final.c 2001/12/07 12:31:06 1.230
--- final.c 2001/12/08 10:48:35
*************** cleanup_subreg_operands (insn)
*** 2726,2732 ****
extract_insn_cached (insn);
for (i = 0; i < recog_data.n_operands; i++)
{
! if (GET_CODE (recog_data.operand[i]) == SUBREG)
recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]);
else if (GET_CODE (recog_data.operand[i]) == PLUS
|| GET_CODE (recog_data.operand[i]) == MULT
--- 2726,2737 ----
extract_insn_cached (insn);
for (i = 0; i < recog_data.n_operands; i++)
{
! /* The following test cannot use recog_data.operand when tesing
! for a SUBREG: the underlying object might have been changed
! already if we are inside a match_operator expression that
! matches the else clause. Instead we test the underlying
! expression directly. */
! if (GET_CODE (*recog_data.operand_loc[i]) == SUBREG)
recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]);
else if (GET_CODE (recog_data.operand[i]) == PLUS
|| GET_CODE (recog_data.operand[i]) == MULT