home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / gcc.info-16 (.txt) < prev    next >
GNU Info File  |  1994-02-06  |  45KB  |  760 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.49 from the input
  2. file gcc.texi.
  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 cal