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