|
|
1.1.1.5 ! root 1: This is Info file gcc.info, produced by Makeinfo-1.54 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: 1.1.1.5 ! root 6: Published by the Free Software Foundation 675 Massachusetts Avenue ! 7: Cambridge, MA 02139 USA ! 8: ! 9: Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc. 1.1 root 10: 1.1.1.3 root 11: Permission is granted to make and distribute verbatim copies of this 12: manual provided the copyright notice and this permission notice are 13: preserved on all copies. 1.1 root 14: 15: Permission is granted to copy and distribute modified versions of 16: this manual under the conditions for verbatim copying, provided also 1.1.1.4 root 17: that the sections entitled "GNU General Public License" and "Protect 18: Your Freedom--Fight `Look And Feel'" are included exactly as in the 19: original, and provided that the entire resulting derived work is 20: distributed under the terms of a permission notice identical to this 21: one. 1.1 root 22: 23: Permission is granted to copy and distribute translations of this 24: manual into another language, under the above conditions for modified 1.1.1.3 root 25: versions, except that the sections entitled "GNU General Public 1.1.1.4 root 26: License" and "Protect Your Freedom--Fight `Look And Feel'", and this 27: permission notice, may be included in translations approved by the Free 28: Software Foundation instead of in the original English. 29: 30: 1.1.1.5 ! root 31: File: gcc.info, Node: RTL Template, Next: Output Template, Prev: Example, Up: Machine Desc ! 32: ! 33: RTL Template ! 34: ============ ! 35: ! 36: The RTL template is used to define which insns match the particular ! 37: pattern and how to find their operands. For named patterns, the RTL ! 38: template also says how to construct an insn from specified operands. ! 39: ! 40: Construction involves substituting specified operands into a copy of ! 41: the template. Matching involves determining the values that serve as ! 42: the operands in the insn being matched. Both of these activities are ! 43: controlled by special expression types that direct matching and ! 44: substitution of the operands. ! 45: ! 46: `(match_operand:M N PREDICATE CONSTRAINT)' ! 47: This expression is a placeholder for operand number N of the insn. ! 48: When constructing an insn, operand number N will be substituted ! 49: at this point. When matching an insn, whatever appears at this ! 50: position in the insn will be taken as operand number N; but it ! 51: must satisfy PREDICATE or this instruction pattern will not match ! 52: at all. ! 53: ! 54: Operand numbers must be chosen consecutively counting from zero in ! 55: each instruction pattern. There may be only one `match_operand' ! 56: expression in the pattern for each operand number. Usually ! 57: operands are numbered in the order of appearance in `match_operand' ! 58: expressions. ! 59: ! 60: PREDICATE is a string that is the name of a C function that ! 61: accepts two arguments, an expression and a machine mode. During ! 62: matching, the function will be called with the putative operand as ! 63: the expression and M as the mode argument (if M is not specified, ! 64: `VOIDmode' will be used, which normally causes PREDICATE to accept ! 65: any mode). If it returns zero, this instruction pattern fails to ! 66: match. PREDICATE may be an empty string; then it means no test is ! 67: to be done on the operand, so anything which occurs in this ! 68: position is valid. ! 69: ! 70: Most of the time, PREDICATE will reject modes other than M--but ! 71: not always. For example, the predicate `address_operand' uses M ! 72: as the mode of memory ref that the address should be valid for. ! 73: Many predicates accept `const_int' nodes even though their mode is ! 74: `VOIDmode'. ! 75: ! 76: CONSTRAINT controls reloading and the choice of the best register ! 77: class to use for a value, as explained later (*note ! 78: Constraints::.). ! 79: ! 80: People are often unclear on the difference between the constraint ! 81: and the predicate. The predicate helps decide whether a given ! 82: insn matches the pattern. The constraint plays no role in this ! 83: decision; instead, it controls various decisions in the case of an ! 84: insn which does match. ! 85: ! 86: On CISC machines, the most common PREDICATE is ! 87: `"general_operand"'. This function checks that the putative ! 88: operand is either a constant, a register or a memory reference, ! 89: and that it is valid for mode M. ! 90: ! 91: For an operand that must be a register, PREDICATE should be ! 92: `"register_operand"'. Using `"general_operand"' would be valid, ! 93: since the reload pass would copy any non-register operands through ! 94: registers, but this would make GNU CC do extra work, it would ! 95: prevent invariant operands (such as constant) from being removed ! 96: from loops, and it would prevent the register allocator from doing ! 97: the best possible job. On RISC machines, it is usually most ! 98: efficient to allow PREDICATE to accept only objects that the ! 99: constraints allow. ! 100: ! 101: For an operand that must be a constant, you must be sure to either ! 102: use `"immediate_operand"' for PREDICATE, or make the instruction ! 103: pattern's extra condition require a constant, or both. You cannot ! 104: expect the constraints to do this work! If the constraints allow ! 105: only constants, but the predicate allows something else, the ! 106: compiler will crash when that case arises. ! 107: ! 108: `(match_scratch:M N CONSTRAINT)' ! 109: This expression is also a placeholder for operand number N and ! 110: indicates that operand must be a `scratch' or `reg' expression. ! 111: ! 112: When matching patterns, this is completely equivalent to ! 113: ! 114: (match_operand:M N "scratch_operand" PRED) ! 115: ! 116: but, when generating RTL, it produces a (`scratch':M) expression. ! 117: ! 118: If the last few expressions in a `parallel' are `clobber' ! 119: expressions whose operands are either a hard register or ! 120: `match_scratch', the combiner can add them when necessary. *Note ! 121: Side Effects::. ! 122: ! 123: `(match_dup N)' ! 124: This expression is also a placeholder for operand number N. It is ! 125: used when the operand needs to appear more than once in the insn. ! 126: ! 127: In construction, `match_dup' acts just like `match_operand': the ! 128: operand is substituted into the insn being constructed. But in ! 129: matching, `match_dup' behaves differently. It assumes that operand ! 130: number N has already been determined by a `match_operand' ! 131: appearing earlier in the recognition template, and it matches only ! 132: an identical-looking expression. ! 133: ! 134: `(match_operator:M N PREDICATE [OPERANDS...])' ! 135: This pattern is a kind of placeholder for a variable RTL expression ! 136: code. ! 137: ! 138: When constructing an insn, it stands for an RTL expression whose ! 139: expression code is taken from that of operand N, and whose ! 140: operands are constructed from the patterns OPERANDS. ! 141: ! 142: When matching an expression, it matches an expression if the ! 143: function PREDICATE returns nonzero on that expression *and* the ! 144: patterns OPERANDS match the operands of the expression. ! 145: ! 146: Suppose that the function `commutative_operator' is defined as ! 147: follows, to match any expression whose operator is one of the ! 148: commutative arithmetic operators of RTL and whose mode is MODE: ! 149: ! 150: int ! 151: commutative_operator (x, mode) ! 152: rtx x; ! 153: enum machine_mode mode; ! 154: { ! 155: enum rtx_code code = GET_CODE (x); ! 156: if (GET_MODE (x) != mode) ! 157: return 0; ! 158: return (GET_RTX_CLASS (code) == 'c' ! 159: || code == EQ || code == NE); ! 160: } ! 161: ! 162: Then the following pattern will match any RTL expression consisting ! 163: of a commutative operator applied to two general operands: ! 164: ! 165: (match_operator:SI 3 "commutative_operator" ! 166: [(match_operand:SI 1 "general_operand" "g") ! 167: (match_operand:SI 2 "general_operand" "g")]) ! 168: ! 169: Here the vector `[OPERANDS...]' contains two patterns because the ! 170: expressions to be matched all contain two operands. ! 171: ! 172: When this pattern does match, the two operands of the commutative ! 173: operator are recorded as operands 1 and 2 of the insn. (This is ! 174: done by the two instances of `match_operand'.) Operand 3 of the ! 175: insn will be the entire commutative expression: use `GET_CODE ! 176: (operands[3])' to see which commutative operator was used. ! 177: ! 178: The machine mode M of `match_operator' works like that of ! 179: `match_operand': it is passed as the second argument to the ! 180: predicate function, and that function is solely responsible for ! 181: deciding whether the expression to be matched "has" that mode. ! 182: ! 183: When constructing an insn, argument 3 of the gen-function will ! 184: specify the operation (i.e. the expression code) for the ! 185: expression to be made. It should be an RTL expression, whose ! 186: expression code is copied into a new expression whose operands are ! 187: arguments 1 and 2 of the gen-function. The subexpressions of ! 188: argument 3 are not used; only its expression code matters. ! 189: ! 190: When `match_operator' is used in a pattern for matching an insn, ! 191: it usually best if the operand number of the `match_operator' is ! 192: higher than that of the actual operands of the insn. This improves ! 193: register allocation because the register allocator often looks at ! 194: operands 1 and 2 of insns to see if it can do register tying. ! 195: ! 196: There is no way to specify constraints in `match_operator'. The ! 197: operand of the insn which corresponds to the `match_operator' ! 198: never has any constraints because it is never reloaded as a whole. ! 199: However, if parts of its OPERANDS are matched by `match_operand' ! 200: patterns, those parts may have constraints of their own. ! 201: ! 202: `(match_op_dup:M N[OPERANDS...])' ! 203: Like `match_dup', except that it applies to operators instead of ! 204: operands. When constructing an insn, operand number N will be ! 205: substituted at this point. But in matching, `match_op_dup' behaves ! 206: differently. It assumes that operand number N has already been ! 207: determined by a `match_operator' appearing earlier in the ! 208: recognition template, and it matches only an identical-looking ! 209: expression. ! 210: ! 211: `(match_parallel N PREDICATE [SUBPAT...])' ! 212: This pattern is a placeholder for an insn that consists of a ! 213: `parallel' expression with a variable number of elements. This ! 214: expression should only appear at the top level of an insn pattern. ! 215: ! 216: When constructing an insn, operand number N will be substituted at ! 217: this point. When matching an insn, it matches if the body of the ! 218: insn is a `parallel' expression with at least as many elements as ! 219: the vector of SUBPAT expressions in the `match_parallel', if each ! 220: SUBPAT matches the corresponding element of the `parallel', *and* ! 221: the function PREDICATE returns nonzero on the `parallel' that is ! 222: the body of the insn. It is the responsibility of the predicate ! 223: to validate elements of the `parallel' beyond those listed in the ! 224: `match_parallel'. ! 225: ! 226: A typical use of `match_parallel' is to match load and store ! 227: multiple expressions, which can contains a variable number of ! 228: elements in a `parallel'. For example, ! 229: ! 230: (define_insn "" ! 231: [(match_parallel 0 "load_multiple_operation" ! 232: [(set (match_operand:SI 1 "gpc_reg_operand" "=r") ! 233: (match_operand:SI 2 "memory_operand" "m")) ! 234: (use (reg:SI 179)) ! 235: (clobber (reg:SI 179))])] ! 236: "" ! 237: "loadm 0,0,%1,%2") ! 238: ! 239: This example comes from `a29k.md'. The function ! 240: `load_multiple_operations' is defined in `a29k.c' and checks that ! 241: subsequent elements in the `parallel' are the same as the `set' in ! 242: the pattern, except that they are referencing subsequent registers ! 243: and memory locations. ! 244: ! 245: An insn that matches this pattern might look like: ! 246: ! 247: (parallel ! 248: [(set (reg:SI 20) (mem:SI (reg:SI 100))) ! 249: (use (reg:SI 179)) ! 250: (clobber (reg:SI 179)) ! 251: (set (reg:SI 21) ! 252: (mem:SI (plus:SI (reg:SI 100) ! 253: (const_int 4)))) ! 254: (set (reg:SI 22) ! 255: (mem:SI (plus:SI (reg:SI 100) ! 256: (const_int 8))))]) ! 257: ! 258: `(match_par_dup N [SUBPAT...])' ! 259: Like `match_op_dup', but for `match_parallel' instead of ! 260: `match_operator'. ! 261: ! 262: `(address (match_operand:M N "address_operand" ""))' ! 263: This complex of expressions is a placeholder for an operand number ! 264: N in a "load address" instruction: an operand which specifies a ! 265: memory location in the usual way, but for which the actual operand ! 266: value used is the address of the location, not the contents of the ! 267: location. ! 268: ! 269: `address' expressions never appear in RTL code, only in machine ! 270: descriptions. And they are used only in machine descriptions that ! 271: do not use the operand constraint feature. When operand ! 272: constraints are in use, the letter `p' in the constraint serves ! 273: this purpose. ! 274: ! 275: M is the machine mode of the *memory location being addressed*, ! 276: not the machine mode of the address itself. That mode is always ! 277: the same on a given target machine (it is `Pmode', which normally ! 278: is `SImode'), so there is no point in mentioning it; thus, no ! 279: machine mode is written in the `address' expression. If some day ! 280: support is added for machines in which addresses of different ! 281: kinds of objects appear differently or are used differently (such ! 282: as the PDP-10), different formats would perhaps need different ! 283: machine modes and these modes might be written in the `address' ! 284: expression. ! 285: ! 286: ! 287: File: gcc.info, Node: Output Template, Next: Output Statement, Prev: RTL Template, Up: Machine Desc ! 288: ! 289: Output Templates and Operand Substitution ! 290: ========================================= ! 291: ! 292: The "output template" is a string which specifies how to output the ! 293: assembler code for an instruction pattern. Most of the template is a ! 294: fixed string which is output literally. The character `%' is used to ! 295: specify where to substitute an operand; it can also be used to identify ! 296: places where different variants of the assembler require different ! 297: syntax. ! 298: ! 299: In the simplest case, a `%' followed by a digit N says to output ! 300: operand N at that point in the string. ! 301: ! 302: `%' followed by a letter and a digit says to output an operand in an ! 303: alternate fashion. Four letters have standard, built-in meanings ! 304: described below. The machine description macro `PRINT_OPERAND' can ! 305: define additional letters with nonstandard meanings. ! 306: ! 307: `%cDIGIT' can be used to substitute an operand that is a constant ! 308: value without the syntax that normally indicates an immediate operand. ! 309: ! 310: `%nDIGIT' is like `%cDIGIT' except that the value of the constant is ! 311: negated before printing. ! 312: ! 313: `%aDIGIT' can be used to substitute an operand as if it were a ! 314: memory reference, with the actual operand treated as the address. This ! 315: may be useful when outputting a "load address" instruction, because ! 316: often the assembler syntax for such an instruction requires you to ! 317: write the operand as if it were a memory reference. ! 318: ! 319: `%lDIGIT' is used to substitute a `label_ref' into a jump ! 320: instruction. ! 321: ! 322: `%=' outputs a number which is unique to each instruction in the ! 323: entire compilation. This is useful for making local labels to be ! 324: referred to more than once in a single template that generates multiple ! 325: assembler instructions. ! 326: ! 327: `%' followed by a punctuation character specifies a substitution that ! 328: does not use an operand. Only one case is standard: `%%' outputs a `%' ! 329: into the assembler code. Other nonstandard cases can be defined in the ! 330: `PRINT_OPERAND' macro. You must also define which punctuation ! 331: characters are valid with the `PRINT_OPERAND_PUNCT_VALID_P' macro. ! 332: ! 333: The template may generate multiple assembler instructions. Write ! 334: the text for the instructions, with `\;' between them. ! 335: ! 336: When the RTL contains two operands which are required by constraint ! 337: to match each other, the output template must refer only to the ! 338: lower-numbered operand. Matching operands are not always identical, ! 339: and the rest of the compiler arranges to put the proper RTL expression ! 340: for printing into the lower-numbered operand. ! 341: ! 342: One use of nonstandard letters or punctuation following `%' is to ! 343: distinguish between different assembler languages for the same machine; ! 344: for example, Motorola syntax versus MIT syntax for the 68000. Motorola ! 345: syntax requires periods in most opcode names, while MIT syntax does ! 346: not. For example, the opcode `movel' in MIT syntax is `move.l' in ! 347: Motorola syntax. The same file of patterns is used for both kinds of ! 348: output syntax, but the character sequence `%.' is used in each place ! 349: where Motorola syntax wants a period. The `PRINT_OPERAND' macro for ! 350: Motorola syntax defines the sequence to output a period; the macro for ! 351: MIT syntax defines it to do nothing. ! 352: ! 353: As a special case, a template consisting of the single character `#' ! 354: instructs the compiler to first split the insn, and then output the ! 355: resulting instructions separately. This helps eliminate redundancy in ! 356: the output templates. If you have a `define_insn' that needs to emit ! 357: multiple assembler instructions, and there is an matching `define_split' ! 358: already defined, then you can simply use `#' as the output template ! 359: instead of writing an output template that emits the multiple assembler ! 360: instructions. ! 361: ! 362: ! 363: File: gcc.info, Node: Output Statement, Next: Constraints, Prev: Output Template, Up: Machine Desc 1.1.1.4 root 364: 1.1.1.5 ! root 365: C Statements for Assembler Output ! 366: ================================= 1.1.1.4 root 367: 1.1.1.5 ! root 368: Often a single fixed template string cannot produce correct and ! 369: efficient assembler code for all the cases that are recognized by a ! 370: single instruction pattern. For example, the opcodes may depend on the ! 371: kinds of operands; or some unfortunate combinations of operands may ! 372: require extra machine instructions. ! 373: ! 374: If the output control string starts with a `@', then it is actually ! 375: a series of templates, each on a separate line. (Blank lines and ! 376: leading spaces and tabs are ignored.) The templates correspond to the ! 377: pattern's constraint alternatives (*note Multi-Alternative::.). For ! 378: example, if a target machine has a two-address add instruction `addr' ! 379: to add into a register and another `addm' to add a register to memory, ! 380: you might write this pattern: ! 381: ! 382: (define_insn "addsi3" ! 383: [(set (match_operand:SI 0 "general_operand" "=r,m") ! 384: (plus:SI (match_operand:SI 1 "general_operand" "0,0") ! 385: (match_operand:SI 2 "general_operand" "g,r")))] 1.1.1.4 root 386: "" 1.1.1.5 ! root 387: "@ ! 388: addr %2,%0 ! 389: addm %2,%0") ! 390: ! 391: If the output control string starts with a `*', then it is not an ! 392: output template but rather a piece of C program that should compute a ! 393: template. It should execute a `return' statement to return the ! 394: template-string you want. Most such templates use C string literals, ! 395: which require doublequote characters to delimit them. To include these ! 396: doublequote characters in the string, prefix each one with `\'. ! 397: ! 398: The operands may be found in the array `operands', whose C data type ! 399: is `rtx []'. ! 400: ! 401: It is very common to select different ways of generating assembler ! 402: code based on whether an immediate operand is within a certain range. ! 403: Be careful when doing this, because the result of `INTVAL' is an ! 404: integer on the host machine. If the host machine has more bits in an ! 405: `int' than the target machine has in the mode in which the constant ! 406: will be used, then some of the bits you get from `INTVAL' will be ! 407: superfluous. For proper results, you must carefully disregard the ! 408: values of those bits. ! 409: ! 410: It is possible to output an assembler instruction and then go on to ! 411: output or compute more of them, using the subroutine `output_asm_insn'. ! 412: This receives two arguments: a template-string and a vector of ! 413: operands. The vector may be `operands', or it may be another array of ! 414: `rtx' that you declare locally and initialize yourself. ! 415: ! 416: When an insn pattern has multiple alternatives in its constraints, ! 417: often the appearance of the assembler code is determined mostly by ! 418: which alternative was matched. When this is so, the C code can test ! 419: the variable `which_alternative', which is the ordinal number of the ! 420: alternative that was actually satisfied (0 for the first, 1 for the ! 421: second alternative, etc.). ! 422: ! 423: For example, suppose there are two opcodes for storing zero, `clrreg' ! 424: for registers and `clrmem' for memory locations. Here is how a pattern ! 425: could use `which_alternative' to choose between them: ! 426: ! 427: (define_insn "" ! 428: [(set (match_operand:SI 0 "general_operand" "=r,m") ! 429: (const_int 0))] 1.1.1.4 root 430: "" 1.1.1.5 ! root 431: "* ! 432: return (which_alternative == 0 ! 433: ? \"clrreg %0\" : \"clrmem %0\"); ! 434: ") ! 435: ! 436: The example above, where the assembler code to generate was *solely* ! 437: determined by the alternative, could also have been specified as ! 438: follows, having the output control string start with a `@': 1.1.1.4 root 439: 1.1.1.5 ! root 440: (define_insn "" ! 441: [(set (match_operand:SI 0 "general_operand" "=r,m") ! 442: (const_int 0))] 1.1.1.4 root 443: "" 1.1.1.5 ! root 444: "@ ! 445: clrreg %0 ! 446: clrmem %0") 1.1.1.4 root 447: 448: 1.1.1.5 ! root 449: File: gcc.info, Node: Constraints, Next: Standard Names, Prev: Output Statement, Up: Machine Desc ! 450: ! 451: Operand Constraints ! 452: =================== ! 453: ! 454: Each `match_operand' in an instruction pattern can specify a ! 455: constraint for the type of operands allowed. Constraints can say ! 456: whether an operand may be in a register, and which kinds of register; ! 457: whether the operand can be a memory reference, and which kinds of ! 458: address; whether the operand may be an immediate constant, and which ! 459: possible values it may have. Constraints can also require two operands ! 460: to match. ! 461: ! 462: * Menu: ! 463: ! 464: * Simple Constraints:: Basic use of constraints. ! 465: * Multi-Alternative:: When an insn has two alternative constraint-patterns. ! 466: * Class Preferences:: Constraints guide which hard register to put things in. ! 467: * Modifiers:: More precise control over effects of constraints. ! 468: * Machine Constraints:: Existing constraints for some particular machines. ! 469: * No Constraints:: Describing a clean machine without constraints. ! 470: ! 471: ! 472: File: gcc.info, Node: Simple Constraints, Next: Multi-Alternative, Up: Constraints ! 473: ! 474: Simple Constraints ! 475: ------------------ 1.1.1.4 root 476: 1.1.1.5 ! root 477: The simplest kind of constraint is a string full of letters, each of ! 478: which describes one kind of operand that is permitted. Here are the ! 479: letters that are allowed: ! 480: ! 481: `m' ! 482: A memory operand is allowed, with any kind of address that the ! 483: machine supports in general. ! 484: ! 485: `o' ! 486: A memory operand is allowed, but only if the address is ! 487: "offsettable". This means that adding a small integer (actually, ! 488: the width in bytes of the operand, as determined by its machine ! 489: mode) may be added to the address and the result is also a valid ! 490: memory address. ! 491: ! 492: For example, an address which is constant is offsettable; so is an ! 493: address that is the sum of a register and a constant (as long as a ! 494: slightly larger constant is also within the range of ! 495: address-offsets supported by the machine); but an autoincrement or ! 496: autodecrement address is not offsettable. More complicated ! 497: indirect/indexed addresses may or may not be offsettable depending ! 498: on the other addressing modes that the machine supports. ! 499: ! 500: Note that in an output operand which can be matched by another ! 501: operand, the constraint letter `o' is valid only when accompanied ! 502: by both `<' (if the target machine has predecrement addressing) ! 503: and `>' (if the target machine has preincrement addressing). ! 504: ! 505: `V' ! 506: A memory operand that is not offsettable. In other words, ! 507: anything that would fit the `m' constraint but not the `o' ! 508: constraint. ! 509: ! 510: `<' ! 511: A memory operand with autodecrement addressing (either ! 512: predecrement or postdecrement) is allowed. ! 513: ! 514: `>' ! 515: A memory operand with autoincrement addressing (either ! 516: preincrement or postincrement) is allowed. ! 517: ! 518: `r' ! 519: A register operand is allowed provided that it is in a general ! 520: register. ! 521: ! 522: `d', `a', `f', ... ! 523: Other letters can be defined in machine-dependent fashion to stand ! 524: for particular classes of registers. `d', `a' and `f' are defined ! 525: on the 68000/68020 to stand for data, address and floating point ! 526: registers. ! 527: ! 528: `i' ! 529: An immediate integer operand (one with constant value) is allowed. ! 530: This includes symbolic constants whose values will be known only at ! 531: assembly time. ! 532: ! 533: `n' ! 534: An immediate integer operand with a known numeric value is allowed. ! 535: Many systems cannot support assembly-time constants for operands ! 536: less than a word wide. Constraints for these operands should use ! 537: `n' rather than `i'. ! 538: ! 539: `I', `J', `K', ... `P' ! 540: Other letters in the range `I' through `P' may be defined in a ! 541: machine-dependent fashion to permit immediate integer operands with ! 542: explicit integer values in specified ranges. For example, on the ! 543: 68000, `I' is defined to stand for the range of values 1 to 8. ! 544: This is the range permitted as a shift count in the shift ! 545: instructions. ! 546: ! 547: `E' ! 548: An immediate floating operand (expression code `const_double') is ! 549: allowed, but only if the target floating point format is the same ! 550: as that of the host machine (on which the compiler is running). ! 551: ! 552: `F' ! 553: An immediate floating operand (expression code `const_double') is ! 554: allowed. ! 555: ! 556: `G', `H' ! 557: `G' and `H' may be defined in a machine-dependent fashion to ! 558: permit immediate floating operands in particular ranges of values. ! 559: ! 560: `s' ! 561: An immediate integer operand whose value is not an explicit ! 562: integer is allowed. ! 563: ! 564: This might appear strange; if an insn allows a constant operand ! 565: with a value not known at compile time, it certainly must allow ! 566: any known value. So why use `s' instead of `i'? Sometimes it ! 567: allows better code to be generated. ! 568: ! 569: For example, on the 68000 in a fullword instruction it is possible ! 570: to use an immediate operand; but if the immediate value is between ! 571: -128 and 127, better code results from loading the value into a ! 572: register and using the register. This is because the load into ! 573: the register can be done with a `moveq' instruction. We arrange ! 574: for this to happen by defining the letter `K' to mean "any integer ! 575: outside the range -128 to 127", and then specifying `Ks' in the ! 576: operand constraints. ! 577: ! 578: `g' ! 579: Any register, memory or immediate integer operand is allowed, ! 580: except for registers that are not general registers. ! 581: ! 582: `X' ! 583: Any operand whatsoever is allowed, even if it does not satisfy ! 584: `general_operand'. This is normally used in the constraint of a ! 585: `match_scratch' when certain alternatives will not actually ! 586: require a scratch register. ! 587: ! 588: `0', `1', `2', ... `9' ! 589: An operand that matches the specified operand number is allowed. ! 590: If a digit is used together with letters within the same ! 591: alternative, the digit should come last. ! 592: ! 593: This is called a "matching constraint" and what it really means is ! 594: that the assembler has only a single operand that fills two roles ! 595: considered separate in the RTL insn. For example, an add insn has ! 596: two input operands and one output operand in the RTL, but on most ! 597: CISC machines an add instruction really has only two operands, one ! 598: of them an input-output operand: ! 599: ! 600: addl #35,r12 ! 601: ! 602: Matching constraints are used in these circumstances. More ! 603: precisely, the two operands that match must include one input-only ! 604: operand and one output-only operand. Moreover, the digit must be a ! 605: smaller number than the number of the operand that uses it in the ! 606: constraint. ! 607: ! 608: For operands to match in a particular case usually means that they ! 609: are identical-looking RTL expressions. But in a few special cases ! 610: specific kinds of dissimilarity are allowed. For example, `*x' as ! 611: an input operand will match `*x++' as an output operand. For ! 612: proper results in such cases, the output template should always ! 613: use the output-operand's number when printing the operand. ! 614: ! 615: `p' ! 616: An operand that is a valid memory address is allowed. This is for ! 617: "load address" and "push address" instructions. ! 618: ! 619: `p' in the constraint must be accompanied by `address_operand' as ! 620: the predicate in the `match_operand'. This predicate interprets ! 621: the mode specified in the `match_operand' as the mode of the memory ! 622: reference for which the address would be valid. ! 623: ! 624: `Q', `R', `S', ... `U' ! 625: Letters in the range `Q' through `U' may be defined in a ! 626: machine-dependent fashion to stand for arbitrary operand types. ! 627: The machine description macro `EXTRA_CONSTRAINT' is passed the ! 628: operand as its first argument and the constraint letter as its ! 629: second operand. ! 630: ! 631: A typical use for this would be to distinguish certain types of ! 632: memory references that affect other insn operands. ! 633: ! 634: Do not define these constraint letters to accept register ! 635: references (`reg'); the reload pass does not expect this and would ! 636: not handle it properly. ! 637: ! 638: In order to have valid assembler code, each operand must satisfy its ! 639: constraint. But a failure to do so does not prevent the pattern from ! 640: applying to an insn. Instead, it directs the compiler to modify the ! 641: code so that the constraint will be satisfied. Usually this is done by ! 642: copying an operand into a register. 1.1.1.4 root 643: 1.1.1.5 ! root 644: Contrast, therefore, the two instruction patterns that follow: ! 645: ! 646: (define_insn "" ! 647: [(set (match_operand:SI 0 "general_operand" "=r") ! 648: (plus:SI (match_dup 0) ! 649: (match_operand:SI 1 "general_operand" "r")))] 1.1.1.4 root 650: "" 1.1.1.5 ! root 651: "...") ! 652: ! 653: which has two operands, one of which must appear in two places, and ! 654: ! 655: (define_insn "" ! 656: [(set (match_operand:SI 0 "general_operand" "=r") ! 657: (plus:SI (match_operand:SI 1 "general_operand" "0") ! 658: (match_operand:SI 2 "general_operand" "r")))] 1.1.1.4 root 659: "" 1.1.1.5 ! root 660: "...") ! 661: ! 662: which has three operands, two of which are required by a constraint to ! 663: be identical. If we are considering an insn of the form ! 664: ! 665: (insn N PREV NEXT ! 666: (set (reg:SI 3) ! 667: (plus:SI (reg:SI 6) (reg:SI 109))) ! 668: ...) ! 669: ! 670: the first pattern would not apply at all, because this insn does not ! 671: contain two identical subexpressions in the right place. The pattern ! 672: would say, "That does not look like an add instruction; try other ! 673: patterns." The second pattern would say, "Yes, that's an add ! 674: instruction, but there is something wrong with it." It would direct ! 675: the reload pass of the compiler to generate additional insns to make ! 676: the constraint true. The results might look like this: ! 677: ! 678: (insn N2 PREV N ! 679: (set (reg:SI 3) (reg:SI 6)) ! 680: ...) 1.1.1.4 root 681: 1.1.1.5 ! root 682: (insn N N2 NEXT ! 683: (set (reg:SI 3) ! 684: (plus:SI (reg:SI 3) (reg:SI 109))) ! 685: ...) ! 686: ! 687: It is up to you to make sure that each operand, in each pattern, has ! 688: constraints that can handle any RTL expression that could be present for ! 689: that operand. (When multiple alternatives are in use, each pattern ! 690: must, for each possible combination of operand expressions, have at ! 691: least one alternative which can handle that combination of operands.) ! 692: The constraints don't need to *allow* any possible operand--when this is ! 693: the case, they do not constrain--but they must at least point the way to ! 694: reloading any possible operand so that it will fit. ! 695: ! 696: * If the constraint accepts whatever operands the predicate permits, ! 697: there is no problem: reloading is never necessary for this operand. ! 698: ! 699: For example, an operand whose constraints permit everything except ! 700: registers is safe provided its predicate rejects registers. ! 701: ! 702: An operand whose predicate accepts only constant values is safe ! 703: provided its constraints include the letter `i'. If any possible ! 704: constant value is accepted, then nothing less than `i' will do; if ! 705: the predicate is more selective, then the constraints may also be ! 706: more selective. ! 707: ! 708: * Any operand expression can be reloaded by copying it into a ! 709: register. So if an operand's constraints allow some kind of ! 710: register, it is certain to be safe. It need not permit all ! 711: classes of registers; the compiler knows how to copy a register ! 712: into another register of the proper class in order to make an ! 713: instruction valid. ! 714: ! 715: * A nonoffsettable memory reference can be reloaded by copying the ! 716: address into a register. So if the constraint uses the letter ! 717: `o', all memory references are taken care of. ! 718: ! 719: * A constant operand can be reloaded by allocating space in memory to ! 720: hold it as preinitialized data. Then the memory reference can be ! 721: used in place of the constant. So if the constraint uses the ! 722: letters `o' or `m', constant operands are not a problem. ! 723: ! 724: * If the constraint permits a constant and a pseudo register used in ! 725: an insn was not allocated to a hard register and is equivalent to ! 726: a constant, the register will be replaced with the constant. If ! 727: the predicate does not permit a constant and the insn is ! 728: re-recognized for some reason, the compiler will crash. Thus the ! 729: predicate must always recognize any objects allowed by the ! 730: constraint. ! 731: ! 732: If the operand's predicate can recognize registers, but the ! 733: constraint does not permit them, it can make the compiler crash. When ! 734: this operand happens to be a register, the reload pass will be stymied, ! 735: because it does not know how to copy a register temporarily into memory. 1.1.1.4 root 736: 737: 1.1.1.5 ! root 738: File: gcc.info, Node: Multi-Alternative, Next: Class Preferences, Prev: Simple Constraints, Up: Constraints 1.1.1.4 root 739: 1.1.1.5 ! root 740: Multiple Alternative Constraints ! 741: -------------------------------- 1.1.1.4 root 742: 1.1.1.5 ! root 743: Sometimes a single instruction has multiple alternative sets of ! 744: possible operands. For example, on the 68000, a logical-or instruction ! 745: can combine register or an immediate value into memory, or it can ! 746: combine any kind of operand into a register; but it cannot combine one ! 747: memory location into another. ! 748: ! 749: These constraints are represented as multiple alternatives. An ! 750: alternative can be described by a series of letters for each operand. ! 751: The overall constraint for an operand is made from the letters for this ! 752: operand from the first alternative, a comma, the letters for this ! 753: operand from the second alternative, a comma, and so on until the last ! 754: alternative. Here is how it is done for fullword logical-or on the ! 755: 68000: ! 756: ! 757: (define_insn "iorsi3" ! 758: [(set (match_operand:SI 0 "general_operand" "=m,d") ! 759: (ior:SI (match_operand:SI 1 "general_operand" "%0,0") ! 760: (match_operand:SI 2 "general_operand" "dKs,dmKs")))] ! 761: ...) ! 762: ! 763: The first alternative has `m' (memory) for operand 0, `0' for ! 764: operand 1 (meaning it must match operand 0), and `dKs' for operand 2. ! 765: The second alternative has `d' (data register) for operand 0, `0' for ! 766: operand 1, and `dmKs' for operand 2. The `=' and `%' in the ! 767: constraints apply to all the alternatives; their meaning is explained ! 768: in the next section (*note Class Preferences::.). ! 769: ! 770: If all the operands fit any one alternative, the instruction is ! 771: valid. Otherwise, for each alternative, the compiler counts how many ! 772: instructions must be added to copy the operands so that that ! 773: alternative applies. The alternative requiring the least copying is ! 774: chosen. If two alternatives need the same amount of copying, the one ! 775: that comes first is chosen. These choices can be altered with the `?' ! 776: and `!' characters: ! 777: ! 778: `?' ! 779: Disparage slightly the alternative that the `?' appears in, as a ! 780: choice when no alternative applies exactly. The compiler regards ! 781: this alternative as one unit more costly for each `?' that appears ! 782: in it. ! 783: ! 784: `!' ! 785: Disparage severely the alternative that the `!' appears in. This ! 786: alternative can still be used if it fits without reloading, but if ! 787: reloading is needed, some other alternative will be used. ! 788: ! 789: When an insn pattern has multiple alternatives in its constraints, ! 790: often the appearance of the assembler code is determined mostly by which ! 791: alternative was matched. When this is so, the C code for writing the ! 792: assembler code can use the variable `which_alternative', which is the ! 793: ordinal number of the alternative that was actually satisfied (0 for ! 794: the first, 1 for the second alternative, etc.). *Note Output ! 795: Statement::. 1.1.1.3 root 796: 1.1.1.5 ! root 797: ! 798: File: gcc.info, Node: Class Preferences, Next: Modifiers, Prev: Multi-Alternative, Up: Constraints 1.1.1.3 root 799: 1.1.1.5 ! root 800: Register Class Preferences ! 801: -------------------------- ! 802: ! 803: The operand constraints have another function: they enable the ! 804: compiler to decide which kind of hardware register a pseudo register is ! 805: best allocated to. The compiler examines the constraints that apply to ! 806: the insns that use the pseudo register, looking for the ! 807: machine-dependent letters such as `d' and `a' that specify classes of ! 808: registers. The pseudo register is put in whichever class gets the most ! 809: "votes". The constraint letters `g' and `r' also vote: they vote in ! 810: favor of a general register. The machine description says which ! 811: registers are considered general. ! 812: ! 813: Of course, on some machines all registers are equivalent, and no ! 814: register classes are defined. Then none of this complexity is relevant. 1.1.1.4 root 815: 816: 1.1.1.5 ! root 817: File: gcc.info, Node: Modifiers, Next: Machine Constraints, Prev: Class Preferences, Up: Constraints 1.1.1.4 root 818: 1.1.1.5 ! root 819: Constraint Modifier Characters ! 820: ------------------------------ 1.1.1.4 root 821: 1.1.1.5 ! root 822: `=' ! 823: Means that this operand is write-only for this instruction: the ! 824: previous value is discarded and replaced by output data. ! 825: ! 826: `+' ! 827: Means that this operand is both read and written by the ! 828: instruction. ! 829: ! 830: When the compiler fixes up the operands to satisfy the constraints, ! 831: it needs to know which operands are inputs to the instruction and ! 832: which are outputs from it. `=' identifies an output; `+' ! 833: identifies an operand that is both input and output; all other ! 834: operands are assumed to be input only. ! 835: ! 836: `&' ! 837: Means (in a particular alternative) that this operand is written ! 838: before the instruction is finished using the input operands. ! 839: Therefore, this operand may not lie in a register that is used as ! 840: an input operand or as part of any memory address. ! 841: ! 842: `&' applies only to the alternative in which it is written. In ! 843: constraints with multiple alternatives, sometimes one alternative ! 844: requires `&' while others do not. See, for example, the `movdf' ! 845: insn of the 68000. ! 846: ! 847: `&' does not obviate the need to write `='. ! 848: ! 849: `%' ! 850: Declares the instruction to be commutative for this operand and the ! 851: following operand. This means that the compiler may interchange ! 852: the two operands if that is the cheapest way to make all operands ! 853: fit the constraints. This is often used in patterns for addition ! 854: instructions that really have only two operands: the result must ! 855: go in one of the arguments. Here for example, is how the 68000 ! 856: halfword-add instruction is defined: ! 857: ! 858: (define_insn "addhi3" ! 859: [(set (match_operand:HI 0 "general_operand" "=m,r") ! 860: (plus:HI (match_operand:HI 1 "general_operand" "%0,0") ! 861: (match_operand:HI 2 "general_operand" "di,g")))] ! 862: ...) ! 863: ! 864: `#' ! 865: Says that all following characters, up to the next comma, are to be ! 866: ignored as a constraint. They are significant only for choosing ! 867: register preferences. ! 868: ! 869: `*' ! 870: Says that the following character should be ignored when choosing ! 871: register preferences. `*' has no effect on the meaning of the ! 872: constraint as a constraint, and no effect on reloading. ! 873: ! 874: Here is an example: the 68000 has an instruction to sign-extend a ! 875: halfword in a data register, and can also sign-extend a value by ! 876: copying it into an address register. While either kind of ! 877: register is acceptable, the constraints on an address-register ! 878: destination are less strict, so it is best if register allocation ! 879: makes an address register its goal. Therefore, `*' is used so ! 880: that the `d' constraint letter (for data register) is ignored when ! 881: computing register preferences. ! 882: ! 883: (define_insn "extendhisi2" ! 884: [(set (match_operand:SI 0 "general_operand" "=*d,a") ! 885: (sign_extend:SI ! 886: (match_operand:HI 1 "general_operand" "0,g")))] ! 887: ...) 1.1.1.4 root 888: 1.1.1.5 ! root 889: ! 890: File: gcc.info, Node: Machine Constraints, Next: No Constraints, Prev: Modifiers, Up: Constraints 1.1.1.4 root 891: 1.1.1.5 ! root 892: Constraints for Particular Machines ! 893: ----------------------------------- 1.1.1.4 root 894: 1.1.1.5 ! root 895: Whenever possible, you should use the general-purpose constraint ! 896: letters in `asm' arguments, since they will convey meaning more readily ! 897: to people reading your code. Failing that, use the constraint letters ! 898: that usually have very similar meanings across architectures. The most ! 899: commonly used constraints are `m' and `r' (for memory and ! 900: general-purpose registers respectively; *note Simple Constraints::.), ! 901: and `I', usually the letter indicating the most common ! 902: immediate-constant format. 1.1.1.4 root 903: 1.1.1.5 ! root 904: For each machine architecture, the `config/MACHINE.h' file defines ! 905: additional constraints. These constraints are used by the compiler ! 906: itself for instruction generation, as well as for `asm' statements; ! 907: therefore, some of the constraints are not particularly interesting for ! 908: `asm'. The constraints are defined through these macros: 1.1.1.4 root 909: 1.1.1.5 ! root 910: `REG_CLASS_FROM_LETTER' ! 911: Register class constraints (usually lower case). 1.1.1.4 root 912: 1.1.1.5 ! root 913: `CONST_OK_FOR_LETTER_P' ! 914: Immediate constant constraints, for non-floating point constants of ! 915: word size or smaller precision (usually upper case). 1.1.1.4 root 916: 1.1.1.5 ! root 917: `CONST_DOUBLE_OK_FOR_LETTER_P' ! 918: Immediate constant constraints, for all floating point constants ! 919: and for constants of greater than word size precision (usually ! 920: upper case). 1.1.1.4 root 921: 1.1.1.5 ! root 922: `EXTRA_CONSTRAINT' ! 923: Special cases of registers or memory. This macro is not required, ! 924: and is only defined for some machines. 1.1.1.4 root 925: 1.1.1.5 ! root 926: Inspecting these macro definitions in the compiler source for your ! 927: machine is the best way to be certain you have the right constraints. ! 928: However, here is a summary of the machine-dependent constraints ! 929: available on some particular machines. 1.1.1.4 root 930: 1.1.1.5 ! root 931: *AMD 29000 family--`a29k.h'* ! 932: `l' ! 933: Local register 0 1.1.1.4 root 934: 1.1.1.5 ! root 935: `b' ! 936: Byte Pointer (`BP') register 1.1.1.4 root 937: 1.1.1.5 ! root 938: `q' ! 939: `Q' register 1.1.1.4 root 940: 1.1.1.5 ! root 941: `h' ! 942: Special purpose register 1.1.1.4 root 943: 1.1.1.5 ! root 944: `A' ! 945: First accumulator register 1.1.1.4 root 946: 1.1.1.5 ! root 947: `a' ! 948: Other accumulator register 1.1.1.4 root 949: 1.1.1.5 ! root 950: `f' ! 951: Floating point register 1.1.1.4 root 952: 1.1.1.5 ! root 953: `I' ! 954: Constant greater than 0, less than 0x100 1.1.1.4 root 955: 1.1.1.5 ! root 956: `J' ! 957: Constant greater than 0, less than 0x10000 1.1.1.4 root 958: 1.1.1.5 ! root 959: `K' ! 960: Constant whose high 24 bits are on (1) 1.1.1.4 root 961: 1.1.1.5 ! root 962: `L' ! 963: 16 bit constant whose high 8 bits are on (1) 1.1.1.4 root 964: 1.1.1.5 ! root 965: `M' ! 966: 32 bit constant whose high 16 bits are on (1) 1.1.1.4 root 967: 1.1.1.5 ! root 968: `N' ! 969: 32 bit negative constant that fits in 8 bits 1.1.1.4 root 970: 1.1.1.5 ! root 971: `O' ! 972: The constant 0x80000000 or, on the 29050, any 32 bit constant ! 973: whose low 16 bits are 0. 1.1.1.4 root 974: 1.1.1.5 ! root 975: `P' ! 976: 16 bit negative constant that fits in 8 bits 1.1.1.4 root 977: 1.1.1.5 ! root 978: `G' ! 979: `H' ! 980: A floating point constant (in `asm' statements, use the ! 981: machine independent `E' or `F' instead) 1.1.1.4 root 982: 1.1.1.5 ! root 983: *IBM RS6000--`rs6000.h'* ! 984: `b' ! 985: Address base register 1.1.1.4 root 986: 1.1.1.5 ! root 987: `f' ! 988: Floating point register 1.1.1.4 root 989: 1.1.1.5 ! root 990: `h' ! 991: `MQ', `CTR', or `LINK' register 1.1.1.4 root 992: 1.1.1.5 ! root 993: `q' ! 994: `MQ' register 1.1.1.4 root 995: 1.1.1.5 ! root 996: `c' ! 997: `CTR' register 1.1.1.4 root 998: 1.1.1.5 ! root 999: `l' ! 1000: `LINK' register 1.1.1.4 root 1001: 1.1.1.5 ! root 1002: `x' ! 1003: `CR' register (condition register) number 0 1.1.1.4 root 1004: 1.1.1.5 ! root 1005: `y' ! 1006: `CR' register (condition register) 1.1.1.4 root 1007: 1.1.1.5 ! root 1008: `I' ! 1009: Signed 16 bit constant 1.1.1.4 root 1010: 1.1.1.5 ! root 1011: `J' ! 1012: Constant whose low 16 bits are 0 1.1.1.4 root 1013: 1.1.1.5 ! root 1014: `K' ! 1015: Constant whose high 16 bits are 0 1.1.1.4 root 1016: 1.1.1.5 ! root 1017: `L' ! 1018: Constant suitable as a mask operand 1.1.1.4 root 1019: 1.1.1.5 ! root 1020: `M' ! 1021: Constant larger than 31 1.1.1.4 root 1022: 1.1.1.5 ! root 1023: `N' ! 1024: Exact power of 2 1.1.1.4 root 1025: 1.1.1.5 ! root 1026: `O' ! 1027: Zero 1.1.1.4 root 1028: 1.1.1.5 ! root 1029: `P' ! 1030: Constant whose negation is a signed 16 bit constant 1.1.1.4 root 1031: 1.1.1.5 ! root 1032: `G' ! 1033: Floating point constant that can be loaded into a register ! 1034: with one instruction per word 1.1.1.4 root 1035: 1.1.1.5 ! root 1036: `Q' ! 1037: Memory operand that is an offset from a register (`m' is ! 1038: preferable for `asm' statements) 1.1.1.4 root 1039: 1.1.1.5 ! root 1040: *Intel 386--`i386.h'* ! 1041: `q' ! 1042: `a', `b', `c', or `d' register 1.1.1.4 root 1043: 1.1.1.5 ! root 1044: `f' ! 1045: Floating point register 1.1.1.4 root 1046: 1.1.1.5 ! root 1047: `t' ! 1048: First (top of stack) floating point register 1.1.1.4 root 1049: 1.1.1.5 ! root 1050: `u' ! 1051: Second floating point register 1.1.1.4 root 1052: 1.1.1.5 ! root 1053: `a' ! 1054: `a' register 1.1.1.4 root 1055: 1.1.1.5 ! root 1056: `b' ! 1057: `b' register 1.1.1.4 root 1058: 1.1.1.5 ! root 1059: `c' ! 1060: `c' register 1.1.1.4 root 1061: 1.1.1.5 ! root 1062: `d' ! 1063: `d' register 1.1.1.4 root 1064: 1.1.1.5 ! root 1065: `D' ! 1066: `di' register 1.1.1.4 root 1067: 1.1.1.5 ! root 1068: `S' ! 1069: `si' register 1.1.1.4 root 1070: 1.1.1.5 ! root 1071: `I' ! 1072: Constant in range 0 to 31 (for 32 bit shifts) 1.1.1.4 root 1073: 1.1.1.5 ! root 1074: `J' ! 1075: Constant in range 0 to 63 (for 64 bit shifts) 1.1.1.4 root 1076: 1.1.1.5 ! root 1077: `K' ! 1078: `0xff' 1.1.1.4 root 1079: 1.1.1.5 ! root 1080: `L' ! 1081: `0xffff' 1.1.1.4 root 1082: 1.1.1.5 ! root 1083: `M' ! 1084: 0, 1, 2, or 3 (shifts for `lea' instruction) 1.1.1.3 root 1085: 1.1.1.5 ! root 1086: `G' ! 1087: Standard 80387 floating point constant ! 1088: ! 1089: *Intel 960--`i960.h'* ! 1090: `f' ! 1091: Floating point register (`fp0' to `fp3') ! 1092: ! 1093: `l' ! 1094: Local register (`r0' to `r15') ! 1095: ! 1096: `b' ! 1097: Global register (`g0' to `g15') ! 1098: ! 1099: `d' ! 1100: Any local or global register ! 1101: ! 1102: `I' ! 1103: Integers from 0 to 31 ! 1104: ! 1105: `J' ! 1106: 0 ! 1107: ! 1108: `K' ! 1109: Integers from -31 to 0 ! 1110: ! 1111: `G' ! 1112: Floating point 0 ! 1113: ! 1114: `H' ! 1115: Floating point 1 ! 1116: ! 1117: *MIPS--`mips.h'* ! 1118: `d' ! 1119: General-purpose integer register ! 1120: ! 1121: `f' ! 1122: Floating-point register (if available) ! 1123: ! 1124: `h' ! 1125: `Hi' register ! 1126: ! 1127: `l' ! 1128: `Lo' register ! 1129: ! 1130: `x' ! 1131: `Hi' or `Lo' register ! 1132: ! 1133: `y' ! 1134: General-purpose integer register ! 1135: ! 1136: `z' ! 1137: Floating-point status register ! 1138: ! 1139: `I' ! 1140: Signed 16 bit constant (for arithmetic instructions) ! 1141: ! 1142: `J' ! 1143: Zero ! 1144: ! 1145: `K' ! 1146: Zero-extended 16-bit constant (for logic instructions) ! 1147: ! 1148: `L' ! 1149: Constant with low 16 bits zero (can be loaded with `lui') ! 1150: ! 1151: `M' ! 1152: 32 bit constant which requires two instructions to load (a ! 1153: constant which is not `I', `K', or `L') ! 1154: ! 1155: `N' ! 1156: Negative 16 bit constant ! 1157: ! 1158: `O' ! 1159: Exact power of two ! 1160: ! 1161: `P' ! 1162: Positive 16 bit constant ! 1163: ! 1164: `G' ! 1165: Floating point zero ! 1166: ! 1167: `Q' ! 1168: Memory reference that can be loaded with more than one ! 1169: instruction (`m' is preferable for `asm' statements) ! 1170: ! 1171: `R' ! 1172: Memory reference that can be loaded with one instruction (`m' ! 1173: is preferable for `asm' statements) ! 1174: ! 1175: `S' ! 1176: Memory reference in external OSF/rose PIC format (`m' is ! 1177: preferable for `asm' statements) ! 1178: ! 1179: *Motorola 680x0--`m68k.h'* ! 1180: `a' ! 1181: Address register ! 1182: ! 1183: `d' ! 1184: Data register ! 1185: ! 1186: `f' ! 1187: 68881 floating-point register, if available ! 1188: ! 1189: `x' ! 1190: Sun FPA (floating-point) register, if available ! 1191: ! 1192: `y' ! 1193: First 16 Sun FPA registers, if available ! 1194: ! 1195: `I' ! 1196: Integer in the range 1 to 8 ! 1197: ! 1198: `J' ! 1199: 16 bit signed number ! 1200: ! 1201: `K' ! 1202: Signed number whose magnitude is greater than 0x80 ! 1203: ! 1204: `L' ! 1205: Integer in the range -8 to -1 ! 1206: ! 1207: `G' ! 1208: Floating point constant that is not a 68881 constant ! 1209: ! 1210: `H' ! 1211: Floating point constant that can be used by Sun FPA ! 1212: ! 1213: *SPARC--`sparc.h'* ! 1214: `f' ! 1215: Floating-point register ! 1216: ! 1217: `I' ! 1218: Signed 13 bit constant ! 1219: ! 1220: `J' ! 1221: Zero ! 1222: ! 1223: `K' ! 1224: 32 bit constant with the low 12 bits clear (a constant that ! 1225: can be loaded with the `sethi' instruction) ! 1226: ! 1227: `G' ! 1228: Floating-point zero ! 1229: ! 1230: `H' ! 1231: Signed 13 bit constant, sign-extended to 32 or 64 bits ! 1232: ! 1233: `Q' ! 1234: Memory reference that can be loaded with one instruction ! 1235: (`m' is more appropriate for `asm' statements) ! 1236: ! 1237: `S' ! 1238: Constant, or memory address ! 1239: ! 1240: `T' ! 1241: Memory address aligned to an 8-byte boundary ! 1242: ! 1243: `U' ! 1244: Even register ! 1245: ! 1246: ! 1247: File: gcc.info, Node: No Constraints, Prev: Machine Constraints, Up: Constraints ! 1248: ! 1249: Not Using Constraints ! 1250: --------------------- 1.1 root 1251: 1.1.1.5 ! root 1252: Some machines are so clean that operand constraints are not ! 1253: required. For example, on the Vax, an operand valid in one context is ! 1254: valid in any other context. On such a machine, every operand ! 1255: constraint would be `g', excepting only operands of "load address" ! 1256: instructions which are written as if they referred to a memory ! 1257: location's contents but actual refer to its address. They would have ! 1258: constraint `p'. ! 1259: ! 1260: For such machines, instead of writing `g' and `p' for all the ! 1261: constraints, you can choose to write a description with empty ! 1262: constraints. Then you write `""' for the constraint in every ! 1263: `match_operand'. Address operands are identified by writing an ! 1264: `address' expression around the `match_operand', not by their ! 1265: constraints. ! 1266: ! 1267: When the machine description has just empty constraints, certain ! 1268: parts of compilation are skipped, making the compiler faster. However, ! 1269: few machines actually do not need constraints; all machine descriptions ! 1270: now in existence use constraints. 1.1 root 1271:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.