rtl.texi revision 103445
190075Sobrien@c Copyright (C) 1988, 1989, 1992, 1994, 1997, 1998, 1999, 2000, 2001, 2002
290075Sobrien@c Free Software Foundation, Inc.
390075Sobrien@c This is part of the GCC manual.
490075Sobrien@c For copying conditions, see the file gcc.texi.
590075Sobrien
690075Sobrien@node RTL
790075Sobrien@chapter RTL Representation
890075Sobrien@cindex RTL representation
990075Sobrien@cindex representation of RTL
1090075Sobrien@cindex Register Transfer Language (RTL)
1190075Sobrien
1290075SobrienMost of the work of the compiler is done on an intermediate representation
1390075Sobriencalled register transfer language.  In this language, the instructions to be
1490075Sobrienoutput are described, pretty much one by one, in an algebraic form that
1590075Sobriendescribes what the instruction does.
1690075Sobrien
1790075SobrienRTL is inspired by Lisp lists.  It has both an internal form, made up of
1890075Sobrienstructures that point at other structures, and a textual form that is used
1990075Sobrienin the machine description and in printed debugging dumps.  The textual
2090075Sobrienform uses nested parentheses to indicate the pointers in the internal form.
2190075Sobrien
2290075Sobrien@menu
2390075Sobrien* RTL Objects::       Expressions vs vectors vs strings vs integers.
2490075Sobrien* RTL Classes::       Categories of RTL expression objects, and their structure.
2590075Sobrien* Accessors::         Macros to access expression operands or vector elts.
2690075Sobrien* Flags::             Other flags in an RTL expression.
2790075Sobrien* Machine Modes::     Describing the size and format of a datum.
2890075Sobrien* Constants::         Expressions with constant values.
2990075Sobrien* Regs and Memory::   Expressions representing register contents or memory.
3090075Sobrien* Arithmetic::        Expressions representing arithmetic on other expressions.
3190075Sobrien* Comparisons::       Expressions representing comparison of expressions.
3290075Sobrien* Bit-Fields::        Expressions representing bit-fields in memory or reg.
3390075Sobrien* Vector Operations:: Expressions involving vector datatypes.
3490075Sobrien* Conversions::       Extending, truncating, floating or fixing.
3590075Sobrien* RTL Declarations::  Declaring volatility, constancy, etc.
3690075Sobrien* Side Effects::      Expressions for storing in registers, etc.
3790075Sobrien* Incdec::            Embedded side-effects for autoincrement addressing.
3890075Sobrien* Assembler::         Representing @code{asm} with operands.
3990075Sobrien* Insns::             Expression types for entire insns.
4090075Sobrien* Calls::             RTL representation of function call insns.
4190075Sobrien* Sharing::           Some expressions are unique; others *must* be copied.
4290075Sobrien* Reading RTL::       Reading textual RTL from a file.
4390075Sobrien@end menu
4490075Sobrien
4590075Sobrien@node RTL Objects
4690075Sobrien@section RTL Object Types
4790075Sobrien@cindex RTL object types
4890075Sobrien
4990075Sobrien@cindex RTL integers
5090075Sobrien@cindex RTL strings
5190075Sobrien@cindex RTL vectors
5290075Sobrien@cindex RTL expression
5390075Sobrien@cindex RTX (See RTL)
5490075SobrienRTL uses five kinds of objects: expressions, integers, wide integers,
5590075Sobrienstrings and vectors.  Expressions are the most important ones.  An RTL
5690075Sobrienexpression (``RTX'', for short) is a C structure, but it is usually
5790075Sobrienreferred to with a pointer; a type that is given the typedef name
5890075Sobrien@code{rtx}.
5990075Sobrien
6090075SobrienAn integer is simply an @code{int}; their written form uses decimal
6190075Sobriendigits.  A wide integer is an integral object whose type is
6290075Sobrien@code{HOST_WIDE_INT}; their written form uses decimal digits.
6390075Sobrien
6490075SobrienA string is a sequence of characters.  In core it is represented as a
6590075Sobrien@code{char *} in usual C fashion, and it is written in C syntax as well.
6690075SobrienHowever, strings in RTL may never be null.  If you write an empty string in
6790075Sobriena machine description, it is represented in core as a null pointer rather
6890075Sobrienthan as a pointer to a null character.  In certain contexts, these null
6990075Sobrienpointers instead of strings are valid.  Within RTL code, strings are most
7090075Sobriencommonly found inside @code{symbol_ref} expressions, but they appear in
7190075Sobrienother contexts in the RTL expressions that make up machine descriptions.
7290075Sobrien
7390075SobrienIn a machine description, strings are normally written with double
7490075Sobrienquotes, as you would in C.  However, strings in machine descriptions may
7590075Sobrienextend over many lines, which is invalid C, and adjacent string
7690075Sobrienconstants are not concatenated as they are in C.  Any string constant
7790075Sobrienmay be surrounded with a single set of parentheses.  Sometimes this
7890075Sobrienmakes the machine description easier to read.
7990075Sobrien
8090075SobrienThere is also a special syntax for strings, which can be useful when C
8190075Sobriencode is embedded in a machine description.  Wherever a string can
8290075Sobrienappear, it is also valid to write a C-style brace block.  The entire
8390075Sobrienbrace block, including the outermost pair of braces, is considered to be
8490075Sobrienthe string constant.  Double quote characters inside the braces are not
8590075Sobrienspecial.  Therefore, if you write string constants in the C code, you
8690075Sobrienneed not escape each quote character with a backslash.
8790075Sobrien
8890075SobrienA vector contains an arbitrary number of pointers to expressions.  The
8990075Sobriennumber of elements in the vector is explicitly present in the vector.
9090075SobrienThe written form of a vector consists of square brackets
9190075Sobrien(@samp{[@dots{}]}) surrounding the elements, in sequence and with
9290075Sobrienwhitespace separating them.  Vectors of length zero are not created;
9390075Sobriennull pointers are used instead.
9490075Sobrien
9590075Sobrien@cindex expression codes
9690075Sobrien@cindex codes, RTL expression
9790075Sobrien@findex GET_CODE
9890075Sobrien@findex PUT_CODE
9990075SobrienExpressions are classified by @dfn{expression codes} (also called RTX
10090075Sobriencodes).  The expression code is a name defined in @file{rtl.def}, which is
10190075Sobrienalso (in upper case) a C enumeration constant.  The possible expression
10290075Sobriencodes and their meanings are machine-independent.  The code of an RTX can
10390075Sobrienbe extracted with the macro @code{GET_CODE (@var{x})} and altered with
10490075Sobrien@code{PUT_CODE (@var{x}, @var{newcode})}.
10590075Sobrien
10690075SobrienThe expression code determines how many operands the expression contains,
10790075Sobrienand what kinds of objects they are.  In RTL, unlike Lisp, you cannot tell
10890075Sobrienby looking at an operand what kind of object it is.  Instead, you must know
10990075Sobrienfrom its context---from the expression code of the containing expression.
11090075SobrienFor example, in an expression of code @code{subreg}, the first operand is
11190075Sobriento be regarded as an expression and the second operand as an integer.  In
11290075Sobrienan expression of code @code{plus}, there are two operands, both of which
11390075Sobrienare to be regarded as expressions.  In a @code{symbol_ref} expression,
11490075Sobrienthere is one operand, which is to be regarded as a string.
11590075Sobrien
11690075SobrienExpressions are written as parentheses containing the name of the
11790075Sobrienexpression type, its flags and machine mode if any, and then the operands
11890075Sobrienof the expression (separated by spaces).
11990075Sobrien
12090075SobrienExpression code names in the @samp{md} file are written in lower case,
12190075Sobrienbut when they appear in C code they are written in upper case.  In this
12290075Sobrienmanual, they are shown as follows: @code{const_int}.
12390075Sobrien
12490075Sobrien@cindex (nil)
12590075Sobrien@cindex nil
12690075SobrienIn a few contexts a null pointer is valid where an expression is normally
12790075Sobrienwanted.  The written form of this is @code{(nil)}.
12890075Sobrien
12990075Sobrien@node RTL Classes
13090075Sobrien@section RTL Classes and Formats
13190075Sobrien@cindex RTL classes
13290075Sobrien@cindex classes of RTX codes
13390075Sobrien@cindex RTX codes, classes of
13490075Sobrien@findex GET_RTX_CLASS
13590075Sobrien
13690075SobrienThe various expression codes are divided into several @dfn{classes},
13790075Sobrienwhich are represented by single characters.  You can determine the class
13890075Sobrienof an RTX code with the macro @code{GET_RTX_CLASS (@var{code})}.
13990075SobrienCurrently, @file{rtx.def} defines these classes:
14090075Sobrien
14190075Sobrien@table @code
14290075Sobrien@item o
14390075SobrienAn RTX code that represents an actual object, such as a register
14490075Sobrien(@code{REG}) or a memory location (@code{MEM}, @code{SYMBOL_REF}).
14590075SobrienConstants and basic transforms on objects (@code{ADDRESSOF},
14690075Sobrien@code{HIGH}, @code{LO_SUM}) are also included.  Note that @code{SUBREG}
14790075Sobrienand @code{STRICT_LOW_PART} are not in this class, but in class @code{x}.
14890075Sobrien
14990075Sobrien@item <
15090075SobrienAn RTX code for a comparison, such as @code{NE} or @code{LT}.
15190075Sobrien
15290075Sobrien@item 1
15390075SobrienAn RTX code for a unary arithmetic operation, such as @code{NEG},
15490075Sobrien@code{NOT}, or @code{ABS}.  This category also includes value extension
15590075Sobrien(sign or zero) and conversions between integer and floating point.
15690075Sobrien
15790075Sobrien@item c
15890075SobrienAn RTX code for a commutative binary operation, such as @code{PLUS} or
15990075Sobrien@code{AND}.  @code{NE} and @code{EQ} are comparisons, so they have class
16090075Sobrien@code{<}.
16190075Sobrien
16290075Sobrien@item 2
16390075SobrienAn RTX code for a non-commutative binary operation, such as @code{MINUS},
16490075Sobrien@code{DIV}, or @code{ASHIFTRT}.
16590075Sobrien
16690075Sobrien@item b
16790075SobrienAn RTX code for a bit-field operation.  Currently only
16890075Sobrien@code{ZERO_EXTRACT} and @code{SIGN_EXTRACT}.  These have three inputs
16990075Sobrienand are lvalues (so they can be used for insertion as well).
17090075Sobrien@xref{Bit-Fields}.
17190075Sobrien
17290075Sobrien@item 3
17390075SobrienAn RTX code for other three input operations.  Currently only
17490075Sobrien@code{IF_THEN_ELSE}.
17590075Sobrien
17690075Sobrien@item i
17790075SobrienAn RTX code for an entire instruction:  @code{INSN}, @code{JUMP_INSN}, and
17890075Sobrien@code{CALL_INSN}.  @xref{Insns}.
17990075Sobrien
18090075Sobrien@item m
18190075SobrienAn RTX code for something that matches in insns, such as
18290075Sobrien@code{MATCH_DUP}.  These only occur in machine descriptions.
18390075Sobrien
18490075Sobrien@item a
18590075SobrienAn RTX code for an auto-increment addressing mode, such as
18690075Sobrien@code{POST_INC}.
18790075Sobrien
18890075Sobrien@item x
18990075SobrienAll other RTX codes.  This category includes the remaining codes used
19090075Sobrienonly in machine descriptions (@code{DEFINE_*}, etc.).  It also includes
19190075Sobrienall the codes describing side effects (@code{SET}, @code{USE},
19290075Sobrien@code{CLOBBER}, etc.) and the non-insns that may appear on an insn
19390075Sobrienchain, such as @code{NOTE}, @code{BARRIER}, and @code{CODE_LABEL}.
19490075Sobrien@end table
19590075Sobrien
19690075Sobrien@cindex RTL format
19790075SobrienFor each expression code, @file{rtl.def} specifies the number of
19890075Sobriencontained objects and their kinds using a sequence of characters
19990075Sobriencalled the @dfn{format} of the expression code.  For example,
20090075Sobrienthe format of @code{subreg} is @samp{ei}.
20190075Sobrien
20290075Sobrien@cindex RTL format characters
20390075SobrienThese are the most commonly used format characters:
20490075Sobrien
20590075Sobrien@table @code
20690075Sobrien@item e
20790075SobrienAn expression (actually a pointer to an expression).
20890075Sobrien
20990075Sobrien@item i
21090075SobrienAn integer.
21190075Sobrien
21290075Sobrien@item w
21390075SobrienA wide integer.
21490075Sobrien
21590075Sobrien@item s
21690075SobrienA string.
21790075Sobrien
21890075Sobrien@item E
21990075SobrienA vector of expressions.
22090075Sobrien@end table
22190075Sobrien
22290075SobrienA few other format characters are used occasionally:
22390075Sobrien
22490075Sobrien@table @code
22590075Sobrien@item u
22690075Sobrien@samp{u} is equivalent to @samp{e} except that it is printed differently
22790075Sobrienin debugging dumps.  It is used for pointers to insns.
22890075Sobrien
22990075Sobrien@item n
23090075Sobrien@samp{n} is equivalent to @samp{i} except that it is printed differently
23190075Sobrienin debugging dumps.  It is used for the line number or code number of a
23290075Sobrien@code{note} insn.
23390075Sobrien
23490075Sobrien@item S
23590075Sobrien@samp{S} indicates a string which is optional.  In the RTL objects in
23690075Sobriencore, @samp{S} is equivalent to @samp{s}, but when the object is read,
23790075Sobrienfrom an @samp{md} file, the string value of this operand may be omitted.
23890075SobrienAn omitted string is taken to be the null string.
23990075Sobrien
24090075Sobrien@item V
24190075Sobrien@samp{V} indicates a vector which is optional.  In the RTL objects in
24290075Sobriencore, @samp{V} is equivalent to @samp{E}, but when the object is read
24390075Sobrienfrom an @samp{md} file, the vector value of this operand may be omitted.
24490075SobrienAn omitted vector is effectively the same as a vector of no elements.
24590075Sobrien
24690075Sobrien@item 0
24790075Sobrien@samp{0} means a slot whose contents do not fit any normal category.
24890075Sobrien@samp{0} slots are not printed at all in dumps, and are often used in
24990075Sobrienspecial ways by small parts of the compiler.
25090075Sobrien@end table
25190075Sobrien
25290075SobrienThere are macros to get the number of operands and the format
25390075Sobrienof an expression code:
25490075Sobrien
25590075Sobrien@table @code
25690075Sobrien@findex GET_RTX_LENGTH
25790075Sobrien@item GET_RTX_LENGTH (@var{code})
25890075SobrienNumber of operands of an RTX of code @var{code}.
25990075Sobrien
26090075Sobrien@findex GET_RTX_FORMAT
26190075Sobrien@item GET_RTX_FORMAT (@var{code})
26290075SobrienThe format of an RTX of code @var{code}, as a C string.
26390075Sobrien@end table
26490075Sobrien
26590075SobrienSome classes of RTX codes always have the same format.  For example, it
26690075Sobrienis safe to assume that all comparison operations have format @code{ee}.
26790075Sobrien
26890075Sobrien@table @code
26990075Sobrien@item 1
27090075SobrienAll codes of this class have format @code{e}.
27190075Sobrien
27290075Sobrien@item <
27390075Sobrien@itemx c
27490075Sobrien@itemx 2
27590075SobrienAll codes of these classes have format @code{ee}.
27690075Sobrien
27790075Sobrien@item b
27890075Sobrien@itemx 3
27990075SobrienAll codes of these classes have format @code{eee}.
28090075Sobrien
28190075Sobrien@item i
28290075SobrienAll codes of this class have formats that begin with @code{iuueiee}.
28390075Sobrien@xref{Insns}.  Note that not all RTL objects linked onto an insn chain
28490075Sobrienare of class @code{i}.
28590075Sobrien
28690075Sobrien@item o
28790075Sobrien@itemx m
28890075Sobrien@itemx x
28990075SobrienYou can make no assumptions about the format of these codes.
29090075Sobrien@end table
29190075Sobrien
29290075Sobrien@node Accessors
29390075Sobrien@section Access to Operands
29490075Sobrien@cindex accessors
29590075Sobrien@cindex access to operands
29690075Sobrien@cindex operand access
29790075Sobrien
29890075Sobrien@findex XEXP
29990075Sobrien@findex XINT
30090075Sobrien@findex XWINT
30190075Sobrien@findex XSTR
30290075SobrienOperands of expressions are accessed using the macros @code{XEXP},
30390075Sobrien@code{XINT}, @code{XWINT} and @code{XSTR}.  Each of these macros takes
30490075Sobrientwo arguments: an expression-pointer (RTX) and an operand number
30590075Sobrien(counting from zero).  Thus,
30690075Sobrien
30790075Sobrien@example
30890075SobrienXEXP (@var{x}, 2)
30990075Sobrien@end example
31090075Sobrien
31190075Sobrien@noindent
31290075Sobrienaccesses operand 2 of expression @var{x}, as an expression.
31390075Sobrien
31490075Sobrien@example
31590075SobrienXINT (@var{x}, 2)
31690075Sobrien@end example
31790075Sobrien
31890075Sobrien@noindent
31990075Sobrienaccesses the same operand as an integer.  @code{XSTR}, used in the same
32090075Sobrienfashion, would access it as a string.
32190075Sobrien
32290075SobrienAny operand can be accessed as an integer, as an expression or as a string.
32390075SobrienYou must choose the correct method of access for the kind of value actually
32490075Sobrienstored in the operand.  You would do this based on the expression code of
32590075Sobrienthe containing expression.  That is also how you would know how many
32690075Sobrienoperands there are.
32790075Sobrien
32890075SobrienFor example, if @var{x} is a @code{subreg} expression, you know that it has
32990075Sobrientwo operands which can be correctly accessed as @code{XEXP (@var{x}, 0)}
33090075Sobrienand @code{XINT (@var{x}, 1)}.  If you did @code{XINT (@var{x}, 0)}, you
33190075Sobrienwould get the address of the expression operand but cast as an integer;
33290075Sobrienthat might occasionally be useful, but it would be cleaner to write
33390075Sobrien@code{(int) XEXP (@var{x}, 0)}.  @code{XEXP (@var{x}, 1)} would also
33490075Sobriencompile without error, and would return the second, integer operand cast as
33590075Sobrienan expression pointer, which would probably result in a crash when
33690075Sobrienaccessed.  Nothing stops you from writing @code{XEXP (@var{x}, 28)} either,
33790075Sobrienbut this will access memory past the end of the expression with
33890075Sobrienunpredictable results.
33990075Sobrien
34090075SobrienAccess to operands which are vectors is more complicated.  You can use the
34190075Sobrienmacro @code{XVEC} to get the vector-pointer itself, or the macros
34290075Sobrien@code{XVECEXP} and @code{XVECLEN} to access the elements and length of a
34390075Sobrienvector.
34490075Sobrien
34590075Sobrien@table @code
34690075Sobrien@findex XVEC
34790075Sobrien@item XVEC (@var{exp}, @var{idx})
34890075SobrienAccess the vector-pointer which is operand number @var{idx} in @var{exp}.
34990075Sobrien
35090075Sobrien@findex XVECLEN
35190075Sobrien@item XVECLEN (@var{exp}, @var{idx})
35290075SobrienAccess the length (number of elements) in the vector which is
35390075Sobrienin operand number @var{idx} in @var{exp}.  This value is an @code{int}.
35490075Sobrien
35590075Sobrien@findex XVECEXP
35690075Sobrien@item XVECEXP (@var{exp}, @var{idx}, @var{eltnum})
35790075SobrienAccess element number @var{eltnum} in the vector which is
35890075Sobrienin operand number @var{idx} in @var{exp}.  This value is an RTX@.
35990075Sobrien
36090075SobrienIt is up to you to make sure that @var{eltnum} is not negative
36190075Sobrienand is less than @code{XVECLEN (@var{exp}, @var{idx})}.
36290075Sobrien@end table
36390075Sobrien
36490075SobrienAll the macros defined in this section expand into lvalues and therefore
36590075Sobriencan be used to assign the operands, lengths and vector elements as well as
36690075Sobriento access them.
36790075Sobrien
36890075Sobrien@node Flags
36990075Sobrien@section Flags in an RTL Expression
37090075Sobrien@cindex flags in RTL expression
37190075Sobrien
37290075SobrienRTL expressions contain several flags (one-bit bit-fields)
37390075Sobrienthat are used in certain types of expression.  Most often they
37490075Sobrienare accessed with the following macros, which expand into lvalues:
37590075Sobrien
37690075Sobrien@table @code
37790075Sobrien@findex CONSTANT_POOL_ADDRESS_P
37890075Sobrien@cindex @code{symbol_ref} and @samp{/u}
37990075Sobrien@cindex @code{unchanging}, in @code{symbol_ref}
38090075Sobrien@item CONSTANT_POOL_ADDRESS_P (@var{x})
38190075SobrienNonzero in a @code{symbol_ref} if it refers to part of the current
38290075Sobrienfunction's constant pool.  For most targets these addresses are in a
38390075Sobrien@code{.rodata} section entirely separate from the function, but for
38490075Sobriensome targets the addresses are close to the beginning of the function.
38590075SobrienIn either case GCC assumes these addresses can be addressed directly,
38690075Sobrienperhaps with the help of base registers.
38790075SobrienStored in the @code{unchanging} field and printed as @samp{/u}.
38890075Sobrien
38990075Sobrien@findex CONST_OR_PURE_CALL_P
39090075Sobrien@cindex @code{call_insn} and @samp{/u}
39190075Sobrien@cindex @code{unchanging}, in @code{call_insn}
39290075Sobrien@item CONST_OR_PURE_CALL_P (@var{x})
39390075SobrienIn a @code{call_insn}, @code{note}, or an @code{expr_list} for notes,
39490075Sobrienindicates that the insn represents a call to a const or pure function.
39590075SobrienStored in the @code{unchanging} field and printed as @samp{/u}.
39690075Sobrien
39790075Sobrien@findex INSN_ANNULLED_BRANCH_P
39890075Sobrien@cindex @code{insn} and @samp{/u}
39990075Sobrien@cindex @code{unchanging}, in @code{insn}
40090075Sobrien@item INSN_ANNULLED_BRANCH_P (@var{x})
40190075SobrienIn an @code{insn} in the delay slot of a branch insn, indicates that an
40290075Sobrienannulling branch should be used.  See the discussion under
40390075Sobrien@code{sequence} below.  Stored in the @code{unchanging} field and printed
40490075Sobrienas @samp{/u}.
40590075Sobrien
40690075Sobrien@findex INSN_DEAD_CODE_P
40790075Sobrien@cindex @code{insn} and @samp{/s}
40890075Sobrien@cindex @code{in_struct}, in @code{insn}
40990075Sobrien@item INSN_DEAD_CODE_P (@var{x})
41090075SobrienIn an @code{insn} during the dead-code elimination pass, nonzero if the
41190075Sobrieninsn is dead.
41290075SobrienStored in the @code{in_struct} field and printed as @samp{/s}.
41390075Sobrien
41490075Sobrien@findex INSN_DELETED_P
41590075Sobrien@cindex @code{insn} and @samp{/v}
41690075Sobrien@cindex @code{volatil}, in @code{insn}
41790075Sobrien@item INSN_DELETED_P (@var{x})
41890075SobrienIn an @code{insn}, nonzero if the insn has been deleted.  Stored in the
41990075Sobrien@code{volatil} field and printed as @samp{/v}.
42090075Sobrien
42190075Sobrien@findex INSN_FROM_TARGET_P
42290075Sobrien@cindex @code{insn} and @samp{/s}
42390075Sobrien@cindex @code{in_struct}, in @code{insn}
42490075Sobrien@item INSN_FROM_TARGET_P (@var{x})
42590075SobrienIn an @code{insn} in a delay slot of a branch, indicates that the insn
42690075Sobrienis from the target of the branch.  If the branch insn has
42790075Sobrien@code{INSN_ANNULLED_BRANCH_P} set, this insn will only be executed if
42890075Sobrienthe branch is taken.  For annulled branches with
42990075Sobrien@code{INSN_FROM_TARGET_P} clear, the insn will be executed only if the
43090075Sobrienbranch is not taken.  When @code{INSN_ANNULLED_BRANCH_P} is not set,
43190075Sobrienthis insn will always be executed.  Stored in the @code{in_struct}
43290075Sobrienfield and printed as @samp{/s}.
43390075Sobrien
43490075Sobrien@findex LABEL_OUTSIDE_LOOP_P
43590075Sobrien@cindex @code{label_ref} and @samp{/s}
43690075Sobrien@cindex @code{in_struct}, in @code{label_ref}
43790075Sobrien@item LABEL_OUTSIDE_LOOP_P (@var{x})
43890075SobrienIn @code{label_ref} expressions, nonzero if this is a reference to a
43990075Sobrienlabel that is outside the innermost loop containing the reference to the
44090075Sobrienlabel.  Stored in the @code{in_struct} field and printed as @samp{/s}.
44190075Sobrien
44290075Sobrien@findex LABEL_PRESERVE_P
44390075Sobrien@cindex @code{code_label} and @samp{/i}
44490075Sobrien@cindex @code{in_struct}, in @code{code_label}
44590075Sobrien@item LABEL_PRESERVE_P (@var{x})
44690075SobrienIn a @code{code_label}, indicates that the label is referenced by
44790075Sobriencode or data not visible to the RTL of a given function.
44890075SobrienLabels referenced by a non-local goto will have this bit set.  Stored
44990075Sobrienin the @code{in_struct} field and printed as @samp{/s}.
45090075Sobrien
45190075Sobrien@findex LABEL_REF_NONLOCAL_P
45290075Sobrien@cindex @code{label_ref} and @samp{/v}
45390075Sobrien@cindex @code{volatil}, in @code{label_ref}
45490075Sobrien@item LABEL_REF_NONLOCAL_P (@var{x})
45590075SobrienIn @code{label_ref} and @code{reg_label} expressions, nonzero if this is
45690075Sobriena reference to a non-local label.
45790075SobrienStored in the @code{volatil} field and printed as @samp{/v}.
45890075Sobrien
45990075Sobrien@findex LINK_COST_FREE
46090075Sobrien@cindex @code{insn_list} and @samp{/c}
46190075Sobrien@cindex @code{call}, in @code{insn_list}
46290075Sobrien@item LINK_COST_FREE (@var{x})
46390075SobrienIn the @code{LOG_LINKS} @code{insn_list} during scheduling, nonzero when
46490075Sobrienthe cost of executing an instruction through the link is zero, i.e., the
46590075Sobrienlink makes the cost free.  Stored in the @code{call} field and printed
46690075Sobrienas @samp{/c}.
46790075Sobrien
46890075Sobrien@findex LINK_COST_ZERO
46990075Sobrien@cindex @code{insn_list} and @samp{/j}
47090075Sobrien@cindex @code{jump}, in @code{insn_list}
47190075Sobrien@item LINK_COST_ZERO (@var{x})
47290075SobrienIn the @code{LOG_LINKS} @code{insn_list} during scheduling, nonzero when
47390075Sobrienthe cost of executing an instruction through the link varies and is
47490075Sobrienunchanged, i.e., the link has zero additional cost.
47590075SobrienStored in the @code{jump} field and printed as @samp{/j}.
47690075Sobrien
47790075Sobrien@findex MEM_IN_STRUCT_P
47890075Sobrien@cindex @code{mem} and @samp{/s}
47990075Sobrien@cindex @code{in_struct}, in @code{mem}
48090075Sobrien@item MEM_IN_STRUCT_P (@var{x})
48190075SobrienIn @code{mem} expressions, nonzero for reference to an entire structure,
48290075Sobrienunion or array, or to a component of one.  Zero for references to a
48390075Sobrienscalar variable or through a pointer to a scalar.  If both this flag and
48490075Sobrien@code{MEM_SCALAR_P} are clear, then we don't know whether this @code{mem}
48590075Sobrienis in a structure or not.  Both flags should never be simultaneously set.
48690075SobrienStored in the @code{in_struct} field and printed as @samp{/s}.
48790075Sobrien
48890075Sobrien@findex MEM_KEEP_ALIAS_SET_P
48990075Sobrien@cindex @code{mem} and @samp{/j}
49090075Sobrien@cindex @code{jump}, in @code{mem}
49190075Sobrien@item MEM_KEEP_ALIAS_SET_P (@var{x})
49290075SobrienIn @code{mem} expressions, 1 if we should keep the alias set for this
49390075Sobrienmem unchanged when we access a component.  Set to 1, for example, when we
49490075Sobrienare already in a non-addressable component of an aggregate.
49590075SobrienStored in the @code{jump} field and printed as @samp{/j}.
49690075Sobrien
49790075Sobrien@findex MEM_SCALAR_P
49890075Sobrien@cindex @code{mem} and @samp{/f}
49990075Sobrien@cindex @code{frame_related}, in @code{mem}
50090075Sobrien@item MEM_SCALAR_P (@var{x})
50190075SobrienIn @code{mem} expressions, nonzero for reference to a scalar known not
50290075Sobriento be a member of a structure, union, or array.  Zero for such
50390075Sobrienreferences and for indirections through pointers, even pointers pointing
50496263Sobriento scalar types.  If both this flag and @code{MEM_IN_STRUCT_P} are clear,
50596263Sobrienthen we don't know whether this @code{mem} is in a structure or not.
50696263SobrienBoth flags should never be simultaneously set.
50790075SobrienStored in the @code{frame_related} field and printed as @samp{/f}.
50890075Sobrien
50990075Sobrien@findex MEM_VOLATILE_P
51090075Sobrien@cindex @code{mem} and @samp{/v}
51190075Sobrien@cindex @code{volatil}, in @code{mem}
51290075Sobrien@item MEM_VOLATILE_P (@var{x})
51390075SobrienIn @code{mem} and @code{asm_operands} expressions, nonzero for volatile
51490075Sobrienmemory references.
51590075SobrienStored in the @code{volatil} field and printed as @samp{/v}.
51690075Sobrien
51790075Sobrien@findex REG_FUNCTION_VALUE_P
51890075Sobrien@cindex @code{reg} and @samp{/i}
51990075Sobrien@cindex @code{integrated}, in @code{reg}
52090075Sobrien@item REG_FUNCTION_VALUE_P (@var{x})
52190075SobrienNonzero in a @code{reg} if it is the place in which this function's
52290075Sobrienvalue is going to be returned.  (This happens only in a hard
52390075Sobrienregister.)  Stored in the @code{integrated} field and printed as
52490075Sobrien@samp{/i}.
52590075Sobrien
52690075Sobrien@findex REG_LOOP_TEST_P
52790075Sobrien@cindex @code{reg} and @samp{/s}
52890075Sobrien@cindex @code{in_struct}, in @code{reg}
52990075Sobrien@item REG_LOOP_TEST_P (@var{x})
53090075SobrienIn @code{reg} expressions, nonzero if this register's entire life is
53190075Sobriencontained in the exit test code for some loop.  Stored in the
53290075Sobrien@code{in_struct} field and printed as @samp{/s}.
53390075Sobrien
53490075Sobrien@findex REG_POINTER
53590075Sobrien@cindex @code{reg} and @samp{/f}
53690075Sobrien@cindex @code{frame_related}, in @code{reg}
53790075Sobrien@item REG_POINTER (@var{x})
53890075SobrienNonzero in a @code{reg} if the register holds a pointer.  Stored in the
53990075Sobrien@code{frame_related} field and printed as @samp{/f}.
54090075Sobrien
54190075Sobrien@findex REG_USERVAR_P
54290075Sobrien@cindex @code{reg} and @samp{/v}
54390075Sobrien@cindex @code{volatil}, in @code{reg}
54490075Sobrien@item REG_USERVAR_P (@var{x})
54590075SobrienIn a @code{reg}, nonzero if it corresponds to a variable present in
54690075Sobrienthe user's source code.  Zero for temporaries generated internally by
54790075Sobrienthe compiler.  Stored in the @code{volatil} field and printed as
54890075Sobrien@samp{/v}.
54990075Sobrien
55090075SobrienThe same hard register may be used also for collecting the values of
55190075Sobrienfunctions called by this one, but @code{REG_FUNCTION_VALUE_P} is zero
55290075Sobrienin this kind of use.
55390075Sobrien
55490075Sobrien@findex RTX_FRAME_RELATED_P
55590075Sobrien@cindex @code{insn} and @samp{/f}
55690075Sobrien@cindex @code{frame_related}, in @code{insn}
55790075Sobrien@item RTX_FRAME_RELATED_P (@var{x})
55890075SobrienNonzero in an @code{insn} or @code{set} which is part of a function prologue
55990075Sobrienand sets the stack pointer, sets the frame pointer, or saves a register.
56090075SobrienThis flag should also be set on an instruction that sets up a temporary
56190075Sobrienregister to use in place of the frame pointer.
56290075SobrienStored in the @code{frame_related} field and printed as @samp{/f}.
56390075Sobrien
56490075SobrienIn particular, on RISC targets where there are limits on the sizes of
56590075Sobrienimmediate constants, it is sometimes impossible to reach the register
56690075Sobriensave area directly from the stack pointer.  In that case, a temporary
56790075Sobrienregister is used that is near enough to the register save area, and the
56890075SobrienCanonical Frame Address, i.e., DWARF2's logical frame pointer, register
56990075Sobrienmust (temporarily) be changed to be this temporary register.  So, the
57090075Sobrieninstruction that sets this temporary register must be marked as
57190075Sobrien@code{RTX_FRAME_RELATED_P}.
57290075Sobrien
57390075SobrienIf the marked instruction is overly complex (defined in terms of what
57490075Sobrien@code{dwarf2out_frame_debug_expr} can handle), you will also have to
57590075Sobriencreate a @code{REG_FRAME_RELATED_EXPR} note and attach it to the
57690075Sobrieninstruction.  This note should contain a simple expression of the
57790075Sobriencomputation performed by this instruction, i.e., one that
57890075Sobrien@code{dwarf2out_frame_debug_expr} can handle.
57990075Sobrien
58090075SobrienThis flag is required for exception handling support on targets with RTL
58190075Sobrienprologues.
58290075Sobrien
58390075Sobrien@findex RTX_INTEGRATED_P
58490075Sobrien@cindex @code{insn} and @samp{/i}
58590075Sobrien@cindex @code{integrated}, in @code{insn}
58690075Sobrien@item RTX_INTEGRATED_P (@var{x})
58790075SobrienNonzero in an @code{insn}, @code{insn_list}, or @code{const} if it
58890075Sobrienresulted from an in-line function call.
58990075SobrienStored in the @code{integrated} field and printed as @samp{/i}.
59090075Sobrien
59190075Sobrien@findex RTX_UNCHANGING_P
59290075Sobrien@cindex @code{reg} and @samp{/u}
59390075Sobrien@cindex @code{mem} and @samp{/u}
59490075Sobrien@cindex @code{unchanging}, in @code{reg} and @code{mem}
59590075Sobrien@item RTX_UNCHANGING_P (@var{x})
59690075SobrienNonzero in a @code{reg} or @code{mem} if the memory is set at most once,
59790075Sobrienanywhere.  This does not mean that it is function invariant.
59890075SobrienStored in the @code{unchanging} field and printed as @samp{/u}.
59990075Sobrien
60090075Sobrien@findex SCHED_GROUP_P
60190075Sobrien@cindex @code{insn} and @samp{/i}
60290075Sobrien@cindex @code{in_struct}, in @code{insn}
60390075Sobrien@item SCHED_GROUP_P (@var{x})
60490075SobrienDuring instruction scheduling, in an @code{insn}, indicates that the
60590075Sobrienprevious insn must be scheduled together with this insn.  This is used to
60690075Sobrienensure that certain groups of instructions will not be split up by the
60790075Sobrieninstruction scheduling pass, for example, @code{use} insns before
60890075Sobriena @code{call_insn} may not be separated from the @code{call_insn}.
60990075SobrienStored in the @code{in_struct} field and printed as @samp{/s}.
61090075Sobrien
61190075Sobrien@findex SET_IS_RETURN_P
61290075Sobrien@cindex @code{insn} and @samp{/j}
61390075Sobrien@cindex @code{jump}, in @code{insn}
61490075Sobrien@item SET_IS_RETURN_P (@var{x})
61590075SobrienFor a @code{set}, nonzero if it is for a return.
61690075SobrienStored in the @code{jump} field and printed as @samp{/j}.
61790075Sobrien
61890075Sobrien@findex SIBLING_CALL_P
61990075Sobrien@cindex @code{call_insn} and @samp{/j}
62090075Sobrien@cindex @code{jump}, in @code{call_insn}
62190075Sobrien@item SIBLING_CALL_P (@var{x})
62290075SobrienFor a @code{call_insn}, nonzero if the insn is a sibling call.
62390075SobrienStored in the @code{jump} field and printed as @samp{/j}.
62490075Sobrien
62590075Sobrien@findex STRING_POOL_ADDRESS_P
62690075Sobrien@cindex @code{symbol_ref} and @samp{/f}
62790075Sobrien@cindex @code{frame_related}, in @code{symbol_ref}
62890075Sobrien@item STRING_POOL_ADDRESS_P (@var{x})
62990075SobrienFor a @code{symbol_ref} expression, nonzero if it addresses this function's
63090075Sobrienstring constant pool.
63190075SobrienStored in the @code{frame_related} field and printed as @samp{/f}.
63290075Sobrien
63390075Sobrien@findex SUBREG_PROMOTED_UNSIGNED_P
63490075Sobrien@cindex @code{subreg} and @samp{/u}
63590075Sobrien@cindex @code{unchanging}, in @code{subreg}
63690075Sobrien@item SUBREG_PROMOTED_UNSIGNED_P (@var{x})
63790075SobrienNonzero in a @code{subreg} that has @code{SUBREG_PROMOTED_VAR_P} nonzero
63890075Sobrienif the object being referenced is kept zero-extended and zero if it
63990075Sobrienis kept sign-extended.  Stored in the @code{unchanging} field and
64090075Sobrienprinted as @samp{/u}.
64190075Sobrien
64290075Sobrien@findex SUBREG_PROMOTED_VAR_P
64390075Sobrien@cindex @code{subreg} and @samp{/s}
64490075Sobrien@cindex @code{in_struct}, in @code{subreg}
64590075Sobrien@item SUBREG_PROMOTED_VAR_P (@var{x})
64690075SobrienNonzero in a @code{subreg} if it was made when accessing an object that
64790075Sobrienwas promoted to a wider mode in accord with the @code{PROMOTED_MODE} machine
64890075Sobriendescription macro (@pxref{Storage Layout}).  In this case, the mode of
64990075Sobrienthe @code{subreg} is the declared mode of the object and the mode of
65090075Sobrien@code{SUBREG_REG} is the mode of the register that holds the object.
65190075SobrienPromoted variables are always either sign- or zero-extended to the wider
65290075Sobrienmode on every assignment.  Stored in the @code{in_struct} field and
65390075Sobrienprinted as @samp{/s}.
65490075Sobrien
65590075Sobrien@findex SYMBOL_REF_FLAG
65690075Sobrien@cindex @code{symbol_ref} and @samp{/v}
65790075Sobrien@cindex @code{volatil}, in @code{symbol_ref}
65890075Sobrien@item SYMBOL_REF_FLAG (@var{x})
65990075SobrienIn a @code{symbol_ref}, this is used as a flag for machine-specific purposes.
66090075SobrienStored in the @code{volatil} field and printed as @samp{/v}.
66190075Sobrien
66290075Sobrien@findex SYMBOL_REF_USED
66390075Sobrien@cindex @code{used}, in @code{symbol_ref}
66490075Sobrien@item SYMBOL_REF_USED (@var{x})
66590075SobrienIn a @code{symbol_ref}, indicates that @var{x} has been used.  This is
66690075Sobriennormally only used to ensure that @var{x} is only declared external
66790075Sobrienonce.  Stored in the @code{used} field.
66890075Sobrien
66990075Sobrien@findex SYMBOL_REF_WEAK
67090075Sobrien@cindex @code{symbol_ref} and @samp{/i}
67190075Sobrien@cindex @code{integrated}, in @code{symbol_ref}
67290075Sobrien@item SYMBOL_REF_WEAK (@var{x})
67390075SobrienIn a @code{symbol_ref}, indicates that @var{x} has been declared weak.
67490075SobrienStored in the @code{integrated} field and printed as @samp{/i}.
67590075Sobrien@end table
67690075Sobrien
67790075SobrienThese are the fields to which the above macros refer:
67890075Sobrien
67990075Sobrien@table @code
68090075Sobrien@findex call
68190075Sobrien@cindex @samp{/c} in RTL dump
68290075Sobrien@item call
68390075SobrienIn the @code{LOG_LINKS} of an @code{insn_list} during scheduling, 1 means that
68490075Sobrienthe cost of executing an instruction through the link is zero.
68590075Sobrien
68690075SobrienIn an RTL dump, this flag is represented as @samp{/c}.
68790075Sobrien
68890075Sobrien@findex frame_related
68990075Sobrien@cindex @samp{/f} in RTL dump
69090075Sobrien@item frame_related
69190075SobrienIn an @code{insn} or @code{set} expression, 1 means that it is part of
69290075Sobriena function prologue and sets the stack pointer, sets the frame pointer,
69390075Sobriensaves a register, or sets up a temporary register to use in place of the
69490075Sobrienframe pointer.
69590075Sobrien
69690075SobrienIn @code{reg} expressions, 1 means that the register holds a pointer.
69790075Sobrien
69890075SobrienIn @code{symbol_ref} expressions, 1 means that the reference addresses
69990075Sobrienthis function's string constant pool.
70090075Sobrien
70190075SobrienIn @code{mem} expressions, 1 means that the reference is to a scalar.
70290075Sobrien
70390075SobrienIn an RTL dump, this flag is represented as @samp{/f}.
70490075Sobrien
70590075Sobrien@findex in_struct
70690075Sobrien@cindex @samp{/s} in RTL dump
70790075Sobrien@item in_struct
70890075SobrienIn @code{mem} expressions, it is 1 if the memory datum referred to is
70990075Sobrienall or part of a structure or array; 0 if it is (or might be) a scalar
71090075Sobrienvariable.  A reference through a C pointer has 0 because the pointer
71190075Sobrienmight point to a scalar variable.  This information allows the compiler
71290075Sobriento determine something about possible cases of aliasing.
71390075Sobrien
71490075SobrienIn @code{reg} expressions, it is 1 if the register has its entire life
71590075Sobriencontained within the test expression of some loop.
71690075Sobrien
71790075SobrienIn @code{subreg} expressions, 1 means that the @code{subreg} is accessing
71890075Sobrienan object that has had its mode promoted from a wider mode.
71990075Sobrien
72090075SobrienIn @code{label_ref} expressions, 1 means that the referenced label is
72190075Sobrienoutside the innermost loop containing the insn in which the @code{label_ref}
72290075Sobrienwas found.
72390075Sobrien
72490075SobrienIn @code{code_label} expressions, it is 1 if the label may never be deleted.
72590075SobrienThis is used for labels which are the target of non-local gotos.  Such a
72690075Sobrienlabel that would have been deleted is replaced with a @code{note} of type
72790075Sobrien@code{NOTE_INSN_DELETED_LABEL}.
72890075Sobrien
72990075SobrienIn an @code{insn} during dead-code elimination, 1 means that the insn is
73090075Sobriendead code.
73190075Sobrien
73290075SobrienIn an @code{insn} during reorg for an insn in the delay slot of a branch,
73390075Sobrien1 means that this insn is from the target of the branch.
73490075Sobrien
73590075SobrienIn an @code{insn} during instruction scheduling, 1 means that this insn
73690075Sobrienmust be scheduled as part of a group together with the previous insn.
73790075Sobrien
73890075SobrienIn an RTL dump, this flag is represented as @samp{/s}.
73990075Sobrien
74090075Sobrien@findex integrated
74190075Sobrien@cindex @samp{/i} in RTL dump
74290075Sobrien@item integrated
74390075SobrienIn an @code{insn}, @code{insn_list}, or @code{const}, 1 means the RTL was
74490075Sobrienproduced by procedure integration.
74590075Sobrien
74690075SobrienIn @code{reg} expressions, 1 means the register contains
74790075Sobrienthe value to be returned by the current function.  On
74890075Sobrienmachines that pass parameters in registers, the same register number
74990075Sobrienmay be used for parameters as well, but this flag is not set on such
75090075Sobrienuses.
75190075Sobrien
75290075SobrienIn @code{symbol_ref} expressions, 1 means the referenced symbol is weak.
75390075Sobrien
75490075SobrienIn an RTL dump, this flag is represented as @samp{/i}.
75590075Sobrien
75690075Sobrien@findex jump
75790075Sobrien@cindex @samp{/j} in RTL dump
75890075Sobrien@item jump
75990075SobrienIn a @code{mem} expression, 1 means we should keep the alias set for this
76090075Sobrienmem unchanged when we access a component.
76190075Sobrien
76290075SobrienIn a @code{set}, 1 means it is for a return.
76390075Sobrien
76490075SobrienIn a @code{call_insn}, 1 means it is a sibling call.
76590075Sobrien
76690075SobrienIn the @code{LOG_LINKS} of an @code{insn_list} during scheduling, 1 means the
76790075Sobriencost of executing an instruction through the link varies and is unchanging.
76890075Sobrien
76990075SobrienIn an RTL dump, this flag is represented as @samp{/j}.
77090075Sobrien
77190075Sobrien@findex unchanging
77290075Sobrien@cindex @samp{/u} in RTL dump
77390075Sobrien@item unchanging
77490075SobrienIn @code{reg} and @code{mem} expressions, 1 means
77590075Sobrienthat the value of the expression never changes.
77690075Sobrien
77790075SobrienIn @code{subreg} expressions, it is 1 if the @code{subreg} references an
77890075Sobrienunsigned object whose mode has been promoted to a wider mode.
77990075Sobrien
78090075SobrienIn an @code{insn}, 1 means that this is an annulling branch.
78190075Sobrien
78290075SobrienIn a @code{symbol_ref} expression, 1 means that this symbol addresses
78390075Sobriensomething in the per-function constant pool.
78490075Sobrien
78590075SobrienIn a @code{call_insn}, @code{note}, or an @code{expr_list} of notes,
78690075Sobrien1 means that this instruction is a call to a const or pure function.
78790075Sobrien
78890075SobrienIn an RTL dump, this flag is represented as @samp{/u}.
78990075Sobrien
79090075Sobrien@findex used
79190075Sobrien@item used
79290075SobrienThis flag is used directly (without an access macro) at the end of RTL
79390075Sobriengeneration for a function, to count the number of times an expression
79490075Sobrienappears in insns.  Expressions that appear more than once are copied,
79590075Sobrienaccording to the rules for shared structure (@pxref{Sharing}).
79690075Sobrien
79790075SobrienFor a @code{reg}, it is used directly (without an access macro) by the
79890075Sobrienleaf register renumbering code to ensure that each register is only
79990075Sobrienrenumbered once.
80090075Sobrien
80190075SobrienIn a @code{symbol_ref}, it indicates that an external declaration for
80290075Sobrienthe symbol has already been written.
80390075Sobrien
80490075Sobrien@findex volatil
80590075Sobrien@cindex @samp{/v} in RTL dump
80690075Sobrien@item volatil
80790075Sobrien@cindex volatile memory references
80890075SobrienIn a @code{mem} or @code{asm_operands} expression, it is 1 if the memory
80990075Sobrienreference is volatile.  Volatile memory references may not be deleted,
81090075Sobrienreordered or combined.
81190075Sobrien
81290075SobrienIn a @code{symbol_ref} expression, it is used for machine-specific
81390075Sobrienpurposes.
81490075Sobrien
81590075SobrienIn a @code{reg} expression, it is 1 if the value is a user-level variable.
81690075Sobrien0 indicates an internal compiler temporary.
81790075Sobrien
81890075SobrienIn an @code{insn}, 1 means the insn has been deleted.
81990075Sobrien
82090075SobrienIn @code{label_ref} and @code{reg_label} expressions, 1 means a reference
82190075Sobriento a non-local label.
82290075Sobrien
82390075SobrienIn an RTL dump, this flag is represented as @samp{/v}.
82490075Sobrien@end table
82590075Sobrien
82690075Sobrien@node Machine Modes
82790075Sobrien@section Machine Modes
82890075Sobrien@cindex machine modes
82990075Sobrien
83090075Sobrien@findex enum machine_mode
83190075SobrienA machine mode describes a size of data object and the representation used
83290075Sobrienfor it.  In the C code, machine modes are represented by an enumeration
83390075Sobrientype, @code{enum machine_mode}, defined in @file{machmode.def}.  Each RTL
83490075Sobrienexpression has room for a machine mode and so do certain kinds of tree
83590075Sobrienexpressions (declarations and types, to be precise).
83690075Sobrien
83790075SobrienIn debugging dumps and machine descriptions, the machine mode of an RTL
83890075Sobrienexpression is written after the expression code with a colon to separate
83990075Sobrienthem.  The letters @samp{mode} which appear at the end of each machine mode
84090075Sobrienname are omitted.  For example, @code{(reg:SI 38)} is a @code{reg}
84190075Sobrienexpression with machine mode @code{SImode}.  If the mode is
84290075Sobrien@code{VOIDmode}, it is not written at all.
84390075Sobrien
84490075SobrienHere is a table of machine modes.  The term ``byte'' below refers to an
84590075Sobrienobject of @code{BITS_PER_UNIT} bits (@pxref{Storage Layout}).
84690075Sobrien
84790075Sobrien@table @code
84890075Sobrien@findex BImode
84990075Sobrien@item BImode
85090075Sobrien``Bit'' mode represents a single bit, for predicate registers.
85190075Sobrien
85290075Sobrien@findex QImode
85390075Sobrien@item QImode
85490075Sobrien``Quarter-Integer'' mode represents a single byte treated as an integer.
85590075Sobrien
85690075Sobrien@findex HImode
85790075Sobrien@item HImode
85890075Sobrien``Half-Integer'' mode represents a two-byte integer.
85990075Sobrien
86090075Sobrien@findex PSImode
86190075Sobrien@item PSImode
86290075Sobrien``Partial Single Integer'' mode represents an integer which occupies
86390075Sobrienfour bytes but which doesn't really use all four.  On some machines,
86490075Sobrienthis is the right mode to use for pointers.
86590075Sobrien
86690075Sobrien@findex SImode
86790075Sobrien@item SImode
86890075Sobrien``Single Integer'' mode represents a four-byte integer.
86990075Sobrien
87090075Sobrien@findex PDImode
87190075Sobrien@item PDImode
87290075Sobrien``Partial Double Integer'' mode represents an integer which occupies
87390075Sobrieneight bytes but which doesn't really use all eight.  On some machines,
87490075Sobrienthis is the right mode to use for certain pointers.
87590075Sobrien
87690075Sobrien@findex DImode
87790075Sobrien@item DImode
87890075Sobrien``Double Integer'' mode represents an eight-byte integer.
87990075Sobrien
88090075Sobrien@findex TImode
88190075Sobrien@item TImode
88290075Sobrien``Tetra Integer'' (?) mode represents a sixteen-byte integer.
88390075Sobrien
88490075Sobrien@findex OImode
88590075Sobrien@item OImode
88690075Sobrien``Octa Integer'' (?) mode represents a thirty-two-byte integer.
88790075Sobrien
88890075Sobrien@findex QFmode
88990075Sobrien@item QFmode
89090075Sobrien``Quarter-Floating'' mode represents a quarter-precision (single byte)
89190075Sobrienfloating point number.
89290075Sobrien
89390075Sobrien@findex HFmode
89490075Sobrien@item HFmode
89590075Sobrien``Half-Floating'' mode represents a half-precision (two byte) floating
89690075Sobrienpoint number.
89790075Sobrien
89890075Sobrien@findex TQFmode
89990075Sobrien@item TQFmode
90090075Sobrien``Three-Quarter-Floating'' (?) mode represents a three-quarter-precision
90190075Sobrien(three byte) floating point number.
90290075Sobrien
90390075Sobrien@findex SFmode
90490075Sobrien@item SFmode
90590075Sobrien``Single Floating'' mode represents a four byte floating point number.
90690075SobrienIn the common case, of a processor with IEEE arithmetic and 8-bit bytes,
90790075Sobrienthis is a single-precision IEEE floating point number; it can also be
90890075Sobrienused for double-precision (on processors with 16-bit bytes) and
90990075Sobriensingle-precision VAX and IBM types.
91090075Sobrien
91190075Sobrien@findex DFmode
91290075Sobrien@item DFmode
91390075Sobrien``Double Floating'' mode represents an eight byte floating point number.
91490075SobrienIn the common case, of a processor with IEEE arithmetic and 8-bit bytes,
91590075Sobrienthis is a double-precision IEEE floating point number.
91690075Sobrien
91790075Sobrien@findex XFmode
91890075Sobrien@item XFmode
91990075Sobrien``Extended Floating'' mode represents a twelve byte floating point
92090075Sobriennumber.  This mode is used for IEEE extended floating point.  On some
92190075Sobriensystems not all bits within these bytes will actually be used.
92290075Sobrien
92390075Sobrien@findex TFmode
92490075Sobrien@item TFmode
92590075Sobrien``Tetra Floating'' mode represents a sixteen byte floating point number.
92690075SobrienThis gets used for both the 96-bit extended IEEE floating-point types
92790075Sobrienpadded to 128 bits, and true 128-bit extended IEEE floating-point types.
92890075Sobrien
92990075Sobrien@findex CCmode
93090075Sobrien@item CCmode
93190075Sobrien``Condition Code'' mode represents the value of a condition code, which
93290075Sobrienis a machine-specific set of bits used to represent the result of a
93390075Sobriencomparison operation.  Other machine-specific modes may also be used for
93490075Sobrienthe condition code.  These modes are not used on machines that use
93590075Sobrien@code{cc0} (see @pxref{Condition Code}).
93690075Sobrien
93790075Sobrien@findex BLKmode
93890075Sobrien@item BLKmode
93990075Sobrien``Block'' mode represents values that are aggregates to which none of
94090075Sobrienthe other modes apply.  In RTL, only memory references can have this mode,
94190075Sobrienand only if they appear in string-move or vector instructions.  On machines
94290075Sobrienwhich have no such instructions, @code{BLKmode} will not appear in RTL@.
94390075Sobrien
94490075Sobrien@findex VOIDmode
94590075Sobrien@item VOIDmode
94690075SobrienVoid mode means the absence of a mode or an unspecified mode.
94790075SobrienFor example, RTL expressions of code @code{const_int} have mode
94890075Sobrien@code{VOIDmode} because they can be taken to have whatever mode the context
94990075Sobrienrequires.  In debugging dumps of RTL, @code{VOIDmode} is expressed by
95090075Sobrienthe absence of any mode.
95190075Sobrien
95290075Sobrien@findex QCmode
95390075Sobrien@findex HCmode
95490075Sobrien@findex SCmode
95590075Sobrien@findex DCmode
95690075Sobrien@findex XCmode
95790075Sobrien@findex TCmode
95890075Sobrien@item QCmode, HCmode, SCmode, DCmode, XCmode, TCmode
95990075SobrienThese modes stand for a complex number represented as a pair of floating
96090075Sobrienpoint values.  The floating point values are in @code{QFmode},
96190075Sobrien@code{HFmode}, @code{SFmode}, @code{DFmode}, @code{XFmode}, and
96290075Sobrien@code{TFmode}, respectively.
96390075Sobrien
96490075Sobrien@findex CQImode
96590075Sobrien@findex CHImode
96690075Sobrien@findex CSImode
96790075Sobrien@findex CDImode
96890075Sobrien@findex CTImode
96990075Sobrien@findex COImode
97090075Sobrien@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode
97190075SobrienThese modes stand for a complex number represented as a pair of integer
97290075Sobrienvalues.  The integer values are in @code{QImode}, @code{HImode},
97390075Sobrien@code{SImode}, @code{DImode}, @code{TImode}, and @code{OImode},
97490075Sobrienrespectively.
97590075Sobrien@end table
97690075Sobrien
97790075SobrienThe machine description defines @code{Pmode} as a C macro which expands
97890075Sobrieninto the machine mode used for addresses.  Normally this is the mode
97990075Sobrienwhose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines.
98090075Sobrien
98190075SobrienThe only modes which a machine description @i{must} support are
98290075Sobrien@code{QImode}, and the modes corresponding to @code{BITS_PER_WORD},
98390075Sobrien@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}.
98490075SobrienThe compiler will attempt to use @code{DImode} for 8-byte structures and
98590075Sobrienunions, but this can be prevented by overriding the definition of
98690075Sobrien@code{MAX_FIXED_MODE_SIZE}.  Alternatively, you can have the compiler
98790075Sobrienuse @code{TImode} for 16-byte structures and unions.  Likewise, you can
98890075Sobrienarrange for the C type @code{short int} to avoid using @code{HImode}.
98990075Sobrien
99090075Sobrien@cindex mode classes
99190075SobrienVery few explicit references to machine modes remain in the compiler and
99290075Sobrienthese few references will soon be removed.  Instead, the machine modes
99390075Sobrienare divided into mode classes.  These are represented by the enumeration
99490075Sobrientype @code{enum mode_class} defined in @file{machmode.h}.  The possible
99590075Sobrienmode classes are:
99690075Sobrien
99790075Sobrien@table @code
99890075Sobrien@findex MODE_INT
99990075Sobrien@item MODE_INT
100090075SobrienInteger modes.  By default these are @code{BImode}, @code{QImode},
100190075Sobrien@code{HImode}, @code{SImode}, @code{DImode}, @code{TImode}, and
100290075Sobrien@code{OImode}.
100390075Sobrien
100490075Sobrien@findex MODE_PARTIAL_INT
100590075Sobrien@item MODE_PARTIAL_INT
100690075SobrienThe ``partial integer'' modes, @code{PQImode}, @code{PHImode},
100790075Sobrien@code{PSImode} and @code{PDImode}.
100890075Sobrien
100990075Sobrien@findex MODE_FLOAT
101090075Sobrien@item MODE_FLOAT
101190075SobrienFloating point modes.  By default these are @code{QFmode},
101290075Sobrien@code{HFmode}, @code{TQFmode}, @code{SFmode}, @code{DFmode},
101390075Sobrien@code{XFmode} and @code{TFmode}.
101490075Sobrien
101590075Sobrien@findex MODE_COMPLEX_INT
101690075Sobrien@item MODE_COMPLEX_INT
101790075SobrienComplex integer modes.  (These are not currently implemented).
101890075Sobrien
101990075Sobrien@findex MODE_COMPLEX_FLOAT
102090075Sobrien@item MODE_COMPLEX_FLOAT
102190075SobrienComplex floating point modes.  By default these are @code{QCmode},
102290075Sobrien@code{HCmode}, @code{SCmode}, @code{DCmode}, @code{XCmode}, and
102390075Sobrien@code{TCmode}.
102490075Sobrien
102590075Sobrien@findex MODE_FUNCTION
102690075Sobrien@item MODE_FUNCTION
102790075SobrienAlgol or Pascal function variables including a static chain.
102890075Sobrien(These are not currently implemented).
102990075Sobrien
103090075Sobrien@findex MODE_CC
103190075Sobrien@item MODE_CC
103290075SobrienModes representing condition code values.  These are @code{CCmode} plus
103390075Sobrienany modes listed in the @code{EXTRA_CC_MODES} macro.  @xref{Jump Patterns},
103490075Sobrienalso see @ref{Condition Code}.
103590075Sobrien
103690075Sobrien@findex MODE_RANDOM
103790075Sobrien@item MODE_RANDOM
103890075SobrienThis is a catchall mode class for modes which don't fit into the above
103990075Sobrienclasses.  Currently @code{VOIDmode} and @code{BLKmode} are in
104090075Sobrien@code{MODE_RANDOM}.
104190075Sobrien@end table
104290075Sobrien
104390075SobrienHere are some C macros that relate to machine modes:
104490075Sobrien
104590075Sobrien@table @code
104690075Sobrien@findex GET_MODE
104790075Sobrien@item GET_MODE (@var{x})
104890075SobrienReturns the machine mode of the RTX @var{x}.
104990075Sobrien
105090075Sobrien@findex PUT_MODE
105190075Sobrien@item PUT_MODE (@var{x}, @var{newmode})
105290075SobrienAlters the machine mode of the RTX @var{x} to be @var{newmode}.
105390075Sobrien
105490075Sobrien@findex NUM_MACHINE_MODES
105590075Sobrien@item NUM_MACHINE_MODES
105690075SobrienStands for the number of machine modes available on the target
105790075Sobrienmachine.  This is one greater than the largest numeric value of any
105890075Sobrienmachine mode.
105990075Sobrien
106090075Sobrien@findex GET_MODE_NAME
106190075Sobrien@item GET_MODE_NAME (@var{m})
106290075SobrienReturns the name of mode @var{m} as a string.
106390075Sobrien
106490075Sobrien@findex GET_MODE_CLASS
106590075Sobrien@item GET_MODE_CLASS (@var{m})
106690075SobrienReturns the mode class of mode @var{m}.
106790075Sobrien
106890075Sobrien@findex GET_MODE_WIDER_MODE
106990075Sobrien@item GET_MODE_WIDER_MODE (@var{m})
107090075SobrienReturns the next wider natural mode.  For example, the expression
107190075Sobrien@code{GET_MODE_WIDER_MODE (QImode)} returns @code{HImode}.
107290075Sobrien
107390075Sobrien@findex GET_MODE_SIZE
107490075Sobrien@item GET_MODE_SIZE (@var{m})
107590075SobrienReturns the size in bytes of a datum of mode @var{m}.
107690075Sobrien
107790075Sobrien@findex GET_MODE_BITSIZE
107890075Sobrien@item GET_MODE_BITSIZE (@var{m})
107990075SobrienReturns the size in bits of a datum of mode @var{m}.
108090075Sobrien
108190075Sobrien@findex GET_MODE_MASK
108290075Sobrien@item GET_MODE_MASK (@var{m})
108390075SobrienReturns a bitmask containing 1 for all bits in a word that fit within
108490075Sobrienmode @var{m}.  This macro can only be used for modes whose bitsize is
108590075Sobrienless than or equal to @code{HOST_BITS_PER_INT}.
108690075Sobrien
108790075Sobrien@findex GET_MODE_ALIGNMENT
108890075Sobrien@item GET_MODE_ALIGNMENT (@var{m})
108990075SobrienReturn the required alignment, in bits, for an object of mode @var{m}.
109090075Sobrien
109190075Sobrien@findex GET_MODE_UNIT_SIZE
109290075Sobrien@item GET_MODE_UNIT_SIZE (@var{m})
109390075SobrienReturns the size in bytes of the subunits of a datum of mode @var{m}.
109490075SobrienThis is the same as @code{GET_MODE_SIZE} except in the case of complex
109590075Sobrienmodes.  For them, the unit size is the size of the real or imaginary
109690075Sobrienpart.
109790075Sobrien
109890075Sobrien@findex GET_MODE_NUNITS
109990075Sobrien@item GET_MODE_NUNITS (@var{m})
110090075SobrienReturns the number of units contained in a mode, i.e.,
110190075Sobrien@code{GET_MODE_SIZE} divided by @code{GET_MODE_UNIT_SIZE}.
110290075Sobrien
110390075Sobrien@findex GET_CLASS_NARROWEST_MODE
110490075Sobrien@item GET_CLASS_NARROWEST_MODE (@var{c})
110590075SobrienReturns the narrowest mode in mode class @var{c}.
110690075Sobrien@end table
110790075Sobrien
110890075Sobrien@findex byte_mode
110990075Sobrien@findex word_mode
111090075SobrienThe global variables @code{byte_mode} and @code{word_mode} contain modes
111190075Sobrienwhose classes are @code{MODE_INT} and whose bitsizes are either
111290075Sobrien@code{BITS_PER_UNIT} or @code{BITS_PER_WORD}, respectively.  On 32-bit
111390075Sobrienmachines, these are @code{QImode} and @code{SImode}, respectively.
111490075Sobrien
111590075Sobrien@node Constants
111690075Sobrien@section Constant Expression Types
111790075Sobrien@cindex RTL constants
111890075Sobrien@cindex RTL constant expression types
111990075Sobrien
112090075SobrienThe simplest RTL expressions are those that represent constant values.
112190075Sobrien
112290075Sobrien@table @code
112390075Sobrien@findex const_int
112490075Sobrien@item (const_int @var{i})
112590075SobrienThis type of expression represents the integer value @var{i}.  @var{i}
112690075Sobrienis customarily accessed with the macro @code{INTVAL} as in
112790075Sobrien@code{INTVAL (@var{exp})}, which is equivalent to @code{XWINT (@var{exp}, 0)}.
112890075Sobrien
112990075Sobrien@findex const0_rtx
113090075Sobrien@findex const1_rtx
113190075Sobrien@findex const2_rtx
113290075Sobrien@findex constm1_rtx
113390075SobrienThere is only one expression object for the integer value zero; it is
113490075Sobrienthe value of the variable @code{const0_rtx}.  Likewise, the only
113590075Sobrienexpression for integer value one is found in @code{const1_rtx}, the only
113690075Sobrienexpression for integer value two is found in @code{const2_rtx}, and the
113790075Sobrienonly expression for integer value negative one is found in
113890075Sobrien@code{constm1_rtx}.  Any attempt to create an expression of code
113990075Sobrien@code{const_int} and value zero, one, two or negative one will return
114090075Sobrien@code{const0_rtx}, @code{const1_rtx}, @code{const2_rtx} or
114190075Sobrien@code{constm1_rtx} as appropriate.
114290075Sobrien
114390075Sobrien@findex const_true_rtx
114490075SobrienSimilarly, there is only one object for the integer whose value is
114590075Sobrien@code{STORE_FLAG_VALUE}.  It is found in @code{const_true_rtx}.  If
114690075Sobrien@code{STORE_FLAG_VALUE} is one, @code{const_true_rtx} and
114790075Sobrien@code{const1_rtx} will point to the same object.  If
114890075Sobrien@code{STORE_FLAG_VALUE} is @minus{}1, @code{const_true_rtx} and
114990075Sobrien@code{constm1_rtx} will point to the same object.
115090075Sobrien
115190075Sobrien@findex const_double
115290075Sobrien@item (const_double:@var{m} @var{addr} @var{i0} @var{i1} @dots{})
115390075SobrienRepresents either a floating-point constant of mode @var{m} or an
115490075Sobrieninteger constant too large to fit into @code{HOST_BITS_PER_WIDE_INT}
115590075Sobrienbits but small enough to fit within twice that number of bits (GCC
115690075Sobriendoes not provide a mechanism to represent even larger constants).  In
115790075Sobrienthe latter case, @var{m} will be @code{VOIDmode}.
115890075Sobrien
115996263Sobrien@findex const_vector
116096263Sobrien@item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}])
116196263SobrienRepresents a vector constant.  The square brackets stand for the vector
116296263Sobriencontaining the constant elements.  @var{x0}, @var{x1} and so on are
116396263Sobrienthe @code{const_int} or @code{const_double} elements.
116496263Sobrien
116596263SobrienThe number of units in a @code{const_vector} is obtained with the macro
116696263Sobrien@code{CONST_VECTOR_NUNITS} as in @code{CONST_VECTOR_NUNITS (@var{v})}.
116796263Sobrien
116896263SobrienIndividual elements in a vector constant are accessed with the macro
116996263Sobrien@code{CONST_VECTOR_ELT} as in @code{CONST_VECTOR_ELT (@var{v}, @var{n})}
117096263Sobrienwhere @var{v} is the vector constant and @var{n} is the element
117196263Sobriendesired.
117296263Sobrien
117390075Sobrien@findex CONST_DOUBLE_MEM
117490075Sobrien@findex CONST_DOUBLE_CHAIN
117590075Sobrien@var{addr} is used to contain the @code{mem} expression that corresponds
117690075Sobriento the location in memory that at which the constant can be found.  If
117790075Sobrienit has not been allocated a memory location, but is on the chain of all
117890075Sobrien@code{const_double} expressions in this compilation (maintained using an
117990075Sobrienundisplayed field), @var{addr} contains @code{const0_rtx}.  If it is not
118090075Sobrienon the chain, @var{addr} contains @code{cc0_rtx}.  @var{addr} is
118190075Sobriencustomarily accessed with the macro @code{CONST_DOUBLE_MEM} and the
118290075Sobrienchain field via @code{CONST_DOUBLE_CHAIN}.
118390075Sobrien
118490075Sobrien@findex CONST_DOUBLE_LOW
118590075SobrienIf @var{m} is @code{VOIDmode}, the bits of the value are stored in
118690075Sobrien@var{i0} and @var{i1}.  @var{i0} is customarily accessed with the macro
118790075Sobrien@code{CONST_DOUBLE_LOW} and @var{i1} with @code{CONST_DOUBLE_HIGH}.
118890075Sobrien
118990075SobrienIf the constant is floating point (regardless of its precision), then
119090075Sobrienthe number of integers used to store the value depends on the size of
119190075Sobrien@code{REAL_VALUE_TYPE} (@pxref{Cross-compilation}).  The integers
119290075Sobrienrepresent a floating point number, but not precisely in the target
119390075Sobrienmachine's or host machine's floating point format.  To convert them to
119490075Sobrienthe precise bit pattern used by the target machine, use the macro
119590075Sobrien@code{REAL_VALUE_TO_TARGET_DOUBLE} and friends (@pxref{Data Output}).
119690075Sobrien
119790075Sobrien@findex CONST0_RTX
119890075Sobrien@findex CONST1_RTX
119990075Sobrien@findex CONST2_RTX
120090075SobrienThe macro @code{CONST0_RTX (@var{mode})} refers to an expression with
120190075Sobrienvalue 0 in mode @var{mode}.  If mode @var{mode} is of mode class
120296263Sobrien@code{MODE_INT}, it returns @code{const0_rtx}.  If mode @var{mode} is of
120396263Sobrienmode class @code{MODE_FLOAT}, it returns a @code{CONST_DOUBLE}
120496263Sobrienexpression in mode @var{mode}.  Otherwise, it returns a
120596263Sobrien@code{CONST_VECTOR} expression in mode @var{mode}.  Similarly, the macro
120690075Sobrien@code{CONST1_RTX (@var{mode})} refers to an expression with value 1 in
120796263Sobrienmode @var{mode} and similarly for @code{CONST2_RTX}.  The
120896263Sobrien@code{CONST1_RTX} and @code{CONST2_RTX} macros are undefined
120996263Sobrienfor vector modes.
121090075Sobrien
121190075Sobrien@findex const_string
121290075Sobrien@item (const_string @var{str})
121390075SobrienRepresents a constant string with value @var{str}.  Currently this is
121490075Sobrienused only for insn attributes (@pxref{Insn Attributes}) since constant
121590075Sobrienstrings in C are placed in memory.
121690075Sobrien
121790075Sobrien@findex symbol_ref
121890075Sobrien@item (symbol_ref:@var{mode} @var{symbol})
121990075SobrienRepresents the value of an assembler label for data.  @var{symbol} is
122090075Sobriena string that describes the name of the assembler label.  If it starts
122190075Sobrienwith a @samp{*}, the label is the rest of @var{symbol} not including
122290075Sobrienthe @samp{*}.  Otherwise, the label is @var{symbol}, usually prefixed
122390075Sobrienwith @samp{_}.
122490075Sobrien
122590075SobrienThe @code{symbol_ref} contains a mode, which is usually @code{Pmode}.
122690075SobrienUsually that is the only mode for which a symbol is directly valid.
122790075Sobrien
122890075Sobrien@findex label_ref
122990075Sobrien@item (label_ref @var{label})
123090075SobrienRepresents the value of an assembler label for code.  It contains one
123190075Sobrienoperand, an expression, which must be a @code{code_label} or a @code{note}
123290075Sobrienof type @code{NOTE_INSN_DELETED_LABEL} that appears in the instruction
123390075Sobriensequence to identify the place where the label should go.
123490075Sobrien
123590075SobrienThe reason for using a distinct expression type for code label
123690075Sobrienreferences is so that jump optimization can distinguish them.
123790075Sobrien
123890075Sobrien@item (const:@var{m} @var{exp})
123990075SobrienRepresents a constant that is the result of an assembly-time
124090075Sobrienarithmetic computation.  The operand, @var{exp}, is an expression that
124190075Sobriencontains only constants (@code{const_int}, @code{symbol_ref} and
124290075Sobrien@code{label_ref} expressions) combined with @code{plus} and
124390075Sobrien@code{minus}.  However, not all combinations are valid, since the
124490075Sobrienassembler cannot do arbitrary arithmetic on relocatable symbols.
124590075Sobrien
124690075Sobrien@var{m} should be @code{Pmode}.
124790075Sobrien
124890075Sobrien@findex high
124990075Sobrien@item (high:@var{m} @var{exp})
125090075SobrienRepresents the high-order bits of @var{exp}, usually a
125190075Sobrien@code{symbol_ref}.  The number of bits is machine-dependent and is
125290075Sobriennormally the number of bits specified in an instruction that initializes
125390075Sobrienthe high order bits of a register.  It is used with @code{lo_sum} to
125490075Sobrienrepresent the typical two-instruction sequence used in RISC machines to
125590075Sobrienreference a global memory location.
125690075Sobrien
125790075Sobrien@var{m} should be @code{Pmode}.
125890075Sobrien@end table
125990075Sobrien
126090075Sobrien@node Regs and Memory
126190075Sobrien@section Registers and Memory
126290075Sobrien@cindex RTL register expressions
126390075Sobrien@cindex RTL memory expressions
126490075Sobrien
126590075SobrienHere are the RTL expression types for describing access to machine
126690075Sobrienregisters and to main memory.
126790075Sobrien
126890075Sobrien@table @code
126990075Sobrien@findex reg
127090075Sobrien@cindex hard registers
127190075Sobrien@cindex pseudo registers
127290075Sobrien@item (reg:@var{m} @var{n})
127390075SobrienFor small values of the integer @var{n} (those that are less than
127490075Sobrien@code{FIRST_PSEUDO_REGISTER}), this stands for a reference to machine
127590075Sobrienregister number @var{n}: a @dfn{hard register}.  For larger values of
127690075Sobrien@var{n}, it stands for a temporary value or @dfn{pseudo register}.
127790075SobrienThe compiler's strategy is to generate code assuming an unlimited
127890075Sobriennumber of such pseudo registers, and later convert them into hard
127990075Sobrienregisters or into memory references.
128090075Sobrien
128190075Sobrien@var{m} is the machine mode of the reference.  It is necessary because
128290075Sobrienmachines can generally refer to each register in more than one mode.
128390075SobrienFor example, a register may contain a full word but there may be
128490075Sobrieninstructions to refer to it as a half word or as a single byte, as
128590075Sobrienwell as instructions to refer to it as a floating point number of
128690075Sobrienvarious precisions.
128790075Sobrien
128890075SobrienEven for a register that the machine can access in only one mode,
128990075Sobrienthe mode must always be specified.
129090075Sobrien
129190075SobrienThe symbol @code{FIRST_PSEUDO_REGISTER} is defined by the machine
129290075Sobriendescription, since the number of hard registers on the machine is an
129390075Sobrieninvariant characteristic of the machine.  Note, however, that not
129490075Sobrienall of the machine registers must be general registers.  All the
129590075Sobrienmachine registers that can be used for storage of data are given
129690075Sobrienhard register numbers, even those that can be used only in certain
129790075Sobrieninstructions or can hold only certain types of data.
129890075Sobrien
129990075SobrienA hard register may be accessed in various modes throughout one
130090075Sobrienfunction, but each pseudo register is given a natural mode
130190075Sobrienand is accessed only in that mode.  When it is necessary to describe
130290075Sobrienan access to a pseudo register using a nonnatural mode, a @code{subreg}
130390075Sobrienexpression is used.
130490075Sobrien
130590075SobrienA @code{reg} expression with a machine mode that specifies more than
130690075Sobrienone word of data may actually stand for several consecutive registers.
130790075SobrienIf in addition the register number specifies a hardware register, then
130890075Sobrienit actually represents several consecutive hardware registers starting
130990075Sobrienwith the specified one.
131090075Sobrien
131190075SobrienEach pseudo register number used in a function's RTL code is
131290075Sobrienrepresented by a unique @code{reg} expression.
131390075Sobrien
131490075Sobrien@findex FIRST_VIRTUAL_REGISTER
131590075Sobrien@findex LAST_VIRTUAL_REGISTER
131690075SobrienSome pseudo register numbers, those within the range of
131790075Sobrien@code{FIRST_VIRTUAL_REGISTER} to @code{LAST_VIRTUAL_REGISTER} only
131890075Sobrienappear during the RTL generation phase and are eliminated before the
131990075Sobrienoptimization phases.  These represent locations in the stack frame that
132090075Sobriencannot be determined until RTL generation for the function has been
132190075Sobriencompleted.  The following virtual register numbers are defined:
132290075Sobrien
132390075Sobrien@table @code
132490075Sobrien@findex VIRTUAL_INCOMING_ARGS_REGNUM
132590075Sobrien@item VIRTUAL_INCOMING_ARGS_REGNUM
132690075SobrienThis points to the first word of the incoming arguments passed on the
132790075Sobrienstack.  Normally these arguments are placed there by the caller, but the
132890075Sobriencallee may have pushed some arguments that were previously passed in
132990075Sobrienregisters.
133090075Sobrien
133190075Sobrien@cindex @code{FIRST_PARM_OFFSET} and virtual registers
133290075Sobrien@cindex @code{ARG_POINTER_REGNUM} and virtual registers
133390075SobrienWhen RTL generation is complete, this virtual register is replaced
133490075Sobrienby the sum of the register given by @code{ARG_POINTER_REGNUM} and the
133590075Sobrienvalue of @code{FIRST_PARM_OFFSET}.
133690075Sobrien
133790075Sobrien@findex VIRTUAL_STACK_VARS_REGNUM
133890075Sobrien@cindex @code{FRAME_GROWS_DOWNWARD} and virtual registers
133990075Sobrien@item VIRTUAL_STACK_VARS_REGNUM
134090075SobrienIf @code{FRAME_GROWS_DOWNWARD} is defined, this points to immediately
134190075Sobrienabove the first variable on the stack.  Otherwise, it points to the
134290075Sobrienfirst variable on the stack.
134390075Sobrien
134490075Sobrien@cindex @code{STARTING_FRAME_OFFSET} and virtual registers
134590075Sobrien@cindex @code{FRAME_POINTER_REGNUM} and virtual registers
134690075Sobrien@code{VIRTUAL_STACK_VARS_REGNUM} is replaced with the sum of the
134790075Sobrienregister given by @code{FRAME_POINTER_REGNUM} and the value
134890075Sobrien@code{STARTING_FRAME_OFFSET}.
134990075Sobrien
135090075Sobrien@findex VIRTUAL_STACK_DYNAMIC_REGNUM
135190075Sobrien@item VIRTUAL_STACK_DYNAMIC_REGNUM
135290075SobrienThis points to the location of dynamically allocated memory on the stack
135390075Sobrienimmediately after the stack pointer has been adjusted by the amount of
135490075Sobrienmemory desired.
135590075Sobrien
135690075Sobrien@cindex @code{STACK_DYNAMIC_OFFSET} and virtual registers
135790075Sobrien@cindex @code{STACK_POINTER_REGNUM} and virtual registers
135890075SobrienThis virtual register is replaced by the sum of the register given by
135990075Sobrien@code{STACK_POINTER_REGNUM} and the value @code{STACK_DYNAMIC_OFFSET}.
136090075Sobrien
136190075Sobrien@findex VIRTUAL_OUTGOING_ARGS_REGNUM
136290075Sobrien@item VIRTUAL_OUTGOING_ARGS_REGNUM
136390075SobrienThis points to the location in the stack at which outgoing arguments
136490075Sobrienshould be written when the stack is pre-pushed (arguments pushed using
136590075Sobrienpush insns should always use @code{STACK_POINTER_REGNUM}).
136690075Sobrien
136790075Sobrien@cindex @code{STACK_POINTER_OFFSET} and virtual registers
136890075SobrienThis virtual register is replaced by the sum of the register given by
136990075Sobrien@code{STACK_POINTER_REGNUM} and the value @code{STACK_POINTER_OFFSET}.
137090075Sobrien@end table
137190075Sobrien
137290075Sobrien@findex subreg
137390075Sobrien@item (subreg:@var{m} @var{reg} @var{bytenum})
137490075Sobrien@code{subreg} expressions are used to refer to a register in a machine
137590075Sobrienmode other than its natural one, or to refer to one register of
137690075Sobriena multi-part @code{reg} that actually refers to several registers.
137790075Sobrien
137890075SobrienEach pseudo-register has a natural mode.  If it is necessary to
137990075Sobrienoperate on it in a different mode---for example, to perform a fullword
138090075Sobrienmove instruction on a pseudo-register that contains a single
138190075Sobrienbyte---the pseudo-register must be enclosed in a @code{subreg}.  In
138290075Sobriensuch a case, @var{bytenum} is zero.
138390075Sobrien
138490075SobrienUsually @var{m} is at least as narrow as the mode of @var{reg}, in which
138590075Sobriencase it is restricting consideration to only the bits of @var{reg} that
138690075Sobrienare in @var{m}.
138790075Sobrien
138890075SobrienSometimes @var{m} is wider than the mode of @var{reg}.  These
138990075Sobrien@code{subreg} expressions are often called @dfn{paradoxical}.  They are
139090075Sobrienused in cases where we want to refer to an object in a wider mode but do
139190075Sobriennot care what value the additional bits have.  The reload pass ensures
139290075Sobrienthat paradoxical references are only made to hard registers.
139390075Sobrien
139490075SobrienThe other use of @code{subreg} is to extract the individual registers of
139590075Sobriena multi-register value.  Machine modes such as @code{DImode} and
139690075Sobrien@code{TImode} can indicate values longer than a word, values which
139790075Sobrienusually require two or more consecutive registers.  To access one of the
139890075Sobrienregisters, use a @code{subreg} with mode @code{SImode} and a
139990075Sobrien@var{bytenum} offset that says which register.
140090075Sobrien
140190075SobrienStoring in a non-paradoxical @code{subreg} has undefined results for
140290075Sobrienbits belonging to the same word as the @code{subreg}.  This laxity makes
140390075Sobrienit easier to generate efficient code for such instructions.  To
140490075Sobrienrepresent an instruction that preserves all the bits outside of those in
140590075Sobrienthe @code{subreg}, use @code{strict_low_part} around the @code{subreg}.
140690075Sobrien
140790075Sobrien@cindex @code{WORDS_BIG_ENDIAN}, effect on @code{subreg}
140890075SobrienThe compilation parameter @code{WORDS_BIG_ENDIAN}, if set to 1, says
140990075Sobrienthat byte number zero is part of the most significant word; otherwise,
141090075Sobrienit is part of the least significant word.
141190075Sobrien
141290075Sobrien@cindex @code{BYTES_BIG_ENDIAN}, effect on @code{subreg}
141390075SobrienThe compilation parameter @code{BYTES_BIG_ENDIAN}, if set to 1, says
141490075Sobrienthat byte number zero is the most significant byte within a word;
141590075Sobrienotherwise, it is the least significant byte within a word.
141690075Sobrien
141790075Sobrien@cindex @code{FLOAT_WORDS_BIG_ENDIAN}, (lack of) effect on @code{subreg}
141890075SobrienOn a few targets, @code{FLOAT_WORDS_BIG_ENDIAN} disagrees with
141990075Sobrien@code{WORDS_BIG_ENDIAN}.
142090075SobrienHowever, most parts of the compiler treat floating point values as if
142190075Sobrienthey had the same endianness as integer values.  This works because
142290075Sobrienthey handle them solely as a collection of integer values, with no
142390075Sobrienparticular numerical value.  Only real.c and the runtime libraries
142490075Sobriencare about @code{FLOAT_WORDS_BIG_ENDIAN}.
142590075Sobrien
142690075Sobrien@cindex combiner pass
142790075Sobrien@cindex reload pass
142890075Sobrien@cindex @code{subreg}, special reload handling
142990075SobrienBetween the combiner pass and the reload pass, it is possible to have a
143090075Sobrienparadoxical @code{subreg} which contains a @code{mem} instead of a
143190075Sobrien@code{reg} as its first operand.  After the reload pass, it is also
143290075Sobrienpossible to have a non-paradoxical @code{subreg} which contains a
143390075Sobrien@code{mem}; this usually occurs when the @code{mem} is a stack slot
143490075Sobrienwhich replaced a pseudo register.
143590075Sobrien
143690075SobrienNote that it is not valid to access a @code{DFmode} value in @code{SFmode}
143790075Sobrienusing a @code{subreg}.  On some machines the most significant part of a
143890075Sobrien@code{DFmode} value does not have the same format as a single-precision
143990075Sobrienfloating value.
144090075Sobrien
144190075SobrienIt is also not valid to access a single word of a multi-word value in a
144290075Sobrienhard register when less registers can hold the value than would be
144390075Sobrienexpected from its size.  For example, some 32-bit machines have
144490075Sobrienfloating-point registers that can hold an entire @code{DFmode} value.
144590075SobrienIf register 10 were such a register @code{(subreg:SI (reg:DF 10) 1)}
144690075Sobrienwould be invalid because there is no way to convert that reference to
144790075Sobriena single machine register.  The reload pass prevents @code{subreg}
144890075Sobrienexpressions such as these from being formed.
144990075Sobrien
145090075Sobrien@findex SUBREG_REG
145190075Sobrien@findex SUBREG_BYTE
145290075SobrienThe first operand of a @code{subreg} expression is customarily accessed
145390075Sobrienwith the @code{SUBREG_REG} macro and the second operand is customarily
145490075Sobrienaccessed with the @code{SUBREG_BYTE} macro.
145590075Sobrien
145690075Sobrien@findex scratch
145790075Sobrien@cindex scratch operands
145890075Sobrien@item (scratch:@var{m})
145990075SobrienThis represents a scratch register that will be required for the
146090075Sobrienexecution of a single instruction and not used subsequently.  It is
146190075Sobrienconverted into a @code{reg} by either the local register allocator or
146290075Sobrienthe reload pass.
146390075Sobrien
146490075Sobrien@code{scratch} is usually present inside a @code{clobber} operation
146590075Sobrien(@pxref{Side Effects}).
146690075Sobrien
146790075Sobrien@findex cc0
146890075Sobrien@cindex condition code register
146990075Sobrien@item (cc0)
147090075SobrienThis refers to the machine's condition code register.  It has no
147190075Sobrienoperands and may not have a machine mode.  There are two ways to use it:
147290075Sobrien
147390075Sobrien@itemize @bullet
147490075Sobrien@item
147590075SobrienTo stand for a complete set of condition code flags.  This is best on
147690075Sobrienmost machines, where each comparison sets the entire series of flags.
147790075Sobrien
147890075SobrienWith this technique, @code{(cc0)} may be validly used in only two
147990075Sobriencontexts: as the destination of an assignment (in test and compare
148090075Sobrieninstructions) and in comparison operators comparing against zero
148190075Sobrien(@code{const_int} with value zero; that is to say, @code{const0_rtx}).
148290075Sobrien
148390075Sobrien@item
148490075SobrienTo stand for a single flag that is the result of a single condition.
148590075SobrienThis is useful on machines that have only a single flag bit, and in
148690075Sobrienwhich comparison instructions must specify the condition to test.
148790075Sobrien
148890075SobrienWith this technique, @code{(cc0)} may be validly used in only two
148990075Sobriencontexts: as the destination of an assignment (in test and compare
149090075Sobrieninstructions) where the source is a comparison operator, and as the
149190075Sobrienfirst operand of @code{if_then_else} (in a conditional branch).
149290075Sobrien@end itemize
149390075Sobrien
149490075Sobrien@findex cc0_rtx
149590075SobrienThere is only one expression object of code @code{cc0}; it is the
149690075Sobrienvalue of the variable @code{cc0_rtx}.  Any attempt to create an
149790075Sobrienexpression of code @code{cc0} will return @code{cc0_rtx}.
149890075Sobrien
149990075SobrienInstructions can set the condition code implicitly.  On many machines,
150090075Sobriennearly all instructions set the condition code based on the value that
150190075Sobrienthey compute or store.  It is not necessary to record these actions
150290075Sobrienexplicitly in the RTL because the machine description includes a
150390075Sobrienprescription for recognizing the instructions that do so (by means of
150490075Sobrienthe macro @code{NOTICE_UPDATE_CC}).  @xref{Condition Code}.  Only
150590075Sobrieninstructions whose sole purpose is to set the condition code, and
150690075Sobrieninstructions that use the condition code, need mention @code{(cc0)}.
150790075Sobrien
150890075SobrienOn some machines, the condition code register is given a register number
150990075Sobrienand a @code{reg} is used instead of @code{(cc0)}.  This is usually the
151090075Sobrienpreferable approach if only a small subset of instructions modify the
151190075Sobriencondition code.  Other machines store condition codes in general
151290075Sobrienregisters; in such cases a pseudo register should be used.
151390075Sobrien
151490075SobrienSome machines, such as the Sparc and RS/6000, have two sets of
151590075Sobrienarithmetic instructions, one that sets and one that does not set the
151690075Sobriencondition code.  This is best handled by normally generating the
151790075Sobrieninstruction that does not set the condition code, and making a pattern
151890075Sobrienthat both performs the arithmetic and sets the condition code register
151990075Sobrien(which would not be @code{(cc0)} in this case).  For examples, search
152090075Sobrienfor @samp{addcc} and @samp{andcc} in @file{sparc.md}.
152190075Sobrien
152290075Sobrien@findex pc
152390075Sobrien@item (pc)
152490075Sobrien@cindex program counter
152590075SobrienThis represents the machine's program counter.  It has no operands and
152690075Sobrienmay not have a machine mode.  @code{(pc)} may be validly used only in
152790075Sobriencertain specific contexts in jump instructions.
152890075Sobrien
152990075Sobrien@findex pc_rtx
153090075SobrienThere is only one expression object of code @code{pc}; it is the value
153190075Sobrienof the variable @code{pc_rtx}.  Any attempt to create an expression of
153290075Sobriencode @code{pc} will return @code{pc_rtx}.
153390075Sobrien
153490075SobrienAll instructions that do not jump alter the program counter implicitly
153590075Sobrienby incrementing it, but there is no need to mention this in the RTL@.
153690075Sobrien
153790075Sobrien@findex mem
153890075Sobrien@item (mem:@var{m} @var{addr} @var{alias})
153990075SobrienThis RTX represents a reference to main memory at an address
154090075Sobrienrepresented by the expression @var{addr}.  @var{m} specifies how large
154190075Sobriena unit of memory is accessed.  @var{alias} specifies an alias set for the
154290075Sobrienreference.  In general two items are in different alias sets if they cannot
154390075Sobrienreference the same memory address.
154490075Sobrien
154590075Sobrien@findex addressof
154690075Sobrien@item (addressof:@var{m} @var{reg})
154790075SobrienThis RTX represents a request for the address of register @var{reg}.  Its mode
154890075Sobrienis always @code{Pmode}.  If there are any @code{addressof}
154990075Sobrienexpressions left in the function after CSE, @var{reg} is forced into the
155090075Sobrienstack and the @code{addressof} expression is replaced with a @code{plus}
155190075Sobrienexpression for the address of its stack slot.
155290075Sobrien@end table
155390075Sobrien
155490075Sobrien@node Arithmetic
155590075Sobrien@section RTL Expressions for Arithmetic
155690075Sobrien@cindex arithmetic, in RTL
155790075Sobrien@cindex math, in RTL
155890075Sobrien@cindex RTL expressions for arithmetic
155990075Sobrien
156090075SobrienUnless otherwise specified, all the operands of arithmetic expressions
156190075Sobrienmust be valid for mode @var{m}.  An operand is valid for mode @var{m}
156290075Sobrienif it has mode @var{m}, or if it is a @code{const_int} or
156390075Sobrien@code{const_double} and @var{m} is a mode of class @code{MODE_INT}.
156490075Sobrien
156590075SobrienFor commutative binary operations, constants should be placed in the
156690075Sobriensecond operand.
156790075Sobrien
156890075Sobrien@table @code
156990075Sobrien@findex plus
157090075Sobrien@cindex RTL addition
157190075Sobrien@cindex RTL sum
157290075Sobrien@item (plus:@var{m} @var{x} @var{y})
157390075SobrienRepresents the sum of the values represented by @var{x} and @var{y}
157490075Sobriencarried out in machine mode @var{m}.
157590075Sobrien
157690075Sobrien@findex lo_sum
157790075Sobrien@item (lo_sum:@var{m} @var{x} @var{y})
157890075SobrienLike @code{plus}, except that it represents that sum of @var{x} and the
157990075Sobrienlow-order bits of @var{y}.  The number of low order bits is
158090075Sobrienmachine-dependent but is normally the number of bits in a @code{Pmode}
158190075Sobrienitem minus the number of bits set by the @code{high} code
158290075Sobrien(@pxref{Constants}).
158390075Sobrien
158490075Sobrien@var{m} should be @code{Pmode}.
158590075Sobrien
158690075Sobrien@findex minus
158790075Sobrien@cindex RTL subtraction
158890075Sobrien@cindex RTL difference
158990075Sobrien@item (minus:@var{m} @var{x} @var{y})
159090075SobrienLike @code{plus} but represents subtraction.
159190075Sobrien
159290075Sobrien@findex ss_plus
159390075Sobrien@cindex RTL addition with signed saturation
159490075Sobrien@item (ss_plus:@var{m} @var{x} @var{y})
159590075Sobrien
159690075SobrienLike @code{plus}, but using signed saturation in case of an overflow.
159790075Sobrien
159890075Sobrien@findex us_plus
159990075Sobrien@cindex RTL addition with unsigned saturation
160090075Sobrien@item (us_plus:@var{m} @var{x} @var{y})
160190075Sobrien
160290075SobrienLike @code{plus}, but using unsigned saturation in case of an overflow.
160390075Sobrien
160490075Sobrien@findex ss_minus
160590075Sobrien@cindex RTL addition with signed saturation
160690075Sobrien@item (ss_minus:@var{m} @var{x} @var{y})
160790075Sobrien
160890075SobrienLike @code{minus}, but using signed saturation in case of an overflow.
160990075Sobrien
161090075Sobrien@findex us_minus
161190075Sobrien@cindex RTL addition with unsigned saturation
161290075Sobrien@item (us_minus:@var{m} @var{x} @var{y})
161390075Sobrien
161490075SobrienLike @code{minus}, but using unsigned saturation in case of an overflow.
161590075Sobrien
161690075Sobrien@findex compare
161790075Sobrien@cindex RTL comparison
161890075Sobrien@item (compare:@var{m} @var{x} @var{y})
161990075SobrienRepresents the result of subtracting @var{y} from @var{x} for purposes
162090075Sobrienof comparison.  The result is computed without overflow, as if with
162190075Sobrieninfinite precision.
162290075Sobrien
162390075SobrienOf course, machines can't really subtract with infinite precision.
162490075SobrienHowever, they can pretend to do so when only the sign of the result will
162590075Sobrienbe used, which is the case when the result is stored in the condition
162690075Sobriencode.  And that is the @emph{only} way this kind of expression may
162790075Sobrienvalidly be used: as a value to be stored in the condition codes, either
162890075Sobrien@code{(cc0)} or a register.  @xref{Comparisons}.
162990075Sobrien
163090075SobrienThe mode @var{m} is not related to the modes of @var{x} and @var{y}, but
163190075Sobrieninstead is the mode of the condition code value.  If @code{(cc0)} is
163290075Sobrienused, it is @code{VOIDmode}.  Otherwise it is some mode in class
163390075Sobrien@code{MODE_CC}, often @code{CCmode}.  @xref{Condition Code}.  If @var{m}
163490075Sobrienis @code{VOIDmode} or @code{CCmode}, the operation returns sufficient
163590075Sobrieninformation (in an unspecified format) so that any comparison operator
163690075Sobriencan be applied to the result of the @code{COMPARE} operation.  For other
163790075Sobrienmodes in class @code{MODE_CC}, the operation only returns a subset of
163890075Sobrienthis information.
163990075Sobrien
164090075SobrienNormally, @var{x} and @var{y} must have the same mode.  Otherwise,
164190075Sobrien@code{compare} is valid only if the mode of @var{x} is in class
164290075Sobrien@code{MODE_INT} and @var{y} is a @code{const_int} or
164390075Sobrien@code{const_double} with mode @code{VOIDmode}.  The mode of @var{x}
164490075Sobriendetermines what mode the comparison is to be done in; thus it must not
164590075Sobrienbe @code{VOIDmode}.
164690075Sobrien
164790075SobrienIf one of the operands is a constant, it should be placed in the
164890075Sobriensecond operand and the comparison code adjusted as appropriate.
164990075Sobrien
165090075SobrienA @code{compare} specifying two @code{VOIDmode} constants is not valid
165190075Sobriensince there is no way to know in what mode the comparison is to be
165290075Sobrienperformed; the comparison must either be folded during the compilation
165390075Sobrienor the first operand must be loaded into a register while its mode is
165490075Sobrienstill known.
165590075Sobrien
165690075Sobrien@findex neg
165790075Sobrien@item (neg:@var{m} @var{x})
165890075SobrienRepresents the negation (subtraction from zero) of the value represented
165990075Sobrienby @var{x}, carried out in mode @var{m}.
166090075Sobrien
166190075Sobrien@findex mult
166290075Sobrien@cindex multiplication
166390075Sobrien@cindex product
166490075Sobrien@item (mult:@var{m} @var{x} @var{y})
166590075SobrienRepresents the signed product of the values represented by @var{x} and
166690075Sobrien@var{y} carried out in machine mode @var{m}.
166790075Sobrien
166890075SobrienSome machines support a multiplication that generates a product wider
166990075Sobrienthan the operands.  Write the pattern for this as
167090075Sobrien
167190075Sobrien@example
167290075Sobrien(mult:@var{m} (sign_extend:@var{m} @var{x}) (sign_extend:@var{m} @var{y}))
167390075Sobrien@end example
167490075Sobrien
167590075Sobrienwhere @var{m} is wider than the modes of @var{x} and @var{y}, which need
167690075Sobriennot be the same.
167790075Sobrien
167890075SobrienFor unsigned widening multiplication, use the same idiom, but with
167990075Sobrien@code{zero_extend} instead of @code{sign_extend}.
168090075Sobrien
168190075Sobrien@findex div
168290075Sobrien@cindex division
168390075Sobrien@cindex signed division
168490075Sobrien@cindex quotient
168590075Sobrien@item (div:@var{m} @var{x} @var{y})
168690075SobrienRepresents the quotient in signed division of @var{x} by @var{y},
168790075Sobriencarried out in machine mode @var{m}.  If @var{m} is a floating point
168890075Sobrienmode, it represents the exact quotient; otherwise, the integerized
168990075Sobrienquotient.
169090075Sobrien
169190075SobrienSome machines have division instructions in which the operands and
169290075Sobrienquotient widths are not all the same; you should represent
169390075Sobriensuch instructions using @code{truncate} and @code{sign_extend} as in,
169490075Sobrien
169590075Sobrien@example
169690075Sobrien(truncate:@var{m1} (div:@var{m2} @var{x} (sign_extend:@var{m2} @var{y})))
169790075Sobrien@end example
169890075Sobrien
169990075Sobrien@findex udiv
170090075Sobrien@cindex unsigned division
170190075Sobrien@cindex division
170290075Sobrien@item (udiv:@var{m} @var{x} @var{y})
170390075SobrienLike @code{div} but represents unsigned division.
170490075Sobrien
170590075Sobrien@findex mod
170690075Sobrien@findex umod
170790075Sobrien@cindex remainder
170890075Sobrien@cindex division
170990075Sobrien@item (mod:@var{m} @var{x} @var{y})
171090075Sobrien@itemx (umod:@var{m} @var{x} @var{y})
171190075SobrienLike @code{div} and @code{udiv} but represent the remainder instead of
171290075Sobrienthe quotient.
171390075Sobrien
171490075Sobrien@findex smin
171590075Sobrien@findex smax
171690075Sobrien@cindex signed minimum
171790075Sobrien@cindex signed maximum
171890075Sobrien@item (smin:@var{m} @var{x} @var{y})
171990075Sobrien@itemx (smax:@var{m} @var{x} @var{y})
172090075SobrienRepresents the smaller (for @code{smin}) or larger (for @code{smax}) of
172190075Sobrien@var{x} and @var{y}, interpreted as signed integers in mode @var{m}.
172290075Sobrien
172390075Sobrien@findex umin
172490075Sobrien@findex umax
172590075Sobrien@cindex unsigned minimum and maximum
172690075Sobrien@item (umin:@var{m} @var{x} @var{y})
172790075Sobrien@itemx (umax:@var{m} @var{x} @var{y})
172890075SobrienLike @code{smin} and @code{smax}, but the values are interpreted as unsigned
172990075Sobrienintegers.
173090075Sobrien
173190075Sobrien@findex not
173290075Sobrien@cindex complement, bitwise
173390075Sobrien@cindex bitwise complement
173490075Sobrien@item (not:@var{m} @var{x})
173590075SobrienRepresents the bitwise complement of the value represented by @var{x},
173690075Sobriencarried out in mode @var{m}, which must be a fixed-point machine mode.
173790075Sobrien
173890075Sobrien@findex and
173990075Sobrien@cindex logical-and, bitwise
174090075Sobrien@cindex bitwise logical-and
174190075Sobrien@item (and:@var{m} @var{x} @var{y})
174290075SobrienRepresents the bitwise logical-and of the values represented by
174390075Sobrien@var{x} and @var{y}, carried out in machine mode @var{m}, which must be
174490075Sobriena fixed-point machine mode.
174590075Sobrien
174690075Sobrien@findex ior
174790075Sobrien@cindex inclusive-or, bitwise
174890075Sobrien@cindex bitwise inclusive-or
174990075Sobrien@item (ior:@var{m} @var{x} @var{y})
175090075SobrienRepresents the bitwise inclusive-or of the values represented by @var{x}
175190075Sobrienand @var{y}, carried out in machine mode @var{m}, which must be a
175290075Sobrienfixed-point mode.
175390075Sobrien
175490075Sobrien@findex xor
175590075Sobrien@cindex exclusive-or, bitwise
175690075Sobrien@cindex bitwise exclusive-or
175790075Sobrien@item (xor:@var{m} @var{x} @var{y})
175890075SobrienRepresents the bitwise exclusive-or of the values represented by @var{x}
175990075Sobrienand @var{y}, carried out in machine mode @var{m}, which must be a
176090075Sobrienfixed-point mode.
176190075Sobrien
176290075Sobrien@findex ashift
176390075Sobrien@cindex left shift
176490075Sobrien@cindex shift
176590075Sobrien@cindex arithmetic shift
176690075Sobrien@item (ashift:@var{m} @var{x} @var{c})
176790075SobrienRepresents the result of arithmetically shifting @var{x} left by @var{c}
176890075Sobrienplaces.  @var{x} have mode @var{m}, a fixed-point machine mode.  @var{c}
176990075Sobrienbe a fixed-point mode or be a constant with mode @code{VOIDmode}; which
177090075Sobrienmode is determined by the mode called for in the machine description
177190075Sobrienentry for the left-shift instruction.  For example, on the VAX, the mode
177290075Sobrienof @var{c} is @code{QImode} regardless of @var{m}.
177390075Sobrien
177490075Sobrien@findex lshiftrt
177590075Sobrien@cindex right shift
177690075Sobrien@findex ashiftrt
177790075Sobrien@item (lshiftrt:@var{m} @var{x} @var{c})
177890075Sobrien@itemx (ashiftrt:@var{m} @var{x} @var{c})
177990075SobrienLike @code{ashift} but for right shift.  Unlike the case for left shift,
178090075Sobrienthese two operations are distinct.
178190075Sobrien
178290075Sobrien@findex rotate
178390075Sobrien@cindex rotate
178490075Sobrien@cindex left rotate
178590075Sobrien@findex rotatert
178690075Sobrien@cindex right rotate
178790075Sobrien@item (rotate:@var{m} @var{x} @var{c})
178890075Sobrien@itemx (rotatert:@var{m} @var{x} @var{c})
178990075SobrienSimilar but represent left and right rotate.  If @var{c} is a constant,
179090075Sobrienuse @code{rotate}.
179190075Sobrien
179290075Sobrien@findex abs
179390075Sobrien@cindex absolute value
179490075Sobrien@item (abs:@var{m} @var{x})
179590075SobrienRepresents the absolute value of @var{x}, computed in mode @var{m}.
179690075Sobrien
179790075Sobrien@findex sqrt
179890075Sobrien@cindex square root
179990075Sobrien@item (sqrt:@var{m} @var{x})
180090075SobrienRepresents the square root of @var{x}, computed in mode @var{m}.
180190075SobrienMost often @var{m} will be a floating point mode.
180290075Sobrien
180390075Sobrien@findex ffs
180490075Sobrien@item (ffs:@var{m} @var{x})
180590075SobrienRepresents one plus the index of the least significant 1-bit in
180690075Sobrien@var{x}, represented as an integer of mode @var{m}.  (The value is
180790075Sobrienzero if @var{x} is zero.)  The mode of @var{x} need not be @var{m};
180890075Sobriendepending on the target machine, various mode combinations may be
180990075Sobrienvalid.
181090075Sobrien@end table
181190075Sobrien
181290075Sobrien@node Comparisons
181390075Sobrien@section Comparison Operations
181490075Sobrien@cindex RTL comparison operations
181590075Sobrien
181690075SobrienComparison operators test a relation on two operands and are considered
181790075Sobriento represent a machine-dependent nonzero value described by, but not
181890075Sobriennecessarily equal to, @code{STORE_FLAG_VALUE} (@pxref{Misc})
181990075Sobrienif the relation holds, or zero if it does not.  The mode of the
182090075Sobriencomparison operation is independent of the mode of the data being
182190075Sobriencompared.  If the comparison operation is being tested (e.g., the first
182290075Sobrienoperand of an @code{if_then_else}), the mode must be @code{VOIDmode}.
182390075SobrienIf the comparison operation is producing data to be stored in some
182490075Sobrienvariable, the mode must be in class @code{MODE_INT}.  All comparison
182590075Sobrienoperations producing data must use the same mode, which is
182690075Sobrienmachine-specific.
182790075Sobrien
182890075Sobrien@cindex condition codes
182990075SobrienThere are two ways that comparison operations may be used.  The
183090075Sobriencomparison operators may be used to compare the condition codes
183190075Sobrien@code{(cc0)} against zero, as in @code{(eq (cc0) (const_int 0))}.  Such
183290075Sobriena construct actually refers to the result of the preceding instruction
183390075Sobrienin which the condition codes were set.  The instruction setting the
183490075Sobriencondition code must be adjacent to the instruction using the condition
183590075Sobriencode; only @code{note} insns may separate them.
183690075Sobrien
183790075SobrienAlternatively, a comparison operation may directly compare two data
183890075Sobrienobjects.  The mode of the comparison is determined by the operands; they
183990075Sobrienmust both be valid for a common machine mode.  A comparison with both
184090075Sobrienoperands constant would be invalid as the machine mode could not be
184190075Sobriendeduced from it, but such a comparison should never exist in RTL due to
184290075Sobrienconstant folding.
184390075Sobrien
184490075SobrienIn the example above, if @code{(cc0)} were last set to
184590075Sobrien@code{(compare @var{x} @var{y})}, the comparison operation is
184690075Sobrienidentical to @code{(eq @var{x} @var{y})}.  Usually only one style
184790075Sobrienof comparisons is supported on a particular machine, but the combine
184890075Sobrienpass will try to merge the operations to produce the @code{eq} shown
184990075Sobrienin case it exists in the context of the particular insn involved.
185090075Sobrien
185190075SobrienInequality comparisons come in two flavors, signed and unsigned.  Thus,
185290075Sobrienthere are distinct expression codes @code{gt} and @code{gtu} for signed and
185390075Sobrienunsigned greater-than.  These can produce different results for the same
185490075Sobrienpair of integer values: for example, 1 is signed greater-than @minus{}1 but not
185590075Sobrienunsigned greater-than, because @minus{}1 when regarded as unsigned is actually
185690075Sobrien@code{0xffffffff} which is greater than 1.
185790075Sobrien
185890075SobrienThe signed comparisons are also used for floating point values.  Floating
185990075Sobrienpoint comparisons are distinguished by the machine modes of the operands.
186090075Sobrien
186190075Sobrien@table @code
186290075Sobrien@findex eq
186390075Sobrien@cindex equal
186490075Sobrien@item (eq:@var{m} @var{x} @var{y})
186590075Sobrien@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y}
186690075Sobrienare equal, otherwise 0.
186790075Sobrien
186890075Sobrien@findex ne
186990075Sobrien@cindex not equal
187090075Sobrien@item (ne:@var{m} @var{x} @var{y})
187190075Sobrien@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y}
187290075Sobrienare not equal, otherwise 0.
187390075Sobrien
187490075Sobrien@findex gt
187590075Sobrien@cindex greater than
187690075Sobrien@item (gt:@var{m} @var{x} @var{y})
187790075Sobrien@code{STORE_FLAG_VALUE} if the @var{x} is greater than @var{y}.  If they
187890075Sobrienare fixed-point, the comparison is done in a signed sense.
187990075Sobrien
188090075Sobrien@findex gtu
188190075Sobrien@cindex greater than
188290075Sobrien@cindex unsigned greater than
188390075Sobrien@item (gtu:@var{m} @var{x} @var{y})
188490075SobrienLike @code{gt} but does unsigned comparison, on fixed-point numbers only.
188590075Sobrien
188690075Sobrien@findex lt
188790075Sobrien@cindex less than
188890075Sobrien@findex ltu
188990075Sobrien@cindex unsigned less than
189090075Sobrien@item (lt:@var{m} @var{x} @var{y})
189190075Sobrien@itemx (ltu:@var{m} @var{x} @var{y})
189290075SobrienLike @code{gt} and @code{gtu} but test for ``less than''.
189390075Sobrien
189490075Sobrien@findex ge
189590075Sobrien@cindex greater than
189690075Sobrien@findex geu
189790075Sobrien@cindex unsigned greater than
189890075Sobrien@item (ge:@var{m} @var{x} @var{y})
189990075Sobrien@itemx (geu:@var{m} @var{x} @var{y})
190090075SobrienLike @code{gt} and @code{gtu} but test for ``greater than or equal''.
190190075Sobrien
190290075Sobrien@findex le
190390075Sobrien@cindex less than or equal
190490075Sobrien@findex leu
190590075Sobrien@cindex unsigned less than
190690075Sobrien@item (le:@var{m} @var{x} @var{y})
190790075Sobrien@itemx (leu:@var{m} @var{x} @var{y})
190890075SobrienLike @code{gt} and @code{gtu} but test for ``less than or equal''.
190990075Sobrien
191090075Sobrien@findex if_then_else
191190075Sobrien@item (if_then_else @var{cond} @var{then} @var{else})
191290075SobrienThis is not a comparison operation but is listed here because it is
191390075Sobrienalways used in conjunction with a comparison operation.  To be
191490075Sobrienprecise, @var{cond} is a comparison expression.  This expression
191590075Sobrienrepresents a choice, according to @var{cond}, between the value
191690075Sobrienrepresented by @var{then} and the one represented by @var{else}.
191790075Sobrien
191890075SobrienOn most machines, @code{if_then_else} expressions are valid only
191990075Sobriento express conditional jumps.
192090075Sobrien
192190075Sobrien@findex cond
192290075Sobrien@item (cond [@var{test1} @var{value1} @var{test2} @var{value2} @dots{}] @var{default})
192390075SobrienSimilar to @code{if_then_else}, but more general.  Each of @var{test1},
192490075Sobrien@var{test2}, @dots{} is performed in turn.  The result of this expression is
192590075Sobrienthe @var{value} corresponding to the first nonzero test, or @var{default} if
192690075Sobriennone of the tests are nonzero expressions.
192790075Sobrien
192890075SobrienThis is currently not valid for instruction patterns and is supported only
192990075Sobrienfor insn attributes.  @xref{Insn Attributes}.
193090075Sobrien@end table
193190075Sobrien
193290075Sobrien@node Bit-Fields
193390075Sobrien@section Bit-Fields
193490075Sobrien@cindex bit-fields
193590075Sobrien
193690075SobrienSpecial expression codes exist to represent bit-field instructions.
193790075SobrienThese types of expressions are lvalues in RTL; they may appear
193890075Sobrienon the left side of an assignment, indicating insertion of a value
193990075Sobrieninto the specified bit-field.
194090075Sobrien
194190075Sobrien@table @code
194290075Sobrien@findex sign_extract
194390075Sobrien@cindex @code{BITS_BIG_ENDIAN}, effect on @code{sign_extract}
194490075Sobrien@item (sign_extract:@var{m} @var{loc} @var{size} @var{pos})
194590075SobrienThis represents a reference to a sign-extended bit-field contained or
194690075Sobrienstarting in @var{loc} (a memory or register reference).  The bit-field
194790075Sobrienis @var{size} bits wide and starts at bit @var{pos}.  The compilation
194890075Sobrienoption @code{BITS_BIG_ENDIAN} says which end of the memory unit
194990075Sobrien@var{pos} counts from.
195090075Sobrien
195190075SobrienIf @var{loc} is in memory, its mode must be a single-byte integer mode.
195290075SobrienIf @var{loc} is in a register, the mode to use is specified by the
195390075Sobrienoperand of the @code{insv} or @code{extv} pattern
195490075Sobrien(@pxref{Standard Names}) and is usually a full-word integer mode,
195590075Sobrienwhich is the default if none is specified.
195690075Sobrien
195790075SobrienThe mode of @var{pos} is machine-specific and is also specified
195890075Sobrienin the @code{insv} or @code{extv} pattern.
195990075Sobrien
196090075SobrienThe mode @var{m} is the same as the mode that would be used for
196190075Sobrien@var{loc} if it were a register.
196290075Sobrien
196390075Sobrien@findex zero_extract
196490075Sobrien@item (zero_extract:@var{m} @var{loc} @var{size} @var{pos})
196590075SobrienLike @code{sign_extract} but refers to an unsigned or zero-extended
196690075Sobrienbit-field.  The same sequence of bits are extracted, but they
196790075Sobrienare filled to an entire word with zeros instead of by sign-extension.
196890075Sobrien@end table
196990075Sobrien
197090075Sobrien@node Vector Operations
197190075Sobrien@section Vector Operations
197290075Sobrien@cindex vector operations
197390075Sobrien
197490075SobrienAll normal RTL expressions can be used with vector modes; they are
197590075Sobrieninterpreted as operating on each part of the vector independently.
197690075SobrienAdditionally, there are a few new expressions to describe specific vector
197790075Sobrienoperations.
197890075Sobrien
197990075Sobrien@table @code
198090075Sobrien@findex vec_merge
198190075Sobrien@item (vec_merge:@var{m} @var{vec1} @var{vec2} @var{items})
198290075SobrienThis describes a merge operation between two vectors.  The result is a vector
198390075Sobrienof mode @var{m}; its elements are selected from either @var{vec1} or
198490075Sobrien@var{vec2}.  Which elements are selected is described by @var{items}, which
198590075Sobrienis a bit mask represented by a @code{const_int}; a zero bit indicates the
198690075Sobriencorresponding element in the result vector is taken from @var{vec2} while
198790075Sobriena set bit indicates it is taken from @var{vec1}.
198890075Sobrien
198990075Sobrien@findex vec_select
199090075Sobrien@item (vec_select:@var{m} @var{vec1} @var{selection})
199190075SobrienThis describes an operation that selects parts of a vector.  @var{vec1} is
199290075Sobrienthe source vector, @var{selection} is a @code{parallel} that contains a
199390075Sobrien@code{const_int} for each of the subparts of the result vector, giving the
199490075Sobriennumber of the source subpart that should be stored into it.
199590075Sobrien
199690075Sobrien@findex vec_concat
199790075Sobrien@item (vec_concat:@var{m} @var{vec1} @var{vec2})
199890075SobrienDescribes a vector concat operation.  The result is a concatenation of the
199990075Sobrienvectors @var{vec1} and @var{vec2}; its length is the sum of the lengths of
200090075Sobrienthe two inputs.
200190075Sobrien
200290075Sobrien@findex vec_const
200390075Sobrien@item (vec_const:@var{m} @var{subparts})
200490075SobrienThis describes a constant vector.  @var{subparts} is a @code{parallel} that
200590075Sobriencontains a constant for each of the subparts of the vector.
200690075Sobrien
200790075Sobrien@findex vec_duplicate
200890075Sobrien@item (vec_duplicate:@var{m} @var{vec})
200990075SobrienThis operation converts a small vector into a larger one by duplicating the
201090075Sobrieninput values.  The output vector mode must have the same submodes as the
201190075Sobrieninput vector mode, and the number of output parts must be an integer multiple
201290075Sobrienof the number of input parts.
201390075Sobrien
201490075Sobrien@end table
201590075Sobrien
201690075Sobrien@node Conversions
201790075Sobrien@section Conversions
201890075Sobrien@cindex conversions
201990075Sobrien@cindex machine mode conversions
202090075Sobrien
202190075SobrienAll conversions between machine modes must be represented by
202290075Sobrienexplicit conversion operations.  For example, an expression
202390075Sobrienwhich is the sum of a byte and a full word cannot be written as
202490075Sobrien@code{(plus:SI (reg:QI 34) (reg:SI 80))} because the @code{plus}
202590075Sobrienoperation requires two operands of the same machine mode.
202690075SobrienTherefore, the byte-sized operand is enclosed in a conversion
202790075Sobrienoperation, as in
202890075Sobrien
202990075Sobrien@example
203090075Sobrien(plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
203190075Sobrien@end example
203290075Sobrien
203390075SobrienThe conversion operation is not a mere placeholder, because there
203490075Sobrienmay be more than one way of converting from a given starting mode
203590075Sobriento the desired final mode.  The conversion operation code says how
203690075Sobriento do it.
203790075Sobrien
203890075SobrienFor all conversion operations, @var{x} must not be @code{VOIDmode}
203990075Sobrienbecause the mode in which to do the conversion would not be known.
204090075SobrienThe conversion must either be done at compile-time or @var{x}
204190075Sobrienmust be placed into a register.
204290075Sobrien
204390075Sobrien@table @code
204490075Sobrien@findex sign_extend
204590075Sobrien@item (sign_extend:@var{m} @var{x})
204690075SobrienRepresents the result of sign-extending the value @var{x}
204790075Sobriento machine mode @var{m}.  @var{m} must be a fixed-point mode
204890075Sobrienand @var{x} a fixed-point value of a mode narrower than @var{m}.
204990075Sobrien
205090075Sobrien@findex zero_extend
205190075Sobrien@item (zero_extend:@var{m} @var{x})
205290075SobrienRepresents the result of zero-extending the value @var{x}
205390075Sobriento machine mode @var{m}.  @var{m} must be a fixed-point mode
205490075Sobrienand @var{x} a fixed-point value of a mode narrower than @var{m}.
205590075Sobrien
205690075Sobrien@findex float_extend
205790075Sobrien@item (float_extend:@var{m} @var{x})
205890075SobrienRepresents the result of extending the value @var{x}
205990075Sobriento machine mode @var{m}.  @var{m} must be a floating point mode
206090075Sobrienand @var{x} a floating point value of a mode narrower than @var{m}.
206190075Sobrien
206290075Sobrien@findex truncate
206390075Sobrien@item (truncate:@var{m} @var{x})
206490075SobrienRepresents the result of truncating the value @var{x}
206590075Sobriento machine mode @var{m}.  @var{m} must be a fixed-point mode
206690075Sobrienand @var{x} a fixed-point value of a mode wider than @var{m}.
206790075Sobrien
206890075Sobrien@findex ss_truncate
206990075Sobrien@item (ss_truncate:@var{m} @var{x})
207090075SobrienRepresents the result of truncating the value @var{x}
207190075Sobriento machine mode @var{m}, using signed saturation in the case of
207290075Sobrienoverflow.  Both @var{m} and the mode of @var{x} must be fixed-point
207390075Sobrienmodes.
207490075Sobrien
207590075Sobrien@findex us_truncate
207690075Sobrien@item (us_truncate:@var{m} @var{x})
207790075SobrienRepresents the result of truncating the value @var{x}
207890075Sobriento machine mode @var{m}, using unsigned saturation in the case of
207990075Sobrienoverflow.  Both @var{m} and the mode of @var{x} must be fixed-point
208090075Sobrienmodes.
208190075Sobrien
208290075Sobrien@findex float_truncate
208390075Sobrien@item (float_truncate:@var{m} @var{x})
208490075SobrienRepresents the result of truncating the value @var{x}
208590075Sobriento machine mode @var{m}.  @var{m} must be a floating point mode
208690075Sobrienand @var{x} a floating point value of a mode wider than @var{m}.
208790075Sobrien
208890075Sobrien@findex float
208990075Sobrien@item (float:@var{m} @var{x})
209090075SobrienRepresents the result of converting fixed point value @var{x},
209190075Sobrienregarded as signed, to floating point mode @var{m}.
209290075Sobrien
209390075Sobrien@findex unsigned_float
209490075Sobrien@item (unsigned_float:@var{m} @var{x})
209590075SobrienRepresents the result of converting fixed point value @var{x},
209690075Sobrienregarded as unsigned, to floating point mode @var{m}.
209790075Sobrien
209890075Sobrien@findex fix
209990075Sobrien@item (fix:@var{m} @var{x})
210090075SobrienWhen @var{m} is a fixed point mode, represents the result of
210190075Sobrienconverting floating point value @var{x} to mode @var{m}, regarded as
210290075Sobriensigned.  How rounding is done is not specified, so this operation may
210390075Sobrienbe used validly in compiling C code only for integer-valued operands.
210490075Sobrien
210590075Sobrien@findex unsigned_fix
210690075Sobrien@item (unsigned_fix:@var{m} @var{x})
210790075SobrienRepresents the result of converting floating point value @var{x} to
210890075Sobrienfixed point mode @var{m}, regarded as unsigned.  How rounding is done
210990075Sobrienis not specified.
211090075Sobrien
211190075Sobrien@findex fix
211290075Sobrien@item (fix:@var{m} @var{x})
211390075SobrienWhen @var{m} is a floating point mode, represents the result of
211490075Sobrienconverting floating point value @var{x} (valid for mode @var{m}) to an
211590075Sobrieninteger, still represented in floating point mode @var{m}, by rounding
211690075Sobrientowards zero.
211790075Sobrien@end table
211890075Sobrien
211990075Sobrien@node RTL Declarations
212090075Sobrien@section Declarations
212190075Sobrien@cindex RTL declarations
212290075Sobrien@cindex declarations, RTL
212390075Sobrien
212490075SobrienDeclaration expression codes do not represent arithmetic operations
212590075Sobrienbut rather state assertions about their operands.
212690075Sobrien
212790075Sobrien@table @code
212890075Sobrien@findex strict_low_part
212990075Sobrien@cindex @code{subreg}, in @code{strict_low_part}
213090075Sobrien@item (strict_low_part (subreg:@var{m} (reg:@var{n} @var{r}) 0))
213190075SobrienThis expression code is used in only one context: as the destination operand of a
213290075Sobrien@code{set} expression.  In addition, the operand of this expression
213390075Sobrienmust be a non-paradoxical @code{subreg} expression.
213490075Sobrien
213590075SobrienThe presence of @code{strict_low_part} says that the part of the
213690075Sobrienregister which is meaningful in mode @var{n}, but is not part of
213790075Sobrienmode @var{m}, is not to be altered.  Normally, an assignment to such
213890075Sobriena subreg is allowed to have undefined effects on the rest of the
213990075Sobrienregister when @var{m} is less than a word.
214090075Sobrien@end table
214190075Sobrien
214290075Sobrien@node Side Effects
214390075Sobrien@section Side Effect Expressions
214490075Sobrien@cindex RTL side effect expressions
214590075Sobrien
214690075SobrienThe expression codes described so far represent values, not actions.
214790075SobrienBut machine instructions never produce values; they are meaningful
214890075Sobrienonly for their side effects on the state of the machine.  Special
214990075Sobrienexpression codes are used to represent side effects.
215090075Sobrien
215190075SobrienThe body of an instruction is always one of these side effect codes;
215290075Sobrienthe codes described above, which represent values, appear only as
215390075Sobrienthe operands of these.
215490075Sobrien
215590075Sobrien@table @code
215690075Sobrien@findex set
215790075Sobrien@item (set @var{lval} @var{x})
215890075SobrienRepresents the action of storing the value of @var{x} into the place
215990075Sobrienrepresented by @var{lval}.  @var{lval} must be an expression
216090075Sobrienrepresenting a place that can be stored in: @code{reg} (or @code{subreg}
216190075Sobrienor @code{strict_low_part}), @code{mem}, @code{pc}, @code{parallel}, or
216290075Sobrien@code{cc0}.
216390075Sobrien
216490075SobrienIf @var{lval} is a @code{reg}, @code{subreg} or @code{mem}, it has a
216590075Sobrienmachine mode; then @var{x} must be valid for that mode.
216690075Sobrien
216790075SobrienIf @var{lval} is a @code{reg} whose machine mode is less than the full
216890075Sobrienwidth of the register, then it means that the part of the register
216990075Sobrienspecified by the machine mode is given the specified value and the
217090075Sobrienrest of the register receives an undefined value.  Likewise, if
217190075Sobrien@var{lval} is a @code{subreg} whose machine mode is narrower than
217290075Sobrienthe mode of the register, the rest of the register can be changed in
217390075Sobrienan undefined way.
217490075Sobrien
217590075SobrienIf @var{lval} is a @code{strict_low_part} of a @code{subreg}, then the
217690075Sobrienpart of the register specified by the machine mode of the
217790075Sobrien@code{subreg} is given the value @var{x} and the rest of the register
217890075Sobrienis not changed.
217990075Sobrien
218090075SobrienIf @var{lval} is @code{(cc0)}, it has no machine mode, and @var{x} may
218190075Sobrienbe either a @code{compare} expression or a value that may have any mode.
218290075SobrienThe latter case represents a ``test'' instruction.  The expression
218390075Sobrien@code{(set (cc0) (reg:@var{m} @var{n}))} is equivalent to
218490075Sobrien@code{(set (cc0) (compare (reg:@var{m} @var{n}) (const_int 0)))}.
218590075SobrienUse the former expression to save space during the compilation.
218690075Sobrien
218790075SobrienIf @var{lval} is a @code{parallel}, it is used to represent the case of
218890075Sobriena function returning a structure in multiple registers.  Each element
218990075Sobrienof the @code{parallel} is an @code{expr_list} whose first operand is a
219090075Sobrien@code{reg} and whose second operand is a @code{const_int} representing the
219190075Sobrienoffset (in bytes) into the structure at which the data in that register
219290075Sobriencorresponds.  The first element may be null to indicate that the structure
219390075Sobrienis also passed partly in memory.
219490075Sobrien
219590075Sobrien@cindex jump instructions and @code{set}
219690075Sobrien@cindex @code{if_then_else} usage
219790075SobrienIf @var{lval} is @code{(pc)}, we have a jump instruction, and the
219890075Sobrienpossibilities for @var{x} are very limited.  It may be a
219990075Sobrien@code{label_ref} expression (unconditional jump).  It may be an
220090075Sobrien@code{if_then_else} (conditional jump), in which case either the
220190075Sobriensecond or the third operand must be @code{(pc)} (for the case which
220290075Sobriendoes not jump) and the other of the two must be a @code{label_ref}
220390075Sobrien(for the case which does jump).  @var{x} may also be a @code{mem} or
220490075Sobrien@code{(plus:SI (pc) @var{y})}, where @var{y} may be a @code{reg} or a
220590075Sobrien@code{mem}; these unusual patterns are used to represent jumps through
220690075Sobrienbranch tables.
220790075Sobrien
220890075SobrienIf @var{lval} is neither @code{(cc0)} nor @code{(pc)}, the mode of
220990075Sobrien@var{lval} must not be @code{VOIDmode} and the mode of @var{x} must be
221090075Sobrienvalid for the mode of @var{lval}.
221190075Sobrien
221290075Sobrien@findex SET_DEST
221390075Sobrien@findex SET_SRC
221490075Sobrien@var{lval} is customarily accessed with the @code{SET_DEST} macro and
221590075Sobrien@var{x} with the @code{SET_SRC} macro.
221690075Sobrien
221790075Sobrien@findex return
221890075Sobrien@item (return)
221990075SobrienAs the sole expression in a pattern, represents a return from the
222090075Sobriencurrent function, on machines where this can be done with one
222190075Sobrieninstruction, such as VAXen.  On machines where a multi-instruction
222290075Sobrien``epilogue'' must be executed in order to return from the function,
222390075Sobrienreturning is done by jumping to a label which precedes the epilogue, and
222490075Sobrienthe @code{return} expression code is never used.
222590075Sobrien
222690075SobrienInside an @code{if_then_else} expression, represents the value to be
222790075Sobrienplaced in @code{pc} to return to the caller.
222890075Sobrien
222990075SobrienNote that an insn pattern of @code{(return)} is logically equivalent to
223090075Sobrien@code{(set (pc) (return))}, but the latter form is never used.
223190075Sobrien
223290075Sobrien@findex call
223390075Sobrien@item (call @var{function} @var{nargs})
223490075SobrienRepresents a function call.  @var{function} is a @code{mem} expression
223590075Sobrienwhose address is the address of the function to be called.
223690075Sobrien@var{nargs} is an expression which can be used for two purposes: on
223790075Sobriensome machines it represents the number of bytes of stack argument; on
223890075Sobrienothers, it represents the number of argument registers.
223990075Sobrien
224090075SobrienEach machine has a standard machine mode which @var{function} must
224190075Sobrienhave.  The machine description defines macro @code{FUNCTION_MODE} to
224290075Sobrienexpand into the requisite mode name.  The purpose of this mode is to
224390075Sobrienspecify what kind of addressing is allowed, on machines where the
224490075Sobrienallowed kinds of addressing depend on the machine mode being
224590075Sobrienaddressed.
224690075Sobrien
224790075Sobrien@findex clobber
224890075Sobrien@item (clobber @var{x})
224990075SobrienRepresents the storing or possible storing of an unpredictable,
225090075Sobrienundescribed value into @var{x}, which must be a @code{reg},
225190075Sobrien@code{scratch}, @code{parallel} or @code{mem} expression.
225290075Sobrien
225390075SobrienOne place this is used is in string instructions that store standard
225490075Sobrienvalues into particular hard registers.  It may not be worth the
225590075Sobrientrouble to describe the values that are stored, but it is essential to
225690075Sobrieninform the compiler that the registers will be altered, lest it
225790075Sobrienattempt to keep data in them across the string instruction.
225890075Sobrien
225990075SobrienIf @var{x} is @code{(mem:BLK (const_int 0))}, it means that all memory
226090075Sobrienlocations must be presumed clobbered.  If @var{x} is a @code{parallel},
226190075Sobrienit has the same meaning as a @code{parallel} in a @code{set} expression.
226290075Sobrien
226390075SobrienNote that the machine description classifies certain hard registers as
226490075Sobrien``call-clobbered''.  All function call instructions are assumed by
226590075Sobriendefault to clobber these registers, so there is no need to use
226690075Sobrien@code{clobber} expressions to indicate this fact.  Also, each function
226790075Sobriencall is assumed to have the potential to alter any memory location,
226890075Sobrienunless the function is declared @code{const}.
226990075Sobrien
227090075SobrienIf the last group of expressions in a @code{parallel} are each a
227190075Sobrien@code{clobber} expression whose arguments are @code{reg} or
227290075Sobrien@code{match_scratch} (@pxref{RTL Template}) expressions, the combiner
227390075Sobrienphase can add the appropriate @code{clobber} expressions to an insn it
227490075Sobrienhas constructed when doing so will cause a pattern to be matched.
227590075Sobrien
227690075SobrienThis feature can be used, for example, on a machine that whose multiply
227790075Sobrienand add instructions don't use an MQ register but which has an
227890075Sobrienadd-accumulate instruction that does clobber the MQ register.  Similarly,
227990075Sobriena combined instruction might require a temporary register while the
228090075Sobrienconstituent instructions might not.
228190075Sobrien
228290075SobrienWhen a @code{clobber} expression for a register appears inside a
228390075Sobrien@code{parallel} with other side effects, the register allocator
228490075Sobrienguarantees that the register is unoccupied both before and after that
228590075Sobrieninsn.  However, the reload phase may allocate a register used for one of
228690075Sobrienthe inputs unless the @samp{&} constraint is specified for the selected
228790075Sobrienalternative (@pxref{Modifiers}).  You can clobber either a specific hard
228890075Sobrienregister, a pseudo register, or a @code{scratch} expression; in the
228990075Sobrienlatter two cases, GCC will allocate a hard register that is available
229090075Sobrienthere for use as a temporary.
229190075Sobrien
229290075SobrienFor instructions that require a temporary register, you should use
229390075Sobrien@code{scratch} instead of a pseudo-register because this will allow the
229490075Sobriencombiner phase to add the @code{clobber} when required.  You do this by
229590075Sobriencoding (@code{clobber} (@code{match_scratch} @dots{})).  If you do
229690075Sobrienclobber a pseudo register, use one which appears nowhere else---generate
229790075Sobriena new one each time.  Otherwise, you may confuse CSE@.
229890075Sobrien
229990075SobrienThere is one other known use for clobbering a pseudo register in a
230090075Sobrien@code{parallel}: when one of the input operands of the insn is also
230190075Sobrienclobbered by the insn.  In this case, using the same pseudo register in
230290075Sobrienthe clobber and elsewhere in the insn produces the expected results.
230390075Sobrien
230490075Sobrien@findex use
230590075Sobrien@item (use @var{x})
230690075SobrienRepresents the use of the value of @var{x}.  It indicates that the
230790075Sobrienvalue in @var{x} at this point in the program is needed, even though
230890075Sobrienit may not be apparent why this is so.  Therefore, the compiler will
230990075Sobriennot attempt to delete previous instructions whose only effect is to
231090075Sobrienstore a value in @var{x}.  @var{x} must be a @code{reg} expression.
231190075Sobrien
231290075SobrienIn some situations, it may be tempting to add a @code{use} of a
231390075Sobrienregister in a @code{parallel} to describe a situation where the value
231490075Sobrienof a special register will modify the behavior of the instruction.
231590075SobrienAn hypothetical example might be a pattern for an addition that can
231690075Sobrieneither wrap around or use saturating addition depending on the value
231790075Sobrienof a special control register:
231890075Sobrien
2319103445Skan@smallexample
232096263Sobrien(parallel [(set (reg:SI 2) (unspec:SI [(reg:SI 3)
232190075Sobrien                                       (reg:SI 4)] 0))
232290075Sobrien           (use (reg:SI 1))])
2323103445Skan@end smallexample
232490075Sobrien
232590075Sobrien@noindent
232690075Sobrien
232790075SobrienThis will not work, several of the optimizers only look at expressions
232890075Sobrienlocally; it is very likely that if you have multiple insns with
232990075Sobrienidentical inputs to the @code{unspec}, they will be optimized away even
233090075Sobrienif register 1 changes in between.
233190075Sobrien
233290075SobrienThis means that @code{use} can @emph{only} be used to describe
233390075Sobrienthat the register is live.  You should think twice before adding
233490075Sobrien@code{use} statements, more often you will want to use @code{unspec}
233590075Sobrieninstead.  The @code{use} RTX is most commonly useful to describe that
233690075Sobriena fixed register is implicitly used in an insn.  It is also safe to use
233790075Sobrienin patterns where the compiler knows for other reasons that the result
233890075Sobrienof the whole pattern is variable, such as @samp{movstr@var{m}} or
233990075Sobrien@samp{call} patterns.
234090075Sobrien
234190075SobrienDuring the reload phase, an insn that has a @code{use} as pattern
234290075Sobriencan carry a reg_equal note.  These @code{use} insns will be deleted
234390075Sobrienbefore the reload phase exits.
234490075Sobrien
234590075SobrienDuring the delayed branch scheduling phase, @var{x} may be an insn.
234690075SobrienThis indicates that @var{x} previously was located at this place in the
234790075Sobriencode and its data dependencies need to be taken into account.  These
234890075Sobrien@code{use} insns will be deleted before the delayed branch scheduling
234990075Sobrienphase exits.
235090075Sobrien
235190075Sobrien@findex parallel
235290075Sobrien@item (parallel [@var{x0} @var{x1} @dots{}])
235390075SobrienRepresents several side effects performed in parallel.  The square
235490075Sobrienbrackets stand for a vector; the operand of @code{parallel} is a
235590075Sobrienvector of expressions.  @var{x0}, @var{x1} and so on are individual
235690075Sobrienside effect expressions---expressions of code @code{set}, @code{call},
235790075Sobrien@code{return}, @code{clobber} or @code{use}.
235890075Sobrien
235990075Sobrien``In parallel'' means that first all the values used in the individual
236090075Sobrienside-effects are computed, and second all the actual side-effects are
236190075Sobrienperformed.  For example,
236290075Sobrien
236390075Sobrien@example
236490075Sobrien(parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
236590075Sobrien           (set (mem:SI (reg:SI 1)) (reg:SI 1))])
236690075Sobrien@end example
236790075Sobrien
236890075Sobrien@noindent
236990075Sobriensays unambiguously that the values of hard register 1 and the memory
237090075Sobrienlocation addressed by it are interchanged.  In both places where
237190075Sobrien@code{(reg:SI 1)} appears as a memory address it refers to the value
237290075Sobrienin register 1 @emph{before} the execution of the insn.
237390075Sobrien
237490075SobrienIt follows that it is @emph{incorrect} to use @code{parallel} and
237590075Sobrienexpect the result of one @code{set} to be available for the next one.
237690075SobrienFor example, people sometimes attempt to represent a jump-if-zero
237790075Sobrieninstruction this way:
237890075Sobrien
237990075Sobrien@example
238090075Sobrien(parallel [(set (cc0) (reg:SI 34))
238190075Sobrien           (set (pc) (if_then_else
238290075Sobrien                        (eq (cc0) (const_int 0))
238390075Sobrien                        (label_ref @dots{})
238490075Sobrien                        (pc)))])
238590075Sobrien@end example
238690075Sobrien
238790075Sobrien@noindent
238890075SobrienBut this is incorrect, because it says that the jump condition depends
238990075Sobrienon the condition code value @emph{before} this instruction, not on the
239090075Sobriennew value that is set by this instruction.
239190075Sobrien
239290075Sobrien@cindex peephole optimization, RTL representation
239390075SobrienPeephole optimization, which takes place together with final assembly
239490075Sobriencode output, can produce insns whose patterns consist of a @code{parallel}
239590075Sobrienwhose elements are the operands needed to output the resulting
239690075Sobrienassembler code---often @code{reg}, @code{mem} or constant expressions.
239790075SobrienThis would not be well-formed RTL at any other stage in compilation,
239890075Sobrienbut it is ok then because no further optimization remains to be done.
239990075SobrienHowever, the definition of the macro @code{NOTICE_UPDATE_CC}, if
240090075Sobrienany, must deal with such insns if you define any peephole optimizations.
240190075Sobrien
240290075Sobrien@findex cond_exec
240390075Sobrien@item (cond_exec [@var{cond} @var{expr}])
240490075SobrienRepresents a conditionally executed expression.  The @var{expr} is
240590075Sobrienexecuted only if the @var{cond} is nonzero.  The @var{cond} expression
240690075Sobrienmust not have side-effects, but the @var{expr} may very well have
240790075Sobrienside-effects.
240890075Sobrien
240990075Sobrien@findex sequence
241090075Sobrien@item (sequence [@var{insns} @dots{}])
241190075SobrienRepresents a sequence of insns.  Each of the @var{insns} that appears
241290075Sobrienin the vector is suitable for appearing in the chain of insns, so it
241390075Sobrienmust be an @code{insn}, @code{jump_insn}, @code{call_insn},
241490075Sobrien@code{code_label}, @code{barrier} or @code{note}.
241590075Sobrien
241690075SobrienA @code{sequence} RTX is never placed in an actual insn during RTL
241790075Sobriengeneration.  It represents the sequence of insns that result from a
241890075Sobrien@code{define_expand} @emph{before} those insns are passed to
241990075Sobrien@code{emit_insn} to insert them in the chain of insns.  When actually
242090075Sobrieninserted, the individual sub-insns are separated out and the
242190075Sobrien@code{sequence} is forgotten.
242290075Sobrien
242390075SobrienAfter delay-slot scheduling is completed, an insn and all the insns that
242490075Sobrienreside in its delay slots are grouped together into a @code{sequence}.
242590075SobrienThe insn requiring the delay slot is the first insn in the vector;
242690075Sobriensubsequent insns are to be placed in the delay slot.
242790075Sobrien
242890075Sobrien@code{INSN_ANNULLED_BRANCH_P} is set on an insn in a delay slot to
242990075Sobrienindicate that a branch insn should be used that will conditionally annul
243090075Sobrienthe effect of the insns in the delay slots.  In such a case,
243190075Sobrien@code{INSN_FROM_TARGET_P} indicates that the insn is from the target of
243290075Sobrienthe branch and should be executed only if the branch is taken; otherwise
243390075Sobrienthe insn should be executed only if the branch is not taken.
243490075Sobrien@xref{Delay Slots}.
243590075Sobrien@end table
243690075Sobrien
243790075SobrienThese expression codes appear in place of a side effect, as the body of
243890075Sobrienan insn, though strictly speaking they do not always describe side
243990075Sobrieneffects as such:
244090075Sobrien
244190075Sobrien@table @code
244290075Sobrien@findex asm_input
244390075Sobrien@item (asm_input @var{s})
244490075SobrienRepresents literal assembler code as described by the string @var{s}.
244590075Sobrien
244690075Sobrien@findex unspec
244790075Sobrien@findex unspec_volatile
244890075Sobrien@item (unspec [@var{operands} @dots{}] @var{index})
244990075Sobrien@itemx (unspec_volatile [@var{operands} @dots{}] @var{index})
245090075SobrienRepresents a machine-specific operation on @var{operands}.  @var{index}
245190075Sobrienselects between multiple machine-specific operations.
245290075Sobrien@code{unspec_volatile} is used for volatile operations and operations
245390075Sobrienthat may trap; @code{unspec} is used for other operations.
245490075Sobrien
245590075SobrienThese codes may appear inside a @code{pattern} of an
245690075Sobrieninsn, inside a @code{parallel}, or inside an expression.
245790075Sobrien
245890075Sobrien@findex addr_vec
245990075Sobrien@item (addr_vec:@var{m} [@var{lr0} @var{lr1} @dots{}])
246090075SobrienRepresents a table of jump addresses.  The vector elements @var{lr0},
246190075Sobrienetc., are @code{label_ref} expressions.  The mode @var{m} specifies
246290075Sobrienhow much space is given to each address; normally @var{m} would be
246390075Sobrien@code{Pmode}.
246490075Sobrien
246590075Sobrien@findex addr_diff_vec
246690075Sobrien@item (addr_diff_vec:@var{m} @var{base} [@var{lr0} @var{lr1} @dots{}] @var{min} @var{max} @var{flags})
246790075SobrienRepresents a table of jump addresses expressed as offsets from
246890075Sobrien@var{base}.  The vector elements @var{lr0}, etc., are @code{label_ref}
246990075Sobrienexpressions and so is @var{base}.  The mode @var{m} specifies how much
247090075Sobrienspace is given to each address-difference.  @var{min} and @var{max}
247190075Sobrienare set up by branch shortening and hold a label with a minimum and a
247290075Sobrienmaximum address, respectively.  @var{flags} indicates the relative
247390075Sobrienposition of @var{base}, @var{min} and @var{max} to the containing insn
247490075Sobrienand of @var{min} and @var{max} to @var{base}.  See rtl.def for details.
247590075Sobrien
247690075Sobrien@findex prefetch
247790075Sobrien@item (prefetch:@var{m} @var{addr} @var{rw} @var{locality})
247890075SobrienRepresents prefetch of memory at address @var{addr}.
247990075SobrienOperand @var{rw} is 1 if the prefetch is for data to be written, 0 otherwise;
248090075Sobrientargets that do not support write prefetches should treat this as a normal
248190075Sobrienprefetch.
248290075SobrienOperand @var{locality} specifies the amount of temporal locality; 0 if there
248390075Sobrienis none or 1, 2, or 3 for increasing levels of temporal locality;
248490075Sobrientargets that do not support locality hints should ignore this.
248590075Sobrien
248690075SobrienThis insn is used to minimize cache-miss latency by moving data into a
248790075Sobriencache before it is accessed.  It should use only non-faulting data prefetch
248890075Sobrieninstructions.
248990075Sobrien@end table
249090075Sobrien
249190075Sobrien@node Incdec
249290075Sobrien@section Embedded Side-Effects on Addresses
249390075Sobrien@cindex RTL preincrement
249490075Sobrien@cindex RTL postincrement
249590075Sobrien@cindex RTL predecrement
249690075Sobrien@cindex RTL postdecrement
249790075Sobrien
249890075SobrienSix special side-effect expression codes appear as memory addresses.
249990075Sobrien
250090075Sobrien@table @code
250190075Sobrien@findex pre_dec
250290075Sobrien@item (pre_dec:@var{m} @var{x})
250390075SobrienRepresents the side effect of decrementing @var{x} by a standard
250490075Sobrienamount and represents also the value that @var{x} has after being
250590075Sobriendecremented.  @var{x} must be a @code{reg} or @code{mem}, but most
250690075Sobrienmachines allow only a @code{reg}.  @var{m} must be the machine mode
250790075Sobrienfor pointers on the machine in use.  The amount @var{x} is decremented
250890075Sobrienby is the length in bytes of the machine mode of the containing memory
250990075Sobrienreference of which this expression serves as the address.  Here is an
251090075Sobrienexample of its use:
251190075Sobrien
251290075Sobrien@example
251390075Sobrien(mem:DF (pre_dec:SI (reg:SI 39)))
251490075Sobrien@end example
251590075Sobrien
251690075Sobrien@noindent
251790075SobrienThis says to decrement pseudo register 39 by the length of a @code{DFmode}
251890075Sobrienvalue and use the result to address a @code{DFmode} value.
251990075Sobrien
252090075Sobrien@findex pre_inc
252190075Sobrien@item (pre_inc:@var{m} @var{x})
252290075SobrienSimilar, but specifies incrementing @var{x} instead of decrementing it.
252390075Sobrien
252490075Sobrien@findex post_dec
252590075Sobrien@item (post_dec:@var{m} @var{x})
252690075SobrienRepresents the same side effect as @code{pre_dec} but a different
252790075Sobrienvalue.  The value represented here is the value @var{x} has @i{before}
252890075Sobrienbeing decremented.
252990075Sobrien
253090075Sobrien@findex post_inc
253190075Sobrien@item (post_inc:@var{m} @var{x})
253290075SobrienSimilar, but specifies incrementing @var{x} instead of decrementing it.
253390075Sobrien
253490075Sobrien@findex post_modify
253590075Sobrien@item (post_modify:@var{m} @var{x} @var{y})
253690075Sobrien
253790075SobrienRepresents the side effect of setting @var{x} to @var{y} and
253890075Sobrienrepresents @var{x} before @var{x} is modified.  @var{x} must be a
253990075Sobrien@code{reg} or @code{mem}, but most machines allow only a @code{reg}.
254090075Sobrien@var{m} must be the machine mode for pointers on the machine in use.
254190075SobrienThe amount @var{x} is decremented by is the length in bytes of the
254290075Sobrienmachine mode of the containing memory reference of which this expression
254390075Sobrienserves as the address.  Note that this is not currently implemented.
254490075Sobrien
254590075SobrienThe expression @var{y} must be one of three forms:
254690075Sobrien@table @code
254790075Sobrien@code{(plus:@var{m} @var{x} @var{z})},
254890075Sobrien@code{(minus:@var{m} @var{x} @var{z})}, or
254990075Sobrien@code{(plus:@var{m} @var{x} @var{i})},
255090075Sobrien@end table
255190075Sobrienwhere @var{z} is an index register and @var{i} is a constant.
255290075Sobrien
255390075SobrienHere is an example of its use:
255490075Sobrien
2555103445Skan@smallexample
255690075Sobrien(mem:SF (post_modify:SI (reg:SI 42) (plus (reg:SI 42)
255790075Sobrien                                          (reg:SI 48))))
2558103445Skan@end smallexample
255990075Sobrien
256090075SobrienThis says to modify pseudo register 42 by adding the contents of pseudo
256190075Sobrienregister 48 to it, after the use of what ever 42 points to.
256290075Sobrien
256390075Sobrien@findex post_modify
256490075Sobrien@item (pre_modify:@var{m} @var{x} @var{expr})
256590075SobrienSimilar except side effects happen before the use.
256690075Sobrien@end table
256790075Sobrien
256890075SobrienThese embedded side effect expressions must be used with care.  Instruction
256990075Sobrienpatterns may not use them.  Until the @samp{flow} pass of the compiler,
257090075Sobrienthey may occur only to represent pushes onto the stack.  The @samp{flow}
257190075Sobrienpass finds cases where registers are incremented or decremented in one
257290075Sobrieninstruction and used as an address shortly before or after; these cases are
257390075Sobrienthen transformed to use pre- or post-increment or -decrement.
257490075Sobrien
257590075SobrienIf a register used as the operand of these expressions is used in
257690075Sobrienanother address in an insn, the original value of the register is used.
257790075SobrienUses of the register outside of an address are not permitted within the
257890075Sobriensame insn as a use in an embedded side effect expression because such
257990075Sobrieninsns behave differently on different machines and hence must be treated
258090075Sobrienas ambiguous and disallowed.
258190075Sobrien
258290075SobrienAn instruction that can be represented with an embedded side effect
258390075Sobriencould also be represented using @code{parallel} containing an additional
258490075Sobrien@code{set} to describe how the address register is altered.  This is not
258590075Sobriendone because machines that allow these operations at all typically
258690075Sobrienallow them wherever a memory address is called for.  Describing them as
258790075Sobrienadditional parallel stores would require doubling the number of entries
258890075Sobrienin the machine description.
258990075Sobrien
259090075Sobrien@node Assembler
259190075Sobrien@section Assembler Instructions as Expressions
259290075Sobrien@cindex assembler instructions in RTL
259390075Sobrien
259490075Sobrien@cindex @code{asm_operands}, usage
259590075SobrienThe RTX code @code{asm_operands} represents a value produced by a
259690075Sobrienuser-specified assembler instruction.  It is used to represent
259790075Sobrienan @code{asm} statement with arguments.  An @code{asm} statement with
259890075Sobriena single output operand, like this:
259990075Sobrien
260090075Sobrien@smallexample
260190075Sobrienasm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
260290075Sobrien@end smallexample
260390075Sobrien
260490075Sobrien@noindent
260590075Sobrienis represented using a single @code{asm_operands} RTX which represents
260690075Sobrienthe value that is stored in @code{outputvar}:
260790075Sobrien
260890075Sobrien@smallexample
260990075Sobrien(set @var{rtx-for-outputvar}
261090075Sobrien     (asm_operands "foo %1,%2,%0" "a" 0
261190075Sobrien                   [@var{rtx-for-addition-result} @var{rtx-for-*z}]
261290075Sobrien                   [(asm_input:@var{m1} "g")
261390075Sobrien                    (asm_input:@var{m2} "di")]))
261490075Sobrien@end smallexample
261590075Sobrien
261690075Sobrien@noindent
261790075SobrienHere the operands of the @code{asm_operands} RTX are the assembler
261890075Sobrientemplate string, the output-operand's constraint, the index-number of the
261990075Sobrienoutput operand among the output operands specified, a vector of input
262090075Sobrienoperand RTX's, and a vector of input-operand modes and constraints.  The
262190075Sobrienmode @var{m1} is the mode of the sum @code{x+y}; @var{m2} is that of
262290075Sobrien@code{*z}.
262390075Sobrien
262490075SobrienWhen an @code{asm} statement has multiple output values, its insn has
262590075Sobrienseveral such @code{set} RTX's inside of a @code{parallel}.  Each @code{set}
262690075Sobriencontains a @code{asm_operands}; all of these share the same assembler
262790075Sobrientemplate and vectors, but each contains the constraint for the respective
262890075Sobrienoutput operand.  They are also distinguished by the output-operand index
262990075Sobriennumber, which is 0, 1, @dots{} for successive output operands.
263090075Sobrien
263190075Sobrien@node Insns
263290075Sobrien@section Insns
263390075Sobrien@cindex insns
263490075Sobrien
263590075SobrienThe RTL representation of the code for a function is a doubly-linked
263690075Sobrienchain of objects called @dfn{insns}.  Insns are expressions with
263790075Sobrienspecial codes that are used for no other purpose.  Some insns are
263890075Sobrienactual instructions; others represent dispatch tables for @code{switch}
263990075Sobrienstatements; others represent labels to jump to or various sorts of
264090075Sobriendeclarative information.
264190075Sobrien
264290075SobrienIn addition to its own specific data, each insn must have a unique
264390075Sobrienid-number that distinguishes it from all other insns in the current
264490075Sobrienfunction (after delayed branch scheduling, copies of an insn with the
264590075Sobriensame id-number may be present in multiple places in a function, but
264690075Sobrienthese copies will always be identical and will only appear inside a
264790075Sobrien@code{sequence}), and chain pointers to the preceding and following
264890075Sobrieninsns.  These three fields occupy the same position in every insn,
264990075Sobrienindependent of the expression code of the insn.  They could be accessed
265090075Sobrienwith @code{XEXP} and @code{XINT}, but instead three special macros are
265190075Sobrienalways used:
265290075Sobrien
265390075Sobrien@table @code
265490075Sobrien@findex INSN_UID
265590075Sobrien@item INSN_UID (@var{i})
265690075SobrienAccesses the unique id of insn @var{i}.
265790075Sobrien
265890075Sobrien@findex PREV_INSN
265990075Sobrien@item PREV_INSN (@var{i})
266090075SobrienAccesses the chain pointer to the insn preceding @var{i}.
266190075SobrienIf @var{i} is the first insn, this is a null pointer.
266290075Sobrien
266390075Sobrien@findex NEXT_INSN
266490075Sobrien@item NEXT_INSN (@var{i})
266590075SobrienAccesses the chain pointer to the insn following @var{i}.
266690075SobrienIf @var{i} is the last insn, this is a null pointer.
266790075Sobrien@end table
266890075Sobrien
266990075Sobrien@findex get_insns
267090075Sobrien@findex get_last_insn
267190075SobrienThe first insn in the chain is obtained by calling @code{get_insns}; the
267290075Sobrienlast insn is the result of calling @code{get_last_insn}.  Within the
267390075Sobrienchain delimited by these insns, the @code{NEXT_INSN} and
267490075Sobrien@code{PREV_INSN} pointers must always correspond: if @var{insn} is not
267590075Sobrienthe first insn,
267690075Sobrien
267790075Sobrien@example
267890075SobrienNEXT_INSN (PREV_INSN (@var{insn})) == @var{insn}
267990075Sobrien@end example
268090075Sobrien
268190075Sobrien@noindent
268290075Sobrienis always true and if @var{insn} is not the last insn,
268390075Sobrien
268490075Sobrien@example
268590075SobrienPREV_INSN (NEXT_INSN (@var{insn})) == @var{insn}
268690075Sobrien@end example
268790075Sobrien
268890075Sobrien@noindent
268990075Sobrienis always true.
269090075Sobrien
269190075SobrienAfter delay slot scheduling, some of the insns in the chain might be
269290075Sobrien@code{sequence} expressions, which contain a vector of insns.  The value
269390075Sobrienof @code{NEXT_INSN} in all but the last of these insns is the next insn
269490075Sobrienin the vector; the value of @code{NEXT_INSN} of the last insn in the vector
269590075Sobrienis the same as the value of @code{NEXT_INSN} for the @code{sequence} in
269690075Sobrienwhich it is contained.  Similar rules apply for @code{PREV_INSN}.
269790075Sobrien
269890075SobrienThis means that the above invariants are not necessarily true for insns
269990075Sobrieninside @code{sequence} expressions.  Specifically, if @var{insn} is the
270090075Sobrienfirst insn in a @code{sequence}, @code{NEXT_INSN (PREV_INSN (@var{insn}))}
270190075Sobrienis the insn containing the @code{sequence} expression, as is the value
270290075Sobrienof @code{PREV_INSN (NEXT_INSN (@var{insn}))} if @var{insn} is the last
270390075Sobrieninsn in the @code{sequence} expression.  You can use these expressions
270490075Sobriento find the containing @code{sequence} expression.
270590075Sobrien
270690075SobrienEvery insn has one of the following six expression codes:
270790075Sobrien
270890075Sobrien@table @code
270990075Sobrien@findex insn
271090075Sobrien@item insn
271190075SobrienThe expression code @code{insn} is used for instructions that do not jump
271290075Sobrienand do not do function calls.  @code{sequence} expressions are always
271390075Sobriencontained in insns with code @code{insn} even if one of those insns
271490075Sobrienshould jump or do function calls.
271590075Sobrien
271690075SobrienInsns with code @code{insn} have four additional fields beyond the three
271790075Sobrienmandatory ones listed above.  These four are described in a table below.
271890075Sobrien
271990075Sobrien@findex jump_insn
272090075Sobrien@item jump_insn
272190075SobrienThe expression code @code{jump_insn} is used for instructions that may
272290075Sobrienjump (or, more generally, may contain @code{label_ref} expressions).  If
272390075Sobrienthere is an instruction to return from the current function, it is
272490075Sobrienrecorded as a @code{jump_insn}.
272590075Sobrien
272690075Sobrien@findex JUMP_LABEL
272790075Sobrien@code{jump_insn} insns have the same extra fields as @code{insn} insns,
272890075Sobrienaccessed in the same way and in addition contain a field
272990075Sobrien@code{JUMP_LABEL} which is defined once jump optimization has completed.
273090075Sobrien
273190075SobrienFor simple conditional and unconditional jumps, this field contains
273290075Sobrienthe @code{code_label} to which this insn will (possibly conditionally)
273390075Sobrienbranch.  In a more complex jump, @code{JUMP_LABEL} records one of the
273490075Sobrienlabels that the insn refers to; the only way to find the others is to
273590075Sobrienscan the entire body of the insn.  In an @code{addr_vec},
273690075Sobrien@code{JUMP_LABEL} is @code{NULL_RTX}.
273790075Sobrien
273890075SobrienReturn insns count as jumps, but since they do not refer to any
273990075Sobrienlabels, their @code{JUMP_LABEL} is @code{NULL_RTX}.
274090075Sobrien
274190075Sobrien@findex call_insn
274290075Sobrien@item call_insn
274390075SobrienThe expression code @code{call_insn} is used for instructions that may do
274490075Sobrienfunction calls.  It is important to distinguish these instructions because
274590075Sobrienthey imply that certain registers and memory locations may be altered
274690075Sobrienunpredictably.
274790075Sobrien
274890075Sobrien@findex CALL_INSN_FUNCTION_USAGE
274990075Sobrien@code{call_insn} insns have the same extra fields as @code{insn} insns,
275090075Sobrienaccessed in the same way and in addition contain a field
275190075Sobrien@code{CALL_INSN_FUNCTION_USAGE}, which contains a list (chain of
275290075Sobrien@code{expr_list} expressions) containing @code{use} and @code{clobber}
275390075Sobrienexpressions that denote hard registers and @code{MEM}s used or
275490075Sobrienclobbered by the called function.
275590075Sobrien
275690075SobrienA @code{MEM} generally points to a stack slots in which arguments passed
275790075Sobriento the libcall by reference (@pxref{Register Arguments,
275890075SobrienFUNCTION_ARG_PASS_BY_REFERENCE}) are stored.  If the argument is
275990075Sobriencaller-copied (@pxref{Register Arguments, FUNCTION_ARG_CALLEE_COPIES}),
276090075Sobrienthe stack slot will be mentioned in @code{CLOBBER} and @code{USE}
276190075Sobrienentries; if it's callee-copied, only a @code{USE} will appear, and the
276290075Sobrien@code{MEM} may point to addresses that are not stack slots.  These
276390075Sobrien@code{MEM}s are used only in libcalls, because, unlike regular function
276490075Sobriencalls, @code{CONST_CALL}s (which libcalls generally are, @pxref{Flags,
276590075SobrienCONST_CALL_P}) aren't assumed to read and write all memory, so flow
276690075Sobrienwould consider the stores dead and remove them.  Note that, since a
276790075Sobrienlibcall must never return values in memory (@pxref{Aggregate Return,
276890075SobrienRETURN_IN_MEMORY}), there will never be a @code{CLOBBER} for a memory
276990075Sobrienaddress holding a return value.
277090075Sobrien
277190075Sobrien@code{CLOBBER}ed registers in this list augment registers specified in
277290075Sobrien@code{CALL_USED_REGISTERS} (@pxref{Register Basics}).
277390075Sobrien
277490075Sobrien@findex code_label
277590075Sobrien@findex CODE_LABEL_NUMBER
277690075Sobrien@item code_label
277790075SobrienA @code{code_label} insn represents a label that a jump insn can jump
277890075Sobriento.  It contains two special fields of data in addition to the three
277990075Sobrienstandard ones.  @code{CODE_LABEL_NUMBER} is used to hold the @dfn{label
278090075Sobriennumber}, a number that identifies this label uniquely among all the
278190075Sobrienlabels in the compilation (not just in the current function).
278290075SobrienUltimately, the label is represented in the assembler output as an
278390075Sobrienassembler label, usually of the form @samp{L@var{n}} where @var{n} is
278490075Sobrienthe label number.
278590075Sobrien
278690075SobrienWhen a @code{code_label} appears in an RTL expression, it normally
278790075Sobrienappears within a @code{label_ref} which represents the address of
278890075Sobrienthe label, as a number.
278990075Sobrien
279090075SobrienBesides as a @code{code_label}, a label can also be represented as a
279190075Sobrien@code{note} of type @code{NOTE_INSN_DELETED_LABEL}.
279290075Sobrien
279390075Sobrien@findex LABEL_NUSES
279490075SobrienThe field @code{LABEL_NUSES} is only defined once the jump optimization
279590075Sobrienphase is completed and contains the number of times this label is
279690075Sobrienreferenced in the current function.
279790075Sobrien
279890075Sobrien@findex LABEL_ALTERNATE_NAME
279990075SobrienThe field @code{LABEL_ALTERNATE_NAME} is used to associate a name with
280090075Sobriena @code{code_label}.  If this field is defined, the alternate name will
280190075Sobrienbe emitted instead of an internally generated label name.
280290075Sobrien
280390075Sobrien@findex barrier
280490075Sobrien@item barrier
280590075SobrienBarriers are placed in the instruction stream when control cannot flow
280690075Sobrienpast them.  They are placed after unconditional jump instructions to
280790075Sobrienindicate that the jumps are unconditional and after calls to
280890075Sobrien@code{volatile} functions, which do not return (e.g., @code{exit}).
280990075SobrienThey contain no information beyond the three standard fields.
281090075Sobrien
281190075Sobrien@findex note
281290075Sobrien@findex NOTE_LINE_NUMBER
281390075Sobrien@findex NOTE_SOURCE_FILE
281490075Sobrien@item note
281590075Sobrien@code{note} insns are used to represent additional debugging and
281690075Sobriendeclarative information.  They contain two nonstandard fields, an
281790075Sobrieninteger which is accessed with the macro @code{NOTE_LINE_NUMBER} and a
281890075Sobrienstring accessed with @code{NOTE_SOURCE_FILE}.
281990075Sobrien
282090075SobrienIf @code{NOTE_LINE_NUMBER} is positive, the note represents the
282190075Sobrienposition of a source line and @code{NOTE_SOURCE_FILE} is the source file name
282290075Sobrienthat the line came from.  These notes control generation of line
282390075Sobriennumber data in the assembler output.
282490075Sobrien
282590075SobrienOtherwise, @code{NOTE_LINE_NUMBER} is not really a line number but a
282690075Sobriencode with one of the following values (and @code{NOTE_SOURCE_FILE}
282790075Sobrienmust contain a null pointer):
282890075Sobrien
282990075Sobrien@table @code
283090075Sobrien@findex NOTE_INSN_DELETED
283190075Sobrien@item NOTE_INSN_DELETED
283290075SobrienSuch a note is completely ignorable.  Some passes of the compiler
283390075Sobriendelete insns by altering them into notes of this kind.
283490075Sobrien
283590075Sobrien@findex NOTE_INSN_DELETED_LABEL
283690075Sobrien@item NOTE_INSN_DELETED_LABEL
283790075SobrienThis marks what used to be a @code{code_label}, but was not used for other
283890075Sobrienpurposes than taking its address and was transformed to mark that no
283990075Sobriencode jumps to it.
284090075Sobrien
284190075Sobrien@findex NOTE_INSN_BLOCK_BEG
284290075Sobrien@findex NOTE_INSN_BLOCK_END
284390075Sobrien@item NOTE_INSN_BLOCK_BEG
284490075Sobrien@itemx NOTE_INSN_BLOCK_END
284590075SobrienThese types of notes indicate the position of the beginning and end
284690075Sobrienof a level of scoping of variable names.  They control the output
284790075Sobrienof debugging information.
284890075Sobrien
284990075Sobrien@findex NOTE_INSN_EH_REGION_BEG
285090075Sobrien@findex NOTE_INSN_EH_REGION_END
285190075Sobrien@item NOTE_INSN_EH_REGION_BEG
285290075Sobrien@itemx NOTE_INSN_EH_REGION_END
285390075SobrienThese types of notes indicate the position of the beginning and end of a
285490075Sobrienlevel of scoping for exception handling.  @code{NOTE_BLOCK_NUMBER}
285590075Sobrienidentifies which @code{CODE_LABEL} or @code{note} of type
285690075Sobrien@code{NOTE_INSN_DELETED_LABEL} is associated with the given region.
285790075Sobrien
285890075Sobrien@findex NOTE_INSN_LOOP_BEG
285990075Sobrien@findex NOTE_INSN_LOOP_END
286090075Sobrien@item NOTE_INSN_LOOP_BEG
286190075Sobrien@itemx NOTE_INSN_LOOP_END
286290075SobrienThese types of notes indicate the position of the beginning and end
286390075Sobrienof a @code{while} or @code{for} loop.  They enable the loop optimizer
286490075Sobriento find loops quickly.
286590075Sobrien
286690075Sobrien@findex NOTE_INSN_LOOP_CONT
286790075Sobrien@item NOTE_INSN_LOOP_CONT
286890075SobrienAppears at the place in a loop that @code{continue} statements jump to.
286990075Sobrien
287090075Sobrien@findex NOTE_INSN_LOOP_VTOP
287190075Sobrien@item NOTE_INSN_LOOP_VTOP
287290075SobrienThis note indicates the place in a loop where the exit test begins for
287390075Sobrienthose loops in which the exit test has been duplicated.  This position
287490075Sobrienbecomes another virtual start of the loop when considering loop
287590075Sobrieninvariants.
287690075Sobrien
287790075Sobrien@findex NOTE_INSN_FUNCTION_END
287890075Sobrien@item NOTE_INSN_FUNCTION_END
287990075SobrienAppears near the end of the function body, just before the label that
288090075Sobrien@code{return} statements jump to (on machine where a single instruction
288190075Sobriendoes not suffice for returning).  This note may be deleted by jump
288290075Sobrienoptimization.
288390075Sobrien
288490075Sobrien@findex NOTE_INSN_SETJMP
288590075Sobrien@item NOTE_INSN_SETJMP
288690075SobrienAppears following each call to @code{setjmp} or a related function.
288790075Sobrien@end table
288890075Sobrien
288990075SobrienThese codes are printed symbolically when they appear in debugging dumps.
289090075Sobrien@end table
289190075Sobrien
289290075Sobrien@cindex @code{TImode}, in @code{insn}
289390075Sobrien@cindex @code{HImode}, in @code{insn}
289490075Sobrien@cindex @code{QImode}, in @code{insn}
289590075SobrienThe machine mode of an insn is normally @code{VOIDmode}, but some
289690075Sobrienphases use the mode for various purposes.
289790075Sobrien
289890075SobrienThe common subexpression elimination pass sets the mode of an insn to
289990075Sobrien@code{QImode} when it is the first insn in a block that has already
290090075Sobrienbeen processed.
290190075Sobrien
290290075SobrienThe second Haifa scheduling pass, for targets that can multiple issue,
290390075Sobriensets the mode of an insn to @code{TImode} when it is believed that the
290490075Sobrieninstruction begins an issue group.  That is, when the instruction
290590075Sobriencannot issue simultaneously with the previous.  This may be relied on
290690075Sobrienby later passes, in particular machine-dependent reorg.
290790075Sobrien
290890075SobrienHere is a table of the extra fields of @code{insn}, @code{jump_insn}
290990075Sobrienand @code{call_insn} insns:
291090075Sobrien
291190075Sobrien@table @code
291290075Sobrien@findex PATTERN
291390075Sobrien@item PATTERN (@var{i})
291490075SobrienAn expression for the side effect performed by this insn.  This must be
291590075Sobrienone of the following codes: @code{set}, @code{call}, @code{use},
291690075Sobrien@code{clobber}, @code{return}, @code{asm_input}, @code{asm_output},
291790075Sobrien@code{addr_vec}, @code{addr_diff_vec}, @code{trap_if}, @code{unspec},
291890075Sobrien@code{unspec_volatile}, @code{parallel}, @code{cond_exec}, or @code{sequence}.  If it is a @code{parallel},
291990075Sobrieneach element of the @code{parallel} must be one these codes, except that
292090075Sobrien@code{parallel} expressions cannot be nested and @code{addr_vec} and
292190075Sobrien@code{addr_diff_vec} are not permitted inside a @code{parallel} expression.
292290075Sobrien
292390075Sobrien@findex INSN_CODE
292490075Sobrien@item INSN_CODE (@var{i})
292590075SobrienAn integer that says which pattern in the machine description matches
292690075Sobrienthis insn, or @minus{}1 if the matching has not yet been attempted.
292790075Sobrien
292890075SobrienSuch matching is never attempted and this field remains @minus{}1 on an insn
292990075Sobrienwhose pattern consists of a single @code{use}, @code{clobber},
293090075Sobrien@code{asm_input}, @code{addr_vec} or @code{addr_diff_vec} expression.
293190075Sobrien
293290075Sobrien@findex asm_noperands
293390075SobrienMatching is also never attempted on insns that result from an @code{asm}
293490075Sobrienstatement.  These contain at least one @code{asm_operands} expression.
293590075SobrienThe function @code{asm_noperands} returns a non-negative value for
293690075Sobriensuch insns.
293790075Sobrien
293890075SobrienIn the debugging output, this field is printed as a number followed by
293990075Sobriena symbolic representation that locates the pattern in the @file{md}
294090075Sobrienfile as some small positive or negative offset from a named pattern.
294190075Sobrien
294290075Sobrien@findex LOG_LINKS
294390075Sobrien@item LOG_LINKS (@var{i})
294490075SobrienA list (chain of @code{insn_list} expressions) giving information about
294590075Sobriendependencies between instructions within a basic block.  Neither a jump
294690075Sobriennor a label may come between the related insns.
294790075Sobrien
294890075Sobrien@findex REG_NOTES
294990075Sobrien@item REG_NOTES (@var{i})
295090075SobrienA list (chain of @code{expr_list} and @code{insn_list} expressions)
295190075Sobriengiving miscellaneous information about the insn.  It is often
295290075Sobrieninformation pertaining to the registers used in this insn.
295390075Sobrien@end table
295490075Sobrien
295590075SobrienThe @code{LOG_LINKS} field of an insn is a chain of @code{insn_list}
295690075Sobrienexpressions.  Each of these has two operands: the first is an insn,
295790075Sobrienand the second is another @code{insn_list} expression (the next one in
295890075Sobrienthe chain).  The last @code{insn_list} in the chain has a null pointer
295990075Sobrienas second operand.  The significant thing about the chain is which
296090075Sobrieninsns appear in it (as first operands of @code{insn_list}
296190075Sobrienexpressions).  Their order is not significant.
296290075Sobrien
296390075SobrienThis list is originally set up by the flow analysis pass; it is a null
296490075Sobrienpointer until then.  Flow only adds links for those data dependencies
296590075Sobrienwhich can be used for instruction combination.  For each insn, the flow
296690075Sobrienanalysis pass adds a link to insns which store into registers values
296790075Sobrienthat are used for the first time in this insn.  The instruction
296890075Sobrienscheduling pass adds extra links so that every dependence will be
296990075Sobrienrepresented.  Links represent data dependencies, antidependencies and
297090075Sobrienoutput dependencies; the machine mode of the link distinguishes these
297190075Sobrienthree types: antidependencies have mode @code{REG_DEP_ANTI}, output
297290075Sobriendependencies have mode @code{REG_DEP_OUTPUT}, and data dependencies have
297390075Sobrienmode @code{VOIDmode}.
297490075Sobrien
297590075SobrienThe @code{REG_NOTES} field of an insn is a chain similar to the
297690075Sobrien@code{LOG_LINKS} field but it includes @code{expr_list} expressions in
297790075Sobrienaddition to @code{insn_list} expressions.  There are several kinds of
297890075Sobrienregister notes, which are distinguished by the machine mode, which in a
297990075Sobrienregister note is really understood as being an @code{enum reg_note}.
298090075SobrienThe first operand @var{op} of the note is data whose meaning depends on
298190075Sobrienthe kind of note.
298290075Sobrien
298390075Sobrien@findex REG_NOTE_KIND
298490075Sobrien@findex PUT_REG_NOTE_KIND
298590075SobrienThe macro @code{REG_NOTE_KIND (@var{x})} returns the kind of
298690075Sobrienregister note.  Its counterpart, the macro @code{PUT_REG_NOTE_KIND
298790075Sobrien(@var{x}, @var{newkind})} sets the register note type of @var{x} to be
298890075Sobrien@var{newkind}.
298990075Sobrien
299090075SobrienRegister notes are of three classes: They may say something about an
299190075Sobrieninput to an insn, they may say something about an output of an insn, or
299290075Sobrienthey may create a linkage between two insns.  There are also a set
299390075Sobrienof values that are only used in @code{LOG_LINKS}.
299490075Sobrien
299590075SobrienThese register notes annotate inputs to an insn:
299690075Sobrien
299790075Sobrien@table @code
299890075Sobrien@findex REG_DEAD
299990075Sobrien@item REG_DEAD
300090075SobrienThe value in @var{op} dies in this insn; that is to say, altering the
300190075Sobrienvalue immediately after this insn would not affect the future behavior
300290075Sobrienof the program.
300390075Sobrien
300490075SobrienIt does not follow that the register @var{op} has no useful value after
300590075Sobrienthis insn since @var{op} is not necessarily modified by this insn.
300690075SobrienRather, no subsequent instruction uses the contents of @var{op}.
300790075Sobrien
300890075Sobrien@findex REG_UNUSED
300990075Sobrien@item REG_UNUSED
301090075SobrienThe register @var{op} being set by this insn will not be used in a
301190075Sobriensubsequent insn.  This differs from a @code{REG_DEAD} note, which
301290075Sobrienindicates that the value in an input will not be used subsequently.
301390075SobrienThese two notes are independent; both may be present for the same
301490075Sobrienregister.
301590075Sobrien
301690075Sobrien@findex REG_INC
301790075Sobrien@item REG_INC
301890075SobrienThe register @var{op} is incremented (or decremented; at this level
301990075Sobrienthere is no distinction) by an embedded side effect inside this insn.
302090075SobrienThis means it appears in a @code{post_inc}, @code{pre_inc},
302190075Sobrien@code{post_dec} or @code{pre_dec} expression.
302290075Sobrien
302390075Sobrien@findex REG_NONNEG
302490075Sobrien@item REG_NONNEG
302590075SobrienThe register @var{op} is known to have a nonnegative value when this
302690075Sobrieninsn is reached.  This is used so that decrement and branch until zero
302790075Sobrieninstructions, such as the m68k dbra, can be matched.
302890075Sobrien
302990075SobrienThe @code{REG_NONNEG} note is added to insns only if the machine
303090075Sobriendescription has a @samp{decrement_and_branch_until_zero} pattern.
303190075Sobrien
303290075Sobrien@findex REG_NO_CONFLICT
303390075Sobrien@item REG_NO_CONFLICT
303490075SobrienThis insn does not cause a conflict between @var{op} and the item
303590075Sobrienbeing set by this insn even though it might appear that it does.
303690075SobrienIn other words, if the destination register and @var{op} could
303790075Sobrienotherwise be assigned the same register, this insn does not
303890075Sobrienprevent that assignment.
303990075Sobrien
304090075SobrienInsns with this note are usually part of a block that begins with a
304190075Sobrien@code{clobber} insn specifying a multi-word pseudo register (which will
304290075Sobrienbe the output of the block), a group of insns that each set one word of
304390075Sobrienthe value and have the @code{REG_NO_CONFLICT} note attached, and a final
304490075Sobrieninsn that copies the output to itself with an attached @code{REG_EQUAL}
304590075Sobriennote giving the expression being computed.  This block is encapsulated
304690075Sobrienwith @code{REG_LIBCALL} and @code{REG_RETVAL} notes on the first and
304790075Sobrienlast insns, respectively.
304890075Sobrien
304990075Sobrien@findex REG_LABEL
305090075Sobrien@item REG_LABEL
305190075SobrienThis insn uses @var{op}, a @code{code_label} or a @code{note} of type
305290075Sobrien@code{NOTE_INSN_DELETED_LABEL}, but is not a
305390075Sobrien@code{jump_insn}, or it is a @code{jump_insn} that required the label to
305490075Sobrienbe held in a register.  The presence of this note allows jump
305590075Sobrienoptimization to be aware that @var{op} is, in fact, being used, and flow
305690075Sobrienoptimization to build an accurate flow graph.
305790075Sobrien@end table
305890075Sobrien
305990075SobrienThe following notes describe attributes of outputs of an insn:
306090075Sobrien
306190075Sobrien@table @code
306290075Sobrien@findex REG_EQUIV
306390075Sobrien@findex REG_EQUAL
306490075Sobrien@item REG_EQUIV
306590075Sobrien@itemx REG_EQUAL
306690075SobrienThis note is only valid on an insn that sets only one register and
306790075Sobrienindicates that that register will be equal to @var{op} at run time; the
306890075Sobrienscope of this equivalence differs between the two types of notes.  The
306990075Sobrienvalue which the insn explicitly copies into the register may look
307090075Sobriendifferent from @var{op}, but they will be equal at run time.  If the
307190075Sobrienoutput of the single @code{set} is a @code{strict_low_part} expression,
307290075Sobrienthe note refers to the register that is contained in @code{SUBREG_REG}
307390075Sobrienof the @code{subreg} expression.
307490075Sobrien
307590075SobrienFor @code{REG_EQUIV}, the register is equivalent to @var{op} throughout
307690075Sobrienthe entire function, and could validly be replaced in all its
307790075Sobrienoccurrences by @var{op}.  (``Validly'' here refers to the data flow of
307890075Sobrienthe program; simple replacement may make some insns invalid.)  For
307990075Sobrienexample, when a constant is loaded into a register that is never
308090075Sobrienassigned any other value, this kind of note is used.
308190075Sobrien
308290075SobrienWhen a parameter is copied into a pseudo-register at entry to a function,
308390075Sobriena note of this kind records that the register is equivalent to the stack
308490075Sobrienslot where the parameter was passed.  Although in this case the register
308590075Sobrienmay be set by other insns, it is still valid to replace the register
308690075Sobrienby the stack slot throughout the function.
308790075Sobrien
308890075SobrienA @code{REG_EQUIV} note is also used on an instruction which copies a
308990075Sobrienregister parameter into a pseudo-register at entry to a function, if
309090075Sobrienthere is a stack slot where that parameter could be stored.  Although
309190075Sobrienother insns may set the pseudo-register, it is valid for the compiler to
309290075Sobrienreplace the pseudo-register by stack slot throughout the function,
309390075Sobrienprovided the compiler ensures that the stack slot is properly
309490075Sobrieninitialized by making the replacement in the initial copy instruction as
309590075Sobrienwell.  This is used on machines for which the calling convention
309690075Sobrienallocates stack space for register parameters.  See
309790075Sobrien@code{REG_PARM_STACK_SPACE} in @ref{Stack Arguments}.
309890075Sobrien
309990075SobrienIn the case of @code{REG_EQUAL}, the register that is set by this insn
310090075Sobrienwill be equal to @var{op} at run time at the end of this insn but not
310190075Sobriennecessarily elsewhere in the function.  In this case, @var{op}
310290075Sobrienis typically an arithmetic expression.  For example, when a sequence of
310390075Sobrieninsns such as a library call is used to perform an arithmetic operation,
310490075Sobrienthis kind of note is attached to the insn that produces or copies the
310590075Sobrienfinal value.
310690075Sobrien
310790075SobrienThese two notes are used in different ways by the compiler passes.
310890075Sobrien@code{REG_EQUAL} is used by passes prior to register allocation (such as
310990075Sobriencommon subexpression elimination and loop optimization) to tell them how
311090075Sobriento think of that value.  @code{REG_EQUIV} notes are used by register
311190075Sobrienallocation to indicate that there is an available substitute expression
311290075Sobrien(either a constant or a @code{mem} expression for the location of a
311390075Sobrienparameter on the stack) that may be used in place of a register if
311490075Sobrieninsufficient registers are available.
311590075Sobrien
311690075SobrienExcept for stack homes for parameters, which are indicated by a
311790075Sobrien@code{REG_EQUIV} note and are not useful to the early optimization
311890075Sobrienpasses and pseudo registers that are equivalent to a memory location
311990075Sobrienthroughout their entire life, which is not detected until later in
312090075Sobrienthe compilation, all equivalences are initially indicated by an attached
312190075Sobrien@code{REG_EQUAL} note.  In the early stages of register allocation, a
312290075Sobrien@code{REG_EQUAL} note is changed into a @code{REG_EQUIV} note if
312390075Sobrien@var{op} is a constant and the insn represents the only set of its
312490075Sobriendestination register.
312590075Sobrien
312690075SobrienThus, compiler passes prior to register allocation need only check for
312790075Sobrien@code{REG_EQUAL} notes and passes subsequent to register allocation
312890075Sobrienneed only check for @code{REG_EQUIV} notes.
312990075Sobrien
313090075Sobrien@findex REG_WAS_0
313190075Sobrien@item REG_WAS_0
313290075SobrienThe single output of this insn contained zero before this insn.
313390075Sobrien@var{op} is the insn that set it to zero.  You can rely on this note if
313490075Sobrienit is present and @var{op} has not been deleted or turned into a @code{note};
313590075Sobrienits absence implies nothing.
313690075Sobrien@end table
313790075Sobrien
313890075SobrienThese notes describe linkages between insns.  They occur in pairs: one
313990075Sobrieninsn has one of a pair of notes that points to a second insn, which has
314090075Sobrienthe inverse note pointing back to the first insn.
314190075Sobrien
314290075Sobrien@table @code
314390075Sobrien@findex REG_RETVAL
314490075Sobrien@item REG_RETVAL
314590075SobrienThis insn copies the value of a multi-insn sequence (for example, a
314690075Sobrienlibrary call), and @var{op} is the first insn of the sequence (for a
314790075Sobrienlibrary call, the first insn that was generated to set up the arguments
314890075Sobrienfor the library call).
314990075Sobrien
315090075SobrienLoop optimization uses this note to treat such a sequence as a single
315190075Sobrienoperation for code motion purposes and flow analysis uses this note to
315290075Sobriendelete such sequences whose results are dead.
315390075Sobrien
315490075SobrienA @code{REG_EQUAL} note will also usually be attached to this insn to
315590075Sobrienprovide the expression being computed by the sequence.
315690075Sobrien
315790075SobrienThese notes will be deleted after reload, since they are no longer
315890075Sobrienaccurate or useful.
315990075Sobrien
316090075Sobrien@findex REG_LIBCALL
316190075Sobrien@item REG_LIBCALL
316290075SobrienThis is the inverse of @code{REG_RETVAL}: it is placed on the first
316390075Sobrieninsn of a multi-insn sequence, and it points to the last one.
316490075Sobrien
316590075SobrienThese notes are deleted after reload, since they are no longer useful or
316690075Sobrienaccurate.
316790075Sobrien
316890075Sobrien@findex REG_CC_SETTER
316990075Sobrien@findex REG_CC_USER
317090075Sobrien@item REG_CC_SETTER
317190075Sobrien@itemx REG_CC_USER
317290075SobrienOn machines that use @code{cc0}, the insns which set and use @code{cc0}
317390075Sobrienset and use @code{cc0} are adjacent.  However, when branch delay slot
317490075Sobrienfilling is done, this may no longer be true.  In this case a
317590075Sobrien@code{REG_CC_USER} note will be placed on the insn setting @code{cc0} to
317690075Sobrienpoint to the insn using @code{cc0} and a @code{REG_CC_SETTER} note will
317790075Sobrienbe placed on the insn using @code{cc0} to point to the insn setting
317890075Sobrien@code{cc0}.
317990075Sobrien@end table
318090075Sobrien
318190075SobrienThese values are only used in the @code{LOG_LINKS} field, and indicate
318290075Sobrienthe type of dependency that each link represents.  Links which indicate
318390075Sobriena data dependence (a read after write dependence) do not use any code,
318490075Sobrienthey simply have mode @code{VOIDmode}, and are printed without any
318590075Sobriendescriptive text.
318690075Sobrien
318790075Sobrien@table @code
318890075Sobrien@findex REG_DEP_ANTI
318990075Sobrien@item REG_DEP_ANTI
319090075SobrienThis indicates an anti dependence (a write after read dependence).
319190075Sobrien
319290075Sobrien@findex REG_DEP_OUTPUT
319390075Sobrien@item REG_DEP_OUTPUT
319490075SobrienThis indicates an output dependence (a write after write dependence).
319590075Sobrien@end table
319690075Sobrien
319790075SobrienThese notes describe information gathered from gcov profile data.  They
319890075Sobrienare stored in the @code{REG_NOTES} field of an insn as an
319990075Sobrien@code{expr_list}.
320090075Sobrien
320190075Sobrien@table @code
320290075Sobrien@findex REG_EXEC_COUNT
320390075Sobrien@item REG_EXEC_COUNT
320490075SobrienThis is used to indicate the number of times a basic block was executed
320590075Sobrienaccording to the profile data.  The note is attached to the first insn in
320690075Sobrienthe basic block.
320790075Sobrien
320890075Sobrien@findex REG_BR_PROB
320990075Sobrien@item REG_BR_PROB
321090075SobrienThis is used to specify the ratio of branches to non-branches of a
321190075Sobrienbranch insn according to the profile data.  The value is stored as a
321290075Sobrienvalue between 0 and REG_BR_PROB_BASE; larger values indicate a higher
321390075Sobrienprobability that the branch will be taken.
321490075Sobrien
321590075Sobrien@findex REG_BR_PRED
321690075Sobrien@item REG_BR_PRED
321790075SobrienThese notes are found in JUMP insns after delayed branch scheduling
321890075Sobrienhas taken place.  They indicate both the direction and the likelihood
321990075Sobrienof the JUMP@.  The format is a bitmask of ATTR_FLAG_* values.
322090075Sobrien
322190075Sobrien@findex REG_FRAME_RELATED_EXPR
322290075Sobrien@item REG_FRAME_RELATED_EXPR
322390075SobrienThis is used on an RTX_FRAME_RELATED_P insn wherein the attached expression
322490075Sobrienis used in place of the actual insn pattern.  This is done in cases where
322590075Sobrienthe pattern is either complex or misleading.
322690075Sobrien@end table
322790075Sobrien
322890075SobrienFor convenience, the machine mode in an @code{insn_list} or
322990075Sobrien@code{expr_list} is printed using these symbolic codes in debugging dumps.
323090075Sobrien
323190075Sobrien@findex insn_list
323290075Sobrien@findex expr_list
323390075SobrienThe only difference between the expression codes @code{insn_list} and
323490075Sobrien@code{expr_list} is that the first operand of an @code{insn_list} is
323590075Sobrienassumed to be an insn and is printed in debugging dumps as the insn's
323690075Sobrienunique id; the first operand of an @code{expr_list} is printed in the
323790075Sobrienordinary way as an expression.
323890075Sobrien
323990075Sobrien@node Calls
324090075Sobrien@section RTL Representation of Function-Call Insns
324190075Sobrien@cindex calling functions in RTL
324290075Sobrien@cindex RTL function-call insns
324390075Sobrien@cindex function-call insns
324490075Sobrien
324590075SobrienInsns that call subroutines have the RTL expression code @code{call_insn}.
324690075SobrienThese insns must satisfy special rules, and their bodies must use a special
324790075SobrienRTL expression code, @code{call}.
324890075Sobrien
324990075Sobrien@cindex @code{call} usage
325090075SobrienA @code{call} expression has two operands, as follows:
325190075Sobrien
325290075Sobrien@example
325390075Sobrien(call (mem:@var{fm} @var{addr}) @var{nbytes})
325490075Sobrien@end example
325590075Sobrien
325690075Sobrien@noindent
325790075SobrienHere @var{nbytes} is an operand that represents the number of bytes of
325890075Sobrienargument data being passed to the subroutine, @var{fm} is a machine mode
325990075Sobrien(which must equal as the definition of the @code{FUNCTION_MODE} macro in
326090075Sobrienthe machine description) and @var{addr} represents the address of the
326190075Sobriensubroutine.
326290075Sobrien
326390075SobrienFor a subroutine that returns no value, the @code{call} expression as
326490075Sobrienshown above is the entire body of the insn, except that the insn might
326590075Sobrienalso contain @code{use} or @code{clobber} expressions.
326690075Sobrien
326790075Sobrien@cindex @code{BLKmode}, and function return values
326890075SobrienFor a subroutine that returns a value whose mode is not @code{BLKmode},
326990075Sobrienthe value is returned in a hard register.  If this register's number is
327090075Sobrien@var{r}, then the body of the call insn looks like this:
327190075Sobrien
327290075Sobrien@example
327390075Sobrien(set (reg:@var{m} @var{r})
327490075Sobrien     (call (mem:@var{fm} @var{addr}) @var{nbytes}))
327590075Sobrien@end example
327690075Sobrien
327790075Sobrien@noindent
327890075SobrienThis RTL expression makes it clear (to the optimizer passes) that the
327990075Sobrienappropriate register receives a useful value in this insn.
328090075Sobrien
328190075SobrienWhen a subroutine returns a @code{BLKmode} value, it is handled by
328290075Sobrienpassing to the subroutine the address of a place to store the value.
328390075SobrienSo the call insn itself does not ``return'' any value, and it has the
328490075Sobriensame RTL form as a call that returns nothing.
328590075Sobrien
328690075SobrienOn some machines, the call instruction itself clobbers some register,
328790075Sobrienfor example to contain the return address.  @code{call_insn} insns
328890075Sobrienon these machines should have a body which is a @code{parallel}
328990075Sobrienthat contains both the @code{call} expression and @code{clobber}
329090075Sobrienexpressions that indicate which registers are destroyed.  Similarly,
329190075Sobrienif the call instruction requires some register other than the stack
329290075Sobrienpointer that is not explicitly mentioned it its RTL, a @code{use}
329390075Sobriensubexpression should mention that register.
329490075Sobrien
329590075SobrienFunctions that are called are assumed to modify all registers listed in
329690075Sobrienthe configuration macro @code{CALL_USED_REGISTERS} (@pxref{Register
329790075SobrienBasics}) and, with the exception of @code{const} functions and library
329890075Sobriencalls, to modify all of memory.
329990075Sobrien
330090075SobrienInsns containing just @code{use} expressions directly precede the
330190075Sobrien@code{call_insn} insn to indicate which registers contain inputs to the
330290075Sobrienfunction.  Similarly, if registers other than those in
330390075Sobrien@code{CALL_USED_REGISTERS} are clobbered by the called function, insns
330490075Sobriencontaining a single @code{clobber} follow immediately after the call to
330590075Sobrienindicate which registers.
330690075Sobrien
330790075Sobrien@node Sharing
330890075Sobrien@section Structure Sharing Assumptions
330990075Sobrien@cindex sharing of RTL components
331090075Sobrien@cindex RTL structure sharing assumptions
331190075Sobrien
331290075SobrienThe compiler assumes that certain kinds of RTL expressions are unique;
331390075Sobrienthere do not exist two distinct objects representing the same value.
331490075SobrienIn other cases, it makes an opposite assumption: that no RTL expression
331590075Sobrienobject of a certain kind appears in more than one place in the
331690075Sobriencontaining structure.
331790075Sobrien
331890075SobrienThese assumptions refer to a single function; except for the RTL
331990075Sobrienobjects that describe global variables and external functions,
332090075Sobrienand a few standard objects such as small integer constants,
332190075Sobrienno RTL objects are common to two functions.
332290075Sobrien
332390075Sobrien@itemize @bullet
332490075Sobrien@cindex @code{reg}, RTL sharing
332590075Sobrien@item
332690075SobrienEach pseudo-register has only a single @code{reg} object to represent it,
332790075Sobrienand therefore only a single machine mode.
332890075Sobrien
332990075Sobrien@cindex symbolic label
333090075Sobrien@cindex @code{symbol_ref}, RTL sharing
333190075Sobrien@item
333290075SobrienFor any symbolic label, there is only one @code{symbol_ref} object
333390075Sobrienreferring to it.
333490075Sobrien
333590075Sobrien@cindex @code{const_int}, RTL sharing
333690075Sobrien@item
333790075SobrienAll @code{const_int} expressions with equal values are shared.
333890075Sobrien
333990075Sobrien@cindex @code{pc}, RTL sharing
334090075Sobrien@item
334190075SobrienThere is only one @code{pc} expression.
334290075Sobrien
334390075Sobrien@cindex @code{cc0}, RTL sharing
334490075Sobrien@item
334590075SobrienThere is only one @code{cc0} expression.
334690075Sobrien
334790075Sobrien@cindex @code{const_double}, RTL sharing
334890075Sobrien@item
334990075SobrienThere is only one @code{const_double} expression with value 0 for
335090075Sobrieneach floating point mode.  Likewise for values 1 and 2.
335190075Sobrien
335296263Sobrien@cindex @code{const_vector}, RTL sharing
335396263Sobrien@item
335496263SobrienThere is only one @code{const_vector} expression with value 0 for
335596263Sobrieneach vector mode, be it an integer or a double constant vector.
335696263Sobrien
335790075Sobrien@cindex @code{label_ref}, RTL sharing
335890075Sobrien@cindex @code{scratch}, RTL sharing
335990075Sobrien@item
336090075SobrienNo @code{label_ref} or @code{scratch} appears in more than one place in
336190075Sobrienthe RTL structure; in other words, it is safe to do a tree-walk of all
336290075Sobrienthe insns in the function and assume that each time a @code{label_ref}
336390075Sobrienor @code{scratch} is seen it is distinct from all others that are seen.
336490075Sobrien
336590075Sobrien@cindex @code{mem}, RTL sharing
336690075Sobrien@item
336790075SobrienOnly one @code{mem} object is normally created for each static
336890075Sobrienvariable or stack slot, so these objects are frequently shared in all
336990075Sobrienthe places they appear.  However, separate but equal objects for these
337090075Sobrienvariables are occasionally made.
337190075Sobrien
337290075Sobrien@cindex @code{asm_operands}, RTL sharing
337390075Sobrien@item
337490075SobrienWhen a single @code{asm} statement has multiple output operands, a
337590075Sobriendistinct @code{asm_operands} expression is made for each output operand.
337690075SobrienHowever, these all share the vector which contains the sequence of input
337790075Sobrienoperands.  This sharing is used later on to test whether two
337890075Sobrien@code{asm_operands} expressions come from the same statement, so all
337990075Sobrienoptimizations must carefully preserve the sharing if they copy the
338090075Sobrienvector at all.
338190075Sobrien
338290075Sobrien@item
338390075SobrienNo RTL object appears in more than one place in the RTL structure
338490075Sobrienexcept as described above.  Many passes of the compiler rely on this
338590075Sobrienby assuming that they can modify RTL objects in place without unwanted
338690075Sobrienside-effects on other insns.
338790075Sobrien
338890075Sobrien@findex unshare_all_rtl
338990075Sobrien@item
339090075SobrienDuring initial RTL generation, shared structure is freely introduced.
339190075SobrienAfter all the RTL for a function has been generated, all shared
339290075Sobrienstructure is copied by @code{unshare_all_rtl} in @file{emit-rtl.c},
339390075Sobrienafter which the above rules are guaranteed to be followed.
339490075Sobrien
339590075Sobrien@findex copy_rtx_if_shared
339690075Sobrien@item
339790075SobrienDuring the combiner pass, shared structure within an insn can exist
339890075Sobrientemporarily.  However, the shared structure is copied before the
339990075Sobriencombiner is finished with the insn.  This is done by calling
340090075Sobrien@code{copy_rtx_if_shared}, which is a subroutine of
340190075Sobrien@code{unshare_all_rtl}.
340290075Sobrien@end itemize
340390075Sobrien
340490075Sobrien@node Reading RTL
340590075Sobrien@section Reading RTL
340690075Sobrien
340790075SobrienTo read an RTL object from a file, call @code{read_rtx}.  It takes one
340890075Sobrienargument, a stdio stream, and returns a single RTL object.  This routine
340990075Sobrienis defined in @file{read-rtl.c}.  It is not available in the compiler
341090075Sobrienitself, only the various programs that generate the compiler back end
341190075Sobrienfrom the machine description.
341290075Sobrien
341390075SobrienPeople frequently have the idea of using RTL stored as text in a file as
341490075Sobrienan interface between a language front end and the bulk of GCC@.  This
341590075Sobrienidea is not feasible.
341690075Sobrien
341790075SobrienGCC was designed to use RTL internally only.  Correct RTL for a given
341890075Sobrienprogram is very dependent on the particular target machine.  And the RTL
341990075Sobriendoes not contain all the information about the program.
342090075Sobrien
342190075SobrienThe proper way to interface GCC to a new language front end is with
342290075Sobrienthe ``tree'' data structure, described in the files @file{tree.h} and
342390075Sobrien@file{tree.def}.  The documentation for this structure (@pxref{Trees})
342490075Sobrienis incomplete.
3425