home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / gcc.i16 (.txt) < prev    next >
GNU Info File  |  1993-06-12  |  46KB  |  755 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.47 from the input
  2. file gcc.tex.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the sections entitled "GNU General Public License" and "Protect
  11. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  12. original, and provided that the entire resulting derived work is
  13. distributed under the terms of a permission notice identical to this
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the sections entitled "GNU General Public
  17. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  18. permission notice, may be included in translations approved by the Free
  19. Software Foundation instead of in the original English.
  20. File: gcc.info,  Node: Function Entry,  Next: Profiling,  Prev: Caller Saves,  Up: Stack and Calling
  21. Function Entry and Exit
  22. -----------------------
  23.    This section describes the macros that output function entry
  24. ("prologue") and exit ("epilogue") code.
  25. `FUNCTION_PROLOGUE (FILE, SIZE)'
  26.      A C compound statement that outputs the assembler code for entry
  27.      to a function.  The prologue is responsible for setting up the
  28.      stack frame, initializing the frame pointer register, saving
  29.      registers that must be saved, and allocating SIZE additional bytes
  30.      of storage for the local variables.  SIZE is an integer.  FILE is
  31.      a stdio stream to which the assembler code should be output.
  32.      The label for the beginning of the function need not be output by
  33.      this macro.  That has already been done when the macro is run.
  34.      To determine which registers to save, the macro can refer to the
  35.      array `regs_ever_live': element R is nonzero if hard register R is
  36.      used anywhere within the function.  This implies the function
  37.      prologue should save register R, provided it is not one of the
  38.      call-used registers.  (`FUNCTION_EPILOGUE' must likewise use
  39.      `regs_ever_live'.)
  40.      On machines that have "register windows", the function entry code
  41.      does not save on the stack the registers that are in the windows,
  42.      even if they are supposed to be preserved by function calls;
  43.      instead it takes appropriate steps to "push" the register stack,
  44.      if any non-call-used registers are used in the function.
  45.      On machines where functions may or may not have frame-pointers, the
  46.      function entry code must vary accordingly; it must set up the frame
  47.      pointer if one is wanted, and not otherwise.  To determine whether
  48.      a frame pointer is in wanted, the macro can refer to the variable
  49.      `frame_pointer_needed'.  The variable's value will be 1 at run
  50.      time in a function that needs a frame pointer.  *Note
  51.      Elimination::.
  52.      The function entry code is responsible for allocating any stack
  53.      space required for the function.  This stack space consists of the
  54.      regions listed below.  In most cases, these regions are allocated
  55.      in the order listed, with the last listed region closest to the
  56.      top of the stack (the lowest address if `STACK_GROWS_DOWNWARD' is
  57.      defined, and the highest address if it is not defined).  You can
  58.      use a different order for a machine if doing so is more convenient
  59.      or required for compatibility reasons.  Except in cases where
  60.      required by standard or by a debugger, there is no reason why the
  61.      stack layout used by GCC need agree with that used by other
  62.      compilers for a machine.
  63.         * A region of `current_function_pretend_args_size' bytes of
  64.           uninitialized space just underneath the first argument
  65.           arriving on the stack.  (This may not be at the very start of
  66.           the allocated stack region if the calling sequence has pushed
  67.           anything else since pushing the stack arguments.  But
  68.           usually, on such machines, nothing else has been pushed yet,
  69.           because the function prologue itself does all the pushing.) 
  70.           This region is used on machines where an argument may be
  71.           passed partly in registers and partly in memory, and, in some
  72.           cases to support the features in `varargs.h' and `stdargs.h'.
  73.         * An area of memory used to save certain registers used by the
  74.           function. The size of this area, which may also include space
  75.           for such things as the return address and pointers to
  76.           previous stack frames, is machine-specific and usually
  77.           depends on which registers have been used in the function. 
  78.           Machines with register windows often do not require a save
  79.           area.
  80.         * A region of at least SIZE bytes, possibly rounded up to an
  81.           allocation boundary, to contain the local variables of the
  82.           function.  On some machines, this region and the save area
  83.           may occur in the opposite order, with the save area closer to
  84.           the top of the stack.
  85.         * Optionally, in the case that `ACCUMULATE_OUTGOING_ARGS' is
  86.           defined, a region of `current_function_outgoing_args_size'
  87.           bytes to be used for outgoing argument lists of the function.
  88.            *Note Stack Arguments::.
  89.      Normally, it is necessary for `FUNCTION_PROLOGUE' and
  90.      `FUNCTION_EPILOGUE' to treat leaf functions specially.  The C
  91.      variable `leaf_function' is nonzero for such a function.
  92. `EXIT_IGNORE_STACK'
  93.      Define this macro as a C expression that is nonzero if the return
  94.      instruction or the function epilogue ignores the value of the stack
  95.      pointer; in other words, if it is safe to delete an instruction to
  96.      adjust the stack pointer before a return from the function.
  97.      Note that this macro's value is relevant only for functions for
  98.      which frame pointers are maintained.  It is never safe to delete a
  99.      final stack adjustment in a function that has no frame pointer,
  100.      and the compiler knows this regardless of `EXIT_IGNORE_STACK'.
  101. `FUNCTION_EPILOGUE (FILE, SIZE)'
  102.      A C compound statement that outputs the assembler code for exit
  103.      from a function.  The epilogue is responsible for restoring the
  104.      saved registers and stack pointer to their values when the
  105.      function was called, and returning control to the caller.  This
  106.      macro takes the same arguments as the macro `FUNCTION_PROLOGUE',
  107.      and the registers to restore are determined from `regs_ever_live'
  108.      and `CALL_USED_REGISTERS' in the same way.
  109.      On some machines, there is a single instruction that does all the
  110.      work of returning from the function.  On these machines, give that
  111.      instruction the name `return' and do not define the macro
  112.      `FUNCTION_EPILOGUE' at all.
  113.      Do not define a pattern named `return' if you want the
  114.      `FUNCTION_EPILOGUE' to be used.  If you want the target switches
  115.      to control whether return instructions or epilogues are used,
  116.      define a `return' pattern with a validity condition that tests the
  117.      target switches appropriately.  If the `return' pattern's validity
  118.      condition is false, epilogues will be used.
  119.      On machines where functions may or may not have frame-pointers, the
  120.      function exit code must vary accordingly.  Sometimes the code for
  121.      these two cases is completely different.  To determine whether a
  122.      frame pointer is wanted, the macro can refer to the variable
  123.      `frame_pointer_needed'.  The variable's value will be 1 at run time
  124.      in a function that needs a frame pointer.
  125.      Normally, it is necessary for `FUNCTION_PROLOGUE' and
  126.      `FUNCTION_EPILOGUE' to treat leaf functions specially.  The C
  127.      variable `leaf_function' is nonzero for such a function. *Note
  128.      Leaf Functions::.
  129.      On some machines, some functions pop their arguments on exit while
  130.      others leave that for the caller to do.  For example, the 68020
  131.      when given `-mrtd' pops arguments in functions that take a fixed
  132.      number of arguments.
  133.      Your definition of the macro `RETURN_POPS_ARGS' decides which
  134.      functions pop their own arguments.  `FUNCTION_EPILOGUE' needs to
  135.      know what was decided.  The variable `current_function_pops_args'
  136.      is the number of bytes of its arguments that a function should pop.
  137.      *Note Scalar Return::.
  138. `DELAY_SLOTS_FOR_EPILOGUE'
  139.      Define this macro if the function epilogue contains delay slots to
  140.      which instructions from the rest of the function can be "moved". 
  141.      The definition should be a C expression whose value is an integer
  142.      representing the number of delay slots there.
  143. `ELIGIBLE_FOR_EPILOGUE_DELAY (INSN, N)'
  144.      A C expression that returns 1 if INSN can be placed in delay slot
  145.      number N of the epilogue.
  146.      The argument N is an integer which identifies the delay slot now
  147.      being considered (since different slots may have different rules of
  148.      eligibility).  It is never negative and is always less than the
  149.      number of epilogue delay slots (what `DELAY_SLOTS_FOR_EPILOGUE'
  150.      returns). If you reject a particular insn for a given delay slot,
  151.      in principle, it may be reconsidered for a subsequent delay slot. 
  152.      Also, other insns may (at least in principle) be considered for
  153.      the so far unfilled delay slot.
  154.      The insns accepted to fill the epilogue delay slots are put in an
  155.      RTL list made with `insn_list' objects, stored in the variable
  156.      `current_function_epilogue_delay_list'.  The insn for the first
  157.      delay slot comes first in the list.  Your definition of the macro
  158.      `FUNCTION_EPILOGUE' should fill the delay slots by outputting the
  159.      insns in this list, usually by calling `final_scan_insn'.
  160.      You need not define this macro if you did not define
  161.      `DELAY_SLOTS_FOR_EPILOGUE'.
  162. File: gcc.info,  Node: Profiling,  Prev: Function Entry,  Up: Stack and Calling
  163. Generating Code for Profiling
  164. -----------------------------
  165. `FUNCTION_PROFILER (FILE, LABELNO)'
  166.      A C statement or compound statement to output to FILE some
  167.      assembler code to call the profiling subroutine `mcount'. Before
  168.      calling, the assembler code must load the address of a counter
  169.      variable into a register where `mcount' expects to find the
  170.      address.  The name of this variable is `LP' followed by the number
  171.      LABELNO, so you would generate the name using `LP%d' in a
  172.      `fprintf'.
  173.      The details of how the address should be passed to `mcount' are
  174.      determined by your operating system environment, not by GNU CC.  To
  175.      figure them out, compile a small program for profiling using the
  176.      system's installed C compiler and look at the assembler code that
  177.      results.
  178. `PROFILE_BEFORE_PROLOGUE'
  179.      Define this macro if the code for function profiling should come
  180.      before the function prologue.  Normally, the profiling code comes
  181.      after.
  182. `FUNCTION_BLOCK_PROFILER (FILE, LABELNO)'
  183.      A C statement or compound statement to output to FILE some
  184.      assembler code to initialize basic-block profiling for the current
  185.      object module.  This code should call the subroutine
  186.      `__bb_init_func' once per object module, passing it as its sole
  187.      argument the address of a block allocated in the object module.
  188.      The name of the block is a local symbol made with this statement:
  189.           ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
  190.      Of course, since you are writing the definition of
  191.      `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  192.      can take a short cut in the definition of this macro and use the
  193.      name that you know will result.
  194.      The first word of this block is a flag which will be nonzero if the
  195.      object module has already been initialized.  So test this word
  196.      first, and do not call `__bb_init_func' if the flag is nonzero.
  197. `BLOCK_PROFILER (FILE, BLOCKNO)'
  198.      A C statement or compound statement to increment the count
  199.      associated with the basic block number BLOCKNO.  Basic blocks are
  200.      numbered separately from zero within each compilation.  The count
  201.      associated with block number BLOCKNO is at index BLOCKNO in a
  202.      vector of words; the name of this array is a local symbol made
  203.      with this statement:
  204.           ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
  205.      Of course, since you are writing the definition of
  206.      `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  207.      can take a short cut in the definition of this macro and use the
  208.      name that you know will result.
  209. File: gcc.info,  Node: Varargs,  Next: Trampolines,  Prev: Stack and Calling,  Up: Target Macros
  210. Implementing the Varargs Macros
  211. ===============================
  212.    GNU CC comes with an implementation of `varargs.h' and `stdarg.h'
  213. that work without change on machines that pass arguments on the stack. 
  214. Other machines require their own implementations of varargs, and the
  215. two machine independent header files must have conditionals to include
  216.    ANSI `stdarg.h' differs from traditional `varargs.h' mainly in the
  217. calling convention for `va_start'.  The traditional implementation
  218. takes just one argument, which is the variable in which to store the
  219. argument pointer.  The ANSI implementation of `va_start' takes an
  220. additional second argument.  The user is supposed to write the last
  221. named argument of the function here.
  222.    However, `va_start' should not use this argument.  The way to find
  223. the end of the named arguments is with the built-in functions described
  224. below.
  225. `__builtin_saveregs ()'
  226.      Use this built-in function to save the argument registers in
  227.      memory so that the varargs mechanism can access them.  Both ANSI
  228.      and traditional versions of `va_start' must use
  229.      `__builtin_saveregs', unless you use `SETUP_INCOMING_VARARGS' (see
  230.      below) instead.
  231.      On some machines, `__builtin_saveregs' is open-coded under the
  232.      control of the macro `EXPAND_BUILTIN_SAVEREGS'.  On other machines,
  233.      it calls a routine written in assembler language, found in
  234.      `libgcc2.c'.
  235.      Regardless of what code is generated for the call to
  236.      `__builtin_saveregs', it appears at the beginning of the function,
  237.      not where the call to `__builtin_saveregs' is written.  This is
  238.      because the registers must be saved before the function starts to
  239.      use them for its own purposes.
  240. `__builtin_args_info (CATEGORY)'
  241.      Use this built-in function to find the first anonymous arguments in
  242.      registers.
  243.      In general, a machine may have several categories of registers
  244.      used for arguments, each for a particular category of data types. 
  245.      (For example, on some machines, floating-point registers are used
  246.      for floating-point arguments while other arguments are passed in
  247.      the general registers.) To make non-varargs functions use the
  248.      proper calling convention, you have defined the `CUMULATIVE_ARGS'
  249.      data type to record how many registers in each category have been
  250.      used so far
  251.      `__builtin_args_info' accesses the same data structure of type
  252.      `CUMULATIVE_ARGS' after the ordinary argument layout is finished
  253.      with it, with CATEGORY specifying which word to access.  Thus, the
  254.      value indicates the first unused register in a given category.
  255.      Normally, you would use `__builtin_args_info' in the implementation
  256.      of `va_start', accessing each category just once and storing the
  257.      value in the `va_list' object.  This is because `va_list' will
  258.      have to update the values, and there is no way to alter the values
  259.      accessed by `__builtin_args_info'.
  260. `__builtin_next_arg ()'
  261.      This is the equivalent of `__builtin_args_info', for stack
  262.      arguments.  It returns the address of the first anonymous stack
  263.      argument, as type `void *'. If `ARGS_GROW_DOWNWARD', it returns
  264.      the address of the location above the first anonymous stack
  265.      argument. Use it in `va_start' to initialize the pointer for
  266.      fetching arguments from the stack.
  267. `__builtin_classify_type (OBJECT)'
  268.      Since each machine has its own conventions for which data types are
  269.      passed in which kind of register, your implementation of `va_arg'
  270.      has to embody these conventions.  The easiest way to categorize the
  271.      specified data type is to use `__builtin_classify_type' together
  272.      with `sizeof' and `__alignof__'.
  273.      `__builtin_classify_type' ignores the value of OBJECT, considering
  274.      only its data type.  It returns an integer describing what kind of
  275.      type that is--integer, floating, pointer, structure, and so on.
  276.      The file `typeclass.h' defines an enumeration that you can use to
  277.      interpret the values of `__builtin_classify_type'.
  278.    These machine description macros help implement varargs:
  279. `EXPAND_BUILTIN_SAVEREGS (ARGS)'
  280.      If defined, is a C expression that produces the machine-specific
  281.      code for a call to `__builtin_saveregs'.  This code will be moved
  282.      to the very beginning of the function, before any parameter access
  283.      are made. The return value of this function should be an RTX that
  284.      contains the value to use as the return of `__builtin_saveregs'.
  285.      The argument ARGS is a `tree_list' containing the arguments that
  286.      were passed to `__builtin_saveregs'.
  287.      If this macro is not defined, the compiler will output an ordinary
  288.      call to the library function `__builtin_saveregs'.
  289. `SETUP_INCOMING_VARARGS (ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME)'
  290.      This macro offers an alternative to using `__builtin_saveregs' and
  291.      defining the macro `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the
  292.      anonymous register arguments into the stack so that all the
  293.      arguments appear to have been passed consecutively on the stack. 
  294.      Once this is done, you can use the standard implementation of
  295.      varargs that works for machines that pass all their arguments on
  296.      the stack.
  297.      The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
  298.      containing the values that obtain after processing of the named
  299.      arguments.  The arguments MODE and TYPE describe the last named
  300.      argument--its machine mode and its data type as a tree node.
  301.      The macro implementation should do two things: first, push onto the
  302.      stack all the argument registers *not* used for the named
  303.      arguments, and second, store the size of the data thus pushed into
  304.      the `int'-valued variable whose name is supplied as the argument
  305.      PRETEND_ARGS_SIZE.  The value that you store here will serve as
  306.      additional offset for setting up the stack frame.
  307.      Because you must generate code to push the anonymous arguments at
  308.      compile time without knowing their data types,
  309.      `SETUP_INCOMING_VARARGS' is only useful on machines that have just
  310.      a single category of argument register and use it uniformly for
  311.      all data types.
  312.      If the argument SECOND_TIME is nonzero, it means that the
  313.      arguments of the function are being analyzed for the second time. 
  314.      This happens for an inline function, which is not actually
  315.      compiled until the end of the source file.  The macro
  316.      `SETUP_INCOMING_VARARGS' should not generate any instructions in
  317.      this case.
  318. File: gcc.info,  Node: Trampolines,  Next: Library Calls,  Prev: Varargs,  Up: Target Macros
  319. Trampolines for Nested Functions
  320. ================================
  321.    A "trampoline" is a small piece of code that is created at run time
  322. when the address of a nested function is taken.  It normally resides on
  323. the stack, in the stack frame of the containing function.  These macros
  324. tell GNU CC how to generate code to allocate and initialize a
  325. trampoline.
  326.    The instructions in the trampoline must do two things: load a
  327. constant address into the static chain register, and jump to the real
  328. address of the nested function.  On CISC machines such as the m68k,
  329. this requires two instructions, a move immediate and a jump.  Then the
  330. two addresses exist in the trampoline as word-long immediate operands. 
  331. On RISC machines, it is often necessary to load each address into a
  332. register in two parts.  Then pieces of each address form separate
  333. immediate operands.
  334.    The code generated to initialize the trampoline must store the
  335. variable parts--the static chain value and the function address--into
  336. the immediate operands of the instructions.  On a CISC machine, this is
  337. simply a matter of copying each address to a memory reference at the
  338. proper offset from the start of the trampoline.  On a RISC machine, it
  339. may be necessary to take out pieces of the address and store them
  340. separately.
  341. `TRAMPOLINE_TEMPLATE (FILE)'
  342.      A C statement to output, on the stream FILE, assembler code for a
  343.      block of data that contains the constant parts of a trampoline. 
  344.      This code should not include a label--the label is taken care of
  345.      automatically.
  346. `TRAMPOLINE_SIZE'
  347.      A C expression for the size in bytes of the trampoline, as an
  348.      integer.
  349. `TRAMPOLINE_ALIGNMENT'
  350.      Alignment required for trampolines, in bits.
  351.      If you don't define this macro, the value of `BIGGEST_ALIGNMENT'
  352.      is used for aligning trampolines.
  353. `INITIALIZE_TRAMPOLINE (ADDR, FNADDR, STATIC_CHAIN)'
  354.      A C statement to initialize the variable parts of a trampoline.
  355.      ADDR is an RTX for the address of the trampoline; FNADDR is an RTX
  356.      for the address of the nested function; STATIC_CHAIN is an RTX for
  357.      the static chain value that should be passed to the function when
  358.      it is called.
  359. `ALLOCATE_TRAMPOLINE (FP)'
  360.      A C expression to allocate run-time space for a trampoline.  The
  361.      expression value should be an RTX representing a memory reference
  362.      to the space for the trampoline.
  363.      If this macro is not defined, by default the trampoline is
  364.      allocated as a stack slot.  This default is right for most
  365.      machines.  The exceptions are machines where it is impossible to
  366.      execute instructions in the stack area.  On such machines, you may
  367.      have to implement a separate stack, using this macro in
  368.      conjunction with `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE'.
  369.      FP points to a data structure, a `struct function', which
  370.      describes the compilation status of the immediate containing
  371.      function of the function which the trampoline is for.  Normally
  372.      (when `ALLOCATE_TRAMPOLINE' is not defined), the stack slot for the
  373.      trampoline is in the stack frame of this containing function. 
  374.      Other allocation strategies probably must do something analogous
  375.      with this information.
  376.    Implementing trampolines is difficult on many machines because they
  377. have separate instruction and data caches.  Writing into a stack
  378. location fails to clear the memory in the instruction cache, so when
  379. the program jumps to that location, it executes the old contents.
  380.    Here are two possible solutions.  One is to clear the relevant parts
  381. of the instruction cache whenever a trampoline is set up.  The other is
  382. to make all trampolines identical, by having them jump to a standard
  383. subroutine.  The former technique makes trampoline execution faster; the
  384. latter makes initialization faster.
  385.    To clear the instruction cache when a trampoline is initialized,
  386. define the following macros which describe the shape of the cache.
  387. `INSN_CACHE_SIZE'
  388.      The total size in bytes of the cache.
  389. `INSN_CACHE_LINE_WIDTH'
  390.      The length in bytes of each cache line.  The cache is divided into
  391.      cache lines which are disjoint slots, each holding a contiguous
  392.      chunk of data fetched from memory.  Each time data is brought into
  393.      the cache, an entire line is read at once.  The data loaded into a
  394.      cache line is always aligned on a boundary equal to the line size.
  395. `INSN_CACHE_DEPTH'
  396.      The number of alternative cache lines that can hold any particular
  397.      memory location.
  398.    To use a standard subroutine, define the following macro.  In
  399. addition, you must make sure that the instructions in a trampoline fill
  400. an entire cache line with identical instructions, or else ensure that
  401. the beginning of the trampoline code is always aligned at the same
  402. point in its cache line.  Look in `m68k.h' as a guide.
  403. `TRANSFER_FROM_TRAMPOLINE'
  404.      Define this macro if trampolines need a special subroutine to do
  405.      their work.  The macro should expand to a series of `asm'
  406.      statements which will be compiled with GNU CC.  They go in a
  407.      library function named `__transfer_from_trampoline'.
  408.      If you need to avoid executing the ordinary prologue code of a
  409.      compiled C function when you jump to the subroutine, you can do so
  410.      by placing a special label of your own in the assembler code.  Use
  411.      one `asm' statement to generate an assembler label, and another to
  412.      make the label global.  Then trampolines can use that label to
  413.      jump directly to your special assembler code.
  414. File: gcc.info,  Node: Library Calls,  Next: Addressing Modes,  Prev: Trampolines,  Up: Target Macros
  415. Implicit Calls to Library Routines
  416. ==================================
  417. `MULSI3_LIBCALL'
  418.      A C string constant giving the name of the function to call for
  419.      multiplication of one signed full-word by another.  If you do not
  420.      define this macro, the default name is used, which is `__mulsi3',
  421.      a function defined in `libgcc.a'.
  422. `DIVSI3_LIBCALL'
  423.      A C string constant giving the name of the function to call for
  424.      division of one signed full-word by another.  If you do not define
  425.      this macro, the default name is used, which is `__divsi3', a
  426.      function defined in `libgcc.a'.
  427. `UDIVSI3_LIBCALL'
  428.      A C string constant giving the name of the function to call for
  429.      division of one unsigned full-word by another.  If you do not
  430.      define this macro, the default name is used, which is `__udivsi3',
  431.      a function defined in `libgcc.a'.
  432. `MODSI3_LIBCALL'
  433.      A C string constant giving the name of the function to call for the
  434.      remainder in division of one signed full-word by another.  If you
  435.      do not define this macro, the default name is used, which is
  436.      `__modsi3', a function defined in `libgcc.a'.
  437. `UMODSI3_LIBCALL'
  438.      A C string constant giving the name of the function to call for the
  439.      remainder in division of one unsigned full-word by another.  If
  440.      you do not define this macro, the default name is used, which is
  441.      `__umodsi3', a function defined in `libgcc.a'.
  442. `MULDI3_LIBCALL'
  443.      A C string constant giving the name of the function to call for
  444.      multiplication of one signed double-word by another.  If you do not
  445.      define this macro, the default name is used, which is `__muldi3',
  446.      a function defined in `libgcc.a'.
  447. `DIVDI3_LIBCALL'
  448.      A C string constant giving the name of the function to call for
  449.      division of one signed double-word by another.  If you do not
  450.      define this macro, the default name is used, which is `__divdi3', a
  451.      function defined in `libgcc.a'.
  452. `UDIVDI3_LIBCALL'
  453.      A C string constant giving the name of the function to call for
  454.      division of one unsigned full-word by another.  If you do not
  455.      define this macro, the default name is used, which is `__udivdi3',
  456.      a function defined in `libgcc.a'.
  457. `MODDI3_LIBCALL'
  458.      A C string constant giving the name of the function to call for the
  459.      remainder in division of one signed double-word by another.  If
  460.      you do not define this macro, the default name is used, which is
  461.      `__moddi3', a function defined in `libgcc.a'.
  462. `UMODDI3_LIBCALL'
  463.      A C string constant giving the name of the function to call for the
  464.      remainder in division of one unsigned full-word by another.  If
  465.      you do not define this macro, the default name is used, which is
  466.      `__umoddi3', a function defined in `libgcc.a'.
  467. `TARGET_EDOM'
  468.      The value of `EDOM' on the target machine, as a C integer constant
  469.      expression.  If you don't define this macro, GNU CC does not
  470.      attempt to deposit the value of `EDOM' into `errno' directly. 
  471.      Look in `/usr/include/errno.h' to find the value of `EDOM' on your
  472.      system.
  473.      If you do not define `TARGET_EDOM', then compiled code reports
  474.      domain errors by calling the library function and letting it
  475.      report the error.  If mathematical functions on your system use
  476.      `matherr' when there is an error, then you should leave
  477.      `TARGET_EDOM' undefined so that `matherr' is used normally.
  478. `GEN_ERRNO_RTX'
  479.      Define this macro as a C expression to create an rtl expression
  480.      that refers to the global "variable" `errno'.  (On certain systems,
  481.      `errno' may not actually be a variable.)  If you don't define this
  482.      macro, a reasonable default is used.
  483. `TARGET_MEM_FUNCTIONS'
  484.      Define this macro if GNU CC should generate calls to the System V
  485.      (and ANSI C) library functions `memcpy' and `memset' rather than
  486.      the BSD functions `bcopy' and `bzero'.
  487. `LIBGCC_NEEDS_DOUBLE'
  488.      Define this macro if only `float' arguments cannot be passed to
  489.      library routines (so they must be converted to `double').  This
  490.      macro affects both how library calls are generated and how the
  491.      library routines in `libgcc1.c' accept their arguments.  It is
  492.      useful on machines where floating and fixed point arguments are
  493.      passed differently, such as the i860.
  494. `FLOAT_ARG_TYPE'
  495.      Define this macro to override the type used by the library
  496.      routines to pick up arguments of type `float'.  (By default, they
  497.      use a union of `float' and `int'.)
  498.      The obvious choice would be `float'--but that won't work with
  499.      traditional C compilers that expect all arguments declared as
  500.      `float' to arrive as `double'.  To avoid this conversion, the
  501.      library routines ask for the value as some other type and then
  502.      treat it as a `float'.
  503.      On some systems, no other type will work for this.  For these
  504.      systems, you must use `LIBGCC_NEEDS_DOUBLE' instead, to force
  505.      conversion of the values `double' before they are passed.
  506. `FLOATIFY (PASSED-VALUE)'
  507.      Define this macro to override the way library routines redesignate
  508.      a `float' argument as a `float' instead of the type it was passed
  509.      as.  The default is an expression which takes the `float' field of
  510.      the union.
  511. `FLOAT_VALUE_TYPE'
  512.      Define this macro to override the type used by the library
  513.      routines to return values that ought to have type `float'.  (By
  514.      default, they use `int'.)
  515.      The obvious choice would be `float'--but that won't work with
  516.      traditional C compilers gratuitously convert values declared as
  517.      `float' into `double'.
  518. `INTIFY (FLOAT-VALUE)'
  519.      Define this macro to override the way the value of a
  520.      `float'-returning library routine should be packaged in order to
  521.      return it.  These functions are actually declared to return type
  522.      `FLOAT_VALUE_TYPE' (normally `int').
  523.      These values can't be returned as type `float' because traditional
  524.      C compilers would gratuitously convert the value to a `double'.
  525.      A local variable named `intify' is always available when the macro
  526.      `INTIFY' is used.  It is a union of a `float' field named `f' and
  527.      a field named `i' whose type is `FLOAT_VALUE_TYPE' or `int'.
  528.      If you don't define this macro, the default definition works by
  529.      copying the value through that union.
  530. `nongcc_SI_type'
  531.      Define this macro as the name of the data type corresponding to
  532.      `SImode' in the system's own C compiler.
  533.      You need not define this macro if that type is `int', as it usually
  534.      is.
  535. `perform_...'
  536.      Define these macros to supply explicit C statements to carry out
  537.      various arithmetic operations on types `float' and `double' in the
  538.      library routines in `libgcc1.c'.  See that file for a full list of
  539.      these macros and their arguments.
  540.      On most machines, you don't need to define any of these macros,
  541.      because the C compiler that comes with the system takes care of
  542.      doing them.
  543. `NEXT_OBJC_RUNTIME'
  544.      Define this macro to generate code for Objective C message sending
  545.      using the calling convention of the NeXT system.  This calling
  546.      convention involves passing the object, the selector and the
  547.      method arguments all at once to the method-lookup library function.
  548.      The default calling convention passes just the object and the
  549.      selector to the lookup function, which returns a pointer to the
  550.      method.
  551. File: gcc.info,  Node: Addressing Modes,  Next: Condition Code,  Prev: Library Calls,  Up: Target Macros
  552. Addressing Modes
  553. ================
  554. `HAVE_POST_INCREMENT'
  555.      Define this macro if the machine supports post-increment
  556.      addressing.
  557. `HAVE_PRE_INCREMENT'
  558. `HAVE_POST_DECREMENT'
  559. `HAVE_PRE_DECREMENT'
  560.      Similar for other kinds of addressing.
  561. `CONSTANT_ADDRESS_P (X)'
  562.      A C expression that is 1 if the RTX X is a constant which is a
  563.      valid address.  On most machines, this can be defined as
  564.      `CONSTANT_P (X)', but a few machines are more restrictive in which
  565.      constant addresses are supported.
  566.      `CONSTANT_P' accepts integer-values expressions whose values are
  567.      not explicitly known, such as `symbol_ref', `label_ref', and
  568.      `high' expressions and `const' arithmetic expressions, in addition
  569.      to `const_int' and `const_double' expressions.
  570. `MAX_REGS_PER_ADDRESS'
  571.      A number, the maximum number of registers that can appear in a
  572.      valid memory address.  Note that it is up to you to specify a
  573.      value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
  574.      would ever accept.
  575. `GO_IF_LEGITIMATE_ADDRESS (MODE, X, LABEL)'
  576.      A C compound statement with a conditional `goto LABEL;' executed
  577.      if X (an RTX) is a legitimate memory address on the target machine
  578.      for a memory operand of mode MODE.
  579.      It usually pays to define several simpler macros to serve as
  580.      subroutines for this one.  Otherwise it may be too complicated to
  581.      understand.
  582.      This macro must exist in two variants: a strict variant and a
  583.      non-strict one.  The strict variant is used in the reload pass.  It
  584.      must be defined so that any pseudo-register that has not been
  585.      allocated a hard register is considered a memory reference.  In
  586.      contexts where some kind of register is required, a pseudo-register
  587.      with no hard register must be rejected.
  588.      The non-strict variant is used in other passes.  It must be
  589.      defined to accept all pseudo-registers in every context where some
  590.      kind of register is required.
  591.      Compiler source files that want to use the strict variant of this
  592.      macro define the macro `REG_OK_STRICT'.  You should use an `#ifdef
  593.      REG_OK_STRICT' conditional to define the strict variant in that
  594.      case and the non-strict variant otherwise.
  595.      Typically among the subroutines used to define
  596.      `GO_IF_LEGITIMATE_ADDRESS' are subroutines to check for acceptable
  597.      registers for various purposes (one for base registers, one for
  598.      index registers, and so on).  Then only these subroutine macros
  599.      need have two variants; the higher levels of macros may be the same
  600.      whether strict or not.
  601.      Normally, constant addresses which are the sum of a `symbol_ref'
  602.      and an integer are stored inside a `const' RTX to mark them as
  603.      constant.  Therefore, there is no need to recognize such sums
  604.      specifically as legitimate addresses.  Normally you would simply
  605.      recognize any `const' as legitimate.
  606.      Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant
  607.      sums that are not marked with  `const'.  It assumes that a naked
  608.      `plus' indicates indexing.  If so, then you *must* reject such
  609.      naked constant sums as illegitimate addresses, so that none of
  610.      them will be given to `PRINT_OPERAND_ADDRESS'.
  611.      On some machines, whether a symbolic address is legitimate depends
  612.      on the section that the address refers to.  On these machines,
  613.      define the macro `ENCODE_SECTION_INFO' to store the information
  614.      into the `symbol_ref', and then check for it here.  When you see a
  615.      `const', you will have to look inside it to find the `symbol_ref'
  616.      in order to determine the section.  *Note Assembler Format::.
  617.      The best way to modify the name string is by adding text to the
  618.      beginning, with suitable punctuation to prevent any ambiguity. 
  619.      Allocate the new name in `saveable_obstack'.  You will have to
  620.      modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
  621.      and output the name accordingly, and define `STRIP_NAME_ENCODING'
  622.      to access the original name string.
  623.      You can check the information stored here into the `symbol_ref' in
  624.      the definitions of `GO_IF_LEGITIMATE_ADDRESS' and
  625.      `PRINT_OPERAND_ADDRESS'.
  626. `REG_OK_FOR_BASE_P (X)'
  627.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  628.      valid for use as a base register.  For hard registers, it should
  629.      always accept those which the hardware permits and reject the
  630.      others.  Whether the macro accepts or rejects pseudo registers
  631.      must be controlled by `REG_OK_STRICT' as described above.  This
  632.      usually requires two variant definitions, of which `REG_OK_STRICT'
  633.      controls the one actually used.
  634. `REG_OK_FOR_INDEX_P (X)'
  635.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  636.      valid for use as an index register.
  637.      The difference between an index register and a base register is
  638.      that the index register may be scaled.  If an address involves the
  639.      sum of two registers, neither one of them scaled, then either one
  640.      may be labeled the "base" and the other the "index"; but whichever
  641.      labeling is used must fit the machine's constraints of which
  642.      registers may serve in each capacity.  The compiler will try both
  643.      labelings, looking for one that is valid, and will reload one or
  644.      both registers only if neither labeling works.
  645. `LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN)'
  646.      A C compound statement that attempts to replace X with a valid
  647.      memory address for an operand of mode MODE.  WIN will be a C
  648.      statement label elsewhere in the code; the macro definition may use
  649.           GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
  650.      to avoid further processing if the address has become legitimate.
  651.      X will always be the result of a call to `break_out_memory_refs',
  652.      and OLDX will be the operand that was given to that function to
  653.      produce X.
  654.      The code generated by this macro should not alter the substructure
  655.      of X.  If it transforms X into a more legitimate form, it should
  656.      assign X (which will always be a C variable) a new value.
  657.      It is not necessary for this macro to come up with a legitimate
  658.      address.  The compiler has standard ways of doing so in all cases.
  659.       In fact, it is safe for this macro to do nothing.  But often a
  660.      machine-dependent strategy can generate better code.
  661. `GO_IF_MODE_DEPENDENT_ADDRESS (ADDR, LABEL)'
  662.      A C statement or compound statement with a conditional `goto
  663.      LABEL;' executed if memory address X (an RTX) can have different
  664.      meanings depending on the machine mode of the memory reference it
  665.      is used for or if the address is valid for some modes but not
  666.      others.
  667.      Autoincrement and autodecrement addresses typically have
  668.      mode-dependent effects because the amount of the increment or
  669.      decrement is the size of the operand being addressed.  Some
  670.      machines have other mode-dependent addresses.  Many RISC machines
  671.      have no mode-dependent addresses.
  672.      You may assume that ADDR is a valid address for the machine.
  673. `LEGITIMATE_CONSTANT_P (X)'
  674.      A C expression that is nonzero if X is a legitimate constant for
  675.      an immediate operand on the target machine.  You can assume that X
  676.      satisfies `CONSTANT_P', so you need not check this.  In fact, `1'
  677.      is a suitable definition for this macro on machines where anything
  678.      `CONSTANT_P' is valid.
  679. File: gcc.info,  Node: Condition Code,  Next: Costs,  Prev: Addressing Modes,  Up: Target Macros
  680. Condition Code Status
  681. =====================
  682.    The file `conditions.h' defines a variable `cc_status' to describe
  683. how the condition code was computed (in case the interpretation of the
  684. condition code depends on the instruction that it was set by).  This
  685. variable contains the RTL expressions on which the condition code is
  686. currently based, and several standard flags.
  687.    Sometimes additional machine-specific flags must be defined in the
  688. machine description header file.  It can also add additional
  689. machine-specific information by defining `CC_STATUS_MDEP'.
  690. `CC_STATUS_MDEP'
  691.      C code for a data type which is used for declaring the `mdep'
  692.      component of `cc_status'.  It defaults to `int'.
  693.      This macro is not used on machines that do not use `cc0'.
  694. `CC_STATUS_MDEP_INIT'
  695.      A C expression to initialize the `mdep' field to "empty". The
  696.      default definition does nothing, since most machines don't use the
  697.      field anyway.  If you want to use the field, you should probably
  698.      define this macro to initialize it.
  699.      This macro is not used on machines that do not use `cc0'.
  700. `NOTICE_UPDATE_CC (EXP, INSN)'
  701.      A C compound statement to set the components of `cc_status'
  702.      appropriately for an insn INSN whose body is EXP.  It is this
  703.      macro's responsibility to recognize insns that set the condition
  704.      code as a byproduct of other activity as well as those that
  705.      explicitly set `(cc0)'.
  706.      This macro is not used on machines that do not use `cc0'.
  707.      If there are insns that do not set the condition code but do alter
  708.      other machine registers, this macro must check to see whether they
  709.      invalidate the expressions that the condition code is recorded as
  710.      reflecting.  For example, on the 68000, insns that store in address
  711.      registers do not set the condition code, which means that usually
  712.      `NOTICE_UPDATE_CC' can leave `cc_status' unaltered for such insns.
  713.       But suppose that the previous insn set the condition code based
  714.      on location `a4@(102)' and the current insn stores a new value in
  715.      `a4'.  Although the condition code is not changed by this, it will
  716.      no longer be true that it reflects the contents of `a4@(102)'. 
  717.      Therefore, `NOTICE_UPDATE_CC' must alter `cc_status' in this case
  718.      to say that nothing is known about the condition code value.
  719.      The definition of `NOTICE_UPDATE_CC' must be prepared to deal with
  720.      the results of peephole optimization: insns whose patterns are
  721.      `parallel' RTXs containing various `reg', `mem' or constants which
  722.      are just the operands.  The RTL structure of these insns is not
  723.      sufficient to indicate what the insns actually do.  What
  724.      `NOTICE_UPDATE_CC' should do when it sees one is just to run
  725.      `CC_STATUS_INIT'.
  726.      A possible definition of `NOTICE_UPDATE_CC' is to call a function
  727.      that looks at an attribute (*note Insn Attributes::.) named, for
  728.      example, `cc'.  This avoids having detailed information about
  729.      patterns in two places, the `md' file and in `NOTICE_UPDATE_CC'.
  730. `EXTRA_CC_MODES'
  731.      A list of names to be used for additional modes for condition code
  732.      values in registers (*note Jump Patterns::.).  These names are
  733.      added to `enum machine_mode' and all have class `MODE_CC'.  By
  734.      convention, they should start with `CC' and end with `mode'.
  735.      You should only define this macro if your machine does not use
  736.      `cc0' and only if additional modes are required.
  737. `EXTRA_CC_NAMES'
  738.      A list of C strings giving the names for the modes listed in
  739.      `EXTRA_CC_MODES'.  For example, the Sparc defines this macro and
  740.      `EXTRA_CC_MODES' as
  741.           #define EXTRA_CC_MODES CC_NOOVmode, CCFPmode
  742.           #define EXTRA_CC_NAMES "CC_NOOV", "CCFP"
  743.      This macro is not required if `EXTRA_CC_MODES' is not defined.
  744. `SELECT_CC_MODE (OP, X, Y)'
  745.      Returns a mode from class `MODE_CC' to be used when comparison
  746.      operation code OP is applied to rtx X and Y.  For example, on the
  747.      Sparc, `SELECT_CC_MODE' is defined as (see *note Jump Patterns::.
  748.      for a description of the reason for this definition)
  749.           #define SELECT_CC_MODE(OP,X,Y) \
  750.             (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT                \
  751.              ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)        \
  752.              : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS || GET_CODE (X) == NEG) \
  753.                 ? CC_NOOVmode : CCmode))
  754.      This macro is not required if `EXTRA_CC_MODES' is not defined.
  755.