xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/rtl.texi (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1*8feb0f0bSmrg@c Copyright (C) 1988-2020 Free Software Foundation, Inc.
21debfc3dSmrg@c This is part of the GCC manual.
31debfc3dSmrg@c For copying conditions, see the file gcc.texi.
41debfc3dSmrg
51debfc3dSmrg@node RTL
61debfc3dSmrg@chapter RTL Representation
71debfc3dSmrg@cindex RTL representation
81debfc3dSmrg@cindex representation of RTL
91debfc3dSmrg@cindex Register Transfer Language (RTL)
101debfc3dSmrg
111debfc3dSmrgThe last part of the compiler work is done on a low-level intermediate
121debfc3dSmrgrepresentation called Register Transfer Language.  In this language, the
131debfc3dSmrginstructions to be output are described, pretty much one by one, in an
141debfc3dSmrgalgebraic form that describes what the instruction does.
151debfc3dSmrg
161debfc3dSmrgRTL is inspired by Lisp lists.  It has both an internal form, made up of
171debfc3dSmrgstructures that point at other structures, and a textual form that is used
181debfc3dSmrgin the machine description and in printed debugging dumps.  The textual
191debfc3dSmrgform uses nested parentheses to indicate the pointers in the internal form.
201debfc3dSmrg
211debfc3dSmrg@menu
221debfc3dSmrg* RTL Objects::       Expressions vs vectors vs strings vs integers.
231debfc3dSmrg* RTL Classes::       Categories of RTL expression objects, and their structure.
241debfc3dSmrg* Accessors::         Macros to access expression operands or vector elts.
251debfc3dSmrg* Special Accessors:: Macros to access specific annotations on RTL.
261debfc3dSmrg* Flags::             Other flags in an RTL expression.
271debfc3dSmrg* Machine Modes::     Describing the size and format of a datum.
281debfc3dSmrg* Constants::         Expressions with constant values.
291debfc3dSmrg* Regs and Memory::   Expressions representing register contents or memory.
301debfc3dSmrg* Arithmetic::        Expressions representing arithmetic on other expressions.
311debfc3dSmrg* Comparisons::       Expressions representing comparison of expressions.
321debfc3dSmrg* Bit-Fields::        Expressions representing bit-fields in memory or reg.
331debfc3dSmrg* Vector Operations:: Expressions involving vector datatypes.
341debfc3dSmrg* Conversions::       Extending, truncating, floating or fixing.
351debfc3dSmrg* RTL Declarations::  Declaring volatility, constancy, etc.
361debfc3dSmrg* Side Effects::      Expressions for storing in registers, etc.
371debfc3dSmrg* Incdec::            Embedded side-effects for autoincrement addressing.
381debfc3dSmrg* Assembler::         Representing @code{asm} with operands.
391debfc3dSmrg* Debug Information:: Expressions representing debugging information.
401debfc3dSmrg* Insns::             Expression types for entire insns.
411debfc3dSmrg* Calls::             RTL representation of function call insns.
421debfc3dSmrg* Sharing::           Some expressions are unique; others *must* be copied.
431debfc3dSmrg* Reading RTL::       Reading textual RTL from a file.
441debfc3dSmrg@end menu
451debfc3dSmrg
461debfc3dSmrg@node RTL Objects
471debfc3dSmrg@section RTL Object Types
481debfc3dSmrg@cindex RTL object types
491debfc3dSmrg
501debfc3dSmrg@cindex RTL integers
511debfc3dSmrg@cindex RTL strings
521debfc3dSmrg@cindex RTL vectors
531debfc3dSmrg@cindex RTL expression
541debfc3dSmrg@cindex RTX (See RTL)
551debfc3dSmrgRTL uses five kinds of objects: expressions, integers, wide integers,
561debfc3dSmrgstrings and vectors.  Expressions are the most important ones.  An RTL
571debfc3dSmrgexpression (``RTX'', for short) is a C structure, but it is usually
581debfc3dSmrgreferred to with a pointer; a type that is given the typedef name
591debfc3dSmrg@code{rtx}.
601debfc3dSmrg
611debfc3dSmrgAn integer is simply an @code{int}; their written form uses decimal
621debfc3dSmrgdigits.  A wide integer is an integral object whose type is
631debfc3dSmrg@code{HOST_WIDE_INT}; their written form uses decimal digits.
641debfc3dSmrg
651debfc3dSmrgA string is a sequence of characters.  In core it is represented as a
661debfc3dSmrg@code{char *} in usual C fashion, and it is written in C syntax as well.
671debfc3dSmrgHowever, strings in RTL may never be null.  If you write an empty string in
681debfc3dSmrga machine description, it is represented in core as a null pointer rather
691debfc3dSmrgthan as a pointer to a null character.  In certain contexts, these null
701debfc3dSmrgpointers instead of strings are valid.  Within RTL code, strings are most
711debfc3dSmrgcommonly found inside @code{symbol_ref} expressions, but they appear in
721debfc3dSmrgother contexts in the RTL expressions that make up machine descriptions.
731debfc3dSmrg
741debfc3dSmrgIn a machine description, strings are normally written with double
751debfc3dSmrgquotes, as you would in C@.  However, strings in machine descriptions may
761debfc3dSmrgextend over many lines, which is invalid C, and adjacent string
771debfc3dSmrgconstants are not concatenated as they are in C@.  Any string constant
781debfc3dSmrgmay be surrounded with a single set of parentheses.  Sometimes this
791debfc3dSmrgmakes the machine description easier to read.
801debfc3dSmrg
811debfc3dSmrgThere is also a special syntax for strings, which can be useful when C
821debfc3dSmrgcode is embedded in a machine description.  Wherever a string can
831debfc3dSmrgappear, it is also valid to write a C-style brace block.  The entire
841debfc3dSmrgbrace block, including the outermost pair of braces, is considered to be
851debfc3dSmrgthe string constant.  Double quote characters inside the braces are not
861debfc3dSmrgspecial.  Therefore, if you write string constants in the C code, you
871debfc3dSmrgneed not escape each quote character with a backslash.
881debfc3dSmrg
891debfc3dSmrgA vector contains an arbitrary number of pointers to expressions.  The
901debfc3dSmrgnumber of elements in the vector is explicitly present in the vector.
911debfc3dSmrgThe written form of a vector consists of square brackets
921debfc3dSmrg(@samp{[@dots{}]}) surrounding the elements, in sequence and with
931debfc3dSmrgwhitespace separating them.  Vectors of length zero are not created;
941debfc3dSmrgnull pointers are used instead.
951debfc3dSmrg
961debfc3dSmrg@cindex expression codes
971debfc3dSmrg@cindex codes, RTL expression
981debfc3dSmrg@findex GET_CODE
991debfc3dSmrg@findex PUT_CODE
1001debfc3dSmrgExpressions are classified by @dfn{expression codes} (also called RTX
1011debfc3dSmrgcodes).  The expression code is a name defined in @file{rtl.def}, which is
1021debfc3dSmrgalso (in uppercase) a C enumeration constant.  The possible expression
1031debfc3dSmrgcodes and their meanings are machine-independent.  The code of an RTX can
1041debfc3dSmrgbe extracted with the macro @code{GET_CODE (@var{x})} and altered with
1051debfc3dSmrg@code{PUT_CODE (@var{x}, @var{newcode})}.
1061debfc3dSmrg
1071debfc3dSmrgThe expression code determines how many operands the expression contains,
1081debfc3dSmrgand what kinds of objects they are.  In RTL, unlike Lisp, you cannot tell
1091debfc3dSmrgby looking at an operand what kind of object it is.  Instead, you must know
1101debfc3dSmrgfrom its context---from the expression code of the containing expression.
1111debfc3dSmrgFor example, in an expression of code @code{subreg}, the first operand is
112a2dc1f3fSmrgto be regarded as an expression and the second operand as a polynomial
113a2dc1f3fSmrginteger.  In an expression of code @code{plus}, there are two operands,
114a2dc1f3fSmrgboth of which are to be regarded as expressions.  In a @code{symbol_ref}
115a2dc1f3fSmrgexpression, there is one operand, which is to be regarded as a string.
1161debfc3dSmrg
1171debfc3dSmrgExpressions are written as parentheses containing the name of the
1181debfc3dSmrgexpression type, its flags and machine mode if any, and then the operands
1191debfc3dSmrgof the expression (separated by spaces).
1201debfc3dSmrg
1211debfc3dSmrgExpression code names in the @samp{md} file are written in lowercase,
1221debfc3dSmrgbut when they appear in C code they are written in uppercase.  In this
1231debfc3dSmrgmanual, they are shown as follows: @code{const_int}.
1241debfc3dSmrg
1251debfc3dSmrg@cindex (nil)
1261debfc3dSmrg@cindex nil
1271debfc3dSmrgIn a few contexts a null pointer is valid where an expression is normally
1281debfc3dSmrgwanted.  The written form of this is @code{(nil)}.
1291debfc3dSmrg
1301debfc3dSmrg@node RTL Classes
1311debfc3dSmrg@section RTL Classes and Formats
1321debfc3dSmrg@cindex RTL classes
1331debfc3dSmrg@cindex classes of RTX codes
1341debfc3dSmrg@cindex RTX codes, classes of
1351debfc3dSmrg@findex GET_RTX_CLASS
1361debfc3dSmrg
1371debfc3dSmrgThe various expression codes are divided into several @dfn{classes},
1381debfc3dSmrgwhich are represented by single characters.  You can determine the class
1391debfc3dSmrgof an RTX code with the macro @code{GET_RTX_CLASS (@var{code})}.
1401debfc3dSmrgCurrently, @file{rtl.def} defines these classes:
1411debfc3dSmrg
1421debfc3dSmrg@table @code
1431debfc3dSmrg@item RTX_OBJ
1441debfc3dSmrgAn RTX code that represents an actual object, such as a register
1451debfc3dSmrg(@code{REG}) or a memory location (@code{MEM}, @code{SYMBOL_REF}).
1461debfc3dSmrg@code{LO_SUM}) is also included; instead, @code{SUBREG} and
147c0a68be4Smrg@code{STRICT_LOW_PART} are not in this class, but in class
148c0a68be4Smrg@code{RTX_EXTRA}.
1491debfc3dSmrg
1501debfc3dSmrg@item RTX_CONST_OBJ
1511debfc3dSmrgAn RTX code that represents a constant object.  @code{HIGH} is also
1521debfc3dSmrgincluded in this class.
1531debfc3dSmrg
1541debfc3dSmrg@item RTX_COMPARE
1551debfc3dSmrgAn RTX code for a non-symmetric comparison, such as @code{GEU} or
1561debfc3dSmrg@code{LT}.
1571debfc3dSmrg
1581debfc3dSmrg@item RTX_COMM_COMPARE
1591debfc3dSmrgAn RTX code for a symmetric (commutative) comparison, such as @code{EQ}
1601debfc3dSmrgor @code{ORDERED}.
1611debfc3dSmrg
1621debfc3dSmrg@item RTX_UNARY
1631debfc3dSmrgAn RTX code for a unary arithmetic operation, such as @code{NEG},
1641debfc3dSmrg@code{NOT}, or @code{ABS}.  This category also includes value extension
1651debfc3dSmrg(sign or zero) and conversions between integer and floating point.
1661debfc3dSmrg
1671debfc3dSmrg@item RTX_COMM_ARITH
1681debfc3dSmrgAn RTX code for a commutative binary operation, such as @code{PLUS} or
1691debfc3dSmrg@code{AND}.  @code{NE} and @code{EQ} are comparisons, so they have class
170c0a68be4Smrg@code{RTX_COMM_COMPARE}.
1711debfc3dSmrg
1721debfc3dSmrg@item RTX_BIN_ARITH
1731debfc3dSmrgAn RTX code for a non-commutative binary operation, such as @code{MINUS},
1741debfc3dSmrg@code{DIV}, or @code{ASHIFTRT}.
1751debfc3dSmrg
1761debfc3dSmrg@item RTX_BITFIELD_OPS
1771debfc3dSmrgAn RTX code for a bit-field operation.  Currently only
1781debfc3dSmrg@code{ZERO_EXTRACT} and @code{SIGN_EXTRACT}.  These have three inputs
1791debfc3dSmrgand are lvalues (so they can be used for insertion as well).
1801debfc3dSmrg@xref{Bit-Fields}.
1811debfc3dSmrg
1821debfc3dSmrg@item RTX_TERNARY
1831debfc3dSmrgAn RTX code for other three input operations.  Currently only
1841debfc3dSmrg@code{IF_THEN_ELSE},  @code{VEC_MERGE}, @code{SIGN_EXTRACT},
1851debfc3dSmrg@code{ZERO_EXTRACT}, and @code{FMA}.
1861debfc3dSmrg
1871debfc3dSmrg@item RTX_INSN
1881debfc3dSmrgAn RTX code for an entire instruction:  @code{INSN}, @code{JUMP_INSN}, and
1891debfc3dSmrg@code{CALL_INSN}.  @xref{Insns}.
1901debfc3dSmrg
1911debfc3dSmrg@item RTX_MATCH
1921debfc3dSmrgAn RTX code for something that matches in insns, such as
1931debfc3dSmrg@code{MATCH_DUP}.  These only occur in machine descriptions.
1941debfc3dSmrg
1951debfc3dSmrg@item RTX_AUTOINC
1961debfc3dSmrgAn RTX code for an auto-increment addressing mode, such as
1971debfc3dSmrg@code{POST_INC}.  @samp{XEXP (@var{x}, 0)} gives the auto-modified
1981debfc3dSmrgregister.
1991debfc3dSmrg
2001debfc3dSmrg@item RTX_EXTRA
2011debfc3dSmrgAll other RTX codes.  This category includes the remaining codes used
2021debfc3dSmrgonly in machine descriptions (@code{DEFINE_*}, etc.).  It also includes
2031debfc3dSmrgall the codes describing side effects (@code{SET}, @code{USE},
2041debfc3dSmrg@code{CLOBBER}, etc.) and the non-insns that may appear on an insn
2051debfc3dSmrgchain, such as @code{NOTE}, @code{BARRIER}, and @code{CODE_LABEL}.
2061debfc3dSmrg@code{SUBREG} is also part of this class.
2071debfc3dSmrg@end table
2081debfc3dSmrg
2091debfc3dSmrg@cindex RTL format
2101debfc3dSmrgFor each expression code, @file{rtl.def} specifies the number of
2111debfc3dSmrgcontained objects and their kinds using a sequence of characters
2121debfc3dSmrgcalled the @dfn{format} of the expression code.  For example,
213a2dc1f3fSmrgthe format of @code{subreg} is @samp{ep}.
2141debfc3dSmrg
2151debfc3dSmrg@cindex RTL format characters
2161debfc3dSmrgThese are the most commonly used format characters:
2171debfc3dSmrg
2181debfc3dSmrg@table @code
2191debfc3dSmrg@item e
2201debfc3dSmrgAn expression (actually a pointer to an expression).
2211debfc3dSmrg
2221debfc3dSmrg@item i
2231debfc3dSmrgAn integer.
2241debfc3dSmrg
2251debfc3dSmrg@item w
2261debfc3dSmrgA wide integer.
2271debfc3dSmrg
2281debfc3dSmrg@item s
2291debfc3dSmrgA string.
2301debfc3dSmrg
2311debfc3dSmrg@item E
2321debfc3dSmrgA vector of expressions.
2331debfc3dSmrg@end table
2341debfc3dSmrg
2351debfc3dSmrgA few other format characters are used occasionally:
2361debfc3dSmrg
2371debfc3dSmrg@table @code
2381debfc3dSmrg@item u
2391debfc3dSmrg@samp{u} is equivalent to @samp{e} except that it is printed differently
2401debfc3dSmrgin debugging dumps.  It is used for pointers to insns.
2411debfc3dSmrg
2421debfc3dSmrg@item n
2431debfc3dSmrg@samp{n} is equivalent to @samp{i} except that it is printed differently
2441debfc3dSmrgin debugging dumps.  It is used for the line number or code number of a
2451debfc3dSmrg@code{note} insn.
2461debfc3dSmrg
2471debfc3dSmrg@item S
2481debfc3dSmrg@samp{S} indicates a string which is optional.  In the RTL objects in
2491debfc3dSmrgcore, @samp{S} is equivalent to @samp{s}, but when the object is read,
2501debfc3dSmrgfrom an @samp{md} file, the string value of this operand may be omitted.
2511debfc3dSmrgAn omitted string is taken to be the null string.
2521debfc3dSmrg
2531debfc3dSmrg@item V
2541debfc3dSmrg@samp{V} indicates a vector which is optional.  In the RTL objects in
2551debfc3dSmrgcore, @samp{V} is equivalent to @samp{E}, but when the object is read
2561debfc3dSmrgfrom an @samp{md} file, the vector value of this operand may be omitted.
2571debfc3dSmrgAn omitted vector is effectively the same as a vector of no elements.
2581debfc3dSmrg
2591debfc3dSmrg@item B
2601debfc3dSmrg@samp{B} indicates a pointer to basic block structure.
2611debfc3dSmrg
262a2dc1f3fSmrg@item p
263a2dc1f3fSmrgA polynomial integer.  At present this is used only for @code{SUBREG_BYTE}.
264a2dc1f3fSmrg
2651debfc3dSmrg@item 0
2661debfc3dSmrg@samp{0} means a slot whose contents do not fit any normal category.
2671debfc3dSmrg@samp{0} slots are not printed at all in dumps, and are often used in
2681debfc3dSmrgspecial ways by small parts of the compiler.
2691debfc3dSmrg@end table
2701debfc3dSmrg
2711debfc3dSmrgThere are macros to get the number of operands and the format
2721debfc3dSmrgof an expression code:
2731debfc3dSmrg
2741debfc3dSmrg@table @code
2751debfc3dSmrg@findex GET_RTX_LENGTH
2761debfc3dSmrg@item GET_RTX_LENGTH (@var{code})
2771debfc3dSmrgNumber of operands of an RTX of code @var{code}.
2781debfc3dSmrg
2791debfc3dSmrg@findex GET_RTX_FORMAT
2801debfc3dSmrg@item GET_RTX_FORMAT (@var{code})
2811debfc3dSmrgThe format of an RTX of code @var{code}, as a C string.
2821debfc3dSmrg@end table
2831debfc3dSmrg
2841debfc3dSmrgSome classes of RTX codes always have the same format.  For example, it
2851debfc3dSmrgis safe to assume that all comparison operations have format @code{ee}.
2861debfc3dSmrg
2871debfc3dSmrg@table @code
288c0a68be4Smrg@item RTX_UNARY
2891debfc3dSmrgAll codes of this class have format @code{e}.
2901debfc3dSmrg
291c0a68be4Smrg@item RTX_BIN_ARITH
292c0a68be4Smrg@itemx RTX_COMM_ARITH
293c0a68be4Smrg@itemx RTX_COMM_COMPARE
294c0a68be4Smrg@itemx RTX_COMPARE
2951debfc3dSmrgAll codes of these classes have format @code{ee}.
2961debfc3dSmrg
297c0a68be4Smrg@item RTX_BITFIELD_OPS
298c0a68be4Smrg@itemx RTX_TERNARY
2991debfc3dSmrgAll codes of these classes have format @code{eee}.
3001debfc3dSmrg
301c0a68be4Smrg@item RTX_INSN
3021debfc3dSmrgAll codes of this class have formats that begin with @code{iuueiee}.
3031debfc3dSmrg@xref{Insns}.  Note that not all RTL objects linked onto an insn chain
304c0a68be4Smrgare of class @code{RTX_INSN}.
3051debfc3dSmrg
306c0a68be4Smrg@item RTX_CONST_OBJ
307c0a68be4Smrg@itemx RTX_OBJ
308c0a68be4Smrg@itemx RTX_MATCH
309c0a68be4Smrg@itemx RTX_EXTRA
3101debfc3dSmrgYou can make no assumptions about the format of these codes.
3111debfc3dSmrg@end table
3121debfc3dSmrg
3131debfc3dSmrg@node Accessors
3141debfc3dSmrg@section Access to Operands
3151debfc3dSmrg@cindex accessors
3161debfc3dSmrg@cindex access to operands
3171debfc3dSmrg@cindex operand access
3181debfc3dSmrg
3191debfc3dSmrg@findex XEXP
3201debfc3dSmrg@findex XINT
3211debfc3dSmrg@findex XWINT
3221debfc3dSmrg@findex XSTR
3231debfc3dSmrgOperands of expressions are accessed using the macros @code{XEXP},
3241debfc3dSmrg@code{XINT}, @code{XWINT} and @code{XSTR}.  Each of these macros takes
3251debfc3dSmrgtwo arguments: an expression-pointer (RTX) and an operand number
3261debfc3dSmrg(counting from zero).  Thus,
3271debfc3dSmrg
3281debfc3dSmrg@smallexample
3291debfc3dSmrgXEXP (@var{x}, 2)
3301debfc3dSmrg@end smallexample
3311debfc3dSmrg
3321debfc3dSmrg@noindent
3331debfc3dSmrgaccesses operand 2 of expression @var{x}, as an expression.
3341debfc3dSmrg
3351debfc3dSmrg@smallexample
3361debfc3dSmrgXINT (@var{x}, 2)
3371debfc3dSmrg@end smallexample
3381debfc3dSmrg
3391debfc3dSmrg@noindent
3401debfc3dSmrgaccesses the same operand as an integer.  @code{XSTR}, used in the same
3411debfc3dSmrgfashion, would access it as a string.
3421debfc3dSmrg
3431debfc3dSmrgAny operand can be accessed as an integer, as an expression or as a string.
3441debfc3dSmrgYou must choose the correct method of access for the kind of value actually
3451debfc3dSmrgstored in the operand.  You would do this based on the expression code of
3461debfc3dSmrgthe containing expression.  That is also how you would know how many
3471debfc3dSmrgoperands there are.
3481debfc3dSmrg
349a2dc1f3fSmrgFor example, if @var{x} is an @code{int_list} expression, you know that it has
350a2dc1f3fSmrgtwo operands which can be correctly accessed as @code{XINT (@var{x}, 0)}
351a2dc1f3fSmrgand @code{XEXP (@var{x}, 1)}.  Incorrect accesses like
352a2dc1f3fSmrg@code{XEXP (@var{x}, 0)} and @code{XINT (@var{x}, 1)} would compile,
353a2dc1f3fSmrgbut would trigger an internal compiler error when rtl checking is enabled.
354a2dc1f3fSmrgNothing stops you from writing @code{XEXP (@var{x}, 28)} either, but
355a2dc1f3fSmrgthis will access memory past the end of the expression with
3561debfc3dSmrgunpredictable results.
3571debfc3dSmrg
3581debfc3dSmrgAccess to operands which are vectors is more complicated.  You can use the
3591debfc3dSmrgmacro @code{XVEC} to get the vector-pointer itself, or the macros
3601debfc3dSmrg@code{XVECEXP} and @code{XVECLEN} to access the elements and length of a
3611debfc3dSmrgvector.
3621debfc3dSmrg
3631debfc3dSmrg@table @code
3641debfc3dSmrg@findex XVEC
3651debfc3dSmrg@item XVEC (@var{exp}, @var{idx})
3661debfc3dSmrgAccess the vector-pointer which is operand number @var{idx} in @var{exp}.
3671debfc3dSmrg
3681debfc3dSmrg@findex XVECLEN
3691debfc3dSmrg@item XVECLEN (@var{exp}, @var{idx})
3701debfc3dSmrgAccess the length (number of elements) in the vector which is
3711debfc3dSmrgin operand number @var{idx} in @var{exp}.  This value is an @code{int}.
3721debfc3dSmrg
3731debfc3dSmrg@findex XVECEXP
3741debfc3dSmrg@item XVECEXP (@var{exp}, @var{idx}, @var{eltnum})
3751debfc3dSmrgAccess element number @var{eltnum} in the vector which is
3761debfc3dSmrgin operand number @var{idx} in @var{exp}.  This value is an RTX@.
3771debfc3dSmrg
3781debfc3dSmrgIt is up to you to make sure that @var{eltnum} is not negative
3791debfc3dSmrgand is less than @code{XVECLEN (@var{exp}, @var{idx})}.
3801debfc3dSmrg@end table
3811debfc3dSmrg
3821debfc3dSmrgAll the macros defined in this section expand into lvalues and therefore
3831debfc3dSmrgcan be used to assign the operands, lengths and vector elements as well as
3841debfc3dSmrgto access them.
3851debfc3dSmrg
3861debfc3dSmrg@node Special Accessors
3871debfc3dSmrg@section Access to Special Operands
3881debfc3dSmrg@cindex access to special operands
3891debfc3dSmrg
3901debfc3dSmrgSome RTL nodes have special annotations associated with them.
3911debfc3dSmrg
3921debfc3dSmrg@table @code
3931debfc3dSmrg@item MEM
3941debfc3dSmrg@table @code
3951debfc3dSmrg@findex MEM_ALIAS_SET
3961debfc3dSmrg@item MEM_ALIAS_SET (@var{x})
3971debfc3dSmrgIf 0, @var{x} is not in any alias set, and may alias anything.  Otherwise,
3981debfc3dSmrg@var{x} can only alias @code{MEM}s in a conflicting alias set.  This value
3991debfc3dSmrgis set in a language-dependent manner in the front-end, and should not be
4001debfc3dSmrgaltered in the back-end.  In some front-ends, these numbers may correspond
4011debfc3dSmrgin some way to types, or other language-level entities, but they need not,
4021debfc3dSmrgand the back-end makes no such assumptions.
4031debfc3dSmrgThese set numbers are tested with @code{alias_sets_conflict_p}.
4041debfc3dSmrg
4051debfc3dSmrg@findex MEM_EXPR
4061debfc3dSmrg@item MEM_EXPR (@var{x})
4071debfc3dSmrgIf this register is known to hold the value of some user-level
4081debfc3dSmrgdeclaration, this is that tree node.  It may also be a
4091debfc3dSmrg@code{COMPONENT_REF}, in which case this is some field reference,
4101debfc3dSmrgand @code{TREE_OPERAND (@var{x}, 0)} contains the declaration,
4111debfc3dSmrgor another @code{COMPONENT_REF}, or null if there is no compile-time
4121debfc3dSmrgobject associated with the reference.
4131debfc3dSmrg
4141debfc3dSmrg@findex MEM_OFFSET_KNOWN_P
4151debfc3dSmrg@item MEM_OFFSET_KNOWN_P (@var{x})
4161debfc3dSmrgTrue if the offset of the memory reference from @code{MEM_EXPR} is known.
4171debfc3dSmrg@samp{MEM_OFFSET (@var{x})} provides the offset if so.
4181debfc3dSmrg
4191debfc3dSmrg@findex MEM_OFFSET
4201debfc3dSmrg@item MEM_OFFSET (@var{x})
4211debfc3dSmrgThe offset from the start of @code{MEM_EXPR}.  The value is only valid if
4221debfc3dSmrg@samp{MEM_OFFSET_KNOWN_P (@var{x})} is true.
4231debfc3dSmrg
4241debfc3dSmrg@findex MEM_SIZE_KNOWN_P
4251debfc3dSmrg@item MEM_SIZE_KNOWN_P (@var{x})
4261debfc3dSmrgTrue if the size of the memory reference is known.
4271debfc3dSmrg@samp{MEM_SIZE (@var{x})} provides its size if so.
4281debfc3dSmrg
4291debfc3dSmrg@findex MEM_SIZE
4301debfc3dSmrg@item MEM_SIZE (@var{x})
4311debfc3dSmrgThe size in bytes of the memory reference.
4321debfc3dSmrgThis is mostly relevant for @code{BLKmode} references as otherwise
4331debfc3dSmrgthe size is implied by the mode.  The value is only valid if
4341debfc3dSmrg@samp{MEM_SIZE_KNOWN_P (@var{x})} is true.
4351debfc3dSmrg
4361debfc3dSmrg@findex MEM_ALIGN
4371debfc3dSmrg@item MEM_ALIGN (@var{x})
4381debfc3dSmrgThe known alignment in bits of the memory reference.
4391debfc3dSmrg
4401debfc3dSmrg@findex MEM_ADDR_SPACE
4411debfc3dSmrg@item MEM_ADDR_SPACE (@var{x})
4421debfc3dSmrgThe address space of the memory reference.  This will commonly be zero
4431debfc3dSmrgfor the generic address space.
4441debfc3dSmrg@end table
4451debfc3dSmrg
4461debfc3dSmrg@item REG
4471debfc3dSmrg@table @code
4481debfc3dSmrg@findex ORIGINAL_REGNO
4491debfc3dSmrg@item ORIGINAL_REGNO (@var{x})
4501debfc3dSmrgThis field holds the number the register ``originally'' had; for a
4511debfc3dSmrgpseudo register turned into a hard reg this will hold the old pseudo
4521debfc3dSmrgregister number.
4531debfc3dSmrg
4541debfc3dSmrg@findex REG_EXPR
4551debfc3dSmrg@item REG_EXPR (@var{x})
4561debfc3dSmrgIf this register is known to hold the value of some user-level
4571debfc3dSmrgdeclaration, this is that tree node.
4581debfc3dSmrg
4591debfc3dSmrg@findex REG_OFFSET
4601debfc3dSmrg@item REG_OFFSET (@var{x})
4611debfc3dSmrgIf this register is known to hold the value of some user-level
4621debfc3dSmrgdeclaration, this is the offset into that logical storage.
4631debfc3dSmrg@end table
4641debfc3dSmrg
4651debfc3dSmrg@item SYMBOL_REF
4661debfc3dSmrg@table @code
4671debfc3dSmrg@findex SYMBOL_REF_DECL
4681debfc3dSmrg@item SYMBOL_REF_DECL (@var{x})
4691debfc3dSmrgIf the @code{symbol_ref} @var{x} was created for a @code{VAR_DECL} or
4701debfc3dSmrga @code{FUNCTION_DECL}, that tree is recorded here.  If this value is
4711debfc3dSmrgnull, then @var{x} was created by back end code generation routines,
4721debfc3dSmrgand there is no associated front end symbol table entry.
4731debfc3dSmrg
4741debfc3dSmrg@code{SYMBOL_REF_DECL} may also point to a tree of class @code{'c'},
4751debfc3dSmrgthat is, some sort of constant.  In this case, the @code{symbol_ref}
4761debfc3dSmrgis an entry in the per-file constant pool; again, there is no associated
4771debfc3dSmrgfront end symbol table entry.
4781debfc3dSmrg
4791debfc3dSmrg@findex SYMBOL_REF_CONSTANT
4801debfc3dSmrg@item SYMBOL_REF_CONSTANT (@var{x})
4811debfc3dSmrgIf @samp{CONSTANT_POOL_ADDRESS_P (@var{x})} is true, this is the constant
4821debfc3dSmrgpool entry for @var{x}.  It is null otherwise.
4831debfc3dSmrg
4841debfc3dSmrg@findex SYMBOL_REF_DATA
4851debfc3dSmrg@item SYMBOL_REF_DATA (@var{x})
4861debfc3dSmrgA field of opaque type used to store @code{SYMBOL_REF_DECL} or
4871debfc3dSmrg@code{SYMBOL_REF_CONSTANT}.
4881debfc3dSmrg
4891debfc3dSmrg@findex SYMBOL_REF_FLAGS
4901debfc3dSmrg@item SYMBOL_REF_FLAGS (@var{x})
4911debfc3dSmrgIn a @code{symbol_ref}, this is used to communicate various predicates
4921debfc3dSmrgabout the symbol.  Some of these are common enough to be computed by
4931debfc3dSmrgcommon code, some are specific to the target.  The common bits are:
4941debfc3dSmrg
4951debfc3dSmrg@table @code
4961debfc3dSmrg@findex SYMBOL_REF_FUNCTION_P
4971debfc3dSmrg@findex SYMBOL_FLAG_FUNCTION
4981debfc3dSmrg@item SYMBOL_FLAG_FUNCTION
4991debfc3dSmrgSet if the symbol refers to a function.
5001debfc3dSmrg
5011debfc3dSmrg@findex SYMBOL_REF_LOCAL_P
5021debfc3dSmrg@findex SYMBOL_FLAG_LOCAL
5031debfc3dSmrg@item SYMBOL_FLAG_LOCAL
5041debfc3dSmrgSet if the symbol is local to this ``module''.
5051debfc3dSmrgSee @code{TARGET_BINDS_LOCAL_P}.
5061debfc3dSmrg
5071debfc3dSmrg@findex SYMBOL_REF_EXTERNAL_P
5081debfc3dSmrg@findex SYMBOL_FLAG_EXTERNAL
5091debfc3dSmrg@item SYMBOL_FLAG_EXTERNAL
5101debfc3dSmrgSet if this symbol is not defined in this translation unit.
5111debfc3dSmrgNote that this is not the inverse of @code{SYMBOL_FLAG_LOCAL}.
5121debfc3dSmrg
5131debfc3dSmrg@findex SYMBOL_REF_SMALL_P
5141debfc3dSmrg@findex SYMBOL_FLAG_SMALL
5151debfc3dSmrg@item SYMBOL_FLAG_SMALL
5161debfc3dSmrgSet if the symbol is located in the small data section.
5171debfc3dSmrgSee @code{TARGET_IN_SMALL_DATA_P}.
5181debfc3dSmrg
5191debfc3dSmrg@findex SYMBOL_FLAG_TLS_SHIFT
5201debfc3dSmrg@findex SYMBOL_REF_TLS_MODEL
5211debfc3dSmrg@item SYMBOL_REF_TLS_MODEL (@var{x})
5221debfc3dSmrgThis is a multi-bit field accessor that returns the @code{tls_model}
5231debfc3dSmrgto be used for a thread-local storage symbol.  It returns zero for
5241debfc3dSmrgnon-thread-local symbols.
5251debfc3dSmrg
5261debfc3dSmrg@findex SYMBOL_REF_HAS_BLOCK_INFO_P
5271debfc3dSmrg@findex SYMBOL_FLAG_HAS_BLOCK_INFO
5281debfc3dSmrg@item SYMBOL_FLAG_HAS_BLOCK_INFO
5291debfc3dSmrgSet if the symbol has @code{SYMBOL_REF_BLOCK} and
5301debfc3dSmrg@code{SYMBOL_REF_BLOCK_OFFSET} fields.
5311debfc3dSmrg
5321debfc3dSmrg@findex SYMBOL_REF_ANCHOR_P
5331debfc3dSmrg@findex SYMBOL_FLAG_ANCHOR
5341debfc3dSmrg@cindex @option{-fsection-anchors}
5351debfc3dSmrg@item SYMBOL_FLAG_ANCHOR
5361debfc3dSmrgSet if the symbol is used as a section anchor.  ``Section anchors''
5371debfc3dSmrgare symbols that have a known position within an @code{object_block}
5381debfc3dSmrgand that can be used to access nearby members of that block.
5391debfc3dSmrgThey are used to implement @option{-fsection-anchors}.
5401debfc3dSmrg
5411debfc3dSmrgIf this flag is set, then @code{SYMBOL_FLAG_HAS_BLOCK_INFO} will be too.
5421debfc3dSmrg@end table
5431debfc3dSmrg
5441debfc3dSmrgBits beginning with @code{SYMBOL_FLAG_MACH_DEP} are available for
5451debfc3dSmrgthe target's use.
5461debfc3dSmrg@end table
5471debfc3dSmrg
5481debfc3dSmrg@findex SYMBOL_REF_BLOCK
5491debfc3dSmrg@item SYMBOL_REF_BLOCK (@var{x})
5501debfc3dSmrgIf @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})}, this is the
5511debfc3dSmrg@samp{object_block} structure to which the symbol belongs,
5521debfc3dSmrgor @code{NULL} if it has not been assigned a block.
5531debfc3dSmrg
5541debfc3dSmrg@findex SYMBOL_REF_BLOCK_OFFSET
5551debfc3dSmrg@item SYMBOL_REF_BLOCK_OFFSET (@var{x})
5561debfc3dSmrgIf @samp{SYMBOL_REF_HAS_BLOCK_INFO_P (@var{x})}, this is the offset of @var{x}
5571debfc3dSmrgfrom the first object in @samp{SYMBOL_REF_BLOCK (@var{x})}.  The value is
5581debfc3dSmrgnegative if @var{x} has not yet been assigned to a block, or it has not
5591debfc3dSmrgbeen given an offset within that block.
5601debfc3dSmrg@end table
5611debfc3dSmrg
5621debfc3dSmrg@node Flags
5631debfc3dSmrg@section Flags in an RTL Expression
5641debfc3dSmrg@cindex flags in RTL expression
5651debfc3dSmrg
5661debfc3dSmrgRTL expressions contain several flags (one-bit bit-fields)
5671debfc3dSmrgthat are used in certain types of expression.  Most often they
5681debfc3dSmrgare accessed with the following macros, which expand into lvalues.
5691debfc3dSmrg
5701debfc3dSmrg@table @code
571a2dc1f3fSmrg@findex CROSSING_JUMP_P
572a2dc1f3fSmrg@cindex @code{jump_insn} and @samp{/j}
573a2dc1f3fSmrg@item CROSSING_JUMP_P (@var{x})
574a2dc1f3fSmrgNonzero in a @code{jump_insn} if it crosses between hot and cold sections,
575a2dc1f3fSmrgwhich could potentially be very far apart in the executable.  The presence
576a2dc1f3fSmrgof this flag indicates to other optimizations that this branching instruction
577a2dc1f3fSmrgshould not be ``collapsed'' into a simpler branching construct.  It is used
578a2dc1f3fSmrgwhen the optimization to partition basic blocks into hot and cold sections
579a2dc1f3fSmrgis turned on.
580a2dc1f3fSmrg
5811debfc3dSmrg@findex CONSTANT_POOL_ADDRESS_P
5821debfc3dSmrg@cindex @code{symbol_ref} and @samp{/u}
5831debfc3dSmrg@cindex @code{unchanging}, in @code{symbol_ref}
5841debfc3dSmrg@item CONSTANT_POOL_ADDRESS_P (@var{x})
5851debfc3dSmrgNonzero in a @code{symbol_ref} if it refers to part of the current
5861debfc3dSmrgfunction's constant pool.  For most targets these addresses are in a
5871debfc3dSmrg@code{.rodata} section entirely separate from the function, but for
5881debfc3dSmrgsome targets the addresses are close to the beginning of the function.
5891debfc3dSmrgIn either case GCC assumes these addresses can be addressed directly,
5901debfc3dSmrgperhaps with the help of base registers.
5911debfc3dSmrgStored in the @code{unchanging} field and printed as @samp{/u}.
5921debfc3dSmrg
5931debfc3dSmrg@findex INSN_ANNULLED_BRANCH_P
5941debfc3dSmrg@cindex @code{jump_insn} and @samp{/u}
5951debfc3dSmrg@cindex @code{call_insn} and @samp{/u}
5961debfc3dSmrg@cindex @code{insn} and @samp{/u}
5971debfc3dSmrg@cindex @code{unchanging}, in @code{jump_insn}, @code{call_insn} and @code{insn}
5981debfc3dSmrg@item INSN_ANNULLED_BRANCH_P (@var{x})
5991debfc3dSmrgIn a @code{jump_insn}, @code{call_insn}, or @code{insn} indicates
6001debfc3dSmrgthat the branch is an annulling one.  See the discussion under
6011debfc3dSmrg@code{sequence} below.  Stored in the @code{unchanging} field and
6021debfc3dSmrgprinted as @samp{/u}.
6031debfc3dSmrg
6041debfc3dSmrg@findex INSN_DELETED_P
6051debfc3dSmrg@cindex @code{insn} and @samp{/v}
6061debfc3dSmrg@cindex @code{call_insn} and @samp{/v}
6071debfc3dSmrg@cindex @code{jump_insn} and @samp{/v}
6081debfc3dSmrg@cindex @code{code_label} and @samp{/v}
6091debfc3dSmrg@cindex @code{jump_table_data} and @samp{/v}
6101debfc3dSmrg@cindex @code{barrier} and @samp{/v}
6111debfc3dSmrg@cindex @code{note} and @samp{/v}
6121debfc3dSmrg@cindex @code{volatil}, in @code{insn}, @code{call_insn}, @code{jump_insn}, @code{code_label}, @code{jump_table_data}, @code{barrier}, and @code{note}
6131debfc3dSmrg@item INSN_DELETED_P (@var{x})
6141debfc3dSmrgIn an @code{insn}, @code{call_insn}, @code{jump_insn}, @code{code_label},
6151debfc3dSmrg@code{jump_table_data}, @code{barrier}, or @code{note},
6161debfc3dSmrgnonzero if the insn has been deleted.  Stored in the
6171debfc3dSmrg@code{volatil} field and printed as @samp{/v}.
6181debfc3dSmrg
6191debfc3dSmrg@findex INSN_FROM_TARGET_P
6201debfc3dSmrg@cindex @code{insn} and @samp{/s}
6211debfc3dSmrg@cindex @code{jump_insn} and @samp{/s}
6221debfc3dSmrg@cindex @code{call_insn} and @samp{/s}
6231debfc3dSmrg@cindex @code{in_struct}, in @code{insn} and @code{jump_insn} and @code{call_insn}
6241debfc3dSmrg@item INSN_FROM_TARGET_P (@var{x})
6251debfc3dSmrgIn an @code{insn} or @code{jump_insn} or @code{call_insn} in a delay
6261debfc3dSmrgslot of a branch, indicates that the insn
6271debfc3dSmrgis from the target of the branch.  If the branch insn has
6281debfc3dSmrg@code{INSN_ANNULLED_BRANCH_P} set, this insn will only be executed if
6291debfc3dSmrgthe branch is taken.  For annulled branches with
6301debfc3dSmrg@code{INSN_FROM_TARGET_P} clear, the insn will be executed only if the
6311debfc3dSmrgbranch is not taken.  When @code{INSN_ANNULLED_BRANCH_P} is not set,
6321debfc3dSmrgthis insn will always be executed.  Stored in the @code{in_struct}
6331debfc3dSmrgfield and printed as @samp{/s}.
6341debfc3dSmrg
6351debfc3dSmrg@findex LABEL_PRESERVE_P
6361debfc3dSmrg@cindex @code{code_label} and @samp{/i}
6371debfc3dSmrg@cindex @code{note} and @samp{/i}
6381debfc3dSmrg@cindex @code{in_struct}, in @code{code_label} and @code{note}
6391debfc3dSmrg@item LABEL_PRESERVE_P (@var{x})
6401debfc3dSmrgIn a @code{code_label} or @code{note}, indicates that the label is referenced by
6411debfc3dSmrgcode or data not visible to the RTL of a given function.
6421debfc3dSmrgLabels referenced by a non-local goto will have this bit set.  Stored
6431debfc3dSmrgin the @code{in_struct} field and printed as @samp{/s}.
6441debfc3dSmrg
6451debfc3dSmrg@findex LABEL_REF_NONLOCAL_P
6461debfc3dSmrg@cindex @code{label_ref} and @samp{/v}
6471debfc3dSmrg@cindex @code{reg_label} and @samp{/v}
6481debfc3dSmrg@cindex @code{volatil}, in @code{label_ref} and @code{reg_label}
6491debfc3dSmrg@item LABEL_REF_NONLOCAL_P (@var{x})
6501debfc3dSmrgIn @code{label_ref} and @code{reg_label} expressions, nonzero if this is
6511debfc3dSmrga reference to a non-local label.
6521debfc3dSmrgStored in the @code{volatil} field and printed as @samp{/v}.
6531debfc3dSmrg
6541debfc3dSmrg@findex MEM_KEEP_ALIAS_SET_P
6551debfc3dSmrg@cindex @code{mem} and @samp{/j}
6561debfc3dSmrg@cindex @code{jump}, in @code{mem}
6571debfc3dSmrg@item MEM_KEEP_ALIAS_SET_P (@var{x})
6581debfc3dSmrgIn @code{mem} expressions, 1 if we should keep the alias set for this
6591debfc3dSmrgmem unchanged when we access a component.  Set to 1, for example, when we
6601debfc3dSmrgare already in a non-addressable component of an aggregate.
6611debfc3dSmrgStored in the @code{jump} field and printed as @samp{/j}.
6621debfc3dSmrg
6631debfc3dSmrg@findex MEM_VOLATILE_P
6641debfc3dSmrg@cindex @code{mem} and @samp{/v}
6651debfc3dSmrg@cindex @code{asm_input} and @samp{/v}
6661debfc3dSmrg@cindex @code{asm_operands} and @samp{/v}
6671debfc3dSmrg@cindex @code{volatil}, in @code{mem}, @code{asm_operands}, and @code{asm_input}
6681debfc3dSmrg@item MEM_VOLATILE_P (@var{x})
6691debfc3dSmrgIn @code{mem}, @code{asm_operands}, and @code{asm_input} expressions,
6701debfc3dSmrgnonzero for volatile memory references.
6711debfc3dSmrgStored in the @code{volatil} field and printed as @samp{/v}.
6721debfc3dSmrg
6731debfc3dSmrg@findex MEM_NOTRAP_P
6741debfc3dSmrg@cindex @code{mem} and @samp{/c}
6751debfc3dSmrg@cindex @code{call}, in @code{mem}
6761debfc3dSmrg@item MEM_NOTRAP_P (@var{x})
6771debfc3dSmrgIn @code{mem}, nonzero for memory references that will not trap.
6781debfc3dSmrgStored in the @code{call} field and printed as @samp{/c}.
6791debfc3dSmrg
6801debfc3dSmrg@findex MEM_POINTER
6811debfc3dSmrg@cindex @code{mem} and @samp{/f}
6821debfc3dSmrg@cindex @code{frame_related}, in @code{mem}
6831debfc3dSmrg@item MEM_POINTER (@var{x})
6841debfc3dSmrgNonzero in a @code{mem} if the memory reference holds a pointer.
6851debfc3dSmrgStored in the @code{frame_related} field and printed as @samp{/f}.
6861debfc3dSmrg
687a2dc1f3fSmrg@findex MEM_READONLY_P
688a2dc1f3fSmrg@cindex @code{mem} and @samp{/u}
689a2dc1f3fSmrg@cindex @code{unchanging}, in @code{mem}
690a2dc1f3fSmrg@item MEM_READONLY_P (@var{x})
691a2dc1f3fSmrgNonzero in a @code{mem}, if the memory is statically allocated and read-only.
692a2dc1f3fSmrg
693a2dc1f3fSmrgRead-only in this context means never modified during the lifetime of the
694a2dc1f3fSmrgprogram, not necessarily in ROM or in write-disabled pages.  A common
695a2dc1f3fSmrgexample of the later is a shared library's global offset table.  This
696a2dc1f3fSmrgtable is initialized by the runtime loader, so the memory is technically
697a2dc1f3fSmrgwritable, but after control is transferred from the runtime loader to the
698a2dc1f3fSmrgapplication, this memory will never be subsequently modified.
699a2dc1f3fSmrg
700a2dc1f3fSmrgStored in the @code{unchanging} field and printed as @samp{/u}.
701a2dc1f3fSmrg
702a2dc1f3fSmrg@findex PREFETCH_SCHEDULE_BARRIER_P
703a2dc1f3fSmrg@cindex @code{prefetch} and @samp{/v}
704a2dc1f3fSmrg@cindex @code{volatile}, in @code{prefetch}
705a2dc1f3fSmrg@item PREFETCH_SCHEDULE_BARRIER_P (@var{x})
706a2dc1f3fSmrgIn a @code{prefetch}, indicates that the prefetch is a scheduling barrier.
707a2dc1f3fSmrgNo other INSNs will be moved over it.
708a2dc1f3fSmrgStored in the @code{volatil} field and printed as @samp{/v}.
709a2dc1f3fSmrg
7101debfc3dSmrg@findex REG_FUNCTION_VALUE_P
7111debfc3dSmrg@cindex @code{reg} and @samp{/i}
7121debfc3dSmrg@cindex @code{return_val}, in @code{reg}
7131debfc3dSmrg@item REG_FUNCTION_VALUE_P (@var{x})
7141debfc3dSmrgNonzero in a @code{reg} if it is the place in which this function's
7151debfc3dSmrgvalue is going to be returned.  (This happens only in a hard
7161debfc3dSmrgregister.)  Stored in the @code{return_val} field and printed as
7171debfc3dSmrg@samp{/i}.
7181debfc3dSmrg
7191debfc3dSmrg@findex REG_POINTER
7201debfc3dSmrg@cindex @code{reg} and @samp{/f}
7211debfc3dSmrg@cindex @code{frame_related}, in @code{reg}
7221debfc3dSmrg@item REG_POINTER (@var{x})
7231debfc3dSmrgNonzero in a @code{reg} if the register holds a pointer.  Stored in the
7241debfc3dSmrg@code{frame_related} field and printed as @samp{/f}.
7251debfc3dSmrg
7261debfc3dSmrg@findex REG_USERVAR_P
7271debfc3dSmrg@cindex @code{reg} and @samp{/v}
7281debfc3dSmrg@cindex @code{volatil}, in @code{reg}
7291debfc3dSmrg@item REG_USERVAR_P (@var{x})
7301debfc3dSmrgIn a @code{reg}, nonzero if it corresponds to a variable present in
7311debfc3dSmrgthe user's source code.  Zero for temporaries generated internally by
7321debfc3dSmrgthe compiler.  Stored in the @code{volatil} field and printed as
7331debfc3dSmrg@samp{/v}.
7341debfc3dSmrg
7351debfc3dSmrgThe same hard register may be used also for collecting the values of
7361debfc3dSmrgfunctions called by this one, but @code{REG_FUNCTION_VALUE_P} is zero
7371debfc3dSmrgin this kind of use.
7381debfc3dSmrg
739a2dc1f3fSmrg@findex RTL_CONST_CALL_P
740a2dc1f3fSmrg@cindex @code{call_insn} and @samp{/u}
741a2dc1f3fSmrg@cindex @code{unchanging}, in @code{call_insn}
742a2dc1f3fSmrg@item RTL_CONST_CALL_P (@var{x})
743a2dc1f3fSmrgIn a @code{call_insn} indicates that the insn represents a call to a
744a2dc1f3fSmrgconst function.  Stored in the @code{unchanging} field and printed as
745a2dc1f3fSmrg@samp{/u}.
746a2dc1f3fSmrg
747a2dc1f3fSmrg@findex RTL_PURE_CALL_P
748a2dc1f3fSmrg@cindex @code{call_insn} and @samp{/i}
749a2dc1f3fSmrg@cindex @code{return_val}, in @code{call_insn}
750a2dc1f3fSmrg@item RTL_PURE_CALL_P (@var{x})
751a2dc1f3fSmrgIn a @code{call_insn} indicates that the insn represents a call to a
752a2dc1f3fSmrgpure function.  Stored in the @code{return_val} field and printed as
753a2dc1f3fSmrg@samp{/i}.
754a2dc1f3fSmrg
755a2dc1f3fSmrg@findex RTL_CONST_OR_PURE_CALL_P
756a2dc1f3fSmrg@cindex @code{call_insn} and @samp{/u} or @samp{/i}
757a2dc1f3fSmrg@item RTL_CONST_OR_PURE_CALL_P (@var{x})
758a2dc1f3fSmrgIn a @code{call_insn}, true if @code{RTL_CONST_CALL_P} or
759a2dc1f3fSmrg@code{RTL_PURE_CALL_P} is true.
760a2dc1f3fSmrg
761a2dc1f3fSmrg@findex RTL_LOOPING_CONST_OR_PURE_CALL_P
762a2dc1f3fSmrg@cindex @code{call_insn} and @samp{/c}
763a2dc1f3fSmrg@cindex @code{call}, in @code{call_insn}
764a2dc1f3fSmrg@item RTL_LOOPING_CONST_OR_PURE_CALL_P (@var{x})
765a2dc1f3fSmrgIn a @code{call_insn} indicates that the insn represents a possibly
766a2dc1f3fSmrginfinite looping call to a const or pure function.  Stored in the
767a2dc1f3fSmrg@code{call} field and printed as @samp{/c}.  Only true if one of
768a2dc1f3fSmrg@code{RTL_CONST_CALL_P} or @code{RTL_PURE_CALL_P} is true.
769a2dc1f3fSmrg
7701debfc3dSmrg@findex RTX_FRAME_RELATED_P
7711debfc3dSmrg@cindex @code{insn} and @samp{/f}
7721debfc3dSmrg@cindex @code{call_insn} and @samp{/f}
7731debfc3dSmrg@cindex @code{jump_insn} and @samp{/f}
7741debfc3dSmrg@cindex @code{barrier} and @samp{/f}
7751debfc3dSmrg@cindex @code{set} and @samp{/f}
7761debfc3dSmrg@cindex @code{frame_related}, in @code{insn}, @code{call_insn}, @code{jump_insn}, @code{barrier}, and @code{set}
7771debfc3dSmrg@item RTX_FRAME_RELATED_P (@var{x})
7781debfc3dSmrgNonzero in an @code{insn}, @code{call_insn}, @code{jump_insn},
7791debfc3dSmrg@code{barrier}, or @code{set} which is part of a function prologue
7801debfc3dSmrgand sets the stack pointer, sets the frame pointer, or saves a register.
7811debfc3dSmrgThis flag should also be set on an instruction that sets up a temporary
7821debfc3dSmrgregister to use in place of the frame pointer.
7831debfc3dSmrgStored in the @code{frame_related} field and printed as @samp{/f}.
7841debfc3dSmrg
7851debfc3dSmrgIn particular, on RISC targets where there are limits on the sizes of
7861debfc3dSmrgimmediate constants, it is sometimes impossible to reach the register
7871debfc3dSmrgsave area directly from the stack pointer.  In that case, a temporary
7881debfc3dSmrgregister is used that is near enough to the register save area, and the
7891debfc3dSmrgCanonical Frame Address, i.e., DWARF2's logical frame pointer, register
7901debfc3dSmrgmust (temporarily) be changed to be this temporary register.  So, the
7911debfc3dSmrginstruction that sets this temporary register must be marked as
7921debfc3dSmrg@code{RTX_FRAME_RELATED_P}.
7931debfc3dSmrg
7941debfc3dSmrgIf the marked instruction is overly complex (defined in terms of what
7951debfc3dSmrg@code{dwarf2out_frame_debug_expr} can handle), you will also have to
7961debfc3dSmrgcreate a @code{REG_FRAME_RELATED_EXPR} note and attach it to the
7971debfc3dSmrginstruction.  This note should contain a simple expression of the
7981debfc3dSmrgcomputation performed by this instruction, i.e., one that
7991debfc3dSmrg@code{dwarf2out_frame_debug_expr} can handle.
8001debfc3dSmrg
8011debfc3dSmrgThis flag is required for exception handling support on targets with RTL
8021debfc3dSmrgprologues.
8031debfc3dSmrg
8041debfc3dSmrg@findex SCHED_GROUP_P
8051debfc3dSmrg@cindex @code{insn} and @samp{/s}
8061debfc3dSmrg@cindex @code{call_insn} and @samp{/s}
8071debfc3dSmrg@cindex @code{jump_insn} and @samp{/s}
8081debfc3dSmrg@cindex @code{jump_table_data} and @samp{/s}
8091debfc3dSmrg@cindex @code{in_struct}, in @code{insn}, @code{call_insn}, @code{jump_insn} and @code{jump_table_data}
8101debfc3dSmrg@item SCHED_GROUP_P (@var{x})
8111debfc3dSmrgDuring instruction scheduling, in an @code{insn}, @code{call_insn},
8121debfc3dSmrg@code{jump_insn} or @code{jump_table_data}, indicates that the
8131debfc3dSmrgprevious insn must be scheduled together with this insn.  This is used to
8141debfc3dSmrgensure that certain groups of instructions will not be split up by the
8151debfc3dSmrginstruction scheduling pass, for example, @code{use} insns before
8161debfc3dSmrga @code{call_insn} may not be separated from the @code{call_insn}.
8171debfc3dSmrgStored in the @code{in_struct} field and printed as @samp{/s}.
8181debfc3dSmrg
8191debfc3dSmrg@findex SET_IS_RETURN_P
8201debfc3dSmrg@cindex @code{insn} and @samp{/j}
8211debfc3dSmrg@cindex @code{jump}, in @code{insn}
8221debfc3dSmrg@item SET_IS_RETURN_P (@var{x})
8231debfc3dSmrgFor a @code{set}, nonzero if it is for a return.
8241debfc3dSmrgStored in the @code{jump} field and printed as @samp{/j}.
8251debfc3dSmrg
8261debfc3dSmrg@findex SIBLING_CALL_P
8271debfc3dSmrg@cindex @code{call_insn} and @samp{/j}
8281debfc3dSmrg@cindex @code{jump}, in @code{call_insn}
8291debfc3dSmrg@item SIBLING_CALL_P (@var{x})
8301debfc3dSmrgFor a @code{call_insn}, nonzero if the insn is a sibling call.
8311debfc3dSmrgStored in the @code{jump} field and printed as @samp{/j}.
8321debfc3dSmrg
8331debfc3dSmrg@findex STRING_POOL_ADDRESS_P
8341debfc3dSmrg@cindex @code{symbol_ref} and @samp{/f}
8351debfc3dSmrg@cindex @code{frame_related}, in @code{symbol_ref}
8361debfc3dSmrg@item STRING_POOL_ADDRESS_P (@var{x})
8371debfc3dSmrgFor a @code{symbol_ref} expression, nonzero if it addresses this function's
8381debfc3dSmrgstring constant pool.
8391debfc3dSmrgStored in the @code{frame_related} field and printed as @samp{/f}.
8401debfc3dSmrg
8411debfc3dSmrg@findex SUBREG_PROMOTED_UNSIGNED_P
8421debfc3dSmrg@cindex @code{subreg} and @samp{/u} and @samp{/v}
8431debfc3dSmrg@cindex @code{unchanging}, in @code{subreg}
8441debfc3dSmrg@cindex @code{volatil}, in @code{subreg}
8451debfc3dSmrg@item SUBREG_PROMOTED_UNSIGNED_P (@var{x})
8461debfc3dSmrgReturns a value greater then zero for a @code{subreg} that has
8471debfc3dSmrg@code{SUBREG_PROMOTED_VAR_P} nonzero if the object being referenced is kept
8481debfc3dSmrgzero-extended, zero if it is kept sign-extended, and less then zero if it is
8491debfc3dSmrgextended some other way via the @code{ptr_extend} instruction.
8501debfc3dSmrgStored in the @code{unchanging}
8511debfc3dSmrgfield and @code{volatil} field, printed as @samp{/u} and @samp{/v}.
8521debfc3dSmrgThis macro may only be used to get the value it may not be used to change
8531debfc3dSmrgthe value.  Use @code{SUBREG_PROMOTED_UNSIGNED_SET} to change the value.
8541debfc3dSmrg
8551debfc3dSmrg@findex SUBREG_PROMOTED_UNSIGNED_SET
8561debfc3dSmrg@cindex @code{subreg} and @samp{/u}
8571debfc3dSmrg@cindex @code{unchanging}, in @code{subreg}
8581debfc3dSmrg@cindex @code{volatil}, in @code{subreg}
8591debfc3dSmrg@item SUBREG_PROMOTED_UNSIGNED_SET (@var{x})
8601debfc3dSmrgSet the @code{unchanging} and @code{volatil} fields in a @code{subreg}
8611debfc3dSmrgto reflect zero, sign, or other extension.  If @code{volatil} is
8621debfc3dSmrgzero, then @code{unchanging} as nonzero means zero extension and as
8631debfc3dSmrgzero means sign extension.  If @code{volatil} is nonzero then some
8641debfc3dSmrgother type of extension was done via the @code{ptr_extend} instruction.
8651debfc3dSmrg
8661debfc3dSmrg@findex SUBREG_PROMOTED_VAR_P
8671debfc3dSmrg@cindex @code{subreg} and @samp{/s}
8681debfc3dSmrg@cindex @code{in_struct}, in @code{subreg}
8691debfc3dSmrg@item SUBREG_PROMOTED_VAR_P (@var{x})
8701debfc3dSmrgNonzero in a @code{subreg} if it was made when accessing an object that
8711debfc3dSmrgwas promoted to a wider mode in accord with the @code{PROMOTED_MODE} machine
8721debfc3dSmrgdescription macro (@pxref{Storage Layout}).  In this case, the mode of
8731debfc3dSmrgthe @code{subreg} is the declared mode of the object and the mode of
8741debfc3dSmrg@code{SUBREG_REG} is the mode of the register that holds the object.
8751debfc3dSmrgPromoted variables are always either sign- or zero-extended to the wider
8761debfc3dSmrgmode on every assignment.  Stored in the @code{in_struct} field and
8771debfc3dSmrgprinted as @samp{/s}.
8781debfc3dSmrg
8791debfc3dSmrg@findex SYMBOL_REF_USED
8801debfc3dSmrg@cindex @code{used}, in @code{symbol_ref}
8811debfc3dSmrg@item SYMBOL_REF_USED (@var{x})
8821debfc3dSmrgIn a @code{symbol_ref}, indicates that @var{x} has been used.  This is
8831debfc3dSmrgnormally only used to ensure that @var{x} is only declared external
8841debfc3dSmrgonce.  Stored in the @code{used} field.
8851debfc3dSmrg
8861debfc3dSmrg@findex SYMBOL_REF_WEAK
8871debfc3dSmrg@cindex @code{symbol_ref} and @samp{/i}
8881debfc3dSmrg@cindex @code{return_val}, in @code{symbol_ref}
8891debfc3dSmrg@item SYMBOL_REF_WEAK (@var{x})
8901debfc3dSmrgIn a @code{symbol_ref}, indicates that @var{x} has been declared weak.
8911debfc3dSmrgStored in the @code{return_val} field and printed as @samp{/i}.
8921debfc3dSmrg
8931debfc3dSmrg@findex SYMBOL_REF_FLAG
8941debfc3dSmrg@cindex @code{symbol_ref} and @samp{/v}
8951debfc3dSmrg@cindex @code{volatil}, in @code{symbol_ref}
8961debfc3dSmrg@item SYMBOL_REF_FLAG (@var{x})
8971debfc3dSmrgIn a @code{symbol_ref}, this is used as a flag for machine-specific purposes.
8981debfc3dSmrgStored in the @code{volatil} field and printed as @samp{/v}.
8991debfc3dSmrg
9001debfc3dSmrgMost uses of @code{SYMBOL_REF_FLAG} are historic and may be subsumed
9011debfc3dSmrgby @code{SYMBOL_REF_FLAGS}.  Certainly use of @code{SYMBOL_REF_FLAGS}
9021debfc3dSmrgis mandatory if the target requires more than one bit of storage.
9031debfc3dSmrg@end table
9041debfc3dSmrg
9051debfc3dSmrgThese are the fields to which the above macros refer:
9061debfc3dSmrg
9071debfc3dSmrg@table @code
9081debfc3dSmrg@findex call
9091debfc3dSmrg@cindex @samp{/c} in RTL dump
9101debfc3dSmrg@item call
9111debfc3dSmrgIn a @code{mem}, 1 means that the memory reference will not trap.
9121debfc3dSmrg
9131debfc3dSmrgIn a @code{call}, 1 means that this pure or const call may possibly
9141debfc3dSmrginfinite loop.
9151debfc3dSmrg
9161debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/c}.
9171debfc3dSmrg
9181debfc3dSmrg@findex frame_related
9191debfc3dSmrg@cindex @samp{/f} in RTL dump
9201debfc3dSmrg@item frame_related
9211debfc3dSmrgIn an @code{insn} or @code{set} expression, 1 means that it is part of
9221debfc3dSmrga function prologue and sets the stack pointer, sets the frame pointer,
9231debfc3dSmrgsaves a register, or sets up a temporary register to use in place of the
9241debfc3dSmrgframe pointer.
9251debfc3dSmrg
9261debfc3dSmrgIn @code{reg} expressions, 1 means that the register holds a pointer.
9271debfc3dSmrg
9281debfc3dSmrgIn @code{mem} expressions, 1 means that the memory reference holds a pointer.
9291debfc3dSmrg
9301debfc3dSmrgIn @code{symbol_ref} expressions, 1 means that the reference addresses
9311debfc3dSmrgthis function's string constant pool.
9321debfc3dSmrg
9331debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/f}.
9341debfc3dSmrg
9351debfc3dSmrg@findex in_struct
9361debfc3dSmrg@cindex @samp{/s} in RTL dump
9371debfc3dSmrg@item in_struct
9381debfc3dSmrgIn @code{reg} expressions, it is 1 if the register has its entire life
9391debfc3dSmrgcontained within the test expression of some loop.
9401debfc3dSmrg
9411debfc3dSmrgIn @code{subreg} expressions, 1 means that the @code{subreg} is accessing
9421debfc3dSmrgan object that has had its mode promoted from a wider mode.
9431debfc3dSmrg
9441debfc3dSmrgIn @code{label_ref} expressions, 1 means that the referenced label is
9451debfc3dSmrgoutside the innermost loop containing the insn in which the @code{label_ref}
9461debfc3dSmrgwas found.
9471debfc3dSmrg
9481debfc3dSmrgIn @code{code_label} expressions, it is 1 if the label may never be deleted.
9491debfc3dSmrgThis is used for labels which are the target of non-local gotos.  Such a
9501debfc3dSmrglabel that would have been deleted is replaced with a @code{note} of type
9511debfc3dSmrg@code{NOTE_INSN_DELETED_LABEL}.
9521debfc3dSmrg
9531debfc3dSmrgIn an @code{insn} during dead-code elimination, 1 means that the insn is
9541debfc3dSmrgdead code.
9551debfc3dSmrg
9561debfc3dSmrgIn an @code{insn} or @code{jump_insn} during reorg for an insn in the
9571debfc3dSmrgdelay slot of a branch,
9581debfc3dSmrg1 means that this insn is from the target of the branch.
9591debfc3dSmrg
9601debfc3dSmrgIn an @code{insn} during instruction scheduling, 1 means that this insn
9611debfc3dSmrgmust be scheduled as part of a group together with the previous insn.
9621debfc3dSmrg
9631debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/s}.
9641debfc3dSmrg
9651debfc3dSmrg@findex return_val
9661debfc3dSmrg@cindex @samp{/i} in RTL dump
9671debfc3dSmrg@item return_val
9681debfc3dSmrgIn @code{reg} expressions, 1 means the register contains
9691debfc3dSmrgthe value to be returned by the current function.  On
9701debfc3dSmrgmachines that pass parameters in registers, the same register number
9711debfc3dSmrgmay be used for parameters as well, but this flag is not set on such
9721debfc3dSmrguses.
9731debfc3dSmrg
9741debfc3dSmrgIn @code{symbol_ref} expressions, 1 means the referenced symbol is weak.
9751debfc3dSmrg
9761debfc3dSmrgIn @code{call} expressions, 1 means the call is pure.
9771debfc3dSmrg
9781debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/i}.
9791debfc3dSmrg
9801debfc3dSmrg@findex jump
9811debfc3dSmrg@cindex @samp{/j} in RTL dump
9821debfc3dSmrg@item jump
9831debfc3dSmrgIn a @code{mem} expression, 1 means we should keep the alias set for this
9841debfc3dSmrgmem unchanged when we access a component.
9851debfc3dSmrg
9861debfc3dSmrgIn a @code{set}, 1 means it is for a return.
9871debfc3dSmrg
9881debfc3dSmrgIn a @code{call_insn}, 1 means it is a sibling call.
9891debfc3dSmrg
990a2dc1f3fSmrgIn a @code{jump_insn}, 1 means it is a crossing jump.
991a2dc1f3fSmrg
9921debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/j}.
9931debfc3dSmrg
9941debfc3dSmrg@findex unchanging
9951debfc3dSmrg@cindex @samp{/u} in RTL dump
9961debfc3dSmrg@item unchanging
9971debfc3dSmrgIn @code{reg} and @code{mem} expressions, 1 means
9981debfc3dSmrgthat the value of the expression never changes.
9991debfc3dSmrg
10001debfc3dSmrgIn @code{subreg} expressions, it is 1 if the @code{subreg} references an
10011debfc3dSmrgunsigned object whose mode has been promoted to a wider mode.
10021debfc3dSmrg
10031debfc3dSmrgIn an @code{insn} or @code{jump_insn} in the delay slot of a branch
10041debfc3dSmrginstruction, 1 means an annulling branch should be used.
10051debfc3dSmrg
10061debfc3dSmrgIn a @code{symbol_ref} expression, 1 means that this symbol addresses
10071debfc3dSmrgsomething in the per-function constant pool.
10081debfc3dSmrg
10091debfc3dSmrgIn a @code{call_insn} 1 means that this instruction is a call to a const
10101debfc3dSmrgfunction.
10111debfc3dSmrg
10121debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/u}.
10131debfc3dSmrg
10141debfc3dSmrg@findex used
10151debfc3dSmrg@item used
10161debfc3dSmrgThis flag is used directly (without an access macro) at the end of RTL
10171debfc3dSmrggeneration for a function, to count the number of times an expression
10181debfc3dSmrgappears in insns.  Expressions that appear more than once are copied,
10191debfc3dSmrgaccording to the rules for shared structure (@pxref{Sharing}).
10201debfc3dSmrg
10211debfc3dSmrgFor a @code{reg}, it is used directly (without an access macro) by the
10221debfc3dSmrgleaf register renumbering code to ensure that each register is only
10231debfc3dSmrgrenumbered once.
10241debfc3dSmrg
10251debfc3dSmrgIn a @code{symbol_ref}, it indicates that an external declaration for
10261debfc3dSmrgthe symbol has already been written.
10271debfc3dSmrg
10281debfc3dSmrg@findex volatil
10291debfc3dSmrg@cindex @samp{/v} in RTL dump
10301debfc3dSmrg@item volatil
10311debfc3dSmrg@cindex volatile memory references
10321debfc3dSmrgIn a @code{mem}, @code{asm_operands}, or @code{asm_input}
10331debfc3dSmrgexpression, it is 1 if the memory
10341debfc3dSmrgreference is volatile.  Volatile memory references may not be deleted,
10351debfc3dSmrgreordered or combined.
10361debfc3dSmrg
10371debfc3dSmrgIn a @code{symbol_ref} expression, it is used for machine-specific
10381debfc3dSmrgpurposes.
10391debfc3dSmrg
10401debfc3dSmrgIn a @code{reg} expression, it is 1 if the value is a user-level variable.
10411debfc3dSmrg0 indicates an internal compiler temporary.
10421debfc3dSmrg
10431debfc3dSmrgIn an @code{insn}, 1 means the insn has been deleted.
10441debfc3dSmrg
10451debfc3dSmrgIn @code{label_ref} and @code{reg_label} expressions, 1 means a reference
10461debfc3dSmrgto a non-local label.
10471debfc3dSmrg
10481debfc3dSmrgIn @code{prefetch} expressions, 1 means that the containing insn is a
10491debfc3dSmrgscheduling barrier.
10501debfc3dSmrg
10511debfc3dSmrgIn an RTL dump, this flag is represented as @samp{/v}.
10521debfc3dSmrg@end table
10531debfc3dSmrg
10541debfc3dSmrg@node Machine Modes
10551debfc3dSmrg@section Machine Modes
10561debfc3dSmrg@cindex machine modes
10571debfc3dSmrg
10581debfc3dSmrg@findex machine_mode
10591debfc3dSmrgA machine mode describes a size of data object and the representation used
10601debfc3dSmrgfor it.  In the C code, machine modes are represented by an enumeration
10611debfc3dSmrgtype, @code{machine_mode}, defined in @file{machmode.def}.  Each RTL
10621debfc3dSmrgexpression has room for a machine mode and so do certain kinds of tree
10631debfc3dSmrgexpressions (declarations and types, to be precise).
10641debfc3dSmrg
10651debfc3dSmrgIn debugging dumps and machine descriptions, the machine mode of an RTL
10661debfc3dSmrgexpression is written after the expression code with a colon to separate
10671debfc3dSmrgthem.  The letters @samp{mode} which appear at the end of each machine mode
10681debfc3dSmrgname are omitted.  For example, @code{(reg:SI 38)} is a @code{reg}
10691debfc3dSmrgexpression with machine mode @code{SImode}.  If the mode is
10701debfc3dSmrg@code{VOIDmode}, it is not written at all.
10711debfc3dSmrg
10721debfc3dSmrgHere is a table of machine modes.  The term ``byte'' below refers to an
10731debfc3dSmrgobject of @code{BITS_PER_UNIT} bits (@pxref{Storage Layout}).
10741debfc3dSmrg
10751debfc3dSmrg@table @code
10761debfc3dSmrg@findex BImode
10771debfc3dSmrg@item BImode
10781debfc3dSmrg``Bit'' mode represents a single bit, for predicate registers.
10791debfc3dSmrg
10801debfc3dSmrg@findex QImode
10811debfc3dSmrg@item QImode
10821debfc3dSmrg``Quarter-Integer'' mode represents a single byte treated as an integer.
10831debfc3dSmrg
10841debfc3dSmrg@findex HImode
10851debfc3dSmrg@item HImode
10861debfc3dSmrg``Half-Integer'' mode represents a two-byte integer.
10871debfc3dSmrg
10881debfc3dSmrg@findex PSImode
10891debfc3dSmrg@item PSImode
10901debfc3dSmrg``Partial Single Integer'' mode represents an integer which occupies
10911debfc3dSmrgfour bytes but which doesn't really use all four.  On some machines,
10921debfc3dSmrgthis is the right mode to use for pointers.
10931debfc3dSmrg
10941debfc3dSmrg@findex SImode
10951debfc3dSmrg@item SImode
10961debfc3dSmrg``Single Integer'' mode represents a four-byte integer.
10971debfc3dSmrg
10981debfc3dSmrg@findex PDImode
10991debfc3dSmrg@item PDImode
11001debfc3dSmrg``Partial Double Integer'' mode represents an integer which occupies
11011debfc3dSmrgeight bytes but which doesn't really use all eight.  On some machines,
11021debfc3dSmrgthis is the right mode to use for certain pointers.
11031debfc3dSmrg
11041debfc3dSmrg@findex DImode
11051debfc3dSmrg@item DImode
11061debfc3dSmrg``Double Integer'' mode represents an eight-byte integer.
11071debfc3dSmrg
11081debfc3dSmrg@findex TImode
11091debfc3dSmrg@item TImode
11101debfc3dSmrg``Tetra Integer'' (?) mode represents a sixteen-byte integer.
11111debfc3dSmrg
11121debfc3dSmrg@findex OImode
11131debfc3dSmrg@item OImode
11141debfc3dSmrg``Octa Integer'' (?) mode represents a thirty-two-byte integer.
11151debfc3dSmrg
11161debfc3dSmrg@findex XImode
11171debfc3dSmrg@item XImode
11181debfc3dSmrg``Hexadeca Integer'' (?) mode represents a sixty-four-byte integer.
11191debfc3dSmrg
11201debfc3dSmrg@findex QFmode
11211debfc3dSmrg@item QFmode
11221debfc3dSmrg``Quarter-Floating'' mode represents a quarter-precision (single byte)
11231debfc3dSmrgfloating point number.
11241debfc3dSmrg
11251debfc3dSmrg@findex HFmode
11261debfc3dSmrg@item HFmode
11271debfc3dSmrg``Half-Floating'' mode represents a half-precision (two byte) floating
11281debfc3dSmrgpoint number.
11291debfc3dSmrg
11301debfc3dSmrg@findex TQFmode
11311debfc3dSmrg@item TQFmode
11321debfc3dSmrg``Three-Quarter-Floating'' (?) mode represents a three-quarter-precision
11331debfc3dSmrg(three byte) floating point number.
11341debfc3dSmrg
11351debfc3dSmrg@findex SFmode
11361debfc3dSmrg@item SFmode
11371debfc3dSmrg``Single Floating'' mode represents a four byte floating point number.
11381debfc3dSmrgIn the common case, of a processor with IEEE arithmetic and 8-bit bytes,
11391debfc3dSmrgthis is a single-precision IEEE floating point number; it can also be
11401debfc3dSmrgused for double-precision (on processors with 16-bit bytes) and
11411debfc3dSmrgsingle-precision VAX and IBM types.
11421debfc3dSmrg
11431debfc3dSmrg@findex DFmode
11441debfc3dSmrg@item DFmode
11451debfc3dSmrg``Double Floating'' mode represents an eight byte floating point number.
11461debfc3dSmrgIn the common case, of a processor with IEEE arithmetic and 8-bit bytes,
11471debfc3dSmrgthis is a double-precision IEEE floating point number.
11481debfc3dSmrg
11491debfc3dSmrg@findex XFmode
11501debfc3dSmrg@item XFmode
11511debfc3dSmrg``Extended Floating'' mode represents an IEEE extended floating point
11521debfc3dSmrgnumber.  This mode only has 80 meaningful bits (ten bytes).  Some
11531debfc3dSmrgprocessors require such numbers to be padded to twelve bytes, others
11541debfc3dSmrgto sixteen; this mode is used for either.
11551debfc3dSmrg
11561debfc3dSmrg@findex SDmode
11571debfc3dSmrg@item SDmode
11581debfc3dSmrg``Single Decimal Floating'' mode represents a four byte decimal
11591debfc3dSmrgfloating point number (as distinct from conventional binary floating
11601debfc3dSmrgpoint).
11611debfc3dSmrg
11621debfc3dSmrg@findex DDmode
11631debfc3dSmrg@item DDmode
11641debfc3dSmrg``Double Decimal Floating'' mode represents an eight byte decimal
11651debfc3dSmrgfloating point number.
11661debfc3dSmrg
11671debfc3dSmrg@findex TDmode
11681debfc3dSmrg@item TDmode
11691debfc3dSmrg``Tetra Decimal Floating'' mode represents a sixteen byte decimal
11701debfc3dSmrgfloating point number all 128 of whose bits are meaningful.
11711debfc3dSmrg
11721debfc3dSmrg@findex TFmode
11731debfc3dSmrg@item TFmode
11741debfc3dSmrg``Tetra Floating'' mode represents a sixteen byte floating point number
11751debfc3dSmrgall 128 of whose bits are meaningful.  One common use is the
11761debfc3dSmrgIEEE quad-precision format.
11771debfc3dSmrg
11781debfc3dSmrg@findex QQmode
11791debfc3dSmrg@item QQmode
11801debfc3dSmrg``Quarter-Fractional'' mode represents a single byte treated as a signed
11811debfc3dSmrgfractional number.  The default format is ``s.7''.
11821debfc3dSmrg
11831debfc3dSmrg@findex HQmode
11841debfc3dSmrg@item HQmode
11851debfc3dSmrg``Half-Fractional'' mode represents a two-byte signed fractional number.
11861debfc3dSmrgThe default format is ``s.15''.
11871debfc3dSmrg
11881debfc3dSmrg@findex SQmode
11891debfc3dSmrg@item SQmode
11901debfc3dSmrg``Single Fractional'' mode represents a four-byte signed fractional number.
11911debfc3dSmrgThe default format is ``s.31''.
11921debfc3dSmrg
11931debfc3dSmrg@findex DQmode
11941debfc3dSmrg@item DQmode
11951debfc3dSmrg``Double Fractional'' mode represents an eight-byte signed fractional number.
11961debfc3dSmrgThe default format is ``s.63''.
11971debfc3dSmrg
11981debfc3dSmrg@findex TQmode
11991debfc3dSmrg@item TQmode
12001debfc3dSmrg``Tetra Fractional'' mode represents a sixteen-byte signed fractional number.
12011debfc3dSmrgThe default format is ``s.127''.
12021debfc3dSmrg
12031debfc3dSmrg@findex UQQmode
12041debfc3dSmrg@item UQQmode
12051debfc3dSmrg``Unsigned Quarter-Fractional'' mode represents a single byte treated as an
12061debfc3dSmrgunsigned fractional number.  The default format is ``.8''.
12071debfc3dSmrg
12081debfc3dSmrg@findex UHQmode
12091debfc3dSmrg@item UHQmode
12101debfc3dSmrg``Unsigned Half-Fractional'' mode represents a two-byte unsigned fractional
12111debfc3dSmrgnumber.  The default format is ``.16''.
12121debfc3dSmrg
12131debfc3dSmrg@findex USQmode
12141debfc3dSmrg@item USQmode
12151debfc3dSmrg``Unsigned Single Fractional'' mode represents a four-byte unsigned fractional
12161debfc3dSmrgnumber.  The default format is ``.32''.
12171debfc3dSmrg
12181debfc3dSmrg@findex UDQmode
12191debfc3dSmrg@item UDQmode
12201debfc3dSmrg``Unsigned Double Fractional'' mode represents an eight-byte unsigned
12211debfc3dSmrgfractional number.  The default format is ``.64''.
12221debfc3dSmrg
12231debfc3dSmrg@findex UTQmode
12241debfc3dSmrg@item UTQmode
12251debfc3dSmrg``Unsigned Tetra Fractional'' mode represents a sixteen-byte unsigned
12261debfc3dSmrgfractional number.  The default format is ``.128''.
12271debfc3dSmrg
12281debfc3dSmrg@findex HAmode
12291debfc3dSmrg@item HAmode
12301debfc3dSmrg``Half-Accumulator'' mode represents a two-byte signed accumulator.
12311debfc3dSmrgThe default format is ``s8.7''.
12321debfc3dSmrg
12331debfc3dSmrg@findex SAmode
12341debfc3dSmrg@item SAmode
12351debfc3dSmrg``Single Accumulator'' mode represents a four-byte signed accumulator.
12361debfc3dSmrgThe default format is ``s16.15''.
12371debfc3dSmrg
12381debfc3dSmrg@findex DAmode
12391debfc3dSmrg@item DAmode
12401debfc3dSmrg``Double Accumulator'' mode represents an eight-byte signed accumulator.
12411debfc3dSmrgThe default format is ``s32.31''.
12421debfc3dSmrg
12431debfc3dSmrg@findex TAmode
12441debfc3dSmrg@item TAmode
12451debfc3dSmrg``Tetra Accumulator'' mode represents a sixteen-byte signed accumulator.
12461debfc3dSmrgThe default format is ``s64.63''.
12471debfc3dSmrg
12481debfc3dSmrg@findex UHAmode
12491debfc3dSmrg@item UHAmode
12501debfc3dSmrg``Unsigned Half-Accumulator'' mode represents a two-byte unsigned accumulator.
12511debfc3dSmrgThe default format is ``8.8''.
12521debfc3dSmrg
12531debfc3dSmrg@findex USAmode
12541debfc3dSmrg@item USAmode
12551debfc3dSmrg``Unsigned Single Accumulator'' mode represents a four-byte unsigned
12561debfc3dSmrgaccumulator.  The default format is ``16.16''.
12571debfc3dSmrg
12581debfc3dSmrg@findex UDAmode
12591debfc3dSmrg@item UDAmode
12601debfc3dSmrg``Unsigned Double Accumulator'' mode represents an eight-byte unsigned
12611debfc3dSmrgaccumulator.  The default format is ``32.32''.
12621debfc3dSmrg
12631debfc3dSmrg@findex UTAmode
12641debfc3dSmrg@item UTAmode
12651debfc3dSmrg``Unsigned Tetra Accumulator'' mode represents a sixteen-byte unsigned
12661debfc3dSmrgaccumulator.  The default format is ``64.64''.
12671debfc3dSmrg
12681debfc3dSmrg@findex CCmode
12691debfc3dSmrg@item CCmode
12701debfc3dSmrg``Condition Code'' mode represents the value of a condition code, which
12711debfc3dSmrgis a machine-specific set of bits used to represent the result of a
12721debfc3dSmrgcomparison operation.  Other machine-specific modes may also be used for
12731debfc3dSmrgthe condition code.  These modes are not used on machines that use
12741debfc3dSmrg@code{cc0} (@pxref{Condition Code}).
12751debfc3dSmrg
12761debfc3dSmrg@findex BLKmode
12771debfc3dSmrg@item BLKmode
12781debfc3dSmrg``Block'' mode represents values that are aggregates to which none of
12791debfc3dSmrgthe other modes apply.  In RTL, only memory references can have this mode,
12801debfc3dSmrgand only if they appear in string-move or vector instructions.  On machines
12811debfc3dSmrgwhich have no such instructions, @code{BLKmode} will not appear in RTL@.
12821debfc3dSmrg
12831debfc3dSmrg@findex VOIDmode
12841debfc3dSmrg@item VOIDmode
12851debfc3dSmrgVoid mode means the absence of a mode or an unspecified mode.
12861debfc3dSmrgFor example, RTL expressions of code @code{const_int} have mode
12871debfc3dSmrg@code{VOIDmode} because they can be taken to have whatever mode the context
12881debfc3dSmrgrequires.  In debugging dumps of RTL, @code{VOIDmode} is expressed by
12891debfc3dSmrgthe absence of any mode.
12901debfc3dSmrg
12911debfc3dSmrg@findex QCmode
12921debfc3dSmrg@findex HCmode
12931debfc3dSmrg@findex SCmode
12941debfc3dSmrg@findex DCmode
12951debfc3dSmrg@findex XCmode
12961debfc3dSmrg@findex TCmode
12971debfc3dSmrg@item QCmode, HCmode, SCmode, DCmode, XCmode, TCmode
12981debfc3dSmrgThese modes stand for a complex number represented as a pair of floating
12991debfc3dSmrgpoint values.  The floating point values are in @code{QFmode},
13001debfc3dSmrg@code{HFmode}, @code{SFmode}, @code{DFmode}, @code{XFmode}, and
13011debfc3dSmrg@code{TFmode}, respectively.
13021debfc3dSmrg
13031debfc3dSmrg@findex CQImode
13041debfc3dSmrg@findex CHImode
13051debfc3dSmrg@findex CSImode
13061debfc3dSmrg@findex CDImode
13071debfc3dSmrg@findex CTImode
13081debfc3dSmrg@findex COImode
13091debfc3dSmrg@findex CPSImode
13101debfc3dSmrg@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode, CPSImode
13111debfc3dSmrgThese modes stand for a complex number represented as a pair of integer
13121debfc3dSmrgvalues.  The integer values are in @code{QImode}, @code{HImode},
13131debfc3dSmrg@code{SImode}, @code{DImode}, @code{TImode}, @code{OImode}, and @code{PSImode},
13141debfc3dSmrgrespectively.
13151debfc3dSmrg
13161debfc3dSmrg@findex BND32mode
13171debfc3dSmrg@findex BND64mode
13181debfc3dSmrg@item BND32mode BND64mode
13191debfc3dSmrgThese modes stand for bounds for pointer of 32 and 64 bit size respectively.
13201debfc3dSmrgMode size is double pointer mode size.
13211debfc3dSmrg@end table
13221debfc3dSmrg
13231debfc3dSmrgThe machine description defines @code{Pmode} as a C macro which expands
13241debfc3dSmrginto the machine mode used for addresses.  Normally this is the mode
13251debfc3dSmrgwhose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines.
13261debfc3dSmrg
13271debfc3dSmrgThe only modes which a machine description @i{must} support are
13281debfc3dSmrg@code{QImode}, and the modes corresponding to @code{BITS_PER_WORD},
13291debfc3dSmrg@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}.
13301debfc3dSmrgThe compiler will attempt to use @code{DImode} for 8-byte structures and
13311debfc3dSmrgunions, but this can be prevented by overriding the definition of
13321debfc3dSmrg@code{MAX_FIXED_MODE_SIZE}.  Alternatively, you can have the compiler
13331debfc3dSmrguse @code{TImode} for 16-byte structures and unions.  Likewise, you can
13341debfc3dSmrgarrange for the C type @code{short int} to avoid using @code{HImode}.
13351debfc3dSmrg
13361debfc3dSmrg@cindex mode classes
13371debfc3dSmrgVery few explicit references to machine modes remain in the compiler and
13381debfc3dSmrgthese few references will soon be removed.  Instead, the machine modes
13391debfc3dSmrgare divided into mode classes.  These are represented by the enumeration
13401debfc3dSmrgtype @code{enum mode_class} defined in @file{machmode.h}.  The possible
13411debfc3dSmrgmode classes are:
13421debfc3dSmrg
13431debfc3dSmrg@table @code
13441debfc3dSmrg@findex MODE_INT
13451debfc3dSmrg@item MODE_INT
13461debfc3dSmrgInteger modes.  By default these are @code{BImode}, @code{QImode},
13471debfc3dSmrg@code{HImode}, @code{SImode}, @code{DImode}, @code{TImode}, and
13481debfc3dSmrg@code{OImode}.
13491debfc3dSmrg
13501debfc3dSmrg@findex MODE_PARTIAL_INT
13511debfc3dSmrg@item MODE_PARTIAL_INT
13521debfc3dSmrgThe ``partial integer'' modes, @code{PQImode}, @code{PHImode},
13531debfc3dSmrg@code{PSImode} and @code{PDImode}.
13541debfc3dSmrg
13551debfc3dSmrg@findex MODE_FLOAT
13561debfc3dSmrg@item MODE_FLOAT
13571debfc3dSmrgFloating point modes.  By default these are @code{QFmode},
13581debfc3dSmrg@code{HFmode}, @code{TQFmode}, @code{SFmode}, @code{DFmode},
13591debfc3dSmrg@code{XFmode} and @code{TFmode}.
13601debfc3dSmrg
13611debfc3dSmrg@findex MODE_DECIMAL_FLOAT
13621debfc3dSmrg@item MODE_DECIMAL_FLOAT
13631debfc3dSmrgDecimal floating point modes.  By default these are @code{SDmode},
13641debfc3dSmrg@code{DDmode} and @code{TDmode}.
13651debfc3dSmrg
13661debfc3dSmrg@findex MODE_FRACT
13671debfc3dSmrg@item MODE_FRACT
13681debfc3dSmrgSigned fractional modes.  By default these are @code{QQmode}, @code{HQmode},
13691debfc3dSmrg@code{SQmode}, @code{DQmode} and @code{TQmode}.
13701debfc3dSmrg
13711debfc3dSmrg@findex MODE_UFRACT
13721debfc3dSmrg@item MODE_UFRACT
13731debfc3dSmrgUnsigned fractional modes.  By default these are @code{UQQmode}, @code{UHQmode},
13741debfc3dSmrg@code{USQmode}, @code{UDQmode} and @code{UTQmode}.
13751debfc3dSmrg
13761debfc3dSmrg@findex MODE_ACCUM
13771debfc3dSmrg@item MODE_ACCUM
13781debfc3dSmrgSigned accumulator modes.  By default these are @code{HAmode},
13791debfc3dSmrg@code{SAmode}, @code{DAmode} and @code{TAmode}.
13801debfc3dSmrg
13811debfc3dSmrg@findex MODE_UACCUM
13821debfc3dSmrg@item MODE_UACCUM
13831debfc3dSmrgUnsigned accumulator modes.  By default these are @code{UHAmode},
13841debfc3dSmrg@code{USAmode}, @code{UDAmode} and @code{UTAmode}.
13851debfc3dSmrg
13861debfc3dSmrg@findex MODE_COMPLEX_INT
13871debfc3dSmrg@item MODE_COMPLEX_INT
13881debfc3dSmrgComplex integer modes.  (These are not currently implemented).
13891debfc3dSmrg
13901debfc3dSmrg@findex MODE_COMPLEX_FLOAT
13911debfc3dSmrg@item MODE_COMPLEX_FLOAT
13921debfc3dSmrgComplex floating point modes.  By default these are @code{QCmode},
13931debfc3dSmrg@code{HCmode}, @code{SCmode}, @code{DCmode}, @code{XCmode}, and
13941debfc3dSmrg@code{TCmode}.
13951debfc3dSmrg
13961debfc3dSmrg@findex MODE_CC
13971debfc3dSmrg@item MODE_CC
13981debfc3dSmrgModes representing condition code values.  These are @code{CCmode} plus
13991debfc3dSmrgany @code{CC_MODE} modes listed in the @file{@var{machine}-modes.def}.
14001debfc3dSmrg@xref{Jump Patterns},
14011debfc3dSmrgalso see @ref{Condition Code}.
14021debfc3dSmrg
14031debfc3dSmrg@findex MODE_POINTER_BOUNDS
14041debfc3dSmrg@item MODE_POINTER_BOUNDS
14051debfc3dSmrgPointer bounds modes.  Used to represent values of pointer bounds type.
14061debfc3dSmrgOperations in these modes may be executed as NOPs depending on hardware
14071debfc3dSmrgfeatures and environment setup.
14081debfc3dSmrg
14091debfc3dSmrg@findex MODE_RANDOM
14101debfc3dSmrg@item MODE_RANDOM
14111debfc3dSmrgThis is a catchall mode class for modes which don't fit into the above
14121debfc3dSmrgclasses.  Currently @code{VOIDmode} and @code{BLKmode} are in
14131debfc3dSmrg@code{MODE_RANDOM}.
14141debfc3dSmrg@end table
14151debfc3dSmrg
1416a2dc1f3fSmrg@cindex machine mode wrapper classes
1417a2dc1f3fSmrg@code{machmode.h} also defines various wrapper classes that combine a
1418a2dc1f3fSmrg@code{machine_mode} with a static assertion that a particular
1419a2dc1f3fSmrgcondition holds.  The classes are:
1420a2dc1f3fSmrg
1421a2dc1f3fSmrg@table @code
1422a2dc1f3fSmrg@findex scalar_int_mode
1423a2dc1f3fSmrg@item scalar_int_mode
1424a2dc1f3fSmrgA mode that has class @code{MODE_INT} or @code{MODE_PARTIAL_INT}.
1425a2dc1f3fSmrg
1426a2dc1f3fSmrg@findex scalar_float_mode
1427a2dc1f3fSmrg@item scalar_float_mode
1428a2dc1f3fSmrgA mode that has class @code{MODE_FLOAT} or @code{MODE_DECIMAL_FLOAT}.
1429a2dc1f3fSmrg
1430a2dc1f3fSmrg@findex scalar_mode
1431a2dc1f3fSmrg@item scalar_mode
1432a2dc1f3fSmrgA mode that holds a single numerical value.  In practice this means
1433a2dc1f3fSmrgthat the mode is a @code{scalar_int_mode}, is a @code{scalar_float_mode},
1434a2dc1f3fSmrgor has class @code{MODE_FRACT}, @code{MODE_UFRACT}, @code{MODE_ACCUM},
1435a2dc1f3fSmrg@code{MODE_UACCUM} or @code{MODE_POINTER_BOUNDS}.
1436a2dc1f3fSmrg
1437a2dc1f3fSmrg@findex complex_mode
1438a2dc1f3fSmrg@item complex_mode
1439a2dc1f3fSmrgA mode that has class @code{MODE_COMPLEX_INT} or @code{MODE_COMPLEX_FLOAT}.
1440a2dc1f3fSmrg
1441a2dc1f3fSmrg@findex fixed_size_mode
1442a2dc1f3fSmrg@item fixed_size_mode
1443a2dc1f3fSmrgA mode whose size is known at compile time.
1444a2dc1f3fSmrg@end table
1445a2dc1f3fSmrg
1446a2dc1f3fSmrgNamed modes use the most constrained of the available wrapper classes,
1447a2dc1f3fSmrgif one exists, otherwise they use @code{machine_mode}.  For example,
1448a2dc1f3fSmrg@code{QImode} is a @code{scalar_int_mode}, @code{SFmode} is a
1449a2dc1f3fSmrg@code{scalar_float_mode} and @code{BLKmode} is a plain
1450a2dc1f3fSmrg@code{machine_mode}.  It is possible to refer to any mode as a raw
1451a2dc1f3fSmrg@code{machine_mode} by adding the @code{E_} prefix, where @code{E}
1452a2dc1f3fSmrgstands for ``enumeration''.  For example, the raw @code{machine_mode}
1453a2dc1f3fSmrgnames of the modes just mentioned are @code{E_QImode}, @code{E_SFmode}
1454a2dc1f3fSmrgand @code{E_BLKmode} respectively.
1455a2dc1f3fSmrg
1456a2dc1f3fSmrgThe wrapper classes implicitly convert to @code{machine_mode} and to any
1457a2dc1f3fSmrgwrapper class that represents a more general condition; for example
1458a2dc1f3fSmrg@code{scalar_int_mode} and @code{scalar_float_mode} both convert
1459a2dc1f3fSmrgto @code{scalar_mode} and all three convert to @code{fixed_size_mode}.
1460a2dc1f3fSmrgThe classes act like @code{machine_mode}s that accept only certain
1461a2dc1f3fSmrgnamed modes.
1462a2dc1f3fSmrg
1463a2dc1f3fSmrg@findex opt_mode
1464a2dc1f3fSmrg@file{machmode.h} also defines a template class @code{opt_mode<@var{T}>}
1465a2dc1f3fSmrgthat holds a @code{T} or nothing, where @code{T} can be either
1466a2dc1f3fSmrg@code{machine_mode} or one of the wrapper classes above.  The main
1467a2dc1f3fSmrgoperations on an @code{opt_mode<@var{T}>} @var{x} are as follows:
1468a2dc1f3fSmrg
1469a2dc1f3fSmrg@table @samp
1470a2dc1f3fSmrg@item @var{x}.exists ()
1471a2dc1f3fSmrgReturn true if @var{x} holds a mode rather than nothing.
1472a2dc1f3fSmrg
1473a2dc1f3fSmrg@item @var{x}.exists (&@var{y})
1474a2dc1f3fSmrgReturn true if @var{x} holds a mode rather than nothing, storing the
1475a2dc1f3fSmrgmode in @var{y} if so.  @var{y} must be assignment-compatible with @var{T}.
1476a2dc1f3fSmrg
1477a2dc1f3fSmrg@item @var{x}.require ()
1478a2dc1f3fSmrgAssert that @var{x} holds a mode rather than nothing and return that mode.
1479a2dc1f3fSmrg
1480a2dc1f3fSmrg@item @var{x} = @var{y}
1481a2dc1f3fSmrgSet @var{x} to @var{y}, where @var{y} is a @var{T} or implicitly converts
1482a2dc1f3fSmrgto a @var{T}.
1483a2dc1f3fSmrg@end table
1484a2dc1f3fSmrg
1485a2dc1f3fSmrgThe default constructor sets an @code{opt_mode<@var{T}>} to nothing.
1486a2dc1f3fSmrgThere is also a constructor that takes an initial value of type @var{T}.
1487a2dc1f3fSmrg
1488a2dc1f3fSmrgIt is possible to use the @file{is-a.h} accessors on a @code{machine_mode}
1489a2dc1f3fSmrgor machine mode wrapper @var{x}:
1490a2dc1f3fSmrg
1491a2dc1f3fSmrg@table @samp
1492a2dc1f3fSmrg@findex is_a
1493a2dc1f3fSmrg@item is_a <@var{T}> (@var{x})
1494a2dc1f3fSmrgReturn true if @var{x} meets the conditions for wrapper class @var{T}.
1495a2dc1f3fSmrg
1496a2dc1f3fSmrg@item is_a <@var{T}> (@var{x}, &@var{y})
1497a2dc1f3fSmrgReturn true if @var{x} meets the conditions for wrapper class @var{T},
1498a2dc1f3fSmrgstoring it in @var{y} if so.  @var{y} must be assignment-compatible with
1499a2dc1f3fSmrg@var{T}.
1500a2dc1f3fSmrg
1501a2dc1f3fSmrg@item as_a <@var{T}> (@var{x})
1502a2dc1f3fSmrgAssert that @var{x} meets the conditions for wrapper class @var{T}
1503a2dc1f3fSmrgand return it as a @var{T}.
1504a2dc1f3fSmrg
1505a2dc1f3fSmrg@item dyn_cast <@var{T}> (@var{x})
1506a2dc1f3fSmrgReturn an @code{opt_mode<@var{T}>} that holds @var{x} if @var{x} meets
1507a2dc1f3fSmrgthe conditions for wrapper class @var{T} and that holds nothing otherwise.
1508a2dc1f3fSmrg@end table
1509a2dc1f3fSmrg
1510a2dc1f3fSmrgThe purpose of these wrapper classes is to give stronger static type
1511a2dc1f3fSmrgchecking.  For example, if a function takes a @code{scalar_int_mode},
1512a2dc1f3fSmrga caller that has a general @code{machine_mode} must either check or
1513a2dc1f3fSmrgassert that the code is indeed a scalar integer first, using one of
1514a2dc1f3fSmrgthe functions above.
1515a2dc1f3fSmrg
1516a2dc1f3fSmrgThe wrapper classes are normal C++ classes, with user-defined
1517a2dc1f3fSmrgconstructors.  Sometimes it is useful to have a POD version of
1518a2dc1f3fSmrgthe same type, particularly if the type appears in a @code{union}.
1519a2dc1f3fSmrgThe template class @code{pod_mode<@var{T}>} provides a POD version
1520a2dc1f3fSmrgof wrapper class @var{T}.  It is assignment-compatible with @var{T}
1521a2dc1f3fSmrgand implicitly converts to both @code{machine_mode} and @var{T}.
1522a2dc1f3fSmrg
15231debfc3dSmrgHere are some C macros that relate to machine modes:
15241debfc3dSmrg
15251debfc3dSmrg@table @code
15261debfc3dSmrg@findex GET_MODE
15271debfc3dSmrg@item GET_MODE (@var{x})
15281debfc3dSmrgReturns the machine mode of the RTX @var{x}.
15291debfc3dSmrg
15301debfc3dSmrg@findex PUT_MODE
15311debfc3dSmrg@item PUT_MODE (@var{x}, @var{newmode})
15321debfc3dSmrgAlters the machine mode of the RTX @var{x} to be @var{newmode}.
15331debfc3dSmrg
15341debfc3dSmrg@findex NUM_MACHINE_MODES
15351debfc3dSmrg@item NUM_MACHINE_MODES
15361debfc3dSmrgStands for the number of machine modes available on the target
15371debfc3dSmrgmachine.  This is one greater than the largest numeric value of any
15381debfc3dSmrgmachine mode.
15391debfc3dSmrg
15401debfc3dSmrg@findex GET_MODE_NAME
15411debfc3dSmrg@item GET_MODE_NAME (@var{m})
15421debfc3dSmrgReturns the name of mode @var{m} as a string.
15431debfc3dSmrg
15441debfc3dSmrg@findex GET_MODE_CLASS
15451debfc3dSmrg@item GET_MODE_CLASS (@var{m})
15461debfc3dSmrgReturns the mode class of mode @var{m}.
15471debfc3dSmrg
15481debfc3dSmrg@findex GET_MODE_WIDER_MODE
15491debfc3dSmrg@item GET_MODE_WIDER_MODE (@var{m})
15501debfc3dSmrgReturns the next wider natural mode.  For example, the expression
15511debfc3dSmrg@code{GET_MODE_WIDER_MODE (QImode)} returns @code{HImode}.
15521debfc3dSmrg
15531debfc3dSmrg@findex GET_MODE_SIZE
15541debfc3dSmrg@item GET_MODE_SIZE (@var{m})
15551debfc3dSmrgReturns the size in bytes of a datum of mode @var{m}.
15561debfc3dSmrg
15571debfc3dSmrg@findex GET_MODE_BITSIZE
15581debfc3dSmrg@item GET_MODE_BITSIZE (@var{m})
15591debfc3dSmrgReturns the size in bits of a datum of mode @var{m}.
15601debfc3dSmrg
15611debfc3dSmrg@findex GET_MODE_IBIT
15621debfc3dSmrg@item GET_MODE_IBIT (@var{m})
15631debfc3dSmrgReturns the number of integral bits of a datum of fixed-point mode @var{m}.
15641debfc3dSmrg
15651debfc3dSmrg@findex GET_MODE_FBIT
15661debfc3dSmrg@item GET_MODE_FBIT (@var{m})
15671debfc3dSmrgReturns the number of fractional bits of a datum of fixed-point mode @var{m}.
15681debfc3dSmrg
15691debfc3dSmrg@findex GET_MODE_MASK
15701debfc3dSmrg@item GET_MODE_MASK (@var{m})
15711debfc3dSmrgReturns a bitmask containing 1 for all bits in a word that fit within
15721debfc3dSmrgmode @var{m}.  This macro can only be used for modes whose bitsize is
15731debfc3dSmrgless than or equal to @code{HOST_BITS_PER_INT}.
15741debfc3dSmrg
15751debfc3dSmrg@findex GET_MODE_ALIGNMENT
15761debfc3dSmrg@item GET_MODE_ALIGNMENT (@var{m})
15771debfc3dSmrgReturn the required alignment, in bits, for an object of mode @var{m}.
15781debfc3dSmrg
15791debfc3dSmrg@findex GET_MODE_UNIT_SIZE
15801debfc3dSmrg@item GET_MODE_UNIT_SIZE (@var{m})
15811debfc3dSmrgReturns the size in bytes of the subunits of a datum of mode @var{m}.
15821debfc3dSmrgThis is the same as @code{GET_MODE_SIZE} except in the case of complex
15831debfc3dSmrgmodes.  For them, the unit size is the size of the real or imaginary
15841debfc3dSmrgpart.
15851debfc3dSmrg
15861debfc3dSmrg@findex GET_MODE_NUNITS
15871debfc3dSmrg@item GET_MODE_NUNITS (@var{m})
15881debfc3dSmrgReturns the number of units contained in a mode, i.e.,
15891debfc3dSmrg@code{GET_MODE_SIZE} divided by @code{GET_MODE_UNIT_SIZE}.
15901debfc3dSmrg
15911debfc3dSmrg@findex GET_CLASS_NARROWEST_MODE
15921debfc3dSmrg@item GET_CLASS_NARROWEST_MODE (@var{c})
15931debfc3dSmrgReturns the narrowest mode in mode class @var{c}.
15941debfc3dSmrg@end table
15951debfc3dSmrg
15961debfc3dSmrgThe following 3 variables are defined on every target.   They can be
15971debfc3dSmrgused to allocate buffers that are guaranteed to be large enough to
15981debfc3dSmrghold any value that can be represented on the target.   The first two
15991debfc3dSmrgcan be overridden by defining them in the target's mode.def file,
16001debfc3dSmrghowever, the value must be a constant that can determined very early
16011debfc3dSmrgin the compilation process.   The third symbol cannot be overridden.
16021debfc3dSmrg
16031debfc3dSmrg@table @code
16041debfc3dSmrg@findex BITS_PER_UNIT
16051debfc3dSmrg@item BITS_PER_UNIT
16061debfc3dSmrgThe number of bits in an addressable storage unit (byte).  If you do
16071debfc3dSmrgnot define this, the default is 8.
16081debfc3dSmrg
16091debfc3dSmrg@findex MAX_BITSIZE_MODE_ANY_INT
16101debfc3dSmrg@item MAX_BITSIZE_MODE_ANY_INT
16111debfc3dSmrgThe maximum bitsize of any mode that is used in integer math.  This
16121debfc3dSmrgshould be overridden by the target if it uses large integers as
16131debfc3dSmrgcontainers for larger vectors but otherwise never uses the contents to
16141debfc3dSmrgcompute integer values.
16151debfc3dSmrg
16161debfc3dSmrg@findex MAX_BITSIZE_MODE_ANY_MODE
16171debfc3dSmrg@item MAX_BITSIZE_MODE_ANY_MODE
1618a2dc1f3fSmrgThe bitsize of the largest mode on the target.  The default value is
1619a2dc1f3fSmrgthe largest mode size given in the mode definition file, which is
1620a2dc1f3fSmrgalways correct for targets whose modes have a fixed size.  Targets
1621a2dc1f3fSmrgthat might increase the size of a mode beyond this default should define
1622a2dc1f3fSmrg@code{MAX_BITSIZE_MODE_ANY_MODE} to the actual upper limit in
1623a2dc1f3fSmrg@file{@var{machine}-modes.def}.
16241debfc3dSmrg@end table
16251debfc3dSmrg
16261debfc3dSmrg@findex byte_mode
16271debfc3dSmrg@findex word_mode
16281debfc3dSmrgThe global variables @code{byte_mode} and @code{word_mode} contain modes
16291debfc3dSmrgwhose classes are @code{MODE_INT} and whose bitsizes are either
16301debfc3dSmrg@code{BITS_PER_UNIT} or @code{BITS_PER_WORD}, respectively.  On 32-bit
16311debfc3dSmrgmachines, these are @code{QImode} and @code{SImode}, respectively.
16321debfc3dSmrg
16331debfc3dSmrg@node Constants
16341debfc3dSmrg@section Constant Expression Types
16351debfc3dSmrg@cindex RTL constants
16361debfc3dSmrg@cindex RTL constant expression types
16371debfc3dSmrg
16381debfc3dSmrgThe simplest RTL expressions are those that represent constant values.
16391debfc3dSmrg
16401debfc3dSmrg@table @code
16411debfc3dSmrg@findex const_int
16421debfc3dSmrg@item (const_int @var{i})
16431debfc3dSmrgThis type of expression represents the integer value @var{i}.  @var{i}
16441debfc3dSmrgis customarily accessed with the macro @code{INTVAL} as in
16451debfc3dSmrg@code{INTVAL (@var{exp})}, which is equivalent to @code{XWINT (@var{exp}, 0)}.
16461debfc3dSmrg
16471debfc3dSmrgConstants generated for modes with fewer bits than in
16481debfc3dSmrg@code{HOST_WIDE_INT} must be sign extended to full width (e.g., with
16491debfc3dSmrg@code{gen_int_mode}).  For constants for modes with more bits than in
16501debfc3dSmrg@code{HOST_WIDE_INT} the implied high order bits of that constant are
16511debfc3dSmrgcopies of the top bit.  Note however that values are neither
16521debfc3dSmrginherently signed nor inherently unsigned; where necessary, signedness
16531debfc3dSmrgis determined by the rtl operation instead.
16541debfc3dSmrg
16551debfc3dSmrg@findex const0_rtx
16561debfc3dSmrg@findex const1_rtx
16571debfc3dSmrg@findex const2_rtx
16581debfc3dSmrg@findex constm1_rtx
16591debfc3dSmrgThere is only one expression object for the integer value zero; it is
16601debfc3dSmrgthe value of the variable @code{const0_rtx}.  Likewise, the only
16611debfc3dSmrgexpression for integer value one is found in @code{const1_rtx}, the only
16621debfc3dSmrgexpression for integer value two is found in @code{const2_rtx}, and the
16631debfc3dSmrgonly expression for integer value negative one is found in
16641debfc3dSmrg@code{constm1_rtx}.  Any attempt to create an expression of code
16651debfc3dSmrg@code{const_int} and value zero, one, two or negative one will return
16661debfc3dSmrg@code{const0_rtx}, @code{const1_rtx}, @code{const2_rtx} or
16671debfc3dSmrg@code{constm1_rtx} as appropriate.
16681debfc3dSmrg
16691debfc3dSmrg@findex const_true_rtx
16701debfc3dSmrgSimilarly, there is only one object for the integer whose value is
16711debfc3dSmrg@code{STORE_FLAG_VALUE}.  It is found in @code{const_true_rtx}.  If
16721debfc3dSmrg@code{STORE_FLAG_VALUE} is one, @code{const_true_rtx} and
16731debfc3dSmrg@code{const1_rtx} will point to the same object.  If
16741debfc3dSmrg@code{STORE_FLAG_VALUE} is @minus{}1, @code{const_true_rtx} and
16751debfc3dSmrg@code{constm1_rtx} will point to the same object.
16761debfc3dSmrg
16771debfc3dSmrg@findex const_double
16781debfc3dSmrg@item (const_double:@var{m} @var{i0} @var{i1} @dots{})
16791debfc3dSmrgThis represents either a floating-point constant of mode @var{m} or
16801debfc3dSmrg(on older ports that do not define
16811debfc3dSmrg@code{TARGET_SUPPORTS_WIDE_INT}) an integer constant too large to fit
16821debfc3dSmrginto @code{HOST_BITS_PER_WIDE_INT} bits but small enough to fit within
16831debfc3dSmrgtwice that number of bits.  In the latter case, @var{m} will be
16841debfc3dSmrg@code{VOIDmode}.  For integral values constants for modes with more
16851debfc3dSmrgbits than twice the number in @code{HOST_WIDE_INT} the implied high
16861debfc3dSmrgorder bits of that constant are copies of the top bit of
16871debfc3dSmrg@code{CONST_DOUBLE_HIGH}.  Note however that integral values are
16881debfc3dSmrgneither inherently signed nor inherently unsigned; where necessary,
16891debfc3dSmrgsignedness is determined by the rtl operation instead.
16901debfc3dSmrg
16911debfc3dSmrgOn more modern ports, @code{CONST_DOUBLE} only represents floating
16921debfc3dSmrgpoint values.  New ports define @code{TARGET_SUPPORTS_WIDE_INT} to
16931debfc3dSmrgmake this designation.
16941debfc3dSmrg
16951debfc3dSmrg@findex CONST_DOUBLE_LOW
16961debfc3dSmrgIf @var{m} is @code{VOIDmode}, the bits of the value are stored in
16971debfc3dSmrg@var{i0} and @var{i1}.  @var{i0} is customarily accessed with the macro
16981debfc3dSmrg@code{CONST_DOUBLE_LOW} and @var{i1} with @code{CONST_DOUBLE_HIGH}.
16991debfc3dSmrg
17001debfc3dSmrgIf the constant is floating point (regardless of its precision), then
17011debfc3dSmrgthe number of integers used to store the value depends on the size of
17021debfc3dSmrg@code{REAL_VALUE_TYPE} (@pxref{Floating Point}).  The integers
17031debfc3dSmrgrepresent a floating point number, but not precisely in the target
17041debfc3dSmrgmachine's or host machine's floating point format.  To convert them to
17051debfc3dSmrgthe precise bit pattern used by the target machine, use the macro
17061debfc3dSmrg@code{REAL_VALUE_TO_TARGET_DOUBLE} and friends (@pxref{Data Output}).
17071debfc3dSmrg
17081debfc3dSmrg@findex CONST_WIDE_INT
17091debfc3dSmrg@item (const_wide_int:@var{m} @var{nunits} @var{elt0} @dots{})
17101debfc3dSmrgThis contains an array of @code{HOST_WIDE_INT}s that is large enough
17111debfc3dSmrgto hold any constant that can be represented on the target.  This form
17121debfc3dSmrgof rtl is only used on targets that define
17131debfc3dSmrg@code{TARGET_SUPPORTS_WIDE_INT} to be nonzero and then
17141debfc3dSmrg@code{CONST_DOUBLE}s are only used to hold floating-point values.  If
17151debfc3dSmrgthe target leaves @code{TARGET_SUPPORTS_WIDE_INT} defined as 0,
17161debfc3dSmrg@code{CONST_WIDE_INT}s are not used and @code{CONST_DOUBLE}s are as
17171debfc3dSmrgthey were before.
17181debfc3dSmrg
17191debfc3dSmrgThe values are stored in a compressed format.  The higher-order
17201debfc3dSmrg0s or -1s are not represented if they are just the logical sign
17211debfc3dSmrgextension of the number that is represented.
17221debfc3dSmrg
17231debfc3dSmrg@findex CONST_WIDE_INT_VEC
17241debfc3dSmrg@item CONST_WIDE_INT_VEC (@var{code})
17251debfc3dSmrgReturns the entire array of @code{HOST_WIDE_INT}s that are used to
17261debfc3dSmrgstore the value.  This macro should be rarely used.
17271debfc3dSmrg
17281debfc3dSmrg@findex CONST_WIDE_INT_NUNITS
17291debfc3dSmrg@item CONST_WIDE_INT_NUNITS (@var{code})
17301debfc3dSmrgThe number of @code{HOST_WIDE_INT}s used to represent the number.
17311debfc3dSmrgNote that this generally is smaller than the number of
17321debfc3dSmrg@code{HOST_WIDE_INT}s implied by the mode size.
17331debfc3dSmrg
17341debfc3dSmrg@findex CONST_WIDE_INT_ELT
1735c0a68be4Smrg@item CONST_WIDE_INT_ELT (@var{code},@var{i})
17361debfc3dSmrgReturns the @code{i}th element of the array.   Element 0 is contains
17371debfc3dSmrgthe low order bits of the constant.
17381debfc3dSmrg
17391debfc3dSmrg@findex const_fixed
17401debfc3dSmrg@item (const_fixed:@var{m} @dots{})
17411debfc3dSmrgRepresents a fixed-point constant of mode @var{m}.
17421debfc3dSmrgThe operand is a data structure of type @code{struct fixed_value} and
17431debfc3dSmrgis accessed with the macro @code{CONST_FIXED_VALUE}.  The high part of
17441debfc3dSmrgdata is accessed with @code{CONST_FIXED_VALUE_HIGH}; the low part is
17451debfc3dSmrgaccessed with @code{CONST_FIXED_VALUE_LOW}.
17461debfc3dSmrg
1747a2dc1f3fSmrg@findex const_poly_int
1748a2dc1f3fSmrg@item (const_poly_int:@var{m} [@var{c0} @var{c1} @dots{}])
1749a2dc1f3fSmrgRepresents a @code{poly_int}-style polynomial integer with coefficients
1750a2dc1f3fSmrg@var{c0}, @var{c1}, @dots{}.  The coefficients are @code{wide_int}-based
1751a2dc1f3fSmrgintegers rather than rtxes.  @code{CONST_POLY_INT_COEFFS} gives the
1752a2dc1f3fSmrgvalues of individual coefficients (which is mostly only useful in
1753a2dc1f3fSmrglow-level routines) and @code{const_poly_int_value} gives the full
1754a2dc1f3fSmrg@code{poly_int} value.
1755a2dc1f3fSmrg
17561debfc3dSmrg@findex const_vector
17571debfc3dSmrg@item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}])
1758a2dc1f3fSmrgRepresents a vector constant.  The values in square brackets are
1759a2dc1f3fSmrgelements of the vector, which are always @code{const_int},
1760a2dc1f3fSmrg@code{const_wide_int}, @code{const_double} or @code{const_fixed}
1761a2dc1f3fSmrgexpressions.
17621debfc3dSmrg
1763a2dc1f3fSmrgEach vector constant @var{v} is treated as a specific instance of an
1764a2dc1f3fSmrgarbitrary-length sequence that itself contains
1765a2dc1f3fSmrg@samp{CONST_VECTOR_NPATTERNS (@var{v})} interleaved patterns.  Each
1766a2dc1f3fSmrgpattern has the form:
17671debfc3dSmrg
1768a2dc1f3fSmrg@smallexample
1769a2dc1f3fSmrg@{ @var{base0}, @var{base1}, @var{base1} + @var{step}, @var{base1} + @var{step} * 2, @dots{} @}
1770a2dc1f3fSmrg@end smallexample
1771a2dc1f3fSmrg
1772a2dc1f3fSmrgThe first three elements in each pattern are enough to determine the
1773a2dc1f3fSmrgvalues of the other elements.  However, if all @var{step}s are zero,
1774a2dc1f3fSmrgonly the first two elements are needed.  If in addition each @var{base1}
1775a2dc1f3fSmrgis equal to the corresponding @var{base0}, only the first element in
1776a2dc1f3fSmrgeach pattern is needed.  The number of determining elements per pattern
1777a2dc1f3fSmrgis given by @samp{CONST_VECTOR_NELTS_PER_PATTERN (@var{v})}.
1778a2dc1f3fSmrg
1779a2dc1f3fSmrgFor example, the constant:
1780a2dc1f3fSmrg
1781a2dc1f3fSmrg@smallexample
1782a2dc1f3fSmrg@{ 0, 1, 2, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8, 18 @}
1783a2dc1f3fSmrg@end smallexample
1784a2dc1f3fSmrg
1785a2dc1f3fSmrgis interpreted as an interleaving of the sequences:
1786a2dc1f3fSmrg
1787a2dc1f3fSmrg@smallexample
1788a2dc1f3fSmrg@{ 0, 2, 3, 4, 5, 6, 7, 8 @}
1789a2dc1f3fSmrg@{ 1, 6, 8, 10, 12, 14, 16, 18 @}
1790a2dc1f3fSmrg@end smallexample
1791a2dc1f3fSmrg
1792a2dc1f3fSmrgwhere the sequences are represented by the following patterns:
1793a2dc1f3fSmrg
1794a2dc1f3fSmrg@smallexample
1795a2dc1f3fSmrg@var{base0} == 0, @var{base1} == 2, @var{step} == 1
1796a2dc1f3fSmrg@var{base0} == 1, @var{base1} == 6, @var{step} == 2
1797a2dc1f3fSmrg@end smallexample
1798a2dc1f3fSmrg
1799a2dc1f3fSmrgIn this case:
1800a2dc1f3fSmrg
1801a2dc1f3fSmrg@smallexample
1802a2dc1f3fSmrgCONST_VECTOR_NPATTERNS (@var{v}) == 2
1803a2dc1f3fSmrgCONST_VECTOR_NELTS_PER_PATTERN (@var{v}) == 3
1804a2dc1f3fSmrg@end smallexample
1805a2dc1f3fSmrg
1806a2dc1f3fSmrgThus the first 6 elements (@samp{@{ 0, 1, 2, 6, 3, 8 @}}) are enough
1807a2dc1f3fSmrgto determine the whole sequence; we refer to them as the ``encoded''
1808a2dc1f3fSmrgelements.  They are the only elements present in the square brackets
1809c0a68be4Smrgfor variable-length @code{const_vector}s (i.e.@: for
1810a2dc1f3fSmrg@code{const_vector}s whose mode @var{m} has a variable number of
1811a2dc1f3fSmrgelements).  However, as a convenience to code that needs to handle
1812a2dc1f3fSmrgboth @code{const_vector}s and @code{parallel}s, all elements are
1813a2dc1f3fSmrgpresent in the square brackets for fixed-length @code{const_vector}s;
1814a2dc1f3fSmrgthe encoding scheme simply reduces the amount of work involved in
1815a2dc1f3fSmrgprocessing constants that follow a regular pattern.
1816a2dc1f3fSmrg
1817a2dc1f3fSmrgSometimes this scheme can create two possible encodings of the same
1818a2dc1f3fSmrgvector.  For example @{ 0, 1 @} could be seen as two patterns with
1819a2dc1f3fSmrgone element each or one pattern with two elements (@var{base0} and
1820a2dc1f3fSmrg@var{base1}).  The canonical encoding is always the one with the
1821a2dc1f3fSmrgfewest patterns or (if both encodings have the same number of
1822a2dc1f3fSmrgpetterns) the one with the fewest encoded elements.
1823a2dc1f3fSmrg
1824a2dc1f3fSmrg@samp{const_vector_encoding_nelts (@var{v})} gives the total number of
1825a2dc1f3fSmrgencoded elements in @var{v}, which is 6 in the example above.
1826a2dc1f3fSmrg@code{CONST_VECTOR_ENCODED_ELT (@var{v}, @var{i})} accesses the value
1827a2dc1f3fSmrgof encoded element @var{i}.
1828a2dc1f3fSmrg
1829a2dc1f3fSmrg@samp{CONST_VECTOR_DUPLICATE_P (@var{v})} is true if @var{v} simply contains
1830a2dc1f3fSmrgrepeated instances of @samp{CONST_VECTOR_NPATTERNS (@var{v})} values.  This is
1831a2dc1f3fSmrga shorthand for testing @samp{CONST_VECTOR_NELTS_PER_PATTERN (@var{v}) == 1}.
1832a2dc1f3fSmrg
1833a2dc1f3fSmrg@samp{CONST_VECTOR_STEPPED_P (@var{v})} is true if at least one
1834a2dc1f3fSmrgpattern in @var{v} has a nonzero step.  This is a shorthand for
1835a2dc1f3fSmrgtesting @samp{CONST_VECTOR_NELTS_PER_PATTERN (@var{v}) == 3}.
1836a2dc1f3fSmrg
1837a2dc1f3fSmrg@code{CONST_VECTOR_NUNITS (@var{v})} gives the total number of elements
1838a2dc1f3fSmrgin @var{v}; it is a shorthand for getting the number of units in
1839a2dc1f3fSmrg@samp{GET_MODE (@var{v})}.
1840a2dc1f3fSmrg
1841a2dc1f3fSmrgThe utility function @code{const_vector_elt} gives the value of an
1842a2dc1f3fSmrgarbitrary element as an @code{rtx}.  @code{const_vector_int_elt} gives
1843a2dc1f3fSmrgthe same value as a @code{wide_int}.
18441debfc3dSmrg
18451debfc3dSmrg@findex const_string
18461debfc3dSmrg@item (const_string @var{str})
18471debfc3dSmrgRepresents a constant string with value @var{str}.  Currently this is
18481debfc3dSmrgused only for insn attributes (@pxref{Insn Attributes}) since constant
18491debfc3dSmrgstrings in C are placed in memory.
18501debfc3dSmrg
18511debfc3dSmrg@findex symbol_ref
18521debfc3dSmrg@item (symbol_ref:@var{mode} @var{symbol})
18531debfc3dSmrgRepresents the value of an assembler label for data.  @var{symbol} is
18541debfc3dSmrga string that describes the name of the assembler label.  If it starts
18551debfc3dSmrgwith a @samp{*}, the label is the rest of @var{symbol} not including
18561debfc3dSmrgthe @samp{*}.  Otherwise, the label is @var{symbol}, usually prefixed
18571debfc3dSmrgwith @samp{_}.
18581debfc3dSmrg
18591debfc3dSmrgThe @code{symbol_ref} contains a mode, which is usually @code{Pmode}.
18601debfc3dSmrgUsually that is the only mode for which a symbol is directly valid.
18611debfc3dSmrg
18621debfc3dSmrg@findex label_ref
18631debfc3dSmrg@item (label_ref:@var{mode} @var{label})
18641debfc3dSmrgRepresents the value of an assembler label for code.  It contains one
18651debfc3dSmrgoperand, an expression, which must be a @code{code_label} or a @code{note}
18661debfc3dSmrgof type @code{NOTE_INSN_DELETED_LABEL} that appears in the instruction
18671debfc3dSmrgsequence to identify the place where the label should go.
18681debfc3dSmrg
18691debfc3dSmrgThe reason for using a distinct expression type for code label
18701debfc3dSmrgreferences is so that jump optimization can distinguish them.
18711debfc3dSmrg
18721debfc3dSmrgThe @code{label_ref} contains a mode, which is usually @code{Pmode}.
18731debfc3dSmrgUsually that is the only mode for which a label is directly valid.
18741debfc3dSmrg
18751debfc3dSmrg@findex const
18761debfc3dSmrg@item (const:@var{m} @var{exp})
18771debfc3dSmrgRepresents a constant that is the result of an assembly-time
1878a2dc1f3fSmrgarithmetic computation.  The operand, @var{exp}, contains only
1879a2dc1f3fSmrg@code{const_int}, @code{symbol_ref}, @code{label_ref} or @code{unspec}
1880a2dc1f3fSmrgexpressions, combined with @code{plus} and @code{minus}.  Any such
1881a2dc1f3fSmrg@code{unspec}s are target-specific and typically represent some form
1882a2dc1f3fSmrgof relocation operator.  @var{m} should be a valid address mode.
18831debfc3dSmrg
18841debfc3dSmrg@findex high
18851debfc3dSmrg@item (high:@var{m} @var{exp})
1886c0a68be4SmrgRepresents the high-order bits of @var{exp}.
1887c0a68be4SmrgThe number of bits is machine-dependent and is
18881debfc3dSmrgnormally the number of bits specified in an instruction that initializes
18891debfc3dSmrgthe high order bits of a register.  It is used with @code{lo_sum} to
18901debfc3dSmrgrepresent the typical two-instruction sequence used in RISC machines to
1891c0a68be4Smrgreference large immediate values and/or link-time constants such
1892c0a68be4Smrgas global memory addresses.  In the latter case, @var{m} is @code{Pmode}
1893c0a68be4Smrgand @var{exp} is usually a constant expression involving @code{symbol_ref}.
18941debfc3dSmrg@end table
18951debfc3dSmrg
18961debfc3dSmrg@findex CONST0_RTX
18971debfc3dSmrg@findex CONST1_RTX
18981debfc3dSmrg@findex CONST2_RTX
18991debfc3dSmrgThe macro @code{CONST0_RTX (@var{mode})} refers to an expression with
19001debfc3dSmrgvalue 0 in mode @var{mode}.  If mode @var{mode} is of mode class
19011debfc3dSmrg@code{MODE_INT}, it returns @code{const0_rtx}.  If mode @var{mode} is of
19021debfc3dSmrgmode class @code{MODE_FLOAT}, it returns a @code{CONST_DOUBLE}
19031debfc3dSmrgexpression in mode @var{mode}.  Otherwise, it returns a
19041debfc3dSmrg@code{CONST_VECTOR} expression in mode @var{mode}.  Similarly, the macro
19051debfc3dSmrg@code{CONST1_RTX (@var{mode})} refers to an expression with value 1 in
19061debfc3dSmrgmode @var{mode} and similarly for @code{CONST2_RTX}.  The
19071debfc3dSmrg@code{CONST1_RTX} and @code{CONST2_RTX} macros are undefined
19081debfc3dSmrgfor vector modes.
19091debfc3dSmrg
19101debfc3dSmrg@node Regs and Memory
19111debfc3dSmrg@section Registers and Memory
19121debfc3dSmrg@cindex RTL register expressions
19131debfc3dSmrg@cindex RTL memory expressions
19141debfc3dSmrg
19151debfc3dSmrgHere are the RTL expression types for describing access to machine
19161debfc3dSmrgregisters and to main memory.
19171debfc3dSmrg
19181debfc3dSmrg@table @code
19191debfc3dSmrg@findex reg
19201debfc3dSmrg@cindex hard registers
19211debfc3dSmrg@cindex pseudo registers
19221debfc3dSmrg@item (reg:@var{m} @var{n})
19231debfc3dSmrgFor small values of the integer @var{n} (those that are less than
19241debfc3dSmrg@code{FIRST_PSEUDO_REGISTER}), this stands for a reference to machine
19251debfc3dSmrgregister number @var{n}: a @dfn{hard register}.  For larger values of
19261debfc3dSmrg@var{n}, it stands for a temporary value or @dfn{pseudo register}.
19271debfc3dSmrgThe compiler's strategy is to generate code assuming an unlimited
19281debfc3dSmrgnumber of such pseudo registers, and later convert them into hard
19291debfc3dSmrgregisters or into memory references.
19301debfc3dSmrg
19311debfc3dSmrg@var{m} is the machine mode of the reference.  It is necessary because
19321debfc3dSmrgmachines can generally refer to each register in more than one mode.
19331debfc3dSmrgFor example, a register may contain a full word but there may be
19341debfc3dSmrginstructions to refer to it as a half word or as a single byte, as
19351debfc3dSmrgwell as instructions to refer to it as a floating point number of
19361debfc3dSmrgvarious precisions.
19371debfc3dSmrg
19381debfc3dSmrgEven for a register that the machine can access in only one mode,
19391debfc3dSmrgthe mode must always be specified.
19401debfc3dSmrg
19411debfc3dSmrgThe symbol @code{FIRST_PSEUDO_REGISTER} is defined by the machine
19421debfc3dSmrgdescription, since the number of hard registers on the machine is an
19431debfc3dSmrginvariant characteristic of the machine.  Note, however, that not
19441debfc3dSmrgall of the machine registers must be general registers.  All the
19451debfc3dSmrgmachine registers that can be used for storage of data are given
19461debfc3dSmrghard register numbers, even those that can be used only in certain
19471debfc3dSmrginstructions or can hold only certain types of data.
19481debfc3dSmrg
19491debfc3dSmrgA hard register may be accessed in various modes throughout one
19501debfc3dSmrgfunction, but each pseudo register is given a natural mode
19511debfc3dSmrgand is accessed only in that mode.  When it is necessary to describe
19521debfc3dSmrgan access to a pseudo register using a nonnatural mode, a @code{subreg}
19531debfc3dSmrgexpression is used.
19541debfc3dSmrg
19551debfc3dSmrgA @code{reg} expression with a machine mode that specifies more than
19561debfc3dSmrgone word of data may actually stand for several consecutive registers.
19571debfc3dSmrgIf in addition the register number specifies a hardware register, then
19581debfc3dSmrgit actually represents several consecutive hardware registers starting
19591debfc3dSmrgwith the specified one.
19601debfc3dSmrg
19611debfc3dSmrgEach pseudo register number used in a function's RTL code is
19621debfc3dSmrgrepresented by a unique @code{reg} expression.
19631debfc3dSmrg
19641debfc3dSmrg@findex FIRST_VIRTUAL_REGISTER
19651debfc3dSmrg@findex LAST_VIRTUAL_REGISTER
19661debfc3dSmrgSome pseudo register numbers, those within the range of
19671debfc3dSmrg@code{FIRST_VIRTUAL_REGISTER} to @code{LAST_VIRTUAL_REGISTER} only
19681debfc3dSmrgappear during the RTL generation phase and are eliminated before the
19691debfc3dSmrgoptimization phases.  These represent locations in the stack frame that
19701debfc3dSmrgcannot be determined until RTL generation for the function has been
19711debfc3dSmrgcompleted.  The following virtual register numbers are defined:
19721debfc3dSmrg
19731debfc3dSmrg@table @code
19741debfc3dSmrg@findex VIRTUAL_INCOMING_ARGS_REGNUM
19751debfc3dSmrg@item VIRTUAL_INCOMING_ARGS_REGNUM
19761debfc3dSmrgThis points to the first word of the incoming arguments passed on the
19771debfc3dSmrgstack.  Normally these arguments are placed there by the caller, but the
19781debfc3dSmrgcallee may have pushed some arguments that were previously passed in
19791debfc3dSmrgregisters.
19801debfc3dSmrg
19811debfc3dSmrg@cindex @code{FIRST_PARM_OFFSET} and virtual registers
19821debfc3dSmrg@cindex @code{ARG_POINTER_REGNUM} and virtual registers
19831debfc3dSmrgWhen RTL generation is complete, this virtual register is replaced
19841debfc3dSmrgby the sum of the register given by @code{ARG_POINTER_REGNUM} and the
19851debfc3dSmrgvalue of @code{FIRST_PARM_OFFSET}.
19861debfc3dSmrg
19871debfc3dSmrg@findex VIRTUAL_STACK_VARS_REGNUM
19881debfc3dSmrg@cindex @code{FRAME_GROWS_DOWNWARD} and virtual registers
19891debfc3dSmrg@item VIRTUAL_STACK_VARS_REGNUM
19901debfc3dSmrgIf @code{FRAME_GROWS_DOWNWARD} is defined to a nonzero value, this points
19911debfc3dSmrgto immediately above the first variable on the stack.  Otherwise, it points
19921debfc3dSmrgto the first variable on the stack.
19931debfc3dSmrg
1994a2dc1f3fSmrg@cindex @code{TARGET_STARTING_FRAME_OFFSET} and virtual registers
19951debfc3dSmrg@cindex @code{FRAME_POINTER_REGNUM} and virtual registers
19961debfc3dSmrg@code{VIRTUAL_STACK_VARS_REGNUM} is replaced with the sum of the
19971debfc3dSmrgregister given by @code{FRAME_POINTER_REGNUM} and the value
1998a2dc1f3fSmrg@code{TARGET_STARTING_FRAME_OFFSET}.
19991debfc3dSmrg
20001debfc3dSmrg@findex VIRTUAL_STACK_DYNAMIC_REGNUM
20011debfc3dSmrg@item VIRTUAL_STACK_DYNAMIC_REGNUM
20021debfc3dSmrgThis points to the location of dynamically allocated memory on the stack
20031debfc3dSmrgimmediately after the stack pointer has been adjusted by the amount of
20041debfc3dSmrgmemory desired.
20051debfc3dSmrg
20061debfc3dSmrg@cindex @code{STACK_DYNAMIC_OFFSET} and virtual registers
20071debfc3dSmrg@cindex @code{STACK_POINTER_REGNUM} and virtual registers
20081debfc3dSmrgThis virtual register is replaced by the sum of the register given by
20091debfc3dSmrg@code{STACK_POINTER_REGNUM} and the value @code{STACK_DYNAMIC_OFFSET}.
20101debfc3dSmrg
20111debfc3dSmrg@findex VIRTUAL_OUTGOING_ARGS_REGNUM
20121debfc3dSmrg@item VIRTUAL_OUTGOING_ARGS_REGNUM
20131debfc3dSmrgThis points to the location in the stack at which outgoing arguments
20141debfc3dSmrgshould be written when the stack is pre-pushed (arguments pushed using
20151debfc3dSmrgpush insns should always use @code{STACK_POINTER_REGNUM}).
20161debfc3dSmrg
20171debfc3dSmrg@cindex @code{STACK_POINTER_OFFSET} and virtual registers
20181debfc3dSmrgThis virtual register is replaced by the sum of the register given by
20191debfc3dSmrg@code{STACK_POINTER_REGNUM} and the value @code{STACK_POINTER_OFFSET}.
20201debfc3dSmrg@end table
20211debfc3dSmrg
20221debfc3dSmrg@findex subreg
20231debfc3dSmrg@item (subreg:@var{m1} @var{reg:m2} @var{bytenum})
20241debfc3dSmrg
20251debfc3dSmrg@code{subreg} expressions are used to refer to a register in a machine
20261debfc3dSmrgmode other than its natural one, or to refer to one register of
20271debfc3dSmrga multi-part @code{reg} that actually refers to several registers.
20281debfc3dSmrg
20291debfc3dSmrgEach pseudo register has a natural mode.  If it is necessary to
20301debfc3dSmrgoperate on it in a different mode, the register must be
20311debfc3dSmrgenclosed in a @code{subreg}.
20321debfc3dSmrg
20331debfc3dSmrgThere are currently three supported types for the first operand of a
20341debfc3dSmrg@code{subreg}:
20351debfc3dSmrg@itemize
20361debfc3dSmrg@item pseudo registers
20371debfc3dSmrgThis is the most common case.  Most @code{subreg}s have pseudo
20381debfc3dSmrg@code{reg}s as their first operand.
20391debfc3dSmrg
20401debfc3dSmrg@item mem
20411debfc3dSmrg@code{subreg}s of @code{mem} were common in earlier versions of GCC and
20421debfc3dSmrgare still supported.  During the reload pass these are replaced by plain
20431debfc3dSmrg@code{mem}s.  On machines that do not do instruction scheduling, use of
20441debfc3dSmrg@code{subreg}s of @code{mem} are still used, but this is no longer
20451debfc3dSmrgrecommended.  Such @code{subreg}s are considered to be
20461debfc3dSmrg@code{register_operand}s rather than @code{memory_operand}s before and
20471debfc3dSmrgduring reload.  Because of this, the scheduling passes cannot properly
20481debfc3dSmrgschedule instructions with @code{subreg}s of @code{mem}, so for machines
20491debfc3dSmrgthat do scheduling, @code{subreg}s of @code{mem} should never be used.
20501debfc3dSmrgTo support this, the combine and recog passes have explicit code to
20511debfc3dSmrginhibit the creation of @code{subreg}s of @code{mem} when
20521debfc3dSmrg@code{INSN_SCHEDULING} is defined.
20531debfc3dSmrg
20541debfc3dSmrgThe use of @code{subreg}s of @code{mem} after the reload pass is an area
20551debfc3dSmrgthat is not well understood and should be avoided.  There is still some
20561debfc3dSmrgcode in the compiler to support this, but this code has possibly rotted.
20571debfc3dSmrgThis use of @code{subreg}s is discouraged and will most likely not be
20581debfc3dSmrgsupported in the future.
20591debfc3dSmrg
20601debfc3dSmrg@item hard registers
20611debfc3dSmrgIt is seldom necessary to wrap hard registers in @code{subreg}s; such
20621debfc3dSmrgregisters would normally reduce to a single @code{reg} rtx.  This use of
20631debfc3dSmrg@code{subreg}s is discouraged and may not be supported in the future.
20641debfc3dSmrg
20651debfc3dSmrg@end itemize
20661debfc3dSmrg
20671debfc3dSmrg@code{subreg}s of @code{subreg}s are not supported.  Using
20681debfc3dSmrg@code{simplify_gen_subreg} is the recommended way to avoid this problem.
20691debfc3dSmrg
20701debfc3dSmrg@code{subreg}s come in two distinct flavors, each having its own
20711debfc3dSmrgusage and rules:
20721debfc3dSmrg
20731debfc3dSmrg@table @asis
20741debfc3dSmrg@item Paradoxical subregs
20751debfc3dSmrgWhen @var{m1} is strictly wider than @var{m2}, the @code{subreg}
20761debfc3dSmrgexpression is called @dfn{paradoxical}.  The canonical test for this
20771debfc3dSmrgclass of @code{subreg} is:
20781debfc3dSmrg
20791debfc3dSmrg@smallexample
2080a2dc1f3fSmrgparadoxical_subreg_p (@var{m1}, @var{m2})
20811debfc3dSmrg@end smallexample
20821debfc3dSmrg
20831debfc3dSmrgParadoxical @code{subreg}s can be used as both lvalues and rvalues.
20841debfc3dSmrgWhen used as an lvalue, the low-order bits of the source value
20851debfc3dSmrgare stored in @var{reg} and the high-order bits are discarded.
20861debfc3dSmrgWhen used as an rvalue, the low-order bits of the @code{subreg} are
20871debfc3dSmrgtaken from @var{reg} while the high-order bits may or may not be
20881debfc3dSmrgdefined.
20891debfc3dSmrg
20901debfc3dSmrgThe high-order bits of rvalues are defined in the following circumstances:
20911debfc3dSmrg
20921debfc3dSmrg@itemize
20931debfc3dSmrg@item @code{subreg}s of @code{mem}
20941debfc3dSmrgWhen @var{m2} is smaller than a word, the macro @code{LOAD_EXTEND_OP},
20951debfc3dSmrgcan control how the high-order bits are defined.
20961debfc3dSmrg
20971debfc3dSmrg@item @code{subreg} of @code{reg}s
20981debfc3dSmrgThe upper bits are defined when @code{SUBREG_PROMOTED_VAR_P} is true.
20991debfc3dSmrg@code{SUBREG_PROMOTED_UNSIGNED_P} describes what the upper bits hold.
21001debfc3dSmrgSuch subregs usually represent local variables, register variables
21011debfc3dSmrgand parameter pseudo variables that have been promoted to a wider mode.
21021debfc3dSmrg
21031debfc3dSmrg@end itemize
21041debfc3dSmrg
21051debfc3dSmrg@var{bytenum} is always zero for a paradoxical @code{subreg}, even on
21061debfc3dSmrgbig-endian targets.
21071debfc3dSmrg
21081debfc3dSmrgFor example, the paradoxical @code{subreg}:
21091debfc3dSmrg
21101debfc3dSmrg@smallexample
21111debfc3dSmrg(set (subreg:SI (reg:HI @var{x}) 0) @var{y})
21121debfc3dSmrg@end smallexample
21131debfc3dSmrg
21141debfc3dSmrgstores the lower 2 bytes of @var{y} in @var{x} and discards the upper
21151debfc3dSmrg2 bytes.  A subsequent:
21161debfc3dSmrg
21171debfc3dSmrg@smallexample
21181debfc3dSmrg(set @var{z} (subreg:SI (reg:HI @var{x}) 0))
21191debfc3dSmrg@end smallexample
21201debfc3dSmrg
21211debfc3dSmrgwould set the lower two bytes of @var{z} to @var{y} and set the upper
21221debfc3dSmrgtwo bytes to an unknown value assuming @code{SUBREG_PROMOTED_VAR_P} is
21231debfc3dSmrgfalse.
21241debfc3dSmrg
21251debfc3dSmrg@item Normal subregs
21261debfc3dSmrgWhen @var{m1} is at least as narrow as @var{m2} the @code{subreg}
21271debfc3dSmrgexpression is called @dfn{normal}.
21281debfc3dSmrg
2129a2dc1f3fSmrg@findex REGMODE_NATURAL_SIZE
21301debfc3dSmrgNormal @code{subreg}s restrict consideration to certain bits of
2131a2dc1f3fSmrg@var{reg}.  For this purpose, @var{reg} is divided into
2132a2dc1f3fSmrgindividually-addressable blocks in which each block has:
21331debfc3dSmrg
2134a2dc1f3fSmrg@smallexample
2135a2dc1f3fSmrgREGMODE_NATURAL_SIZE (@var{m2})
2136a2dc1f3fSmrg@end smallexample
2137a2dc1f3fSmrg
2138a2dc1f3fSmrgbytes.  Usually the value is @code{UNITS_PER_WORD}; that is,
2139a2dc1f3fSmrgmost targets usually treat each word of a register as being
2140a2dc1f3fSmrgindependently addressable.
2141a2dc1f3fSmrg
2142a2dc1f3fSmrgThere are two types of normal @code{subreg}.  If @var{m1} is known
2143a2dc1f3fSmrgto be no bigger than a block, the @code{subreg} refers to the
2144a2dc1f3fSmrgleast-significant part (or @dfn{lowpart}) of one block of @var{reg}.
2145a2dc1f3fSmrgIf @var{m1} is known to be larger than a block, the @code{subreg} refers
2146a2dc1f3fSmrgto two or more complete blocks.
2147a2dc1f3fSmrg
2148a2dc1f3fSmrgWhen used as an lvalue, @code{subreg} is a block-based accessor.
2149a2dc1f3fSmrgStoring to a @code{subreg} modifies all the blocks of @var{reg} that
2150a2dc1f3fSmrgoverlap the @code{subreg}, but it leaves the other blocks of @var{reg}
21511debfc3dSmrgalone.
21521debfc3dSmrg
2153a2dc1f3fSmrgWhen storing to a normal @code{subreg} that is smaller than a block,
2154a2dc1f3fSmrgthe other bits of the referenced block are usually left in an undefined
21551debfc3dSmrgstate.  This laxity makes it easier to generate efficient code for
21561debfc3dSmrgsuch instructions.  To represent an instruction that preserves all the
21571debfc3dSmrgbits outside of those in the @code{subreg}, use @code{strict_low_part}
21581debfc3dSmrgor @code{zero_extract} around the @code{subreg}.
21591debfc3dSmrg
21601debfc3dSmrg@var{bytenum} must identify the offset of the first byte of the
21611debfc3dSmrg@code{subreg} from the start of @var{reg}, assuming that @var{reg} is
21621debfc3dSmrglaid out in memory order.  The memory order of bytes is defined by
21631debfc3dSmrgtwo target macros, @code{WORDS_BIG_ENDIAN} and @code{BYTES_BIG_ENDIAN}:
21641debfc3dSmrg
21651debfc3dSmrg@itemize
21661debfc3dSmrg@item
21671debfc3dSmrg@cindex @code{WORDS_BIG_ENDIAN}, effect on @code{subreg}
21681debfc3dSmrg@code{WORDS_BIG_ENDIAN}, if set to 1, says that byte number zero is
21691debfc3dSmrgpart of the most significant word; otherwise, it is part of the least
21701debfc3dSmrgsignificant word.
21711debfc3dSmrg
21721debfc3dSmrg@item
21731debfc3dSmrg@cindex @code{BYTES_BIG_ENDIAN}, effect on @code{subreg}
21741debfc3dSmrg@code{BYTES_BIG_ENDIAN}, if set to 1, says that byte number zero is
21751debfc3dSmrgthe most significant byte within a word; otherwise, it is the least
21761debfc3dSmrgsignificant byte within a word.
21771debfc3dSmrg@end itemize
21781debfc3dSmrg
21791debfc3dSmrg@cindex @code{FLOAT_WORDS_BIG_ENDIAN}, (lack of) effect on @code{subreg}
21801debfc3dSmrgOn a few targets, @code{FLOAT_WORDS_BIG_ENDIAN} disagrees with
21811debfc3dSmrg@code{WORDS_BIG_ENDIAN}.  However, most parts of the compiler treat
21821debfc3dSmrgfloating point values as if they had the same endianness as integer
21831debfc3dSmrgvalues.  This works because they handle them solely as a collection of
21841debfc3dSmrginteger values, with no particular numerical value.  Only real.c and
21851debfc3dSmrgthe runtime libraries care about @code{FLOAT_WORDS_BIG_ENDIAN}.
21861debfc3dSmrg
21871debfc3dSmrgThus,
21881debfc3dSmrg
21891debfc3dSmrg@smallexample
21901debfc3dSmrg(subreg:HI (reg:SI @var{x}) 2)
21911debfc3dSmrg@end smallexample
21921debfc3dSmrg
21931debfc3dSmrgon a @code{BYTES_BIG_ENDIAN}, @samp{UNITS_PER_WORD == 4} target is the same as
21941debfc3dSmrg
21951debfc3dSmrg@smallexample
21961debfc3dSmrg(subreg:HI (reg:SI @var{x}) 0)
21971debfc3dSmrg@end smallexample
21981debfc3dSmrg
21991debfc3dSmrgon a little-endian, @samp{UNITS_PER_WORD == 4} target.  Both
22001debfc3dSmrg@code{subreg}s access the lower two bytes of register @var{x}.
22011debfc3dSmrg
2202a2dc1f3fSmrgNote that the byte offset is a polynomial integer; it may not be a
2203a2dc1f3fSmrgcompile-time constant on targets with variable-sized modes.  However,
2204a2dc1f3fSmrgthe restrictions above mean that there are only a certain set of
2205a2dc1f3fSmrgacceptable offsets for a given combination of @var{m1} and @var{m2}.
2206a2dc1f3fSmrgThe compiler can always tell which blocks a valid subreg occupies, and
2207a2dc1f3fSmrgwhether the subreg is a lowpart of a block.
2208a2dc1f3fSmrg
22091debfc3dSmrg@end table
22101debfc3dSmrg
22111debfc3dSmrgA @code{MODE_PARTIAL_INT} mode behaves as if it were as wide as the
22121debfc3dSmrgcorresponding @code{MODE_INT} mode, except that it has an unknown
22131debfc3dSmrgnumber of undefined bits.  For example:
22141debfc3dSmrg
22151debfc3dSmrg@smallexample
22161debfc3dSmrg(subreg:PSI (reg:SI 0) 0)
22171debfc3dSmrg@end smallexample
22181debfc3dSmrg
2219a2dc1f3fSmrg@findex REGMODE_NATURAL_SIZE
22201debfc3dSmrgaccesses the whole of @samp{(reg:SI 0)}, but the exact relationship
22211debfc3dSmrgbetween the @code{PSImode} value and the @code{SImode} value is not
2222a2dc1f3fSmrgdefined.  If we assume @samp{REGMODE_NATURAL_SIZE (DImode) <= 4},
2223a2dc1f3fSmrgthen the following two @code{subreg}s:
22241debfc3dSmrg
22251debfc3dSmrg@smallexample
22261debfc3dSmrg(subreg:PSI (reg:DI 0) 0)
22271debfc3dSmrg(subreg:PSI (reg:DI 0) 4)
22281debfc3dSmrg@end smallexample
22291debfc3dSmrg
22301debfc3dSmrgrepresent independent 4-byte accesses to the two halves of
22311debfc3dSmrg@samp{(reg:DI 0)}.  Both @code{subreg}s have an unknown number
22321debfc3dSmrgof undefined bits.
22331debfc3dSmrg
2234a2dc1f3fSmrgIf @samp{REGMODE_NATURAL_SIZE (PSImode) <= 2} then these two @code{subreg}s:
22351debfc3dSmrg
22361debfc3dSmrg@smallexample
22371debfc3dSmrg(subreg:HI (reg:PSI 0) 0)
22381debfc3dSmrg(subreg:HI (reg:PSI 0) 2)
22391debfc3dSmrg@end smallexample
22401debfc3dSmrg
22411debfc3dSmrgrepresent independent 2-byte accesses that together span the whole
22421debfc3dSmrgof @samp{(reg:PSI 0)}.  Storing to the first @code{subreg} does not
22431debfc3dSmrgaffect the value of the second, and vice versa.  @samp{(reg:PSI 0)}
22441debfc3dSmrghas an unknown number of undefined bits, so the assignment:
22451debfc3dSmrg
22461debfc3dSmrg@smallexample
22471debfc3dSmrg(set (subreg:HI (reg:PSI 0) 0) (reg:HI 4))
22481debfc3dSmrg@end smallexample
22491debfc3dSmrg
22501debfc3dSmrgdoes not guarantee that @samp{(subreg:HI (reg:PSI 0) 0)} has the
22511debfc3dSmrgvalue @samp{(reg:HI 4)}.
22521debfc3dSmrg
2253a2dc1f3fSmrg@cindex @code{TARGET_CAN_CHANGE_MODE_CLASS} and subreg semantics
22541debfc3dSmrgThe rules above apply to both pseudo @var{reg}s and hard @var{reg}s.
22551debfc3dSmrgIf the semantics are not correct for particular combinations of
22561debfc3dSmrg@var{m1}, @var{m2} and hard @var{reg}, the target-specific code
22571debfc3dSmrgmust ensure that those combinations are never used.  For example:
22581debfc3dSmrg
22591debfc3dSmrg@smallexample
2260a2dc1f3fSmrgTARGET_CAN_CHANGE_MODE_CLASS (@var{m2}, @var{m1}, @var{class})
22611debfc3dSmrg@end smallexample
22621debfc3dSmrg
2263a2dc1f3fSmrgmust be false for every class @var{class} that includes @var{reg}.
2264a2dc1f3fSmrg
2265a2dc1f3fSmrgGCC must be able to determine at compile time whether a subreg is
2266a2dc1f3fSmrgparadoxical, whether it occupies a whole number of blocks, or whether
2267a2dc1f3fSmrgit is a lowpart of a block.  This means that certain combinations of
2268a2dc1f3fSmrgvariable-sized mode are not permitted.  For example, if @var{m2}
2269a2dc1f3fSmrgholds @var{n} @code{SI} values, where @var{n} is greater than zero,
2270a2dc1f3fSmrgit is not possible to form a @code{DI} @code{subreg} of it; such a
2271a2dc1f3fSmrg@code{subreg} would be paradoxical when @var{n} is 1 but not when
2272a2dc1f3fSmrg@var{n} is greater than 1.
22731debfc3dSmrg
22741debfc3dSmrg@findex SUBREG_REG
22751debfc3dSmrg@findex SUBREG_BYTE
22761debfc3dSmrgThe first operand of a @code{subreg} expression is customarily accessed
22771debfc3dSmrgwith the @code{SUBREG_REG} macro and the second operand is customarily
22781debfc3dSmrgaccessed with the @code{SUBREG_BYTE} macro.
22791debfc3dSmrg
22801debfc3dSmrgIt has been several years since a platform in which
22811debfc3dSmrg@code{BYTES_BIG_ENDIAN} not equal to @code{WORDS_BIG_ENDIAN} has
22821debfc3dSmrgbeen tested.  Anyone wishing to support such a platform in the future
22831debfc3dSmrgmay be confronted with code rot.
22841debfc3dSmrg
22851debfc3dSmrg@findex scratch
22861debfc3dSmrg@cindex scratch operands
22871debfc3dSmrg@item (scratch:@var{m})
22881debfc3dSmrgThis represents a scratch register that will be required for the
22891debfc3dSmrgexecution of a single instruction and not used subsequently.  It is
22901debfc3dSmrgconverted into a @code{reg} by either the local register allocator or
22911debfc3dSmrgthe reload pass.
22921debfc3dSmrg
22931debfc3dSmrg@code{scratch} is usually present inside a @code{clobber} operation
22941debfc3dSmrg(@pxref{Side Effects}).
22951debfc3dSmrg
22961debfc3dSmrg@findex cc0
22971debfc3dSmrg@cindex condition code register
22981debfc3dSmrg@item (cc0)
22991debfc3dSmrgThis refers to the machine's condition code register.  It has no
23001debfc3dSmrgoperands and may not have a machine mode.  There are two ways to use it:
23011debfc3dSmrg
23021debfc3dSmrg@itemize @bullet
23031debfc3dSmrg@item
23041debfc3dSmrgTo stand for a complete set of condition code flags.  This is best on
23051debfc3dSmrgmost machines, where each comparison sets the entire series of flags.
23061debfc3dSmrg
23071debfc3dSmrgWith this technique, @code{(cc0)} may be validly used in only two
23081debfc3dSmrgcontexts: as the destination of an assignment (in test and compare
23091debfc3dSmrginstructions) and in comparison operators comparing against zero
23101debfc3dSmrg(@code{const_int} with value zero; that is to say, @code{const0_rtx}).
23111debfc3dSmrg
23121debfc3dSmrg@item
23131debfc3dSmrgTo stand for a single flag that is the result of a single condition.
23141debfc3dSmrgThis is useful on machines that have only a single flag bit, and in
23151debfc3dSmrgwhich comparison instructions must specify the condition to test.
23161debfc3dSmrg
23171debfc3dSmrgWith this technique, @code{(cc0)} may be validly used in only two
23181debfc3dSmrgcontexts: as the destination of an assignment (in test and compare
23191debfc3dSmrginstructions) where the source is a comparison operator, and as the
23201debfc3dSmrgfirst operand of @code{if_then_else} (in a conditional branch).
23211debfc3dSmrg@end itemize
23221debfc3dSmrg
23231debfc3dSmrg@findex cc0_rtx
23241debfc3dSmrgThere is only one expression object of code @code{cc0}; it is the
23251debfc3dSmrgvalue of the variable @code{cc0_rtx}.  Any attempt to create an
23261debfc3dSmrgexpression of code @code{cc0} will return @code{cc0_rtx}.
23271debfc3dSmrg
23281debfc3dSmrgInstructions can set the condition code implicitly.  On many machines,
23291debfc3dSmrgnearly all instructions set the condition code based on the value that
23301debfc3dSmrgthey compute or store.  It is not necessary to record these actions
23311debfc3dSmrgexplicitly in the RTL because the machine description includes a
23321debfc3dSmrgprescription for recognizing the instructions that do so (by means of
23331debfc3dSmrgthe macro @code{NOTICE_UPDATE_CC}).  @xref{Condition Code}.  Only
23341debfc3dSmrginstructions whose sole purpose is to set the condition code, and
23351debfc3dSmrginstructions that use the condition code, need mention @code{(cc0)}.
23361debfc3dSmrg
23371debfc3dSmrgOn some machines, the condition code register is given a register number
23381debfc3dSmrgand a @code{reg} is used instead of @code{(cc0)}.  This is usually the
23391debfc3dSmrgpreferable approach if only a small subset of instructions modify the
23401debfc3dSmrgcondition code.  Other machines store condition codes in general
23411debfc3dSmrgregisters; in such cases a pseudo register should be used.
23421debfc3dSmrg
23431debfc3dSmrgSome machines, such as the SPARC and RS/6000, have two sets of
23441debfc3dSmrgarithmetic instructions, one that sets and one that does not set the
23451debfc3dSmrgcondition code.  This is best handled by normally generating the
23461debfc3dSmrginstruction that does not set the condition code, and making a pattern
23471debfc3dSmrgthat both performs the arithmetic and sets the condition code register
23481debfc3dSmrg(which would not be @code{(cc0)} in this case).  For examples, search
23491debfc3dSmrgfor @samp{addcc} and @samp{andcc} in @file{sparc.md}.
23501debfc3dSmrg
23511debfc3dSmrg@findex pc
23521debfc3dSmrg@item (pc)
23531debfc3dSmrg@cindex program counter
23541debfc3dSmrgThis represents the machine's program counter.  It has no operands and
23551debfc3dSmrgmay not have a machine mode.  @code{(pc)} may be validly used only in
23561debfc3dSmrgcertain specific contexts in jump instructions.
23571debfc3dSmrg
23581debfc3dSmrg@findex pc_rtx
23591debfc3dSmrgThere is only one expression object of code @code{pc}; it is the value
23601debfc3dSmrgof the variable @code{pc_rtx}.  Any attempt to create an expression of
23611debfc3dSmrgcode @code{pc} will return @code{pc_rtx}.
23621debfc3dSmrg
23631debfc3dSmrgAll instructions that do not jump alter the program counter implicitly
23641debfc3dSmrgby incrementing it, but there is no need to mention this in the RTL@.
23651debfc3dSmrg
23661debfc3dSmrg@findex mem
23671debfc3dSmrg@item (mem:@var{m} @var{addr} @var{alias})
23681debfc3dSmrgThis RTX represents a reference to main memory at an address
23691debfc3dSmrgrepresented by the expression @var{addr}.  @var{m} specifies how large
23701debfc3dSmrga unit of memory is accessed.  @var{alias} specifies an alias set for the
23711debfc3dSmrgreference.  In general two items are in different alias sets if they cannot
23721debfc3dSmrgreference the same memory address.
23731debfc3dSmrg
23741debfc3dSmrgThe construct @code{(mem:BLK (scratch))} is considered to alias all
23751debfc3dSmrgother memories.  Thus it may be used as a memory barrier in epilogue
23761debfc3dSmrgstack deallocation patterns.
23771debfc3dSmrg
23781debfc3dSmrg@findex concat
23791debfc3dSmrg@item (concat@var{m} @var{rtx} @var{rtx})
23801debfc3dSmrgThis RTX represents the concatenation of two other RTXs.  This is used
23811debfc3dSmrgfor complex values.  It should only appear in the RTL attached to
23821debfc3dSmrgdeclarations and during RTL generation.  It should not appear in the
23831debfc3dSmrgordinary insn chain.
23841debfc3dSmrg
23851debfc3dSmrg@findex concatn
23861debfc3dSmrg@item (concatn@var{m} [@var{rtx} @dots{}])
23871debfc3dSmrgThis RTX represents the concatenation of all the @var{rtx} to make a
23881debfc3dSmrgsingle value.  Like @code{concat}, this should only appear in
23891debfc3dSmrgdeclarations, and not in the insn chain.
23901debfc3dSmrg@end table
23911debfc3dSmrg
23921debfc3dSmrg@node Arithmetic
23931debfc3dSmrg@section RTL Expressions for Arithmetic
23941debfc3dSmrg@cindex arithmetic, in RTL
23951debfc3dSmrg@cindex math, in RTL
23961debfc3dSmrg@cindex RTL expressions for arithmetic
23971debfc3dSmrg
23981debfc3dSmrgUnless otherwise specified, all the operands of arithmetic expressions
23991debfc3dSmrgmust be valid for mode @var{m}.  An operand is valid for mode @var{m}
24001debfc3dSmrgif it has mode @var{m}, or if it is a @code{const_int} or
24011debfc3dSmrg@code{const_double} and @var{m} is a mode of class @code{MODE_INT}.
24021debfc3dSmrg
24031debfc3dSmrgFor commutative binary operations, constants should be placed in the
24041debfc3dSmrgsecond operand.
24051debfc3dSmrg
24061debfc3dSmrg@table @code
24071debfc3dSmrg@findex plus
24081debfc3dSmrg@findex ss_plus
24091debfc3dSmrg@findex us_plus
24101debfc3dSmrg@cindex RTL sum
24111debfc3dSmrg@cindex RTL addition
24121debfc3dSmrg@cindex RTL addition with signed saturation
24131debfc3dSmrg@cindex RTL addition with unsigned saturation
24141debfc3dSmrg@item (plus:@var{m} @var{x} @var{y})
24151debfc3dSmrg@itemx (ss_plus:@var{m} @var{x} @var{y})
24161debfc3dSmrg@itemx (us_plus:@var{m} @var{x} @var{y})
24171debfc3dSmrg
24181debfc3dSmrgThese three expressions all represent the sum of the values
24191debfc3dSmrgrepresented by @var{x} and @var{y} carried out in machine mode
24201debfc3dSmrg@var{m}.  They differ in their behavior on overflow of integer modes.
24211debfc3dSmrg@code{plus} wraps round modulo the width of @var{m}; @code{ss_plus}
24221debfc3dSmrgsaturates at the maximum signed value representable in @var{m};
24231debfc3dSmrg@code{us_plus} saturates at the maximum unsigned value.
24241debfc3dSmrg
24251debfc3dSmrg@c ??? What happens on overflow of floating point modes?
24261debfc3dSmrg
24271debfc3dSmrg@findex lo_sum
24281debfc3dSmrg@item (lo_sum:@var{m} @var{x} @var{y})
24291debfc3dSmrg
24301debfc3dSmrgThis expression represents the sum of @var{x} and the low-order bits
24311debfc3dSmrgof @var{y}.  It is used with @code{high} (@pxref{Constants}) to
2432c0a68be4Smrgrepresent the typical two-instruction sequence used in RISC machines to
2433c0a68be4Smrgreference large immediate values and/or link-time constants such
2434c0a68be4Smrgas global memory addresses.  In the latter case, @var{m} is @code{Pmode}
2435c0a68be4Smrgand @var{y} is usually a constant expression involving @code{symbol_ref}.
24361debfc3dSmrg
24371debfc3dSmrgThe number of low order bits is machine-dependent but is
2438c0a68be4Smrgnormally the number of bits in mode @var{m} minus the number of
24391debfc3dSmrgbits set by @code{high}.
24401debfc3dSmrg
24411debfc3dSmrg@findex minus
24421debfc3dSmrg@findex ss_minus
24431debfc3dSmrg@findex us_minus
24441debfc3dSmrg@cindex RTL difference
24451debfc3dSmrg@cindex RTL subtraction
24461debfc3dSmrg@cindex RTL subtraction with signed saturation
24471debfc3dSmrg@cindex RTL subtraction with unsigned saturation
24481debfc3dSmrg@item (minus:@var{m} @var{x} @var{y})
24491debfc3dSmrg@itemx (ss_minus:@var{m} @var{x} @var{y})
24501debfc3dSmrg@itemx (us_minus:@var{m} @var{x} @var{y})
24511debfc3dSmrg
24521debfc3dSmrgThese three expressions represent the result of subtracting @var{y}
24531debfc3dSmrgfrom @var{x}, carried out in mode @var{M}.  Behavior on overflow is
24541debfc3dSmrgthe same as for the three variants of @code{plus} (see above).
24551debfc3dSmrg
24561debfc3dSmrg@findex compare
24571debfc3dSmrg@cindex RTL comparison
24581debfc3dSmrg@item (compare:@var{m} @var{x} @var{y})
24591debfc3dSmrgRepresents the result of subtracting @var{y} from @var{x} for purposes
24601debfc3dSmrgof comparison.  The result is computed without overflow, as if with
24611debfc3dSmrginfinite precision.
24621debfc3dSmrg
24631debfc3dSmrgOf course, machines cannot really subtract with infinite precision.
24641debfc3dSmrgHowever, they can pretend to do so when only the sign of the result will
24651debfc3dSmrgbe used, which is the case when the result is stored in the condition
24661debfc3dSmrgcode.  And that is the @emph{only} way this kind of expression may
24671debfc3dSmrgvalidly be used: as a value to be stored in the condition codes, either
24681debfc3dSmrg@code{(cc0)} or a register.  @xref{Comparisons}.
24691debfc3dSmrg
24701debfc3dSmrgThe mode @var{m} is not related to the modes of @var{x} and @var{y}, but
24711debfc3dSmrginstead is the mode of the condition code value.  If @code{(cc0)} is
24721debfc3dSmrgused, it is @code{VOIDmode}.  Otherwise it is some mode in class
24731debfc3dSmrg@code{MODE_CC}, often @code{CCmode}.  @xref{Condition Code}.  If @var{m}
24741debfc3dSmrgis @code{VOIDmode} or @code{CCmode}, the operation returns sufficient
24751debfc3dSmrginformation (in an unspecified format) so that any comparison operator
24761debfc3dSmrgcan be applied to the result of the @code{COMPARE} operation.  For other
24771debfc3dSmrgmodes in class @code{MODE_CC}, the operation only returns a subset of
24781debfc3dSmrgthis information.
24791debfc3dSmrg
24801debfc3dSmrgNormally, @var{x} and @var{y} must have the same mode.  Otherwise,
24811debfc3dSmrg@code{compare} is valid only if the mode of @var{x} is in class
24821debfc3dSmrg@code{MODE_INT} and @var{y} is a @code{const_int} or
24831debfc3dSmrg@code{const_double} with mode @code{VOIDmode}.  The mode of @var{x}
24841debfc3dSmrgdetermines what mode the comparison is to be done in; thus it must not
24851debfc3dSmrgbe @code{VOIDmode}.
24861debfc3dSmrg
24871debfc3dSmrgIf one of the operands is a constant, it should be placed in the
24881debfc3dSmrgsecond operand and the comparison code adjusted as appropriate.
24891debfc3dSmrg
24901debfc3dSmrgA @code{compare} specifying two @code{VOIDmode} constants is not valid
24911debfc3dSmrgsince there is no way to know in what mode the comparison is to be
24921debfc3dSmrgperformed; the comparison must either be folded during the compilation
24931debfc3dSmrgor the first operand must be loaded into a register while its mode is
24941debfc3dSmrgstill known.
24951debfc3dSmrg
24961debfc3dSmrg@findex neg
24971debfc3dSmrg@findex ss_neg
24981debfc3dSmrg@findex us_neg
24991debfc3dSmrg@cindex negation
25001debfc3dSmrg@cindex negation with signed saturation
25011debfc3dSmrg@cindex negation with unsigned saturation
25021debfc3dSmrg@item (neg:@var{m} @var{x})
25031debfc3dSmrg@itemx (ss_neg:@var{m} @var{x})
25041debfc3dSmrg@itemx (us_neg:@var{m} @var{x})
25051debfc3dSmrgThese two expressions represent the negation (subtraction from zero) of
25061debfc3dSmrgthe value represented by @var{x}, carried out in mode @var{m}.  They
25071debfc3dSmrgdiffer in the behavior on overflow of integer modes.  In the case of
25081debfc3dSmrg@code{neg}, the negation of the operand may be a number not representable
25091debfc3dSmrgin mode @var{m}, in which case it is truncated to @var{m}.  @code{ss_neg}
25101debfc3dSmrgand @code{us_neg} ensure that an out-of-bounds result saturates to the
25111debfc3dSmrgmaximum or minimum signed or unsigned value.
25121debfc3dSmrg
25131debfc3dSmrg@findex mult
25141debfc3dSmrg@findex ss_mult
25151debfc3dSmrg@findex us_mult
25161debfc3dSmrg@cindex multiplication
25171debfc3dSmrg@cindex product
25181debfc3dSmrg@cindex multiplication with signed saturation
25191debfc3dSmrg@cindex multiplication with unsigned saturation
25201debfc3dSmrg@item (mult:@var{m} @var{x} @var{y})
25211debfc3dSmrg@itemx (ss_mult:@var{m} @var{x} @var{y})
25221debfc3dSmrg@itemx (us_mult:@var{m} @var{x} @var{y})
25231debfc3dSmrgRepresents the signed product of the values represented by @var{x} and
25241debfc3dSmrg@var{y} carried out in machine mode @var{m}.
25251debfc3dSmrg@code{ss_mult} and @code{us_mult} ensure that an out-of-bounds result
25261debfc3dSmrgsaturates to the maximum or minimum signed or unsigned value.
25271debfc3dSmrg
25281debfc3dSmrgSome machines support a multiplication that generates a product wider
25291debfc3dSmrgthan the operands.  Write the pattern for this as
25301debfc3dSmrg
25311debfc3dSmrg@smallexample
25321debfc3dSmrg(mult:@var{m} (sign_extend:@var{m} @var{x}) (sign_extend:@var{m} @var{y}))
25331debfc3dSmrg@end smallexample
25341debfc3dSmrg
25351debfc3dSmrgwhere @var{m} is wider than the modes of @var{x} and @var{y}, which need
25361debfc3dSmrgnot be the same.
25371debfc3dSmrg
25381debfc3dSmrgFor unsigned widening multiplication, use the same idiom, but with
25391debfc3dSmrg@code{zero_extend} instead of @code{sign_extend}.
25401debfc3dSmrg
25411debfc3dSmrg@findex fma
25421debfc3dSmrg@item (fma:@var{m} @var{x} @var{y} @var{z})
25431debfc3dSmrgRepresents the @code{fma}, @code{fmaf}, and @code{fmal} builtin
25441debfc3dSmrgfunctions, which compute @samp{@var{x} * @var{y} + @var{z}}
25451debfc3dSmrgwithout doing an intermediate rounding step.
25461debfc3dSmrg
25471debfc3dSmrg@findex div
25481debfc3dSmrg@findex ss_div
25491debfc3dSmrg@cindex division
25501debfc3dSmrg@cindex signed division
25511debfc3dSmrg@cindex signed division with signed saturation
25521debfc3dSmrg@cindex quotient
25531debfc3dSmrg@item (div:@var{m} @var{x} @var{y})
25541debfc3dSmrg@itemx (ss_div:@var{m} @var{x} @var{y})
25551debfc3dSmrgRepresents the quotient in signed division of @var{x} by @var{y},
25561debfc3dSmrgcarried out in machine mode @var{m}.  If @var{m} is a floating point
25571debfc3dSmrgmode, it represents the exact quotient; otherwise, the integerized
25581debfc3dSmrgquotient.
25591debfc3dSmrg@code{ss_div} ensures that an out-of-bounds result saturates to the maximum
25601debfc3dSmrgor minimum signed value.
25611debfc3dSmrg
25621debfc3dSmrgSome machines have division instructions in which the operands and
25631debfc3dSmrgquotient widths are not all the same; you should represent
25641debfc3dSmrgsuch instructions using @code{truncate} and @code{sign_extend} as in,
25651debfc3dSmrg
25661debfc3dSmrg@smallexample
25671debfc3dSmrg(truncate:@var{m1} (div:@var{m2} @var{x} (sign_extend:@var{m2} @var{y})))
25681debfc3dSmrg@end smallexample
25691debfc3dSmrg
25701debfc3dSmrg@findex udiv
25711debfc3dSmrg@cindex unsigned division
25721debfc3dSmrg@cindex unsigned division with unsigned saturation
25731debfc3dSmrg@cindex division
25741debfc3dSmrg@item (udiv:@var{m} @var{x} @var{y})
25751debfc3dSmrg@itemx (us_div:@var{m} @var{x} @var{y})
25761debfc3dSmrgLike @code{div} but represents unsigned division.
25771debfc3dSmrg@code{us_div} ensures that an out-of-bounds result saturates to the maximum
25781debfc3dSmrgor minimum unsigned value.
25791debfc3dSmrg
25801debfc3dSmrg@findex mod
25811debfc3dSmrg@findex umod
25821debfc3dSmrg@cindex remainder
25831debfc3dSmrg@cindex division
25841debfc3dSmrg@item (mod:@var{m} @var{x} @var{y})
25851debfc3dSmrg@itemx (umod:@var{m} @var{x} @var{y})
25861debfc3dSmrgLike @code{div} and @code{udiv} but represent the remainder instead of
25871debfc3dSmrgthe quotient.
25881debfc3dSmrg
25891debfc3dSmrg@findex smin
25901debfc3dSmrg@findex smax
25911debfc3dSmrg@cindex signed minimum
25921debfc3dSmrg@cindex signed maximum
25931debfc3dSmrg@item (smin:@var{m} @var{x} @var{y})
25941debfc3dSmrg@itemx (smax:@var{m} @var{x} @var{y})
25951debfc3dSmrgRepresents the smaller (for @code{smin}) or larger (for @code{smax}) of
25961debfc3dSmrg@var{x} and @var{y}, interpreted as signed values in mode @var{m}.
25971debfc3dSmrgWhen used with floating point, if both operands are zeros, or if either
25981debfc3dSmrgoperand is @code{NaN}, then it is unspecified which of the two operands
25991debfc3dSmrgis returned as the result.
26001debfc3dSmrg
26011debfc3dSmrg@findex umin
26021debfc3dSmrg@findex umax
26031debfc3dSmrg@cindex unsigned minimum and maximum
26041debfc3dSmrg@item (umin:@var{m} @var{x} @var{y})
26051debfc3dSmrg@itemx (umax:@var{m} @var{x} @var{y})
26061debfc3dSmrgLike @code{smin} and @code{smax}, but the values are interpreted as unsigned
26071debfc3dSmrgintegers.
26081debfc3dSmrg
26091debfc3dSmrg@findex not
26101debfc3dSmrg@cindex complement, bitwise
26111debfc3dSmrg@cindex bitwise complement
26121debfc3dSmrg@item (not:@var{m} @var{x})
26131debfc3dSmrgRepresents the bitwise complement of the value represented by @var{x},
26141debfc3dSmrgcarried out in mode @var{m}, which must be a fixed-point machine mode.
26151debfc3dSmrg
26161debfc3dSmrg@findex and
26171debfc3dSmrg@cindex logical-and, bitwise
26181debfc3dSmrg@cindex bitwise logical-and
26191debfc3dSmrg@item (and:@var{m} @var{x} @var{y})
26201debfc3dSmrgRepresents the bitwise logical-and of the values represented by
26211debfc3dSmrg@var{x} and @var{y}, carried out in machine mode @var{m}, which must be
26221debfc3dSmrga fixed-point machine mode.
26231debfc3dSmrg
26241debfc3dSmrg@findex ior
26251debfc3dSmrg@cindex inclusive-or, bitwise
26261debfc3dSmrg@cindex bitwise inclusive-or
26271debfc3dSmrg@item (ior:@var{m} @var{x} @var{y})
26281debfc3dSmrgRepresents the bitwise inclusive-or of the values represented by @var{x}
26291debfc3dSmrgand @var{y}, carried out in machine mode @var{m}, which must be a
26301debfc3dSmrgfixed-point mode.
26311debfc3dSmrg
26321debfc3dSmrg@findex xor
26331debfc3dSmrg@cindex exclusive-or, bitwise
26341debfc3dSmrg@cindex bitwise exclusive-or
26351debfc3dSmrg@item (xor:@var{m} @var{x} @var{y})
26361debfc3dSmrgRepresents the bitwise exclusive-or of the values represented by @var{x}
26371debfc3dSmrgand @var{y}, carried out in machine mode @var{m}, which must be a
26381debfc3dSmrgfixed-point mode.
26391debfc3dSmrg
26401debfc3dSmrg@findex ashift
26411debfc3dSmrg@findex ss_ashift
26421debfc3dSmrg@findex us_ashift
26431debfc3dSmrg@cindex left shift
26441debfc3dSmrg@cindex shift
26451debfc3dSmrg@cindex arithmetic shift
26461debfc3dSmrg@cindex arithmetic shift with signed saturation
26471debfc3dSmrg@cindex arithmetic shift with unsigned saturation
26481debfc3dSmrg@item (ashift:@var{m} @var{x} @var{c})
26491debfc3dSmrg@itemx (ss_ashift:@var{m} @var{x} @var{c})
26501debfc3dSmrg@itemx (us_ashift:@var{m} @var{x} @var{c})
26511debfc3dSmrgThese three expressions represent the result of arithmetically shifting @var{x}
26521debfc3dSmrgleft by @var{c} places.  They differ in their behavior on overflow of integer
26531debfc3dSmrgmodes.  An @code{ashift} operation is a plain shift with no special behavior
26541debfc3dSmrgin case of a change in the sign bit; @code{ss_ashift} and @code{us_ashift}
26551debfc3dSmrgsaturates to the minimum or maximum representable value if any of the bits
26561debfc3dSmrgshifted out differs from the final sign bit.
26571debfc3dSmrg
26581debfc3dSmrg@var{x} have mode @var{m}, a fixed-point machine mode.  @var{c}
26591debfc3dSmrgbe a fixed-point mode or be a constant with mode @code{VOIDmode}; which
26601debfc3dSmrgmode is determined by the mode called for in the machine description
26611debfc3dSmrgentry for the left-shift instruction.  For example, on the VAX, the mode
26621debfc3dSmrgof @var{c} is @code{QImode} regardless of @var{m}.
26631debfc3dSmrg
26641debfc3dSmrg@findex lshiftrt
26651debfc3dSmrg@cindex right shift
26661debfc3dSmrg@findex ashiftrt
26671debfc3dSmrg@item (lshiftrt:@var{m} @var{x} @var{c})
26681debfc3dSmrg@itemx (ashiftrt:@var{m} @var{x} @var{c})
26691debfc3dSmrgLike @code{ashift} but for right shift.  Unlike the case for left shift,
26701debfc3dSmrgthese two operations are distinct.
26711debfc3dSmrg
26721debfc3dSmrg@findex rotate
26731debfc3dSmrg@cindex rotate
26741debfc3dSmrg@cindex left rotate
26751debfc3dSmrg@findex rotatert
26761debfc3dSmrg@cindex right rotate
26771debfc3dSmrg@item (rotate:@var{m} @var{x} @var{c})
26781debfc3dSmrg@itemx (rotatert:@var{m} @var{x} @var{c})
26791debfc3dSmrgSimilar but represent left and right rotate.  If @var{c} is a constant,
26801debfc3dSmrguse @code{rotate}.
26811debfc3dSmrg
26821debfc3dSmrg@findex abs
26831debfc3dSmrg@findex ss_abs
26841debfc3dSmrg@cindex absolute value
26851debfc3dSmrg@item (abs:@var{m} @var{x})
26861debfc3dSmrg@item (ss_abs:@var{m} @var{x})
26871debfc3dSmrgRepresents the absolute value of @var{x}, computed in mode @var{m}.
26881debfc3dSmrg@code{ss_abs} ensures that an out-of-bounds result saturates to the
26891debfc3dSmrgmaximum signed value.
26901debfc3dSmrg
26911debfc3dSmrg
26921debfc3dSmrg@findex sqrt
26931debfc3dSmrg@cindex square root
26941debfc3dSmrg@item (sqrt:@var{m} @var{x})
26951debfc3dSmrgRepresents the square root of @var{x}, computed in mode @var{m}.
26961debfc3dSmrgMost often @var{m} will be a floating point mode.
26971debfc3dSmrg
26981debfc3dSmrg@findex ffs
26991debfc3dSmrg@item (ffs:@var{m} @var{x})
27001debfc3dSmrgRepresents one plus the index of the least significant 1-bit in
27011debfc3dSmrg@var{x}, represented as an integer of mode @var{m}.  (The value is
27021debfc3dSmrgzero if @var{x} is zero.)  The mode of @var{x} must be @var{m}
27031debfc3dSmrgor @code{VOIDmode}.
27041debfc3dSmrg
27051debfc3dSmrg@findex clrsb
27061debfc3dSmrg@item (clrsb:@var{m} @var{x})
27071debfc3dSmrgRepresents the number of redundant leading sign bits in @var{x},
27081debfc3dSmrgrepresented as an integer of mode @var{m}, starting at the most
27091debfc3dSmrgsignificant bit position.  This is one less than the number of leading
27101debfc3dSmrgsign bits (either 0 or 1), with no special cases.  The mode of @var{x}
27111debfc3dSmrgmust be @var{m} or @code{VOIDmode}.
27121debfc3dSmrg
27131debfc3dSmrg@findex clz
27141debfc3dSmrg@item (clz:@var{m} @var{x})
27151debfc3dSmrgRepresents the number of leading 0-bits in @var{x}, represented as an
27161debfc3dSmrginteger of mode @var{m}, starting at the most significant bit position.
27171debfc3dSmrgIf @var{x} is zero, the value is determined by
27181debfc3dSmrg@code{CLZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}).  Note that this is one of
27191debfc3dSmrgthe few expressions that is not invariant under widening.  The mode of
27201debfc3dSmrg@var{x} must be @var{m} or @code{VOIDmode}.
27211debfc3dSmrg
27221debfc3dSmrg@findex ctz
27231debfc3dSmrg@item (ctz:@var{m} @var{x})
27241debfc3dSmrgRepresents the number of trailing 0-bits in @var{x}, represented as an
27251debfc3dSmrginteger of mode @var{m}, starting at the least significant bit position.
27261debfc3dSmrgIf @var{x} is zero, the value is determined by
27271debfc3dSmrg@code{CTZ_DEFINED_VALUE_AT_ZERO} (@pxref{Misc}).  Except for this case,
27281debfc3dSmrg@code{ctz(x)} is equivalent to @code{ffs(@var{x}) - 1}.  The mode of
27291debfc3dSmrg@var{x} must be @var{m} or @code{VOIDmode}.
27301debfc3dSmrg
27311debfc3dSmrg@findex popcount
27321debfc3dSmrg@item (popcount:@var{m} @var{x})
27331debfc3dSmrgRepresents the number of 1-bits in @var{x}, represented as an integer of
27341debfc3dSmrgmode @var{m}.  The mode of @var{x} must be @var{m} or @code{VOIDmode}.
27351debfc3dSmrg
27361debfc3dSmrg@findex parity
27371debfc3dSmrg@item (parity:@var{m} @var{x})
27381debfc3dSmrgRepresents the number of 1-bits modulo 2 in @var{x}, represented as an
27391debfc3dSmrginteger of mode @var{m}.  The mode of @var{x} must be @var{m} or
27401debfc3dSmrg@code{VOIDmode}.
27411debfc3dSmrg
27421debfc3dSmrg@findex bswap
27431debfc3dSmrg@item (bswap:@var{m} @var{x})
27441debfc3dSmrgRepresents the value @var{x} with the order of bytes reversed, carried out
27451debfc3dSmrgin mode @var{m}, which must be a fixed-point machine mode.
27461debfc3dSmrgThe mode of @var{x} must be @var{m} or @code{VOIDmode}.
27471debfc3dSmrg@end table
27481debfc3dSmrg
27491debfc3dSmrg@node Comparisons
27501debfc3dSmrg@section Comparison Operations
27511debfc3dSmrg@cindex RTL comparison operations
27521debfc3dSmrg
27531debfc3dSmrgComparison operators test a relation on two operands and are considered
27541debfc3dSmrgto represent a machine-dependent nonzero value described by, but not
27551debfc3dSmrgnecessarily equal to, @code{STORE_FLAG_VALUE} (@pxref{Misc})
27561debfc3dSmrgif the relation holds, or zero if it does not, for comparison operators
27571debfc3dSmrgwhose results have a `MODE_INT' mode,
27581debfc3dSmrg@code{FLOAT_STORE_FLAG_VALUE} (@pxref{Misc}) if the relation holds, or
27591debfc3dSmrgzero if it does not, for comparison operators that return floating-point
27601debfc3dSmrgvalues, and a vector of either @code{VECTOR_STORE_FLAG_VALUE} (@pxref{Misc})
27611debfc3dSmrgif the relation holds, or of zeros if it does not, for comparison operators
27621debfc3dSmrgthat return vector results.
27631debfc3dSmrgThe mode of the comparison operation is independent of the mode
27641debfc3dSmrgof the data being compared.  If the comparison operation is being tested
27651debfc3dSmrg(e.g., the first operand of an @code{if_then_else}), the mode must be
27661debfc3dSmrg@code{VOIDmode}.
27671debfc3dSmrg
27681debfc3dSmrg@cindex condition codes
27691debfc3dSmrgThere are two ways that comparison operations may be used.  The
27701debfc3dSmrgcomparison operators may be used to compare the condition codes
27711debfc3dSmrg@code{(cc0)} against zero, as in @code{(eq (cc0) (const_int 0))}.  Such
27721debfc3dSmrga construct actually refers to the result of the preceding instruction
27731debfc3dSmrgin which the condition codes were set.  The instruction setting the
27741debfc3dSmrgcondition code must be adjacent to the instruction using the condition
27751debfc3dSmrgcode; only @code{note} insns may separate them.
27761debfc3dSmrg
27771debfc3dSmrgAlternatively, a comparison operation may directly compare two data
27781debfc3dSmrgobjects.  The mode of the comparison is determined by the operands; they
27791debfc3dSmrgmust both be valid for a common machine mode.  A comparison with both
27801debfc3dSmrgoperands constant would be invalid as the machine mode could not be
27811debfc3dSmrgdeduced from it, but such a comparison should never exist in RTL due to
27821debfc3dSmrgconstant folding.
27831debfc3dSmrg
27841debfc3dSmrgIn the example above, if @code{(cc0)} were last set to
27851debfc3dSmrg@code{(compare @var{x} @var{y})}, the comparison operation is
27861debfc3dSmrgidentical to @code{(eq @var{x} @var{y})}.  Usually only one style
27871debfc3dSmrgof comparisons is supported on a particular machine, but the combine
27881debfc3dSmrgpass will try to merge the operations to produce the @code{eq} shown
27891debfc3dSmrgin case it exists in the context of the particular insn involved.
27901debfc3dSmrg
27911debfc3dSmrgInequality comparisons come in two flavors, signed and unsigned.  Thus,
27921debfc3dSmrgthere are distinct expression codes @code{gt} and @code{gtu} for signed and
27931debfc3dSmrgunsigned greater-than.  These can produce different results for the same
27941debfc3dSmrgpair of integer values: for example, 1 is signed greater-than @minus{}1 but not
27951debfc3dSmrgunsigned greater-than, because @minus{}1 when regarded as unsigned is actually
27961debfc3dSmrg@code{0xffffffff} which is greater than 1.
27971debfc3dSmrg
27981debfc3dSmrgThe signed comparisons are also used for floating point values.  Floating
27991debfc3dSmrgpoint comparisons are distinguished by the machine modes of the operands.
28001debfc3dSmrg
28011debfc3dSmrg@table @code
28021debfc3dSmrg@findex eq
28031debfc3dSmrg@cindex equal
28041debfc3dSmrg@item (eq:@var{m} @var{x} @var{y})
28051debfc3dSmrg@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y}
28061debfc3dSmrgare equal, otherwise 0.
28071debfc3dSmrg
28081debfc3dSmrg@findex ne
28091debfc3dSmrg@cindex not equal
28101debfc3dSmrg@item (ne:@var{m} @var{x} @var{y})
28111debfc3dSmrg@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y}
28121debfc3dSmrgare not equal, otherwise 0.
28131debfc3dSmrg
28141debfc3dSmrg@findex gt
28151debfc3dSmrg@cindex greater than
28161debfc3dSmrg@item (gt:@var{m} @var{x} @var{y})
28171debfc3dSmrg@code{STORE_FLAG_VALUE} if the @var{x} is greater than @var{y}.  If they
28181debfc3dSmrgare fixed-point, the comparison is done in a signed sense.
28191debfc3dSmrg
28201debfc3dSmrg@findex gtu
28211debfc3dSmrg@cindex greater than
28221debfc3dSmrg@cindex unsigned greater than
28231debfc3dSmrg@item (gtu:@var{m} @var{x} @var{y})
28241debfc3dSmrgLike @code{gt} but does unsigned comparison, on fixed-point numbers only.
28251debfc3dSmrg
28261debfc3dSmrg@findex lt
28271debfc3dSmrg@cindex less than
28281debfc3dSmrg@findex ltu
28291debfc3dSmrg@cindex unsigned less than
28301debfc3dSmrg@item (lt:@var{m} @var{x} @var{y})
28311debfc3dSmrg@itemx (ltu:@var{m} @var{x} @var{y})
28321debfc3dSmrgLike @code{gt} and @code{gtu} but test for ``less than''.
28331debfc3dSmrg
28341debfc3dSmrg@findex ge
28351debfc3dSmrg@cindex greater than
28361debfc3dSmrg@findex geu
28371debfc3dSmrg@cindex unsigned greater than
28381debfc3dSmrg@item (ge:@var{m} @var{x} @var{y})
28391debfc3dSmrg@itemx (geu:@var{m} @var{x} @var{y})
28401debfc3dSmrgLike @code{gt} and @code{gtu} but test for ``greater than or equal''.
28411debfc3dSmrg
28421debfc3dSmrg@findex le
28431debfc3dSmrg@cindex less than or equal
28441debfc3dSmrg@findex leu
28451debfc3dSmrg@cindex unsigned less than
28461debfc3dSmrg@item (le:@var{m} @var{x} @var{y})
28471debfc3dSmrg@itemx (leu:@var{m} @var{x} @var{y})
28481debfc3dSmrgLike @code{gt} and @code{gtu} but test for ``less than or equal''.
28491debfc3dSmrg
28501debfc3dSmrg@findex if_then_else
28511debfc3dSmrg@item (if_then_else @var{cond} @var{then} @var{else})
28521debfc3dSmrgThis is not a comparison operation but is listed here because it is
28531debfc3dSmrgalways used in conjunction with a comparison operation.  To be
28541debfc3dSmrgprecise, @var{cond} is a comparison expression.  This expression
28551debfc3dSmrgrepresents a choice, according to @var{cond}, between the value
28561debfc3dSmrgrepresented by @var{then} and the one represented by @var{else}.
28571debfc3dSmrg
28581debfc3dSmrgOn most machines, @code{if_then_else} expressions are valid only
28591debfc3dSmrgto express conditional jumps.
28601debfc3dSmrg
28611debfc3dSmrg@findex cond
28621debfc3dSmrg@item (cond [@var{test1} @var{value1} @var{test2} @var{value2} @dots{}] @var{default})
28631debfc3dSmrgSimilar to @code{if_then_else}, but more general.  Each of @var{test1},
28641debfc3dSmrg@var{test2}, @dots{} is performed in turn.  The result of this expression is
28651debfc3dSmrgthe @var{value} corresponding to the first nonzero test, or @var{default} if
28661debfc3dSmrgnone of the tests are nonzero expressions.
28671debfc3dSmrg
28681debfc3dSmrgThis is currently not valid for instruction patterns and is supported only
28691debfc3dSmrgfor insn attributes.  @xref{Insn Attributes}.
28701debfc3dSmrg@end table
28711debfc3dSmrg
28721debfc3dSmrg@node Bit-Fields
28731debfc3dSmrg@section Bit-Fields
28741debfc3dSmrg@cindex bit-fields
28751debfc3dSmrg
28761debfc3dSmrgSpecial expression codes exist to represent bit-field instructions.
28771debfc3dSmrg
28781debfc3dSmrg@table @code
28791debfc3dSmrg@findex sign_extract
28801debfc3dSmrg@cindex @code{BITS_BIG_ENDIAN}, effect on @code{sign_extract}
28811debfc3dSmrg@item (sign_extract:@var{m} @var{loc} @var{size} @var{pos})
28821debfc3dSmrgThis represents a reference to a sign-extended bit-field contained or
28831debfc3dSmrgstarting in @var{loc} (a memory or register reference).  The bit-field
28841debfc3dSmrgis @var{size} bits wide and starts at bit @var{pos}.  The compilation
28851debfc3dSmrgoption @code{BITS_BIG_ENDIAN} says which end of the memory unit
28861debfc3dSmrg@var{pos} counts from.
28871debfc3dSmrg
28881debfc3dSmrgIf @var{loc} is in memory, its mode must be a single-byte integer mode.
28891debfc3dSmrgIf @var{loc} is in a register, the mode to use is specified by the
28901debfc3dSmrgoperand of the @code{insv} or @code{extv} pattern
28911debfc3dSmrg(@pxref{Standard Names}) and is usually a full-word integer mode,
28921debfc3dSmrgwhich is the default if none is specified.
28931debfc3dSmrg
28941debfc3dSmrgThe mode of @var{pos} is machine-specific and is also specified
28951debfc3dSmrgin the @code{insv} or @code{extv} pattern.
28961debfc3dSmrg
28971debfc3dSmrgThe mode @var{m} is the same as the mode that would be used for
28981debfc3dSmrg@var{loc} if it were a register.
28991debfc3dSmrg
29001debfc3dSmrgA @code{sign_extract} cannot appear as an lvalue, or part thereof,
29011debfc3dSmrgin RTL.
29021debfc3dSmrg
29031debfc3dSmrg@findex zero_extract
29041debfc3dSmrg@item (zero_extract:@var{m} @var{loc} @var{size} @var{pos})
29051debfc3dSmrgLike @code{sign_extract} but refers to an unsigned or zero-extended
29061debfc3dSmrgbit-field.  The same sequence of bits are extracted, but they
29071debfc3dSmrgare filled to an entire word with zeros instead of by sign-extension.
29081debfc3dSmrg
29091debfc3dSmrgUnlike @code{sign_extract}, this type of expressions can be lvalues
29101debfc3dSmrgin RTL; they may appear on the left side of an assignment, indicating
29111debfc3dSmrginsertion of a value into the specified bit-field.
29121debfc3dSmrg@end table
29131debfc3dSmrg
29141debfc3dSmrg@node Vector Operations
29151debfc3dSmrg@section Vector Operations
29161debfc3dSmrg@cindex vector operations
29171debfc3dSmrg
29181debfc3dSmrgAll normal RTL expressions can be used with vector modes; they are
29191debfc3dSmrginterpreted as operating on each part of the vector independently.
29201debfc3dSmrgAdditionally, there are a few new expressions to describe specific vector
29211debfc3dSmrgoperations.
29221debfc3dSmrg
29231debfc3dSmrg@table @code
29241debfc3dSmrg@findex vec_merge
29251debfc3dSmrg@item (vec_merge:@var{m} @var{vec1} @var{vec2} @var{items})
29261debfc3dSmrgThis describes a merge operation between two vectors.  The result is a vector
29271debfc3dSmrgof mode @var{m}; its elements are selected from either @var{vec1} or
29281debfc3dSmrg@var{vec2}.  Which elements are selected is described by @var{items}, which
29291debfc3dSmrgis a bit mask represented by a @code{const_int}; a zero bit indicates the
29301debfc3dSmrgcorresponding element in the result vector is taken from @var{vec2} while
29311debfc3dSmrga set bit indicates it is taken from @var{vec1}.
29321debfc3dSmrg
29331debfc3dSmrg@findex vec_select
29341debfc3dSmrg@item (vec_select:@var{m} @var{vec1} @var{selection})
29351debfc3dSmrgThis describes an operation that selects parts of a vector.  @var{vec1} is
29361debfc3dSmrgthe source vector, and @var{selection} is a @code{parallel} that contains a
2937c0a68be4Smrg@code{const_int} (or another expression, if the selection can be made at
2938c0a68be4Smrgruntime) for each of the subparts of the result vector, giving the number of
2939c0a68be4Smrgthe source subpart that should be stored into it.  The result mode @var{m} is
2940c0a68be4Smrgeither the submode for a single element of @var{vec1} (if only one subpart is
2941c0a68be4Smrgselected), or another vector mode with that element submode (if multiple
2942c0a68be4Smrgsubparts are selected).
29431debfc3dSmrg
29441debfc3dSmrg@findex vec_concat
29451debfc3dSmrg@item (vec_concat:@var{m} @var{x1} @var{x2})
29461debfc3dSmrgDescribes a vector concat operation.  The result is a concatenation of the
29471debfc3dSmrgvectors or scalars @var{x1} and @var{x2}; its length is the sum of the
29481debfc3dSmrglengths of the two inputs.
29491debfc3dSmrg
29501debfc3dSmrg@findex vec_duplicate
29511debfc3dSmrg@item (vec_duplicate:@var{m} @var{x})
29521debfc3dSmrgThis operation converts a scalar into a vector or a small vector into a
29531debfc3dSmrglarger one by duplicating the input values.  The output vector mode must have
29541debfc3dSmrgthe same submodes as the input vector mode or the scalar modes, and the
29551debfc3dSmrgnumber of output parts must be an integer multiple of the number of input
29561debfc3dSmrgparts.
29571debfc3dSmrg
2958a2dc1f3fSmrg@findex vec_series
2959a2dc1f3fSmrg@item (vec_series:@var{m} @var{base} @var{step})
2960a2dc1f3fSmrgThis operation creates a vector in which element @var{i} is equal to
2961a2dc1f3fSmrg@samp{@var{base} + @var{i}*@var{step}}.  @var{m} must be a vector integer mode.
29621debfc3dSmrg@end table
29631debfc3dSmrg
29641debfc3dSmrg@node Conversions
29651debfc3dSmrg@section Conversions
29661debfc3dSmrg@cindex conversions
29671debfc3dSmrg@cindex machine mode conversions
29681debfc3dSmrg
29691debfc3dSmrgAll conversions between machine modes must be represented by
29701debfc3dSmrgexplicit conversion operations.  For example, an expression
29711debfc3dSmrgwhich is the sum of a byte and a full word cannot be written as
29721debfc3dSmrg@code{(plus:SI (reg:QI 34) (reg:SI 80))} because the @code{plus}
29731debfc3dSmrgoperation requires two operands of the same machine mode.
29741debfc3dSmrgTherefore, the byte-sized operand is enclosed in a conversion
29751debfc3dSmrgoperation, as in
29761debfc3dSmrg
29771debfc3dSmrg@smallexample
29781debfc3dSmrg(plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
29791debfc3dSmrg@end smallexample
29801debfc3dSmrg
29811debfc3dSmrgThe conversion operation is not a mere placeholder, because there
29821debfc3dSmrgmay be more than one way of converting from a given starting mode
29831debfc3dSmrgto the desired final mode.  The conversion operation code says how
29841debfc3dSmrgto do it.
29851debfc3dSmrg
29861debfc3dSmrgFor all conversion operations, @var{x} must not be @code{VOIDmode}
29871debfc3dSmrgbecause the mode in which to do the conversion would not be known.
29881debfc3dSmrgThe conversion must either be done at compile-time or @var{x}
29891debfc3dSmrgmust be placed into a register.
29901debfc3dSmrg
29911debfc3dSmrg@table @code
29921debfc3dSmrg@findex sign_extend
29931debfc3dSmrg@item (sign_extend:@var{m} @var{x})
29941debfc3dSmrgRepresents the result of sign-extending the value @var{x}
29951debfc3dSmrgto machine mode @var{m}.  @var{m} must be a fixed-point mode
29961debfc3dSmrgand @var{x} a fixed-point value of a mode narrower than @var{m}.
29971debfc3dSmrg
29981debfc3dSmrg@findex zero_extend
29991debfc3dSmrg@item (zero_extend:@var{m} @var{x})
30001debfc3dSmrgRepresents the result of zero-extending the value @var{x}
30011debfc3dSmrgto machine mode @var{m}.  @var{m} must be a fixed-point mode
30021debfc3dSmrgand @var{x} a fixed-point value of a mode narrower than @var{m}.
30031debfc3dSmrg
30041debfc3dSmrg@findex float_extend
30051debfc3dSmrg@item (float_extend:@var{m} @var{x})
30061debfc3dSmrgRepresents the result of extending the value @var{x}
30071debfc3dSmrgto machine mode @var{m}.  @var{m} must be a floating point mode
30081debfc3dSmrgand @var{x} a floating point value of a mode narrower than @var{m}.
30091debfc3dSmrg
30101debfc3dSmrg@findex truncate
30111debfc3dSmrg@item (truncate:@var{m} @var{x})
30121debfc3dSmrgRepresents the result of truncating the value @var{x}
30131debfc3dSmrgto machine mode @var{m}.  @var{m} must be a fixed-point mode
30141debfc3dSmrgand @var{x} a fixed-point value of a mode wider than @var{m}.
30151debfc3dSmrg
30161debfc3dSmrg@findex ss_truncate
30171debfc3dSmrg@item (ss_truncate:@var{m} @var{x})
30181debfc3dSmrgRepresents the result of truncating the value @var{x}
30191debfc3dSmrgto machine mode @var{m}, using signed saturation in the case of
30201debfc3dSmrgoverflow.  Both @var{m} and the mode of @var{x} must be fixed-point
30211debfc3dSmrgmodes.
30221debfc3dSmrg
30231debfc3dSmrg@findex us_truncate
30241debfc3dSmrg@item (us_truncate:@var{m} @var{x})
30251debfc3dSmrgRepresents the result of truncating the value @var{x}
30261debfc3dSmrgto machine mode @var{m}, using unsigned saturation in the case of
30271debfc3dSmrgoverflow.  Both @var{m} and the mode of @var{x} must be fixed-point
30281debfc3dSmrgmodes.
30291debfc3dSmrg
30301debfc3dSmrg@findex float_truncate
30311debfc3dSmrg@item (float_truncate:@var{m} @var{x})
30321debfc3dSmrgRepresents the result of truncating the value @var{x}
30331debfc3dSmrgto machine mode @var{m}.  @var{m} must be a floating point mode
30341debfc3dSmrgand @var{x} a floating point value of a mode wider than @var{m}.
30351debfc3dSmrg
30361debfc3dSmrg@findex float
30371debfc3dSmrg@item (float:@var{m} @var{x})
30381debfc3dSmrgRepresents the result of converting fixed point value @var{x},
30391debfc3dSmrgregarded as signed, to floating point mode @var{m}.
30401debfc3dSmrg
30411debfc3dSmrg@findex unsigned_float
30421debfc3dSmrg@item (unsigned_float:@var{m} @var{x})
30431debfc3dSmrgRepresents the result of converting fixed point value @var{x},
30441debfc3dSmrgregarded as unsigned, to floating point mode @var{m}.
30451debfc3dSmrg
30461debfc3dSmrg@findex fix
30471debfc3dSmrg@item (fix:@var{m} @var{x})
30481debfc3dSmrgWhen @var{m} is a floating-point mode, represents the result of
30491debfc3dSmrgconverting floating point value @var{x} (valid for mode @var{m}) to an
30501debfc3dSmrginteger, still represented in floating point mode @var{m}, by rounding
30511debfc3dSmrgtowards zero.
30521debfc3dSmrg
30531debfc3dSmrgWhen @var{m} is a fixed-point mode, represents the result of
30541debfc3dSmrgconverting floating point value @var{x} to mode @var{m}, regarded as
30551debfc3dSmrgsigned.  How rounding is done is not specified, so this operation may
30561debfc3dSmrgbe used validly in compiling C code only for integer-valued operands.
30571debfc3dSmrg
30581debfc3dSmrg@findex unsigned_fix
30591debfc3dSmrg@item (unsigned_fix:@var{m} @var{x})
30601debfc3dSmrgRepresents the result of converting floating point value @var{x} to
30611debfc3dSmrgfixed point mode @var{m}, regarded as unsigned.  How rounding is done
30621debfc3dSmrgis not specified.
30631debfc3dSmrg
30641debfc3dSmrg@findex fract_convert
30651debfc3dSmrg@item (fract_convert:@var{m} @var{x})
30661debfc3dSmrgRepresents the result of converting fixed-point value @var{x} to
30671debfc3dSmrgfixed-point mode @var{m}, signed integer value @var{x} to
30681debfc3dSmrgfixed-point mode @var{m}, floating-point value @var{x} to
30691debfc3dSmrgfixed-point mode @var{m}, fixed-point value @var{x} to integer mode @var{m}
30701debfc3dSmrgregarded as signed, or fixed-point value @var{x} to floating-point mode @var{m}.
30711debfc3dSmrgWhen overflows or underflows happen, the results are undefined.
30721debfc3dSmrg
30731debfc3dSmrg@findex sat_fract
30741debfc3dSmrg@item (sat_fract:@var{m} @var{x})
30751debfc3dSmrgRepresents the result of converting fixed-point value @var{x} to
30761debfc3dSmrgfixed-point mode @var{m}, signed integer value @var{x} to
30771debfc3dSmrgfixed-point mode @var{m}, or floating-point value @var{x} to
30781debfc3dSmrgfixed-point mode @var{m}.
30791debfc3dSmrgWhen overflows or underflows happen, the results are saturated to the
30801debfc3dSmrgmaximum or the minimum.
30811debfc3dSmrg
30821debfc3dSmrg@findex unsigned_fract_convert
30831debfc3dSmrg@item (unsigned_fract_convert:@var{m} @var{x})
30841debfc3dSmrgRepresents the result of converting fixed-point value @var{x} to
30851debfc3dSmrginteger mode @var{m} regarded as unsigned, or unsigned integer value @var{x} to
30861debfc3dSmrgfixed-point mode @var{m}.
30871debfc3dSmrgWhen overflows or underflows happen, the results are undefined.
30881debfc3dSmrg
30891debfc3dSmrg@findex unsigned_sat_fract
30901debfc3dSmrg@item (unsigned_sat_fract:@var{m} @var{x})
30911debfc3dSmrgRepresents the result of converting unsigned integer value @var{x} to
30921debfc3dSmrgfixed-point mode @var{m}.
30931debfc3dSmrgWhen overflows or underflows happen, the results are saturated to the
30941debfc3dSmrgmaximum or the minimum.
30951debfc3dSmrg@end table
30961debfc3dSmrg
30971debfc3dSmrg@node RTL Declarations
30981debfc3dSmrg@section Declarations
30991debfc3dSmrg@cindex RTL declarations
31001debfc3dSmrg@cindex declarations, RTL
31011debfc3dSmrg
31021debfc3dSmrgDeclaration expression codes do not represent arithmetic operations
31031debfc3dSmrgbut rather state assertions about their operands.
31041debfc3dSmrg
31051debfc3dSmrg@table @code
31061debfc3dSmrg@findex strict_low_part
31071debfc3dSmrg@cindex @code{subreg}, in @code{strict_low_part}
31081debfc3dSmrg@item (strict_low_part (subreg:@var{m} (reg:@var{n} @var{r}) 0))
31091debfc3dSmrgThis expression code is used in only one context: as the destination operand of a
31101debfc3dSmrg@code{set} expression.  In addition, the operand of this expression
31111debfc3dSmrgmust be a non-paradoxical @code{subreg} expression.
31121debfc3dSmrg
31131debfc3dSmrgThe presence of @code{strict_low_part} says that the part of the
31141debfc3dSmrgregister which is meaningful in mode @var{n}, but is not part of
31151debfc3dSmrgmode @var{m}, is not to be altered.  Normally, an assignment to such
31161debfc3dSmrga subreg is allowed to have undefined effects on the rest of the
3117a2dc1f3fSmrgregister when @var{m} is smaller than @samp{REGMODE_NATURAL_SIZE (@var{n})}.
31181debfc3dSmrg@end table
31191debfc3dSmrg
31201debfc3dSmrg@node Side Effects
31211debfc3dSmrg@section Side Effect Expressions
31221debfc3dSmrg@cindex RTL side effect expressions
31231debfc3dSmrg
31241debfc3dSmrgThe expression codes described so far represent values, not actions.
31251debfc3dSmrgBut machine instructions never produce values; they are meaningful
31261debfc3dSmrgonly for their side effects on the state of the machine.  Special
31271debfc3dSmrgexpression codes are used to represent side effects.
31281debfc3dSmrg
31291debfc3dSmrgThe body of an instruction is always one of these side effect codes;
31301debfc3dSmrgthe codes described above, which represent values, appear only as
31311debfc3dSmrgthe operands of these.
31321debfc3dSmrg
31331debfc3dSmrg@table @code
31341debfc3dSmrg@findex set
31351debfc3dSmrg@item (set @var{lval} @var{x})
31361debfc3dSmrgRepresents the action of storing the value of @var{x} into the place
31371debfc3dSmrgrepresented by @var{lval}.  @var{lval} must be an expression
31381debfc3dSmrgrepresenting a place that can be stored in: @code{reg} (or @code{subreg},
31391debfc3dSmrg@code{strict_low_part} or @code{zero_extract}), @code{mem}, @code{pc},
31401debfc3dSmrg@code{parallel}, or @code{cc0}.
31411debfc3dSmrg
31421debfc3dSmrgIf @var{lval} is a @code{reg}, @code{subreg} or @code{mem}, it has a
31431debfc3dSmrgmachine mode; then @var{x} must be valid for that mode.
31441debfc3dSmrg
31451debfc3dSmrgIf @var{lval} is a @code{reg} whose machine mode is less than the full
31461debfc3dSmrgwidth of the register, then it means that the part of the register
31471debfc3dSmrgspecified by the machine mode is given the specified value and the
31481debfc3dSmrgrest of the register receives an undefined value.  Likewise, if
31491debfc3dSmrg@var{lval} is a @code{subreg} whose machine mode is narrower than
31501debfc3dSmrgthe mode of the register, the rest of the register can be changed in
31511debfc3dSmrgan undefined way.
31521debfc3dSmrg
31531debfc3dSmrgIf @var{lval} is a @code{strict_low_part} of a subreg, then the part
31541debfc3dSmrgof the register specified by the machine mode of the @code{subreg} is
31551debfc3dSmrggiven the value @var{x} and the rest of the register is not changed.
31561debfc3dSmrg
31571debfc3dSmrgIf @var{lval} is a @code{zero_extract}, then the referenced part of
31581debfc3dSmrgthe bit-field (a memory or register reference) specified by the
31591debfc3dSmrg@code{zero_extract} is given the value @var{x} and the rest of the
31601debfc3dSmrgbit-field is not changed.  Note that @code{sign_extract} cannot
31611debfc3dSmrgappear in @var{lval}.
31621debfc3dSmrg
31631debfc3dSmrgIf @var{lval} is @code{(cc0)}, it has no machine mode, and @var{x} may
31641debfc3dSmrgbe either a @code{compare} expression or a value that may have any mode.
31651debfc3dSmrgThe latter case represents a ``test'' instruction.  The expression
31661debfc3dSmrg@code{(set (cc0) (reg:@var{m} @var{n}))} is equivalent to
31671debfc3dSmrg@code{(set (cc0) (compare (reg:@var{m} @var{n}) (const_int 0)))}.
31681debfc3dSmrgUse the former expression to save space during the compilation.
31691debfc3dSmrg
31701debfc3dSmrgIf @var{lval} is a @code{parallel}, it is used to represent the case of
31711debfc3dSmrga function returning a structure in multiple registers.  Each element
31721debfc3dSmrgof the @code{parallel} is an @code{expr_list} whose first operand is a
31731debfc3dSmrg@code{reg} and whose second operand is a @code{const_int} representing the
31741debfc3dSmrgoffset (in bytes) into the structure at which the data in that register
31751debfc3dSmrgcorresponds.  The first element may be null to indicate that the structure
31761debfc3dSmrgis also passed partly in memory.
31771debfc3dSmrg
31781debfc3dSmrg@cindex jump instructions and @code{set}
31791debfc3dSmrg@cindex @code{if_then_else} usage
31801debfc3dSmrgIf @var{lval} is @code{(pc)}, we have a jump instruction, and the
31811debfc3dSmrgpossibilities for @var{x} are very limited.  It may be a
31821debfc3dSmrg@code{label_ref} expression (unconditional jump).  It may be an
31831debfc3dSmrg@code{if_then_else} (conditional jump), in which case either the
31841debfc3dSmrgsecond or the third operand must be @code{(pc)} (for the case which
31851debfc3dSmrgdoes not jump) and the other of the two must be a @code{label_ref}
31861debfc3dSmrg(for the case which does jump).  @var{x} may also be a @code{mem} or
31871debfc3dSmrg@code{(plus:SI (pc) @var{y})}, where @var{y} may be a @code{reg} or a
31881debfc3dSmrg@code{mem}; these unusual patterns are used to represent jumps through
31891debfc3dSmrgbranch tables.
31901debfc3dSmrg
31911debfc3dSmrgIf @var{lval} is neither @code{(cc0)} nor @code{(pc)}, the mode of
31921debfc3dSmrg@var{lval} must not be @code{VOIDmode} and the mode of @var{x} must be
31931debfc3dSmrgvalid for the mode of @var{lval}.
31941debfc3dSmrg
31951debfc3dSmrg@findex SET_DEST
31961debfc3dSmrg@findex SET_SRC
31971debfc3dSmrg@var{lval} is customarily accessed with the @code{SET_DEST} macro and
31981debfc3dSmrg@var{x} with the @code{SET_SRC} macro.
31991debfc3dSmrg
32001debfc3dSmrg@findex return
32011debfc3dSmrg@item (return)
32021debfc3dSmrgAs the sole expression in a pattern, represents a return from the
32031debfc3dSmrgcurrent function, on machines where this can be done with one
32041debfc3dSmrginstruction, such as VAXen.  On machines where a multi-instruction
32051debfc3dSmrg``epilogue'' must be executed in order to return from the function,
32061debfc3dSmrgreturning is done by jumping to a label which precedes the epilogue, and
32071debfc3dSmrgthe @code{return} expression code is never used.
32081debfc3dSmrg
32091debfc3dSmrgInside an @code{if_then_else} expression, represents the value to be
32101debfc3dSmrgplaced in @code{pc} to return to the caller.
32111debfc3dSmrg
32121debfc3dSmrgNote that an insn pattern of @code{(return)} is logically equivalent to
32131debfc3dSmrg@code{(set (pc) (return))}, but the latter form is never used.
32141debfc3dSmrg
32151debfc3dSmrg@findex simple_return
32161debfc3dSmrg@item (simple_return)
32171debfc3dSmrgLike @code{(return)}, but truly represents only a function return, while
32181debfc3dSmrg@code{(return)} may represent an insn that also performs other functions
32191debfc3dSmrgof the function epilogue.  Like @code{(return)}, this may also occur in
32201debfc3dSmrgconditional jumps.
32211debfc3dSmrg
32221debfc3dSmrg@findex call
32231debfc3dSmrg@item (call @var{function} @var{nargs})
32241debfc3dSmrgRepresents a function call.  @var{function} is a @code{mem} expression
32251debfc3dSmrgwhose address is the address of the function to be called.
32261debfc3dSmrg@var{nargs} is an expression which can be used for two purposes: on
32271debfc3dSmrgsome machines it represents the number of bytes of stack argument; on
32281debfc3dSmrgothers, it represents the number of argument registers.
32291debfc3dSmrg
32301debfc3dSmrgEach machine has a standard machine mode which @var{function} must
32311debfc3dSmrghave.  The machine description defines macro @code{FUNCTION_MODE} to
32321debfc3dSmrgexpand into the requisite mode name.  The purpose of this mode is to
32331debfc3dSmrgspecify what kind of addressing is allowed, on machines where the
32341debfc3dSmrgallowed kinds of addressing depend on the machine mode being
32351debfc3dSmrgaddressed.
32361debfc3dSmrg
32371debfc3dSmrg@findex clobber
32381debfc3dSmrg@item (clobber @var{x})
32391debfc3dSmrgRepresents the storing or possible storing of an unpredictable,
32401debfc3dSmrgundescribed value into @var{x}, which must be a @code{reg},
32411debfc3dSmrg@code{scratch}, @code{parallel} or @code{mem} expression.
32421debfc3dSmrg
32431debfc3dSmrgOne place this is used is in string instructions that store standard
32441debfc3dSmrgvalues into particular hard registers.  It may not be worth the
32451debfc3dSmrgtrouble to describe the values that are stored, but it is essential to
32461debfc3dSmrginform the compiler that the registers will be altered, lest it
32471debfc3dSmrgattempt to keep data in them across the string instruction.
32481debfc3dSmrg
32491debfc3dSmrgIf @var{x} is @code{(mem:BLK (const_int 0))} or
32501debfc3dSmrg@code{(mem:BLK (scratch))}, it means that all memory
32511debfc3dSmrglocations must be presumed clobbered.  If @var{x} is a @code{parallel},
32521debfc3dSmrgit has the same meaning as a @code{parallel} in a @code{set} expression.
32531debfc3dSmrg
32541debfc3dSmrgNote that the machine description classifies certain hard registers as
32551debfc3dSmrg``call-clobbered''.  All function call instructions are assumed by
32561debfc3dSmrgdefault to clobber these registers, so there is no need to use
32571debfc3dSmrg@code{clobber} expressions to indicate this fact.  Also, each function
32581debfc3dSmrgcall is assumed to have the potential to alter any memory location,
32591debfc3dSmrgunless the function is declared @code{const}.
32601debfc3dSmrg
32611debfc3dSmrgIf the last group of expressions in a @code{parallel} are each a
32621debfc3dSmrg@code{clobber} expression whose arguments are @code{reg} or
32631debfc3dSmrg@code{match_scratch} (@pxref{RTL Template}) expressions, the combiner
32641debfc3dSmrgphase can add the appropriate @code{clobber} expressions to an insn it
32651debfc3dSmrghas constructed when doing so will cause a pattern to be matched.
32661debfc3dSmrg
32671debfc3dSmrgThis feature can be used, for example, on a machine that whose multiply
32681debfc3dSmrgand add instructions don't use an MQ register but which has an
32691debfc3dSmrgadd-accumulate instruction that does clobber the MQ register.  Similarly,
32701debfc3dSmrga combined instruction might require a temporary register while the
32711debfc3dSmrgconstituent instructions might not.
32721debfc3dSmrg
32731debfc3dSmrgWhen a @code{clobber} expression for a register appears inside a
32741debfc3dSmrg@code{parallel} with other side effects, the register allocator
32751debfc3dSmrgguarantees that the register is unoccupied both before and after that
32761debfc3dSmrginsn if it is a hard register clobber.  For pseudo-register clobber,
32771debfc3dSmrgthe register allocator and the reload pass do not assign the same hard
32781debfc3dSmrgregister to the clobber and the input operands if there is an insn
32791debfc3dSmrgalternative containing the @samp{&} constraint (@pxref{Modifiers}) for
32801debfc3dSmrgthe clobber and the hard register is in register classes of the
32811debfc3dSmrgclobber in the alternative.  You can clobber either a specific hard
32821debfc3dSmrgregister, a pseudo register, or a @code{scratch} expression; in the
32831debfc3dSmrglatter two cases, GCC will allocate a hard register that is available
32841debfc3dSmrgthere for use as a temporary.
32851debfc3dSmrg
32861debfc3dSmrgFor instructions that require a temporary register, you should use
32871debfc3dSmrg@code{scratch} instead of a pseudo-register because this will allow the
32881debfc3dSmrgcombiner phase to add the @code{clobber} when required.  You do this by
32891debfc3dSmrgcoding (@code{clobber} (@code{match_scratch} @dots{})).  If you do
32901debfc3dSmrgclobber a pseudo register, use one which appears nowhere else---generate
32911debfc3dSmrga new one each time.  Otherwise, you may confuse CSE@.
32921debfc3dSmrg
32931debfc3dSmrgThere is one other known use for clobbering a pseudo register in a
32941debfc3dSmrg@code{parallel}: when one of the input operands of the insn is also
32951debfc3dSmrgclobbered by the insn.  In this case, using the same pseudo register in
32961debfc3dSmrgthe clobber and elsewhere in the insn produces the expected results.
32971debfc3dSmrg
32981debfc3dSmrg@findex use
32991debfc3dSmrg@item (use @var{x})
33001debfc3dSmrgRepresents the use of the value of @var{x}.  It indicates that the
33011debfc3dSmrgvalue in @var{x} at this point in the program is needed, even though
33021debfc3dSmrgit may not be apparent why this is so.  Therefore, the compiler will
33031debfc3dSmrgnot attempt to delete previous instructions whose only effect is to
33041debfc3dSmrgstore a value in @var{x}.  @var{x} must be a @code{reg} expression.
33051debfc3dSmrg
33061debfc3dSmrgIn some situations, it may be tempting to add a @code{use} of a
33071debfc3dSmrgregister in a @code{parallel} to describe a situation where the value
33081debfc3dSmrgof a special register will modify the behavior of the instruction.
33091debfc3dSmrgA hypothetical example might be a pattern for an addition that can
33101debfc3dSmrgeither wrap around or use saturating addition depending on the value
33111debfc3dSmrgof a special control register:
33121debfc3dSmrg
33131debfc3dSmrg@smallexample
33141debfc3dSmrg(parallel [(set (reg:SI 2) (unspec:SI [(reg:SI 3)
33151debfc3dSmrg                                       (reg:SI 4)] 0))
33161debfc3dSmrg           (use (reg:SI 1))])
33171debfc3dSmrg@end smallexample
33181debfc3dSmrg
33191debfc3dSmrg@noindent
33201debfc3dSmrg
33211debfc3dSmrgThis will not work, several of the optimizers only look at expressions
33221debfc3dSmrglocally; it is very likely that if you have multiple insns with
33231debfc3dSmrgidentical inputs to the @code{unspec}, they will be optimized away even
33241debfc3dSmrgif register 1 changes in between.
33251debfc3dSmrg
33261debfc3dSmrgThis means that @code{use} can @emph{only} be used to describe
33271debfc3dSmrgthat the register is live.  You should think twice before adding
33281debfc3dSmrg@code{use} statements, more often you will want to use @code{unspec}
33291debfc3dSmrginstead.  The @code{use} RTX is most commonly useful to describe that
33301debfc3dSmrga fixed register is implicitly used in an insn.  It is also safe to use
33311debfc3dSmrgin patterns where the compiler knows for other reasons that the result
3332*8feb0f0bSmrgof the whole pattern is variable, such as @samp{cpymem@var{m}} or
33331debfc3dSmrg@samp{call} patterns.
33341debfc3dSmrg
33351debfc3dSmrgDuring the reload phase, an insn that has a @code{use} as pattern
33361debfc3dSmrgcan carry a reg_equal note.  These @code{use} insns will be deleted
33371debfc3dSmrgbefore the reload phase exits.
33381debfc3dSmrg
33391debfc3dSmrgDuring the delayed branch scheduling phase, @var{x} may be an insn.
33401debfc3dSmrgThis indicates that @var{x} previously was located at this place in the
33411debfc3dSmrgcode and its data dependencies need to be taken into account.  These
33421debfc3dSmrg@code{use} insns will be deleted before the delayed branch scheduling
33431debfc3dSmrgphase exits.
33441debfc3dSmrg
33451debfc3dSmrg@findex parallel
33461debfc3dSmrg@item (parallel [@var{x0} @var{x1} @dots{}])
33471debfc3dSmrgRepresents several side effects performed in parallel.  The square
33481debfc3dSmrgbrackets stand for a vector; the operand of @code{parallel} is a
33491debfc3dSmrgvector of expressions.  @var{x0}, @var{x1} and so on are individual
33501debfc3dSmrgside effect expressions---expressions of code @code{set}, @code{call},
3351*8feb0f0bSmrg@code{return}, @code{simple_return}, @code{clobber} or @code{use}.
33521debfc3dSmrg
33531debfc3dSmrg``In parallel'' means that first all the values used in the individual
33541debfc3dSmrgside-effects are computed, and second all the actual side-effects are
33551debfc3dSmrgperformed.  For example,
33561debfc3dSmrg
33571debfc3dSmrg@smallexample
33581debfc3dSmrg(parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
33591debfc3dSmrg           (set (mem:SI (reg:SI 1)) (reg:SI 1))])
33601debfc3dSmrg@end smallexample
33611debfc3dSmrg
33621debfc3dSmrg@noindent
33631debfc3dSmrgsays unambiguously that the values of hard register 1 and the memory
33641debfc3dSmrglocation addressed by it are interchanged.  In both places where
33651debfc3dSmrg@code{(reg:SI 1)} appears as a memory address it refers to the value
33661debfc3dSmrgin register 1 @emph{before} the execution of the insn.
33671debfc3dSmrg
33681debfc3dSmrgIt follows that it is @emph{incorrect} to use @code{parallel} and
33691debfc3dSmrgexpect the result of one @code{set} to be available for the next one.
33701debfc3dSmrgFor example, people sometimes attempt to represent a jump-if-zero
33711debfc3dSmrginstruction this way:
33721debfc3dSmrg
33731debfc3dSmrg@smallexample
33741debfc3dSmrg(parallel [(set (cc0) (reg:SI 34))
33751debfc3dSmrg           (set (pc) (if_then_else
33761debfc3dSmrg                        (eq (cc0) (const_int 0))
33771debfc3dSmrg                        (label_ref @dots{})
33781debfc3dSmrg                        (pc)))])
33791debfc3dSmrg@end smallexample
33801debfc3dSmrg
33811debfc3dSmrg@noindent
33821debfc3dSmrgBut this is incorrect, because it says that the jump condition depends
33831debfc3dSmrgon the condition code value @emph{before} this instruction, not on the
33841debfc3dSmrgnew value that is set by this instruction.
33851debfc3dSmrg
33861debfc3dSmrg@cindex peephole optimization, RTL representation
33871debfc3dSmrgPeephole optimization, which takes place together with final assembly
33881debfc3dSmrgcode output, can produce insns whose patterns consist of a @code{parallel}
33891debfc3dSmrgwhose elements are the operands needed to output the resulting
33901debfc3dSmrgassembler code---often @code{reg}, @code{mem} or constant expressions.
33911debfc3dSmrgThis would not be well-formed RTL at any other stage in compilation,
33921debfc3dSmrgbut it is OK then because no further optimization remains to be done.
33931debfc3dSmrgHowever, the definition of the macro @code{NOTICE_UPDATE_CC}, if
33941debfc3dSmrgany, must deal with such insns if you define any peephole optimizations.
33951debfc3dSmrg
33961debfc3dSmrg@findex cond_exec
33971debfc3dSmrg@item (cond_exec [@var{cond} @var{expr}])
33981debfc3dSmrgRepresents a conditionally executed expression.  The @var{expr} is
33991debfc3dSmrgexecuted only if the @var{cond} is nonzero.  The @var{cond} expression
34001debfc3dSmrgmust not have side-effects, but the @var{expr} may very well have
34011debfc3dSmrgside-effects.
34021debfc3dSmrg
34031debfc3dSmrg@findex sequence
34041debfc3dSmrg@item (sequence [@var{insns} @dots{}])
34051debfc3dSmrgRepresents a sequence of insns.  If a @code{sequence} appears in the
34061debfc3dSmrgchain of insns, then each of the @var{insns} that appears in the sequence
3407c0a68be4Smrgmust be suitable for appearing in the chain of insns, i.e.@: must satisfy
34081debfc3dSmrgthe @code{INSN_P} predicate.
34091debfc3dSmrg
34101debfc3dSmrgAfter delay-slot scheduling is completed, an insn and all the insns that
34111debfc3dSmrgreside in its delay slots are grouped together into a @code{sequence}.
34121debfc3dSmrgThe insn requiring the delay slot is the first insn in the vector;
34131debfc3dSmrgsubsequent insns are to be placed in the delay slot.
34141debfc3dSmrg
34151debfc3dSmrg@code{INSN_ANNULLED_BRANCH_P} is set on an insn in a delay slot to
34161debfc3dSmrgindicate that a branch insn should be used that will conditionally annul
34171debfc3dSmrgthe effect of the insns in the delay slots.  In such a case,
34181debfc3dSmrg@code{INSN_FROM_TARGET_P} indicates that the insn is from the target of
34191debfc3dSmrgthe branch and should be executed only if the branch is taken; otherwise
34201debfc3dSmrgthe insn should be executed only if the branch is not taken.
34211debfc3dSmrg@xref{Delay Slots}.
34221debfc3dSmrg
34231debfc3dSmrgSome back ends also use @code{sequence} objects for purposes other than
34241debfc3dSmrgdelay-slot groups.  This is not supported in the common parts of the
34251debfc3dSmrgcompiler, which treat such sequences as delay-slot groups.
34261debfc3dSmrg
34271debfc3dSmrgDWARF2 Call Frame Address (CFA) adjustments are sometimes also expressed
34281debfc3dSmrgusing @code{sequence} objects as the value of a @code{RTX_FRAME_RELATED_P}
34291debfc3dSmrgnote.  This only happens if the CFA adjustments cannot be easily derived
34301debfc3dSmrgfrom the pattern of the instruction to which the note is attached.  In
34311debfc3dSmrgsuch cases, the value of the note is used instead of best-guesing the
34321debfc3dSmrgsemantics of the instruction.  The back end can attach notes containing
34331debfc3dSmrga @code{sequence} of @code{set} patterns that express the effect of the
34341debfc3dSmrgparent instruction.
34351debfc3dSmrg@end table
34361debfc3dSmrg
34371debfc3dSmrgThese expression codes appear in place of a side effect, as the body of
34381debfc3dSmrgan insn, though strictly speaking they do not always describe side
34391debfc3dSmrgeffects as such:
34401debfc3dSmrg
34411debfc3dSmrg@table @code
34421debfc3dSmrg@findex asm_input
34431debfc3dSmrg@item (asm_input @var{s})
34441debfc3dSmrgRepresents literal assembler code as described by the string @var{s}.
34451debfc3dSmrg
34461debfc3dSmrg@findex unspec
34471debfc3dSmrg@findex unspec_volatile
34481debfc3dSmrg@item (unspec [@var{operands} @dots{}] @var{index})
34491debfc3dSmrg@itemx (unspec_volatile [@var{operands} @dots{}] @var{index})
34501debfc3dSmrgRepresents a machine-specific operation on @var{operands}.  @var{index}
34511debfc3dSmrgselects between multiple machine-specific operations.
34521debfc3dSmrg@code{unspec_volatile} is used for volatile operations and operations
34531debfc3dSmrgthat may trap; @code{unspec} is used for other operations.
34541debfc3dSmrg
34551debfc3dSmrgThese codes may appear inside a @code{pattern} of an
34561debfc3dSmrginsn, inside a @code{parallel}, or inside an expression.
34571debfc3dSmrg
34581debfc3dSmrg@findex addr_vec
34591debfc3dSmrg@item (addr_vec:@var{m} [@var{lr0} @var{lr1} @dots{}])
34601debfc3dSmrgRepresents a table of jump addresses.  The vector elements @var{lr0},
34611debfc3dSmrgetc., are @code{label_ref} expressions.  The mode @var{m} specifies
34621debfc3dSmrghow much space is given to each address; normally @var{m} would be
34631debfc3dSmrg@code{Pmode}.
34641debfc3dSmrg
34651debfc3dSmrg@findex addr_diff_vec
34661debfc3dSmrg@item (addr_diff_vec:@var{m} @var{base} [@var{lr0} @var{lr1} @dots{}] @var{min} @var{max} @var{flags})
34671debfc3dSmrgRepresents a table of jump addresses expressed as offsets from
34681debfc3dSmrg@var{base}.  The vector elements @var{lr0}, etc., are @code{label_ref}
34691debfc3dSmrgexpressions and so is @var{base}.  The mode @var{m} specifies how much
34701debfc3dSmrgspace is given to each address-difference.  @var{min} and @var{max}
34711debfc3dSmrgare set up by branch shortening and hold a label with a minimum and a
34721debfc3dSmrgmaximum address, respectively.  @var{flags} indicates the relative
34731debfc3dSmrgposition of @var{base}, @var{min} and @var{max} to the containing insn
34741debfc3dSmrgand of @var{min} and @var{max} to @var{base}.  See rtl.def for details.
34751debfc3dSmrg
34761debfc3dSmrg@findex prefetch
34771debfc3dSmrg@item (prefetch:@var{m} @var{addr} @var{rw} @var{locality})
34781debfc3dSmrgRepresents prefetch of memory at address @var{addr}.
34791debfc3dSmrgOperand @var{rw} is 1 if the prefetch is for data to be written, 0 otherwise;
34801debfc3dSmrgtargets that do not support write prefetches should treat this as a normal
34811debfc3dSmrgprefetch.
34821debfc3dSmrgOperand @var{locality} specifies the amount of temporal locality; 0 if there
34831debfc3dSmrgis none or 1, 2, or 3 for increasing levels of temporal locality;
34841debfc3dSmrgtargets that do not support locality hints should ignore this.
34851debfc3dSmrg
34861debfc3dSmrgThis insn is used to minimize cache-miss latency by moving data into a
34871debfc3dSmrgcache before it is accessed.  It should use only non-faulting data prefetch
34881debfc3dSmrginstructions.
34891debfc3dSmrg@end table
34901debfc3dSmrg
34911debfc3dSmrg@node Incdec
34921debfc3dSmrg@section Embedded Side-Effects on Addresses
34931debfc3dSmrg@cindex RTL preincrement
34941debfc3dSmrg@cindex RTL postincrement
34951debfc3dSmrg@cindex RTL predecrement
34961debfc3dSmrg@cindex RTL postdecrement
34971debfc3dSmrg
34981debfc3dSmrgSix special side-effect expression codes appear as memory addresses.
34991debfc3dSmrg
35001debfc3dSmrg@table @code
35011debfc3dSmrg@findex pre_dec
35021debfc3dSmrg@item (pre_dec:@var{m} @var{x})
35031debfc3dSmrgRepresents the side effect of decrementing @var{x} by a standard
35041debfc3dSmrgamount and represents also the value that @var{x} has after being
35051debfc3dSmrgdecremented.  @var{x} must be a @code{reg} or @code{mem}, but most
35061debfc3dSmrgmachines allow only a @code{reg}.  @var{m} must be the machine mode
35071debfc3dSmrgfor pointers on the machine in use.  The amount @var{x} is decremented
35081debfc3dSmrgby is the length in bytes of the machine mode of the containing memory
35091debfc3dSmrgreference of which this expression serves as the address.  Here is an
35101debfc3dSmrgexample of its use:
35111debfc3dSmrg
35121debfc3dSmrg@smallexample
35131debfc3dSmrg(mem:DF (pre_dec:SI (reg:SI 39)))
35141debfc3dSmrg@end smallexample
35151debfc3dSmrg
35161debfc3dSmrg@noindent
35171debfc3dSmrgThis says to decrement pseudo register 39 by the length of a @code{DFmode}
35181debfc3dSmrgvalue and use the result to address a @code{DFmode} value.
35191debfc3dSmrg
35201debfc3dSmrg@findex pre_inc
35211debfc3dSmrg@item (pre_inc:@var{m} @var{x})
35221debfc3dSmrgSimilar, but specifies incrementing @var{x} instead of decrementing it.
35231debfc3dSmrg
35241debfc3dSmrg@findex post_dec
35251debfc3dSmrg@item (post_dec:@var{m} @var{x})
35261debfc3dSmrgRepresents the same side effect as @code{pre_dec} but a different
35271debfc3dSmrgvalue.  The value represented here is the value @var{x} has @i{before}
35281debfc3dSmrgbeing decremented.
35291debfc3dSmrg
35301debfc3dSmrg@findex post_inc
35311debfc3dSmrg@item (post_inc:@var{m} @var{x})
35321debfc3dSmrgSimilar, but specifies incrementing @var{x} instead of decrementing it.
35331debfc3dSmrg
35341debfc3dSmrg@findex post_modify
35351debfc3dSmrg@item (post_modify:@var{m} @var{x} @var{y})
35361debfc3dSmrg
35371debfc3dSmrgRepresents the side effect of setting @var{x} to @var{y} and
35381debfc3dSmrgrepresents @var{x} before @var{x} is modified.  @var{x} must be a
35391debfc3dSmrg@code{reg} or @code{mem}, but most machines allow only a @code{reg}.
35401debfc3dSmrg@var{m} must be the machine mode for pointers on the machine in use.
35411debfc3dSmrg
35421debfc3dSmrgThe expression @var{y} must be one of three forms:
35431debfc3dSmrg@code{(plus:@var{m} @var{x} @var{z})},
35441debfc3dSmrg@code{(minus:@var{m} @var{x} @var{z})}, or
35451debfc3dSmrg@code{(plus:@var{m} @var{x} @var{i})},
35461debfc3dSmrgwhere @var{z} is an index register and @var{i} is a constant.
35471debfc3dSmrg
35481debfc3dSmrgHere is an example of its use:
35491debfc3dSmrg
35501debfc3dSmrg@smallexample
35511debfc3dSmrg(mem:SF (post_modify:SI (reg:SI 42) (plus (reg:SI 42)
35521debfc3dSmrg                                          (reg:SI 48))))
35531debfc3dSmrg@end smallexample
35541debfc3dSmrg
35551debfc3dSmrgThis says to modify pseudo register 42 by adding the contents of pseudo
35561debfc3dSmrgregister 48 to it, after the use of what ever 42 points to.
35571debfc3dSmrg
35581debfc3dSmrg@findex pre_modify
35591debfc3dSmrg@item (pre_modify:@var{m} @var{x} @var{expr})
35601debfc3dSmrgSimilar except side effects happen before the use.
35611debfc3dSmrg@end table
35621debfc3dSmrg
35631debfc3dSmrgThese embedded side effect expressions must be used with care.  Instruction
35641debfc3dSmrgpatterns may not use them.  Until the @samp{flow} pass of the compiler,
35651debfc3dSmrgthey may occur only to represent pushes onto the stack.  The @samp{flow}
35661debfc3dSmrgpass finds cases where registers are incremented or decremented in one
35671debfc3dSmrginstruction and used as an address shortly before or after; these cases are
35681debfc3dSmrgthen transformed to use pre- or post-increment or -decrement.
35691debfc3dSmrg
35701debfc3dSmrgIf a register used as the operand of these expressions is used in
35711debfc3dSmrganother address in an insn, the original value of the register is used.
35721debfc3dSmrgUses of the register outside of an address are not permitted within the
35731debfc3dSmrgsame insn as a use in an embedded side effect expression because such
35741debfc3dSmrginsns behave differently on different machines and hence must be treated
35751debfc3dSmrgas ambiguous and disallowed.
35761debfc3dSmrg
35771debfc3dSmrgAn instruction that can be represented with an embedded side effect
35781debfc3dSmrgcould also be represented using @code{parallel} containing an additional
35791debfc3dSmrg@code{set} to describe how the address register is altered.  This is not
35801debfc3dSmrgdone because machines that allow these operations at all typically
35811debfc3dSmrgallow them wherever a memory address is called for.  Describing them as
35821debfc3dSmrgadditional parallel stores would require doubling the number of entries
35831debfc3dSmrgin the machine description.
35841debfc3dSmrg
35851debfc3dSmrg@node Assembler
35861debfc3dSmrg@section Assembler Instructions as Expressions
35871debfc3dSmrg@cindex assembler instructions in RTL
35881debfc3dSmrg
35891debfc3dSmrg@cindex @code{asm_operands}, usage
35901debfc3dSmrgThe RTX code @code{asm_operands} represents a value produced by a
35911debfc3dSmrguser-specified assembler instruction.  It is used to represent
35921debfc3dSmrgan @code{asm} statement with arguments.  An @code{asm} statement with
35931debfc3dSmrga single output operand, like this:
35941debfc3dSmrg
35951debfc3dSmrg@smallexample
35961debfc3dSmrgasm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
35971debfc3dSmrg@end smallexample
35981debfc3dSmrg
35991debfc3dSmrg@noindent
36001debfc3dSmrgis represented using a single @code{asm_operands} RTX which represents
36011debfc3dSmrgthe value that is stored in @code{outputvar}:
36021debfc3dSmrg
36031debfc3dSmrg@smallexample
36041debfc3dSmrg(set @var{rtx-for-outputvar}
36051debfc3dSmrg     (asm_operands "foo %1,%2,%0" "a" 0
36061debfc3dSmrg                   [@var{rtx-for-addition-result} @var{rtx-for-*z}]
36071debfc3dSmrg                   [(asm_input:@var{m1} "g")
36081debfc3dSmrg                    (asm_input:@var{m2} "di")]))
36091debfc3dSmrg@end smallexample
36101debfc3dSmrg
36111debfc3dSmrg@noindent
36121debfc3dSmrgHere the operands of the @code{asm_operands} RTX are the assembler
36131debfc3dSmrgtemplate string, the output-operand's constraint, the index-number of the
36141debfc3dSmrgoutput operand among the output operands specified, a vector of input
36151debfc3dSmrgoperand RTX's, and a vector of input-operand modes and constraints.  The
36161debfc3dSmrgmode @var{m1} is the mode of the sum @code{x+y}; @var{m2} is that of
36171debfc3dSmrg@code{*z}.
36181debfc3dSmrg
36191debfc3dSmrgWhen an @code{asm} statement has multiple output values, its insn has
36201debfc3dSmrgseveral such @code{set} RTX's inside of a @code{parallel}.  Each @code{set}
36211debfc3dSmrgcontains an @code{asm_operands}; all of these share the same assembler
36221debfc3dSmrgtemplate and vectors, but each contains the constraint for the respective
36231debfc3dSmrgoutput operand.  They are also distinguished by the output-operand index
36241debfc3dSmrgnumber, which is 0, 1, @dots{} for successive output operands.
36251debfc3dSmrg
36261debfc3dSmrg@node Debug Information
36271debfc3dSmrg@section Variable Location Debug Information in RTL
36281debfc3dSmrg@cindex Variable Location Debug Information in RTL
36291debfc3dSmrg
36301debfc3dSmrgVariable tracking relies on @code{MEM_EXPR} and @code{REG_EXPR}
36311debfc3dSmrgannotations to determine what user variables memory and register
36321debfc3dSmrgreferences refer to.
36331debfc3dSmrg
36341debfc3dSmrgVariable tracking at assignments uses these notes only when they refer
36351debfc3dSmrgto variables that live at fixed locations (e.g., addressable
36361debfc3dSmrgvariables, global non-automatic variables).  For variables whose
36371debfc3dSmrglocation may vary, it relies on the following types of notes.
36381debfc3dSmrg
36391debfc3dSmrg@table @code
36401debfc3dSmrg@findex var_location
36411debfc3dSmrg@item (var_location:@var{mode} @var{var} @var{exp} @var{stat})
36421debfc3dSmrgBinds variable @code{var}, a tree, to value @var{exp}, an RTL
36431debfc3dSmrgexpression.  It appears only in @code{NOTE_INSN_VAR_LOCATION} and
36441debfc3dSmrg@code{DEBUG_INSN}s, with slightly different meanings.  @var{mode}, if
36451debfc3dSmrgpresent, represents the mode of @var{exp}, which is useful if it is a
36461debfc3dSmrgmodeless expression.  @var{stat} is only meaningful in notes,
36471debfc3dSmrgindicating whether the variable is known to be initialized or
36481debfc3dSmrguninitialized.
36491debfc3dSmrg
36501debfc3dSmrg@findex debug_expr
36511debfc3dSmrg@item (debug_expr:@var{mode} @var{decl})
36521debfc3dSmrgStands for the value bound to the @code{DEBUG_EXPR_DECL} @var{decl},
36531debfc3dSmrgthat points back to it, within value expressions in
36541debfc3dSmrg@code{VAR_LOCATION} nodes.
36551debfc3dSmrg
3656a2dc1f3fSmrg@findex debug_implicit_ptr
3657a2dc1f3fSmrg@item (debug_implicit_ptr:@var{mode} @var{decl})
3658a2dc1f3fSmrgStands for the location of a @var{decl} that is no longer addressable.
3659a2dc1f3fSmrg
3660a2dc1f3fSmrg@findex entry_value
3661a2dc1f3fSmrg@item (entry_value:@var{mode} @var{decl})
3662a2dc1f3fSmrgStands for the value a @var{decl} had at the entry point of the
3663a2dc1f3fSmrgcontaining function.
3664a2dc1f3fSmrg
3665a2dc1f3fSmrg@findex debug_parameter_ref
3666a2dc1f3fSmrg@item (debug_parameter_ref:@var{mode} @var{decl})
3667a2dc1f3fSmrgRefers to a parameter that was completely optimized out.
3668a2dc1f3fSmrg
3669a2dc1f3fSmrg@findex debug_marker
3670a2dc1f3fSmrg@item (debug_marker:@var{mode})
3671a2dc1f3fSmrgMarks a program location.  With @code{VOIDmode}, it stands for the
3672a2dc1f3fSmrgbeginning of a statement, a recommended inspection point logically after
3673a2dc1f3fSmrgall prior side effects, and before any subsequent side effects.  With
3674a2dc1f3fSmrg@code{BLKmode}, it indicates an inline entry point: the lexical block
3675a2dc1f3fSmrgencoded in the @code{INSN_LOCATION} is the enclosing block that encloses
3676a2dc1f3fSmrgthe inlined function.
3677a2dc1f3fSmrg
36781debfc3dSmrg@end table
36791debfc3dSmrg
36801debfc3dSmrg@node Insns
36811debfc3dSmrg@section Insns
36821debfc3dSmrg@cindex insns
36831debfc3dSmrg
36841debfc3dSmrgThe RTL representation of the code for a function is a doubly-linked
36851debfc3dSmrgchain of objects called @dfn{insns}.  Insns are expressions with
36861debfc3dSmrgspecial codes that are used for no other purpose.  Some insns are
36871debfc3dSmrgactual instructions; others represent dispatch tables for @code{switch}
36881debfc3dSmrgstatements; others represent labels to jump to or various sorts of
36891debfc3dSmrgdeclarative information.
36901debfc3dSmrg
36911debfc3dSmrgIn addition to its own specific data, each insn must have a unique
36921debfc3dSmrgid-number that distinguishes it from all other insns in the current
36931debfc3dSmrgfunction (after delayed branch scheduling, copies of an insn with the
36941debfc3dSmrgsame id-number may be present in multiple places in a function, but
36951debfc3dSmrgthese copies will always be identical and will only appear inside a
36961debfc3dSmrg@code{sequence}), and chain pointers to the preceding and following
36971debfc3dSmrginsns.  These three fields occupy the same position in every insn,
36981debfc3dSmrgindependent of the expression code of the insn.  They could be accessed
36991debfc3dSmrgwith @code{XEXP} and @code{XINT}, but instead three special macros are
37001debfc3dSmrgalways used:
37011debfc3dSmrg
37021debfc3dSmrg@table @code
37031debfc3dSmrg@findex INSN_UID
37041debfc3dSmrg@item INSN_UID (@var{i})
37051debfc3dSmrgAccesses the unique id of insn @var{i}.
37061debfc3dSmrg
37071debfc3dSmrg@findex PREV_INSN
37081debfc3dSmrg@item PREV_INSN (@var{i})
37091debfc3dSmrgAccesses the chain pointer to the insn preceding @var{i}.
37101debfc3dSmrgIf @var{i} is the first insn, this is a null pointer.
37111debfc3dSmrg
37121debfc3dSmrg@findex NEXT_INSN
37131debfc3dSmrg@item NEXT_INSN (@var{i})
37141debfc3dSmrgAccesses the chain pointer to the insn following @var{i}.
37151debfc3dSmrgIf @var{i} is the last insn, this is a null pointer.
37161debfc3dSmrg@end table
37171debfc3dSmrg
37181debfc3dSmrg@findex get_insns
37191debfc3dSmrg@findex get_last_insn
37201debfc3dSmrgThe first insn in the chain is obtained by calling @code{get_insns}; the
37211debfc3dSmrglast insn is the result of calling @code{get_last_insn}.  Within the
37221debfc3dSmrgchain delimited by these insns, the @code{NEXT_INSN} and
37231debfc3dSmrg@code{PREV_INSN} pointers must always correspond: if @var{insn} is not
37241debfc3dSmrgthe first insn,
37251debfc3dSmrg
37261debfc3dSmrg@smallexample
37271debfc3dSmrgNEXT_INSN (PREV_INSN (@var{insn})) == @var{insn}
37281debfc3dSmrg@end smallexample
37291debfc3dSmrg
37301debfc3dSmrg@noindent
37311debfc3dSmrgis always true and if @var{insn} is not the last insn,
37321debfc3dSmrg
37331debfc3dSmrg@smallexample
37341debfc3dSmrgPREV_INSN (NEXT_INSN (@var{insn})) == @var{insn}
37351debfc3dSmrg@end smallexample
37361debfc3dSmrg
37371debfc3dSmrg@noindent
37381debfc3dSmrgis always true.
37391debfc3dSmrg
37401debfc3dSmrgAfter delay slot scheduling, some of the insns in the chain might be
37411debfc3dSmrg@code{sequence} expressions, which contain a vector of insns.  The value
37421debfc3dSmrgof @code{NEXT_INSN} in all but the last of these insns is the next insn
37431debfc3dSmrgin the vector; the value of @code{NEXT_INSN} of the last insn in the vector
37441debfc3dSmrgis the same as the value of @code{NEXT_INSN} for the @code{sequence} in
37451debfc3dSmrgwhich it is contained.  Similar rules apply for @code{PREV_INSN}.
37461debfc3dSmrg
37471debfc3dSmrgThis means that the above invariants are not necessarily true for insns
37481debfc3dSmrginside @code{sequence} expressions.  Specifically, if @var{insn} is the
37491debfc3dSmrgfirst insn in a @code{sequence}, @code{NEXT_INSN (PREV_INSN (@var{insn}))}
37501debfc3dSmrgis the insn containing the @code{sequence} expression, as is the value
37511debfc3dSmrgof @code{PREV_INSN (NEXT_INSN (@var{insn}))} if @var{insn} is the last
37521debfc3dSmrginsn in the @code{sequence} expression.  You can use these expressions
37531debfc3dSmrgto find the containing @code{sequence} expression.
37541debfc3dSmrg
37551debfc3dSmrgEvery insn has one of the following expression codes:
37561debfc3dSmrg
37571debfc3dSmrg@table @code
37581debfc3dSmrg@findex insn
37591debfc3dSmrg@item insn
37601debfc3dSmrgThe expression code @code{insn} is used for instructions that do not jump
37611debfc3dSmrgand do not do function calls.  @code{sequence} expressions are always
37621debfc3dSmrgcontained in insns with code @code{insn} even if one of those insns
37631debfc3dSmrgshould jump or do function calls.
37641debfc3dSmrg
37651debfc3dSmrgInsns with code @code{insn} have four additional fields beyond the three
37661debfc3dSmrgmandatory ones listed above.  These four are described in a table below.
37671debfc3dSmrg
37681debfc3dSmrg@findex jump_insn
37691debfc3dSmrg@item jump_insn
37701debfc3dSmrgThe expression code @code{jump_insn} is used for instructions that may
37711debfc3dSmrgjump (or, more generally, may contain @code{label_ref} expressions to
37721debfc3dSmrgwhich @code{pc} can be set in that instruction).  If there is an
37731debfc3dSmrginstruction to return from the current function, it is recorded as a
37741debfc3dSmrg@code{jump_insn}.
37751debfc3dSmrg
37761debfc3dSmrg@findex JUMP_LABEL
37771debfc3dSmrg@code{jump_insn} insns have the same extra fields as @code{insn} insns,
37781debfc3dSmrgaccessed in the same way and in addition contain a field
37791debfc3dSmrg@code{JUMP_LABEL} which is defined once jump optimization has completed.
37801debfc3dSmrg
37811debfc3dSmrgFor simple conditional and unconditional jumps, this field contains
37821debfc3dSmrgthe @code{code_label} to which this insn will (possibly conditionally)
37831debfc3dSmrgbranch.  In a more complex jump, @code{JUMP_LABEL} records one of the
37841debfc3dSmrglabels that the insn refers to; other jump target labels are recorded
37851debfc3dSmrgas @code{REG_LABEL_TARGET} notes.  The exception is @code{addr_vec}
37861debfc3dSmrgand @code{addr_diff_vec}, where @code{JUMP_LABEL} is @code{NULL_RTX}
37871debfc3dSmrgand the only way to find the labels is to scan the entire body of the
37881debfc3dSmrginsn.
37891debfc3dSmrg
37901debfc3dSmrgReturn insns count as jumps, but their @code{JUMP_LABEL} is @code{RETURN}
37911debfc3dSmrgor @code{SIMPLE_RETURN}.
37921debfc3dSmrg
37931debfc3dSmrg@findex call_insn
37941debfc3dSmrg@item call_insn
37951debfc3dSmrgThe expression code @code{call_insn} is used for instructions that may do
37961debfc3dSmrgfunction calls.  It is important to distinguish these instructions because
37971debfc3dSmrgthey imply that certain registers and memory locations may be altered
37981debfc3dSmrgunpredictably.
37991debfc3dSmrg
38001debfc3dSmrg@findex CALL_INSN_FUNCTION_USAGE
38011debfc3dSmrg@code{call_insn} insns have the same extra fields as @code{insn} insns,
38021debfc3dSmrgaccessed in the same way and in addition contain a field
38031debfc3dSmrg@code{CALL_INSN_FUNCTION_USAGE}, which contains a list (chain of
38041debfc3dSmrg@code{expr_list} expressions) containing @code{use}, @code{clobber} and
38051debfc3dSmrgsometimes @code{set} expressions that denote hard registers and
38061debfc3dSmrg@code{mem}s used or clobbered by the called function.
38071debfc3dSmrg
38081debfc3dSmrgA @code{mem} generally points to a stack slot in which arguments passed
38091debfc3dSmrgto the libcall by reference (@pxref{Register Arguments,
38101debfc3dSmrgTARGET_PASS_BY_REFERENCE}) are stored.  If the argument is
38111debfc3dSmrgcaller-copied (@pxref{Register Arguments, TARGET_CALLEE_COPIES}),
38121debfc3dSmrgthe stack slot will be mentioned in @code{clobber} and @code{use}
38131debfc3dSmrgentries; if it's callee-copied, only a @code{use} will appear, and the
38141debfc3dSmrg@code{mem} may point to addresses that are not stack slots.
38151debfc3dSmrg
38161debfc3dSmrgRegisters occurring inside a @code{clobber} in this list augment
38171debfc3dSmrgregisters specified in @code{CALL_USED_REGISTERS} (@pxref{Register
38181debfc3dSmrgBasics}).
38191debfc3dSmrg
38201debfc3dSmrgIf the list contains a @code{set} involving two registers, it indicates
38211debfc3dSmrgthat the function returns one of its arguments.  Such a @code{set} may
38221debfc3dSmrglook like a no-op if the same register holds the argument and the return
38231debfc3dSmrgvalue.
38241debfc3dSmrg
38251debfc3dSmrg@findex code_label
38261debfc3dSmrg@findex CODE_LABEL_NUMBER
38271debfc3dSmrg@item code_label
38281debfc3dSmrgA @code{code_label} insn represents a label that a jump insn can jump
38291debfc3dSmrgto.  It contains two special fields of data in addition to the three
38301debfc3dSmrgstandard ones.  @code{CODE_LABEL_NUMBER} is used to hold the @dfn{label
38311debfc3dSmrgnumber}, a number that identifies this label uniquely among all the
38321debfc3dSmrglabels in the compilation (not just in the current function).
38331debfc3dSmrgUltimately, the label is represented in the assembler output as an
38341debfc3dSmrgassembler label, usually of the form @samp{L@var{n}} where @var{n} is
38351debfc3dSmrgthe label number.
38361debfc3dSmrg
38371debfc3dSmrgWhen a @code{code_label} appears in an RTL expression, it normally
38381debfc3dSmrgappears within a @code{label_ref} which represents the address of
38391debfc3dSmrgthe label, as a number.
38401debfc3dSmrg
38411debfc3dSmrgBesides as a @code{code_label}, a label can also be represented as a
38421debfc3dSmrg@code{note} of type @code{NOTE_INSN_DELETED_LABEL}.
38431debfc3dSmrg
38441debfc3dSmrg@findex LABEL_NUSES
38451debfc3dSmrgThe field @code{LABEL_NUSES} is only defined once the jump optimization
38461debfc3dSmrgphase is completed.  It contains the number of times this label is
38471debfc3dSmrgreferenced in the current function.
38481debfc3dSmrg
38491debfc3dSmrg@findex LABEL_KIND
38501debfc3dSmrg@findex SET_LABEL_KIND
38511debfc3dSmrg@findex LABEL_ALT_ENTRY_P
38521debfc3dSmrg@cindex alternate entry points
38531debfc3dSmrgThe field @code{LABEL_KIND} differentiates four different types of
38541debfc3dSmrglabels: @code{LABEL_NORMAL}, @code{LABEL_STATIC_ENTRY},
38551debfc3dSmrg@code{LABEL_GLOBAL_ENTRY}, and @code{LABEL_WEAK_ENTRY}.  The only labels
38561debfc3dSmrgthat do not have type @code{LABEL_NORMAL} are @dfn{alternate entry
38571debfc3dSmrgpoints} to the current function.  These may be static (visible only in
38581debfc3dSmrgthe containing translation unit), global (exposed to all translation
38591debfc3dSmrgunits), or weak (global, but can be overridden by another symbol with the
38601debfc3dSmrgsame name).
38611debfc3dSmrg
38621debfc3dSmrgMuch of the compiler treats all four kinds of label identically.  Some
38631debfc3dSmrgof it needs to know whether or not a label is an alternate entry point;
38641debfc3dSmrgfor this purpose, the macro @code{LABEL_ALT_ENTRY_P} is provided.  It is
38651debfc3dSmrgequivalent to testing whether @samp{LABEL_KIND (label) == LABEL_NORMAL}.
38661debfc3dSmrgThe only place that cares about the distinction between static, global,
38671debfc3dSmrgand weak alternate entry points, besides the front-end code that creates
38681debfc3dSmrgthem, is the function @code{output_alternate_entry_point}, in
38691debfc3dSmrg@file{final.c}.
38701debfc3dSmrg
38711debfc3dSmrgTo set the kind of a label, use the @code{SET_LABEL_KIND} macro.
38721debfc3dSmrg
38731debfc3dSmrg@findex jump_table_data
38741debfc3dSmrg@item jump_table_data
38751debfc3dSmrgA @code{jump_table_data} insn is a placeholder for the jump-table data
38761debfc3dSmrgof a @code{casesi} or @code{tablejump} insn.  They are placed after
38771debfc3dSmrga @code{tablejump_p} insn.  A @code{jump_table_data} insn is not part o
38781debfc3dSmrga basic blockm but it is associated with the basic block that ends with
38791debfc3dSmrgthe @code{tablejump_p} insn.  The @code{PATTERN} of a @code{jump_table_data}
38801debfc3dSmrgis always either an @code{addr_vec} or an @code{addr_diff_vec}, and a
38811debfc3dSmrg@code{jump_table_data} insn is always preceded by a @code{code_label}.
38821debfc3dSmrgThe @code{tablejump_p} insn refers to that @code{code_label} via its
38831debfc3dSmrg@code{JUMP_LABEL}.
38841debfc3dSmrg
38851debfc3dSmrg@findex barrier
38861debfc3dSmrg@item barrier
38871debfc3dSmrgBarriers are placed in the instruction stream when control cannot flow
38881debfc3dSmrgpast them.  They are placed after unconditional jump instructions to
38891debfc3dSmrgindicate that the jumps are unconditional and after calls to
38901debfc3dSmrg@code{volatile} functions, which do not return (e.g., @code{exit}).
38911debfc3dSmrgThey contain no information beyond the three standard fields.
38921debfc3dSmrg
38931debfc3dSmrg@findex note
38941debfc3dSmrg@findex NOTE_LINE_NUMBER
38951debfc3dSmrg@findex NOTE_SOURCE_FILE
38961debfc3dSmrg@item note
38971debfc3dSmrg@code{note} insns are used to represent additional debugging and
38981debfc3dSmrgdeclarative information.  They contain two nonstandard fields, an
38991debfc3dSmrginteger which is accessed with the macro @code{NOTE_LINE_NUMBER} and a
39001debfc3dSmrgstring accessed with @code{NOTE_SOURCE_FILE}.
39011debfc3dSmrg
39021debfc3dSmrgIf @code{NOTE_LINE_NUMBER} is positive, the note represents the
39031debfc3dSmrgposition of a source line and @code{NOTE_SOURCE_FILE} is the source file name
39041debfc3dSmrgthat the line came from.  These notes control generation of line
39051debfc3dSmrgnumber data in the assembler output.
39061debfc3dSmrg
39071debfc3dSmrgOtherwise, @code{NOTE_LINE_NUMBER} is not really a line number but a
39081debfc3dSmrgcode with one of the following values (and @code{NOTE_SOURCE_FILE}
39091debfc3dSmrgmust contain a null pointer):
39101debfc3dSmrg
39111debfc3dSmrg@table @code
39121debfc3dSmrg@findex NOTE_INSN_DELETED
39131debfc3dSmrg@item NOTE_INSN_DELETED
39141debfc3dSmrgSuch a note is completely ignorable.  Some passes of the compiler
39151debfc3dSmrgdelete insns by altering them into notes of this kind.
39161debfc3dSmrg
39171debfc3dSmrg@findex NOTE_INSN_DELETED_LABEL
39181debfc3dSmrg@item NOTE_INSN_DELETED_LABEL
39191debfc3dSmrgThis marks what used to be a @code{code_label}, but was not used for other
39201debfc3dSmrgpurposes than taking its address and was transformed to mark that no
39211debfc3dSmrgcode jumps to it.
39221debfc3dSmrg
39231debfc3dSmrg@findex NOTE_INSN_BLOCK_BEG
39241debfc3dSmrg@findex NOTE_INSN_BLOCK_END
39251debfc3dSmrg@item NOTE_INSN_BLOCK_BEG
39261debfc3dSmrg@itemx NOTE_INSN_BLOCK_END
39271debfc3dSmrgThese types of notes indicate the position of the beginning and end
39281debfc3dSmrgof a level of scoping of variable names.  They control the output
39291debfc3dSmrgof debugging information.
39301debfc3dSmrg
39311debfc3dSmrg@findex NOTE_INSN_EH_REGION_BEG
39321debfc3dSmrg@findex NOTE_INSN_EH_REGION_END
39331debfc3dSmrg@item NOTE_INSN_EH_REGION_BEG
39341debfc3dSmrg@itemx NOTE_INSN_EH_REGION_END
39351debfc3dSmrgThese types of notes indicate the position of the beginning and end of a
39361debfc3dSmrglevel of scoping for exception handling.  @code{NOTE_EH_HANDLER}
39371debfc3dSmrgidentifies which region is associated with these notes.
39381debfc3dSmrg
39391debfc3dSmrg@findex NOTE_INSN_FUNCTION_BEG
39401debfc3dSmrg@item NOTE_INSN_FUNCTION_BEG
39411debfc3dSmrgAppears at the start of the function body, after the function
39421debfc3dSmrgprologue.
39431debfc3dSmrg
39441debfc3dSmrg@findex NOTE_INSN_VAR_LOCATION
39451debfc3dSmrg@findex NOTE_VAR_LOCATION
39461debfc3dSmrg@item NOTE_INSN_VAR_LOCATION
39471debfc3dSmrgThis note is used to generate variable location debugging information.
39481debfc3dSmrgIt indicates that the user variable in its @code{VAR_LOCATION} operand
39491debfc3dSmrgis at the location given in the RTL expression, or holds a value that
39501debfc3dSmrgcan be computed by evaluating the RTL expression from that static
39511debfc3dSmrgpoint in the program up to the next such note for the same user
39521debfc3dSmrgvariable.
39531debfc3dSmrg
3954a2dc1f3fSmrg@findex NOTE_INSN_BEGIN_STMT
3955a2dc1f3fSmrg@item NOTE_INSN_BEGIN_STMT
3956a2dc1f3fSmrgThis note is used to generate @code{is_stmt} markers in line number
3957a2dc1f3fSmrgdebuggign information.  It indicates the beginning of a user
3958a2dc1f3fSmrgstatement.
3959a2dc1f3fSmrg
3960a2dc1f3fSmrg@findex NOTE_INSN_INLINE_ENTRY
3961a2dc1f3fSmrg@item NOTE_INSN_INLINE_ENTRY
3962a2dc1f3fSmrgThis note is used to generate @code{entry_pc} for inlined subroutines in
3963a2dc1f3fSmrgdebugging information.  It indicates an inspection point at which all
3964a2dc1f3fSmrgarguments for the inlined function have been bound, and before its first
3965a2dc1f3fSmrgstatement.
3966a2dc1f3fSmrg
39671debfc3dSmrg@end table
39681debfc3dSmrg
39691debfc3dSmrgThese codes are printed symbolically when they appear in debugging dumps.
39701debfc3dSmrg
39711debfc3dSmrg@findex debug_insn
39721debfc3dSmrg@findex INSN_VAR_LOCATION
39731debfc3dSmrg@item debug_insn
39741debfc3dSmrgThe expression code @code{debug_insn} is used for pseudo-instructions
39751debfc3dSmrgthat hold debugging information for variable tracking at assignments
39761debfc3dSmrg(see @option{-fvar-tracking-assignments} option).  They are the RTL
39771debfc3dSmrgrepresentation of @code{GIMPLE_DEBUG} statements
39781debfc3dSmrg(@ref{@code{GIMPLE_DEBUG}}), with a @code{VAR_LOCATION} operand that
39791debfc3dSmrgbinds a user variable tree to an RTL representation of the
39801debfc3dSmrg@code{value} in the corresponding statement.  A @code{DEBUG_EXPR} in
39811debfc3dSmrgit stands for the value bound to the corresponding
39821debfc3dSmrg@code{DEBUG_EXPR_DECL}.
39831debfc3dSmrg
3984a2dc1f3fSmrg@code{GIMPLE_DEBUG_BEGIN_STMT} and @code{GIMPLE_DEBUG_INLINE_ENTRY} are
3985a2dc1f3fSmrgexpanded to RTL as a @code{DEBUG_INSN} with a @code{DEBUG_MARKER}
3986a2dc1f3fSmrg@code{PATTERN}; the difference is the RTL mode: the former's
3987a2dc1f3fSmrg@code{DEBUG_MARKER} is @code{VOIDmode}, whereas the latter is
3988a2dc1f3fSmrg@code{BLKmode}; information about the inlined function can be taken from
3989a2dc1f3fSmrgthe lexical block encoded in the @code{INSN_LOCATION}.  These
3990a2dc1f3fSmrg@code{DEBUG_INSN}s, that do not carry @code{VAR_LOCATION} information,
3991a2dc1f3fSmrgjust @code{DEBUG_MARKER}s, can be detected by testing
3992a2dc1f3fSmrg@code{DEBUG_MARKER_INSN_P}, whereas those that do can be recognized as
3993a2dc1f3fSmrg@code{DEBUG_BIND_INSN_P}.
3994a2dc1f3fSmrg
3995a2dc1f3fSmrgThroughout optimization passes, @code{DEBUG_INSN}s are not reordered
3996a2dc1f3fSmrgwith respect to each other, particularly during scheduling.  Binding
3997a2dc1f3fSmrginformation is kept in pseudo-instruction form, so that, unlike notes,
3998a2dc1f3fSmrgit gets the same treatment and adjustments that regular instructions
3999a2dc1f3fSmrgwould.  It is the variable tracking pass that turns these
4000a2dc1f3fSmrgpseudo-instructions into @code{NOTE_INSN_VAR_LOCATION},
4001a2dc1f3fSmrg@code{NOTE_INSN_BEGIN_STMT} and @code{NOTE_INSN_INLINE_ENTRY} notes,
4002a2dc1f3fSmrganalyzing control flow, value equivalences and changes to registers and
4003a2dc1f3fSmrgmemory referenced in value expressions, propagating the values of debug
4004a2dc1f3fSmrgtemporaries and determining expressions that can be used to compute the
4005a2dc1f3fSmrgvalue of each user variable at as many points (ranges, actually) in the
4006a2dc1f3fSmrgprogram as possible.
40071debfc3dSmrg
40081debfc3dSmrgUnlike @code{NOTE_INSN_VAR_LOCATION}, the value expression in an
40091debfc3dSmrg@code{INSN_VAR_LOCATION} denotes a value at that specific point in the
40101debfc3dSmrgprogram, rather than an expression that can be evaluated at any later
40111debfc3dSmrgpoint before an overriding @code{VAR_LOCATION} is encountered.  E.g.,
40121debfc3dSmrgif a user variable is bound to a @code{REG} and then a subsequent insn
40131debfc3dSmrgmodifies the @code{REG}, the note location would keep mapping the user
40141debfc3dSmrgvariable to the register across the insn, whereas the insn location
40151debfc3dSmrgwould keep the variable bound to the value, so that the variable
40161debfc3dSmrgtracking pass would emit another location note for the variable at the
40171debfc3dSmrgpoint in which the register is modified.
40181debfc3dSmrg
40191debfc3dSmrg@end table
40201debfc3dSmrg
40211debfc3dSmrg@cindex @code{TImode}, in @code{insn}
40221debfc3dSmrg@cindex @code{HImode}, in @code{insn}
40231debfc3dSmrg@cindex @code{QImode}, in @code{insn}
40241debfc3dSmrgThe machine mode of an insn is normally @code{VOIDmode}, but some
40251debfc3dSmrgphases use the mode for various purposes.
40261debfc3dSmrg
40271debfc3dSmrgThe common subexpression elimination pass sets the mode of an insn to
40281debfc3dSmrg@code{QImode} when it is the first insn in a block that has already
40291debfc3dSmrgbeen processed.
40301debfc3dSmrg
40311debfc3dSmrgThe second Haifa scheduling pass, for targets that can multiple issue,
40321debfc3dSmrgsets the mode of an insn to @code{TImode} when it is believed that the
40331debfc3dSmrginstruction begins an issue group.  That is, when the instruction
40341debfc3dSmrgcannot issue simultaneously with the previous.  This may be relied on
40351debfc3dSmrgby later passes, in particular machine-dependent reorg.
40361debfc3dSmrg
40371debfc3dSmrgHere is a table of the extra fields of @code{insn}, @code{jump_insn}
40381debfc3dSmrgand @code{call_insn} insns:
40391debfc3dSmrg
40401debfc3dSmrg@table @code
40411debfc3dSmrg@findex PATTERN
40421debfc3dSmrg@item PATTERN (@var{i})
40431debfc3dSmrgAn expression for the side effect performed by this insn.  This must
40441debfc3dSmrgbe one of the following codes: @code{set}, @code{call}, @code{use},
40451debfc3dSmrg@code{clobber}, @code{return}, @code{simple_return}, @code{asm_input},
40461debfc3dSmrg@code{asm_output}, @code{addr_vec}, @code{addr_diff_vec},
40471debfc3dSmrg@code{trap_if}, @code{unspec}, @code{unspec_volatile},
40481debfc3dSmrg@code{parallel}, @code{cond_exec}, or @code{sequence}.  If it is a
40491debfc3dSmrg@code{parallel}, each element of the @code{parallel} must be one these
40501debfc3dSmrgcodes, except that @code{parallel} expressions cannot be nested and
40511debfc3dSmrg@code{addr_vec} and @code{addr_diff_vec} are not permitted inside a
40521debfc3dSmrg@code{parallel} expression.
40531debfc3dSmrg
40541debfc3dSmrg@findex INSN_CODE
40551debfc3dSmrg@item INSN_CODE (@var{i})
40561debfc3dSmrgAn integer that says which pattern in the machine description matches
40571debfc3dSmrgthis insn, or @minus{}1 if the matching has not yet been attempted.
40581debfc3dSmrg
40591debfc3dSmrgSuch matching is never attempted and this field remains @minus{}1 on an insn
40601debfc3dSmrgwhose pattern consists of a single @code{use}, @code{clobber},
40611debfc3dSmrg@code{asm_input}, @code{addr_vec} or @code{addr_diff_vec} expression.
40621debfc3dSmrg
40631debfc3dSmrg@findex asm_noperands
40641debfc3dSmrgMatching is also never attempted on insns that result from an @code{asm}
40651debfc3dSmrgstatement.  These contain at least one @code{asm_operands} expression.
40661debfc3dSmrgThe function @code{asm_noperands} returns a non-negative value for
40671debfc3dSmrgsuch insns.
40681debfc3dSmrg
40691debfc3dSmrgIn the debugging output, this field is printed as a number followed by
40701debfc3dSmrga symbolic representation that locates the pattern in the @file{md}
40711debfc3dSmrgfile as some small positive or negative offset from a named pattern.
40721debfc3dSmrg
40731debfc3dSmrg@findex LOG_LINKS
40741debfc3dSmrg@item LOG_LINKS (@var{i})
40751debfc3dSmrgA list (chain of @code{insn_list} expressions) giving information about
40761debfc3dSmrgdependencies between instructions within a basic block.  Neither a jump
40771debfc3dSmrgnor a label may come between the related insns.  These are only used by
40781debfc3dSmrgthe schedulers and by combine.  This is a deprecated data structure.
40791debfc3dSmrgDef-use and use-def chains are now preferred.
40801debfc3dSmrg
40811debfc3dSmrg@findex REG_NOTES
40821debfc3dSmrg@item REG_NOTES (@var{i})
40831debfc3dSmrgA list (chain of @code{expr_list}, @code{insn_list} and @code{int_list}
40841debfc3dSmrgexpressions) giving miscellaneous information about the insn.  It is often
40851debfc3dSmrginformation pertaining to the registers used in this insn.
40861debfc3dSmrg@end table
40871debfc3dSmrg
40881debfc3dSmrgThe @code{LOG_LINKS} field of an insn is a chain of @code{insn_list}
40891debfc3dSmrgexpressions.  Each of these has two operands: the first is an insn,
40901debfc3dSmrgand the second is another @code{insn_list} expression (the next one in
40911debfc3dSmrgthe chain).  The last @code{insn_list} in the chain has a null pointer
40921debfc3dSmrgas second operand.  The significant thing about the chain is which
40931debfc3dSmrginsns appear in it (as first operands of @code{insn_list}
40941debfc3dSmrgexpressions).  Their order is not significant.
40951debfc3dSmrg
40961debfc3dSmrgThis list is originally set up by the flow analysis pass; it is a null
40971debfc3dSmrgpointer until then.  Flow only adds links for those data dependencies
40981debfc3dSmrgwhich can be used for instruction combination.  For each insn, the flow
40991debfc3dSmrganalysis pass adds a link to insns which store into registers values
41001debfc3dSmrgthat are used for the first time in this insn.
41011debfc3dSmrg
41021debfc3dSmrgThe @code{REG_NOTES} field of an insn is a chain similar to the
41031debfc3dSmrg@code{LOG_LINKS} field but it includes @code{expr_list} and @code{int_list}
41041debfc3dSmrgexpressions in addition to @code{insn_list} expressions.  There are several
41051debfc3dSmrgkinds of register notes, which are distinguished by the machine mode, which
41061debfc3dSmrgin a register note is really understood as being an @code{enum reg_note}.
41071debfc3dSmrgThe first operand @var{op} of the note is data whose meaning depends on
41081debfc3dSmrgthe kind of note.
41091debfc3dSmrg
41101debfc3dSmrg@findex REG_NOTE_KIND
41111debfc3dSmrg@findex PUT_REG_NOTE_KIND
41121debfc3dSmrgThe macro @code{REG_NOTE_KIND (@var{x})} returns the kind of
41131debfc3dSmrgregister note.  Its counterpart, the macro @code{PUT_REG_NOTE_KIND
41141debfc3dSmrg(@var{x}, @var{newkind})} sets the register note type of @var{x} to be
41151debfc3dSmrg@var{newkind}.
41161debfc3dSmrg
41171debfc3dSmrgRegister notes are of three classes: They may say something about an
41181debfc3dSmrginput to an insn, they may say something about an output of an insn, or
41191debfc3dSmrgthey may create a linkage between two insns.  There are also a set
41201debfc3dSmrgof values that are only used in @code{LOG_LINKS}.
41211debfc3dSmrg
41221debfc3dSmrgThese register notes annotate inputs to an insn:
41231debfc3dSmrg
41241debfc3dSmrg@table @code
41251debfc3dSmrg@findex REG_DEAD
41261debfc3dSmrg@item REG_DEAD
41271debfc3dSmrgThe value in @var{op} dies in this insn; that is to say, altering the
41281debfc3dSmrgvalue immediately after this insn would not affect the future behavior
41291debfc3dSmrgof the program.
41301debfc3dSmrg
41311debfc3dSmrgIt does not follow that the register @var{op} has no useful value after
41321debfc3dSmrgthis insn since @var{op} is not necessarily modified by this insn.
41331debfc3dSmrgRather, no subsequent instruction uses the contents of @var{op}.
41341debfc3dSmrg
41351debfc3dSmrg@findex REG_UNUSED
41361debfc3dSmrg@item REG_UNUSED
41371debfc3dSmrgThe register @var{op} being set by this insn will not be used in a
41381debfc3dSmrgsubsequent insn.  This differs from a @code{REG_DEAD} note, which
41391debfc3dSmrgindicates that the value in an input will not be used subsequently.
41401debfc3dSmrgThese two notes are independent; both may be present for the same
41411debfc3dSmrgregister.
41421debfc3dSmrg
41431debfc3dSmrg@findex REG_INC
41441debfc3dSmrg@item REG_INC
41451debfc3dSmrgThe register @var{op} is incremented (or decremented; at this level
41461debfc3dSmrgthere is no distinction) by an embedded side effect inside this insn.
41471debfc3dSmrgThis means it appears in a @code{post_inc}, @code{pre_inc},
41481debfc3dSmrg@code{post_dec} or @code{pre_dec} expression.
41491debfc3dSmrg
41501debfc3dSmrg@findex REG_NONNEG
41511debfc3dSmrg@item REG_NONNEG
41521debfc3dSmrgThe register @var{op} is known to have a nonnegative value when this
4153c0a68be4Smrginsn is reached.  This is used by special looping instructions
4154c0a68be4Smrgthat terminate when the register goes negative.
41551debfc3dSmrg
4156c0a68be4SmrgThe @code{REG_NONNEG} note is added only to @samp{doloop_end}
4157c0a68be4Smrginsns, if its pattern uses a @code{ge} condition.
41581debfc3dSmrg
41591debfc3dSmrg@findex REG_LABEL_OPERAND
41601debfc3dSmrg@item REG_LABEL_OPERAND
41611debfc3dSmrgThis insn uses @var{op}, a @code{code_label} or a @code{note} of type
41621debfc3dSmrg@code{NOTE_INSN_DELETED_LABEL}, but is not a @code{jump_insn}, or it
41631debfc3dSmrgis a @code{jump_insn} that refers to the operand as an ordinary
41641debfc3dSmrgoperand.  The label may still eventually be a jump target, but if so
41651debfc3dSmrgin an indirect jump in a subsequent insn.  The presence of this note
41661debfc3dSmrgallows jump optimization to be aware that @var{op} is, in fact, being
41671debfc3dSmrgused, and flow optimization to build an accurate flow graph.
41681debfc3dSmrg
41691debfc3dSmrg@findex REG_LABEL_TARGET
41701debfc3dSmrg@item REG_LABEL_TARGET
41711debfc3dSmrgThis insn is a @code{jump_insn} but not an @code{addr_vec} or
41721debfc3dSmrg@code{addr_diff_vec}.  It uses @var{op}, a @code{code_label} as a
41731debfc3dSmrgdirect or indirect jump target.  Its purpose is similar to that of
41741debfc3dSmrg@code{REG_LABEL_OPERAND}.  This note is only present if the insn has
41751debfc3dSmrgmultiple targets; the last label in the insn (in the highest numbered
41761debfc3dSmrginsn-field) goes into the @code{JUMP_LABEL} field and does not have a
41771debfc3dSmrg@code{REG_LABEL_TARGET} note.  @xref{Insns, JUMP_LABEL}.
41781debfc3dSmrg
41791debfc3dSmrg@findex REG_SETJMP
41801debfc3dSmrg@item REG_SETJMP
41811debfc3dSmrgAppears attached to each @code{CALL_INSN} to @code{setjmp} or a
41821debfc3dSmrgrelated function.
41831debfc3dSmrg@end table
41841debfc3dSmrg
41851debfc3dSmrgThe following notes describe attributes of outputs of an insn:
41861debfc3dSmrg
41871debfc3dSmrg@table @code
41881debfc3dSmrg@findex REG_EQUIV
41891debfc3dSmrg@findex REG_EQUAL
41901debfc3dSmrg@item REG_EQUIV
41911debfc3dSmrg@itemx REG_EQUAL
41921debfc3dSmrgThis note is only valid on an insn that sets only one register and
41931debfc3dSmrgindicates that that register will be equal to @var{op} at run time; the
41941debfc3dSmrgscope of this equivalence differs between the two types of notes.  The
41951debfc3dSmrgvalue which the insn explicitly copies into the register may look
41961debfc3dSmrgdifferent from @var{op}, but they will be equal at run time.  If the
41971debfc3dSmrgoutput of the single @code{set} is a @code{strict_low_part} or
41981debfc3dSmrg@code{zero_extract} expression, the note refers to the register that
41991debfc3dSmrgis contained in its first operand.
42001debfc3dSmrg
42011debfc3dSmrgFor @code{REG_EQUIV}, the register is equivalent to @var{op} throughout
42021debfc3dSmrgthe entire function, and could validly be replaced in all its
42031debfc3dSmrgoccurrences by @var{op}.  (``Validly'' here refers to the data flow of
42041debfc3dSmrgthe program; simple replacement may make some insns invalid.)  For
42051debfc3dSmrgexample, when a constant is loaded into a register that is never
42061debfc3dSmrgassigned any other value, this kind of note is used.
42071debfc3dSmrg
42081debfc3dSmrgWhen a parameter is copied into a pseudo-register at entry to a function,
42091debfc3dSmrga note of this kind records that the register is equivalent to the stack
42101debfc3dSmrgslot where the parameter was passed.  Although in this case the register
42111debfc3dSmrgmay be set by other insns, it is still valid to replace the register
42121debfc3dSmrgby the stack slot throughout the function.
42131debfc3dSmrg
42141debfc3dSmrgA @code{REG_EQUIV} note is also used on an instruction which copies a
42151debfc3dSmrgregister parameter into a pseudo-register at entry to a function, if
42161debfc3dSmrgthere is a stack slot where that parameter could be stored.  Although
42171debfc3dSmrgother insns may set the pseudo-register, it is valid for the compiler to
42181debfc3dSmrgreplace the pseudo-register by stack slot throughout the function,
42191debfc3dSmrgprovided the compiler ensures that the stack slot is properly
42201debfc3dSmrginitialized by making the replacement in the initial copy instruction as
42211debfc3dSmrgwell.  This is used on machines for which the calling convention
42221debfc3dSmrgallocates stack space for register parameters.  See
42231debfc3dSmrg@code{REG_PARM_STACK_SPACE} in @ref{Stack Arguments}.
42241debfc3dSmrg
42251debfc3dSmrgIn the case of @code{REG_EQUAL}, the register that is set by this insn
42261debfc3dSmrgwill be equal to @var{op} at run time at the end of this insn but not
42271debfc3dSmrgnecessarily elsewhere in the function.  In this case, @var{op}
42281debfc3dSmrgis typically an arithmetic expression.  For example, when a sequence of
42291debfc3dSmrginsns such as a library call is used to perform an arithmetic operation,
42301debfc3dSmrgthis kind of note is attached to the insn that produces or copies the
42311debfc3dSmrgfinal value.
42321debfc3dSmrg
42331debfc3dSmrgThese two notes are used in different ways by the compiler passes.
42341debfc3dSmrg@code{REG_EQUAL} is used by passes prior to register allocation (such as
42351debfc3dSmrgcommon subexpression elimination and loop optimization) to tell them how
42361debfc3dSmrgto think of that value.  @code{REG_EQUIV} notes are used by register
42371debfc3dSmrgallocation to indicate that there is an available substitute expression
42381debfc3dSmrg(either a constant or a @code{mem} expression for the location of a
42391debfc3dSmrgparameter on the stack) that may be used in place of a register if
42401debfc3dSmrginsufficient registers are available.
42411debfc3dSmrg
42421debfc3dSmrgExcept for stack homes for parameters, which are indicated by a
42431debfc3dSmrg@code{REG_EQUIV} note and are not useful to the early optimization
42441debfc3dSmrgpasses and pseudo registers that are equivalent to a memory location
42451debfc3dSmrgthroughout their entire life, which is not detected until later in
42461debfc3dSmrgthe compilation, all equivalences are initially indicated by an attached
42471debfc3dSmrg@code{REG_EQUAL} note.  In the early stages of register allocation, a
42481debfc3dSmrg@code{REG_EQUAL} note is changed into a @code{REG_EQUIV} note if
42491debfc3dSmrg@var{op} is a constant and the insn represents the only set of its
42501debfc3dSmrgdestination register.
42511debfc3dSmrg
42521debfc3dSmrgThus, compiler passes prior to register allocation need only check for
42531debfc3dSmrg@code{REG_EQUAL} notes and passes subsequent to register allocation
42541debfc3dSmrgneed only check for @code{REG_EQUIV} notes.
42551debfc3dSmrg@end table
42561debfc3dSmrg
42571debfc3dSmrgThese notes describe linkages between insns.  They occur in pairs: one
42581debfc3dSmrginsn has one of a pair of notes that points to a second insn, which has
42591debfc3dSmrgthe inverse note pointing back to the first insn.
42601debfc3dSmrg
42611debfc3dSmrg@table @code
42621debfc3dSmrg@findex REG_CC_SETTER
42631debfc3dSmrg@findex REG_CC_USER
42641debfc3dSmrg@item REG_CC_SETTER
42651debfc3dSmrg@itemx REG_CC_USER
42661debfc3dSmrgOn machines that use @code{cc0}, the insns which set and use @code{cc0}
42671debfc3dSmrgset and use @code{cc0} are adjacent.  However, when branch delay slot
42681debfc3dSmrgfilling is done, this may no longer be true.  In this case a
42691debfc3dSmrg@code{REG_CC_USER} note will be placed on the insn setting @code{cc0} to
42701debfc3dSmrgpoint to the insn using @code{cc0} and a @code{REG_CC_SETTER} note will
42711debfc3dSmrgbe placed on the insn using @code{cc0} to point to the insn setting
42721debfc3dSmrg@code{cc0}.
42731debfc3dSmrg@end table
42741debfc3dSmrg
42751debfc3dSmrgThese values are only used in the @code{LOG_LINKS} field, and indicate
42761debfc3dSmrgthe type of dependency that each link represents.  Links which indicate
42771debfc3dSmrga data dependence (a read after write dependence) do not use any code,
42781debfc3dSmrgthey simply have mode @code{VOIDmode}, and are printed without any
42791debfc3dSmrgdescriptive text.
42801debfc3dSmrg
42811debfc3dSmrg@table @code
42821debfc3dSmrg@findex REG_DEP_TRUE
42831debfc3dSmrg@item REG_DEP_TRUE
42841debfc3dSmrgThis indicates a true dependence (a read after write dependence).
42851debfc3dSmrg
42861debfc3dSmrg@findex REG_DEP_OUTPUT
42871debfc3dSmrg@item REG_DEP_OUTPUT
42881debfc3dSmrgThis indicates an output dependence (a write after write dependence).
42891debfc3dSmrg
42901debfc3dSmrg@findex REG_DEP_ANTI
42911debfc3dSmrg@item REG_DEP_ANTI
42921debfc3dSmrgThis indicates an anti dependence (a write after read dependence).
42931debfc3dSmrg
42941debfc3dSmrg@end table
42951debfc3dSmrg
42961debfc3dSmrgThese notes describe information gathered from gcov profile data.  They
42971debfc3dSmrgare stored in the @code{REG_NOTES} field of an insn.
42981debfc3dSmrg
42991debfc3dSmrg@table @code
43001debfc3dSmrg@findex REG_BR_PROB
43011debfc3dSmrg@item REG_BR_PROB
43021debfc3dSmrgThis is used to specify the ratio of branches to non-branches of a
43031debfc3dSmrgbranch insn according to the profile data.  The note is represented
4304a2dc1f3fSmrgas an @code{int_list} expression whose integer value is an encoding
4305a2dc1f3fSmrgof @code{profile_probability} type.  @code{profile_probability} provide
4306a2dc1f3fSmrgmember function @code{from_reg_br_prob_note} and @code{to_reg_br_prob_note}
4307a2dc1f3fSmrgto extract and store the probability into the RTL encoding.
43081debfc3dSmrg
43091debfc3dSmrg@findex REG_BR_PRED
43101debfc3dSmrg@item REG_BR_PRED
43111debfc3dSmrgThese notes are found in JUMP insns after delayed branch scheduling
43121debfc3dSmrghas taken place.  They indicate both the direction and the likelihood
43131debfc3dSmrgof the JUMP@.  The format is a bitmask of ATTR_FLAG_* values.
43141debfc3dSmrg
43151debfc3dSmrg@findex REG_FRAME_RELATED_EXPR
43161debfc3dSmrg@item REG_FRAME_RELATED_EXPR
43171debfc3dSmrgThis is used on an RTX_FRAME_RELATED_P insn wherein the attached expression
43181debfc3dSmrgis used in place of the actual insn pattern.  This is done in cases where
43191debfc3dSmrgthe pattern is either complex or misleading.
43201debfc3dSmrg@end table
43211debfc3dSmrg
4322a2dc1f3fSmrgThe note @code{REG_CALL_NOCF_CHECK} is used in conjunction with the
4323a2dc1f3fSmrg@option{-fcf-protection=branch} option.  The note is set if a
4324a2dc1f3fSmrg@code{nocf_check} attribute is specified for a function type or a
4325a2dc1f3fSmrgpointer to function type.  The note is stored in the @code{REG_NOTES}
4326a2dc1f3fSmrgfield of an insn.
4327a2dc1f3fSmrg
4328a2dc1f3fSmrg@table @code
4329a2dc1f3fSmrg@findex REG_CALL_NOCF_CHECK
4330a2dc1f3fSmrg@item REG_CALL_NOCF_CHECK
4331a2dc1f3fSmrgUsers have control through the @code{nocf_check} attribute to identify
4332a2dc1f3fSmrgwhich calls to a function should be skipped from control-flow instrumentation
4333a2dc1f3fSmrgwhen the option @option{-fcf-protection=branch} is specified.  The compiler
4334a2dc1f3fSmrgputs a @code{REG_CALL_NOCF_CHECK} note on each @code{CALL_INSN} instruction
4335a2dc1f3fSmrgthat has a function type marked with a @code{nocf_check} attribute.
4336a2dc1f3fSmrg@end table
4337a2dc1f3fSmrg
43381debfc3dSmrgFor convenience, the machine mode in an @code{insn_list} or
43391debfc3dSmrg@code{expr_list} is printed using these symbolic codes in debugging dumps.
43401debfc3dSmrg
43411debfc3dSmrg@findex insn_list
43421debfc3dSmrg@findex expr_list
43431debfc3dSmrgThe only difference between the expression codes @code{insn_list} and
43441debfc3dSmrg@code{expr_list} is that the first operand of an @code{insn_list} is
43451debfc3dSmrgassumed to be an insn and is printed in debugging dumps as the insn's
43461debfc3dSmrgunique id; the first operand of an @code{expr_list} is printed in the
43471debfc3dSmrgordinary way as an expression.
43481debfc3dSmrg
43491debfc3dSmrg@node Calls
43501debfc3dSmrg@section RTL Representation of Function-Call Insns
43511debfc3dSmrg@cindex calling functions in RTL
43521debfc3dSmrg@cindex RTL function-call insns
43531debfc3dSmrg@cindex function-call insns
43541debfc3dSmrg
43551debfc3dSmrgInsns that call subroutines have the RTL expression code @code{call_insn}.
43561debfc3dSmrgThese insns must satisfy special rules, and their bodies must use a special
43571debfc3dSmrgRTL expression code, @code{call}.
43581debfc3dSmrg
43591debfc3dSmrg@cindex @code{call} usage
43601debfc3dSmrgA @code{call} expression has two operands, as follows:
43611debfc3dSmrg
43621debfc3dSmrg@smallexample
43631debfc3dSmrg(call (mem:@var{fm} @var{addr}) @var{nbytes})
43641debfc3dSmrg@end smallexample
43651debfc3dSmrg
43661debfc3dSmrg@noindent
43671debfc3dSmrgHere @var{nbytes} is an operand that represents the number of bytes of
43681debfc3dSmrgargument data being passed to the subroutine, @var{fm} is a machine mode
43691debfc3dSmrg(which must equal as the definition of the @code{FUNCTION_MODE} macro in
43701debfc3dSmrgthe machine description) and @var{addr} represents the address of the
43711debfc3dSmrgsubroutine.
43721debfc3dSmrg
43731debfc3dSmrgFor a subroutine that returns no value, the @code{call} expression as
43741debfc3dSmrgshown above is the entire body of the insn, except that the insn might
43751debfc3dSmrgalso contain @code{use} or @code{clobber} expressions.
43761debfc3dSmrg
43771debfc3dSmrg@cindex @code{BLKmode}, and function return values
43781debfc3dSmrgFor a subroutine that returns a value whose mode is not @code{BLKmode},
43791debfc3dSmrgthe value is returned in a hard register.  If this register's number is
43801debfc3dSmrg@var{r}, then the body of the call insn looks like this:
43811debfc3dSmrg
43821debfc3dSmrg@smallexample
43831debfc3dSmrg(set (reg:@var{m} @var{r})
43841debfc3dSmrg     (call (mem:@var{fm} @var{addr}) @var{nbytes}))
43851debfc3dSmrg@end smallexample
43861debfc3dSmrg
43871debfc3dSmrg@noindent
43881debfc3dSmrgThis RTL expression makes it clear (to the optimizer passes) that the
43891debfc3dSmrgappropriate register receives a useful value in this insn.
43901debfc3dSmrg
43911debfc3dSmrgWhen a subroutine returns a @code{BLKmode} value, it is handled by
43921debfc3dSmrgpassing to the subroutine the address of a place to store the value.
43931debfc3dSmrgSo the call insn itself does not ``return'' any value, and it has the
43941debfc3dSmrgsame RTL form as a call that returns nothing.
43951debfc3dSmrg
43961debfc3dSmrgOn some machines, the call instruction itself clobbers some register,
43971debfc3dSmrgfor example to contain the return address.  @code{call_insn} insns
43981debfc3dSmrgon these machines should have a body which is a @code{parallel}
43991debfc3dSmrgthat contains both the @code{call} expression and @code{clobber}
44001debfc3dSmrgexpressions that indicate which registers are destroyed.  Similarly,
44011debfc3dSmrgif the call instruction requires some register other than the stack
44021debfc3dSmrgpointer that is not explicitly mentioned in its RTL, a @code{use}
44031debfc3dSmrgsubexpression should mention that register.
44041debfc3dSmrg
44051debfc3dSmrgFunctions that are called are assumed to modify all registers listed in
44061debfc3dSmrgthe configuration macro @code{CALL_USED_REGISTERS} (@pxref{Register
44071debfc3dSmrgBasics}) and, with the exception of @code{const} functions and library
44081debfc3dSmrgcalls, to modify all of memory.
44091debfc3dSmrg
44101debfc3dSmrgInsns containing just @code{use} expressions directly precede the
44111debfc3dSmrg@code{call_insn} insn to indicate which registers contain inputs to the
44121debfc3dSmrgfunction.  Similarly, if registers other than those in
44131debfc3dSmrg@code{CALL_USED_REGISTERS} are clobbered by the called function, insns
44141debfc3dSmrgcontaining a single @code{clobber} follow immediately after the call to
44151debfc3dSmrgindicate which registers.
44161debfc3dSmrg
44171debfc3dSmrg@node Sharing
44181debfc3dSmrg@section Structure Sharing Assumptions
44191debfc3dSmrg@cindex sharing of RTL components
44201debfc3dSmrg@cindex RTL structure sharing assumptions
44211debfc3dSmrg
44221debfc3dSmrgThe compiler assumes that certain kinds of RTL expressions are unique;
44231debfc3dSmrgthere do not exist two distinct objects representing the same value.
44241debfc3dSmrgIn other cases, it makes an opposite assumption: that no RTL expression
44251debfc3dSmrgobject of a certain kind appears in more than one place in the
44261debfc3dSmrgcontaining structure.
44271debfc3dSmrg
44281debfc3dSmrgThese assumptions refer to a single function; except for the RTL
44291debfc3dSmrgobjects that describe global variables and external functions,
44301debfc3dSmrgand a few standard objects such as small integer constants,
44311debfc3dSmrgno RTL objects are common to two functions.
44321debfc3dSmrg
44331debfc3dSmrg@itemize @bullet
44341debfc3dSmrg@cindex @code{reg}, RTL sharing
44351debfc3dSmrg@item
44361debfc3dSmrgEach pseudo-register has only a single @code{reg} object to represent it,
44371debfc3dSmrgand therefore only a single machine mode.
44381debfc3dSmrg
44391debfc3dSmrg@cindex symbolic label
44401debfc3dSmrg@cindex @code{symbol_ref}, RTL sharing
44411debfc3dSmrg@item
44421debfc3dSmrgFor any symbolic label, there is only one @code{symbol_ref} object
44431debfc3dSmrgreferring to it.
44441debfc3dSmrg
44451debfc3dSmrg@cindex @code{const_int}, RTL sharing
44461debfc3dSmrg@item
44471debfc3dSmrgAll @code{const_int} expressions with equal values are shared.
44481debfc3dSmrg
4449a2dc1f3fSmrg@cindex @code{const_poly_int}, RTL sharing
4450a2dc1f3fSmrg@item
4451a2dc1f3fSmrgAll @code{const_poly_int} expressions with equal modes and values
4452a2dc1f3fSmrgare shared.
4453a2dc1f3fSmrg
44541debfc3dSmrg@cindex @code{pc}, RTL sharing
44551debfc3dSmrg@item
44561debfc3dSmrgThere is only one @code{pc} expression.
44571debfc3dSmrg
44581debfc3dSmrg@cindex @code{cc0}, RTL sharing
44591debfc3dSmrg@item
44601debfc3dSmrgThere is only one @code{cc0} expression.
44611debfc3dSmrg
44621debfc3dSmrg@cindex @code{const_double}, RTL sharing
44631debfc3dSmrg@item
44641debfc3dSmrgThere is only one @code{const_double} expression with value 0 for
44651debfc3dSmrgeach floating point mode.  Likewise for values 1 and 2.
44661debfc3dSmrg
44671debfc3dSmrg@cindex @code{const_vector}, RTL sharing
44681debfc3dSmrg@item
44691debfc3dSmrgThere is only one @code{const_vector} expression with value 0 for
44701debfc3dSmrgeach vector mode, be it an integer or a double constant vector.
44711debfc3dSmrg
44721debfc3dSmrg@cindex @code{label_ref}, RTL sharing
44731debfc3dSmrg@cindex @code{scratch}, RTL sharing
44741debfc3dSmrg@item
44751debfc3dSmrgNo @code{label_ref} or @code{scratch} appears in more than one place in
44761debfc3dSmrgthe RTL structure; in other words, it is safe to do a tree-walk of all
44771debfc3dSmrgthe insns in the function and assume that each time a @code{label_ref}
44781debfc3dSmrgor @code{scratch} is seen it is distinct from all others that are seen.
44791debfc3dSmrg
44801debfc3dSmrg@cindex @code{mem}, RTL sharing
44811debfc3dSmrg@item
44821debfc3dSmrgOnly one @code{mem} object is normally created for each static
44831debfc3dSmrgvariable or stack slot, so these objects are frequently shared in all
44841debfc3dSmrgthe places they appear.  However, separate but equal objects for these
44851debfc3dSmrgvariables are occasionally made.
44861debfc3dSmrg
44871debfc3dSmrg@cindex @code{asm_operands}, RTL sharing
44881debfc3dSmrg@item
44891debfc3dSmrgWhen a single @code{asm} statement has multiple output operands, a
44901debfc3dSmrgdistinct @code{asm_operands} expression is made for each output operand.
44911debfc3dSmrgHowever, these all share the vector which contains the sequence of input
44921debfc3dSmrgoperands.  This sharing is used later on to test whether two
44931debfc3dSmrg@code{asm_operands} expressions come from the same statement, so all
44941debfc3dSmrgoptimizations must carefully preserve the sharing if they copy the
44951debfc3dSmrgvector at all.
44961debfc3dSmrg
44971debfc3dSmrg@item
44981debfc3dSmrgNo RTL object appears in more than one place in the RTL structure
44991debfc3dSmrgexcept as described above.  Many passes of the compiler rely on this
45001debfc3dSmrgby assuming that they can modify RTL objects in place without unwanted
45011debfc3dSmrgside-effects on other insns.
45021debfc3dSmrg
45031debfc3dSmrg@findex unshare_all_rtl
45041debfc3dSmrg@item
45051debfc3dSmrgDuring initial RTL generation, shared structure is freely introduced.
45061debfc3dSmrgAfter all the RTL for a function has been generated, all shared
45071debfc3dSmrgstructure is copied by @code{unshare_all_rtl} in @file{emit-rtl.c},
45081debfc3dSmrgafter which the above rules are guaranteed to be followed.
45091debfc3dSmrg
45101debfc3dSmrg@findex copy_rtx_if_shared
45111debfc3dSmrg@item
45121debfc3dSmrgDuring the combiner pass, shared structure within an insn can exist
45131debfc3dSmrgtemporarily.  However, the shared structure is copied before the
45141debfc3dSmrgcombiner is finished with the insn.  This is done by calling
45151debfc3dSmrg@code{copy_rtx_if_shared}, which is a subroutine of
45161debfc3dSmrg@code{unshare_all_rtl}.
45171debfc3dSmrg@end itemize
45181debfc3dSmrg
45191debfc3dSmrg@node Reading RTL
45201debfc3dSmrg@section Reading RTL
45211debfc3dSmrg
45221debfc3dSmrgTo read an RTL object from a file, call @code{read_rtx}.  It takes one
45231debfc3dSmrgargument, a stdio stream, and returns a single RTL object.  This routine
45241debfc3dSmrgis defined in @file{read-rtl.c}.  It is not available in the compiler
45251debfc3dSmrgitself, only the various programs that generate the compiler back end
45261debfc3dSmrgfrom the machine description.
45271debfc3dSmrg
45281debfc3dSmrgPeople frequently have the idea of using RTL stored as text in a file as
45291debfc3dSmrgan interface between a language front end and the bulk of GCC@.  This
45301debfc3dSmrgidea is not feasible.
45311debfc3dSmrg
45321debfc3dSmrgGCC was designed to use RTL internally only.  Correct RTL for a given
45331debfc3dSmrgprogram is very dependent on the particular target machine.  And the RTL
45341debfc3dSmrgdoes not contain all the information about the program.
45351debfc3dSmrg
45361debfc3dSmrgThe proper way to interface GCC to a new language front end is with
45371debfc3dSmrgthe ``tree'' data structure, described in the files @file{tree.h} and
45381debfc3dSmrg@file{tree.def}.  The documentation for this structure (@pxref{GENERIC})
45391debfc3dSmrgis incomplete.
4540