Next:Registers and Memory, Previous:Machine Modes, Up:RTL Representation [Contents][Index]
The simplest RTL expressions are those that represent constant values.
(const_inti) ¶This type of expression represents the integer valuei.iis customarily accessed with the macroINTVAL as inINTVAL (exp), which is equivalent toXWINT (exp, 0).
Constants generated for modes with fewer bits than inHOST_WIDE_INT must be sign extended to full width (e.g., withgen_int_mode). For constants for modes with more bits than inHOST_WIDE_INT the implied high order bits of that constant arecopies of the top bit. Note however that values are neitherinherently signed nor inherently unsigned; where necessary, signednessis determined by the rtl operation instead.
There is only one expression object for the integer value zero; it isthe value of the variableconst0_rtx. Likewise, the onlyexpression for integer value one is found inconst1_rtx, the onlyexpression for integer value two is found inconst2_rtx, and theonly expression for integer value negative one is found inconstm1_rtx. Any attempt to create an expression of codeconst_int and value zero, one, two or negative one will returnconst0_rtx,const1_rtx,const2_rtx orconstm1_rtx as appropriate.
Similarly, there is only one object for the integer whose value isSTORE_FLAG_VALUE. It is found inconst_true_rtx. IfSTORE_FLAG_VALUE is one,const_true_rtx andconst1_rtx will point to the same object. IfSTORE_FLAG_VALUE is −1,const_true_rtx andconstm1_rtx will point to the same object.
(const_double:mi0i1 …) ¶This represents either a floating-point constant of modem or(on older ports that do not defineTARGET_SUPPORTS_WIDE_INT) an integer constant too large to fitintoHOST_BITS_PER_WIDE_INT bits but small enough to fit withintwice that number of bits. In the latter case,m will beVOIDmode. For integral values constants for modes with morebits than twice the number inHOST_WIDE_INT the implied highorder bits of that constant are copies of the top bit ofCONST_DOUBLE_HIGH. Note however that integral values areneither inherently signed nor inherently unsigned; where necessary,signedness is determined by the rtl operation instead.
On more modern ports,CONST_DOUBLE only represents floatingpoint values. New ports defineTARGET_SUPPORTS_WIDE_INT tomake this designation.
Ifm isVOIDmode, the bits of the value are stored ini0 andi1.i0 is customarily accessed with the macroCONST_DOUBLE_LOW andi1 withCONST_DOUBLE_HIGH.
If the constant is floating point (regardless of its precision), thenthe number of integers used to store the value depends on the size ofREAL_VALUE_TYPE (seeCross Compilation and Floating Point). The integersrepresent a floating point number, but not precisely in the targetmachine’s or host machine’s floating point format. To convert them tothe precise bit pattern used by the target machine, use the macroREAL_VALUE_TO_TARGET_DOUBLE and friends (seeOutput of Data).
The host dependency for the number of integers used to store a doublevalue makes it problematic for machine descriptions to use expressionsof codeconst_double and therefore a syntactic alias has beenprovided:
(const_double_zero:m)
standing for:
(const_double:m 0 0 …)
for matching the floating-point value zero, possibly the only useful one.
(const_wide_int:mnunitselt0 …) ¶This contains an array ofHOST_WIDE_INTs that is large enoughto hold any constant that can be represented on the target. This formof rtl is only used on targets that defineTARGET_SUPPORTS_WIDE_INT to be nonzero and thenCONST_DOUBLEs are only used to hold floating-point values. Ifthe target leavesTARGET_SUPPORTS_WIDE_INT defined as 0,CONST_WIDE_INTs are not used andCONST_DOUBLEs are asthey were before.
The values are stored in a compressed format. The higher-order0s or -1s are not represented if they are just the logical signextension of the number that is represented.
CONST_WIDE_INT_VEC (code) ¶Returns the entire array ofHOST_WIDE_INTs that are used tostore the value. This macro should be rarely used.
CONST_WIDE_INT_NUNITS (code) ¶The number ofHOST_WIDE_INTs used to represent the number.Note that this generally is smaller than the number ofHOST_WIDE_INTs implied by the mode size.
CONST_WIDE_INT_ELT (code,i) ¶Returns theith element of the array. Element 0 is containsthe low order bits of the constant.
(const_fixed:m …) ¶Represents a fixed-point constant of modem.The operand is a data structure of typestruct fixed_value andis accessed with the macroCONST_FIXED_VALUE. The high part ofdata is accessed withCONST_FIXED_VALUE_HIGH; the low part isaccessed withCONST_FIXED_VALUE_LOW.
(const_poly_int:m [c0c1 …]) ¶Represents apoly_int-style polynomial integer with coefficientsc0,c1, …. The coefficients arewide_int-basedintegers rather than rtxes.CONST_POLY_INT_COEFFS gives thevalues of individual coefficients (which is mostly only useful inlow-level routines) andconst_poly_int_value gives the fullpoly_int value.
(const_vector:m [x0x1 …]) ¶Represents a vector constant. The values in square brackets areelements of the vector, which are alwaysconst_int,const_wide_int,const_double orconst_fixedexpressions.
Each vector constantv is treated as a specific instance of anarbitrary-length sequence that itself contains‘CONST_VECTOR_NPATTERNS (v)’ interleaved patterns. Eachpattern has the form:
{base0,base1,base1 +step,base1 +step * 2, … }The first three elements in each pattern are enough to determine thevalues of the other elements. However, if allsteps are zero,only the first two elements are needed. If in addition eachbase1is equal to the correspondingbase0, only the first element ineach pattern is needed. The number of determining elements per patternis given by ‘CONST_VECTOR_NELTS_PER_PATTERN (v)’.
For example, the constant:
{ 0, 1, 2, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8, 18 }is interpreted as an interleaving of the sequences:
{ 0, 2, 3, 4, 5, 6, 7, 8 }{ 1, 6, 8, 10, 12, 14, 16, 18 }where the sequences are represented by the following patterns:
base0 == 0,base1 == 2,step == 1base0 == 1,base1 == 6,step == 2
In this case:
CONST_VECTOR_NPATTERNS (v) == 2CONST_VECTOR_NELTS_PER_PATTERN (v) == 3
Thus the first 6 elements (‘{ 0, 1, 2, 6, 3, 8 }’) are enoughto determine the whole sequence; we refer to them as the “encoded”elements. They are the only elements present in the square bracketsfor variable-lengthconst_vectors (i.e. forconst_vectors whose modem has a variable number ofelements). However, as a convenience to code that needs to handlebothconst_vectors andparallels, all elements arepresent in the square brackets for fixed-lengthconst_vectors;the encoding scheme simply reduces the amount of work involved inprocessing constants that follow a regular pattern.
Sometimes this scheme can create two possible encodings of the samevector. For example { 0, 1 } could be seen as two patterns withone element each or one pattern with two elements (base0 andbase1). The canonical encoding is always the one with thefewest patterns or (if both encodings have the same number ofpatterns) the one with the fewest encoded elements.
‘const_vector_encoding_nelts (v)’ gives the total number ofencoded elements inv, which is 6 in the example above.CONST_VECTOR_ENCODED_ELT (v,i) accesses the valueof encoded elementi.
‘CONST_VECTOR_DUPLICATE_P (v)’ is true ifv simply containsrepeated instances of ‘CONST_VECTOR_NPATTERNS (v)’ values. This isa shorthand for testing ‘CONST_VECTOR_NELTS_PER_PATTERN (v) == 1’.
‘CONST_VECTOR_STEPPED_P (v)’ is true if at least onepattern inv has a nonzero step. This is a shorthand fortesting ‘CONST_VECTOR_NELTS_PER_PATTERN (v) == 3’.
CONST_VECTOR_NUNITS (v) gives the total number of elementsinv; it is a shorthand for getting the number of units in‘GET_MODE (v)’.
The utility functionconst_vector_elt gives the value of anarbitrary element as anrtx.const_vector_int_elt givesthe same value as awide_int.
(const_stringstr) ¶Represents a constant string with valuestr. Currently this isused only for insn attributes (seeInstruction Attributes) since constantstrings in C are placed in memory.
(symbol_ref:modesymbol) ¶Represents the value of an assembler label for data.symbol isa string that describes the name of the assembler label. If it startswith a ‘*’, the label is the rest ofsymbol not includingthe ‘*’. Otherwise, the label issymbol, usually prefixedwith ‘_’.
Thesymbol_ref contains a mode, which is usuallyPmode.Usually that is the only mode for which a symbol is directly valid.
(label_ref:modelabel) ¶Represents the value of an assembler label for code. It contains oneoperand, an expression, which must be acode_label or anoteof typeNOTE_INSN_DELETED_LABEL that appears in the instructionsequence to identify the place where the label should go.
The reason for using a distinct expression type for code labelreferences is so that jump optimization can distinguish them.
Thelabel_ref contains a mode, which is usuallyPmode.Usually that is the only mode for which a label is directly valid.
(const:mexp) ¶Represents a constant that is the result of an assembly-timearithmetic computation. The operand,exp, contains onlyconst_int,symbol_ref,label_ref orunspecexpressions, combined withplus andminus. Any suchunspecs are target-specific and typically represent some formof relocation operator.m should be a valid address mode.
(high:mexp) ¶Represents the high-order bits ofexp. The number of bits is machine-dependent and isnormally the number of bits specified in an instruction that initializesthe high order bits of a register. It is used withlo_sum torepresent the typical two-instruction sequence used in RISC machines toreference large immediate values and/or link-time constants suchas global memory addresses. In the latter case,m isPmodeandexp is usually a constant expression involvingsymbol_ref.
The macroCONST0_RTX (mode) refers to an expression withvalue 0 in modemode. If modemode is of mode classMODE_INT, it returnsconst0_rtx. If modemode is ofmode classMODE_FLOAT, it returns aCONST_DOUBLEexpression in modemode. Otherwise, it returns aCONST_VECTOR expression in modemode. Similarly, the macroCONST1_RTX (mode) refers to an expression with value 1 inmodemode and similarly forCONST2_RTX. TheCONST1_RTX andCONST2_RTX macros are undefinedfor vector modes.
Next:Registers and Memory, Previous:Machine Modes, Up:RTL Representation [Contents][Index]