|
|
1.1 ! root 1: /* Definitions of target machine for GNU compiler. Elxsi version. ! 2: Copyright (C) 1987, 1988, 1992 Free Software Foundation, Inc. ! 3: This port, done by Mike Stump <[email protected]> in 1988, and is the first ! 4: 64 bit port of GNU CC. ! 5: Based upon the VAX port. ! 6: ! 7: This file is part of GNU CC. ! 8: ! 9: GNU CC is free software; you can redistribute it and/or modify ! 10: it under the terms of the GNU General Public License as published by ! 11: the Free Software Foundation; either version 1, or (at your option) ! 12: any later version. ! 13: ! 14: GNU CC is distributed in the hope that it will be useful, ! 15: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 17: GNU General Public License for more details. ! 18: ! 19: You should have received a copy of the GNU General Public License ! 20: along with GNU CC; see the file COPYING. If not, write to ! 21: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! 22: ! 23: ! 24: /* Names to predefine in the preprocessor for this target machine. */ ! 25: ! 26: #define CPP_PREDEFINES "-Delxsi -Dunix -Asystem(unix) -Acpu(elxsi) -Amachine(elxsi)" ! 27: ! 28: /* Print subsidiary information on the compiler version in use. */ ! 29: ! 30: #define TARGET_VERSION fprintf (stderr, " (elxsi)"); ! 31: ! 32: /* Run-time compilation parameters selecting different hardware subsets. */ ! 33: ! 34: extern int target_flags; ! 35: ! 36: /* Macros used in the machine description to test the flags. */ ! 37: ! 38: /* Nonzero if compiling code that Unix assembler can assemble. */ ! 39: #define TARGET_UNIX_ASM (target_flags & 1) ! 40: ! 41: ! 42: /* Macro to define tables used to set the flags. ! 43: This is a list in braces of pairs in braces, ! 44: each pair being { "NAME", VALUE } ! 45: where VALUE is the bits to set or minus the bits to clear. ! 46: An empty string NAME is used to identify the default VALUE. */ ! 47: ! 48: #define TARGET_SWITCHES \ ! 49: { {"unix", 1}, \ ! 50: {"embos", -1}, \ ! 51: { "", TARGET_DEFAULT}} ! 52: ! 53: /* Default target_flags if no switches specified. */ ! 54: ! 55: #ifndef TARGET_DEFAULT ! 56: #define TARGET_DEFAULT 1 ! 57: #endif ! 58: ! 59: /* Target machine storage layout */ ! 60: ! 61: /* Define this if most significant bit is lowest numbered ! 62: in instructions that operate on numbered bit-fields. ! 63: This is not true on the vax. */ ! 64: #define BITS_BIG_ENDIAN 0 ! 65: ! 66: /* Define this if most significant byte of a word is the lowest numbered. */ ! 67: #define BYTES_BIG_ENDIAN 1 ! 68: ! 69: /* Define this if most significant word of a multiword number is numbered. */ ! 70: #define WORDS_BIG_ENDIAN 1 ! 71: ! 72: /* Number of bits in an addressable storage unit */ ! 73: #define BITS_PER_UNIT 8 ! 74: ! 75: /* Width in bits of a "word", which is the contents of a machine register. ! 76: Note that this is not necessarily the width of data type `int'; ! 77: if using 16-bit ints on a 68000, this would still be 32. ! 78: But on a machine with 16-bit registers, this would be 16. */ ! 79: #define BITS_PER_WORD 64 ! 80: #define Rmode DImode ! 81: ! 82: #define INT_TYPE_SIZE 32 ! 83: ! 84: #define LONG_TYPE_SIZE 32 ! 85: ! 86: #define LONG_LONG_TYPE_SIZE 64 ! 87: ! 88: #define FLOAT_TYPE_SIZE 32 ! 89: ! 90: #define DOUBLE_TYPE_SIZE 64 ! 91: ! 92: #define LONG_DOUBLE_TYPE_SIZE 64 ! 93: ! 94: /* Width of a word, in units (bytes). */ ! 95: #define UNITS_PER_WORD 8 ! 96: ! 97: /* Width in bits of a pointer. ! 98: See also the macro `Pmode' defined below. */ ! 99: #define POINTER_SIZE 32 ! 100: ! 101: /* Allocation boundary (in *bits*) for storing pointers in memory. */ ! 102: #define POINTER_BOUNDARY 32 ! 103: ! 104: /* Allocation boundary (in *bits*) for storing arguments in argument list. */ ! 105: #define PARM_BOUNDARY 32 ! 106: ! 107: /* Allocation boundary (in *bits*) for the code of a function. */ ! 108: #define FUNCTION_BOUNDARY 8 ! 109: ! 110: /* Alignment of field after `int : 0' in a structure. */ ! 111: #define EMPTY_FIELD_BOUNDARY 8 ! 112: ! 113: /* Every structure's size must be a multiple of this. */ ! 114: #define STRUCTURE_SIZE_BOUNDARY 32 ! 115: ! 116: /* A bitfield declared as `int' forces `int' alignment for the struct. */ ! 117: #define PCC_BITFIELD_TYPE_MATTERS 1 ! 118: ! 119: /* No data type wants to be aligned rounder than this. */ ! 120: #define BIGGEST_ALIGNMENT 32 ! 121: ! 122: /* Define this if move instructions will actually fail to work ! 123: when given unaligned data. */ ! 124: #define STRICT_ALIGNMENT 0 ! 125: ! 126: /* Standard register usage. */ ! 127: ! 128: /* Number of actual hardware registers. ! 129: The hardware registers are assigned numbers for the compiler ! 130: from 0 to just below FIRST_PSEUDO_REGISTER. ! 131: All registers that the compiler knows about must be given numbers, ! 132: even those that are not normally considered general registers. */ ! 133: #define FIRST_PSEUDO_REGISTER 16 ! 134: ! 135: /* 1 for registers that have pervasive standard uses ! 136: and are not available for the register allocator. ! 137: On the elxsi, these is the .r15 (aka .sp). */ ! 138: #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} ! 139: ! 140: /* 1 for registers not available across function calls. ! 141: These must include the FIXED_REGISTERS and also any ! 142: registers that can be used without being saved. ! 143: The latter must include the registers where values are returned ! 144: and the register where structure-value addresses are passed. ! 145: Aside from that, you can include as many other registers as you like. */ ! 146: #define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} ! 147: ! 148: /* Return number of consecutive hard regs needed starting at reg REGNO ! 149: to hold something of mode MODE. ! 150: This is ordinarily the length in words of a value of mode MODE ! 151: but can be less for certain modes in special long registers. ! 152: On the vax, all registers are one word long. */ ! 153: #define HARD_REGNO_NREGS(REGNO, MODE) \ ! 154: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 155: ! 156: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ ! 157: #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 ! 158: ! 159: /* Value is 1 if it is a good idea to tie two pseudo registers ! 160: when one has mode MODE1 and one has mode MODE2. ! 161: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, ! 162: for any hard reg, then this must be 0 for correct output. */ ! 163: #define MODES_TIEABLE_P(MODE1, MODE2) 1 ! 164: ! 165: /* Specify the registers used for certain standard purposes. ! 166: The values of these macros are register numbers. */ ! 167: ! 168: /* Register to use for pushing function arguments. */ ! 169: #define STACK_POINTER_REGNUM 15 ! 170: ! 171: /* Base register for access to local variables of the function. */ ! 172: #define FRAME_POINTER_REGNUM 14 ! 173: ! 174: /* Value should be nonzero if functions must have frame pointers. ! 175: Zero means the frame pointer need not be set up (and parms ! 176: may be accessed via the stack pointer) in functions that seem suitable. ! 177: This is computed in `reload', in reload1.c. */ ! 178: #define FRAME_POINTER_REQUIRED 0 ! 179: ! 180: #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \ ! 181: { int regno; \ ! 182: int offset = 0; \ ! 183: for( regno=0; regno < FIRST_PSEUDO_REGISTER; regno++ ) \ ! 184: if( regs_ever_live[regno] && !call_used_regs[regno] ) \ ! 185: offset += 8; \ ! 186: (DEPTH) = (offset + ((get_frame_size() + 3) & ~3) ); \ ! 187: (DEPTH) = 0; \ ! 188: } ! 189: ! 190: /* Base register for access to arguments of the function. */ ! 191: #define ARG_POINTER_REGNUM 14 ! 192: ! 193: /* Register in which static-chain is passed to a function. */ ! 194: #define STATIC_CHAIN_REGNUM 0 ! 195: ! 196: /* Register in which address to store a structure value ! 197: is passed to a function. */ ! 198: #define STRUCT_VALUE_REGNUM 1 ! 199: ! 200: /* Define the classes of registers for register constraints in the ! 201: machine description. Also define ranges of constants. ! 202: ! 203: One of the classes must always be named ALL_REGS and include all hard regs. ! 204: If there is more than one class, another class must be named NO_REGS ! 205: and contain no registers. ! 206: ! 207: The name GENERAL_REGS must be the name of a class (or an alias for ! 208: another name such as ALL_REGS). This is the class of registers ! 209: that is allowed by "g" or "r" in a register constraint. ! 210: Also, registers outside this class are allocated only when ! 211: instructions express preferences for them. ! 212: ! 213: The classes must be numbered in nondecreasing order; that is, ! 214: a larger-numbered class must never be contained completely ! 215: in a smaller-numbered class. ! 216: ! 217: For any two classes, it is very desirable that there be another ! 218: class that represents their union. */ ! 219: ! 220: /* The vax has only one kind of registers, so NO_REGS and ALL_REGS ! 221: are the only classes. */ ! 222: ! 223: enum reg_class { NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES }; ! 224: ! 225: #define N_REG_CLASSES (int) LIM_REG_CLASSES ! 226: ! 227: /* Give names of register classes as strings for dump file. */ ! 228: ! 229: #define REG_CLASS_NAMES \ ! 230: {"NO_REGS", "GENERAL_REGS", "ALL_REGS" } ! 231: ! 232: /* Define which registers fit in which classes. ! 233: This is an initializer for a vector of HARD_REG_SET ! 234: of length N_REG_CLASSES. */ ! 235: ! 236: #define REG_CLASS_CONTENTS {0, 0x07fff, 0xffff} ! 237: ! 238: /* The same information, inverted: ! 239: Return the class number of the smallest class containing ! 240: reg number REGNO. This could be a conditional expression ! 241: or could index an array. */ ! 242: ! 243: #define REGNO_REG_CLASS(REGNO) (REGNO == 15 ? ALL_REGS : GENERAL_REGS) ! 244: ! 245: /* The class value for index registers, and the one for base regs. */ ! 246: ! 247: #define INDEX_REG_CLASS GENERAL_REGS ! 248: #define BASE_REG_CLASS GENERAL_REGS ! 249: ! 250: /* Get reg_class from a letter such as appears in the machine description. */ ! 251: ! 252: #define REG_CLASS_FROM_LETTER(C) NO_REGS ! 253: ! 254: /* The letters I, J, K, L and M in a register constraint string ! 255: can be used to stand for particular ranges of immediate operands. ! 256: This macro defines what the ranges are. ! 257: C is the letter, and VALUE is a constant value. ! 258: Return 1 if VALUE is in the range specified by C. */ ! 259: ! 260: #define CONST_OK_FOR_LETTER_P(VALUE, C) \ ! 261: ((C) == 'I' ? (VALUE) >=-16 && (VALUE) <=15 : 0) ! 262: ! 263: /* Similar, but for floating constants, and defining letters G and H. ! 264: Here VALUE is the CONST_DOUBLE rtx itself. */ ! 265: ! 266: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1 ! 267: ! 268: /* Given an rtx X being reloaded into a reg required to be ! 269: in class CLASS, return the class of reg to actually use. ! 270: In general this is just CLASS; but on some machines ! 271: in some cases it is preferable to use a more restrictive class. */ ! 272: ! 273: #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) ! 274: ! 275: /* Return the maximum number of consecutive registers ! 276: needed to represent mode MODE in a register of class CLASS. */ ! 277: /* On the vax, this is always the size of MODE in words, ! 278: since all registers are the same size. */ ! 279: #define CLASS_MAX_NREGS(CLASS, MODE) \ ! 280: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 281: ! 282: /* Stack layout; function entry, exit and calling. */ ! 283: ! 284: /* Define this if pushing a word on the stack ! 285: makes the stack pointer a smaller address. */ ! 286: #define STACK_GROWS_DOWNWARD ! 287: ! 288: /* Define this if the nominal address of the stack frame ! 289: is at the high-address end of the local variables; ! 290: that is, each additional local variable allocated ! 291: goes at a more negative offset in the frame. */ ! 292: #define FRAME_GROWS_DOWNWARD ! 293: ! 294: /* Offset within stack frame to start allocating local variables at. ! 295: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the ! 296: first local allocated. Otherwise, it is the offset to the BEGINNING ! 297: of the first local allocated. */ ! 298: #define STARTING_FRAME_OFFSET -4 ! 299: ! 300: /* Offset of first parameter from the argument pointer register value. */ ! 301: #define FIRST_PARM_OFFSET(FNDECL) 4 ! 302: ! 303: /* Value is 1 if returning from a function call automatically ! 304: pops the arguments described by the number-of-args field in the call. ! 305: FUNTYPE is the data type of the function (as a tree), ! 306: or for a library call it is an identifier node for the subroutine name. ! 307: ! 308: On the Vax, the RET insn always pops all the args for any function. */ ! 309: ! 310: #define RETURN_POPS_ARGS(FUNTYPE,SIZE) (SIZE) ! 311: ! 312: /* Define how to find the value returned by a function. ! 313: VALTYPE is the data type of the value (as a tree). ! 314: If the precise function being called is known, FUNC is its FUNCTION_DECL; ! 315: otherwise, FUNC is 0. */ ! 316: ! 317: /* On the Vax the return value is in R0 regardless. */ ! 318: ! 319: #define FUNCTION_VALUE(VALTYPE, FUNC) \ ! 320: gen_rtx (REG, TYPE_MODE (VALTYPE), 0) ! 321: ! 322: /* Define how to find the value returned by a library function ! 323: assuming the value has mode MODE. */ ! 324: ! 325: /* On the Vax the return value is in R0 regardless. */ ! 326: ! 327: #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0) ! 328: ! 329: /* Define this if PCC uses the nonreentrant convention for returning ! 330: structure and union values. */ ! 331: ! 332: #define PCC_STATIC_STRUCT_RETURN ! 333: ! 334: /* 1 if N is a possible register number for a function value. ! 335: On the Vax, R0 is the only register thus used. */ ! 336: ! 337: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) ! 338: ! 339: /* 1 if N is a possible register number for function argument passing. ! 340: On the Vax, no registers are used in this way. */ ! 341: ! 342: #define FUNCTION_ARG_REGNO_P(N) 0 ! 343: ! 344: /* Define a data type for recording info about an argument list ! 345: during the scan of that argument list. This data type should ! 346: hold all necessary information about the function itself ! 347: and about the args processed so far, enough to enable macros ! 348: such as FUNCTION_ARG to determine where the next arg should go. ! 349: ! 350: On the vax, this is a single integer, which is a number of bytes ! 351: of arguments scanned so far. */ ! 352: ! 353: #define CUMULATIVE_ARGS int ! 354: ! 355: /* Initialize a variable CUM of type CUMULATIVE_ARGS ! 356: for a call to a function whose data type is FNTYPE. ! 357: For a library call, FNTYPE is 0. ! 358: ! 359: On the vax, the offset starts at 0. */ ! 360: ! 361: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,x) \ ! 362: ((CUM) = 0) ! 363: ! 364: /* Update the data in CUM to advance over an argument ! 365: of mode MODE and data type TYPE. ! 366: (TYPE is null for libcalls where that information may not be available.) */ ! 367: ! 368: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ! 369: ((CUM) += ((MODE) != BLKmode \ ! 370: ? (GET_MODE_SIZE (MODE) + 3) & ~3 \ ! 371: : (int_size_in_bytes (TYPE) + 3) & ~3)) ! 372: ! 373: /* Define where to put the arguments to a function. ! 374: Value is zero to push the argument on the stack, ! 375: or a hard register in which to store the argument. ! 376: ! 377: MODE is the argument's machine mode. ! 378: TYPE is the data type of the argument (as a tree). ! 379: This is null for libcalls where that information may ! 380: not be available. ! 381: CUM is a variable of type CUMULATIVE_ARGS which gives info about ! 382: the preceding args and about the function being called. ! 383: NAMED is nonzero if this argument is a named parameter ! 384: (otherwise it is an extra parameter matching an ellipsis). */ ! 385: ! 386: /* On the vax all args are pushed. */ ! 387: ! 388: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0 ! 389: ! 390: /* This macro generates the assembly code for function entry. ! 391: FILE is a stdio stream to output the code to. ! 392: SIZE is an int: how many units of temporary storage to allocate. ! 393: Refer to the array `regs_ever_live' to determine which registers ! 394: to save; `regs_ever_live[I]' is nonzero if register number I ! 395: is ever used in the function. This macro is responsible for ! 396: knowing which registers should not be saved even if used. */ ! 397: ! 398: #define FUNCTION_PROLOGUE(FILE, SIZE) \ ! 399: { register int regno; \ ! 400: register int cnt = 0; \ ! 401: extern char call_used_regs[]; \ ! 402: /* the below two lines are a HACK, and should be deleted, but \ ! 403: for now are very much needed (1.35) */ \ ! 404: if (frame_pointer_needed) \ ! 405: regs_ever_live[14]=1, call_used_regs[14]=0; \ ! 406: for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \ ! 407: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 408: cnt+=8; \ ! 409: if ((SIZE)+cnt) \ ! 410: fprintf (FILE, "\tadd.64\t.sp,=%d\n", -(SIZE)-cnt); \ ! 411: cnt = 0; \ ! 412: for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \ ! 413: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 414: fprintf (FILE, "\tst.64\t.r%d,[.sp]%d\n", regno, (cnt+=8)-12); \ ! 415: if (frame_pointer_needed) \ ! 416: fprintf (FILE, "\tadd.64\t.r14,.sp,=%d\n", (SIZE)+cnt); \ ! 417: } ! 418: ! 419: /* Output assembler code to FILE to increment profiler label # LABELNO ! 420: for profiling a function entry. */ ! 421: ! 422: #define FUNCTION_PROFILER(FILE, LABELNO) \ ! 423: fprintf (FILE, "\tld.64\t.r0,.LP%d\n\tcall\tmcount\n", (LABELNO)); ! 424: ! 425: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, ! 426: the stack pointer does not matter. The value is tested only in ! 427: functions that have frame pointers. ! 428: No definition is equivalent to always zero. */ ! 429: ! 430: #define EXIT_IGNORE_STACK 0 ! 431: ! 432: /* This macro generates the assembly code for function exit, ! 433: on machines that need it. If FUNCTION_EPILOGUE is not defined ! 434: then individual return instructions are generated for each ! 435: return statement. Args are same as for FUNCTION_PROLOGUE. */ ! 436: ! 437: #define FUNCTION_EPILOGUE(FILE, SIZE) \ ! 438: { register int regno; \ ! 439: register int cnt = 0; \ ! 440: extern char call_used_regs[]; \ ! 441: extern int current_function_calls_alloca; \ ! 442: /* this conditional is ONLY here because there is a BUG; \ ! 443: EXIT_IGNORE_STACK is ignored itself when the first part of \ ! 444: the condition is true! (atleast in version 1.35) */ \ ! 445: /* the 8*10 is for 64 bits of .r5 - .r14 */ \ ! 446: if (current_function_calls_alloca || (SIZE)>=(256-8*10)) { \ ! 447: /* use .r4 as a temporary! Ok for now.... */ \ ! 448: fprintf (FILE, "\tld.64\t.r4,.r14\n"); \ ! 449: for (regno = FIRST_PSEUDO_REGISTER-1; regno >= 0; --regno) \ ! 450: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 451: cnt+=8; \ ! 452: for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) \ ! 453: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 454: fprintf (FILE, "\tld.64\t.r%d,[.r14]%d\n", regno, \ ! 455: -((cnt-=8) + 8)-4-(SIZE)); \ ! 456: fprintf (FILE, "\tld.64\t.sp,.r4\n\texit\t0\n"); \ ! 457: } else { \ ! 458: for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) \ ! 459: if (regs_ever_live[regno] && !call_used_regs[regno]) \ ! 460: fprintf (FILE, "\tld.64\t.r%d,[.sp]%d\n", regno, (cnt+=8)-12); \ ! 461: fprintf (FILE, "\texit\t%d\n", (SIZE)+cnt); \ ! 462: } } ! 463: ! 464: /* If the memory address ADDR is relative to the frame pointer, ! 465: correct it to be relative to the stack pointer instead. ! 466: This is for when we don't use a frame pointer. ! 467: ADDR should be a variable name. */ ! 468: ! 469: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \ ! 470: { int offset = -1; \ ! 471: rtx regs = stack_pointer_rtx; \ ! 472: if (ADDR == frame_pointer_rtx) \ ! 473: offset = 0; \ ! 474: else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx \ ! 475: && GET_CODE (XEXP (ADDR, 0)) == CONST_INT) \ ! 476: offset = INTVAL (XEXP (ADDR, 0)); \ ! 477: else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \ ! 478: && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \ ! 479: offset = INTVAL (XEXP (ADDR, 1)); \ ! 480: else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx) \ ! 481: { rtx other_reg = XEXP (ADDR, 1); \ ! 482: offset = 0; \ ! 483: regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \ ! 484: else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx) \ ! 485: { rtx other_reg = XEXP (ADDR, 0); \ ! 486: offset = 0; \ ! 487: regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \ ! 488: if (offset >= 0) \ ! 489: { int regno; \ ! 490: extern char call_used_regs[]; \ ! 491: offset += 4; /* I don't know why??? */ \ ! 492: for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \ ! 493: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 494: offset += 8; \ ! 495: ADDR = plus_constant (regs, offset + (DEPTH)); } } ! 496: ! 497: ! 498: /* Addressing modes, and classification of registers for them. */ ! 499: ! 500: /* #define HAVE_POST_INCREMENT */ ! 501: /* #define HAVE_POST_DECREMENT */ ! 502: ! 503: /* #define HAVE_PRE_DECREMENT */ ! 504: /* #define HAVE_PRE_INCREMENT */ ! 505: ! 506: /* Macros to check register numbers against specific register classes. */ ! 507: ! 508: /* These assume that REGNO is a hard or pseudo reg number. ! 509: They give nonzero only if REGNO is a hard reg of the suitable class ! 510: or a pseudo reg currently allocated to a suitable hard reg. ! 511: Since they use reg_renumber, they are safe only once reg_renumber ! 512: has been allocated, which happens in local-alloc.c. */ ! 513: ! 514: #define REGNO_OK_FOR_INDEX_P(regno) \ ! 515: ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0) ! 516: #define REGNO_OK_FOR_BASE_P(regno) \ ! 517: ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0) ! 518: ! 519: /* Maximum number of registers that can appear in a valid memory address. */ ! 520: ! 521: #define MAX_REGS_PER_ADDRESS 2 ! 522: ! 523: /* 1 if X is an rtx for a constant that is a valid address. */ ! 524: ! 525: #define CONSTANT_ADDRESS_P(X) \ ! 526: (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ ! 527: || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ ! 528: || GET_CODE (X) == HIGH) ! 529: ! 530: /* Nonzero if the constant value X is a legitimate general operand. ! 531: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ ! 532: ! 533: #define LEGITIMATE_CONSTANT_P(X) \ ! 534: (GET_CODE (X) != CONST_DOUBLE) ! 535: ! 536: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx ! 537: and check its validity for a certain class. ! 538: We have two alternate definitions for each of them. ! 539: The usual definition accepts all pseudo regs; the other rejects ! 540: them unless they have been allocated suitable hard regs. ! 541: The symbol REG_OK_STRICT causes the latter definition to be used. ! 542: ! 543: Most source files want to accept pseudo regs in the hope that ! 544: they will get allocated to the class that the insn wants them to be in. ! 545: Source files for reload pass need to be strict. ! 546: After reload, it makes no difference, since pseudo regs have ! 547: been eliminated by then. */ ! 548: ! 549: #ifndef REG_OK_STRICT ! 550: ! 551: /* Nonzero if X is a hard reg that can be used as an index ! 552: or if it is a pseudo reg. */ ! 553: #define REG_OK_FOR_INDEX_P(X) 1 ! 554: /* Nonzero if X is a hard reg that can be used as a base reg ! 555: or if it is a pseudo reg. */ ! 556: #define REG_OK_FOR_BASE_P(X) 1 ! 557: ! 558: #else ! 559: ! 560: /* Nonzero if X is a hard reg that can be used as an index. */ ! 561: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) ! 562: /* Nonzero if X is a hard reg that can be used as a base reg. */ ! 563: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) ! 564: ! 565: #endif ! 566: ! 567: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression ! 568: that is a valid memory address for an instruction. ! 569: The MODE argument is the machine mode for the MEM expression ! 570: that wants to use this address. ! 571: ! 572: CONSTANT_ADDRESS_P is actually machine-independent. */ ! 573: ! 574: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ! 575: { \ ! 576: if (GET_CODE (X) == REG) goto ADDR; \ ! 577: if (CONSTANT_ADDRESS_P (X)) goto ADDR; \ ! 578: if (GET_CODE (X) == PLUS) \ ! 579: { \ ! 580: /* Handle [index]<address> represented with index-sum outermost */\ ! 581: if (GET_CODE (XEXP (X, 0)) == REG \ ! 582: && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ ! 583: && GET_CODE (XEXP (X, 1)) == CONST_INT) \ ! 584: goto ADDR; \ ! 585: if (GET_CODE (XEXP (X, 1)) == REG \ ! 586: && REG_OK_FOR_BASE_P (XEXP (X, 0)) \ ! 587: && GET_CODE (XEXP (X, 0)) == CONST_INT) \ ! 588: goto ADDR; \ ! 589: } \ ! 590: } ! 591: ! 592: ! 593: /* Try machine-dependent ways of modifying an illegitimate address ! 594: to be legitimate. If we find one, return the new, valid address. ! 595: This macro is used in only one place: `memory_address' in explow.c. ! 596: ! 597: OLDX is the address as it was before break_out_memory_refs was called. ! 598: In some cases it is useful to look at this to decide what needs to be done. ! 599: ! 600: MODE and WIN are passed so that this macro can use ! 601: GO_IF_LEGITIMATE_ADDRESS. ! 602: ! 603: It is always safe for this macro to do nothing. It exists to recognize ! 604: opportunities to optimize the output. ! 605: ! 606: For the vax, nothing needs to be done. */ ! 607: ! 608: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {} ! 609: ! 610: /* Go to LABEL if ADDR (a legitimate address expression) ! 611: has an effect that depends on the machine mode it is used for. */ ! 612: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) ! 613: ! 614: ! 615: /* Specify the machine mode that this machine uses ! 616: for the index in the tablejump instruction. */ ! 617: #define CASE_VECTOR_MODE SImode ! 618: ! 619: /* Define this if the case instruction expects the table ! 620: to contain offsets from the address of the table. ! 621: Do not define this if the table should contain absolute addresses. */ ! 622: /* #define CASE_VECTOR_PC_RELATIVE */ ! 623: ! 624: /* Specify the tree operation to be used to convert reals to integers. */ ! 625: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR ! 626: ! 627: /* This is the kind of divide that is easiest to do in the general case. */ ! 628: #define EASY_DIV_EXPR TRUNC_DIV_EXPR ! 629: ! 630: /* Define this as 1 if `char' should by default be signed; else as 0. */ ! 631: #define DEFAULT_SIGNED_CHAR 1 ! 632: ! 633: /* This flag, if defined, says the same insns that convert to a signed fixnum ! 634: also convert validly to an unsigned one. */ ! 635: #define FIXUNS_TRUNC_LIKE_FIX_TRUNC ! 636: ! 637: /* Max number of bytes we can move from memory to memory ! 638: in one reasonably fast instruction. */ ! 639: #define MOVE_MAX 8 ! 640: ! 641: /* Define this if zero-extension is slow (more than one real instruction). */ ! 642: /* #define SLOW_ZERO_EXTEND */ ! 643: ! 644: /* Nonzero if access to memory by bytes is slow and undesirable. */ ! 645: #define SLOW_BYTE_ACCESS 0 ! 646: ! 647: /* Define if shifts truncate the shift count ! 648: which implies one can omit a sign-extension or zero-extension ! 649: of a shift count. */ ! 650: /* #define SHIFT_COUNT_TRUNCATED */ ! 651: ! 652: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits ! 653: is done just by pretending it is already truncated. */ ! 654: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 ! 655: ! 656: /* Specify the machine mode that pointers have. ! 657: After generation of rtl, the compiler makes no further distinction ! 658: between pointers and any other objects of this machine mode. */ ! 659: #define Pmode SImode ! 660: ! 661: /* A function address in a call instruction ! 662: is a byte address (for indexing purposes) ! 663: so give the MEM rtx a byte's mode. */ ! 664: #define FUNCTION_MODE QImode ! 665: ! 666: /* Compute the cost of computing a constant rtl expression RTX ! 667: whose rtx-code is CODE. The body of this macro is a portion ! 668: of a switch statement. If the code is computed here, ! 669: return it with a return statement. Otherwise, break from the switch. */ ! 670: ! 671: #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ ! 672: case CONST_INT: \ ! 673: /* Constant zero is super cheap due to clr instruction. */ \ ! 674: if (RTX == const0_rtx) return 0; \ ! 675: if ((unsigned) INTVAL (RTX) < 077) return 1; \ ! 676: case CONST: \ ! 677: case LABEL_REF: \ ! 678: case SYMBOL_REF: \ ! 679: return 3; \ ! 680: case CONST_DOUBLE: \ ! 681: return 5; ! 682: ! 683: /* ! 684: * We can use the BSD C library routines for the gnulib calls that are ! 685: * still generated, since that's what they boil down to anyways. ! 686: */ ! 687: ! 688: /* #define UDIVSI3_LIBCALL "*udiv" */ ! 689: /* #define UMODSI3_LIBCALL "*urem" */ ! 690: ! 691: /* Check a `double' value for validity for a particular machine mode. */ ! 692: ! 693: /* Note that it is very hard to accidentally create a number that fits in a ! 694: double but not in a float, since their ranges are almost the same. */ ! 695: #define CHECK_FLOAT_VALUE(mode, d) \ ! 696: if ((mode) == SFmode) \ ! 697: { \ ! 698: if ((d) > 1.7014117331926443e+38) \ ! 699: { error ("magnitude of constant too large for `float'"); \ ! 700: (d) = 1.7014117331926443e+38; } \ ! 701: else if ((d) < -1.7014117331926443e+38) \ ! 702: { error ("magnitude of constant too large for `float'"); \ ! 703: (d) = -1.7014117331926443e+38; } \ ! 704: else if (((d) > 0) && ((d) < 2.9387358770557188e-39)) \ ! 705: { warning ("`float' constant truncated to zero"); \ ! 706: (d) = 0.0; } \ ! 707: else if (((d) < 0) && ((d) > -2.9387358770557188e-39)) \ ! 708: { warning ("`float' constant truncated to zero"); \ ! 709: (d) = 0.0; } \ ! 710: } ! 711: ! 712: /* Tell final.c how to eliminate redundant test instructions. */ ! 713: ! 714: /* Here we define machine-dependent flags and fields in cc_status ! 715: (see `conditions.h'). No extra ones are needed for the vax. */ ! 716: ! 717: /* Store in cc_status the expressions ! 718: that the condition codes will describe ! 719: after execution of an instruction whose pattern is EXP. ! 720: Do not alter them if the instruction would not alter the cc's. */ ! 721: ! 722: #define NOTICE_UPDATE_CC(EXP, INSN) \ ! 723: CC_STATUS_INIT; ! 724: ! 725: ! 726: /* Control the assembler format that we output. */ ! 727: ! 728: /* Output the name of the file we are compiling. */ ! 729: #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \ ! 730: do { fprintf (STREAM, "\t.file\t"); \ ! 731: output_quoted_string (STREAM, NAME); \ ! 732: fprintf (STREAM, "\n"); \ ! 733: } while (0) ! 734: ! 735: /* Output at beginning of assembler file. */ ! 736: #define ASM_FILE_START(FILE) fprintf (FILE, ""); ! 737: ! 738: /* Output to assembler file text saying following lines ! 739: may contain character constants, extra white space, comments, etc. */ ! 740: ! 741: #define ASM_APP_ON "" ! 742: ! 743: /* Output to assembler file text saying following lines ! 744: no longer contain unusual constructs. */ ! 745: ! 746: #define ASM_APP_OFF "" ! 747: ! 748: /* Output before read-only data. */ ! 749: ! 750: #define TEXT_SECTION_ASM_OP "\t.inst" ! 751: ! 752: /* Output before writable data. */ ! 753: ! 754: #define DATA_SECTION_ASM_OP "\t.var" ! 755: ! 756: /* How to refer to registers in assembler output. ! 757: This sequence is indexed by compiler's hard-register-number (see above). */ ! 758: ! 759: #define REGISTER_NAMES \ ! 760: {".r0", ".r1", ".r2", ".r3", ".r4", ".r5", ".r6", ".r7", ".r8", \ ! 761: ".r9", ".r10", ".r11", ".r12", ".r13", ".r14", ".sp"} ! 762: ! 763: /* This is BSD, so it wants DBX format. */ ! 764: ! 765: /* #define DBX_DEBUGGING_INFO */ ! 766: ! 767: /* How to renumber registers for dbx and gdb. ! 768: Vax needs no change in the numeration. */ ! 769: ! 770: #define DBX_REGISTER_NUMBER(REGNO) (REGNO) ! 771: ! 772: /* Do not break .stabs pseudos into continuations. */ ! 773: ! 774: #define DBX_CONTIN_LENGTH 0 ! 775: ! 776: /* This is the char to use for continuation (in case we need to turn ! 777: continuation back on). */ ! 778: ! 779: #define DBX_CONTIN_CHAR '?' ! 780: ! 781: /* Don't use the `xsfoo;' construct in DBX output; this system ! 782: doesn't support it. */ ! 783: ! 784: #define DBX_NO_XREFS ! 785: ! 786: /* This is how to output the definition of a user-level label named NAME, ! 787: such as the label on a static function or variable NAME. */ ! 788: ! 789: #define ASM_OUTPUT_LABEL(FILE,NAME) \ ! 790: do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) ! 791: ! 792: /* This is how to output a command to make the user-level label named NAME ! 793: defined for reference from other files. */ ! 794: ! 795: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ ! 796: do { fputs ("\t.extdef\t", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) ! 797: ! 798: /* This is how to output a reference to a user-level label named NAME. */ ! 799: ! 800: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 801: fprintf (FILE, "%s", NAME) ! 802: ! 803: /* This is how to output an internal numbered label where ! 804: PREFIX is the class of label and NUM is the number within the class. */ ! 805: ! 806: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 807: fprintf (FILE, ".%s%d:\n", PREFIX, NUM) ! 808: ! 809: /* This is how to store into the string LABEL ! 810: the symbol_ref name of an internal numbered label where ! 811: PREFIX is the class of label and NUM is the number within the class. ! 812: This is suitable for output with `assemble_name'. */ ! 813: ! 814: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ ! 815: sprintf (LABEL, ".%s%d", PREFIX, NUM) ! 816: ! 817: /* This is how to output an assembler line defining a `double' constant. ! 818: It is .dfloat or .gfloat, depending. */ ! 819: ! 820: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ ! 821: { union {double d; int i[2]; } tem; \ ! 822: tem.d = (VALUE); \ ! 823: fprintf (FILE, "\t.data\t%d{32}, %d{32}\n", tem.i[0], tem.i[1]); } ! 824: ! 825: /* This is how to output an assembler line defining a `float' constant. */ ! 826: ! 827: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ ! 828: { union {float f; int i; } tem; \ ! 829: tem.f = (VALUE); \ ! 830: fprintf (FILE, "\t.data %d{32}\n", tem.i); } ! 831: ! 832: /* This is how to output an assembler line defining an `int' constant. */ ! 833: ! 834: #define ASM_OUTPUT_INT(FILE,VALUE) \ ! 835: ( \ ! 836: fprintf (FILE, "\t.data\t"), \ ! 837: output_addr_const (FILE, (VALUE)), \ ! 838: fprintf (FILE, "{32}\n")) ! 839: ! 840: #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ ! 841: { \ ! 842: fprintf (FILE, "\t.data\t"); \ ! 843: if (GET_CODE (VALUE) == CONST_DOUBLE) \ ! 844: { \ ! 845: fprintf (FILE, "%d", CONST_DOUBLE_HIGH (VALUE)); \ ! 846: fprintf (FILE, "{32}, "); \ ! 847: fprintf (FILE, "%d", CONST_DOUBLE_LOW (VALUE)); \ ! 848: fprintf (FILE, "{32}\n"); \ ! 849: } else if (GET_CODE (VALUE) == CONST_INT) \ ! 850: { \ ! 851: int val = INTVAL (VALUE); \ ! 852: fprintf (FILE, "%d", val < 0 ? -1 : 0); \ ! 853: fprintf (FILE, "{32}, "); \ ! 854: fprintf (FILE, "%d", val); \ ! 855: fprintf (FILE, "{32}\n"); \ ! 856: } else abort (); \ ! 857: } ! 858: ! 859: /* Likewise for `char' and `short' constants. */ ! 860: ! 861: #define ASM_OUTPUT_SHORT(FILE,VALUE) \ ! 862: ( fprintf (FILE, "\t.data\t"), \ ! 863: output_addr_const (FILE, (VALUE)), \ ! 864: fprintf (FILE, "{16}\n")) ! 865: ! 866: #define ASM_OUTPUT_CHAR(FILE,VALUE) \ ! 867: ( fprintf (FILE, "\t.data\t"), \ ! 868: output_addr_const (FILE, (VALUE)), \ ! 869: fprintf (FILE, "{8}\n")) ! 870: ! 871: /* This is how to output an assembler line for a numeric constant byte. */ ! 872: ! 873: #define ASM_OUTPUT_BYTE(FILE,VALUE) \ ! 874: fprintf (FILE, "\t.data\t%d{8}\n", (VALUE)) ! 875: ! 876: /* This is how to output an insn to push a register on the stack. ! 877: It need not be very fast code. */ ! 878: ! 879: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ ! 880: fprintf (FILE, "\tsubi.64\t4,.sp\n\tst.32\t%s,[.sp]\n", reg_names[REGNO]) ! 881: ! 882: /* This is how to output an insn to pop a register from the stack. ! 883: It need not be very fast code. */ ! 884: ! 885: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ ! 886: fprintf (FILE, "\tld.32\t%s,[.sp]\n\taddi.64\t4,.sp\n", reg_names[REGNO]) ! 887: ! 888: /* This is how to output an element of a case-vector that is absolute. ! 889: (The Vax does not use such vectors, ! 890: but we must define this macro anyway.) */ ! 891: ! 892: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ! 893: fprintf (FILE, "\t.data .L%d{32}\n", VALUE) ! 894: ! 895: /* This is how to output an element of a case-vector that is relative. */ ! 896: ! 897: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ! 898: fprintf (FILE, "\t.data .L%d-.L%d{32}\n", VALUE, REL) ! 899: ! 900: /* This is how to output an assembler line ! 901: that says to advance the location counter ! 902: to a multiple of 2**LOG bytes. */ ! 903: ! 904: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 905: if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", (LOG)); else 0 ! 906: ! 907: /* This is how to output an assembler line ! 908: that says to advance the location counter by SIZE bytes. */ ! 909: ! 910: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 911: fprintf (FILE, "\t.space %d\n", (SIZE)) ! 912: ! 913: /* This says how to output an assembler line ! 914: to define a global common symbol. */ ! 915: ! 916: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 917: ( fputs (".comm ", (FILE)), \ ! 918: assemble_name ((FILE), (NAME)), \ ! 919: fprintf ((FILE), ",%d\n", (ROUNDED))) ! 920: ! 921: /* This says how to output an assembler line ! 922: to define a local common symbol. */ ! 923: ! 924: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 925: ( fputs (".bss ", (FILE)), \ ! 926: assemble_name ((FILE), (NAME)), \ ! 927: fprintf ((FILE), ",%d,%d\n", (SIZE),(ROUNDED))) ! 928: ! 929: /* Store in OUTPUT a string (made with alloca) containing ! 930: an assembler-name for a local static variable named NAME. ! 931: LABELNO is an integer which is different for each call. */ ! 932: ! 933: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ! 934: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ ! 935: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) ! 936: ! 937: /* Define the parentheses used to group arithmetic operations ! 938: in assembler code. */ ! 939: ! 940: #define ASM_OPEN_PAREN "(" ! 941: #define ASM_CLOSE_PAREN ")" ! 942: ! 943: /* Define results of standard character escape sequences. */ ! 944: #define TARGET_BELL 007 ! 945: #define TARGET_BS 010 ! 946: #define TARGET_TAB 011 ! 947: #define TARGET_NEWLINE 012 ! 948: #define TARGET_VT 013 ! 949: #define TARGET_FF 014 ! 950: #define TARGET_CR 015 ! 951: ! 952: /* Print an instruction operand X on file FILE. ! 953: CODE is the code from the %-spec that requested printing this operand; ! 954: if `%z3' was used to print operand 3, then CODE is 'z'. */ ! 955: ! 956: #define PRINT_OPERAND(FILE, X, CODE) \ ! 957: { \ ! 958: if (CODE == 'r' && GET_CODE (X) == MEM && GET_CODE (XEXP (X, 0)) == REG) \ ! 959: fprintf (FILE, "%s", reg_names[REGNO (XEXP (X, 0))]); \ ! 960: else if (GET_CODE (X) == REG) \ ! 961: fprintf (FILE, "%s", reg_names[REGNO (X)]); \ ! 962: else if (GET_CODE (X) == MEM) \ ! 963: output_address (XEXP (X, 0)); \ ! 964: else \ ! 965: { \ ! 966: /*debug_rtx(X);*/ \ ! 967: putc ('=', FILE); \ ! 968: output_addr_const (FILE, X); } \ ! 969: } ! 970: ! 971: /* Print a memory operand whose address is X, on file FILE. ! 972: This uses a function in output-vax.c. */ ! 973: ! 974: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ ! 975: print_operand_address (FILE, ADDR) ! 976: ! 977: /* Functions used in the md file. */ ! 978: ! 979: extern char *cmp_set(); ! 980: extern char *cmp_jmp(); ! 981: ! 982: /* These are stubs, and have yet to bee written. */ ! 983: ! 984: #define TRAMPOLINE_SIZE 26 ! 985: #define TRAMPOLINE_TEMPLATE(FILE) ! 986: #define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.