|
|
1.1 ! root 1: /* Register Transfer Language (RTL) definitions for GNU C-Compiler ! 2: Copyright (C) 1987 Free Software Foundation, Inc. ! 3: ! 4: This file is part of GNU CC. ! 5: ! 6: GNU CC is distributed in the hope that it will be useful, ! 7: but WITHOUT ANY WARRANTY. No author or distributor ! 8: accepts responsibility to anyone for the consequences of using it ! 9: or for whether it serves any particular purpose or works at all, ! 10: unless he says so in writing. Refer to the GNU CC General Public ! 11: License for full details. ! 12: ! 13: Everyone is granted permission to copy, modify and redistribute ! 14: GNU CC, but only under the conditions described in the ! 15: GNU CC General Public License. A copy of this license is ! 16: supposed to have been given to you along with GNU CC so you ! 17: can know your rights and responsibilities. It should be in a ! 18: file named COPYING. Among other things, the copyright notice ! 19: and this notice must be preserved on all copies. */ ! 20: ! 21: ! 22: /* Register Transfer Language EXPRESSIONS CODES */ ! 23: ! 24: #define RTX_CODE enum rtx_code ! 25: enum rtx_code { ! 26: ! 27: #define DEF_RTL_EXPR(ENUM, NAME, FORMAT) ENUM , ! 28: #include "rtl.def" /* rtl expressions are documented here */ ! 29: #undef DEF_RTL_EXPR ! 30: ! 31: LAST_AND_UNUSED_RTX_CODE}; /* A convienent way to get a value for ! 32: NUM_RTX_CODE. ! 33: Assumes default enum value assignement. */ ! 34: ! 35: #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE) ! 36: /* The cast here, saves many elsewhere. */ ! 37: ! 38: extern int rtx_length[]; ! 39: #define GET_RTX_LENGTH(CODE) (rtx_length[(int)(CODE)]) ! 40: ! 41: extern char *rtx_name[]; ! 42: #define GET_RTX_NAME(CODE) (rtx_name[(int)(CODE)]) ! 43: ! 44: extern char *rtx_format[]; ! 45: #define GET_RTX_FORMAT(CODE) (rtx_format[(int)(CODE)]) ! 46: ! 47: ! 48: /* Get the definition of `enum machine_mode' */ ! 49: ! 50: #ifndef HAVE_MACHINE_MODES ! 51: ! 52: #define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT) SYM, ! 53: ! 54: enum machine_mode { ! 55: #include "machmode.def" ! 56: MAX_MACHINE_MODE }; ! 57: ! 58: #undef DEF_MACHMODE ! 59: ! 60: #define HAVE_MACHINE_MODES ! 61: ! 62: #endif /* not HAVE_MACHINE_MODES */ ! 63: ! 64: #ifndef NUM_MACHINE_MODES ! 65: #define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE ! 66: #endif ! 67: ! 68: /* Get the name of mode MODE as a string. */ ! 69: ! 70: extern char *mode_name[]; ! 71: #define GET_MODE_NAME(MODE) (mode_name[(int)(MODE)]) ! 72: ! 73: enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, ! 74: MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MODE_FUNCTION }; ! 75: ! 76: /* Get the general kind of object that mode MODE represents ! 77: (integer, floating, complex, etc.) */ ! 78: ! 79: extern enum mode_class mode_class[]; ! 80: #define GET_MODE_CLASS(MODE) (mode_class[(int)(MODE)]) ! 81: ! 82: /* Get the size in bytes of an object of mode MODE. */ ! 83: ! 84: extern int mode_size[]; ! 85: #define GET_MODE_SIZE(MODE) (mode_size[(int)(MODE)]) ! 86: ! 87: /* Get the size in bytes of the basic parts of an object of mode MODE. */ ! 88: ! 89: extern int mode_unit_size[]; ! 90: #define GET_MODE_UNIT_SIZE(MODE) (mode_unit_size[(int)(MODE)]) ! 91: ! 92: /* Get the size in bits of an object of mode MODE. */ ! 93: ! 94: #define GET_MODE_BITSIZE(MODE) (BITS_PER_UNIT * mode_size[(int)(MODE)]) ! 95: ! 96: /* Get a bitmask containing 1 for all bits in a word ! 97: that fit within mode MODE. */ ! 98: ! 99: #define GET_MODE_MASK(MODE) \ ! 100: ((GET_MODE_BITSIZE (MODE) >= HOST_BITS_PER_INT) \ ! 101: ? -1 : ((1 << GET_MODE_BITSIZE (MODE)) - 1)) ! 102: ! 103: /* Common union for an element of an rtx. */ ! 104: ! 105: typedef union rtunion_def ! 106: { ! 107: int rtint; ! 108: char *rtstr; ! 109: struct rtx_def *rtx; ! 110: struct rtvec_def *rtvec; ! 111: enum machine_mode rttype; ! 112: } rtunion; ! 113: ! 114: /* RTL expression ("rtx"). */ ! 115: ! 116: typedef struct rtx_def ! 117: { ! 118: /* The kind of expression this is. */ ! 119: enum rtx_code code : 16; ! 120: /* The kind of value the expression has. */ ! 121: enum machine_mode mode : 8; ! 122: /* 1 in an INSN if it can alter flow of control ! 123: within this function. Not yet used! */ ! 124: unsigned int jump : 1; ! 125: /* 1 in an INSN if it can call another function. Not yet used! */ ! 126: unsigned int call : 1; ! 127: /* 1 in a MEM or REG if value of this expression will never change ! 128: during the current function, even though it is not ! 129: manifestly constant. ! 130: 1 in a SYMBOL_REF if it addresses something in the per-function ! 131: constants pool. */ ! 132: unsigned int unchanging : 1; ! 133: /* 1 in a MEM expression if contents of memory are volatile. */ ! 134: /* 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER ! 135: if it is deleted. */ ! 136: /* 1 in a REG expression if corresponds to a variable declared by the user. ! 137: 0 for an internally generated temporary. */ ! 138: unsigned int volatil : 1; ! 139: /* 1 in a MEM referring to a field of a structure (not a union!). ! 140: 0 if the MEM was a variable or the result of a * operator in C; ! 141: 1 if it was the result of a . or -> operator (on a struct) in C. */ ! 142: unsigned int in_struct : 1; ! 143: /* 1 if this rtx is used. This is used for copying shared structure. ! 144: See `unshare_all_rtl'. ! 145: This bit is used to detect that event. */ ! 146: unsigned int used : 1; ! 147: /* Nonzero if this rtx came from procedure integration. */ ! 148: unsigned integrated : 1; ! 149: /* The first element of the operands of this rtx. ! 150: The number of operands and their types are controlled ! 151: by the `code' field, according to rtl.def. */ ! 152: rtunion fld[1]; ! 153: } *rtx; ! 154: ! 155: #define NULL_RTX (rtx) NULL ! 156: ! 157: #define GET_CODE(RTX) ((RTX)->code) ! 158: #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE)) ! 159: ! 160: #define GET_MODE(RTX) ((RTX)->mode) ! 161: #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE)) ! 162: ! 163: /* RTL vector. These appear inside RTX's when there is a need ! 164: for a variable number of things. The principle use is inside ! 165: PARALLEL expressions. */ ! 166: ! 167: typedef struct rtvec_def{ ! 168: unsigned num_elem; /* number of elements */ ! 169: rtunion elem[1]; ! 170: } *rtvec; ! 171: ! 172: #define NULL_RTVEC (rtvec) NULL ! 173: ! 174: #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem) ! 175: #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (unsigned) NUM) ! 176: ! 177: /* 1 if X is a REG. */ ! 178: ! 179: #define REG_P(X) (GET_CODE (X) == REG) ! 180: ! 181: /* 1 if X is a constant value that is an integer. */ ! 182: ! 183: #define CONSTANT_P(X) \ ! 184: (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ ! 185: || GET_CODE (X) == CONST_INT \ ! 186: || GET_CODE (X) == CONST) ! 187: ! 188: /* General accessor macros for accessing the fields of an rtx. */ ! 189: ! 190: #define XEXP(RTX, N) ((RTX)->fld[N].rtx) ! 191: #define XINT(RTX, N) ((RTX)->fld[N].rtint) ! 192: #define XSTR(RTX, N) ((RTX)->fld[N].rtstr) ! 193: #define XVEC(RTX, N) ((RTX)->fld[N].rtvec) ! 194: #define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem) ! 195: #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx) ! 196: ! 197: /* ACCESS MACROS for particular fields of insns. */ ! 198: ! 199: /* Holds a unique number for each insn. ! 200: These are not necessarily sequentially increasing. */ ! 201: #define INSN_UID(INSN) ((INSN)->fld[0].rtint) ! 202: ! 203: /* Chain insns together in sequence. */ ! 204: #define PREV_INSN(INSN) ((INSN)->fld[1].rtx) ! 205: #define NEXT_INSN(INSN) ((INSN)->fld[2].rtx) ! 206: ! 207: /* The body of an insn. */ ! 208: #define PATTERN(INSN) ((INSN)->fld[3].rtx) ! 209: ! 210: /* Code number of instruction, from when it was recognized. ! 211: -1 means this instruction has not been recognized yet. */ ! 212: #define INSN_CODE(INSN) ((INSN)->fld[4].rtint) ! 213: ! 214: /* Set up in flow.c; empty before then. ! 215: Holds a chain of INSN_LIST rtx's whose first operands point at ! 216: previous insns with direct data-flow connections to this one. ! 217: That means that those insns set variables whose next use is in this insn. ! 218: They are always in the same basic block as this insn. */ ! 219: #define LOG_LINKS(INSN) ((INSN)->fld[5].rtx) ! 220: ! 221: /* Holds a list of notes on what this insn does to various REGs. ! 222: It is a chain of EXPR_LIST rtx's, where the second operand ! 223: is the chain pointer and the first operand is the REG being described. ! 224: The mode field of the EXPR_LIST contains not a real machine mode ! 225: but a value that says what this note says about the REG: ! 226: REG_DEAD means that the REG dies in this insn. ! 227: REG_INC means that the REG is autoincremented or autodecremented. ! 228: Note that one insn can have both REG_DEAD and REG_INC for the same register ! 229: if the register is preincremented or predecremented in the insn ! 230: and not needed afterward. This can probably happen. ! 231: REG_EQUIV describes the insn as a whole; it says that the ! 232: insn sets a register to a constant value or to be equivalent to ! 233: a memory address. If the ! 234: register is spilled to the stack then the constant value ! 235: should be substituted for it. The contents of the REG_EQUIV ! 236: is the constant value or memory address, which may be different ! 237: from the source of the SET although it has the same value. ! 238: REG_EQUAL is like REG_EQUIV except that the destination ! 239: is only momentarily equal to the specified rtx. Therefore, it ! 240: cannot be used for substitution; but it can be used for cse. ! 241: REG_RETVAL means that this insn copies the return-value of ! 242: a library call out of the hard reg for return values. This note ! 243: is actually an INSN_LIST and it points to the first insn involved ! 244: in setting up arguments for the call. flow.c uses this to delete ! 245: the entire library call when its result is dead. ! 246: REG_WAS_0 says that the register set in this insn held 0 before the insn. ! 247: The contents of the note is the insn that stored the 0. ! 248: If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative. ! 249: The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST. */ ! 250: ! 251: #define REG_NOTES(INSN) ((INSN)->fld[6].rtx) ! 252: ! 253: enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4, ! 254: REG_EQUAL = 5, REG_RETVAL = 6 }; ! 255: ! 256: /* Extract the reg-note kind from an EXPR_LIST. */ ! 257: #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK)) ! 258: ! 259: /* The label-number of a code-label. The assembler label ! 260: is made from `L' and the label-number printed in decimal. ! 261: Label numbers are unique in a compilation. */ ! 262: #define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint) ! 263: ! 264: #define LINE_NUMBER NOTE ! 265: ! 266: /* In a NOTE that is a line number, this is a string for the file name ! 267: that the line is in. */ ! 268: ! 269: #define NOTE_SOURCE_FILE(INSN) ((INSN)->fld[3].rtstr) ! 270: ! 271: /* In a NOTE that is a line number, this is the line number. ! 272: Other kinds of NOTEs are identified by negative numbers here. */ ! 273: #define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint) ! 274: ! 275: /* Codes that appear in the NOTE_LINE_NUMBER field ! 276: for kinds of notes that are not line numbers. */ ! 277: ! 278: #define NOTE_INSN_FUNCTION_BEG 0 ! 279: #define NOTE_INSN_DELETED -1 ! 280: #define NOTE_INSN_BLOCK_BEG -2 ! 281: #define NOTE_INSN_BLOCK_END -3 ! 282: #define NOTE_INSN_LOOP_BEG -4 ! 283: #define NOTE_INSN_LOOP_END -5 ! 284: /* This kind of note is generated at the end of the function body, ! 285: just before the return insn or return label. ! 286: In an optimizing compilation it is deleted by the first jump optimization, ! 287: after enabling that optimizer to determine whether control can fall ! 288: off the end of the function body without a return statement. */ ! 289: #define NOTE_INSN_FUNCTION_END -6 ! 290: /* This kind of note is generated just after each call to `setjmp', et al. */ ! 291: #define NOTE_INSN_SETJMP -7 ! 292: ! 293: #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr) ! 294: #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint) ! 295: #define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx) ! 296: #define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint) ! 297: #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint) ! 298: ! 299: /* In jump.c, each label contains a count of the number ! 300: of LABEL_REFs that point at it, so unused labels can be deleted. */ ! 301: #define LABEL_NUSES(LABEL) ((LABEL)->fld[4].rtint) ! 302: ! 303: /* In jump.c, each JUMP_INSN can point to a label that it can jump to, ! 304: so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can ! 305: be decremented and possibly the label can be deleted. */ ! 306: #define JUMP_LABEL(INSN) ((INSN)->fld[7].rtx) ! 307: ! 308: /* Once basic blocks are found in flow.c, ! 309: each CODE_LABEL starts a chain that goes through ! 310: all the LABEL_REFs that jump to that label. ! 311: The chain eventually winds up at the CODE_LABEL; it is circular. */ ! 312: #define LABEL_REFS(LABEL) ((LABEL)->fld[4].rtx) ! 313: ! 314: /* This is the field in the LABEL_REF through which the circular chain ! 315: of references to a particular label is linked. ! 316: This chain is set up in flow.c. */ ! 317: ! 318: #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx) ! 319: ! 320: /* Once basic blocks are found in flow.c, ! 321: Each LABEL_REF points to its containing instruction with this field. */ ! 322: ! 323: #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx) ! 324: ! 325: /* For a REG rtx, REGNO extracts the register number. */ ! 326: ! 327: #define REGNO(RTX) ((RTX)->fld[0].rtint) ! 328: ! 329: /* For a CONST_INT rtx, INTVAL extracts the integer. */ ! 330: ! 331: #define INTVAL(RTX) ((RTX)->fld[0].rtint) ! 332: ! 333: /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of. ! 334: SUBREG_WORD extracts the word-number. */ ! 335: ! 336: #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx) ! 337: #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint) ! 338: ! 339: /* For a SET rtx, SET_DEST is the place that is set ! 340: and SET_SRC is the value it is set to. */ ! 341: #define SET_DEST(RTX) ((RTX)->fld[0].rtx) ! 342: #define SET_SRC(RTX) ((RTX)->fld[1].rtx) ! 343: ! 344: /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn ! 345: of the function that is not involved in copying parameters to ! 346: pseudo-registers. FIRST_PARM_INSN is the very first insn of ! 347: the function, including the parameter copying. ! 348: We keep this around in case we must splice ! 349: this function into the assembly code at the end of the file. ! 350: FIRST_LABELNO is the first label number used by the function (inclusive). ! 351: LAST_LABELNO is the last label used by the function (exclusive). ! 352: MAX_REGNUM is the largest pseudo-register used by that function. ! 353: ! 354: We want this to lay down like an INSN. The PREV_INSN field ! 355: is always NULL. The NEXT_INSN field always points to the ! 356: first function insn of the function being squirreled away. */ ! 357: ! 358: #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx) ! 359: #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx) ! 360: #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint) ! 361: #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint) ! 362: #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint) ! 363: #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint) ! 364: #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint) ! 365: ! 366: /* Generally useful functions. */ ! 367: ! 368: extern rtx rtx_alloc (); ! 369: extern rtvec rtvec_alloc (); ! 370: extern rtx find_reg_note (); ! 371: extern rtx gen_rtx (); ! 372: extern rtx copy_rtx (); ! 373: extern rtvec gen_rtvec (); ! 374: extern rtvec gen_rtvec_v (); ! 375: extern rtx gen_reg_rtx (); ! 376: extern rtx gen_label_rtx (); ! 377: extern rtx gen_inline_header_rtx (); ! 378: extern rtx gen_lowpart (); ! 379: extern rtx gen_highpart (); ! 380: extern int subreg_lowpart_p (); ! 381: extern rtx make_safe_from (); ! 382: extern rtx memory_address (); ! 383: extern rtx get_insns (); ! 384: extern rtx get_last_insn (); ! 385: extern rtx gen_sequence (); ! 386: extern rtx expand_expr (); ! 387: extern rtx output_constant_def (); ! 388: extern rtx immed_real_const (); ! 389: extern rtx force_const_double_mem (); ! 390: extern rtx force_const_mem (); ! 391: extern rtx get_parm_real_loc (); ! 392: extern rtx assign_stack_local (); ! 393: extern rtx protect_from_queue (); ! 394: extern void emit_queue (); ! 395: extern rtx emit_move_insn (); ! 396: extern rtx emit_insn (); ! 397: extern rtx emit_jump_insn (); ! 398: extern rtx emit_call_insn (); ! 399: extern rtx emit_insn_before (); ! 400: extern rtx emit_insn_after (); ! 401: extern void emit_label (); ! 402: extern void emit_barrier (); ! 403: extern rtx emit_note (); ! 404: extern rtx prev_real_insn (); ! 405: extern rtx next_real_insn (); ! 406: extern rtx next_nondeleted_insn (); ! 407: extern rtx plus_constant (); ! 408: extern rtx find_equiv_reg (); ! 409: extern rtx delete_insn (); ! 410: extern rtx adj_offsetable_operand (); ! 411: ! 412: extern int emit_to_sequence; ! 413: ! 414: extern int asm_noperands (); ! 415: extern char *decode_asm_operands (); ! 416: ! 417: #ifdef BITS_PER_WORD ! 418: /* Conditional is to detect when config.h has been included. */ ! 419: extern enum reg_class reg_preferred_class (); ! 420: #endif ! 421: ! 422: extern rtx get_first_nonparm_insn (); ! 423: ! 424: /* Standard pieces of rtx, to be substituted directly into things. */ ! 425: extern rtx pc_rtx; ! 426: extern rtx cc0_rtx; ! 427: extern rtx const0_rtx; ! 428: extern rtx const1_rtx; ! 429: extern rtx fconst0_rtx; ! 430: extern rtx dconst0_rtx; ! 431: ! 432: /* All references to certain hard regs, except those created ! 433: by allocating pseudo regs into them (when that's possible), ! 434: go through these unique rtx objects. */ ! 435: extern rtx stack_pointer_rtx; ! 436: extern rtx frame_pointer_rtx; ! 437: extern rtx arg_pointer_rtx; ! 438: extern rtx struct_value_rtx; ! 439: extern rtx struct_value_incoming_rtx; ! 440: extern rtx static_chain_rtx; ! 441: extern rtx static_chain_incoming_rtx;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.