This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Fix PR 20413


On Tue, 12 Apr 2005, Joern RENNECKE wrote:
> >On Mon, 11 Apr 2005, Joern RENNECKE wrote:
> >>2005-04-11  J"orn Rennecke <joern.rennecke@st.com>
> >>	    Stephen Clarke <stevec@superh.com>
> >>
> >>	* cfgrtl.c (redirect_edge_and_branch): Use Pmode instead of
> >>	VOIDmode for LABEL_REF.
> >>	* final.c (shorten_branches): Likewise.
> >>	* jump.c (mark_all_labels, redirect_exp_1): Likewise.
> >>	* loop.c (reg_dead_after_loop): Likewise.
> >>	* varasm.c (decode_addr_const): Likewise.


Sorry for the delay.  Your arguments have convinced me.  This patch
is OK for mainline, with the additional documentation hunk below
(which is a modified version of the same text as symbol_ref).


Index: rtl.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/rtl.texi,v
retrieving revision 1.83
diff -c -3 -p -r1.83 rtl.texi
*** rtl.texi    15 Apr 2005 10:24:11 -0000      1.83
--- rtl.texi    23 Apr 2005 13:27:43 -0000
*************** The @code{symbol_ref} contains a mode, w
*** 1390,1396 ****
  Usually that is the only mode for which a symbol is directly valid.

  @findex label_ref
! @item (label_ref @var{label})
  Represents the value of an assembler label for code.  It contains one
  operand, an expression, which must be a @code{code_label} or a @code{note}
  of type @code{NOTE_INSN_DELETED_LABEL} that appears in the instruction
--- 1390,1396 ----
  Usually that is the only mode for which a symbol is directly valid.

  @findex label_ref
! @item (label_ref:@var{mode} @var{label})
  Represents the value of an assembler label for code.  It contains one
  operand, an expression, which must be a @code{code_label} or a @code{note}
  of type @code{NOTE_INSN_DELETED_LABEL} that appears in the instruction
*************** sequence to identify the place where the
*** 1399,1404 ****
--- 1399,1407 ----
  The reason for using a distinct expression type for code label
  references is so that jump optimization can distinguish them.

+ The @code{label_ref} contains a mode, which is usually @code{Pmode}.
+ Usually that is the only mode for which a label is directly valid.
+
  @item (const:@var{m} @var{exp})
  Represents a constant that is the result of an assembly-time
  arithmetic computation.  The operand, @var{exp}, is an expression that




At the moment the middle-end appears to be creating a mix of Pmode
and VOIDmode LABEL_REFs, both with a history dating back to the
start of the current CVS era.  I hope there aren't any targets
that rely on LABEL_REFs being VOIDmode (which currently can't be
relied upon), and as Joern points out we currently miss optimization
opportunities because two LABEL_REFs to the same label may not
compare equal due to mismatched modes.

There have been no objections to Joern's change, except mine :),
so we'll see how things work out.  If this patch breaks anything
please let me know.

p.s. Remember to mention PR rtl-optimization/20413 in the ChangeLog
entry.

Thanks,

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]