|
|
1.1.1.4 ! root 1: This is Info file gcc.info, produced by Makeinfo-1.49 from the input 1.1 root 2: file gcc.texi. 3: 4: This file documents the use and the internals of the GNU compiler. 5: 6: Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc. 7: 1.1.1.3 root 8: Permission is granted to make and distribute verbatim copies of this 9: manual provided the copyright notice and this permission notice are 10: preserved on all copies. 1.1 root 11: 12: Permission is granted to copy and distribute modified versions of 13: this manual under the conditions for verbatim copying, provided also 1.1.1.4 ! root 14: that the sections entitled "GNU General Public License" and "Protect ! 15: Your Freedom--Fight `Look And Feel'" are included exactly as in the ! 16: original, and provided that the entire resulting derived work is ! 17: distributed under the terms of a permission notice identical to this ! 18: one. 1.1 root 19: 20: Permission is granted to copy and distribute translations of this 21: manual into another language, under the above conditions for modified 1.1.1.3 root 22: versions, except that the sections entitled "GNU General Public 1.1.1.4 ! root 23: License" and "Protect Your Freedom--Fight `Look And Feel'", and this ! 24: permission notice, may be included in translations approved by the Free ! 25: Software Foundation instead of in the original English. 1.1.1.3 root 26: 27: 1.1.1.4 ! root 28: File: gcc.info, Node: Accessors, Next: Flags, Prev: RTL Objects, Up: RTL 1.1.1.3 root 29: 1.1.1.4 ! root 30: Access to Operands ! 31: ================== 1.1.1.3 root 32: 1.1.1.4 ! root 33: For each expression type `rtl.def' specifies the number of contained ! 34: objects and their kinds, with four possibilities: `e' for expression ! 35: (actually a pointer to an expression), `i' for integer, `w' for wide ! 36: integer, `s' for string, and `E' for vector of expressions. The ! 37: sequence of letters for an expression code is called its "format". ! 38: Thus, the format of `subreg' is `ei'. ! 39: ! 40: A few other format characters are used occasionally: ! 41: ! 42: `u' ! 43: `u' is equivalent to `e' except that it is printed differently in ! 44: debugging dumps. It is used for pointers to insns. ! 45: ! 46: `n' ! 47: `n' is equivalent to `i' except that it is printed differently in ! 48: debugging dumps. It is used for the line number or code number of ! 49: a `note' insn. ! 50: ! 51: `S' ! 52: `S' indicates a string which is optional. In the RTL objects in ! 53: core, `S' is equivalent to `s', but when the object is read, from ! 54: an `md' file, the string value of this operand may be omitted. An ! 55: omitted string is taken to be the null string. ! 56: ! 57: `V' ! 58: `V' indicates a vector which is optional. In the RTL objects in ! 59: core, `V' is equivalent to `E', but when the object is read from ! 60: an `md' file, the vector value of this operand may be omitted. An ! 61: omitted vector is effectively the same as a vector of no elements. ! 62: ! 63: `0' ! 64: `0' means a slot whose contents do not fit any normal category. ! 65: `0' slots are not printed at all in dumps, and are often used in ! 66: special ways by small parts of the compiler. ! 67: ! 68: There are macros to get the number of operands, the format, and the ! 69: class of an expression code: ! 70: ! 71: `GET_RTX_LENGTH (CODE)' ! 72: Number of operands of an RTX of code CODE. ! 73: ! 74: `GET_RTX_FORMAT (CODE)' ! 75: The format of an RTX of code CODE, as a C string. ! 76: ! 77: `GET_RTX_CLASS (CODE)' ! 78: A single character representing the type of RTX operation that code ! 79: CODE performs. ! 80: ! 81: The following classes are defined: ! 82: ! 83: `o' ! 84: An RTX code that represents an actual object, such as `reg' or ! 85: `mem'. `subreg' is not in this class. ! 86: ! 87: `<' ! 88: An RTX code for a comparison. The codes in this class are ! 89: `NE', `EQ', `LE', `LT', `GE', `GT', `LEU', `LTU', `GEU', ! 90: `GTU'. ! 91: ! 92: `1' ! 93: An RTX code for a unary arithmetic operation, such as `neg'. ! 94: ! 95: `c' ! 96: An RTX code for a commutative binary operation, other than ! 97: `NE' and `EQ' (which have class `<'). ! 98: ! 99: `2' ! 100: An RTX code for a noncommutative binary operation, such as ! 101: `MINUS'. ! 102: ! 103: `b' ! 104: An RTX code for a bitfield operation (`ZERO_EXTRACT' and ! 105: `SIGN_EXTRACT'). ! 106: ! 107: `3' ! 108: An RTX code for other three input operations, such as ! 109: `IF_THEN_ELSE'. ! 110: ! 111: `i' ! 112: An RTX code for a machine insn (`INSN', `JUMP_INSN', and ! 113: `CALL_INSN'). ! 114: ! 115: `m' ! 116: An RTX code for something that matches in insns, such as ! 117: `MATCH_DUP'. ! 118: ! 119: `x' ! 120: All other RTX codes. ! 121: ! 122: Operands of expressions are accessed using the macros `XEXP', ! 123: `XINT', `XWINT' and `XSTR'. Each of these macros takes two arguments: ! 124: an expression-pointer (RTX) and an operand number (counting from zero). ! 125: Thus, ! 126: ! 127: XEXP (X, 2) ! 128: ! 129: accesses operand 2 of expression X, as an expression. ! 130: ! 131: XINT (X, 2) ! 132: ! 133: accesses the same operand as an integer. `XSTR', used in the same ! 134: fashion, would access it as a string. ! 135: ! 136: Any operand can be accessed as an integer, as an expression or as a ! 137: string. You must choose the correct method of access for the kind of ! 138: value actually stored in the operand. You would do this based on the ! 139: expression code of the containing expression. That is also how you ! 140: would know how many operands there are. ! 141: ! 142: For example, if X is a `subreg' expression, you know that it has two ! 143: operands which can be correctly accessed as `XEXP (X, 0)' and `XINT (X, ! 144: 1)'. If you did `XINT (X, 0)', you would get the address of the ! 145: expression operand but cast as an integer; that might occasionally be ! 146: useful, but it would be cleaner to write `(int) XEXP (X, 0)'. `XEXP ! 147: (X, 1)' would also compile without error, and would return the second, ! 148: integer operand cast as an expression pointer, which would probably ! 149: result in a crash when accessed. Nothing stops you from writing `XEXP ! 150: (X, 28)' either, but this will access memory past the end of the ! 151: expression with unpredictable results. ! 152: ! 153: Access to operands which are vectors is more complicated. You can ! 154: use the macro `XVEC' to get the vector-pointer itself, or the macros ! 155: `XVECEXP' and `XVECLEN' to access the elements and length of a vector. ! 156: ! 157: `XVEC (EXP, IDX)' ! 158: Access the vector-pointer which is operand number IDX in EXP. ! 159: ! 160: `XVECLEN (EXP, IDX)' ! 161: Access the length (number of elements) in the vector which is in ! 162: operand number IDX in EXP. This value is an `int'. ! 163: ! 164: `XVECEXP (EXP, IDX, ELTNUM)' ! 165: Access element number ELTNUM in the vector which is in operand ! 166: number IDX in EXP. This value is an RTX. ! 167: ! 168: It is up to you to make sure that ELTNUM is not negative and is ! 169: less than `XVECLEN (EXP, IDX)'. ! 170: ! 171: All the macros defined in this section expand into lvalues and ! 172: therefore can be used to assign the operands, lengths and vector ! 173: elements as well as to access them. 1.1.1.3 root 174: 175: 1.1.1.4 ! root 176: File: gcc.info, Node: Flags, Next: Machine Modes, Prev: Accessors, Up: RTL 1.1.1.3 root 177: 1.1.1.4 ! root 178: Flags in an RTL Expression ! 179: ========================== 1.1.1.3 root 180: 1.1.1.4 ! root 181: RTL expressions contain several flags (one-bit bit-fields) that are ! 182: used in certain types of expression. Most often they are accessed with ! 183: the following macros: ! 184: ! 185: `MEM_VOLATILE_P (X)' ! 186: In `mem' expressions, nonzero for volatile memory references. ! 187: Stored in the `volatil' field and printed as `/v'. ! 188: ! 189: `MEM_IN_STRUCT_P (X)' ! 190: In `mem' expressions, nonzero for reference to an entire ! 191: structure, union or array, or to a component of one. Zero for ! 192: references to a scalar variable or through a pointer to a scalar. ! 193: Stored in the `in_struct' field and printed as `/s'. ! 194: ! 195: `REG_LOOP_TEST_P' ! 196: In `reg' expressions, nonzero if this register's entire life is ! 197: contained in the exit test code for some loop. Stored in the ! 198: `in_struct' field and printed as `/s'. ! 199: ! 200: `REG_USERVAR_P (X)' ! 201: In a `reg', nonzero if it corresponds to a variable present in the ! 202: user's source code. Zero for temporaries generated internally by ! 203: the compiler. Stored in the `volatil' field and printed as `/v'. ! 204: ! 205: `REG_FUNCTION_VALUE_P (X)' ! 206: Nonzero in a `reg' if it is the place in which this function's ! 207: value is going to be returned. (This happens only in a hard ! 208: register.) Stored in the `integrated' field and printed as `/i'. ! 209: ! 210: The same hard register may be used also for collecting the values ! 211: of functions called by this one, but `REG_FUNCTION_VALUE_P' is zero ! 212: in this kind of use. ! 213: ! 214: `SUBREG_PROMOTED_VAR_P' ! 215: Nonzero in a `subreg' if it was made when accessing an object that ! 216: was promoted to a wider mode in accord with the `PROMOTED_MODE' ! 217: machine description macro (*note Storage Layout::.). In this ! 218: case, the mode of the `subreg' is the declared mode of the object ! 219: and the mode of `SUBREG_REG' is the mode of the register that ! 220: holds the object. Promoted variables are always either sign- or ! 221: zero-extended to the wider mode on every assignment. Stored in ! 222: the `in_struct' field and printed as `/s'. ! 223: ! 224: `SUBREG_PROMOTED_UNSIGNED_P' ! 225: Nonzero in a `subreg' that has `SUBREG_PROMOTED_VAR_P' nonzero if ! 226: the object being referenced is kept zero-extended and zero if it ! 227: is kept sign-extended. Stored in the `unchanging' field and ! 228: printed as `/u'. ! 229: ! 230: `RTX_UNCHANGING_P (X)' ! 231: Nonzero in a `reg' or `mem' if the value is not changed. (This ! 232: flag is not set for memory references via pointers to constants. ! 233: Such pointers only guarantee that the object will not be changed ! 234: explicitly by the current function. The object might be changed by ! 235: other functions or by aliasing.) Stored in the `unchanging' field ! 236: and printed as `/u'. ! 237: ! 238: `RTX_INTEGRATED_P (INSN)' ! 239: Nonzero in an insn if it resulted from an in-line function call. ! 240: Stored in the `integrated' field and printed as `/i'. This may be ! 241: deleted; nothing currently depends on it. ! 242: ! 243: `SYMBOL_REF_USED (X)' ! 244: In a `symbol_ref', indicates that X has been used. This is ! 245: normally only used to ensure that X is only declared external ! 246: once. Stored in the `used' field. ! 247: ! 248: `SYMBOL_REF_FLAG (X)' ! 249: In a `symbol_ref', this is used as a flag for machine-specific ! 250: purposes. Stored in the `volatil' field and printed as `/v'. ! 251: ! 252: `LABEL_OUTSIDE_LOOP_P' ! 253: In `label_ref' expressions, nonzero if this is a reference to a ! 254: label that is outside the innermost loop containing the reference ! 255: to the label. Stored in the `in_struct' field and printed as `/s'. ! 256: ! 257: `INSN_DELETED_P (INSN)' ! 258: In an insn, nonzero if the insn has been deleted. Stored in the ! 259: `volatil' field and printed as `/v'. ! 260: ! 261: `INSN_ANNULLED_BRANCH_P (INSN)' ! 262: In an `insn' in the delay slot of a branch insn, indicates that an ! 263: annulling branch should be used. See the discussion under ! 264: `sequence' below. Stored in the `unchanging' field and printed as ! 265: `/u'. ! 266: ! 267: `INSN_FROM_TARGET_P (INSN)' ! 268: In an `insn' in a delay slot of a branch, indicates that the insn ! 269: is from the target of the branch. If the branch insn has ! 270: `INSN_ANNULLED_BRANCH_P' set, this insn should only be executed if ! 271: the branch is taken. For annulled branches with this bit clear, ! 272: the insn should be executed only if the branch is not taken. ! 273: Stored in the `in_struct' field and printed as `/s'. ! 274: ! 275: `CONSTANT_POOL_ADDRESS_P (X)' ! 276: Nonzero in a `symbol_ref' if it refers to part of the current ! 277: function's "constants pool". These are addresses close to the ! 278: beginning of the function, and GNU CC assumes they can be addressed ! 279: directly (perhaps with the help of base registers). Stored in the ! 280: `unchanging' field and printed as `/u'. ! 281: ! 282: `CONST_CALL_P (X)' ! 283: In a `call_insn', indicates that the insn represents a call to a ! 284: const function. Stored in the `unchanging' field and printed as ! 285: `/u'. ! 286: ! 287: `LABEL_PRESERVE_P (X)' ! 288: In a `code_label', indicates that the label can never be deleted. ! 289: Labels referenced by a non-local goto will have this bit set. ! 290: Stored in the `in_struct' field and printed as `/s'. ! 291: ! 292: `SCHED_GROUP_P (INSN)' ! 293: During instruction scheduling, in an insn, indicates that the ! 294: previous insn must be scheduled together with this insn. This is ! 295: used to ensure that certain groups of instructions will not be ! 296: split up by the instruction scheduling pass, for example, `use' ! 297: insns before a `call_insn' may not be separated from the ! 298: `call_insn'. Stored in the `in_struct' field and printed as `/s'. ! 299: ! 300: These are the fields which the above macros refer to: ! 301: ! 302: `used' ! 303: Normally, this flag is used only momentarily, at the end of RTL ! 304: generation for a function, to count the number of times an ! 305: expression appears in insns. Expressions that appear more than ! 306: once are copied, according to the rules for shared structure ! 307: (*note Sharing::.). ! 308: ! 309: In a `symbol_ref', it indicates that an external declaration for ! 310: the symbol has already been written. ! 311: ! 312: In a `reg', it is used by the leaf register renumbering code to ! 313: ensure that each register is only renumbered once. ! 314: ! 315: `volatil' ! 316: This flag is used in `mem', `symbol_ref' and `reg' expressions and ! 317: in insns. In RTL dump files, it is printed as `/v'. ! 318: ! 319: In a `mem' expression, it is 1 if the memory reference is volatile. ! 320: Volatile memory references may not be deleted, reordered or ! 321: combined. ! 322: ! 323: In a `symbol_ref' expression, it is used for machine-specific ! 324: purposes. ! 325: ! 326: In a `reg' expression, it is 1 if the value is a user-level ! 327: variable. 0 indicates an internal compiler temporary. ! 328: ! 329: In an insn, 1 means the insn has been deleted. ! 330: ! 331: `in_struct' ! 332: In `mem' expressions, it is 1 if the memory datum referred to is ! 333: all or part of a structure or array; 0 if it is (or might be) a ! 334: scalar variable. A reference through a C pointer has 0 because ! 335: the pointer might point to a scalar variable. This information ! 336: allows the compiler to determine something about possible cases of ! 337: aliasing. ! 338: ! 339: In an insn in the delay slot of a branch, 1 means that this insn ! 340: is from the target of the branch. ! 341: ! 342: During instruction scheduling, in an insn, 1 means that this insn ! 343: must be scheduled as part of a group together with the previous ! 344: insn. ! 345: ! 346: In `reg' expressions, it is 1 if the register has its entire life ! 347: contained within the test expression of some loopl. ! 348: ! 349: In `subreg' expressions, 1 means that the `subreg' is accessing an ! 350: object that has had its mode promoted from a wider mode. ! 351: ! 352: In `label_ref' expressions, 1 means that the referenced label is ! 353: outside the innermost loop containing the insn in which the ! 354: `label_ref' was found. ! 355: ! 356: In `code_label' expressions, it is 1 if the label may never be ! 357: deleted. This is used for labels which are the target of non-local ! 358: gotos. ! 359: ! 360: In an RTL dump, this flag is represented as `/s'. ! 361: ! 362: `unchanging' ! 363: In `reg' and `mem' expressions, 1 means that the value of the ! 364: expression never changes. ! 365: ! 366: In `subreg' expressions, it is 1 if the `subreg' references an ! 367: unsigned object whose mode has been promoted to a wider mode. ! 368: ! 369: In an insn, 1 means that this is an annulling branch. ! 370: ! 371: In a `symbol_ref' expression, 1 means that this symbol addresses ! 372: something in the per-function constants pool. ! 373: ! 374: In a `call_insn', 1 means that this instruction is a call to a ! 375: const function. ! 376: ! 377: In an RTL dump, this flag is represented as `/u'. ! 378: ! 379: `integrated' ! 380: In some kinds of expressions, including insns, this flag means the ! 381: rtl was produced by procedure integration. ! 382: ! 383: In a `reg' expression, this flag indicates the register containing ! 384: the value to be returned by the current function. On machines ! 385: that pass parameters in registers, the same register number may be ! 386: used for parameters as well, but this flag is not set on such uses. 1.1.1.3 root 387: 388: 1.1.1.4 ! root 389: File: gcc.info, Node: Machine Modes, Next: Constants, Prev: Flags, Up: RTL 1.1.1.3 root 390: 1.1.1.4 ! root 391: Machine Modes ! 392: ============= 1.1.1.3 root 393: 1.1.1.4 ! root 394: A machine mode describes a size of data object and the ! 395: representation used for it. In the C code, machine modes are ! 396: represented by an enumeration type, `enum machine_mode', defined in ! 397: `machmode.def'. Each RTL expression has room for a machine mode and so ! 398: do certain kinds of tree expressions (declarations and types, to be ! 399: precise). ! 400: ! 401: In debugging dumps and machine descriptions, the machine mode of an ! 402: RTL expression is written after the expression code with a colon to ! 403: separate them. The letters `mode' which appear at the end of each ! 404: machine mode name are omitted. For example, `(reg:SI 38)' is a `reg' ! 405: expression with machine mode `SImode'. If the mode is `VOIDmode', it ! 406: is not written at all. ! 407: ! 408: Here is a table of machine modes. The term "byte" below refers to an ! 409: object of `BITS_PER_UNIT' bits (*note Storage Layout::.). ! 410: ! 411: `QImode' ! 412: "Quarter-Integer" mode represents a single byte treated as an ! 413: integer. ! 414: ! 415: `HImode' ! 416: "Half-Integer" mode represents a two-byte integer. ! 417: ! 418: `PSImode' ! 419: "Partial Single Integer" mode represents an integer which occupies ! 420: four bytes but which doesn't really use all four. On some ! 421: machines, this is the right mode to use for pointers. ! 422: ! 423: `SImode' ! 424: "Single Integer" mode represents a four-byte integer. ! 425: ! 426: `PDImode' ! 427: "Partial Double Integer" mode represents an integer which occupies ! 428: eight bytes but which doesn't really use all eight. On some ! 429: machines, this is the right mode to use for certain pointers. ! 430: ! 431: `DImode' ! 432: "Double Integer" mode represents an eight-byte integer. ! 433: ! 434: `TImode' ! 435: "Tetra Integer" (?) mode represents a sixteen-byte integer. ! 436: ! 437: `SFmode' ! 438: "Single Floating" mode represents a single-precision (four byte) ! 439: floating point number. ! 440: ! 441: `DFmode' ! 442: "Double Floating" mode represents a double-precision (eight byte) ! 443: floating point number. ! 444: ! 445: `XFmode' ! 446: "Extended Floating" mode represents a triple-precision (twelve ! 447: byte) floating point number. This mode is used for IEEE extended ! 448: floating point. ! 449: ! 450: `TFmode' ! 451: "Tetra Floating" mode represents a quadruple-precision (sixteen ! 452: byte) floating point number. ! 453: ! 454: `CCmode' ! 455: "Condition Code" mode represents the value of a condition code, ! 456: which is a machine-specific set of bits used to represent the ! 457: result of a comparison operation. Other machine-specific modes ! 458: may also be used for the condition code. These modes are not used ! 459: on machines that use `cc0' (see *note Condition Code::.). ! 460: ! 461: `BLKmode' ! 462: "Block" mode represents values that are aggregates to which none of ! 463: the other modes apply. In RTL, only memory references can have ! 464: this mode, and only if they appear in string-move or vector ! 465: instructions. On machines which have no such instructions, ! 466: `BLKmode' will not appear in RTL. ! 467: ! 468: `VOIDmode' ! 469: Void mode means the absence of a mode or an unspecified mode. For ! 470: example, RTL expressions of code `const_int' have mode `VOIDmode' ! 471: because they can be taken to have whatever mode the context ! 472: requires. In debugging dumps of RTL, `VOIDmode' is expressed by ! 473: the absence of any mode. ! 474: ! 475: `SCmode, DCmode, XCmode, TCmode' ! 476: These modes stand for a complex number represented as a pair of ! 477: floating point values. The values are in `SFmode', `DFmode', ! 478: `XFmode', and `TFmode', respectively. Since C does not support ! 479: complex numbers, these machine modes are only partially ! 480: implemented. ! 481: ! 482: The machine description defines `Pmode' as a C macro which expands ! 483: into the machine mode used for addresses. Normally this is the mode ! 484: whose size is `BITS_PER_WORD', `SImode' on 32-bit machines. ! 485: ! 486: The only modes which a machine description must support are ! 487: `QImode', and the modes corresponding to `BITS_PER_WORD', ! 488: `FLOAT_TYPE_SIZE' and `DOUBLE_TYPE_SIZE'. The compiler will attempt to ! 489: use `DImode' for 8-byte structures and unions, but this can be ! 490: prevented by overriding the definition of `MAX_FIXED_MODE_SIZE'. ! 491: Alternatively, you can have the compiler use `TImode' for 16-byte ! 492: structures and unions. Likewise, you can arrange for the C type `short ! 493: int' to avoid using `HImode'. ! 494: ! 495: Very few explicit references to machine modes remain in the compiler ! 496: and these few references will soon be removed. Instead, the machine ! 497: modes are divided into mode classes. These are represented by the ! 498: enumeration type `enum mode_class' defined in `machmode.h'. The ! 499: possible mode classes are: ! 500: ! 501: `MODE_INT' ! 502: Integer modes. By default these are `QImode', `HImode', `SImode', ! 503: `DImode', and `TImode'. ! 504: ! 505: `MODE_PARTIAL_INT' ! 506: The "partial integer" modes, `PSImode' and `PDImode'. ! 507: ! 508: `MODE_FLOAT' ! 509: floating point modes. By default these are `SFmode', `DFmode', ! 510: `XFmode' and `TFmode'. ! 511: ! 512: `MODE_COMPLEX_INT' ! 513: Complex integer modes. (These are not currently implemented). ! 514: ! 515: `MODE_COMPLEX_FLOAT' ! 516: Complex floating point modes. By default these are `SCmode', ! 517: `DCmode', `XCmode', and `TCmode'. ! 518: ! 519: `MODE_FUNCTION' ! 520: Algol or Pascal function variables including a static chain. ! 521: (These are not currently implemented). ! 522: ! 523: `MODE_CC' ! 524: Modes representing condition code values. These are `CCmode' plus ! 525: any modes listed in the `EXTRA_CC_MODES' macro. *Note Jump ! 526: Patterns::, also see *Note Condition Code::. ! 527: ! 528: `MODE_RANDOM' ! 529: This is a catchall mode class for modes which don't fit into the ! 530: above classes. Currently `VOIDmode' and `BLKmode' are in ! 531: `MODE_RANDOM'. ! 532: ! 533: Here are some C macros that relate to machine modes: ! 534: ! 535: `GET_MODE (X)' ! 536: Returns the machine mode of the RTX X. ! 537: ! 538: `PUT_MODE (X, NEWMODE)' ! 539: Alters the machine mode of the RTX X to be NEWMODE. ! 540: ! 541: `NUM_MACHINE_MODES' ! 542: Stands for the number of machine modes available on the target ! 543: machine. This is one greater than the largest numeric value of any ! 544: machine mode. ! 545: ! 546: `GET_MODE_NAME (M)' ! 547: Returns the name of mode M as a string. ! 548: ! 549: `GET_MODE_CLASS (M)' ! 550: Returns the mode class of mode M. ! 551: ! 552: `GET_MODE_WIDER_MODE (M)' ! 553: Returns the next wider natural mode. E.g., ! 554: `GET_WIDER_MODE(QImode)' returns `HImode'. ! 555: ! 556: `GET_MODE_SIZE (M)' ! 557: Returns the size in bytes of a datum of mode M. ! 558: ! 559: `GET_MODE_BITSIZE (M)' ! 560: Returns the size in bits of a datum of mode M. ! 561: ! 562: `GET_MODE_MASK (M)' ! 563: Returns a bitmask containing 1 for all bits in a word that fit ! 564: within mode M. This macro can only be used for modes whose ! 565: bitsize is less than or equal to `HOST_BITS_PER_INT'. ! 566: ! 567: `GET_MODE_ALIGNMENT (M))' ! 568: Return the required alignment, in bits, for an object of mode M. ! 569: ! 570: `GET_MODE_UNIT_SIZE (M)' ! 571: Returns the size in bytes of the subunits of a datum of mode M. ! 572: This is the same as `GET_MODE_SIZE' except in the case of complex ! 573: modes. For them, the unit size is the size of the real or ! 574: imaginary part. ! 575: ! 576: `GET_MODE_NUNITS (M)' ! 577: Returns the number of units contained in a mode, i.e., ! 578: `GET_MODE_SIZE' divided by `GET_MODE_UNIT_SIZE'. ! 579: ! 580: `GET_CLASS_NARROWEST_MODE (C)' ! 581: Returns the narrowest mode in mode class C. ! 582: ! 583: The global variables `byte_mode' and `word_mode' contain modes whose ! 584: classes are `MODE_INT' and whose bitsizes are `BITS_PER_UNIT' or ! 585: `BITS_PER_WORD', respectively. On 32-bit machines, these are `QImode' ! 586: and `SImode', respectively. 1.1 root 587: 588: 1.1.1.4 ! root 589: File: gcc.info, Node: Constants, Next: Regs and Memory, Prev: Machine Modes, Up: RTL 1.1.1.2 root 590: 1.1.1.4 ! root 591: Constant Expression Types ! 592: ========================= 1.1.1.2 root 593: 1.1.1.4 ! root 594: The simplest RTL expressions are those that represent constant ! 595: values. 1.1.1.2 root 596: 1.1.1.4 ! root 597: `(const_int I)' ! 598: This type of expression represents the integer value I. I is ! 599: customarily accessed with the macro `INTVAL' as in `INTVAL (EXP)', ! 600: which is equivalent to `XWINT (EXP, 0)'. ! 601: ! 602: There is only one expression object for the integer value zero; it ! 603: is the value of the variable `const0_rtx'. Likewise, the only ! 604: expression for integer value one is found in `const1_rtx', the only ! 605: expression for integer value two is found in `const2_rtx', and the ! 606: only expression for integer value negative one is found in ! 607: `constm1_rtx'. Any attempt to create an expression of code ! 608: `const_int' and value zero, one, two or negative one will return ! 609: `const0_rtx', `const1_rtx', `const2_rtx' or `constm1_rtx' as ! 610: appropriate. ! 611: ! 612: Similarly, there is only one object for the integer whose value is ! 613: `STORE_FLAG_VALUE'. It is found in `const_true_rtx'. If ! 614: `STORE_FLAG_VALUE' is one, `const_true_rtx' and `const1_rtx' will ! 615: point to the same object. If `STORE_FLAG_VALUE' is -1, ! 616: `const_true_rtx' and `constm1_rtx' will point to the same object. ! 617: ! 618: `(const_double:M ADDR I0 I1 ...)' ! 619: Represents either a floating-point constant of mode M or an ! 620: integer constant that is too large to fit into ! 621: `HOST_BITS_PER_WIDE_INT' bits but small enough to fit within twice ! 622: that number of bits (GNU CC does not provide a mechanism to ! 623: represent even larger constants). In the latter case, M will be ! 624: `VOIDmode'. ! 625: ! 626: ADDR is used to contain the `mem' expression that corresponds to ! 627: the location in memory that at which the constant can be found. If ! 628: it has not been allocated a memory location, but is on the chain ! 629: of all `const_double' expressions in this compilation (maintained ! 630: using an undisplayed field), ADDR contains `const0_rtx'. If it is ! 631: not on the chain, ADDR contains `cc0_rtx'. ADDR is customarily ! 632: accessed with the macro `CONST_DOUBLE_MEM' and the chain field via ! 633: `CONST_DOUBLE_CHAIN'. ! 634: ! 635: If M is `VOIDmode', the bits of the value are stored in I0 and I1. ! 636: I0 is customarily accessed with the macro `CONST_DOUBLE_LOW' and ! 637: I1 with `CONST_DOUBLE_HIGH'. ! 638: ! 639: If the constant is floating point (either single or double ! 640: precision), then the number of integers used to store the value ! 641: depends on the size of `REAL_VALUE_TYPE' (*note ! 642: Cross-compilation::.). The integers represent a `double'. To ! 643: convert them to a `double', do ! 644: ! 645: union real_extract u; ! 646: bcopy (&CONST_DOUBLE_LOW (x), &u, sizeof u); ! 647: ! 648: and then refer to `u.d'. ! 649: ! 650: The macro `CONST0_RTX (MODE)' refers to an expression with value 0 ! 651: in mode MODE. If mode MODE is of mode class `MODE_INT', it returns ! 652: `const0_rtx'. Otherwise, it returns a `CONST_DOUBLE' expression ! 653: in mode MODE. Similarly, the macro `CONST1_RTX (MODE)' refers to ! 654: an expression with value 1 in mode MODE and similarly for ! 655: `CONST2_RTX'. ! 656: ! 657: `(const_string STR)' ! 658: Represents a constant string with value STR. Currently this is ! 659: used only for insn attributes (*note Insn Attributes::.) since ! 660: constant strings in C are placed in memory. ! 661: ! 662: `(symbol_ref:MODE SYMBOL)' ! 663: Represents the value of an assembler label for data. SYMBOL is a ! 664: string that describes the name of the assembler label. If it ! 665: starts with a `*', the label is the rest of SYMBOL not including ! 666: the `*'. Otherwise, the label is SYMBOL, usually prefixed with ! 667: `_'. ! 668: ! 669: The `symbol_ref' contains a mode, which is usually `Pmode'. ! 670: Usually that is the only mode for which a symbol is directly valid. ! 671: ! 672: `(label_ref LABEL)' ! 673: Represents the value of an assembler label for code. It contains ! 674: one operand, an expression, which must be a `code_label' that ! 675: appears in the instruction sequence to identify the place where ! 676: the label should go. ! 677: ! 678: The reason for using a distinct expression type for code label ! 679: references is so that jump optimization can distinguish them. ! 680: ! 681: `(const:M EXP)' ! 682: Represents a constant that is the result of an assembly-time ! 683: arithmetic computation. The operand, EXP, is an expression that ! 684: contains only constants (`const_int', `symbol_ref' and `label_ref' ! 685: expressions) combined with `plus' and `minus'. However, not all ! 686: combinations are valid, since the assembler cannot do arbitrary ! 687: arithmetic on relocatable symbols. ! 688: ! 689: M should be `Pmode'. ! 690: ! 691: `(high:M EXP)' ! 692: Represents the high-order bits of EXP, usually a `symbol_ref'. ! 693: The number of bits is machine-dependent and is normally the number ! 694: of bits specified in an instruction that initializes the high ! 695: order bits of a register. It is used with `lo_sum' to represent ! 696: the typical two-instruction sequence used in RISC machines to ! 697: reference a global memory location. 1.1.1.2 root 698: 1.1.1.4 ! root 699: M should be `Pmode'. 1.1.1.2 root 700: 701: 1.1.1.4 ! root 702: File: gcc.info, Node: Regs and Memory, Next: Arithmetic, Prev: Constants, Up: RTL 1.1.1.2 root 703: 1.1.1.4 ! root 704: Registers and Memory ! 705: ==================== 1.1.1.2 root 706: 1.1.1.4 ! root 707: Here are the RTL expression types for describing access to machine ! 708: registers and to main memory. 1.1.1.2 root 709: 1.1.1.4 ! root 710: `(reg:M N)' ! 711: For small values of the integer N (less than ! 712: `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine ! 713: register number N: a "hard register". For larger values of N, it ! 714: stands for a temporary value or "pseudo register". The compiler's ! 715: strategy is to generate code assuming an unlimited number of such ! 716: pseudo registers, and later convert them into hard registers or ! 717: into memory references. ! 718: ! 719: M is the machine mode of the reference. It is necessary because ! 720: machines can generally refer to each register in more than one ! 721: mode. For example, a register may contain a full word but there ! 722: may be instructions to refer to it as a half word or as a single ! 723: byte, as well as instructions to refer to it as a floating point ! 724: number of various precisions. ! 725: ! 726: Even for a register that the machine can access in only one mode, ! 727: the mode must always be specified. ! 728: ! 729: The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine ! 730: description, since the number of hard registers on the machine is ! 731: an invariant characteristic of the machine. Note, however, that ! 732: not all of the machine registers must be general registers. All ! 733: the machine registers that can be used for storage of data are ! 734: given hard register numbers, even those that can be used only in ! 735: certain instructions or can hold only certain types of data. ! 736: ! 737: A hard register may be accessed in various modes throughout one ! 738: function, but each pseudo register is given a natural mode and is ! 739: accessed only in that mode. When it is necessary to describe an ! 740: access to a pseudo register using a nonnatural mode, a `subreg' ! 741: expression is used. ! 742: ! 743: A `reg' expression with a machine mode that specifies more than ! 744: one word of data may actually stand for several consecutive ! 745: registers. If in addition the register number specifies a hardware ! 746: register, then it actually represents several consecutive hardware ! 747: registers starting with the specified one. ! 748: ! 749: Each pseudo register number used in a function's RTL code is ! 750: represented by a unique `reg' expression. ! 751: ! 752: Some pseudo register numbers, those within the range of ! 753: `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear ! 754: during the RTL generation phase and are eliminated before the ! 755: optimization phases. These represent locations in the stack frame ! 756: that cannot be determined until RTL generation for the function ! 757: has been completed. The following virtual register numbers are ! 758: defined: ! 759: ! 760: `VIRTUAL_INCOMING_ARGS_REGNUM' ! 761: This points to the first word of the incoming arguments ! 762: passed on the stack. Normally these arguments are placed ! 763: there by the caller, but the callee may have pushed some ! 764: arguments that were previously passed in registers. ! 765: ! 766: When RTL generation is complete, this virtual register is ! 767: replaced by the sum of the register given by ! 768: `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'. ! 769: ! 770: `VIRTUAL_STACK_VARS_REGNUM' ! 771: If `FRAME_GROWS_DOWNWARDS' is defined, this points to ! 772: immediately above the first variable on the stack. ! 773: Otherwise, it points to the first variable on the stack. ! 774: ! 775: It is replaced with the sum of the register given by ! 776: `FRAME_POINTER_REGNUM' and the value `STARTING_FRAME_OFFSET'. ! 777: ! 778: `VIRTUAL_STACK_DYNAMIC_REGNUM' ! 779: This points to the location of dynamically allocated memory ! 780: on the stack immediately after the stack pointer has been ! 781: adjusted by the amount of memory desired. ! 782: ! 783: It is replaced by the sum of the register given by ! 784: `STACK_POINTER_REGNUM' and the value `STACK_DYNAMIC_OFFSET'. ! 785: ! 786: `VIRTUAL_OUTGOING_ARGS_REGNUM' ! 787: This points to the location in the stack at which outgoing ! 788: arguments should be written when the stack is pre-pushed ! 789: (arguments pushed using push insns should always use ! 790: `STACK_POINTER_REGNUM'). ! 791: ! 792: It is replaced by the sum of the register given by ! 793: `STACK_POINTER_REGNUM' and the value `STACK_POINTER_OFFSET'. ! 794: ! 795: `(subreg:M REG WORDNUM)' ! 796: `subreg' expressions are used to refer to a register in a machine ! 797: mode other than its natural one, or to refer to one register of a ! 798: multi-word `reg' that actually refers to several registers. ! 799: ! 800: Each pseudo-register has a natural mode. If it is necessary to ! 801: operate on it in a different mode--for example, to perform a ! 802: fullword move instruction on a pseudo-register that contains a ! 803: single byte--the pseudo-register must be enclosed in a `subreg'. ! 804: In such a case, WORDNUM is zero. ! 805: ! 806: Usually M is at least as narrow as the mode of REG, in which case ! 807: it is restricting consideration to only the bits of REG that are ! 808: in M. However, sometimes M is wider than the mode of REG. These ! 809: `subreg' expressions are often called "paradoxical". They are ! 810: used in cases where we want to refer to an object in a wider mode ! 811: but do not care what value the additional bits have. The reload ! 812: pass ensures that paradoxical references are only made to hard ! 813: registers. ! 814: ! 815: The other use of `subreg' is to extract the individual registers of ! 816: a multi-register value. Machine modes such as `DImode' and ! 817: `TImode' can indicate values longer than a word, values which ! 818: usually require two or more consecutive registers. To access one ! 819: of the registers, use a `subreg' with mode `SImode' and a WORDNUM ! 820: that says which register. ! 821: ! 822: The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says ! 823: that word number zero is the most significant part; otherwise, it ! 824: is the least significant part. ! 825: ! 826: Between the combiner pass and the reload pass, it is possible to ! 827: have a paradoxical `subreg' which contains a `mem' instead of a ! 828: `reg' as its first operand. After the reload pass, it is also ! 829: possible to have a non-paradoxical `subreg' which contains a ! 830: `mem'; this usually occurs when the `mem' is a stack slot which ! 831: replaced a pseudo register. ! 832: ! 833: Note that it is not valid to access a `DFmode' value in `SFmode' ! 834: using a `subreg'. On some machines the most significant part of a ! 835: `DFmode' value does not have the same format as a single-precision ! 836: floating value. ! 837: ! 838: It is also not valid to access a single word of a multi-word value ! 839: in a hard register when less registers can hold the value than ! 840: would be expected from its size. For example, some 32-bit ! 841: machines have floating-point registers that can hold an entire ! 842: `DFmode' value. If register 10 were such a register `(subreg:SI ! 843: (reg:DF 10) 1)' would be invalid because there is no way to ! 844: convert that reference to a single machine register. The reload ! 845: pass prevents `subreg' expressions such as these from being formed. ! 846: ! 847: The first operand of a `subreg' expression is customarily accessed ! 848: with the `SUBREG_REG' macro and the second operand is customarily ! 849: accessed with the `SUBREG_WORD' macro. ! 850: ! 851: `(scratch:M)' ! 852: This represents a scratch register that will be required for the ! 853: execution of a single instruction and not used subsequently. It is ! 854: converted into a `reg' by either the local register allocator or ! 855: the reload pass. ! 856: ! 857: `scratch' is usually present inside a `clobber' operation (*note ! 858: Side Effects::.). ! 859: ! 860: `(cc0)' ! 861: This refers to the machine's condition code register. It has no ! 862: operands and may not have a machine mode. There are two ways to ! 863: use it: ! 864: ! 865: * To stand for a complete set of condition code flags. This is ! 866: best on most machines, where each comparison sets the entire ! 867: series of flags. ! 868: ! 869: With this technique, `(cc0)' may be validly used in only two ! 870: contexts: as the destination of an assignment (in test and ! 871: compare instructions) and in comparison operators comparing ! 872: against zero (`const_int' with value zero; that is to say, ! 873: `const0_rtx'). ! 874: ! 875: * To stand for a single flag that is the result of a single ! 876: condition. This is useful on machines that have only a single ! 877: flag bit, and in which comparison instructions must specify ! 878: the condition to test. ! 879: ! 880: With this technique, `(cc0)' may be validly used in only two ! 881: contexts: as the destination of an assignment (in test and ! 882: compare instructions) where the source is a comparison ! 883: operator, and as the first operand of `if_then_else' (in a ! 884: conditional branch). ! 885: ! 886: There is only one expression object of code `cc0'; it is the value ! 887: of the variable `cc0_rtx'. Any attempt to create an expression of ! 888: code `cc0' will return `cc0_rtx'. ! 889: ! 890: Instructions can set the condition code implicitly. On many ! 891: machines, nearly all instructions set the condition code based on ! 892: the value that they compute or store. It is not necessary to ! 893: record these actions explicitly in the RTL because the machine ! 894: description includes a prescription for recognizing the ! 895: instructions that do so (by means of the macro ! 896: `NOTICE_UPDATE_CC'). *Note Condition Code::. Only instructions ! 897: whose sole purpose is to set the condition code, and instructions ! 898: that use the condition code, need mention `(cc0)'. ! 899: ! 900: On some machines, the condition code register is given a register ! 901: number and a `reg' is used instead of `(cc0)'. This is usually the ! 902: preferable approach if only a small subset of instructions modify ! 903: the condition code. Other machines store condition codes in ! 904: general registers; in such cases a pseudo register should be used. ! 905: ! 906: Some machines, such as the Sparc and RS/6000, have two sets of ! 907: arithmetic instructions, one that sets and one that does not set ! 908: the condition code. This is best handled by normally generating ! 909: the instruction that does not set the condition code, and making a ! 910: pattern that both performs the arithmetic and sets the condition ! 911: code register (which would not be `(cc0)' in this case). For ! 912: examples, search for `addcc' and `andcc' in `sparc.md'. ! 913: ! 914: `(pc)' ! 915: This represents the machine's program counter. It has no operands ! 916: and may not have a machine mode. `(pc)' may be validly used only ! 917: in certain specific contexts in jump instructions. ! 918: ! 919: There is only one expression object of code `pc'; it is the value ! 920: of the variable `pc_rtx'. Any attempt to create an expression of ! 921: code `pc' will return `pc_rtx'. ! 922: ! 923: All instructions that do not jump alter the program counter ! 924: implicitly by incrementing it, but there is no need to mention ! 925: this in the RTL. ! 926: ! 927: `(mem:M ADDR)' ! 928: This RTX represents a reference to main memory at an address ! 929: represented by the expression ADDR. M specifies how large a unit ! 930: of memory is accessed. 1.1.1.2 root 931: 1.1.1.4 ! root 932: ! 933: File: gcc.info, Node: Arithmetic, Next: Comparisons, Prev: Regs and Memory, Up: RTL 1.1.1.2 root 934: 1.1.1.4 ! root 935: RTL Expressions for Arithmetic ! 936: ============================== 1.1.1.2 root 937: 1.1.1.4 ! root 938: Unless otherwise specified, all the operands of arithmetic ! 939: expressions must be valid for mode M. An operand is valid for mode M ! 940: if it has mode M, or if it is a `const_int' or `const_double' and M is ! 941: a mode of class `MODE_INT'. ! 942: ! 943: For commutative binary operations, constants should be placed in the ! 944: second operand. ! 945: ! 946: `(plus:M X Y)' ! 947: Represents the sum of the values represented by X and Y carried ! 948: out in machine mode M. ! 949: ! 950: `(lo_sum:M X Y)' ! 951: Like `plus', except that it represents that sum of X and the ! 952: low-order bits of Y. The number of low order bits is ! 953: machine-dependent but is normally the number of bits in a `Pmode' ! 954: item minus the number of bits set by the `high' code (*note ! 955: Constants::.). ! 956: ! 957: M should be `Pmode'. ! 958: ! 959: `(minus:M X Y)' ! 960: Like `plus' but represents subtraction. ! 961: ! 962: `(compare:M X Y)' ! 963: Represents the result of subtracting Y from X for purposes of ! 964: comparison. The result is computed without overflow, as if with ! 965: infinite precision. ! 966: ! 967: Of course, machines can't really subtract with infinite precision. ! 968: However, they can pretend to do so when only the sign of the ! 969: result will be used, which is the case when the result is stored ! 970: in the condition code. And that is the only way this kind of ! 971: expression may validly be used: as a value to be stored in the ! 972: condition codes. ! 973: ! 974: The mode M is not related to the modes of X and Y, but instead is ! 975: the mode of the condition code value. If `(cc0)' is used, it is ! 976: `VOIDmode'. Otherwise it is some mode in class `MODE_CC', often ! 977: `CCmode'. *Note Condition Code::. ! 978: ! 979: Normally, X and Y must have the same mode. Otherwise, `compare' ! 980: is valid only if the mode of X is in class `MODE_INT' and Y is a ! 981: `const_int' or `const_double' with mode `VOIDmode'. The mode of X ! 982: determines what mode the comparison is to be done in; thus it must ! 983: not be `VOIDmode'. ! 984: ! 985: If one of the operands is a constant, it should be placed in the ! 986: second operand and the comparison code adjusted as appropriate. ! 987: ! 988: A `compare' specifying two `VOIDmode' constants is not valid since ! 989: there is no way to know in what mode the comparison is to be ! 990: performed; the comparison must either be folded during the ! 991: compilation or the first operand must be loaded into a register ! 992: while its mode is still known. ! 993: ! 994: `(neg:M X)' ! 995: Represents the negation (subtraction from zero) of the value ! 996: represented by X, carried out in mode M. ! 997: ! 998: `(mult:M X Y)' ! 999: Represents the signed product of the values represented by X and Y ! 1000: carried out in machine mode M. ! 1001: ! 1002: Some machines support a multiplication that generates a product ! 1003: wider than the operands. Write the pattern for this as ! 1004: ! 1005: (mult:M (sign_extend:M X) (sign_extend:M Y)) ! 1006: ! 1007: where M is wider than the modes of X and Y, which need not be the ! 1008: same. ! 1009: ! 1010: Write patterns for unsigned widening multiplication similarly using ! 1011: `zero_extend'. ! 1012: ! 1013: `(div:M X Y)' ! 1014: Represents the quotient in signed division of X by Y, carried out ! 1015: in machine mode M. If M is a floating point mode, it represents ! 1016: the exact quotient; otherwise, the integerized quotient. ! 1017: ! 1018: Some machines have division instructions in which the operands and ! 1019: quotient widths are not all the same; you should represent such ! 1020: instructions using `truncate' and `sign_extend' as in, ! 1021: ! 1022: (truncate:M1 (div:M2 X (sign_extend:M2 Y))) ! 1023: ! 1024: `(udiv:M X Y)' ! 1025: Like `div' but represents unsigned division. ! 1026: ! 1027: `(mod:M X Y)' ! 1028: `(umod:M X Y)' ! 1029: Like `div' and `udiv' but represent the remainder instead of the ! 1030: quotient. ! 1031: ! 1032: `(smin:M X Y)' ! 1033: `(smax:M X Y)' ! 1034: Represents the smaller (for `smin') or larger (for `smax') of X ! 1035: and Y, interpreted as signed integers in mode M. ! 1036: ! 1037: `(umin:M X Y)' ! 1038: `(umax:M X Y)' ! 1039: Like `smin' and `smax', but the values are interpreted as unsigned ! 1040: integers. ! 1041: ! 1042: `(not:M X)' ! 1043: Represents the bitwise complement of the value represented by X, ! 1044: carried out in mode M, which must be a fixed-point machine mode. ! 1045: ! 1046: `(and:M X Y)' ! 1047: Represents the bitwise logical-and of the values represented by X ! 1048: and Y, carried out in machine mode M, which must be a fixed-point ! 1049: machine mode. ! 1050: ! 1051: `(ior:M X Y)' ! 1052: Represents the bitwise inclusive-or of the values represented by X ! 1053: and Y, carried out in machine mode M, which must be a fixed-point ! 1054: mode. ! 1055: ! 1056: `(xor:M X Y)' ! 1057: Represents the bitwise exclusive-or of the values represented by X ! 1058: and Y, carried out in machine mode M, which must be a fixed-point ! 1059: mode. ! 1060: ! 1061: `(ashift:M X C)' ! 1062: Represents the result of arithmetically shifting X left by C ! 1063: places. X have mode M, a fixed-point machine mode. C be a ! 1064: fixed-point mode or be a constant with mode `VOIDmode'; which mode ! 1065: is determined by the mode called for in the machine description ! 1066: entry for the left-shift instruction. For example, on the Vax, ! 1067: the mode of C is `QImode' regardless of M. ! 1068: ! 1069: `(lshift:M X C)' ! 1070: Like `ashift' but for logical left shift. `ashift' and `lshift' ! 1071: are identical operations; we customarily use `ashift' for both. ! 1072: ! 1073: `(lshiftrt:M X C)' ! 1074: `(ashiftrt:M X C)' ! 1075: Like `lshift' and `ashift' but for right shift. Unlike the case ! 1076: for left shift, these two operations are distinct. ! 1077: ! 1078: `(rotate:M X C)' ! 1079: `(rotatert:M X C)' ! 1080: Similar but represent left and right rotate. If C is a constant, ! 1081: use `rotate'. ! 1082: ! 1083: `(abs:M X)' ! 1084: Represents the absolute value of X, computed in mode M. ! 1085: ! 1086: `(sqrt:M X)' ! 1087: Represents the square root of X, computed in mode M. Most often M ! 1088: will be a floating point mode. ! 1089: ! 1090: `(ffs:M X)' ! 1091: Represents one plus the index of the least significant 1-bit in X, ! 1092: represented as an integer of mode M. (The value is zero if X is ! 1093: zero.) The mode of X need not be M; depending on the target ! 1094: machine, various mode combinations may be valid. 1.1.1.2 root 1095: 1096: 1.1.1.4 ! root 1097: File: gcc.info, Node: Comparisons, Next: Bit Fields, Prev: Arithmetic, Up: RTL 1.1 root 1098: 1.1.1.4 ! root 1099: Comparison Operations ! 1100: ===================== 1.1 root 1101: 1.1.1.4 ! root 1102: Comparison operators test a relation on two operands and are ! 1103: considered to represent a machine-dependent nonzero value described by, ! 1104: but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the ! 1105: relation holds, or zero if it does not. The mode of the comparison ! 1106: operation is independent of the mode of the data being compared. If ! 1107: the comparison operation is being tested (e.g., the first operand of an ! 1108: `if_then_else'), the mode must be `VOIDmode'. If the comparison ! 1109: operation is producing data to be stored in some variable, the mode ! 1110: must be in class `MODE_INT'. All comparison operations producing data ! 1111: must use the same mode, which is machine-specific. ! 1112: ! 1113: There are two ways that comparison operations may be used. The ! 1114: comparison operators may be used to compare the condition codes `(cc0)' ! 1115: against zero, as in `(eq (cc0) (const_int 0))'. Such a construct ! 1116: actually refers to the result of the preceding instruction in which the ! 1117: condition codes were set. The instructing setting the condition code ! 1118: must be adjacent to the instruction using the condition code; only ! 1119: `note' insns may separate them. ! 1120: ! 1121: Alternatively, a comparison operation may directly compare two data ! 1122: objects. The mode of the comparison is determined by the operands; they ! 1123: must both be valid for a common machine mode. A comparison with both ! 1124: operands constant would be invalid as the machine mode could not be ! 1125: deduced from it, but such a comparison should never exist in RTL due to ! 1126: constant folding. ! 1127: ! 1128: In the example above, if `(cc0)' were last set to `(compare X Y)', ! 1129: the comparison operation is identical to `(eq X Y)'. Usually only one ! 1130: style of comparisons is supported on a particular machine, but the ! 1131: combine pass will try to merge the operations to produce the `eq' shown ! 1132: in case it exists in the context of the particular insn involved. ! 1133: ! 1134: Inequality comparisons come in two flavors, signed and unsigned. ! 1135: Thus, there are distinct expression codes `gt' and `gtu' for signed and ! 1136: unsigned greater-than. These can produce different results for the same ! 1137: pair of integer values: for example, 1 is signed greater-than -1 but not ! 1138: unsigned greater-than, because -1 when regarded as unsigned is actually ! 1139: `0xffffffff' which is greater than 1. ! 1140: ! 1141: The signed comparisons are also used for floating point values. ! 1142: Floating point comparisons are distinguished by the machine modes of ! 1143: the operands. ! 1144: ! 1145: `(eq:M X Y)' ! 1146: 1 if the values represented by X and Y are equal, otherwise 0. ! 1147: ! 1148: `(ne:M X Y)' ! 1149: 1 if the values represented by X and Y are not equal, otherwise 0. ! 1150: ! 1151: `(gt:M X Y)' ! 1152: 1 if the X is greater than Y. If they are fixed-point, the ! 1153: comparison is done in a signed sense. ! 1154: ! 1155: `(gtu:M X Y)' ! 1156: Like `gt' but does unsigned comparison, on fixed-point numbers ! 1157: only. ! 1158: ! 1159: `(lt:M X Y)' ! 1160: `(ltu:M X Y)' ! 1161: Like `gt' and `gtu' but test for "less than". ! 1162: ! 1163: `(ge:M X Y)' ! 1164: `(geu:M X Y)' ! 1165: Like `gt' and `gtu' but test for "greater than or equal". ! 1166: ! 1167: `(le:M X Y)' ! 1168: `(leu:M X Y)' ! 1169: Like `gt' and `gtu' but test for "less than or equal". ! 1170: ! 1171: `(if_then_else COND THEN ELSE)' ! 1172: This is not a comparison operation but is listed here because it is ! 1173: always used in conjunction with a comparison operation. To be ! 1174: precise, COND is a comparison expression. This expression ! 1175: represents a choice, according to COND, between the value ! 1176: represented by THEN and the one represented by ELSE. ! 1177: ! 1178: On most machines, `if_then_else' expressions are valid only to ! 1179: express conditional jumps. ! 1180: ! 1181: `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)' ! 1182: Similar to `if_then_else', but more general. Each of TEST1, ! 1183: TEST2, ... is performed in turn. The result of this expression is ! 1184: the VALUE corresponding to the first non-zero test, or DEFAULT if ! 1185: none of the tests are non-zero expressions. 1.1 root 1186: 1.1.1.4 ! root 1187: This is currently not valid for instruction patterns and is ! 1188: supported only for insn attributes. *Note Insn Attributes::. 1.1 root 1189: 1190: 1.1.1.4 ! root 1191: File: gcc.info, Node: Bit Fields, Next: Conversions, Prev: Comparisons, Up: RTL 1.1 root 1192: 1.1.1.4 ! root 1193: Bit Fields ! 1194: ========== 1.1 root 1195: 1.1.1.4 ! root 1196: Special expression codes exist to represent bit-field instructions. ! 1197: These types of expressions are lvalues in RTL; they may appear on the ! 1198: left side of an assignment, indicating insertion of a value into the ! 1199: specified bit field. ! 1200: ! 1201: `(sign_extract:M LOC SIZE POS)' ! 1202: This represents a reference to a sign-extended bit field contained ! 1203: or starting in LOC (a memory or register reference). The bit field ! 1204: is SIZE bits wide and starts at bit POS. The compilation option ! 1205: `BITS_BIG_ENDIAN' says which end of the memory unit POS counts ! 1206: from. ! 1207: ! 1208: If LOC is in memory, its mode must be a single-byte integer mode. ! 1209: If LOC is in a register, the mode to use is specified by the ! 1210: operand of the `insv' or `extv' pattern (*note Standard Names::.) ! 1211: and is usually a full-word integer mode. ! 1212: ! 1213: The mode of POS is machine-specific and is also specified in the ! 1214: `insv' or `extv' pattern. ! 1215: ! 1216: The mode M is the same as the mode that would be used for LOC if ! 1217: it were a register. ! 1218: ! 1219: `(zero_extract:M LOC SIZE POS)' ! 1220: Like `sign_extract' but refers to an unsigned or zero-extended bit ! 1221: field. The same sequence of bits are extracted, but they are ! 1222: filled to an entire word with zeros instead of by sign-extension. 1.1 root 1223: 1224:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.