rtl.texi: Document the rtl classes and their relation to formats.

1999-04-26 09:47 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
	* rtl.texi: Document the rtl classes and their relation to
	formats.

From-SVN: r26641
This commit is contained in:
Zack Weinberg 1999-04-26 06:48:57 +00:00 committed by Zack Weinberg
parent 3af5b6b508
commit b89d20aa3c
2 changed files with 95 additions and 45 deletions

View File

@ -1,3 +1,8 @@
1999-04-26 09:47 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* rtl.texi: Document the rtl classes and their relation to
formats.
Mon Apr 26 01:02:38 1999 Richard Henderson <rth@cygnus.com> Mon Apr 26 01:02:38 1999 Richard Henderson <rth@cygnus.com>
* alpha.md (fix_trunc patterns): Use reg_no_subreg_operand on op0 * alpha.md (fix_trunc patterns): Use reg_no_subreg_operand on op0

View File

@ -20,6 +20,7 @@ form uses nested parentheses to indicate the pointers in the internal form.
@menu @menu
* RTL Objects:: Expressions vs vectors vs strings vs integers. * RTL Objects:: Expressions vs vectors vs strings vs integers.
* RTL Classes:: Categories of RTL expresion objects, and their structure.
* Accessors:: Macros to access expression operands or vector elts. * Accessors:: Macros to access expression operands or vector elts.
* Flags:: Other flags in an RTL expression. * Flags:: Other flags in an RTL expression.
* Machine Modes:: Describing the size and format of a datum. * Machine Modes:: Describing the size and format of a datum.
@ -39,7 +40,7 @@ form uses nested parentheses to indicate the pointers in the internal form.
* Reading RTL:: Reading textual RTL from a file. * Reading RTL:: Reading textual RTL from a file.
@end menu @end menu
@node RTL Objects, Accessors, RTL, RTL @node RTL Objects, RTL Classes, RTL, RTL
@section RTL Object Types @section RTL Object Types
@cindex RTL object types @cindex RTL object types
@ -108,11 +109,68 @@ manual, they are shown as follows: @code{const_int}.
In a few contexts a null pointer is valid where an expression is normally In a few contexts a null pointer is valid where an expression is normally
wanted. The written form of this is @code{(nil)}. wanted. The written form of this is @code{(nil)}.
@node Accessors, Flags, RTL Objects, RTL @node RTL Classes, Accessors, RTL Objects, RTL
@section Access to Operands @section RTL Classes and Formats
@cindex accessors @cindex RTL classes
@cindex access to operands @cindex classes of RTX codes
@cindex operand access @cindex RTX codes, classes of
@findex GET_RTX_CLASS
The various expression codes are divided into several @dfn{classes},
which are represented by single characters. You can determine the class
of an RTX code with the macro @code{GET_RTX_CLASS (@var{code})}.
Currently, @file{rtx.def} defines these classes:
@table @code
@item o
An RTX code that represents an actual object, such as a register
(@code{REG}) or a memory location (@code{MEM}, @code{SYMBOL_REF}).
Constants and basic transforms on objects (@code{ADDRESSOF},
@code{HIGH}, @code{LO_SUM}) are also included. Note that @code{SUBREG}
and @code{STRICT_LOW_PART} are not in this class, but in class @code{x}.
@item <
An RTX code for a comparison, such as @code{NE} or @code{LT}.
@item 1
An RTX code for a unary arithmetic operation, such as @code{NEG},
@code{NOT}, or @code{ABS}. This category also includes value extension
(sign or zero) and conversions between integer and floating point.
@item c
An RTX code for a commutative binary operation, such as @code{PLUS} or
@code{AND}. @code{NE} and @code{EQ} are comparisons, so they have class
@code{<}.
@item 2
An RTX code for a non-commutative binary operation, such as @code{MINUS},
@code{DIV}, or @code{ASHIFTRT}.
@item b
An RTX code for a bitfield operation. Currently only
@code{ZERO_EXTRACT} and @code{SIGN_EXTRACT}. These have three inputs
and are lvalues (so they can be used for insertion as well). @xref{Bit
Fields}.
@item 3
An RTX code for other three input operations. Currently only
@code{IF_THEN_ELSE}.
@item i
An RTX code for an entire instruction: @code{INSN}, @code{JUMP_INSN}, and
@code{CALL_INSN}. @xref{Insns}.
@item m
An RTX code for something that matches in insns, such as
@code{MATCH_DUP}. These only occur in machine descriptions.
@item x
All other RTX codes. This category includes the remaining codes used
only in machine descriptions (@code{DEFINE_*}, etc.). It also includes
all the codes describing side effects (@code{SET}, @code{USE},
@code{CLOBBER}, etc.) and the non-insns that may appear on an insn
chain, such as @code{NOTE}, @code{BARRIER}, and @code{CODE_LABEL}.
@end table
@cindex RTL format @cindex RTL format
For each expression type @file{rtl.def} specifies the number of For each expression type @file{rtl.def} specifies the number of
@ -120,7 +178,7 @@ contained objects and their kinds, with four possibilities: @samp{e} for
expression (actually a pointer to an expression), @samp{i} for integer, expression (actually a pointer to an expression), @samp{i} for integer,
@samp{w} for wide integer, @samp{s} for string, and @samp{E} for vector @samp{w} for wide integer, @samp{s} for string, and @samp{E} for vector
of expressions. The sequence of letters for an expression code is of expressions. The sequence of letters for an expression code is
called its @dfn{format}. Thus, the format of @code{subreg} is called its @dfn{format}. For example, the format of @code{subreg} is
@samp{ei}.@refill @samp{ei}.@refill
@cindex RTL format characters @cindex RTL format characters
@ -154,8 +212,8 @@ An omitted vector is effectively the same as a vector of no elements.
special ways by small parts of the compiler. special ways by small parts of the compiler.
@end table @end table
There are macros to get the number of operands, the format, and the There are macros to get the number of operands and the format
class of an expression code: of an expression code:
@table @code @table @code
@findex GET_RTX_LENGTH @findex GET_RTX_LENGTH
@ -165,53 +223,40 @@ Number of operands of an RTX of code @var{code}.
@findex GET_RTX_FORMAT @findex GET_RTX_FORMAT
@item GET_RTX_FORMAT (@var{code}) @item GET_RTX_FORMAT (@var{code})
The format of an RTX of code @var{code}, as a C string. The format of an RTX of code @var{code}, as a C string.
@end table
@findex GET_RTX_CLASS Some classes of RTX codes always have the same format. For example, it
@cindex classes of RTX codes is safe to assume that all comparison operations have format @code{ee}.
@item GET_RTX_CLASS (@var{code})
A single character representing the type of RTX operation that code
@var{code} performs.
The following classes are defined:
@table @code @table @code
@item o @item 1
An RTX code that represents an actual object, such as @code{reg} or All codes of this class have format @code{e}.
@code{mem}. @code{subreg} is not in this class.
@item < @item <
An RTX code for a comparison. The codes in this class are @itemx c
@code{NE}, @code{EQ}, @code{LE}, @code{LT}, @code{GE}, @code{GT}, @itemx 2
@code{LEU}, @code{LTU}, @code{GEU}, @code{GTU}.@refill All codes of these classes have format @code{ee}.
@item 1
An RTX code for a unary arithmetic operation, such as @code{neg}.
@item c
An RTX code for a commutative binary operation, other than @code{NE}
and @code{EQ} (which have class @samp{<}).
@item 2
An RTX code for a noncommutative binary operation, such as @code{MINUS}.
@item b @item b
An RTX code for a bitfield operation, either @code{ZERO_EXTRACT} or @itemx 3
@code{SIGN_EXTRACT}. All codes of these classes have format @code{eee}.
@item 3
An RTX code for other three input operations, such as @code{IF_THEN_ELSE}.
@item i @item i
An RTX code for a machine insn (@code{INSN}, @code{JUMP_INSN}, and All codes of this class have formats that begin with @code{iuueiee}.
@code{CALL_INSN}).@refill @xref{Insns}. Note that not all RTL objects linked onto an insn chain
are of class @code{i}.
@item m @item o
An RTX code for something that matches in insns, such as @code{MATCH_DUP}. @itemx m
@itemx x
You can make no assumptions about the format of these codes.
@end table
@item x @node Accessors, Flags, RTL Classes, RTL
All other RTX codes. @section Access to Operands
@end table @cindex accessors
@end table @cindex access to operands
@cindex operand access
@findex XEXP @findex XEXP
@findex XINT @findex XINT