home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gcc-2.7.2.1-base.tgz / gcc-2.7.2.1-base.tar / fsf / gcc / config / 1750a / 1750a.h < prev    next >
C/C++ Source or Header  |  1995-11-26  |  49KB  |  1,314 lines

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