|
|
1.1 ! root 1: /* Definitions of target machine parameters for GNU compiler, ! 2: for Pyramid 90x, 9000, and MIServer Series. ! 3: Copyright (C) 1989 Free Software Foundation, Inc. ! 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: * If you're going to change this, and you haven't already, ! 23: * you should get and read ! 24: * ``OSx Operating System Porting Guide'', ! 25: * publication number 4100-0066-A ! 26: * Revision A ! 27: * Pyramid Technology Corporation. ! 28: * ! 29: * or whatever the most recent version is. In any case, page and ! 30: * section number references given herein refer to this document. ! 31: * ! 32: * The instruction table for gdb lists the available insns and ! 33: * the valid addressing modes. ! 34: * ! 35: * Any other information on the Pyramid architecture is proprietary ! 36: * and hard to get. (Pyramid cc -S and adb are also useful.) ! 37: * ! 38: */ ! 39: ! 40: /*** Run-time compilation parameters selecting different hardware subsets. ***/ ! 41: ! 42: /* Names to predefine in the preprocessor for this target machine. */ ! 43: ! 44: #define CPP_PREDEFINES "-Dpyr -Dunix" ! 45: ! 46: /* Print subsidiary information on the compiler version in use. */ ! 47: ! 48: #define TARGET_VERSION fprintf (stderr, " (pyr)"); ! 49: ! 50: extern int target_flags; ! 51: ! 52: /* Nonzero if compiling code that Unix assembler can assemble. */ ! 53: #define TARGET_UNIX_ASM (target_flags & 1) ! 54: ! 55: /* Use the indexed addressing modes (were once not known to work). ! 56: Leaving this in means we can disable them and so find out what ! 57: they win us. */ ! 58: #define TARGET_INDEX (target_flags & 2) ! 59: ! 60: /* Implement stdarg in the same fashion used on all other machines. */ ! 61: #define TARGET_GNU_STDARG (target_flags & 4) ! 62: ! 63: /* Compile using RETD to pop off the args. ! 64: This will not work unless you use prototypes at least ! 65: for all functions that can take varying numbers of args. ! 66: This contravenes the Pyramid calling convention, so we don't ! 67: do it yet. */ ! 68: ! 69: #define TARGET_RETD (target_flags & 8) ! 70: ! 71: /* Macros used in the machine description to test the flags. */ ! 72: ! 73: /* Macro to define tables used to set the flags. ! 74: This is a list in braces of pairs in braces, ! 75: each pair being { "NAME", VALUE } ! 76: where VALUE is the bits to set or minus the bits to clear. ! 77: An empty string NAME is used to identify the default VALUE. ! 78: ! 79: -mgnu will be useful if we ever have GAS on a pyramid. ! 80: -mindex was used to enable indexing when I didn't understand ! 81: how pyramid's indexing modes worked. */ ! 82: ! 83: #define TARGET_SWITCHES \ ! 84: { {"unix", 1}, \ ! 85: {"gnu", -1}, \ ! 86: {"index", 2}, \ ! 87: {"noindex", -2}, \ ! 88: {"gnu-stdarg", 4}, \ ! 89: {"nognu-stdarg", -4}, \ ! 90: {"retd", 8}, \ ! 91: {"no-retd", -8}, \ ! 92: { "", TARGET_DEFAULT}} ! 93: ! 94: /* Default target_flags if no switches specified. ! 95: ! 96: (equivalent to "-munix -mindex -mgnu-stdarg") */ ! 97: ! 98: #ifndef TARGET_DEFAULT ! 99: #define TARGET_DEFAULT (1 + 2 + 4) ! 100: #endif ! 101: ! 102: /* Never allow $ in identifiers */ ! 103: ! 104: #define DOLLARS_IN_IDENTIFIERS 0 ! 105: ! 106: /*** Target machine storage layout ***/ ! 107: ! 108: /* Define this if most significant bit is lowest numbered ! 109: in instructions that operate on numbered bit-fields. ! 110: This is not true on the pyramid. */ ! 111: #define BITS_BIG_ENDIAN 0 ! 112: ! 113: /* Define this if most significant byte of a word is the lowest numbered. */ ! 114: #define BYTES_BIG_ENDIAN 1 ! 115: ! 116: /* Define this if most significant word of a multiword number is the lowest ! 117: numbered. */ ! 118: #define WORDS_BIG_ENDIAN 1 ! 119: ! 120: /* Number of bits in an addressable storage unit */ ! 121: #define BITS_PER_UNIT 8 ! 122: ! 123: /* Width in bits of a "word", which is the contents of a machine register. ! 124: Note that this is not necessarily the width of data type `int'; ! 125: if using 16-bit ints on a 68000, this would still be 32. ! 126: But on a machine with 16-bit registers, this would be 16. */ ! 127: #define BITS_PER_WORD 32 ! 128: ! 129: /* Width of a word, in units (bytes). */ ! 130: #define UNITS_PER_WORD 4 ! 131: ! 132: /* Width in bits of a pointer. ! 133: See also the macro `Pmode' defined below. */ ! 134: #define POINTER_SIZE 32 ! 135: ! 136: /* Allocation boundary (in *bits*) for storing arguments in argument list. */ ! 137: #define PARM_BOUNDARY 32 ! 138: ! 139: /* Boundary (in *bits*) on which stack pointer should be aligned. */ ! 140: #define STACK_BOUNDARY 32 ! 141: ! 142: /* Allocation boundary (in *bits*) for the code of a function. */ ! 143: #define FUNCTION_BOUNDARY 32 ! 144: ! 145: /* Alignment of field after `int : 0' in a structure. */ ! 146: #define EMPTY_FIELD_BOUNDARY 32 ! 147: ! 148: /* No data type wants to be aligned rounder than this. */ ! 149: #define BIGGEST_ALIGNMENT 32 ! 150: ! 151: /* Specified types of bitfields affect alignment of those fields ! 152: and of the structure as a whole. */ ! 153: #define PCC_BITFIELD_TYPE_MATTERS ! 154: ! 155: /* Make strings word-aligned so strcpy from constants will be faster. ! 156: Pyramid documentation says the best alignment is to align ! 157: on the size of a cache line, which is 32 bytes. ! 158: Newer pyrs have single insns that do strcmp() and strcpy(), so this ! 159: may not actually win anything. */ ! 160: ! 161: #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ! 162: (TREE_CODE (EXP) == STRING_CST \ ! 163: && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) ! 164: ! 165: /* Make arrays of chars word-aligned for the same reasons. */ ! 166: #define DATA_ALIGNMENT(TYPE, ALIGN) \ ! 167: (TREE_CODE (TYPE) == ARRAY_TYPE \ ! 168: && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ ! 169: && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) ! 170: ! 171: /* Define this if move instructions will actually fail to work ! 172: when given unaligned data. */ ! 173: #define STRICT_ALIGNMENT ! 174: ! 175: /*** Standard register usage. ***/ ! 176: ! 177: /* Number of actual hardware registers. ! 178: The hardware registers are assigned numbers for the compiler ! 179: from 0 to just below FIRST_PSEUDO_REGISTER. ! 180: All registers that the compiler knows about must be given numbers, ! 181: even those that are not normally considered general registers. */ ! 182: ! 183: /* Nota Bene: ! 184: Pyramids have 64 addressable 32-bit registers, arranged as four ! 185: groups of sixteen registers each. Pyramid names the groups ! 186: global, parameter, local, and temporary. ! 187: ! 188: The sixteen global registers are fairly conventional; the last ! 189: four are overloaded with a PSW, frame pointer, stack pointer, and pc. ! 190: The non-dedicated global registers used to be reserved for Pyramid ! 191: operating systems, and still have cryptic and undocumented uses for ! 192: certain library calls. We do not use global registers gr0 through ! 193: gr11. ! 194: ! 195: The parameter, local, and temporary registers provide register ! 196: windowing. Each procedure call has its own set of these 48 ! 197: registers, which constitute its call frame. (These frames are ! 198: not allocated on the conventional stack, but contiguously ! 199: on a separate stack called the control stack.) ! 200: Register windowing is a facility whereby the temporary registers ! 201: of frame n become the parameter registers of frame n+1, viz.: ! 202: ! 203: 0 15 0 15 0 15 ! 204: +------------+------------+------------+ ! 205: frame n+1 | | | | ! 206: +------------+------------+------------+ ! 207: Parameter Local Temporary ! 208: ! 209: ^ ! 210: | These 16 regs are the same. ! 211: v ! 212: ! 213: 0 15 0 15 0 15 ! 214: +------------+------------+------------+ ! 215: frame n | | | | ! 216: +------------+------------+------------+ ! 217: Parameter Local Temporary ! 218: ! 219: New frames are automatically allocated on the control stack by the ! 220: call instruction and de-allocated by the return insns "ret" and ! 221: "retd". The control-stack grows contiguously upward from a ! 222: well-known address in memory; programs are free to allocate ! 223: a variable sized, conventional frame on the data stack, which ! 224: grows downwards in memory from just below the control stack. ! 225: ! 226: Temporary registers are used for parameter passing, and are not ! 227: preserved across calls. TR0 through TR11 correspond to ! 228: gcc's ``input'' registers; PR0 through TR11 the ``output'' ! 229: registers. The call insn stores the PC and PSW in PR14 and PR15 of ! 230: the frame it creates; the return insns restore these into the PC ! 231: and PSW. The same is true for interrupts; TR14 and TR15 of the ! 232: current frame are reserved and should never be used, since an ! 233: interrupt may occur at any time and clobber them. ! 234: ! 235: An interesting quirk is the ability to take the address of a ! 236: variable in a windowed register. This done by adding the memory ! 237: address of the base of the current window frame, to the offset ! 238: within the frame of the desired register. The resulting address ! 239: can be treated just like any other pointer; if a quantity is stored ! 240: into that address, the appropriate register also changes. ! 241: GCC does not, and according to RMS will not, support this feature, ! 242: even though some programs rely on this (mis)feature. ! 243: */ ! 244: ! 245: #define PYR_GREG(n) (n) ! 246: #define PYR_PREG(n) (16+(n)) ! 247: #define PYR_LREG(n) (32+(n)) ! 248: #define PYR_TREG(n) (48+(n)) ! 249: ! 250: #define FIRST_PSEUDO_REGISTER 64 ! 251: ! 252: /* 1 for registers that have pervasive standard uses ! 253: and are not available for the register allocator. ! 254: ! 255: On the pyramid, these are LOGPSW, CFP, SP, PC, and all the other ! 256: global regs. */ ! 257: ! 258: #define FIXED_REGISTERS \ ! 259: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ ! 260: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \ ! 261: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ! 262: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1} ! 263: ! 264: /* 1 for registers not available across function calls. ! 265: These must include the FIXED_REGISTERS and also any ! 266: registers that can be used without being saved. ! 267: The latter must include the registers where values are returned ! 268: and the register where structure-value addresses are passed. ! 269: Aside from that, you can include as many other registers as you like. */ ! 270: #define CALL_USED_REGISTERS \ ! 271: {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ ! 272: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \ ! 273: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ! 274: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} ! 275: ! 276: /* #define DEFAULT_CALLER_SAVES */ ! 277: ! 278: /* Return number of consecutive hard regs needed starting at reg REGNO ! 279: to hold something of mode MODE. ! 280: This is ordinarily the length in words of a value of mode MODE ! 281: but can be less for certain modes in special long registers. ! 282: On the pyramid, all registers are one word long. */ ! 283: #define HARD_REGNO_NREGS(REGNO, MODE) \ ! 284: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 285: ! 286: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. ! 287: On the pyramid, all registers can hold all modes. */ ! 288: ! 289: /* -->FIXME: this is not the case for 64-bit quantities in tr11/12 through ! 290: --> TR14/15. This should be fixed, but to do it correctly, we also ! 291: --> need to fix MODES_TIEABLE_P. Yuk. We ignore this, since GCC should ! 292: --> do the "right" thing due to FIXED_REGISTERS. */ ! 293: #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 ! 294: ! 295: /* Value is 1 if it is a good idea to tie two pseudo registers ! 296: when one has mode MODE1 and one has mode MODE2. ! 297: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, ! 298: for any hard reg, then this must be 0 for correct output. */ ! 299: #define MODES_TIEABLE_P(MODE1, MODE2) 1 ! 300: ! 301: /* Specify the registers used for certain standard purposes. ! 302: The values of these macros are register numbers. */ ! 303: ! 304: /* Pyramid pc is overloaded on global register 15. */ ! 305: #define PC_REGNUM PYR_GREG(15) ! 306: ! 307: /* Register to use for pushing function arguments. ! 308: --> on Pyramids, the data stack pointer. */ ! 309: #define STACK_POINTER_REGNUM PYR_GREG(14) ! 310: ! 311: /* Base register for access to local variables of the function. ! 312: Pyramid uses CFP (GR13) as both frame pointer and argument pointer. */ ! 313: #define FRAME_POINTER_REGNUM 13 /* PYR_GREG(13) */ ! 314: ! 315: /* Value should be nonzero if functions must have frame pointers. ! 316: Zero means the frame pointer need not be set up (and parms ! 317: may be accessed via the stack pointer) in functions that seem suitable. ! 318: This is computed in `reload', in reload1.c. ! 319: ! 320: Setting this to 1 can't break anything. Since the Pyramid has ! 321: register windows, I don't know if defining this to be zero can ! 322: win anything. It could changed later, if it wins. */ ! 323: #define FRAME_POINTER_REQUIRED 1 ! 324: ! 325: /* Base register for access to arguments of the function. */ ! 326: #define ARG_POINTER_REGNUM 13 /* PYR_GREG(13) */ ! 327: ! 328: /* Register in which static-chain is passed to a function. */ ! 329: /* If needed, Pyramid says to use temporary register 12. */ ! 330: #define STATIC_CHAIN_REGNUM PYR_TREG(12) ! 331: ! 332: /* Register in which address to store a structure value ! 333: is passed to a function. ! 334: On a Pyramid, this is temporary register 0 (TR0). */ ! 335: ! 336: #define STRUCT_VALUE_REGNUM PYR_TREG(0) ! 337: #define STRUCT_VALUE_INCOMING_REGNUM PYR_PREG(0) ! 338: ! 339: /* Define the classes of registers for register constraints in the ! 340: machine description. Also define ranges of constants. ! 341: ! 342: One of the classes must always be named ALL_REGS and include all hard regs. ! 343: If there is more than one class, another class must be named NO_REGS ! 344: and contain no registers. ! 345: ! 346: The name GENERAL_REGS must be the name of a class (or an alias for ! 347: another name such as ALL_REGS). This is the class of registers ! 348: that is allowed by "g" or "r" in a register constraint. ! 349: Also, registers outside this class are allocated only when ! 350: instructions express preferences for them. ! 351: ! 352: The classes must be numbered in nondecreasing order; that is, ! 353: a larger-numbered class must never be contained completely ! 354: in a smaller-numbered class. ! 355: ! 356: For any two classes, it is very desirable that there be another ! 357: class that represents their union. */ ! 358: ! 359: /* The pyramid has only one kind of registers, so NO_REGS and ALL_REGS ! 360: are the only classes. */ ! 361: ! 362: enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; ! 363: ! 364: #define N_REG_CLASSES (int) LIM_REG_CLASSES ! 365: ! 366: /* Since GENERAL_REGS is the same class as ALL_REGS, ! 367: don't give it a different class number; just make it an alias. */ ! 368: ! 369: #define GENERAL_REGS ALL_REGS ! 370: ! 371: /* Give names of register classes as strings for dump file. */ ! 372: ! 373: #define REG_CLASS_NAMES \ ! 374: {"NO_REGS", "ALL_REGS" } ! 375: ! 376: /* Define which registers fit in which classes. ! 377: This is an initializer for a vector of HARD_REG_SET ! 378: of length N_REG_CLASSES. */ ! 379: ! 380: #define REG_CLASS_CONTENTS {{0,0}, {0xffffffff,0xffffffff}} ! 381: ! 382: /* The same information, inverted: ! 383: Return the class number of the smallest class containing ! 384: reg number REGNO. This could be a conditional expression ! 385: or could index an array. */ ! 386: ! 387: #define REGNO_REG_CLASS(REGNO) ALL_REGS ! 388: ! 389: /* The class value for index registers, and the one for base regs. */ ! 390: ! 391: #define BASE_REG_CLASS ALL_REGS ! 392: #define INDEX_REG_CLASS ALL_REGS ! 393: ! 394: /* Get reg_class from a letter such as appears in the machine description. */ ! 395: ! 396: #define REG_CLASS_FROM_LETTER(C) NO_REGS ! 397: ! 398: /* Given an rtx X being reloaded into a reg required to be ! 399: in class CLASS, return the class of reg to actually use. ! 400: In general this is just CLASS; but on some machines ! 401: in some cases it is preferable to use a more restrictive class. */ ! 402: ! 403: #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) ! 404: ! 405: /* Return the maximum number of consecutive registers ! 406: needed to represent mode MODE in a register of class CLASS. */ ! 407: /* On the pyramid, this is always the size of MODE in words, ! 408: since all registers are the same size. */ ! 409: #define CLASS_MAX_NREGS(CLASS, MODE) \ ! 410: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 411: ! 412: /* The letters I, J, K, L and M in a register constraint string ! 413: can be used to stand for particular ranges of immediate operands. ! 414: This macro defines what the ranges are. ! 415: C is the letter, and VALUE is a constant value. ! 416: Return 1 if VALUE is in the range specified by C. ! 417: ! 418: --> For the Pyramid, 'I' can be used for the 6-bit signed integers ! 419: --> (-32 to 31) allowed as immediate short operands in many ! 420: --> instructions. 'J' cane be used for any value that doesn't fit ! 421: --> in 6 bits. */ ! 422: ! 423: #define CONST_OK_FOR_LETTER_P(VALUE, C) \ ! 424: ((C) == 'I' ? (VALUE) >= -32 && (VALUE) < 32 : \ ! 425: (C) == 'J' ? (VALUE) < -32 || (VALUE) >= 32 : \ ! 426: (C) == 'K' ? (VALUE) == 0xff || (VALUE) == 0xffff : 0) ! 427: ! 428: /* Similar, but for floating constants, and defining letters G and H. ! 429: Here VALUE is the CONST_DOUBLE rtx itself. */ ! 430: ! 431: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 ! 432: ! 433: ! 434: /*** Stack layout; function entry, exit and calling. ***/ ! 435: ! 436: /* Define this if pushing a word on the stack ! 437: makes the stack pointer a smaller address. */ ! 438: #define STACK_GROWS_DOWNWARD ! 439: ! 440: /* Define this if the nominal address of the stack frame ! 441: is at the high-address end of the local variables; ! 442: that is, each additional local variable allocated ! 443: goes at a more negative offset in the frame. */ ! 444: #define FRAME_GROWS_DOWNWARD ! 445: ! 446: /* Offset within stack frame to start allocating local variables at. ! 447: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the ! 448: first local allocated. Otherwise, it is the offset to the BEGINNING ! 449: of the first local allocated. */ ! 450: /* FIXME: this used to work when defined as 0. But that makes gnu ! 451: stdargs clobber the first arg. What gives?? */ ! 452: #define STARTING_FRAME_OFFSET 0 ! 453: ! 454: /* Offset of first parameter from the argument pointer register value. */ ! 455: #define FIRST_PARM_OFFSET(FNDECL) 0 ! 456: ! 457: /* Value is the number of bytes of arguments automatically ! 458: popped when returning from a subroutine call. ! 459: FUNTYPE is the data type of the function (as a tree), ! 460: or for a library call it is an identifier node for the subroutine name. ! 461: SIZE is the number of bytes of arguments passed on the stack. ! 462: ! 463: The Pyramid OSx Porting Guide says we are never to do this; ! 464: using RETD in this way violates the Pyramid calling convention. ! 465: We may nevertheless provide this as an option. */ ! 466: ! 467: #define RETURN_POPS_ARGS(FUNTYPE,SIZE) \ ! 468: ((TARGET_RETD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \ ! 469: && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ ! 470: || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ ! 471: == void_type_node))) \ ! 472: ? (SIZE) : 0) ! 473: ! 474: /* Define how to find the value returned by a function. ! 475: VALTYPE is the data type of the value (as a tree). ! 476: If the precise function being called is known, FUNC is its FUNCTION_DECL; ! 477: otherwise, FUNC is 0. */ ! 478: ! 479: /* --> Pyramid has register windows. ! 480: --> The caller sees the return value is in TR0(/TR1) regardless of ! 481: --> its type. */ ! 482: ! 483: #define FUNCTION_VALUE(VALTYPE, FUNC) \ ! 484: gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_TREG(0)) ! 485: ! 486: /* --> but the callee has to leave it in PR0(/PR1) */ ! 487: ! 488: #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \ ! 489: gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_PREG(0)) ! 490: ! 491: /* Define how to find the value returned by a library function ! 492: assuming the value has mode MODE. */ ! 493: ! 494: /* --> On Pyramid the return value is in TR0/TR1 regardless. */ ! 495: ! 496: #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, PYR_TREG(0)) ! 497: ! 498: /* Define this if PCC uses the nonreentrant convention for returning ! 499: structure and union values. */ ! 500: ! 501: #define PCC_STATIC_STRUCT_RETURN ! 502: ! 503: /* 1 if N is a possible register number for a function value ! 504: as seen by the caller. ! 505: ! 506: On the Pyramid, TR0 is the only register thus used. */ ! 507: ! 508: #define FUNCTION_VALUE_REGNO_P(N) ((N) == PYR_TREG(0)) ! 509: ! 510: /* 1 if N is a possible register number for function argument passing. ! 511: On the Pyramid, the first twelve temporary registers are available. */ ! 512: ! 513: /* FIXME FIXME FIXME ! 514: it's not clear whether this macro should be defined from the point ! 515: of view of the caller or the callee. Since it's never actually used ! 516: in GNU CC, the point is somewhat moot :-). ! 517: ! 518: This definition is consistent with register usage in the md's for ! 519: other register-window architectures (sparc and spur). ! 520: */ ! 521: #define FUNCTION_ARG_REGNO_P(N) ((PYR_TREG(0) <= (N)) && ((N) <= PYR_TREG(11))) ! 522: ! 523: /*** Parameter passing: FUNCTION_ARG and FUNCTION_INCOMING_ARG ***/ ! 524: ! 525: /* Define a data type for recording info about an argument list ! 526: during the scan of that argument list. This data type should ! 527: hold all necessary information about the function itself ! 528: and about the args processed so far, enough to enable macros ! 529: such as FUNCTION_ARG to determine where the next arg should go. ! 530: ! 531: On Pyramids, each parameter is passed either completely on the stack ! 532: or completely in registers. No parameter larger than a double may ! 533: be passed in a register. Also, no struct or union may be passed in ! 534: a register, even if it would fit. ! 535: ! 536: So parameters are not necessarily passed "consecutively". ! 537: Thus we need a vector data type: one element to record how many ! 538: parameters have been passed in registers and on the stack, ! 539: respectively. ! 540: ! 541: ((These constraints seem like a gross waste of registers. But if we ! 542: ignore the constraint about structs & unions, we won`t be able to ! 543: freely mix gcc-compiled code and pyr cc-compiled code. It looks ! 544: like better argument passing conventions, and a machine-dependent ! 545: flag to enable them, might be a win.)) */ ! 546: ! 547: ! 548: #define CUMULATIVE_ARGS int ! 549: ! 550: /* Define the number of registers that can hold paramters. ! 551: This macro is used only in other macro definitions below. */ ! 552: #define NPARM_REGS 12 ! 553: ! 554: /* Decide whether or not a parameter can be put in a register. ! 555: (We may still have problems with libcalls. GCC doesn't seem ! 556: to know about anything more than the machine mode. I trust ! 557: structures are never passed to a libcall... ! 558: ! 559: If compiling with -mgnu-stdarg, this definition should make ! 560: functions using the gcc-supplied stdarg, and calls to such ! 561: functions (declared with an arglist ending in"..."), work. ! 562: But such fns won't be able to call pyr cc-compiled ! 563: varargs fns (eg, printf(), _doprnt.) ! 564: ! 565: If compiling with -mnognu-stdarg, this definition should make ! 566: calls to pyr cc-compiled functions work. Functions using ! 567: the gcc-supplied stdarg will be utterly broken. ! 568: There will be no better solution until RMS can be persuaded that ! 569: one is needed. ! 570: ! 571: This macro is used only in other macro definitions below. ! 572: (well, it may be used in pyr.c, because the damn pyramid cc ! 573: can't handle the macro definition of PARAM_SAFE_FOR_REG_P ! */ ! 574: ! 575: ! 576: #define INNER_PARAM_SAFE_HELPER(TYPE) \ ! 577: ((TARGET_GNU_STDARG ? (! TREE_ADDRESSABLE ((tree)TYPE)): 1) \ ! 578: && (TREE_CODE ((tree)TYPE) != RECORD_TYPE) \ ! 579: && (TREE_CODE ((tree)TYPE) != UNION_TYPE)) ! 580: ! 581: #ifdef __GNUC__ ! 582: #define PARAM_SAFE_HELPER(TYPE) \ ! 583: INNER_PARAM_SAFE_HELPER((TYPE)) ! 584: #else ! 585: extern int inner_param_safe_helper(); ! 586: #define PARAM_SAFE_HELPER(TYPE) \ ! 587: inner_param_safe_helper((tree)(TYPE)) ! 588: #endif ! 589: ! 590: /* Be careful with the expression (long) (TYPE) == 0. ! 591: Writing it in more obvious/correct forms makes the Pyr cc ! 592: dump core! */ ! 593: #define PARAM_SAFE_FOR_REG_P(MODE, TYPE, NAMED) \ ! 594: (((MODE) != BLKmode) \ ! 595: && ((TARGET_GNU_STDARG) ? (NAMED) : 1) \ ! 596: && ((((long)(TYPE))==0) || PARAM_SAFE_HELPER((TYPE)))) ! 597: ! 598: /* Initialize a variable CUM of type CUMULATIVE_ARGS ! 599: for a call to a function whose data type is FNTYPE. ! 600: For a library call, FNTYPE is 0. */ ! 601: ! 602: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \ ! 603: ((CUM) = (FNTYPE && !flag_pcc_struct_return && aggregate_value_p (FNTYPE))) ! 604: ! 605: /* Determine where to put an argument to a function. ! 606: Value is zero to push the argument on the stack, ! 607: or a hard register in which to store the argument. ! 608: ! 609: MODE is the argument's machine mode. ! 610: TYPE is the data type of the argument (as a tree). ! 611: This is null for libcalls where that information may ! 612: not be available. ! 613: CUM is a variable of type CUMULATIVE_ARGS which gives info about ! 614: the preceding args and about the function being called. ! 615: NAMED is nonzero if this argument is a named parameter ! 616: (otherwise it is an extra parameter matching an ellipsis). */ ! 617: ! 618: #define FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) \ ! 619: (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ ! 620: ? (NPARM_REGS >= ((CUM) \ ! 621: + ((MODE) == BLKmode \ ! 622: ? (int_size_in_bytes (TYPE) + 3) / 4 \ ! 623: : (GET_MODE_SIZE (MODE) + 3) / 4)) \ ! 624: ? gen_rtx (REG, (MODE), PYR_TREG(CUM)) \ ! 625: : 0) \ ! 626: : 0) ! 627: #ifdef __GNUC__ ! 628: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ! 629: FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) ! 630: #else ! 631: /***************** Avoid bug in Pyramid OSx compiler... ******************/ ! 632: #define FUNCTION_ARG (rtx) pyr_function_arg ! 633: extern void* pyr_function_arg (); ! 634: #endif ! 635: ! 636: /* Define where a function finds its arguments. ! 637: This is different from FUNCTION_ARG because of register windows. */ ! 638: ! 639: #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ ! 640: (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ ! 641: ? (NPARM_REGS >= ((CUM) \ ! 642: + ((MODE) == BLKmode \ ! 643: ? (int_size_in_bytes (TYPE) + 3) / 4 \ ! 644: : (GET_MODE_SIZE (MODE) + 3) / 4)) \ ! 645: ? gen_rtx (REG, (MODE), PYR_PREG(CUM)) \ ! 646: : 0) \ ! 647: : 0) ! 648: ! 649: /* Update the data in CUM to advance over an argument ! 650: of mode MODE and data type TYPE. ! 651: (TYPE is null for libcalls where that information may not be available.) */ ! 652: ! 653: #define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \ ! 654: ((CUM) += (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \ ! 655: ? ((MODE) != BLKmode \ ! 656: ? (GET_MODE_SIZE (MODE) + 3) / 4 \ ! 657: : (int_size_in_bytes (TYPE) + 3) / 4) \ ! 658: : 0)) ! 659: ! 660: /* This macro generates the assembly code for function entry. ! 661: FILE is a stdio stream to output the code to. ! 662: SIZE is an int: how many units of temporary storage to allocate. ! 663: Refer to the array `regs_ever_live' to determine which registers ! 664: to save; `regs_ever_live[I]' is nonzero if register number I ! 665: is ever used in the function. This macro is responsible for ! 666: knowing which registers should not be saved even if used. */ ! 667: ! 668: #if FRAME_POINTER_REQUIRED ! 669: ! 670: /* We always have frame pointers */ ! 671: ! 672: /* Don't set up a frame pointer if it's not referenced. */ ! 673: ! 674: #define FUNCTION_PROLOGUE(FILE, SIZE) \ ! 675: { \ ! 676: int _size = (SIZE) + current_function_pretend_args_size; \ ! 677: if (_size + current_function_args_size != 0 \ ! 678: || current_function_calls_alloca) \ ! 679: { \ ! 680: fprintf (FILE, "\tadsf $%d\n", _size); \ ! 681: if (current_function_pretend_args_size > 0) \ ! 682: fprintf (FILE, "\tsubw $%d,cfp\n", \ ! 683: current_function_pretend_args_size); \ ! 684: } \ ! 685: } ! 686: ! 687: #else /* !FRAME_POINTER_REQUIRED */ ! 688: ! 689: /* Don't set up a frame pointer if `frame_pointer_needed' tells us ! 690: there is no need. Also, don't set up a frame pointer if it's not ! 691: referenced. */ ! 692: ! 693: /* The definition used to be broken. Write a new one. */ ! 694: ! 695: #endif /* !FRAME_POINTER_REQUIRED */ ! 696: ! 697: /* Output assembler code to FILE to increment profiler label # LABELNO ! 698: for profiling a function entry. */ ! 699: #define FUNCTION_PROFILER(FILE, LABELNO) \ ! 700: fprintf (FILE, "\tmova LP%d,tr0\n\tcall mcount\n", (LABELNO)); ! 701: ! 702: /* Output assembler code to FILE to initialize this source file's ! 703: basic block profiling info, if that has not already been done. ! 704: Don't know if this works on Pyrs. */ ! 705: ! 706: #if 0 /* don't do basic_block profiling yet */ ! 707: #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ ! 708: fprintf (FILE, \ ! 709: "\tmtstw LPBX0,tr0\n\tbne LPI%d\n\tmova LP%d,TR0\n\tcall __bb_init_func\nLPI%d:\n", \ ! 710: LABELNO, LABELNO); ! 711: ! 712: /* Output assembler code to increment the count associated with ! 713: the basic block number BLOCKNO. Not sure how to do this on pyrs. */ ! 714: #define BLOCK_PROFILER(FILE, BLOCKNO) \ ! 715: fprintf (FILE, "\taddw", 4 * BLOCKNO) ! 716: #endif /* don't do basic_block profiling yet */ ! 717: ! 718: /* When returning from a function, the stack pointer does not matter ! 719: (as long as there is a frame pointer). */ ! 720: ! 721: /* This should return non-zero when we really set up a frame pointer. ! 722: Otherwise, GCC is directed to preserve sp by returning zero. */ ! 723: extern int current_function_pretend_args_size; ! 724: extern int current_function_args_size; ! 725: extern int current_function_calls_alloca; ! 726: #define EXIT_IGNORE_STACK \ ! 727: (get_frame_size () + current_function_pretend_args_size \ ! 728: + current_function_args_size != 0 \ ! 729: || current_function_calls_alloca) \ ! 730: ! 731: /* If the memory address ADDR is relative to the frame pointer, ! 732: correct it to be relative to the stack pointer instead. ! 733: This is for when we don't use a frame pointer. ! 734: ADDR should be a variable name. */ ! 735: ! 736: /*** Addressing modes, and classification of registers for them. ***/ ! 737: ! 738: /* #define HAVE_POST_INCREMENT */ /* pyramid has none of these */ ! 739: /* #define HAVE_POST_DECREMENT */ ! 740: ! 741: /* #define HAVE_PRE_DECREMENT */ ! 742: /* #define HAVE_PRE_INCREMENT */ ! 743: ! 744: /* Macros to check register numbers against specific register classes. */ ! 745: ! 746: /* These assume that REGNO is a hard or pseudo reg number. ! 747: They give nonzero only if REGNO is a hard reg of the suitable class ! 748: or a pseudo reg currently allocated to a suitable hard reg. ! 749: Since they use reg_renumber, they are safe only once reg_renumber ! 750: has been allocated, which happens in local-alloc.c. */ ! 751: ! 752: /* All registers except gr0 OK as index or base registers. */ ! 753: ! 754: #define REGNO_OK_FOR_BASE_P(regno) \ ! 755: ((0 < (regno) && (regno) < FIRST_PSEUDO_REGISTER) || reg_renumber[regno] > 0) ! 756: ! 757: #define REGNO_OK_FOR_INDEX_P(regno) \ ! 758: ((0 < (regno) && (regno) < FIRST_PSEUDO_REGISTER) || reg_renumber[regno] > 0) ! 759: ! 760: /* Maximum number of registers that can appear in a valid memory address. */ ! 761: ! 762: #define MAX_REGS_PER_ADDRESS 2 /* check MAX_REGS_PER_ADDRESS */ ! 763: ! 764: /* 1 if X is an rtx for a constant that is a valid address. */ ! 765: ! 766: #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) ! 767: ! 768: /* Nonzero if the constant value X is a legitimate general operand. ! 769: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ ! 770: ! 771: #define LEGITIMATE_CONSTANT_P(X) 1 ! 772: ! 773: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx ! 774: and check its validity for a certain class. ! 775: We have two alternate definitions for each of them. ! 776: The usual definition accepts all pseudo regs; the other rejects ! 777: them unless they have been allocated suitable hard regs. ! 778: The symbol REG_OK_STRICT causes the latter definition to be used. ! 779: ! 780: Most source files want to accept pseudo regs in the hope that ! 781: they will get allocated to the class that the insn wants them to be in. ! 782: Source files for reload pass need to be strict. ! 783: After reload, it makes no difference, since pseudo regs have ! 784: been eliminated by then. */ ! 785: ! 786: #ifndef REG_OK_STRICT ! 787: ! 788: /* Nonzero if X is a hard reg that can be used as an index ! 789: or if it is a pseudo reg. */ ! 790: #define REG_OK_FOR_INDEX_P(X) 1 ! 791: /* Nonzero if X is a hard reg that can be used as a base reg ! 792: or if it is a pseudo reg. */ ! 793: #define REG_OK_FOR_BASE_P(X) 1 ! 794: ! 795: #else ! 796: ! 797: /* Nonzero if X is a hard reg that can be used as an index. */ ! 798: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) ! 799: /* Nonzero if X is a hard reg that can be used as a base reg. */ ! 800: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) ! 801: ! 802: #endif ! 803: ! 804: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression ! 805: that is a valid memory address for an instruction. ! 806: The MODE argument is the machine mode for the MEM expression ! 807: that wants to use this address. ! 808: ! 809: The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, ! 810: except for CONSTANT_ADDRESS_P which is actually machine-independent. */ ! 811: ! 812: ! 813: /* Go to ADDR if X is indexable -- ie, neither indexed nor offset. ! 814: Note that X is indexable iff x is offset. */ ! 815: #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \ ! 816: { register rtx xfoob = (X); \ ! 817: if ((CONSTANT_ADDRESS_P (xfoob)) \ ! 818: || (GET_CODE (xfoob) == REG && (REG_OK_FOR_BASE_P (xfoob)))) \ ! 819: goto ADDR; \ ! 820: } ! 821: ! 822: ! 823: /* Go to label ADDR if X is a valid address that doesn't use indexing. ! 824: This is so if X is either a simple address, or the contents of a register ! 825: plus an offset. ! 826: This macro also gets used in output-pyramid.h in the function that ! 827: recognizes non-indexed operands. */ ! 828: ! 829: #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \ ! 830: { \ ! 831: if (GET_CODE (X) == REG) \ ! 832: goto ADDR; \ ! 833: GO_IF_INDEXABLE_ADDRESS (X, ADDR); \ ! 834: if (GET_CODE (X) == PLUS) \ ! 835: { /* Handle offset(reg) represented with offset on left */ \ ! 836: if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \ ! 837: { if (GET_CODE (XEXP (X, 1)) == REG \ ! 838: && REG_OK_FOR_BASE_P (XEXP (X, 1))) \ ! 839: goto ADDR; \ ! 840: } \ ! 841: /* Handle offset(reg) represented with offset on right */ \ ! 842: if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \ ! 843: { if (GET_CODE (XEXP (X, 0)) == REG \ ! 844: && REG_OK_FOR_BASE_P (XEXP (X, 0))) \ ! 845: goto ADDR; \ ! 846: } \ ! 847: } \ ! 848: } ! 849: ! 850: /* 1 if PROD is either a reg or a reg times a valid offset multiplier ! 851: (ie, 2, 4, or 8). ! 852: This macro's expansion uses the temporary variables xfoo0 and xfoo1 ! 853: that must be declared in the surrounding context. */ ! 854: #define INDEX_TERM_P(PROD, MODE) \ ! 855: ((GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \ ! 856: || (GET_CODE (PROD) == MULT \ ! 857: && \ ! 858: (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \ ! 859: ((GET_CODE (xfoo0) == CONST_INT \ ! 860: && (INTVAL (xfoo0) == 1 \ ! 861: || INTVAL (xfoo0) == 2 \ ! 862: || INTVAL (xfoo0) == 4 \ ! 863: || INTVAL (xfoo0) == 8) \ ! 864: && GET_CODE (xfoo1) == REG \ ! 865: && REG_OK_FOR_INDEX_P (xfoo1)) \ ! 866: || \ ! 867: (GET_CODE (xfoo1) == CONST_INT \ ! 868: && (INTVAL (xfoo1) == 1 \ ! 869: || INTVAL (xfoo1) == 2 \ ! 870: || INTVAL (xfoo1) == 4 \ ! 871: || INTVAL (xfoo1) == 8) \ ! 872: && GET_CODE (xfoo0) == REG \ ! 873: && REG_OK_FOR_INDEX_P (xfoo0)))))) ! 874: ! 875: ! 876: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ! 877: { register rtx xone, xtwo, xfoo0, xfoo1; \ ! 878: GO_IF_NONINDEXED_ADDRESS (X, ADDR); \ ! 879: if (TARGET_INDEX && GET_CODE (X) == PLUS) \ ! 880: { \ ! 881: /* Handle <address>[index] represented with index-sum outermost */\ ! 882: xone = XEXP (X, 0); \ ! 883: xtwo = XEXP (X, 1); \ ! 884: if (INDEX_TERM_P (xone, MODE)) \ ! 885: { GO_IF_INDEXABLE_ADDRESS (xtwo, ADDR); } \ ! 886: /* Handle <address>[index] represented with index-sum innermost */\ ! 887: if (INDEX_TERM_P (xtwo, MODE)) \ ! 888: { GO_IF_INDEXABLE_ADDRESS (xone, ADDR); } \ ! 889: } \ ! 890: } ! 891: ! 892: /* Try machine-dependent ways of modifying an illegitimate address ! 893: to be legitimate. If we find one, return the new, valid address. ! 894: This macro is used in only one place: `memory_address' in explow.c. ! 895: ! 896: OLDX is the address as it was before break_out_memory_refs was called. ! 897: In some cases it is useful to look at this to decide what needs to be done. ! 898: ! 899: MODE and WIN are passed so that this macro can use ! 900: GO_IF_LEGITIMATE_ADDRESS. ! 901: ! 902: It is always safe for this macro to do nothing. It exists to recognize ! 903: opportunities to optimize the output. ! 904: ! 905: --> FIXME: We haven't yet figured out what optimizations are useful ! 906: --> on Pyramids. */ ! 907: ! 908: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} ! 909: ! 910: /* Go to LABEL if ADDR (a legitimate address expression) ! 911: has an effect that depends on the machine mode it is used for. ! 912: There don't seem to be any such modes on pyramids. */ ! 913: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) ! 914: ! 915: /*** Miscellaneous Parameters ***/ ! 916: ! 917: /* Specify the machine mode that this machine uses ! 918: for the index in the tablejump instruction. */ ! 919: #define CASE_VECTOR_MODE SImode ! 920: ! 921: /* Define this if the tablejump instruction expects the table ! 922: to contain offsets from the address of the table. ! 923: Do not define this if the table should contain absolute addresses. */ ! 924: /*#define CASE_VECTOR_PC_RELATIVE*/ ! 925: ! 926: /* Specify the tree operation to be used to convert reals to integers. */ ! 927: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR ! 928: ! 929: /* This is the kind of divide that is easiest to do in the general case. ! 930: It's just a guess. I have no idea of insn cost on pyrs. */ ! 931: #define EASY_DIV_EXPR TRUNC_DIV_EXPR ! 932: ! 933: /* Define this as 1 if `char' should by default be signed; else as 0. */ ! 934: #define DEFAULT_SIGNED_CHAR 1 ! 935: ! 936: /* This flag, if defined, says the same insns that convert to a signed fixnum ! 937: also convert validly to an unsigned one. */ ! 938: /* This is untrue for pyramid. The cvtdw instruction generates a trap ! 939: for input operands that are out-of-range for a signed int. */ ! 940: /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */ ! 941: ! 942: /* Define this macro if the preprocessor should silently ignore ! 943: '#sccs' directives. */ ! 944: /* #define SCCS_DIRECTIVE */ ! 945: ! 946: /* Define this macro if the preprocessor should silently ignore ! 947: '#ident' directives. */ ! 948: /* #define IDENT_DIRECTIVE */ ! 949: ! 950: /* Max number of bytes we can move from memory to memory ! 951: in one reasonably fast instruction. */ ! 952: #define MOVE_MAX 8 ! 953: ! 954: /* Define this if zero-extension is slow (more than one real instruction). */ ! 955: /* #define SLOW_ZERO_EXTEND */ ! 956: ! 957: /* number of bits in an 'int' on target machine */ ! 958: #define INT_TYPE_SIZE 32 ! 959: ! 960: /* 1 if byte access requires more than one instruction */ ! 961: #define SLOW_BYTE_ACCESS 0 ! 962: ! 963: /* Define if shifts truncate the shift count ! 964: which implies one can omit a sign-extension or zero-extension ! 965: of a shift count. */ ! 966: #define SHIFT_COUNT_TRUNCATED ! 967: ! 968: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits ! 969: is done just by pretending it is already truncated. */ ! 970: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 ! 971: ! 972: /* Define this macro if it is as good or better to call a constant ! 973: function address than to call an address kept in a register. */ ! 974: /* #define NO_FUNCTION_CSE */ ! 975: ! 976: /* When a prototype says `char' or `short', really pass an `int'. */ ! 977: #define PROMOTE_PROTOTYPES ! 978: ! 979: /* There are no flag store insns on a pyr. */ ! 980: /* #define STORE_FLAG_VALUE */ ! 981: ! 982: /* Specify the machine mode that pointers have. ! 983: After generation of rtl, the compiler makes no further distinction ! 984: between pointers and any other objects of this machine mode. */ ! 985: #define Pmode SImode ! 986: ! 987: /* A function address in a call instruction ! 988: is a byte address (for indexing purposes) ! 989: so give the MEM rtx a byte's mode. */ ! 990: #define FUNCTION_MODE QImode ! 991: ! 992: /* Compute the cost of computing a constant rtl expression RTX ! 993: whose rtx-code is CODE. The body of this macro is a portion ! 994: of a switch statement. If the code is computed here, ! 995: return it with a return statement. Otherwise, break from the switch. */ ! 996: ! 997: #define CONST_COSTS(RTX,CODE) \ ! 998: case CONST_INT: \ ! 999: if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \ ! 1000: case CONST: \ ! 1001: case LABEL_REF: \ ! 1002: case SYMBOL_REF: \ ! 1003: return 4; \ ! 1004: case CONST_DOUBLE: \ ! 1005: return 6; ! 1006: ! 1007: /*** Condition Code Information ***/ ! 1008: ! 1009: /* Tell final.c how to eliminate redundant test instructions. */ ! 1010: ! 1011: /* Here we define machine-dependent flags and fields in cc_status ! 1012: (see `conditions.h'). No extra ones are needed for the pyr. */ ! 1013: ! 1014: /* Store in cc_status the expressions ! 1015: that the condition codes will describe ! 1016: after execution of an instruction whose pattern is EXP. ! 1017: Do not alter them if the instruction would not alter the cc's. */ ! 1018: ! 1019: /* This is a very simple definition of NOTICE_UPDATE_CC. ! 1020: Many cases can be optimized, to improve condition code usage. ! 1021: Maybe we should handle this entirely in the md, since it complicated ! 1022: to describe the way pyr sets cc. */ ! 1023: ! 1024: #define TRULY_UNSIGNED_COMPARE_P(X) \ ! 1025: (X == GEU || X == GTU || X == LEU || X == LTU) ! 1026: #define CC_VALID_FOR_UNSIGNED 2 ! 1027: ! 1028: #define CC_STATUS_MDEP_INIT cc_status.mdep = 0 ! 1029: ! 1030: #define NOTICE_UPDATE_CC(EXP, INSN) \ ! 1031: notice_update_cc(EXP, INSN) ! 1032: ! 1033: /*** Output of Assembler Code ***/ ! 1034: ! 1035: /* Output at beginning of assembler file. */ ! 1036: ! 1037: #define ASM_FILE_START(FILE) \ ! 1038: fprintf (FILE, ((TARGET_UNIX_ASM)? "" : "#NO_APP\n")); ! 1039: ! 1040: /* Output to assembler file text saying following lines ! 1041: may contain character constants, extra white space, comments, etc. */ ! 1042: ! 1043: #define ASM_APP_ON ((TARGET_UNIX_ASM) ? "" : "#APP\n") ! 1044: ! 1045: /* Output to assembler file text saying following lines ! 1046: no longer contain unusual constructs. */ ! 1047: ! 1048: #define ASM_APP_OFF ((TARGET_UNIX_ASM) ? "" : "#NO_APP\n") ! 1049: ! 1050: /* Output before read-only data. */ ! 1051: ! 1052: #define TEXT_SECTION_ASM_OP ".text" ! 1053: ! 1054: /* Output before writable data. */ ! 1055: ! 1056: #define DATA_SECTION_ASM_OP ".data" ! 1057: ! 1058: /* How to refer to registers in assembler output. ! 1059: This sequence is indexed by compiler's hard-register-number (see above). */ ! 1060: ! 1061: #define REGISTER_NAMES \ ! 1062: {"gr0", "gr1", "gr2", "gr3", "gr4", "gr5", "gr6", "gr7", "gr8", \ ! 1063: "gr9", "gr10", "gr11", "logpsw", "cfp", "sp", "pc", \ ! 1064: "pr0", "pr1", "pr2", "pr3", "pr4", "pr5", "pr6", "pr7", \ ! 1065: "pr8", "pr9", "pr10", "pr11", "pr12", "pr13", "pr14", "pr15", \ ! 1066: "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", \ ! 1067: "lr8", "lr9", "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", \ ! 1068: "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", \ ! 1069: "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"} ! 1070: ! 1071: /* How to renumber registers for dbx and gdb. */ ! 1072: ! 1073: #define DBX_REGISTER_NUMBER(REGNO) (REGNO) ! 1074: ! 1075: /* Our preference is for dbx rather than sdb. ! 1076: Yours may be different. */ ! 1077: #define DBX_DEBUGGING_INFO ! 1078: /* #define SDB_DEBUGGING_INFO */ ! 1079: ! 1080: /* Don't use the `xsfoo;' construct in DBX output; this system ! 1081: doesn't support it. */ ! 1082: ! 1083: #define DBX_NO_XREFS 1 ! 1084: ! 1085: /* Do not break .stabs pseudos into continuations. */ ! 1086: ! 1087: #define DBX_CONTIN_LENGTH 0 ! 1088: ! 1089: /* This is the char to use for continuation (in case we need to turn ! 1090: continuation back on). */ ! 1091: ! 1092: #define DBX_CONTIN_CHAR '?' ! 1093: ! 1094: /* This is how to output the definition of a user-level label named NAME, ! 1095: such as the label on a static function or variable NAME. */ ! 1096: ! 1097: #define ASM_OUTPUT_LABEL(FILE,NAME) \ ! 1098: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) ! 1099: ! 1100: /* This is how to output a command to make the user-level label named NAME ! 1101: defined for reference from other files. */ ! 1102: ! 1103: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ ! 1104: do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) ! 1105: ! 1106: /* This is how to output a reference to a user-level label named NAME. */ ! 1107: ! 1108: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 1109: fprintf (FILE, "_%s", NAME); ! 1110: ! 1111: /* This is how to output an internal numbered label where ! 1112: PREFIX is the class of label and NUM is the number within the class. */ ! 1113: ! 1114: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 1115: fprintf (FILE, "%s%d:\n", PREFIX, NUM) ! 1116: ! 1117: /* This is how to store into the string LABEL ! 1118: the symbol_ref name of an internal numbered label where ! 1119: PREFIX is the class of label and NUM is the number within the class. ! 1120: This is suitable for output with `assemble_name'. */ ! 1121: ! 1122: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ ! 1123: sprintf (LABEL, "*%s%d", PREFIX, NUM) ! 1124: ! 1125: /* This is how to output an assembler line defining a `double' constant. */ ! 1126: ! 1127: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ ! 1128: fprintf (FILE, "\t.double 0d%.20e\n", (VALUE)) ! 1129: ! 1130: /* This is how to output an assembler line defining a `float' constant. */ ! 1131: ! 1132: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ ! 1133: fprintf (FILE, "\t.float 0f%.20e\n", (VALUE)) ! 1134: ! 1135: /* This is how to output an assembler line defining an `int' constant. */ ! 1136: ! 1137: #define ASM_OUTPUT_INT(FILE,VALUE) \ ! 1138: ( fprintf (FILE, "\t.word "), \ ! 1139: output_addr_const (FILE, (VALUE)), \ ! 1140: fprintf (FILE, "\n")) ! 1141: ! 1142: /* Likewise for `char' and `short' constants. */ ! 1143: ! 1144: #define ASM_OUTPUT_SHORT(FILE,VALUE) \ ! 1145: ( fprintf (FILE, "\t.half "), \ ! 1146: output_addr_const (FILE, (VALUE)), \ ! 1147: fprintf (FILE, "\n")) ! 1148: ! 1149: #define ASM_OUTPUT_CHAR(FILE,VALUE) \ ! 1150: ( fprintf (FILE, "\t.byte "), \ ! 1151: output_addr_const (FILE, (VALUE)), \ ! 1152: fprintf (FILE, "\n")) ! 1153: ! 1154: /* This is how to output an assembler line for a numeric constant byte. */ ! 1155: ! 1156: #define ASM_OUTPUT_BYTE(FILE,VALUE) \ ! 1157: fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) ! 1158: ! 1159: /* This is how to output an insn to push a register on the stack. ! 1160: It need not be very fast code. */ ! 1161: ! 1162: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ ! 1163: fprintf (FILE, "\tsubw $4,sp\n\tmovw %s,(sp)\n", reg_names[REGNO]) ! 1164: ! 1165: /* This is how to output an insn to pop a register from the stack. ! 1166: It need not be very fast code. */ ! 1167: ! 1168: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ ! 1169: fprintf (FILE, "\tmovw (sp),%s\n\taddw $4,sp\n", reg_names[REGNO]) ! 1170: ! 1171: /* Store in OUTPUT a string (made with alloca) containing ! 1172: an assembler-name for a local static variable named NAME. ! 1173: LABELNO is an integer which is different for each call. */ ! 1174: ! 1175: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ! 1176: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ ! 1177: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) ! 1178: ! 1179: /* This is how to output an element of a case-vector that is absolute. */ ! 1180: ! 1181: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ! 1182: fprintf (FILE, "\t.word L%d\n", VALUE) ! 1183: ! 1184: /* This is how to output an element of a case-vector that is relative. */ ! 1185: ! 1186: ! 1187: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ! 1188: fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL) ! 1189: ! 1190: /* This is how to output an assembler line ! 1191: that says to advance the location counter ! 1192: to a multiple of 2**LOG bytes. ! 1193: ! 1194: On Pyramids, the text segment must always be word aligned. ! 1195: On Pyramids, .align takes only args between 2 and 5. ! 1196: */ ! 1197: ! 1198: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 1199: fprintf (FILE, "\t.align %d\n", (LOG) < 2 ? 2 : (LOG)) ! 1200: ! 1201: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 1202: fprintf (FILE, "\t.space %u\n", (SIZE)) ! 1203: ! 1204: /* This says how to output an assembler line ! 1205: to define a global common symbol. */ ! 1206: ! 1207: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 1208: ( fputs (".comm ", (FILE)), \ ! 1209: assemble_name ((FILE), (NAME)), \ ! 1210: fprintf ((FILE), ",%u\n", (ROUNDED))) ! 1211: ! 1212: /* This says how to output an assembler line ! 1213: to define a local common symbol. */ ! 1214: ! 1215: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 1216: ( fputs (".lcomm ", (FILE)), \ ! 1217: assemble_name ((FILE), (NAME)), \ ! 1218: fprintf ((FILE), ",%u\n", (ROUNDED))) ! 1219: ! 1220: /* Define the parentheses used to group arithmetic operations ! 1221: in assembler code. */ ! 1222: ! 1223: #define ASM_OPEN_PAREN "(" ! 1224: #define ASM_CLOSE_PAREN ")" ! 1225: ! 1226: /* Define results of standard character escape sequences. */ ! 1227: #define TARGET_BELL 007 ! 1228: #define TARGET_BS 010 ! 1229: #define TARGET_TAB 011 ! 1230: #define TARGET_NEWLINE 012 ! 1231: #define TARGET_VT 013 ! 1232: #define TARGET_FF 014 ! 1233: #define TARGET_CR 015 ! 1234: ! 1235: /* Print operand X (an rtx) in assembler syntax to file FILE. ! 1236: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. ! 1237: For `%' followed by punctuation, CODE is the punctuation and X is null. ! 1238: On the Pyr, we support the conventional CODE characters: ! 1239: ! 1240: 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex) ! 1241: which are never used. */ ! 1242: ! 1243: /* FIXME : should be more robust with CONST_DOUBLE. */ ! 1244: ! 1245: #define PRINT_OPERAND(FILE, X, CODE) \ ! 1246: { if (GET_CODE (X) == REG) \ ! 1247: fprintf (FILE, "%s", reg_names [REGNO (X)]); \ ! 1248: \ ! 1249: else if (GET_CODE (X) == MEM) \ ! 1250: output_address (XEXP (X, 0)); \ ! 1251: \ ! 1252: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \ ! 1253: { union { double d; int i[2]; } u; \ ! 1254: union { float f; int i; } u1; \ ! 1255: u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \ ! 1256: u1.f = u.d; \ ! 1257: if (CODE == 'f') \ ! 1258: fprintf (FILE, "$0f%.0e", u1.f); \ ! 1259: else \ ! 1260: fprintf (FILE, "$0x%x", u1.i); } \ ! 1261: \ ! 1262: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != DImode) \ ! 1263: { union { double d; int i[2]; } u; \ ! 1264: u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \ ! 1265: fprintf (FILE, "$0d%.20e", u.d); } \ ! 1266: \ ! 1267: else if (CODE == 'N') \ ! 1268: switch (GET_CODE (X)) \ ! 1269: { \ ! 1270: case EQ: fputs ("eq", FILE); break; \ ! 1271: case NE: fputs ("ne", FILE); break; \ ! 1272: case GT: \ ! 1273: case GTU: fputs ("gt", FILE); break; \ ! 1274: case LT: \ ! 1275: case LTU: fputs ("lt", FILE); break; \ ! 1276: case GE: \ ! 1277: case GEU: fputs ("ge", FILE); break; \ ! 1278: case LE: \ ! 1279: case LEU: fputs ("le", FILE); break; \ ! 1280: } \ ! 1281: \ ! 1282: else if (CODE == 'C') \ ! 1283: switch (GET_CODE (X)) \ ! 1284: { \ ! 1285: case EQ: fputs ("ne", FILE); break; \ ! 1286: case NE: fputs ("eq", FILE); break; \ ! 1287: case GT: \ ! 1288: case GTU: fputs ("le", FILE); break; \ ! 1289: case LT: \ ! 1290: case LTU: fputs ("ge", FILE); break; \ ! 1291: case GE: \ ! 1292: case GEU: fputs ("lt", FILE); break; \ ! 1293: case LE: \ ! 1294: case LEU: fputs ("gt", FILE); break; \ ! 1295: } \ ! 1296: \ ! 1297: else if (CODE == 'R') \ ! 1298: switch (GET_CODE (X)) \ ! 1299: { \ ! 1300: case EQ: fputs ("eq", FILE); break; \ ! 1301: case NE: fputs ("ne", FILE); break; \ ! 1302: case GT: \ ! 1303: case GTU: fputs ("lt", FILE); break; \ ! 1304: case LT: \ ! 1305: case LTU: fputs ("gt", FILE); break; \ ! 1306: case GE: \ ! 1307: case GEU: fputs ("le", FILE); break; \ ! 1308: case LE: \ ! 1309: case LEU: fputs ("ge", FILE); break; \ ! 1310: } \ ! 1311: \ ! 1312: else { putc ('$', FILE); output_addr_const (FILE, X); } \ ! 1313: } ! 1314: ! 1315: /* Print a memory operand whose address is ADDR, on file FILE. */ ! 1316: /* This is horrendously complicated. */ ! 1317: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ ! 1318: { \ ! 1319: register rtx reg1, reg2, breg, ireg; \ ! 1320: register rtx addr = ADDR; \ ! 1321: rtx offset, scale; \ ! 1322: retry: \ ! 1323: switch (GET_CODE (addr)) \ ! 1324: { \ ! 1325: case MEM: \ ! 1326: fprintf (stderr, "bad Mem "); debug_rtx (addr); \ ! 1327: addr = XEXP (addr, 0); \ ! 1328: abort (); \ ! 1329: case REG: \ ! 1330: fprintf (FILE, "(%s)", reg_names [REGNO (addr)]); \ ! 1331: break; \ ! 1332: case PLUS: \ ! 1333: reg1 = 0; reg2 = 0; \ ! 1334: ireg = 0; breg = 0; \ ! 1335: offset = 0; \ ! 1336: if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \ ! 1337: || GET_CODE (XEXP (addr, 0)) == MEM) \ ! 1338: { \ ! 1339: offset = XEXP (addr, 0); \ ! 1340: addr = XEXP (addr, 1); \ ! 1341: } \ ! 1342: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \ ! 1343: || GET_CODE (XEXP (addr, 1)) == MEM) \ ! 1344: { \ ! 1345: offset = XEXP (addr, 1); \ ! 1346: addr = XEXP (addr, 0); \ ! 1347: } \ ! 1348: if (GET_CODE (addr) != PLUS) ; \ ! 1349: else if (GET_CODE (XEXP (addr, 0)) == MULT) \ ! 1350: { \ ! 1351: reg1 = XEXP (addr, 0); \ ! 1352: addr = XEXP (addr, 1); \ ! 1353: } \ ! 1354: else if (GET_CODE (XEXP (addr, 1)) == MULT) \ ! 1355: { \ ! 1356: reg1 = XEXP (addr, 1); \ ! 1357: addr = XEXP (addr, 0); \ ! 1358: } \ ! 1359: else if (GET_CODE (XEXP (addr, 0)) == REG) \ ! 1360: { \ ! 1361: reg1 = XEXP (addr, 0); \ ! 1362: addr = XEXP (addr, 1); \ ! 1363: } \ ! 1364: else if (GET_CODE (XEXP (addr, 1)) == REG) \ ! 1365: { \ ! 1366: reg1 = XEXP (addr, 1); \ ! 1367: addr = XEXP (addr, 0); \ ! 1368: } \ ! 1369: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) \ ! 1370: { \ ! 1371: if (reg1 == 0) \ ! 1372: reg1 = addr; \ ! 1373: else \ ! 1374: reg2 = addr; \ ! 1375: addr = 0; \ ! 1376: } \ ! 1377: if (offset != 0) \ ! 1378: { \ ! 1379: if (addr != 0) { \ ! 1380: fprintf (stderr, "\nBad addr "); debug_rtx (addr); \ ! 1381: abort ();} \ ! 1382: addr = offset; \ ! 1383: } \ ! 1384: if (reg1 != 0 && GET_CODE (reg1) == MULT) \ ! 1385: { breg = reg2; ireg = reg1; } \ ! 1386: else if (reg2 != 0 && GET_CODE (reg2) == MULT) \ ! 1387: { breg = reg1; ireg = reg2; } \ ! 1388: else if (reg2 != 0 || GET_CODE (addr) == MEM) \ ! 1389: { breg = reg2; ireg = reg1; } \ ! 1390: else \ ! 1391: { breg = reg1; ireg = reg2; } \ ! 1392: if (addr != 0) \ ! 1393: output_address (offset); \ ! 1394: if (breg != 0) \ ! 1395: { if (GET_CODE (breg) != REG) \ ! 1396: { \ ! 1397: fprintf (stderr, "bad Breg"); debug_rtx (addr); \ ! 1398: abort (); \ ! 1399: } \ ! 1400: fprintf (FILE, "(%s)", reg_names[REGNO (breg)]); } \ ! 1401: if (ireg != 0) \ ! 1402: { \ ! 1403: if (GET_CODE (ireg) == MULT) \ ! 1404: { \ ! 1405: scale = XEXP (ireg, 1); \ ! 1406: ireg = XEXP (ireg, 0); \ ! 1407: if (GET_CODE (ireg) != REG) \ ! 1408: { register rtx tem; \ ! 1409: tem = ireg; ireg = scale; scale = tem; \ ! 1410: } \ ! 1411: if (GET_CODE (ireg) != REG) { \ ! 1412: fprintf (stderr, "bad idx "); debug_rtx (addr); \ ! 1413: abort (); } \ ! 1414: if ((GET_CODE (scale) == CONST_INT) && (INTVAL(scale) >= 1))\ ! 1415: fprintf (FILE, "[%s*0x%x]", reg_names[REGNO (ireg)], \ ! 1416: INTVAL(scale)); \ ! 1417: else \ ! 1418: fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \ ! 1419: } \ ! 1420: else if (GET_CODE (ireg) == REG) \ ! 1421: fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \ ! 1422: else \ ! 1423: { \ ! 1424: fprintf (stderr, "Not indexed at all!"); debug_rtx (addr);\ ! 1425: abort (); \ ! 1426: } \ ! 1427: } \ ! 1428: break; \ ! 1429: default: \ ! 1430: output_addr_const (FILE, addr); \ ! 1431: } \ ! 1432: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.