son of subreg rtl documentation

Ulrich Weigand uweigand@de.ibm.com
Mon Apr 14 16:42:00 GMT 2008


Kenneth Zadeck wrote:

> @item mem
> @code{subreg}s of @code{mem} were common in earlier versions of GCC and
> are still supported.  During the reload pass these are replaced by plain
> @code{mem}s.  On machines that do not do instruction scheduling, use of
> @code{subreg}s of @code{mem} are still used, but this is no longer
> recommended.  Such @code{subreg}s are considered to be
> @code{register_operand}s rather than @code{memory_operand}s before and
> during reload.  Because of this, the scheduling passes cannot properly
> schedule instructions with @code{subreg}s of @code{mem}, so for machines
> that do scheduling, @code{subreg}s of @code{mem} should never be used.
> To support this, the combine and recog passes have explicit code to
> inhibit the creation of @code{subreg}s of @code{mem} when
> @code{INSN_SCHEDULING} is defined.

I don't think this paragraph completely describes current behaviour.
For example, the reload pass only replaces subregs that appear as 
operands, not subregs that are part of the insn pattern.  Also, 
combine will definitely create subregs of mem even on machines that
*do* define INSN_SCHEDULING (see the list of examples for s390).

Maybe this whole issue would be more easily understandable if the
documentation were split into two separate parts:

- The core semantics of SUBREG as part of the RTL language
  This would cover:
    * which RTX are valid to appear inside a subreg in general
    * semantics of normal vs. paradoxical subreg
    * special LOAD_EXTEND_OP / SUBREG_PROMOTED semantics

  These should be stated in the form of invariant properties of
  the RTL language that are valid throughout all compilation passes
  and independently of where the subreg appears in an RTX

- Handling of *insn operands* containing a SUBREG
  This would cover:
    * special rules when subregs (of what?) are accepted as 
      (parts of) operands by the standard predicates
    * treatment of subreg operands before/during/after reload
 
  This part should mention the INSN_SCHEDULING related changes etc.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com



More information about the Gcc-patches mailing list