|
|
1.1 ! root 1: /* Definitions of target machine for GNU compiler. ! 2: Copyright (C) 1994 Free Software Foundation, Inc. ! 3: Contributed by O.M.Kellogg, DASA ([email protected]). ! 4: ! 5: This file is part of GNU CC. ! 6: ! 7: GNU CC is free software; you can redistribute it and/or modify ! 8: it under the terms of the GNU General Public License as published by ! 9: the Free Software Foundation; either version 1, 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: /* Names to predefine in the preprocessor for this target machine. */ ! 23: ! 24: /* See tm-sun3.h, tm-sun2.h, tm-isi68.h for different CPP_PREDEFINES. */ ! 25: #define CPP_PREDEFINES "" ! 26: ! 27: /* Print subsidiary information on the compiler version in use. */ ! 28: #ifdef IEEE ! 29: #define TARGET_VERSION fprintf (stderr, " (1750A, IEEE syntax)"); ! 30: #else ! 31: #define TARGET_VERSION fprintf (stderr, " (MIL-STD-1750A)"); ! 32: #endif ! 33: ! 34: /* Run-time compilation parameters selecting different hardware subsets. */ ! 35: ! 36: #define TARGET_SWITCHES \ ! 37: { {"vaxc-alignment", 2}, \ ! 38: { "", TARGET_DEFAULT}} ! 39: ! 40: /* Default target_flags if no switches specified. */ ! 41: ! 42: #ifndef TARGET_DEFAULT ! 43: #define TARGET_DEFAULT 1 ! 44: #endif ! 45: ! 46: /*****************************************************************************/ ! 47: ! 48: /* SPECIAL ADDITION FOR MIL-STD-1750A by O.M.Kellogg, 15-Apr-1993 */ ! 49: /* See file aux-output.c for the actual data instances. */ ! 50: struct datalabel_array { ! 51: char *name; ! 52: char value[14]; ! 53: int size; ! 54: }; ! 55: struct jumplabel_array { ! 56: int pc; ! 57: int num; ! 58: }; ! 59: enum section { Init, Normal, Konst, Static }; ! 60: #define DATALBL_ARRSIZ 256 ! 61: #define JMPLBL_ARRSIZ 256 ! 62: #ifndef __datalbl ! 63: extern struct datalabel_array datalbl[]; ! 64: extern struct jumplabel_array jmplbl[]; ! 65: extern int datalbl_ndx, jmplbl_ndx, label_pending, program_counter; ! 66: extern enum section current_section; ! 67: extern char *sectname[4]; ! 68: extern char *strdup(), *float_label(); ! 69: #endif ! 70: /*--------------------------------------------------------------------*/ ! 71: ! 72: /* target machine storage layout */ ! 73: ! 74: /* Define this if most significant bit is lowest numbered ! 75: in instructions that operate on numbered bit-fields. ! 76: Though 1750 actually counts bits in big-endian fashion, the sign bit ! 77: is still the most significant bit, which is leftmost. Therefore leaving ! 78: this little-endian. Adjust short before assembler output when needed: ! 79: e.g. in QImode, a GCC bit n is a 1750 bit (15-n). */ ! 80: #define BITS_BIG_ENDIAN 0 ! 81: ! 82: /* Define this if most significant byte of a word is the lowest numbered. */ ! 83: /* For 1750 we can decide arbitrarily ! 84: since there are no machine instructions for them. */ ! 85: #define BYTES_BIG_ENDIAN 0 ! 86: ! 87: /* Define this if most significant word of a multiword value is lowest ! 88: numbered. ! 89: True for 1750. */ ! 90: #define WORDS_BIG_ENDIAN 1 ! 91: ! 92: /* number of bits in an addressable storage unit */ ! 93: #define BITS_PER_UNIT 16 ! 94: ! 95: /* Width in bits of a "word", which is the contents of a machine register. ! 96: Note that this is not necessarily the width of data type `int'; ! 97: if using 16-bit ints on a 68000, this would still be 32. ! 98: But on a machine with 16-bit registers, this would be 16. */ ! 99: #define BITS_PER_WORD 16 ! 100: ! 101: /* Width of a word, in units (bytes). */ ! 102: #define UNITS_PER_WORD 1 ! 103: ! 104: /* Width in bits of a pointer. ! 105: See also the macro `Pmode' defined below. */ ! 106: #define POINTER_SIZE 16 ! 107: ! 108: #define PTRDIFF_TYPE "int" ! 109: ! 110: /* Type to use for `size_t'. If undefined, uses `long unsigned int'. */ ! 111: #define SIZE_TYPE "int" ! 112: ! 113: /* 1750a preliminary ! 114: #define TARGET_FLOAT_FORMAT UNKNOWN_FLOAT_FORMAT ! 115: */ ! 116: ! 117: /* Allocation boundary (in *bits*) for storing pointers in memory. */ ! 118: #define POINTER_BOUNDARY 16 ! 119: ! 120: /* Allocation boundary (in *bits*) for storing arguments in argument list. */ ! 121: /* 1750: should have had to make this 32 when BITS_PER_WORD is 32. */ ! 122: #define PARM_BOUNDARY 16 ! 123: ! 124: /* Boundary (in *bits*) on which stack pointer should be aligned. */ ! 125: #define STACK_BOUNDARY 16 ! 126: ! 127: /* Allocation boundary (in *bits*) for the code of a function. */ ! 128: #define FUNCTION_BOUNDARY 16 ! 129: ! 130: /* Alignment of field after `int : 0' in a structure. */ ! 131: #define EMPTY_FIELD_BOUNDARY 16 ! 132: ! 133: /* No data type wants to be aligned rounder than this. */ ! 134: #define BIGGEST_ALIGNMENT 16 ! 135: ! 136: /* Define this to 1 if move instructions will actually fail to work ! 137: when given unaligned data. */ ! 138: #define STRICT_ALIGNMENT 0 ! 139: ! 140: /* Define number of bits in most basic integer type. ! 141: (If undefined, default is BITS_PER_WORD). ! 142: #define INT_TYPE_SIZE 16 */ ! 143: ! 144: /* Define number of bits in short integer type. ! 145: (If undefined, default is half of BITS_PER_WORD). */ ! 146: #define SHORT_TYPE_SIZE 16 ! 147: ! 148: /* Define number of bits in long integer type. ! 149: (If undefined, default is BITS_PER_WORD). */ ! 150: #define LONG_TYPE_SIZE 32 ! 151: ! 152: /* Define number of bits in long long integer type. ! 153: (If undefined, default is twice BITS_PER_WORD). */ ! 154: /* 1750 PRELIMINARY : no processor support for `long long', therefore ! 155: need to check out the long-long opencodings ! */ ! 156: #define LONG_LONG_TYPE_SIZE 64 ! 157: ! 158: /* Define number of bits in char type. ! 159: (If undefined, default is one fourth of BITS_PER_WORD). */ ! 160: #define CHAR_TYPE_SIZE 16 ! 161: ! 162: /* Define number of bits in float type. ! 163: (If undefined, default is BITS_PER_WORD). */ ! 164: #define FLOAT_TYPE_SIZE 32 ! 165: ! 166: /* Define number of bits in double type. ! 167: (If undefined, default is twice BITS_PER_WORD). */ ! 168: #define DOUBLE_TYPE_SIZE 48 ! 169: ! 170: /*****************************************************************************/ ! 171: ! 172: /* Standard register usage. */ ! 173: ! 174: /* Number of actual hardware registers. ! 175: The hardware registers are assigned numbers for the compiler ! 176: from 0 to just below FIRST_PSEUDO_REGISTER. ! 177: All registers that the compiler knows about must be given numbers, ! 178: even those that are not normally considered general registers. */ ! 179: #define FIRST_PSEUDO_REGISTER 16 ! 180: ! 181: /* 1 for registers that have pervasive standard uses ! 182: and are not available for the register allocator. ! 183: R15 is the 1750A stack pointer. R14 is the frame pointer. */ ! 184: ! 185: #define FIXED_REGISTERS \ ! 186: { 0, 0, 0, 0, 0, 0, 0, 0, \ ! 187: 0, 0, 0, 0, 0, 0, 1, 1 } ! 188: ! 189: /* 1 for registers not available across function calls. ! 190: These must include the FIXED_REGISTERS and also any ! 191: registers that can be used without being saved. ! 192: The latter must include the registers where values are returned ! 193: and the register where structure-value addresses are passed. ! 194: Aside from that, you can include as many other registers as you like. ! 195: 1750: return value in R0 foll. (depending on size of retval). ! 196: Should be possible to refine this (how many regs are actually used) */ ! 197: ! 198: #define CALL_USED_REGISTERS \ ! 199: { 1, 1, 1, 1, 1, 1, 1, 1, \ ! 200: 1, 1, 1, 1, 1, 1, 1, 1 } ! 201: ! 202: /* Return number of consecutive hard regs needed starting at reg REGNO ! 203: to hold something of mode MODE. ! 204: This is ordinarily the length in words of a value of mode MODE ! 205: but can be less for certain modes in special long registers. ! 206: All 1750 registers are one word long. */ ! 207: #define HARD_REGNO_NREGS(REGNO, MODE) \ ! 208: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) ! 209: ! 210: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ ! 211: #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 ! 212: ! 213: /* Value is 1 if it is a good idea to tie two pseudo registers ! 214: when one has mode MODE1 and one has mode MODE2. ! 215: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, ! 216: for any hard reg, then this must be 0 for correct output. */ ! 217: #define MODES_TIEABLE_P(MODE1, MODE2) 1 ! 218: ! 219: /* Specify the registers used for certain standard purposes. ! 220: The values of these macros are register numbers. */ ! 221: ! 222: /* 1750A pc isn't overloaded on a register. */ ! 223: /* #define PC_REGNUM */ ! 224: ! 225: /* Register to use for pushing function arguments. */ ! 226: #define STACK_POINTER_REGNUM 15 ! 227: ! 228: /* Base register for access to local variables of the function. */ ! 229: #define FRAME_POINTER_REGNUM 14 ! 230: ! 231: /* Value should be nonzero if functions must have frame pointers. ! 232: Zero means the frame pointer need not be set up (and parms ! 233: may be accessed via the stack pointer) in functions that seem suitable. ! 234: This is computed in `reload', in reload1.c. */ ! 235: #define FRAME_POINTER_REQUIRED 1 ! 236: ! 237: /* Base register for access to arguments of the function. */ ! 238: #define ARG_POINTER_REGNUM 14 ! 239: ! 240: /* Define this if successive args to a function occupy decreasing addresses ! 241: on the stack. ! 242: #define ARGS_GROW_DOWNWARD ! 243: */ ! 244: ! 245: /* Register in which static-chain is passed to a function. */ ! 246: #define STATIC_CHAIN_REGNUM 13 ! 247: ! 248: /* Register in which address to store a structure value ! 249: is passed to a function. */ ! 250: #define STRUCT_VALUE_REGNUM 12 ! 251: ! 252: /* Define this to be 1 if all structure return values must be in memory. */ ! 253: #define DEFAUT_PCC_STRUCT_RETURN 0 ! 254: ! 255: /*****************************************************************************/ ! 256: ! 257: /* Define the classes of registers for register constraints in the ! 258: machine description. Also define ranges of constants. ! 259: ! 260: One of the classes must always be named ALL_REGS and include all hard regs. ! 261: If there is more than one class, another class must be named NO_REGS ! 262: and contain no registers. ! 263: ! 264: The name GENERAL_REGS must be the name of a class (or an alias for ! 265: another name such as ALL_REGS). This is the class of registers ! 266: that is allowed by "g" or "r" in a register constraint. ! 267: Also, registers outside this class are allocated only when ! 268: instructions express preferences for them. ! 269: ! 270: The classes must be numbered in nondecreasing order; that is, ! 271: a larger-numbered class must never be contained completely ! 272: in a smaller-numbered class. ! 273: ! 274: For any two classes, it is very desirable that there be another ! 275: class that represents their union. */ ! 276: ! 277: /* 1750 note: The names (BASE_REGS/INDEX_REGS) are used in their *gcc sense* ! 278: (i.e. *opposite* to the MIL-STD-1750A defined meanings). This means that ! 279: R1..R15 are called "base" regs and R12..R15 are "index" regs. ! 280: Index reg mode (in the gcc sense) is not yet implemented (these are the ! 281: 1750 "Base with Index Reg" instructions, LBX etc. See 1750.md) ! 282: ! 283: Here's an example to drive this point home: in "LBX B12,R5" ! 284: B12 shall be called the "index" reg and R5 shall be the "base" reg. ! 285: This naming inversion is due to the GCC defined capabilities of ! 286: "Base" vs. "Index" regs. */ ! 287: ! 288: enum reg_class { NO_REGS, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLASSES }; ! 289: ! 290: #define N_REG_CLASSES (int) LIM_REG_CLASSES ! 291: ! 292: /* Since GENERAL_REGS is the same class as ALL_REGS, ! 293: don't give it a different class number; just make it an alias. */ ! 294: #define GENERAL_REGS ALL_REGS ! 295: ! 296: /* Give names of register classes as strings for dump file. */ ! 297: ! 298: #define REG_CLASS_NAMES \ ! 299: { "NO_REGS", "INDEX_REGS", "BASE_REGS", "ALL_REGS" } ! 300: ! 301: /* Define which registers fit in which classes. ! 302: This is an initializer for a vector of HARD_REG_SET ! 303: of length N_REG_CLASSES. ! 304: 1750 "index" (remember, in the *GCC* sense!) regs are R12 through R15. ! 305: The only 1750 register not usable as BASE_REG is R0. */ ! 306: ! 307: #define REG_CLASS_CONTENTS {0, 0xf000, 0xfffe, 0xffff} ! 308: ! 309: /* The same information, inverted: ! 310: Return the class number of the smallest class containing ! 311: reg number REGNO. This could be a conditional expression ! 312: or could index an array. */ ! 313: #define REGNO_REG_CLASS(REGNO) \ ! 314: ((REGNO) >= 12 ? INDEX_REGS : (REGNO) > 0 ? BASE_REGS : ALL_REGS) ! 315: ! 316: /* The class value for index registers, and the one for base regs. */ ! 317: ! 318: #define BASE_REG_CLASS BASE_REGS ! 319: #define INDEX_REG_CLASS INDEX_REGS ! 320: ! 321: /* Get reg_class from a letter such as appears in the machine description. ! 322: For the 1750, we have 'b' for gcc Base regs and 'x' for gcc Index regs. */ ! 323: ! 324: #define REG_CLASS_FROM_LETTER(C) ((C) == 'b' ? BASE_REGS : \ ! 325: (C) == 'x' ? INDEX_REGS : NO_REGS) ! 326: ! 327: /* The letters I,J,K,.. to P in a register constraint string ! 328: can be used to stand for particular ranges of immediate operands. ! 329: This macro defines what the ranges are. ! 330: C is the letter, and VALUE is a constant value. ! 331: Return 1 if VALUE is in the range specified by C. ! 332: ! 333: For the 1750A, ! 334: `I' is used for ISP mode instructions, ! 335: `J' is used for ISN mode instructions, ! 336: `K' is used for the STC instruction's constant range, ! 337: `L' is used for unsigned 8-bit address displacements in instructions ! 338: of addressing mode "Base Relative", ! 339: `M' is for IM mode instructions et al., ! 340: `O' is a synonym for (const_int 0). */ ! 341: ! 342: #define CONST_OK_FOR_LETTER_P(VALUE, C) \ ! 343: ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 16 : \ ! 344: (C) == 'J' ? (VALUE) < 0 && (VALUE) >= -16 : \ ! 345: (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 15 : \ ! 346: (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 0xFF : \ ! 347: (C) == 'M' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \ ! 348: (C) == 'O' ? (VALUE) == 0 : 0) ! 349: ! 350: /* Similar, but for floating constants, and defining letter 'G'. ! 351: Here VALUE is the CONST_DOUBLE rtx itself. */ ! 352: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 ! 353: ! 354: /* Given an rtx X being reloaded into a reg required to be ! 355: in class CLASS, return the class of reg to actually use. ! 356: In general this is just CLASS; but on some machines ! 357: in some cases it is preferable to use a more restrictive class. ! 358: For the 1750A, we force an immediate CONST_DOUBLE value to memory. */ ! 359: #define PREFERRED_RELOAD_CLASS(X,CLASS) \ ! 360: (GET_CODE(X) == CONST_DOUBLE ? NO_REGS : CLASS) ! 361: ! 362: /* Return the maximum number of consecutive registers ! 363: needed to represent mode MODE in a register of class CLASS. ! 364: On the 1750A, this is the size of MODE in words, ! 365: since class doesn't make any difference. */ ! 366: #define CLASS_MAX_NREGS(CLASS,MODE) GET_MODE_SIZE(MODE) ! 367: ! 368: /*****************************************************************************/ ! 369: ! 370: /* Stack layout; function entry, exit and calling. */ ! 371: ! 372: /* Define this if pushing a word on the stack ! 373: makes the stack pointer a smaller address. */ ! 374: #define STACK_GROWS_DOWNWARD 1 ! 375: ! 376: /* Define this if the nominal address of the stack frame ! 377: is at the high-address end of the local variables; ! 378: goes at a more negative offset in the frame. ! 379: #define FRAME_GROWS_DOWNWARD ! 380: */ ! 381: ! 382: /* Offset within stack frame to start allocating local variables at. ! 383: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the ! 384: first local allocated. Otherwise, it is the offset to the BEGINNING ! 385: of the first local allocated. ! 386: */ ! 387: #define STARTING_FRAME_OFFSET 1 ! 388: ! 389: /* This is the default anyway: ! 390: #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) FRAMEADDR ! 391: */ ! 392: ! 393: /* If we generate an insn to push BYTES bytes, ! 394: this says how many the stack pointer really advances by. ! 395: 1750 note: what GCC calls a "byte" is really a 16-bit word, ! 396: because BITS_PER_UNIT is 16. */ ! 397: ! 398: #define PUSH_ROUNDING(BYTES) (BYTES) ! 399: ! 400: /* Define this macro if functions should assume that stack space has ! 401: been allocated for arguments even when their values are passed in ! 402: registers. ! 403: Size, in bytes, of the area reserved for arguments passed in ! 404: registers for the function represented by FNDECL. ! 405: #define REG_PARM_STACK_SPACE(FNDECL) 14 */ ! 406: ! 407: /* Define this if it is the responsibility of the caller to allocate ! 408: the area reserved for arguments passed in registers. ! 409: #define OUTGOING_REG_PARM_STACK_SPACE */ ! 410: ! 411: /* Offset of first parameter from the argument pointer register value. ! 412: 1750 note: ! 413: Parameters appear in reversed order on the frame (so when they are ! 414: popped, they come off in the normal left-to-right order.) ! 415: Computed as follows: ! 416: one word for the caller's (PC+1) (i.e. the return address) ! 417: plus total size of called function's "auto" variables ! 418: plus one word for the caller's frame pointer (i.e. the old FP) */ ! 419: ! 420: #define FIRST_PARM_OFFSET(FNDECL) \ ! 421: (1 + get_frame_size() + 1) ! 422: ! 423: /* Value is 1 if returning from a function call automatically ! 424: pops the arguments described by the number-of-args field in the call. ! 425: FUNTYPE is the data type of the function (as a tree), ! 426: or for a library call it is an identifier node for the subroutine name. ! 427: */ ! 428: ! 429: #define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0 ! 430: ! 431: /* Define how to find the value returned by a function. ! 432: VALTYPE is the data type of the value (as a tree). ! 433: If the precise function being called is known, FUNC is its FUNCTION_DECL; ! 434: otherwise, FUNC is 0. */ ! 435: ! 436: #define FUNCTION_VALUE(VALTYPE, FUNC) \ ! 437: gen_rtx(REG,TYPE_MODE(VALTYPE),0) ! 438: ! 439: /* Define how to find the value returned by a library function ! 440: assuming the value has mode MODE. */ ! 441: /* 1750 note: no libcalls yet */ ! 442: ! 443: #define LIBCALL_VALUE(MODE) printf("LIBCALL_VALUE called!\n"), \ ! 444: gen_rtx(REG,MODE,0) ! 445: ! 446: /* 1 if N is a possible register number for a function value. */ ! 447: ! 448: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) ! 449: ! 450: /* 1 if the tree TYPE should be returned in memory instead of in regs. ! 451: #define RETURN_IN_MEMORY(TYPE) \ ! 452: (int_size_in_bytes(TYPE) > 12) ! 453: */ ! 454: ! 455: /* Define this if PCC uses the nonreentrant convention for returning ! 456: structure and union values. ! 457: #define PCC_STATIC_STRUCT_RETURN */ ! 458: ! 459: /* 1 if N is a possible register number for function argument passing. */ ! 460: ! 461: #define FUNCTION_ARG_REGNO_P(N) ((N) < 12) ! 462: ! 463: /*****************************************************************************/ ! 464: ! 465: /* Define a data type for recording info about an argument list ! 466: during the scan of that argument list. This data type should ! 467: hold all necessary information about the function itself ! 468: and about the args processed so far, enough to enable macros ! 469: such as FUNCTION_ARG to determine where the next arg should go. ! 470: ! 471: For 1750A, this is a single integer, which is a number of words ! 472: of arguments scanned so far. */ ! 473: ! 474: #define CUMULATIVE_ARGS int ! 475: ! 476: /* Initialize a variable CUM of type CUMULATIVE_ARGS ! 477: for a call to a function whose data type is FNTYPE. ! 478: For a library call, FNTYPE is 0. ! 479: ! 480: For 1750A, the offset starts at 0. */ ! 481: ! 482: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) ((CUM) = 0) ! 483: ! 484: /* Update the data in CUM to advance over an argument ! 485: of mode MODE and data type TYPE. ! 486: (TYPE is null for libcalls where that information may not be available.) ! 487: ! 488: 1750 note: "int_size_in_bytes()" returns a unit relative to ! 489: BITS_PER_UNIT, so in our case not bytes, but 16-bit words. */ ! 490: ! 491: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ! 492: ((CUM) += (MODE) == BLKmode ? int_size_in_bytes(TYPE) : GET_MODE_SIZE(MODE)) ! 493: ! 494: /* Define where to put the arguments to a function. ! 495: Value is zero to push the argument on the stack, ! 496: or a hard register in which to store the argument. ! 497: ! 498: MODE is the argument's machine mode. ! 499: TYPE is the data type of the argument (as a tree). ! 500: This is null for libcalls where that information may ! 501: not be available. ! 502: CUM is a variable of type CUMULATIVE_ARGS which gives info about ! 503: the preceding args and about the function being called. ! 504: NAMED is nonzero if this argument is a named parameter ! 505: (otherwise it is an extra parameter matching an ellipsis). */ ! 506: ! 507: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ! 508: (rtx) function_arg(CUM,MODE,TYPE,NAMED) ! 509: /* ! 510: (! MUST_PASS_IN_STACK(MODE,TYPE) && \ ! 511: 14 >= (CUM) + \ ! 512: ((MODE)==BLKmode ? int_size_in_bytes(TYPE) : GET_MODE_SIZE (MODE)) \ ! 513: ? gen_rtx (REG, MODE, CUM) \ ! 514: : 0) ! 515: */ ! 516: ! 517: /* Define the following macro if function calls on the target machine ! 518: do not preserve any registers; in other words, if `CALL_USED_REGISTERS' ! 519: has 1 for all registers. This macro enables `-fcaller-saves' by ! 520: default. Eventually that option will be nabled by default on all ! 521: machines and both the option and this macro will be eliminated. */ ! 522: ! 523: #define DEFAULT_CALLER_SAVES ! 524: ! 525: ! 526: /* This macro generates the assembly code for function entry. ! 527: FILE is a stdio stream to output the code to. ! 528: SIZE is an int: how many units of temporary storage to allocate. ! 529: Refer to the array `regs_ever_live' to determine which registers ! 530: to save; `regs_ever_live[I]' is nonzero if register number I ! 531: is ever used in the function. This macro is responsible for ! 532: knowing which registers should not be saved even if used. */ ! 533: ! 534: ! 535: #define FUNCTION_PROLOGUE(FILE, SIZE) { \ ! 536: register int regno, none_used=1; \ ! 537: extern char call_used_regs[]; \ ! 538: fprintf(FILE, "; regs used in this function: "); \ ! 539: for (regno = 0; regno < 15; regno++) \ ! 540: if (regs_ever_live[regno]) { \ ! 541: fprintf(FILE," %s",reg_names[regno]); \ ! 542: none_used = 0; \ ! 543: } \ ! 544: if (none_used) \ ! 545: fprintf(FILE," (none)"); \ ! 546: fprintf(FILE,"\n"); \ ! 547: if (SIZE > 0) \ ! 548: fprintf(FILE,"\t%s\tr15,%d ; reserve local-variable space\n",\ ! 549: (SIZE <= 16 ? "sisp" : "sim"),SIZE); \ ! 550: fprintf(FILE,"\tpshm\tr14,r14 ; push old frame\n"); \ ! 551: fprintf(FILE,"\tlr\tr14,r15 ; set new frame\n"); \ ! 552: program_counter = 0; jmplbl_ndx = -1; \ ! 553: } ! 554: ! 555: /************* 1750: PROFILER HANDLING NOT YET DONE !!!!!!! *************/ ! 556: /* Output assembler code to FILE to increment profiler label # LABELNO ! 557: for profiling a function entry. */ ! 558: ! 559: #define FUNCTION_PROFILER(FILE, LABELNO) \ ! 560: fprintf (FILE, "; got into FUNCTION_PROFILER with label # %d\n", (LABELNO)) ! 561: ! 562: /* Output assembler code to FILE to initialize this source file's ! 563: basic block profiling info, if that has not already been done. */ ! 564: #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ ! 565: fprintf (FILE, "; got into FUNCTION_BLOCK_PROFILER with label # %d\n",LABELNO) ! 566: ! 567: /* Output assembler code to FILE to increment the entry-count for ! 568: the BLOCKNO'th basic block in this source file. */ ! 569: #define BLOCK_PROFILER(FILE, BLOCKNO) \ ! 570: fprintf (FILE, "; got into BLOCK_PROFILER with block # %d\n",BLOCKNO) ! 571: ! 572: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, ! 573: the stack pointer does not matter. The value is tested only in ! 574: functions that have frame pointers. ! 575: No definition is equivalent to always zero. */ ! 576: ! 577: #define EXIT_IGNORE_STACK 1 ! 578: ! 579: /* This macro generates the assembly code for function exit, ! 580: on machines that need it. If FUNCTION_EPILOGUE is not defined ! 581: then individual return instructions are generated for each ! 582: return statement. Args are same as for FUNCTION_PROLOGUE. ! 583: ! 584: The function epilogue should not depend on the current stack pointer! ! 585: It should use the frame pointer only. This is mandatory because ! 586: of alloca; we also take advantage of it to omit stack adjustments ! 587: before returning. */ ! 588: ! 589: #define FUNCTION_EPILOGUE(FILE, SIZE) { \ ! 590: if (SIZE > 0) \ ! 591: fprintf(FILE,"\t%s\tr14,%d ; free up local-var space\n", \ ! 592: (SIZE <= 16 ? "aisp" : "aim"),SIZE); \ ! 593: fprintf(FILE,"\tlr\tr15,r14 ; set stack to return addr\n"); \ ! 594: fprintf(FILE,"\tpopm\tr14,r14 ; restore prev. frame ptr\n"); \ ! 595: fprintf(FILE,"\turs\tr15\n"); } ! 596: ! 597: /* If the memory address ADDR is relative to the frame pointer, ! 598: correct it to be relative to the stack pointer instead. ! 599: This is for when we don't use a frame pointer. ! 600: ADDR should be a variable name. */ ! 601: ! 602: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \ ! 603: fprintf(stderr,"FIX_FRAME_POINTER_ADDRESS called, DEPTH=%d\n"), \ ! 604: DEPTH), abort() ! 605: ! 606: /* Store in the variable DEPTH the initial difference between the ! 607: frame pointer reg contents and the stack pointer reg contents, ! 608: as of the start of the function body. This depends on the layout ! 609: of the fixed parts of the stack frame and on how registers are saved. ! 610: */ ! 611: #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) DEPTH = 0 ! 612: ! 613: /* 1750: not needed 'cause we have INITIAL_FRAME_POINTER_OFFSET. ! 614: #define ELIMINABLE_REGS { \ ! 615: { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ ! 616: { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \ ! 617: { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM } } ! 618: ! 619: #define CAN_ELIMINATE(FROM, TO) 1 ! 620: ! 621: #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) { OFFSET = 0; } ! 622: */ ! 623: ! 624: ! 625: /* Output assembler code for a block containing the constant parts ! 626: of a trampoline, leaving space for the variable parts. */ ! 627: ! 628: #define TRAMPOLINE_TEMPLATE(FILE) fprintf(FILE,"TRAMPOLINE_TEMPLATE called\n") ! 629: ! 630: /* Length in units of the trampoline for entering a nested function. */ ! 631: ! 632: #define TRAMPOLINE_SIZE 2 ! 633: ! 634: /* Emit RTL insns to initialize the variable parts of a trampoline. ! 635: FNADDR is an RTX for the address of the function's pure code. ! 636: CXT is an RTX for the static chain value for the function. */ ! 637: ! 638: #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) printf("INITIALIZE_TRAMPO called\n") ! 639: /* { \ ! 640: emit_move_insn (gen_rtx (MEM, QImode, plus_constant (TRAMP, 1)), CXT); \ ! 641: emit_move_insn (gen_rtx (MEM, QImode, plus_constant (TRAMP, 6)), FNADDR); \ ! 642: } */ ! 643: ! 644: ! 645: /*****************************************************************************/ ! 646: ! 647: /* Addressing modes, and classification of registers for them. */ ! 648: ! 649: /* 1750 doesn't have a lot of auto-incr./decr. - just for the stack ptr. */ ! 650: ! 651: /* #define HAVE_POST_INCREMENT just for R15 (stack pointer) */ ! 652: /* #define HAVE_POST_DECREMENT */ ! 653: /* #define HAVE_PRE_DECREMENT just for R15 (stack pointer) */ ! 654: /* #define HAVE_PRE_INCREMENT */ ! 655: ! 656: /* Macros to check register numbers against specific register classes. */ ! 657: ! 658: /* These assume that REGNO is a hard or pseudo reg number. ! 659: They give nonzero only if REGNO is a hard reg of the suitable class ! 660: or a pseudo reg currently allocated to a suitable hard reg. ! 661: Since they use reg_renumber, they are safe only once reg_renumber ! 662: has been allocated, which happens in local-alloc.c. ! 663: 1750 note: The words BASE and INDEX are used in their GCC senses: ! 664: The "Index Registers", R12 through R15, can have an address displacement ! 665: int the range 0..255 words. ! 666: */ ! 667: ! 668: #define REGNO_OK_FOR_BASE_P(REGNO) \ ! 669: ((REGNO) > 0 && (REGNO) <= 15 || \ ! 670: reg_renumber[REGNO] > 0 && reg_renumber[REGNO] < 15) ! 671: #define REGNO_OK_FOR_INDEX_P(REGNO) \ ! 672: ((REGNO) >= 12 && (REGNO) <= 15 || \ ! 673: reg_renumber[REGNO] >= 12 && reg_renumber[REGNO] <= 15) ! 674: ! 675: /* Now macros that check whether X is a register and also, ! 676: strictly, whether it is in a specified class. ! 677: ! 678: /* 1 if X is an address register */ ! 679: ! 680: #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X))) ! 681: ! 682: /* Maximum number of registers that can appear in a valid memory address. */ ! 683: #define MAX_REGS_PER_ADDRESS 1 ! 684: ! 685: /* Recognize any constant value that is a valid address. */ ! 686: ! 687: #define CONSTANT_ADDRESS_P(X) CONSTANT_P(X) ! 688: ! 689: /* Nonzero if the constant value X is a legitimate general operand. ! 690: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ ! 691: ! 692: #define LEGITIMATE_CONSTANT_P(X) 1 ! 693: ! 694: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx ! 695: and check its validity for a certain class. ! 696: We have two alternate definitions for each of them. ! 697: The usual definition accepts all pseudo regs; the other rejects ! 698: them unless they have been allocated suitable hard regs. ! 699: The symbol REG_OK_STRICT causes the latter definition to be used. ! 700: ! 701: Most source files want to accept pseudo regs in the hope that ! 702: they will get allocated to the class that the insn wants them to be in. ! 703: Source files for reload pass need to be strict. ! 704: After reload, it makes no difference, since pseudo regs have ! 705: been eliminated by then. */ ! 706: ! 707: #ifdef REG_OK_STRICT ! 708: ! 709: /* Nonzero if X is a hard reg that can be used as an index. */ ! 710: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) ! 711: /* Nonzero if X is a hard reg that can be used as a base reg. */ ! 712: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) ! 713: ! 714: #else ! 715: ! 716: /* Nonzero if X is a hard reg that can be used as an index ! 717: or if it is a pseudo reg. */ ! 718: #define REG_OK_FOR_INDEX_P(X) (REGNO (X) >= 12) ! 719: /* Nonzero if X is a hard reg that can be used as a base reg ! 720: or if it is a pseudo reg. */ ! 721: #define REG_OK_FOR_BASE_P(X) (REGNO (X) > 0) ! 722: ! 723: #endif ! 724: ! 725: ! 726: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression ! 727: that is a valid memory address for an instruction. ! 728: The MODE argument is the machine mode for the MEM expression ! 729: that wants to use this address. ! 730: The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. ! 731: ! 732: 1750 note: Currently we don't implement address expressions that use ! 733: GCC "Index"-class regs. To be expanded to handle the 1750 "Base with Index" ! 734: instructions (see also MAX_REGS_PER_ADDRESS and others). */ ! 735: ! 736: #define GO_IF_BASED_ADDRESS(X, ADDR) { \ ! 737: if ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P(X))) \ ! 738: goto ADDR; \ ! 739: if (GET_CODE (X) == PLUS) \ ! 740: { register rtx x0 = XEXP(X,0), x1 = XEXP(X,1); \ ! 741: if ((REG_P(x0) && REG_OK_FOR_BASE_P(x0) && CONSTANT_ADDRESS_P(x1)) \ ! 742: || (REG_P(x1) && REG_OK_FOR_BASE_P(x1) && CONSTANT_ADDRESS_P(x0))) \ ! 743: goto ADDR; } } ! 744: ! 745: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) { \ ! 746: if (CONSTANT_ADDRESS_P(X)) goto ADDR; \ ! 747: GO_IF_BASED_ADDRESS(X,ADDR) } ! 748: ! 749: ! 750: /* Try machine-dependent ways of modifying an illegitimate address ! 751: to be legitimate. If we find one, return the new, valid address. ! 752: This macro is used in only one place: `memory_address' in explow.c. ! 753: ! 754: OLDX is the address as it was before break_out_memory_refs was called. ! 755: In some cases it is useful to look at this to decide what needs to be done. ! 756: ! 757: MODE and WIN are passed so that this macro can use ! 758: GO_IF_LEGITIMATE_ADDRESS. ! 759: ! 760: It is always safe for this macro to do nothing. It exists to recognize ! 761: opportunities to optimize the output. */ ! 762: ! 763: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) ! 764: ! 765: /* Go to LABEL if ADDR (a legitimate address expression) ! 766: has an effect that depends on the machine mode it is used for. ! 767: On the 68000, only predecrement and postincrement address depend thus ! 768: (the amount of decrement or increment being the length of the operand). */ ! 769: /* 1750: not used. */ ! 770: ! 771: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) ! 772: ! 773: /*****************************************************************************/ ! 774: ! 775: /* Specify the machine mode that this machine uses ! 776: for the index in the tablejump instruction. */ ! 777: #define CASE_VECTOR_MODE QImode ! 778: ! 779: /* Define this if the tablejump instruction expects the table ! 780: to contain offsets from the address of the table. ! 781: Do not define this if the table should contain absolute addresses. */ ! 782: /* #define CASE_VECTOR_PC_RELATIVE */ ! 783: ! 784: /* Specify the tree operation to be used to convert reals to integers. */ ! 785: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR ! 786: ! 787: /* This is the kind of divide that is easiest to do in the general case. */ ! 788: #define EASY_DIV_EXPR TRUNC_DIV_EXPR ! 789: ! 790: /* Define this as 1 if `char' should by default be signed; else as 0. */ ! 791: #define DEFAULT_SIGNED_CHAR 0 ! 792: ! 793: /* Max number of bytes we can move from memory to memory ! 794: in one reasonably fast instruction. */ ! 795: /* (was: "1750: not counting the MOV instruction") */ ! 796: #define MOVE_MAX 16 ! 797: ! 798: /* Define this if zero-extension is slow (more than one real instruction). */ ! 799: /* #define SLOW_ZERO_EXTEND */ ! 800: ! 801: /* Nonzero if access to memory by bytes is slow and undesirable. */ ! 802: #define SLOW_BYTE_ACCESS 0 ! 803: ! 804: /* Define if shifts truncate the shift count ! 805: which implies one can omit a sign-extension or zero-extension ! 806: of a shift count. */ ! 807: /* #define SHIFT_COUNT_TRUNCATED 1 */ ! 808: ! 809: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits ! 810: is done just by pretending it is already truncated. */ ! 811: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 ! 812: ! 813: /* We assume that the store-condition-codes instructions store 0 for false ! 814: and some other value for true. This is the value stored for true. */ ! 815: ! 816: #define STORE_FLAG_VALUE 1 ! 817: ! 818: /* When a prototype says `char' or `short', really pass an `int'. ! 819: 1750: for now, `char' is 16 bits wide anyway. ! 820: #define PROMOTE_PROTOTYPES */ ! 821: ! 822: /* Specify the machine mode that pointers have. ! 823: After generation of rtl, the compiler makes no further distinction ! 824: between pointers and any other objects of this machine mode. */ ! 825: #define Pmode QImode ! 826: ! 827: /* A function address in a call instruction ! 828: is a 16-bit address (for indexing purposes) */ ! 829: #define FUNCTION_MODE QImode ! 830: ! 831: /* Compute the cost of computing a constant rtl expression RTX ! 832: whose rtx-code is CODE. The body of this macro is a portion ! 833: of a switch statement. If the code is computed here, ! 834: return it with a return statement. Otherwise, break from the switch. */ ! 835: /* 1750 note: haven't paid attention to this yet. */ ! 836: ! 837: #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ ! 838: case CONST_INT: \ ! 839: if (INTVAL(RTX) >= -16 && INTVAL(RTX) <= 16) return 1; \ ! 840: case CONST: \ ! 841: case LABEL_REF: \ ! 842: case SYMBOL_REF: \ ! 843: return 5; \ ! 844: case CONST_DOUBLE: \ ! 845: return 7; ! 846: ! 847: #define ADDRESS_COST(ADDRESS) (memop_valid(ADDRESS) ? 3 : 1000) ! 848: ! 849: /* Tell final.c how to eliminate redundant test instructions. */ ! 850: ! 851: /* Here we define machine-dependent flags and fields in cc_status ! 852: (see `conditions.h'). */ ! 853: /* MIL-STD-1750: none -- just has the garden variety C,P,Z,N flags. */ ! 854: ! 855: /* Store in cc_status the expressions ! 856: that the condition codes will describe ! 857: after execution of an instruction whose pattern is EXP. ! 858: Do not alter them if the instruction would not alter the cc's. ! 859: 1750: See file out-1750a.c for notice_update_cc(). */ ! 860: ! 861: #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP) ! 862: ! 863: /**********************************************/ ! 864: /* Produce debugging info in the DWARF format ! 865: #define DWARF_DEBUGGING_INFO ! 866: */ ! 867: ! 868: /*****************************************************************************/ ! 869: ! 870: /* Control the assembler format that we output. */ ! 871: ! 872: /* Output at beginning of assembler file. */ ! 873: ! 874: #define ASM_FILE_START(FILE) { \ ! 875: char *p, name[40]; \ ! 876: if ((p = (char *)strrchr(main_input_filename,'/')) != NULL ? 1 : \ ! 877: (p = (char *)strrchr(main_input_filename,']')) != NULL) \ ! 878: p++; \ ! 879: else \ ! 880: p = main_input_filename; \ ! 881: strcpy(name,p); \ ! 882: if (p = (char *)strchr(name,'.')) \ ! 883: *p = '\0'; \ ! 884: fprintf(FILE,"\tname %s\n",name); \ ! 885: fprintf(FILE,"\tnolist\n\tinclude \"ms1750.inc\"\n\tlist\n\n"); \ ! 886: fprintf(FILE,"\tglobal\t__main\n\n"); } ! 887: ! 888: /* Output at end of assembler file. ! 889: For 1750, we copy the data labels accrued in datalbl[] from the Constants ! 890: section (Konst) to the Writable-Data section (Static). */ ! 891: ! 892: #define ASM_FILE_END(FILE) \ ! 893: do { \ ! 894: if (datalbl_ndx >= 0) { \ ! 895: int i, cum_size=0; \ ! 896: fprintf(FILE,"\n\tstatic\ninit_srel\n"); \ ! 897: for (i = 0; i <= datalbl_ndx; i++) { \ ! 898: if (datalbl[i].name == NULL) \ ! 899: { \ ! 900: fprintf(stderr, "asm_file_end internal datalbl err\n"); \ ! 901: exit (0); \ ! 902: } \ ! 903: fprintf(FILE,"%s \tblock %d\n", \ ! 904: datalbl[i].name,datalbl[i].size); \ ! 905: cum_size += datalbl[i].size; \ ! 906: } \ ! 907: fprintf(FILE,"\n\tinit\n"); \ ! 908: fprintf(FILE,"\tlim\tr0,init_srel\n"); /* destin. */ \ ! 909: fprintf(FILE,"\tlim\tr1,%d\n",cum_size); /* count */ \ ! 910: fprintf(FILE,"\tlim\tr2,K%s\n",datalbl[0].name); /* source */ \ ! 911: fprintf(FILE,"\tmov\tr0,r2\n"); \ ! 912: fprintf(FILE,"\n\tnormal\n"); \ ! 913: datalbl_ndx = -1; /* reset stuff */ \ ! 914: for (i = 0; i < DATALBL_ARRSIZ; i++) \ ! 915: datalbl[i].size = 0; \ ! 916: } \ ! 917: fprintf(FILE,"\n\tend\n"); \ ! 918: } while (0) ! 919: ! 920: /* Output to assembler file text saying following lines ! 921: may contain character constants, extra white space, comments, etc. */ ! 922: ! 923: #define ASM_APP_ON "\n\tif 0\n; by ASM_APP_ON\n" ! 924: ! 925: /* Output to assembler file text saying following lines ! 926: no longer contain unusual constructs. */ ! 927: ! 928: #define ASM_APP_OFF "\n\tendif\n" ! 929: ! 930: ! 931: #define EXTRA_SECTIONS in_readonly_data ! 932: ! 933: #define EXTRA_SECTION_FUNCTIONS \ ! 934: void const_section() \ ! 935: { \ ! 936: fprintf(asm_out_file,"\tkonst\n"); \ ! 937: current_section = Konst; \ ! 938: } \ ! 939: check_section(enum section sect) \ ! 940: { \ ! 941: if (current_section != sect) { \ ! 942: fprintf(asm_out_file,"\t%s\n",sectname[(int)sect]); \ ! 943: current_section = sect; \ ! 944: } \ ! 945: switch (sect) { \ ! 946: case Init: \ ! 947: case Normal: \ ! 948: in_section = in_text; \ ! 949: break; \ ! 950: case Static: \ ! 951: in_section = in_data; \ ! 952: break; \ ! 953: case Konst: \ ! 954: in_section = in_readonly_data; \ ! 955: break; \ ! 956: } \ ! 957: } ! 958: ! 959: ! 960: /* Function that switches to the read-only data section (optional) */ ! 961: #define READONLY_DATA_SECTION const_section ! 962: ! 963: /* Output before program init section */ ! 964: #define INIT_SECTION_ASM_OP "\n\tinit ; init_section\n" ! 965: ! 966: /* Output before program text section */ ! 967: #define TEXT_SECTION_ASM_OP "\n\tnormal ; text_section\n" ! 968: ! 969: /* Output before writable data. */ ! 970: #define DATA_SECTION_ASM_OP "\n\tstatic ; data_section\n" ! 971: ! 972: /* How to refer to registers in assembler output. ! 973: This sequence is indexed by compiler's hard-register-number (see above). */ ! 974: ! 975: #define REGISTER_NAMES \ ! 976: { "0", "1", "2", "3", "4", "5", "6", "7", \ ! 977: "8", "9","10","11","12","13","14","15" } ! 978: ! 979: /* How to renumber registers for dbx and gdb. */ ! 980: ! 981: #define DBX_REGISTER_NUMBER(REGNO) (REGNO) ! 982: ! 983: /****************** Assembler output formatting **********************/ ! 984: ! 985: #define ASM_IDENTIFY_GCC(FILE) fputs ("; gcc2_compiled:\n", FILE) ! 986: ! 987: #define ASM_COMMENT_START ";" ! 988: ! 989: #define ASM_OUTPUT_FUNNAM(FILE,NAME) \ ! 990: fprintf(FILE,"%s\n",NAME) ! 991: ! 992: #define ASM_OUTPUT_OPCODE(FILE,PTR) do { \ ! 993: while (*(PTR) != '\0' && *(PTR) != ' ') { \ ! 994: putc (*(PTR), FILE); \ ! 995: (PTR)++; \ ! 996: } \ ! 997: while (*(PTR) == ' ') \ ! 998: (PTR)++; \ ! 999: putc ('\t', FILE); \ ! 1000: program_counter += 2; \ ! 1001: } while (0) ! 1002: ! 1003: #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ ! 1004: fprintf(FILE,"%s\n",NAME) ! 1005: ! 1006: /* This is how to output the definition of a user-level label named NAME, ! 1007: such as the label on a static function or variable NAME. */ ! 1008: /* 1750 note: Labels are prefixed with a 'K'. This is because handling ! 1009: has been changed for labels to be output in the "Constants" section ! 1010: (named "Konst"), and special initialization code takes care of copying ! 1011: the Const-section data into the writable data section (named "Static"). ! 1012: In the Static section we therefore have the true label names (i.e. ! 1013: not prefixed with 'K'). */ ! 1014: ! 1015: #define ASM_OUTPUT_LABEL(FILE,NAME) \ ! 1016: do { if (NAME[0] == '.') { \ ! 1017: fprintf(stderr,"Oops! label %s can't begin with '.'\n",NAME); \ ! 1018: abort(); \ ! 1019: } \ ! 1020: else { \ ! 1021: check_section(Konst); \ ! 1022: fprintf(FILE,"K%s\n",NAME); \ ! 1023: datalbl[++datalbl_ndx].name = (char *)strdup (NAME); \ ! 1024: label_pending = 1; \ ! 1025: } \ ! 1026: } while (0) ! 1027: ! 1028: ! 1029: /* This is how to output a command to make the user-level label named NAME ! 1030: defined for reference from other files. */ ! 1031: ! 1032: #define ASM_GLOBALIZE_LABEL(FILE,NAME) do { \ ! 1033: fprintf (FILE, "\tglobal %s\t; export\n", NAME); \ ! 1034: } while (0) ! 1035: ! 1036: /* This is how to output a reference to a user-level label named NAME. ! 1037: `assemble_name' uses this. */ ! 1038: ! 1039: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 1040: fprintf (FILE, "%s", NAME) ! 1041: ! 1042: /* This is how to output an internal numbered label where ! 1043: PREFIX is the class of label and NUM is the number within the class. */ ! 1044: ! 1045: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 1046: do { \ ! 1047: if (strcmp(PREFIX,"LC") == 0) { \ ! 1048: label_pending = 1; \ ! 1049: datalbl[++datalbl_ndx].name = (char *) malloc (9); \ ! 1050: sprintf(datalbl[datalbl_ndx].name,"LC%d",NUM); \ ! 1051: check_section(Konst); \ ! 1052: fprintf(FILE,"K%s%d\n",PREFIX,NUM); \ ! 1053: } \ ! 1054: else if (find_jmplbl(NUM) < 0) { \ ! 1055: jmplbl[++jmplbl_ndx].num = NUM; \ ! 1056: jmplbl[jmplbl_ndx].pc = program_counter; \ ! 1057: fprintf(FILE, "%s%d\n", PREFIX, NUM); \ ! 1058: } \ ! 1059: } while (0) ! 1060: ! 1061: ! 1062: /* This is how to store into the string LABEL ! 1063: the symbol_ref name of an internal numbered label where ! 1064: PREFIX is the class of label and NUM is the number within the class. ! 1065: This is suitable for output with `assemble_name'. */ ! 1066: ! 1067: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ ! 1068: sprintf (LABEL, "%s%d", PREFIX, NUM) ! 1069: ! 1070: /* This is how to output an assembler line defining a 1750A `float' ! 1071: constant. */ ! 1072: ! 1073: #define ASM_OUTPUT_SHORT_FLOAT(FILE,VALUE) \ ! 1074: do { \ ! 1075: if (label_pending) \ ! 1076: label_pending = 0; \ ! 1077: else \ ! 1078: datalbl[++datalbl_ndx].name = float_label('D',VALUE); \ ! 1079: sprintf (datalbl[datalbl_ndx].value, "%lf", (double) VALUE); \ ! 1080: datalbl[datalbl_ndx].size = 2; \ ! 1081: fprintf (FILE, "\tdataf\t%lf\n",VALUE); \ ! 1082: } while(0) ! 1083: ! 1084: /* This is how to output an assembler line defining a 1750A `double' ! 1085: constant. */ ! 1086: ! 1087: #define ASM_OUTPUT_THREE_QUARTER_FLOAT(FILE,VALUE) \ ! 1088: do { \ ! 1089: if (label_pending) \ ! 1090: label_pending = 0; \ ! 1091: else \ ! 1092: datalbl[++datalbl_ndx].name = float_label('E',VALUE); \ ! 1093: sprintf (datalbl[datalbl_ndx].value, "%lf", VALUE); \ ! 1094: datalbl[datalbl_ndx].size = 3; \ ! 1095: fprintf(FILE,"\tdataef\t%lf\n",VALUE); \ ! 1096: } while (0) ! 1097: ! 1098: /* This is how to output an assembler line defining a string constant. */ ! 1099: ! 1100: #define ASM_OUTPUT_ASCII(FILE, PTR, LEN) do { \ ! 1101: int i; \ ! 1102: if (! label_pending) \ ! 1103: fprintf(FILE,";in ASM_OUTPUT_ASCII without label_pending\n");\ ! 1104: else { \ ! 1105: label_pending = 0; \ ! 1106: datalbl[datalbl_ndx].size = LEN; \ ! 1107: } \ ! 1108: for (i = 0; i < LEN; i++) \ ! 1109: if (PTR[i] >= 32 && PTR[i] < 127) \ ! 1110: fprintf(FILE,"\tdata\t%d\t; '%c'\n",PTR[i],PTR[i]); \ ! 1111: else \ ! 1112: fprintf(FILE,"\tdata\t%d\t; (ascii)\n",PTR[i]); \ ! 1113: } while (0) ! 1114: ! 1115: /* This is how to output an assembler line defining an `int' constant. */ ! 1116: ! 1117: #define ASM_OUTPUT_INT(FILE,VALUE) do { \ ! 1118: if (! label_pending) \ ! 1119: fprintf(FILE,";in ASM_OUTPUT_INT without label_pending\n"); \ ! 1120: else { \ ! 1121: label_pending = 0; \ ! 1122: datalbl[datalbl_ndx].size = 1; \ ! 1123: } \ ! 1124: fprintf(FILE, "\tdata\t"); output_addr_const(FILE,VALUE); \ ! 1125: fprintf(FILE, "\n"); } while (0) ! 1126: ! 1127: /* This is how to output an assembler line defining a `long int' constant. */ ! 1128: ! 1129: #define ASM_OUTPUT_LONG_INT(FILE,VALUE) do { \ ! 1130: if (! label_pending) \ ! 1131: fprintf(FILE,";in ASM_OUTPUT_LONG_INT without label_pending\n");\ ! 1132: else { \ ! 1133: label_pending = 0; \ ! 1134: datalbl[datalbl_ndx].size = 2; \ ! 1135: } \ ! 1136: fprintf(FILE, "\tdatal\t"); output_addr_const(FILE,VALUE); \ ! 1137: fprintf(FILE, "\n"); } while (0) ! 1138: ! 1139: /* Likewise for `short' and `char' constants. */ ! 1140: ! 1141: #define ASM_OUTPUT_SHORT(FILE,VALUE) ASM_OUTPUT_INT(FILE,VALUE) ! 1142: ! 1143: /* For 1750, we treat char same as word. Tektronix 1750 ! 1144: Assembler does a better (packing) job with strings. */ ! 1145: #define ASM_OUTPUT_CHAR(FILE,VALUE) ASM_OUTPUT_INT(FILE,VALUE) ! 1146: ! 1147: /* This is how to output an assembler line for a numeric constant byte. */ ! 1148: /* 1750: For the time being, treating this same as word. Tektronix 1750 ! 1149: Assembler does a better (packing) job with strings. */ ! 1150: #define ASM_OUTPUT_BYTE(FILE,VALUE) ASM_OUTPUT_INT(FILE,VALUE) ! 1151: ! 1152: /* This is how to output an insn to push a register on the stack. ! 1153: It need not be very fast code. */ ! 1154: ! 1155: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ ! 1156: fprintf (FILE, "\tPSHM R%s,R%s\n", reg_names[REGNO]) ! 1157: ! 1158: /* This is how to output an insn to pop a register from the stack. ! 1159: It need not be very fast code. */ ! 1160: ! 1161: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ ! 1162: fprintf (FILE, "\tPOPM R%s,R%s\n", reg_names[REGNO]) ! 1163: ! 1164: /* This is how to output an element of a case-vector that is absolute. */ ! 1165: ! 1166: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ! 1167: fprintf (FILE, "\tdata\tL%d ;addr_vec_elt\n", VALUE) ! 1168: ! 1169: /* This is how to output an element of a case-vector that is relative. */ ! 1170: ! 1171: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ! 1172: fprintf (FILE, "\tdata\tL%d-L%d ;addr_diff_elt\n", VALUE,REL) ! 1173: ! 1174: /* This is how to output an assembler line ! 1175: that says to advance the location counter ! 1176: to a multiple of 2**LOG bytes. */ ! 1177: ! 1178: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 1179: fprintf(FILE,"; in ASM_OUTPUT_ALIGN: pwr_of_2_bytcnt=%d\n",LOG) ! 1180: ! 1181: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 1182: fprintf(FILE,"; in ASM_OUTPUT_SKIP: size=%d\n",SIZE) ! 1183: ! 1184: /* This says how to output an assembler line ! 1185: to define a global common symbol. */ ! 1186: ! 1187: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) do { \ ! 1188: fprintf (FILE, "\tcommon %s,%d\n", NAME, SIZE); \ ! 1189: } while (0) ! 1190: ! 1191: #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) do { \ ! 1192: fprintf (FILE, "\tglobal %s\t; import\n", NAME); \ ! 1193: } while (0) ! 1194: ! 1195: /* This says how to output an assembler line ! 1196: to define a local common symbol. */ ! 1197: ! 1198: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) do { \ ! 1199: check_section (Static); \ ! 1200: fprintf(FILE,"%s \tblock %d\t; local common\n",NAME,SIZE); \ ! 1201: } while (0) ! 1202: ! 1203: /* Store in OUTPUT a string (made with alloca) containing ! 1204: an assembler-name for a local static variable named NAME. ! 1205: LABELNO is an integer which is different for each call. */ ! 1206: ! 1207: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ! 1208: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ ! 1209: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) ! 1210: ! 1211: #define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) do { \ ! 1212: fprintf(FILE, "\tinit\n\t"); assemble_name(NAME); \ ! 1213: fprintf(FILE," ;constructor"); } while (0) ! 1214: ! 1215: #define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) do { \ ! 1216: fprintf(FILE, "\tinit\n\t"); assemble_name(NAME); \ ! 1217: fprintf(FILE," ;destructor"); } while (0) ! 1218: ! 1219: /* Define the parentheses used to group arithmetic operations ! 1220: in assembler code. */ ! 1221: ! 1222: #define ASM_OPEN_PAREN "(" ! 1223: #define ASM_CLOSE_PAREN ")" ! 1224: ! 1225: /* Define results of standard character escape sequences. */ ! 1226: #define TARGET_BELL 007 ! 1227: #define TARGET_BS 010 ! 1228: #define TARGET_TAB 011 ! 1229: #define TARGET_NEWLINE 012 ! 1230: #define TARGET_VT 013 ! 1231: #define TARGET_FF 014 ! 1232: #define TARGET_CR 015 ! 1233: ! 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: 1750 note: there are three special CODE characters: ! 1239: 'D', 'E': print a reference to a floating point constant (D=double, ! 1240: E=single precision) label name ! 1241: 'F': print a label defining a floating-point constant value ! 1242: 'J': print the absolute value of a negative INT_CONST ! 1243: (this is used in LISN/CISN/MISN/SISP and others) */ ! 1244: ! 1245: /* 1750A: see file aux-output.c */ ! 1246: #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE) ! 1247: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE,ADDR) ! 1248:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.