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]

Why does only the SH port need currently_expanding_to_rtl?


Hi Joern,

Currently we have a hack in cfgexpand, solely for SH, to tell the
backends when we are expanding from trees to RTL.  I added that
hack yesterday as a replacement for rtx_equal_function_value_matters,
which was necessary once for the RTL inliner, but was also being
(ab)used in the ia64 and SH backends to tell if the compiler is
in the process of expanding trees to RTL.  I replaced it with a
global variable set and unset while expanding to RTL, see
currently_expanding_to_rtl.

The code in ia64.c that used rtx_equal_function_value_matters was
not reachable, and that code was removed today.  So now it is only
SH that needs this horrible hack.  I don't understand why, would
you mind explaining it please?  For example, it is used in sh.md
as follows:

(define_insn_and_split "load_ra"
  [(set (match_operand:SI 0 "general_movdst_operand" "")
	(unspec:SI [(match_operand 1 "register_operand" "")] UNSPEC_RA))]
  "TARGET_SH1"
  "#"
  "&& ! currently_expanding_to_rtl"
  [(set (match_dup 0) (match_dup 1))]
  "
{
  if (TARGET_SHCOMPACT && current_function_has_nonlocal_label)
    operands[1] = gen_rtx_MEM (SImode, return_address_pointer_rtx);
}")

See also define_expands "seq", "slt", "sgt", "sge", "sgtu", "sltu",
"sleu", "sgeu", and "sne", and in sh.c four times, three times with
the following comment:

      /* Don't expand fine-grained when combining, because that will
         make the pattern fail.  */
      if (currently_expanding_to_rtl
          || reload_in_progress || reload_completed)

I think it is quite strange that only SH would need this hack, and I
would really like to just get rid of currently_expanding_to_rtl.  Can
you look at this and say if you really need this, and if so, please
explain why?

Gr.
Steven



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