|
|
1.1 ! root 1: /* Definitions of target machine for GNU compiler. NS32000 version. ! 2: Copyright (C) 1988 Free Software Foundation, Inc. ! 3: Contributed by Michael Tiemann ([email protected]) ! 4: ! 5: This file is part of GNU CC. ! 6: ! 7: GNU CC is free software; you can redistribute it and/or modify ! 8: it under the terms of the GNU General Public License as published by ! 9: the Free Software Foundation; either version 2, or (at your option) ! 10: any later version. ! 11: ! 12: GNU CC is distributed in the hope that it will be useful, ! 13: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 15: GNU General Public License for more details. ! 16: ! 17: You should have received a copy of the GNU General Public License ! 18: along with GNU CC; see the file COPYING. If not, write to ! 19: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! 20: ! 21: ! 22: /* Note that some other tm.h files include this one and then override ! 23: many of the definitions that relate to assembler syntax. */ ! 24: ! 25: extern enum reg_class secondary_reload_class(); ! 26: ! 27: /* Names to predefine in the preprocessor for this target machine. */ ! 28: ! 29: #define CPP_PREDEFINES "-Dns32000 -Dunix -Asystem(unix) -Acpu(ns32k) -Amachine(ns32k)" ! 30: ! 31: /* Print subsidiary information on the compiler version in use. */ ! 32: #define TARGET_VERSION fprintf (stderr, " (32000, GAS syntax)"); ! 33: ! 34: ! 35: /* ABSOLUTE PREFIX, IMMEDIATE_PREFIX and EXTERNAL_PREFIX can be defined ! 36: to cover most NS32k addressing syntax variations. This way we don't ! 37: need to redefine long macros in all the tm.h files for just slight ! 38: variations in assembler syntax. */ ! 39: ! 40: #ifndef ABSOLUTE_PREFIX ! 41: #define ABSOLUTE_PREFIX '@' ! 42: #endif ! 43: ! 44: #if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX ! 45: #define PUT_IMMEDIATE_PREFIX(FILE) putc(IMMEDIATE_PREFIX, FILE) ! 46: #else ! 47: #define PUT_IMMEDIATE_PREFIX(FILE) ! 48: #endif ! 49: #if defined(ABSOLUTE_PREFIX) && ABSOLUTE_PREFIX ! 50: #define PUT_ABSOLUTE_PREFIX(FILE) putc(ABSOLUTE_PREFIX, FILE) ! 51: #else ! 52: #define PUT_ABSOLUTE_PREFIX(FILE) ! 53: #endif ! 54: #if defined(EXTERNAL_PREFIX) && EXTERNAL_PREFIX ! 55: #define PUT_EXTERNAL_PREFIX(FILE) putc(EXTERNAL_PREFIX, FILE) ! 56: #else ! 57: #define PUT_EXTERNAL_PREFIX(FILE) ! 58: #endif ! 59: ! 60: /* Run-time compilation parameters selecting different hardware subsets. */ ! 61: ! 62: extern int target_flags; ! 63: ! 64: /* Macros used in the machine description to test the flags. */ ! 65: ! 66: /* Compile 32081 insns for floating point (not library calls). */ ! 67: #define TARGET_32081 (target_flags & 1) ! 68: ! 69: /* Compile using rtd insn calling sequence. ! 70: This will not work unless you use prototypes at least ! 71: for all functions that can take varying numbers of args. */ ! 72: #define TARGET_RTD (target_flags & 2) ! 73: ! 74: /* Compile passing first two args in regs 0 and 1. */ ! 75: #define TARGET_REGPARM (target_flags & 4) ! 76: ! 77: /* Options to select type of CPU, for better optimization. ! 78: The output is correct for any kind of 32000 regardless of these options. */ ! 79: #define TARGET_32532 (target_flags & 8) ! 80: #define TARGET_32332 (target_flags & 16) ! 81: ! 82: /* Ok to use the static base register (and presume it's 0) */ ! 83: #define TARGET_SB ((target_flags & 32) == 0) ! 84: ! 85: /* Macro to define tables used to set the flags. ! 86: This is a list in braces of pairs in braces, ! 87: each pair being { "NAME", VALUE } ! 88: where VALUE is the bits to set or minus the bits to clear. ! 89: An empty string NAME is used to identify the default VALUE. */ ! 90: ! 91: #define TARGET_SWITCHES \ ! 92: { { "32081", 1}, \ ! 93: { "soft-float", -1}, \ ! 94: { "rtd", 2}, \ ! 95: { "nortd", -2}, \ ! 96: { "regparm", 4}, \ ! 97: { "noregparm", -4}, \ ! 98: { "32532", 24}, \ ! 99: { "32332", -8}, \ ! 100: { "32332", 16}, \ ! 101: { "32032", -24}, \ ! 102: { "sb", -32}, \ ! 103: { "nosb", 32}, \ ! 104: { "", TARGET_DEFAULT}} ! 105: /* TARGET_DEFAULT is defined in encore.h, pc532.h, etc. */ ! 106: ! 107: /* target machine storage layout */ ! 108: ! 109: /* Define this if most significant bit is lowest numbered ! 110: in instructions that operate on numbered bit-fields. ! 111: This is not true on the ns32k. */ ! 112: #define BITS_BIG_ENDIAN 0 ! 113: ! 114: /* Define this if most significant byte of a word is the lowest numbered. */ ! 115: /* That is not true on the ns32k. */ ! 116: #define BYTES_BIG_ENDIAN 0 ! 117: ! 118: /* Define this if most significant word of a multiword number is lowest ! 119: numbered. This is not true on the ns32k. */ ! 120: #define WORDS_BIG_ENDIAN 0 ! 121: ! 122: /* Number of bits in an addressable storage unit */ ! 123: #define BITS_PER_UNIT 8 ! 124: ! 125: /* Width in bits of a "word", which is the contents of a machine register. ! 126: Note that this is not necessarily the width of data type `int'; ! 127: if using 16-bit ints on a 32000, this would still be 32. ! 128: But on a machine with 16-bit registers, this would be 16. */ ! 129: #define BITS_PER_WORD 32 ! 130: ! 131: /* Width of a word, in units (bytes). */ ! 132: #define UNITS_PER_WORD 4 ! 133: ! 134: /* Width in bits of a pointer. ! 135: See also the macro `Pmode' defined below. */ ! 136: #define POINTER_SIZE 32 ! 137: ! 138: /* Allocation boundary (in *bits*) for storing arguments in argument list. */ ! 139: #define PARM_BOUNDARY 32 ! 140: ! 141: /* Boundary (in *bits*) on which stack pointer should be aligned. */ ! 142: #define STACK_BOUNDARY 32 ! 143: ! 144: /* Allocation boundary (in *bits*) for the code of a function. */ ! 145: #define FUNCTION_BOUNDARY 16 ! 146: ! 147: /* Alignment of field after `int : 0' in a structure. */ ! 148: #define EMPTY_FIELD_BOUNDARY 32 ! 149: ! 150: /* Every structure's size must be a multiple of this. */ ! 151: #define STRUCTURE_SIZE_BOUNDARY 8 ! 152: ! 153: /* No data type wants to be aligned rounder than this. */ ! 154: #define BIGGEST_ALIGNMENT 32 ! 155: ! 156: /* Set this nonzero if move instructions will actually fail to work ! 157: when given unaligned data. National claims that the NS32032 ! 158: works without strict alignment, but rumor has it that operands ! 159: crossing a page boundary cause unpredictable results. */ ! 160: #define STRICT_ALIGNMENT 1 ! 161: ! 162: /* If bit field type is int, dont let it cross an int, ! 163: and give entire struct the alignment of an int. */ ! 164: /* Required on the 386 since it doesn't have a full set of bitfield insns. ! 165: (There is no signed extv insn.) */ ! 166: #define PCC_BITFIELD_TYPE_MATTERS 1 ! 167: ! 168: /* Standard register usage. */ ! 169: ! 170: /* Number of actual hardware registers. ! 171: The hardware registers are assigned numbers for the compiler ! 172: from 0 to just below FIRST_PSEUDO_REGISTER. ! 173: All registers that the compiler knows about must be given numbers, ! 174: even those that are not normally considered general registers. */ ! 175: #define FIRST_PSEUDO_REGISTER 18 ! 176: ! 177: /* 1 for registers that have pervasive standard uses ! 178: and are not available for the register allocator. ! 179: On the ns32k, these are the FP, SP, (SB and PC are not included here). */ ! 180: #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, \ ! 181: 0, 0, 0, 0, 0, 0, 0, 0, \ ! 182: 1, 1} ! 183: ! 184: /* 1 for registers not available across function calls. ! 185: These must include the FIXED_REGISTERS and also any ! 186: registers that can be used without being saved. ! 187: The latter must include the registers where values are returned ! 188: and the register where structure-value addresses are passed. ! 189: Aside from that, you can include as many other registers as you like. */ ! 190: #define CALL_USED_REGISTERS {1, 1, 1, 0, 0, 0, 0, 0, \ ! 191: 1, 1, 1, 1, 0, 0, 0, 0, \ ! 192: 1, 1} ! 193: ! 194: /* Return number of consecutive hard regs needed starting at reg REGNO ! 195: to hold something of mode MODE. ! 196: This is ordinarily the length in words of a value of mode MODE ! 197: but can be less for certain modes in special long registers. ! 198: On the ns32k, all registers are 32 bits long. */ ! 199: #define HARD_REGNO_NREGS(REGNO, MODE) \ ! 200: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 201: ! 202: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ ! 203: #define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok (REGNO, MODE) ! 204: ! 205: /* Value is 1 if it is a good idea to tie two pseudo registers ! 206: when one has mode MODE1 and one has mode MODE2. ! 207: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, ! 208: for any hard reg, then this must be 0 for correct output. */ ! 209: #define MODES_TIEABLE_P(MODE1, MODE2) \ ! 210: (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode) == \ ! 211: ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode)) ! 212: ! 213: /* Specify the registers used for certain standard purposes. ! 214: The values of these macros are register numbers. */ ! 215: ! 216: /* NS32000 pc is not overloaded on a register. */ ! 217: /* #define PC_REGNUM */ ! 218: ! 219: /* Register to use for pushing function arguments. */ ! 220: #define STACK_POINTER_REGNUM 17 ! 221: ! 222: /* Base register for access to local variables of the function. */ ! 223: #define FRAME_POINTER_REGNUM 16 ! 224: ! 225: /* Value should be nonzero if functions must have frame pointers. ! 226: Zero means the frame pointer need not be set up (and parms ! 227: may be accessed via the stack pointer) in functions that seem suitable. ! 228: This is computed in `reload', in reload1.c. */ ! 229: #define FRAME_POINTER_REQUIRED 0 ! 230: ! 231: /* Base register for access to arguments of the function. */ ! 232: #define ARG_POINTER_REGNUM 16 ! 233: ! 234: /* Register in which static-chain is passed to a function. */ ! 235: #define STATIC_CHAIN_REGNUM 1 ! 236: ! 237: /* Register in which address to store a structure value ! 238: is passed to a function. */ ! 239: #define STRUCT_VALUE_REGNUM 2 ! 240: ! 241: /* Define the classes of registers for register constraints in the ! 242: machine description. Also define ranges of constants. ! 243: ! 244: One of the classes must always be named ALL_REGS and include all hard regs. ! 245: If there is more than one class, another class must be named NO_REGS ! 246: and contain no registers. ! 247: ! 248: The name GENERAL_REGS must be the name of a class (or an alias for ! 249: another name such as ALL_REGS). This is the class of registers ! 250: that is allowed by "g" or "r" in a register constraint. ! 251: Also, registers outside this class are allocated only when ! 252: instructions express preferences for them. ! 253: ! 254: The classes must be numbered in nondecreasing order; that is, ! 255: a larger-numbered class must never be contained completely ! 256: in a smaller-numbered class. ! 257: ! 258: For any two classes, it is very desirable that there be another ! 259: class that represents their union. */ ! 260: ! 261: enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, GEN_AND_FP_REGS, ! 262: FRAME_POINTER_REG, STACK_POINTER_REG, ! 263: GEN_AND_MEM_REGS, ALL_REGS, LIM_REG_CLASSES }; ! 264: ! 265: #define N_REG_CLASSES (int) LIM_REG_CLASSES ! 266: ! 267: /* Give names of register classes as strings for dump file. */ ! 268: ! 269: #define REG_CLASS_NAMES \ ! 270: {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "GEN_AND_FP_REGS", \ ! 271: "FRAME_POINTER_REG", "STACK_POINTER_REG", "GEN_AND_MEM_REGS", "ALL_REGS" } ! 272: ! 273: /* Define which registers fit in which classes. ! 274: This is an initializer for a vector of HARD_REG_SET ! 275: of length N_REG_CLASSES. */ ! 276: ! 277: #define REG_CLASS_CONTENTS {0, 0x00ff, 0xff00, 0xffff, \ ! 278: 0x10000, 0x20000, 0x300ff, 0x3ffff } ! 279: ! 280: /* The same information, inverted: ! 281: Return the class number of the smallest class containing ! 282: reg number REGNO. This could be a conditional expression ! 283: or could index an array. */ ! 284: ! 285: #define REGNO_REG_CLASS(REGNO) \ ! 286: ((REGNO) < 8 ? GENERAL_REGS \ ! 287: : (REGNO) < 16 ? FLOAT_REGS \ ! 288: : (REGNO) == 16 ? FRAME_POINTER_REG \ ! 289: : (REGNO) == 17 ? STACK_POINTER_REG \ ! 290: : NO_REGS) ! 291: ! 292: /* The class value for index registers, and the one for base regs. */ ! 293: ! 294: #define INDEX_REG_CLASS GENERAL_REGS ! 295: #define BASE_REG_CLASS GEN_AND_MEM_REGS ! 296: ! 297: /* Get reg_class from a letter such as appears in the machine description. */ ! 298: ! 299: #define REG_CLASS_FROM_LETTER(C) \ ! 300: ((C) == 'f' ? FLOAT_REGS \ ! 301: : (C) == 'x' ? FRAME_POINTER_REG \ ! 302: : (C) == 'y' ? STACK_POINTER_REG \ ! 303: : NO_REGS) ! 304: ! 305: /* The letters I, J, K, L and M in a register constraint string ! 306: can be used to stand for particular ranges of immediate operands. ! 307: This macro defines what the ranges are. ! 308: C is the letter, and VALUE is a constant value. ! 309: Return 1 if VALUE is in the range specified by C. ! 310: ! 311: On the ns32k, these letters are used as follows: ! 312: ! 313: I : Matches integers which are valid shift amounts for scaled indexing. ! 314: These are 0, 1, 2, 3 for byte, word, double, and quadword. ! 315: Used for matching arithmetic shifts only on 32032 & 32332. ! 316: J : Matches integers which fit a "quick" operand. ! 317: K : Matches integers 0 to 7 (for inss and exts instructions). ! 318: */ ! 319: ! 320: #define CONST_OK_FOR_LETTER_P(VALUE, C) \ ! 321: ((VALUE) < 8 && (VALUE) + 8 >= 0 ? \ ! 322: ((C) == 'I' ? (!TARGET_32532 && 0 <= (VALUE) && (VALUE) <= 3) : \ ! 323: (C) == 'J' ? (VALUE) <= 7 : \ ! 324: (C) == 'K' ? 0 <= (VALUE) : 0) : 0) ! 325: ! 326: /* Similar, but for floating constants, and defining letters G and H. ! 327: Here VALUE is the CONST_DOUBLE rtx itself. */ ! 328: ! 329: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1 ! 330: ! 331: /* Given an rtx X being reloaded into a reg required to be ! 332: in class CLASS, return the class of reg to actually use. ! 333: In general this is just CLASS; but on some machines ! 334: in some cases it is preferable to use a more restrictive class. */ ! 335: ! 336: /* We return GENERAL_REGS instead of GEN_AND_MEM_REGS. ! 337: The latter offers no real additional possibilities ! 338: and can cause spurious secondary reloading. */ ! 339: #define PREFERRED_RELOAD_CLASS(X,CLASS) \ ! 340: ((CLASS) == GEN_AND_MEM_REGS ? GENERAL_REGS : (CLASS)) ! 341: ! 342: /* Return the maximum number of consecutive registers ! 343: needed to represent mode MODE in a register of class CLASS. */ ! 344: /* On the 32000, this is the size of MODE in words */ ! 345: #define CLASS_MAX_NREGS(CLASS, MODE) \ ! 346: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 347: ! 348: /* Stack layout; function entry, exit and calling. */ ! 349: ! 350: /* Define this if pushing a word on the stack ! 351: makes the stack pointer a smaller address. */ ! 352: #define STACK_GROWS_DOWNWARD ! 353: ! 354: /* Define this if the nominal address of the stack frame ! 355: is at the high-address end of the local variables; ! 356: that is, each additional local variable allocated ! 357: goes at a more negative offset in the frame. */ ! 358: #define FRAME_GROWS_DOWNWARD ! 359: ! 360: /* Offset within stack frame to start allocating local variables at. ! 361: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the ! 362: first local allocated. Otherwise, it is the offset to the BEGINNING ! 363: of the first local allocated. */ ! 364: #define STARTING_FRAME_OFFSET 0 ! 365: ! 366: /* If we generate an insn to push BYTES bytes, ! 367: this says how many the stack pointer really advances by. ! 368: On the 32000, sp@- in a byte insn really pushes a BYTE. */ ! 369: #define PUSH_ROUNDING(BYTES) (BYTES) ! 370: ! 371: /* Offset of first parameter from the argument pointer register value. */ ! 372: #define FIRST_PARM_OFFSET(FNDECL) 8 ! 373: ! 374: /* Value is the number of byte of arguments automatically ! 375: popped when returning from a subroutine call. ! 376: FUNTYPE is the data type of the function (as a tree), ! 377: or for a library call it is an identifier node for the subroutine name. ! 378: SIZE is the number of bytes of arguments passed on the stack. ! 379: ! 380: On the 32000, the RET insn may be used to pop them if the number ! 381: of args is fixed, but if the number is variable then the caller ! 382: must pop them all. RET can't be used for library calls now ! 383: because the library is compiled with the Unix compiler. ! 384: Use of RET is a selectable option, since it is incompatible with ! 385: standard Unix calling sequences. If the option is not selected, ! 386: the caller must always pop the args. */ ! 387: ! 388: #define RETURN_POPS_ARGS(FUNTYPE,SIZE) \ ! 389: ((TARGET_RTD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \ ! 390: && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ ! 391: || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ ! 392: == void_type_node))) \ ! 393: ? (SIZE) : 0) ! 394: ! 395: /* Define how to find the value returned by a function. ! 396: VALTYPE is the data type of the value (as a tree). ! 397: If the precise function being called is known, FUNC is its FUNCTION_DECL; ! 398: otherwise, FUNC is 0. */ ! 399: ! 400: /* On the 32000 the return value is in R0, ! 401: or perhaps in F0 is there is fp support. */ ! 402: ! 403: #define FUNCTION_VALUE(VALTYPE, FUNC) \ ! 404: (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_32081 \ ! 405: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \ ! 406: : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)) ! 407: ! 408: /* Define how to find the value returned by a library function ! 409: assuming the value has mode MODE. */ ! 410: ! 411: /* On the 32000 the return value is in R0, ! 412: or perhaps F0 is there is fp support. */ ! 413: ! 414: #define LIBCALL_VALUE(MODE) \ ! 415: (((MODE) == DFmode || (MODE) == SFmode) && TARGET_32081 \ ! 416: ? gen_rtx (REG, MODE, 8) \ ! 417: : gen_rtx (REG, MODE, 0)) ! 418: ! 419: /* Define this if PCC uses the nonreentrant convention for returning ! 420: structure and union values. */ ! 421: ! 422: #define PCC_STATIC_STRUCT_RETURN ! 423: ! 424: /* 1 if N is a possible register number for a function value. ! 425: On the 32000, R0 and F0 are the only registers thus used. */ ! 426: ! 427: #define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0) ! 428: ! 429: /* 1 if N is a possible register number for function argument passing. ! 430: On the 32000, no registers are used in this way. */ ! 431: ! 432: #define FUNCTION_ARG_REGNO_P(N) 0 ! 433: ! 434: /* Define a data type for recording info about an argument list ! 435: during the scan of that argument list. This data type should ! 436: hold all necessary information about the function itself ! 437: and about the args processed so far, enough to enable macros ! 438: such as FUNCTION_ARG to determine where the next arg should go. ! 439: ! 440: On the ns32k, this is a single integer, which is a number of bytes ! 441: of arguments scanned so far. */ ! 442: ! 443: #define CUMULATIVE_ARGS int ! 444: ! 445: /* Initialize a variable CUM of type CUMULATIVE_ARGS ! 446: for a call to a function whose data type is FNTYPE. ! 447: For a library call, FNTYPE is 0. ! 448: ! 449: On the ns32k, the offset starts at 0. */ ! 450: ! 451: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \ ! 452: ((CUM) = 0) ! 453: ! 454: /* Update the data in CUM to advance over an argument ! 455: of mode MODE and data type TYPE. ! 456: (TYPE is null for libcalls where that information may not be available.) */ ! 457: ! 458: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ! 459: ((CUM) += ((MODE) != BLKmode \ ! 460: ? (GET_MODE_SIZE (MODE) + 3) & ~3 \ ! 461: : (int_size_in_bytes (TYPE) + 3) & ~3)) ! 462: ! 463: /* Define where to put the arguments to a function. ! 464: Value is zero to push the argument on the stack, ! 465: or a hard register in which to store the argument. ! 466: ! 467: MODE is the argument's machine mode. ! 468: TYPE is the data type of the argument (as a tree). ! 469: This is null for libcalls where that information may ! 470: not be available. ! 471: CUM is a variable of type CUMULATIVE_ARGS which gives info about ! 472: the preceding args and about the function being called. ! 473: NAMED is nonzero if this argument is a named parameter ! 474: (otherwise it is an extra parameter matching an ellipsis). */ ! 475: ! 476: /* On the 32000 all args are pushed, except if -mregparm is specified ! 477: then the first two words of arguments are passed in r0, r1. ! 478: *NOTE* -mregparm does not work. ! 479: It exists only to test register calling conventions. */ ! 480: ! 481: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ! 482: ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0) ! 483: ! 484: /* For an arg passed partly in registers and partly in memory, ! 485: this is the number of registers used. ! 486: For args passed entirely in registers or entirely in memory, zero. */ ! 487: ! 488: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ ! 489: ((TARGET_REGPARM && (CUM) < 8 \ ! 490: && 8 < ((CUM) + ((MODE) == BLKmode \ ! 491: ? int_size_in_bytes (TYPE) \ ! 492: : GET_MODE_SIZE (MODE)))) \ ! 493: ? 2 - (CUM) / 4 : 0) ! 494: ! 495: #ifndef MAIN_FUNCTION_PROLOGUE ! 496: #define MAIN_FUNCTION_PROLOGUE ! 497: #endif ! 498: ! 499: /* ! 500: * The function prologue for the ns32k is fairly simple. ! 501: * If a frame pointer is needed (decided in reload.c ?) then ! 502: * we need assembler of the form ! 503: * ! 504: * # Save the oldframe pointer, set the new frame pointer, make space ! 505: * # on the stack and save any general purpose registers necessary ! 506: * ! 507: * enter [<general purpose regs to save>], <local stack space> ! 508: * ! 509: * movf fn, tos # Save any floating point registers necessary ! 510: * . ! 511: * . ! 512: * ! 513: * If a frame pointer is not needed we need assembler of the form ! 514: * ! 515: * # Make space on the stack ! 516: * ! 517: * adjspd <local stack space + 4> ! 518: * ! 519: * # Save any general purpose registers necessary ! 520: * ! 521: * save [<general purpose regs to save>] ! 522: * ! 523: * movf fn, tos # Save any floating point registers necessary ! 524: * . ! 525: * . ! 526: */ ! 527: ! 528: #define FUNCTION_PROLOGUE(FILE, SIZE) \ ! 529: { register int regno, g_regs_used = 0; \ ! 530: int used_regs_buf[8], *bufp = used_regs_buf; \ ! 531: int used_fregs_buf[8], *fbufp = used_fregs_buf; \ ! 532: extern char call_used_regs[]; \ ! 533: MAIN_FUNCTION_PROLOGUE; \ ! 534: for (regno = 0; regno < 8; regno++) \ ! 535: if (regs_ever_live[regno] \ ! 536: && ! call_used_regs[regno]) \ ! 537: { \ ! 538: *bufp++ = regno; g_regs_used++; \ ! 539: } \ ! 540: *bufp = -1; \ ! 541: for (; regno < 16; regno++) \ ! 542: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 543: { \ ! 544: *fbufp++ = regno; \ ! 545: } \ ! 546: *fbufp = -1; \ ! 547: bufp = used_regs_buf; \ ! 548: if (frame_pointer_needed) \ ! 549: fprintf (FILE, "\tenter ["); \ ! 550: else \ ! 551: { \ ! 552: if (SIZE) \ ! 553: fprintf (FILE, "\tadjspd %$%d\n", SIZE + 4); \ ! 554: if (g_regs_used && g_regs_used > 4) \ ! 555: fprintf (FILE, "\tsave ["); \ ! 556: else \ ! 557: { \ ! 558: while (*bufp >= 0) \ ! 559: fprintf (FILE, "\tmovd r%d,tos\n", *bufp++); \ ! 560: g_regs_used = 0; \ ! 561: } \ ! 562: } \ ! 563: while (*bufp >= 0) \ ! 564: { \ ! 565: fprintf (FILE, "r%d", *bufp++); \ ! 566: if (*bufp >= 0) \ ! 567: fputc (',', FILE); \ ! 568: } \ ! 569: if (frame_pointer_needed) \ ! 570: fprintf (FILE, "],%d\n", SIZE); \ ! 571: else if (g_regs_used) \ ! 572: fprintf (FILE, "]\n"); \ ! 573: fbufp = used_fregs_buf; \ ! 574: while (*fbufp >= 0) \ ! 575: { \ ! 576: if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \ ! 577: fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \ ! 578: else \ ! 579: { \ ! 580: fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \ ! 581: fbufp += 2; \ ! 582: } \ ! 583: } \ ! 584: } ! 585: ! 586: /* Output assembler code to FILE to increment profiler label # LABELNO ! 587: for profiling a function entry. ! 588: ! 589: THIS DEFINITION FOR THE 32000 IS A GUESS. IT HAS NOT BEEN TESTED. */ ! 590: ! 591: #define FUNCTION_PROFILER(FILE, LABELNO) \ ! 592: fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO)) ! 593: ! 594: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, ! 595: the stack pointer does not matter. The value is tested only in ! 596: functions that have frame pointers. ! 597: No definition is equivalent to always zero. ! 598: ! 599: We use 0, because using 1 requires hair in FUNCTION_EPILOGUE ! 600: that is worse than the stack adjust we could save. */ ! 601: ! 602: /* #define EXIT_IGNORE_STACK 1 */ ! 603: ! 604: /* This macro generates the assembly code for function exit, ! 605: on machines that need it. If FUNCTION_EPILOGUE is not defined ! 606: then individual return instructions are generated for each ! 607: return statement. Args are same as for FUNCTION_PROLOGUE. ! 608: ! 609: The function epilogue should not depend on the current stack pointer, ! 610: if EXIT_IGNORE_STACK is nonzero. That doesn't apply here. ! 611: ! 612: If a frame pointer is needed (decided in reload.c ?) then ! 613: we need assembler of the form ! 614: ! 615: movf tos, fn # Restore any saved floating point registers ! 616: . ! 617: . ! 618: ! 619: # Restore any saved general purpose registers, restore the stack ! 620: # pointer from the frame pointer, restore the old frame pointer. ! 621: exit [<general purpose regs to save>] ! 622: ! 623: If a frame pointer is not needed we need assembler of the form ! 624: # Restore any general purpose registers saved ! 625: ! 626: movf tos, fn # Restore any saved floating point registers ! 627: . ! 628: . ! 629: . ! 630: restore [<general purpose regs to save>] ! 631: ! 632: # reclaim space allocated on stack ! 633: ! 634: adjspd <-(local stack space + 4)> */ ! 635: ! 636: ! 637: #define FUNCTION_EPILOGUE(FILE, SIZE) \ ! 638: { register int regno, g_regs_used = 0, f_regs_used = 0; \ ! 639: int used_regs_buf[8], *bufp = used_regs_buf; \ ! 640: int used_fregs_buf[8], *fbufp = used_fregs_buf; \ ! 641: extern char call_used_regs[]; \ ! 642: *fbufp++ = -2; \ ! 643: for (regno = 8; regno < 16; regno++) \ ! 644: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 645: { \ ! 646: *fbufp++ = regno; f_regs_used++; \ ! 647: } \ ! 648: fbufp--; \ ! 649: for (regno = 0; regno < 8; regno++) \ ! 650: if (regs_ever_live[regno] \ ! 651: && ! call_used_regs[regno]) \ ! 652: { \ ! 653: *bufp++ = regno; g_regs_used++; \ ! 654: } \ ! 655: while (fbufp > used_fregs_buf) \ ! 656: { \ ! 657: if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \ ! 658: { \ ! 659: fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \ ! 660: fbufp -= 2; \ ! 661: } \ ! 662: else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \ ! 663: } \ ! 664: if (frame_pointer_needed) \ ! 665: fprintf (FILE, "\texit ["); \ ! 666: else \ ! 667: { \ ! 668: if (g_regs_used && g_regs_used > 4) \ ! 669: fprintf (FILE, "\trestore ["); \ ! 670: else \ ! 671: { \ ! 672: while (bufp > used_regs_buf) \ ! 673: fprintf (FILE, "\tmovd tos,r%d\n", *--bufp); \ ! 674: g_regs_used = 0; \ ! 675: } \ ! 676: } \ ! 677: while (bufp > used_regs_buf) \ ! 678: { \ ! 679: fprintf (FILE, "r%d", *--bufp); \ ! 680: if (bufp > used_regs_buf) \ ! 681: fputc (',', FILE); \ ! 682: } \ ! 683: if (g_regs_used || frame_pointer_needed) \ ! 684: fprintf (FILE, "]\n"); \ ! 685: if (SIZE && !frame_pointer_needed) \ ! 686: fprintf (FILE, "\tadjspd %$%d\n", -(SIZE + 4)); \ ! 687: if (current_function_pops_args) \ ! 688: fprintf (FILE, "\tret %d\n", current_function_pops_args); \ ! 689: else fprintf (FILE, "\tret 0\n"); } ! 690: ! 691: /* Store in the variable DEPTH the initial difference between the ! 692: frame pointer reg contents and the stack pointer reg contents, ! 693: as of the start of the function body. This depends on the layout ! 694: of the fixed parts of the stack frame and on how registers are saved. */ ! 695: ! 696: #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \ ! 697: { \ ! 698: int regno; \ ! 699: int offset = -4; \ ! 700: for (regno = 0; regno < 16; regno++) \ ! 701: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 702: offset += 4; \ ! 703: (DEPTH) = (offset + get_frame_size () \ ! 704: + (get_frame_size () == 0 ? 0 : 4)); \ ! 705: } ! 706: ! 707: ! 708: /* Output assembler code for a block containing the constant parts ! 709: of a trampoline, leaving space for the variable parts. */ ! 710: ! 711: /* On the 32k, the trampoline looks like this: ! 712: addr .,r2 ! 713: jump @__trampoline ! 714: .int STATIC ! 715: .int FUNCTION ! 716: Doing trampolines with a library assist function is easier than figuring ! 717: out how to do stores to memory in reverse byte order (the way immediate ! 718: operands on the 32k are stored). */ ! 719: ! 720: #define TRAMPOLINE_TEMPLATE(FILE) \ ! 721: { \ ! 722: fprintf (FILE, "\taddr .,r2\n" ); \ ! 723: fprintf (FILE, "\tjump " ); \ ! 724: PUT_ABSOLUTE_PREFIX (FILE); \ ! 725: fprintf (FILE, "__trampoline\n" ); \ ! 726: ASM_OUTPUT_INT (FILE, const0_rtx); \ ! 727: ASM_OUTPUT_INT (FILE, const0_rtx); \ ! 728: } ! 729: ! 730: /* Length in units of the trampoline for entering a nested function. */ ! 731: ! 732: #define TRAMPOLINE_SIZE 20 ! 733: ! 734: /* Emit RTL insns to initialize the variable parts of a trampoline. ! 735: FNADDR is an RTX for the address of the function's pure code. ! 736: CXT is an RTX for the static chain value for the function. */ ! 737: ! 738: #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ ! 739: { \ ! 740: emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), CXT); \ ! 741: emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), FNADDR); \ ! 742: } ! 743: ! 744: /* This is the library routine that is used ! 745: to transfer control from the trampoline ! 746: to the actual nested function. */ ! 747: ! 748: /* The function name __transfer_from_trampoline is not actually used. ! 749: The function definition just permits use of "asm with operands" ! 750: (though the operand list is empty). */ ! 751: #define TRANSFER_FROM_TRAMPOLINE \ ! 752: void \ ! 753: __transfer_from_trampoline () \ ! 754: { \ ! 755: asm ("___trampoline:"); \ ! 756: asm ("movd 16(r2),tos"); \ ! 757: asm ("movd 12(r2),r2"); \ ! 758: asm ("ret 0"); \ ! 759: } ! 760: ! 761: /* Addressing modes, and classification of registers for them. */ ! 762: ! 763: /* #define HAVE_POST_INCREMENT */ ! 764: /* #define HAVE_POST_DECREMENT */ ! 765: ! 766: /* #define HAVE_PRE_DECREMENT */ ! 767: /* #define HAVE_PRE_INCREMENT */ ! 768: ! 769: /* Macros to check register numbers against specific register classes. */ ! 770: ! 771: /* These assume that REGNO is a hard or pseudo reg number. ! 772: They give nonzero only if REGNO is a hard reg of the suitable class ! 773: or a pseudo reg currently allocated to a suitable hard reg. ! 774: Since they use reg_renumber, they are safe only once reg_renumber ! 775: has been allocated, which happens in local-alloc.c. */ ! 776: ! 777: /* note that FP and SP cannot be used as an index. What about PC? */ ! 778: #define REGNO_OK_FOR_INDEX_P(REGNO) \ ! 779: ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8) ! 780: #define REGNO_OK_FOR_BASE_P(REGNO) \ ! 781: ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8 \ ! 782: || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM) ! 783: ! 784: #define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) > 7 && REGNO (X) < 16) ! 785: ! 786: /* Maximum number of registers that can appear in a valid memory address. */ ! 787: ! 788: #define MAX_REGS_PER_ADDRESS 2 ! 789: ! 790: /* Recognize any constant value that is a valid address. ! 791: This might not work on future ns32k processors as negative ! 792: displacements are not officially allowed but a mode reserved ! 793: to National. This works on processors up to 32532, though. */ ! 794: ! 795: #define CONSTANT_ADDRESS_P(X) \ ! 796: (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ ! 797: || GET_CODE (X) == CONST \ ! 798: || (GET_CODE (X) == CONST_INT \ ! 799: && ((unsigned)INTVAL (X) >= 0xe0000000 \ ! 800: || (unsigned)INTVAL (X) < 0x20000000))) ! 801: ! 802: #define CONSTANT_ADDRESS_NO_LABEL_P(X) \ ! 803: (GET_CODE (X) == CONST_INT \ ! 804: && ((unsigned)INTVAL (X) >= 0xe0000000 \ ! 805: || (unsigned)INTVAL (X) < 0x20000000)) ! 806: ! 807: /* Return the register class of a scratch register needed to copy IN into ! 808: or out of a register in CLASS in MODE. If it can be done directly, ! 809: NO_REGS is returned. */ ! 810: ! 811: #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \ ! 812: secondary_reload_class (CLASS, MODE, IN) ! 813: ! 814: /* Nonzero if the constant value X is a legitimate general operand. ! 815: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ ! 816: ! 817: #define LEGITIMATE_CONSTANT_P(X) 1 ! 818: ! 819: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx ! 820: and check its validity for a certain class. ! 821: We have two alternate definitions for each of them. ! 822: The usual definition accepts all pseudo regs; the other rejects ! 823: them unless they have been allocated suitable hard regs. ! 824: The symbol REG_OK_STRICT causes the latter definition to be used. ! 825: ! 826: Most source files want to accept pseudo regs in the hope that ! 827: they will get allocated to the class that the insn wants them to be in. ! 828: Source files for reload pass need to be strict. ! 829: After reload, it makes no difference, since pseudo regs have ! 830: been eliminated by then. */ ! 831: ! 832: #ifndef REG_OK_STRICT ! 833: ! 834: /* Nonzero if X is a hard reg that can be used as an index ! 835: or if it is a pseudo reg. */ ! 836: #define REG_OK_FOR_INDEX_P(X) \ ! 837: (REGNO (X) < 8 || REGNO (X) >= FIRST_PSEUDO_REGISTER) ! 838: /* Nonzero if X is a hard reg that can be used as a base reg ! 839: of if it is a pseudo reg. */ ! 840: #define REG_OK_FOR_BASE_P(X) (REGNO (X) < 8 || REGNO (X) >= FRAME_POINTER_REGNUM) ! 841: /* Nonzero if X is a floating point reg or a pseudo reg. */ ! 842: ! 843: #else ! 844: ! 845: /* Nonzero if X is a hard reg that can be used as an index. */ ! 846: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) ! 847: /* Nonzero if X is a hard reg that can be used as a base reg. */ ! 848: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) ! 849: ! 850: #endif ! 851: ! 852: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression ! 853: that is a valid memory address for an instruction. ! 854: The MODE argument is the machine mode for the MEM expression ! 855: that wants to use this address. ! 856: ! 857: The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */ ! 858: ! 859: /* 1 if X is an address that we could indirect through. */ ! 860: /***** NOTE ***** There is a bug in the Sequent assembler which fails ! 861: to fixup addressing information for symbols used as offsets ! 862: from registers which are not FP or SP (or SB or PC). This ! 863: makes _x(fp) valid, while _x(r0) is invalid. */ ! 864: ! 865: #define INDIRECTABLE_1_ADDRESS_P(X) \ ! 866: (CONSTANT_ADDRESS_P (X) \ ! 867: || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ ! 868: || (GET_CODE (X) == PLUS \ ! 869: && GET_CODE (XEXP (X, 0)) == REG \ ! 870: && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ ! 871: && CONSTANT_ADDRESS_P (XEXP (X, 1)) \ ! 872: && (GET_CODE (X) != CONST_INT || NS32K_DISPLACEMENT_P (INTVAL (X))))) ! 873: ! 874: /* 1 if integer I will fit in a 4 byte displacement field. ! 875: Strictly speaking, we can't be sure that a symbol will fit this range. ! 876: But, in practice, it always will. */ ! 877: ! 878: /* [email protected] says that the 32016 and 32032 ! 879: can handle the full range of displacements--it is only the addresses ! 880: that have a limited range. So the following was deleted: ! 881: (((i) <= 16777215 && (i) >= -16777216) ! 882: || ((TARGET_32532 || TARGET_32332) && ...)) */ ! 883: #define NS32K_DISPLACEMENT_P(i) \ ! 884: ((i) < (1 << 29) && (i) >= - (1 << 29)) ! 885: ! 886: /* Check for frame pointer or stack pointer. */ ! 887: #define MEM_REG(X) \ ! 888: (GET_CODE (X) == REG && (REGNO (X) ^ 16) < 2) ! 889: ! 890: /* A memory ref whose address is the FP or SP, with optional integer offset, ! 891: or (on certain machines) a constant address. */ ! 892: #define INDIRECTABLE_2_ADDRESS_P(X) \ ! 893: (GET_CODE (X) == MEM \ ! 894: && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \ ! 895: || (GET_CODE (xfoo0) == PLUS \ ! 896: && MEM_REG (XEXP (xfoo0, 0)) \ ! 897: && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \ ! 898: || (TARGET_SB && CONSTANT_ADDRESS_P (xfoo0)))) ! 899: ! 900: /* Go to ADDR if X is a valid address not using indexing. ! 901: (This much is the easy part.) */ ! 902: #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \ ! 903: { register rtx xfoob = (X); \ ! 904: if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \ ! 905: if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \ ! 906: if (GET_CODE (X) == PLUS) \ ! 907: if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \ ! 908: if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \ ! 909: goto ADDR; \ ! 910: } ! 911: ! 912: /* Go to ADDR if X is a valid address not using indexing. ! 913: (This much is the easy part.) */ ! 914: #define GO_IF_INDEXING(X, MODE, ADDR) \ ! 915: { register rtx xfoob = (X); \ ! 916: if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 0), MODE)) \ ! 917: GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 1), ADDR); \ ! 918: if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 1), MODE)) \ ! 919: GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 0), ADDR); } \ ! 920: ! 921: #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \ ! 922: { if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; \ ! 923: if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \ ! 924: } ! 925: ! 926: /* 1 if PROD is either a reg times size of mode MODE ! 927: or just a reg, if MODE is just one byte. Actually, on the ns32k, ! 928: since the index mode is independent of the operand size, ! 929: we can match more stuff... ! 930: ! 931: This macro's expansion uses the temporary variables xfoo0, xfoo1 ! 932: and xfoo2 that must be declared in the surrounding context. */ ! 933: #define INDEX_TERM_P(PROD, MODE) \ ! 934: ((GET_CODE (PROD) == REG && REG_OK_FOR_INDEX_P (PROD)) \ ! 935: || (GET_CODE (PROD) == MULT \ ! 936: && (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \ ! 937: (GET_CODE (xfoo1) == CONST_INT \ ! 938: && GET_CODE (xfoo0) == REG \ ! 939: && FITS_INDEX_RANGE (INTVAL (xfoo1)) \ ! 940: && REG_OK_FOR_INDEX_P (xfoo0))))) ! 941: ! 942: #define FITS_INDEX_RANGE(X) \ ! 943: ((xfoo2 = (unsigned)(X)-1), \ ! 944: ((xfoo2 < 4 && xfoo2 != 2) || xfoo2 == 7)) ! 945: ! 946: /* Note that xfoo0, xfoo1, xfoo2 are used in some of the submacros above. */ ! 947: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ! 948: { register rtx xfooy, xfoo0, xfoo1; \ ! 949: unsigned xfoo2; \ ! 950: xfooy = X; \ ! 951: GO_IF_NONINDEXED_ADDRESS (xfooy, ADDR); \ ! 952: if (GET_CODE (xfooy) == PLUS) \ ! 953: { \ ! 954: if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 1)) \ ! 955: && GET_CODE (XEXP (xfooy, 0)) == PLUS) \ ! 956: xfooy = XEXP (xfooy, 0); \ ! 957: else if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 0)) \ ! 958: && GET_CODE (XEXP (xfooy, 1)) == PLUS) \ ! 959: xfooy = XEXP (xfooy, 1); \ ! 960: GO_IF_INDEXING (xfooy, MODE, ADDR); \ ! 961: } \ ! 962: else if (INDEX_TERM_P (xfooy, MODE)) \ ! 963: goto ADDR; \ ! 964: else if (GET_CODE (xfooy) == PRE_DEC) \ ! 965: if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \ ! 966: else abort (); \ ! 967: } ! 968: ! 969: /* Try machine-dependent ways of modifying an illegitimate address ! 970: to be legitimate. If we find one, return the new, valid address. ! 971: This macro is used in only one place: `memory_address' in explow.c. ! 972: ! 973: OLDX is the address as it was before break_out_memory_refs was called. ! 974: In some cases it is useful to look at this to decide what needs to be done. ! 975: ! 976: MODE and WIN are passed so that this macro can use ! 977: GO_IF_LEGITIMATE_ADDRESS. ! 978: ! 979: It is always safe for this macro to do nothing. It exists to recognize ! 980: opportunities to optimize the output. ! 981: ! 982: For the ns32k, we do nothing */ ! 983: ! 984: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} ! 985: ! 986: /* Go to LABEL if ADDR (a legitimate address expression) ! 987: has an effect that depends on the machine mode it is used for. ! 988: On the ns32k, only predecrement and postincrement address depend thus ! 989: (the amount of decrement or increment being the length of the operand). */ ! 990: ! 991: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ ! 992: { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \ ! 993: goto LABEL;} ! 994: ! 995: /* Specify the machine mode that this machine uses ! 996: for the index in the tablejump instruction. ! 997: HI mode is more efficient but the range is not wide enough for ! 998: all programs. */ ! 999: #define CASE_VECTOR_MODE SImode ! 1000: ! 1001: /* Define this if the tablejump instruction expects the table ! 1002: to contain offsets from the address of the table. ! 1003: Do not define this if the table should contain absolute addresses. */ ! 1004: #define CASE_VECTOR_PC_RELATIVE ! 1005: ! 1006: /* Specify the tree operation to be used to convert reals to integers. */ ! 1007: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR ! 1008: ! 1009: /* This is the kind of divide that is easiest to do in the general case. */ ! 1010: #define EASY_DIV_EXPR TRUNC_DIV_EXPR ! 1011: ! 1012: /* Define this as 1 if `char' should by default be signed; else as 0. */ ! 1013: #define DEFAULT_SIGNED_CHAR 1 ! 1014: ! 1015: /* Max number of bytes we can move from memory to memory ! 1016: in one reasonably fast instruction. */ ! 1017: #define MOVE_MAX 4 ! 1018: ! 1019: /* Define this if zero-extension is slow (more than one real instruction). */ ! 1020: /* #define SLOW_ZERO_EXTEND */ ! 1021: ! 1022: /* Nonzero if access to memory by bytes is slow and undesirable. */ ! 1023: #define SLOW_BYTE_ACCESS 0 ! 1024: ! 1025: /* Define if shifts truncate the shift count ! 1026: which implies one can omit a sign-extension or zero-extension ! 1027: of a shift count. */ ! 1028: /* #define SHIFT_COUNT_TRUNCATED */ ! 1029: ! 1030: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits ! 1031: is done just by pretending it is already truncated. */ ! 1032: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 ! 1033: ! 1034: /* We assume that the store-condition-codes instructions store 0 for false ! 1035: and some other value for true. This is the value stored for true. */ ! 1036: ! 1037: #define STORE_FLAG_VALUE 1 ! 1038: ! 1039: /* Specify the machine mode that pointers have. ! 1040: After generation of rtl, the compiler makes no further distinction ! 1041: between pointers and any other objects of this machine mode. */ ! 1042: #define Pmode SImode ! 1043: ! 1044: /* A function address in a call instruction ! 1045: is a byte address (for indexing purposes) ! 1046: so give the MEM rtx a byte's mode. */ ! 1047: #define FUNCTION_MODE QImode ! 1048: ! 1049: /* Compute the cost of address ADDRESS. */ ! 1050: ! 1051: #define ADDRESS_COST(RTX) calc_address_cost (RTX) ! 1052: ! 1053: /* Compute the cost of computing a constant rtl expression RTX ! 1054: whose rtx-code is CODE. The body of this macro is a portion ! 1055: of a switch statement. If the code is computed here, ! 1056: return it with a return statement. Otherwise, break from the switch. */ ! 1057: ! 1058: #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ ! 1059: case CONST_INT: \ ! 1060: if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \ ! 1061: if (INTVAL (RTX) < 0x4000 && INTVAL (RTX) >= -0x4000) \ ! 1062: return 1; \ ! 1063: case CONST: \ ! 1064: case LABEL_REF: \ ! 1065: case SYMBOL_REF: \ ! 1066: return 3; \ ! 1067: case CONST_DOUBLE: \ ! 1068: return 5; ! 1069: ! 1070: /* Tell final.c how to eliminate redundant test instructions. */ ! 1071: ! 1072: /* Here we define machine-dependent flags and fields in cc_status ! 1073: (see `conditions.h'). */ ! 1074: ! 1075: /* This bit means that what ought to be in the Z bit ! 1076: should be tested in the F bit. */ ! 1077: #define CC_Z_IN_F 04000 ! 1078: ! 1079: /* This bit means that what ought to be in the Z bit ! 1080: is complemented in the F bit. */ ! 1081: #define CC_Z_IN_NOT_F 010000 ! 1082: ! 1083: /* Store in cc_status the expressions ! 1084: that the condition codes will describe ! 1085: after execution of an instruction whose pattern is EXP. ! 1086: Do not alter them if the instruction would not alter the cc's. */ ! 1087: ! 1088: #define NOTICE_UPDATE_CC(EXP, INSN) \ ! 1089: { if (GET_CODE (EXP) == SET) \ ! 1090: { if (GET_CODE (SET_DEST (EXP)) == CC0) \ ! 1091: { cc_status.flags = 0; \ ! 1092: cc_status.value1 = SET_DEST (EXP); \ ! 1093: cc_status.value2 = SET_SRC (EXP); \ ! 1094: } \ ! 1095: else if (GET_CODE (SET_SRC (EXP)) == CALL) \ ! 1096: { CC_STATUS_INIT; } \ ! 1097: else if (GET_CODE (SET_DEST (EXP)) == REG) \ ! 1098: { if (cc_status.value1 \ ! 1099: && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \ ! 1100: cc_status.value1 = 0; \ ! 1101: if (cc_status.value2 \ ! 1102: && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \ ! 1103: cc_status.value2 = 0; \ ! 1104: } \ ! 1105: else if (GET_CODE (SET_DEST (EXP)) == MEM) \ ! 1106: { CC_STATUS_INIT; } \ ! 1107: } \ ! 1108: else if (GET_CODE (EXP) == PARALLEL \ ! 1109: && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \ ! 1110: { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == CC0) \ ! 1111: { cc_status.flags = 0; \ ! 1112: cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \ ! 1113: cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \ ! 1114: } \ ! 1115: else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == REG) \ ! 1116: { if (cc_status.value1 \ ! 1117: && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value1)) \ ! 1118: cc_status.value1 = 0; \ ! 1119: if (cc_status.value2 \ ! 1120: && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value2)) \ ! 1121: cc_status.value2 = 0; \ ! 1122: } \ ! 1123: else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == MEM) \ ! 1124: { CC_STATUS_INIT; } \ ! 1125: } \ ! 1126: else if (GET_CODE (EXP) == CALL) \ ! 1127: { /* all bets are off */ CC_STATUS_INIT; } \ ! 1128: else { /* nothing happens? CC_STATUS_INIT; */} \ ! 1129: if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \ ! 1130: && cc_status.value2 \ ! 1131: && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \ ! 1132: abort (); \ ! 1133: } ! 1134: ! 1135: /* Describe the costs of the following register moves which are discouraged: ! 1136: 1.) Moves between the Floating point registers and the frame pointer and stack pointer ! 1137: 2.) Moves between the stack pointer and the frame pointer ! 1138: 3.) Moves between the floating point and general registers */ ! 1139: ! 1140: #define REGISTER_MOVE_COST(CLASS1, CLASS2) \ ! 1141: ((((CLASS1) == FLOAT_REGS && ((CLASS2) == STACK_POINTER_REG || (CLASS2) == FRAME_POINTER_REG)) \ ! 1142: || ((CLASS2) == FLOAT_REGS && ((CLASS1) == STACK_POINTER_REG || (CLASS1) == FRAME_POINTER_REG)) \ ! 1143: || ((CLASS1) == STACK_POINTER_REG && (CLASS2) == FRAME_POINTER_REG) \ ! 1144: || ((CLASS2) == STACK_POINTER_REG && (CLASS1) == FRAME_POINTER_REG) \ ! 1145: || ((CLASS1) == FLOAT_REGS && (CLASS2) == GENERAL_REGS) \ ! 1146: || ((CLASS1) == GENERAL_REGS && (CLASS2) == FLOAT_REGS)) \ ! 1147: ? 4 : 2) ! 1148: ! 1149: #define OUTPUT_JUMP(NORMAL, NO_OV) \ ! 1150: { if (cc_status.flags & CC_NO_OVERFLOW) \ ! 1151: return NO_OV; \ ! 1152: return NORMAL; } ! 1153: ! 1154: /* Dividing the output into sections */ ! 1155: ! 1156: /* Output before read-only data. */ ! 1157: ! 1158: #define TEXT_SECTION_ASM_OP ".text" ! 1159: ! 1160: /* Output before writable data. */ ! 1161: ! 1162: #define DATA_SECTION_ASM_OP ".data" ! 1163: ! 1164: /* Define the output Assembly Language */ ! 1165: ! 1166: /* Output at beginning of assembler file. */ ! 1167: ! 1168: #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n"); ! 1169: ! 1170: /* Output to assembler file text saying following lines ! 1171: may contain character constants, extra white space, comments, etc. */ ! 1172: ! 1173: #define ASM_APP_ON "#APP\n" ! 1174: ! 1175: /* Output to assembler file text saying following lines ! 1176: no longer contain unusual constructs. */ ! 1177: ! 1178: #define ASM_APP_OFF "#NO_APP\n" ! 1179: ! 1180: /* Output of Data */ ! 1181: ! 1182: /* This is how to output an assembler line defining a `double' constant. */ ! 1183: ! 1184: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ ! 1185: fprintf (FILE, "\t.double 0d%.20e\n", (VALUE)) ! 1186: ! 1187: /* This is how to output an assembler line defining a `float' constant. */ ! 1188: ! 1189: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ ! 1190: fprintf (FILE, "\t.float 0f%.20e\n", (VALUE)) ! 1191: ! 1192: /* This is how to output an assembler line defining an `int' constant. */ ! 1193: ! 1194: #define ASM_OUTPUT_INT(FILE,VALUE) \ ! 1195: ( fprintf (FILE, "\t.long "), \ ! 1196: output_addr_const (FILE, (VALUE)), \ ! 1197: fprintf (FILE, "\n")) ! 1198: ! 1199: /* Likewise for `char' and `short' constants. */ ! 1200: ! 1201: #define ASM_OUTPUT_SHORT(FILE,VALUE) \ ! 1202: ( fprintf (FILE, "\t.word "), \ ! 1203: output_addr_const (FILE, (VALUE)), \ ! 1204: fprintf (FILE, "\n")) ! 1205: ! 1206: #define ASM_OUTPUT_CHAR(FILE,VALUE) \ ! 1207: ( fprintf (FILE, "\t.byte "), \ ! 1208: output_addr_const (FILE, (VALUE)), \ ! 1209: fprintf (FILE, "\n")) ! 1210: ! 1211: /* This is how to output an assembler line for a numeric constant byte. */ ! 1212: ! 1213: #define ASM_OUTPUT_BYTE(FILE,VALUE) \ ! 1214: fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) ! 1215: ! 1216: /* This is how to output an assembler line defining an external/static ! 1217: address which is not in tree format (for collect.c). */ ! 1218: ! 1219: #define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME) \ ! 1220: do { \ ! 1221: fprintf (STREAM, "\t.long\t"); \ ! 1222: ASM_OUTPUT_LABELREF (STREAM, NAME); \ ! 1223: fprintf (STREAM, "\n"); \ ! 1224: } while (0) ! 1225: ! 1226: /* This is how to output an insn to push a register on the stack. ! 1227: It need not be very fast code. */ ! 1228: ! 1229: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ ! 1230: fprintf (FILE, "\tmovd %s,tos\n", reg_names[REGNO]) ! 1231: ! 1232: /* This is how to output an insn to pop a register from the stack. ! 1233: It need not be very fast code. */ ! 1234: ! 1235: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ ! 1236: fprintf (FILE, "\tmovd tos,%s\n", reg_names[REGNO]) ! 1237: ! 1238: /* How to refer to registers in assembler output. ! 1239: This sequence is indexed by compiler's hard-register-number (see above). */ ! 1240: ! 1241: #define REGISTER_NAMES \ ! 1242: {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ ! 1243: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ ! 1244: "fp", "sp"} ! 1245: ! 1246: /* How to renumber registers for dbx and gdb. ! 1247: NS32000 may need more change in the numeration. */ ! 1248: ! 1249: #define DBX_REGISTER_NUMBER(REGNO) ((REGNO < 8) ? (REGNO)+4 : (REGNO)) ! 1250: ! 1251: /* This is how to output the definition of a user-level label named NAME, ! 1252: such as the label on a static function or variable NAME. */ ! 1253: ! 1254: #ifndef COLLECT ! 1255: #define ASM_OUTPUT_LABEL(FILE,NAME) \ ! 1256: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) ! 1257: #else ! 1258: #define ASM_OUTPUT_LABEL(STREAM,NAME) \ ! 1259: do { \ ! 1260: fprintf (STREAM, "%s:\n", NAME); \ ! 1261: } while (0) ! 1262: #endif ! 1263: ! 1264: /* This is how to output a command to make the user-level label named NAME ! 1265: defined for reference from other files. */ ! 1266: ! 1267: #ifndef COLLECT ! 1268: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ ! 1269: do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) ! 1270: #else ! 1271: #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \ ! 1272: do { \ ! 1273: fprintf (STREAM, "\t.globl\t%s\n", NAME); \ ! 1274: } while (0) ! 1275: #endif ! 1276: ! 1277: /* This is how to output a reference to a user-level label named NAME. ! 1278: `assemble_name' uses this. */ ! 1279: ! 1280: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 1281: fprintf (FILE, "_%s", NAME) ! 1282: ! 1283: /* This is how to output an internal numbered label where ! 1284: PREFIX is the class of label and NUM is the number within the class. */ ! 1285: ! 1286: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 1287: fprintf (FILE, "%s%d:\n", PREFIX, NUM) ! 1288: ! 1289: /* This is how to store into the string LABEL ! 1290: the symbol_ref name of an internal numbered label where ! 1291: PREFIX is the class of label and NUM is the number within the class. ! 1292: This is suitable for output with `assemble_name'. */ ! 1293: ! 1294: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ ! 1295: sprintf (LABEL, "*%s%d", PREFIX, NUM) ! 1296: ! 1297: /* This is how to align the code that follows an unconditional branch. ! 1298: Note that 0xa2 is a no-op. */ ! 1299: ! 1300: #define ASM_OUTPUT_ALIGN_CODE(FILE) \ ! 1301: fprintf (FILE, "\t.align 2,0xa2\n") ! 1302: ! 1303: /* This is how to output an element of a case-vector that is absolute. ! 1304: (The ns32k does not use such vectors, ! 1305: but we must define this macro anyway.) */ ! 1306: ! 1307: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ! 1308: fprintf (FILE, "\t.long L%d\n", VALUE) ! 1309: ! 1310: /* This is how to output an element of a case-vector that is relative. */ ! 1311: /* ** Notice that the second element is LI format! */ ! 1312: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ! 1313: fprintf (FILE, "\t.long L%d-LI%d\n", VALUE, REL) ! 1314: ! 1315: /* This is how to output an assembler line ! 1316: that says to advance the location counter ! 1317: to a multiple of 2**LOG bytes. */ ! 1318: ! 1319: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 1320: fprintf (FILE, "\t.align %d\n", (LOG)) ! 1321: ! 1322: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 1323: fprintf (FILE, "\t.space %u\n", (SIZE)) ! 1324: ! 1325: /* This says how to output an assembler line ! 1326: to define a global common symbol. */ ! 1327: ! 1328: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 1329: ( fputs (".comm ", (FILE)), \ ! 1330: assemble_name ((FILE), (NAME)), \ ! 1331: fprintf ((FILE), ",%u\n", (ROUNDED))) ! 1332: ! 1333: /* This says how to output an assembler line ! 1334: to define a local common symbol. */ ! 1335: ! 1336: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 1337: ( fputs (".lcomm ", (FILE)), \ ! 1338: assemble_name ((FILE), (NAME)), \ ! 1339: fprintf ((FILE), ",%u\n", (ROUNDED))) ! 1340: ! 1341: /* Store in OUTPUT a string (made with alloca) containing ! 1342: an assembler-name for a local static variable named NAME. ! 1343: LABELNO is an integer which is different for each call. */ ! 1344: ! 1345: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ! 1346: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ ! 1347: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) ! 1348: ! 1349: /* Define the parentheses used to group arithmetic operations ! 1350: in assembler code. */ ! 1351: ! 1352: #define ASM_OPEN_PAREN "(" ! 1353: #define ASM_CLOSE_PAREN ")" ! 1354: ! 1355: /* Define results of standard character escape sequences. */ ! 1356: #define TARGET_BELL 007 ! 1357: #define TARGET_BS 010 ! 1358: #define TARGET_TAB 011 ! 1359: #define TARGET_NEWLINE 012 ! 1360: #define TARGET_VT 013 ! 1361: #define TARGET_FF 014 ! 1362: #define TARGET_CR 015 ! 1363: ! 1364: /* Print an instruction operand X on file FILE. ! 1365: CODE is the code from the %-spec that requested printing this operand; ! 1366: if `%z3' was used to print operand 3, then CODE is 'z'. */ ! 1367: ! 1368: /* %$ means print the prefix for an immediate operand. */ ! 1369: ! 1370: #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ ! 1371: ((CODE) == '$' || (CODE) == '?') ! 1372: ! 1373: #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE) ! 1374: ! 1375: /* Print a memory operand whose address is X, on file FILE. */ ! 1376: ! 1377: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR) ! 1378: ! 1379: /* Define functions in ns32k.c and used in insn-output.c. */ ! 1380: ! 1381: extern char *output_move_double (); ! 1382: extern char *output_shift_insn (); ! 1383: ! 1384: /* ! 1385: Local variables: ! 1386: version-control: t ! 1387: End: ! 1388: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.