home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / djgpp / docs / gcc / tm.tex < prev    next >
Encoding:
Text File  |  1993-05-29  |  245.4 KB  |  5,924 lines

  1. @c Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  2. @c This is part of the GCC manual.
  3. @c For copying conditions, see the file gcc.texi.
  4.  
  5. @node Target Macros
  6. @chapter Target Description Macros
  7. @cindex machine description macros
  8. @cindex target description macros
  9. @cindex macros, target description
  10. @cindex @file{tm.h} macros
  11.  
  12. In addition to the file @file{@var{machine}.md}, a machine description
  13. includes a C header file conventionally given the name
  14. @file{@var{machine}.h}.  This header file defines numerous macros
  15. that convey the information about the target machine that does not fit
  16. into the scheme of the @file{.md} file.  The file @file{tm.h} should be
  17. a link to @file{@var{machine}.h}.  The header file @file{config.h}
  18. includes @file{tm.h} and most compiler source files include
  19. @file{config.h}.
  20.  
  21. @menu
  22. * Driver::              Controlling how the driver runs the compilation passes.
  23. * Run-time Target::     Defining @samp{-m} options like @samp{-m68000} and @samp{-m68020}.
  24. * Storage Layout::      Defining sizes and alignments of data.
  25. * Type Layout::         Defining sizes and properties of basic user data types.
  26. * Registers::           Naming and describing the hardware registers.
  27. * Register Classes::    Defining the classes of hardware registers.
  28. * Stack and Calling::   Defining which way the stack grows and by how much.
  29. * Varargs::        Defining the varargs macros.
  30. * Trampolines::         Code set up at run time to enter a nested function.
  31. * Library Calls::       Controlling how library routines are implicitly called.
  32. * Addressing Modes::    Defining addressing modes valid for memory operands.
  33. * Condition Code::      Defining how insns update the condition code.
  34. * Costs::               Defining relative costs of different operations.
  35. * Sections::            Dividing storage into text, data, and other sections.
  36. * PIC::            Macros for position independent code.
  37. * Assembler Format::    Defining how to write insns and pseudo-ops to output.
  38. * Debugging Info::      Defining the format of debugging output.
  39. * Cross-compilation::   Handling floating point for cross-compilers.
  40. * Misc::                Everything else.
  41. @end menu
  42.  
  43. @node Driver
  44. @section Controlling the Compilation Driver, @file{gcc}
  45. @cindex driver
  46. @cindex controlling the compilation driver
  47.  
  48. @table @code
  49. @findex SWITCH_TAKES_ARG
  50. @item SWITCH_TAKES_ARG (@var{char})
  51. A C expression which determines whether the option @samp{-@var{char}}
  52. takes arguments.  The value should be the number of arguments that
  53. option takes--zero, for many options.
  54.  
  55. By default, this macro is defined to handle the standard options
  56. properly.  You need not define it unless you wish to add additional
  57. options which take arguments.
  58.  
  59. @findex WORD_SWITCH_TAKES_ARG
  60. @item WORD_SWITCH_TAKES_ARG (@var{name})
  61. A C expression which determines whether the option @samp{-@var{name}}
  62. takes arguments.  The value should be the number of arguments that
  63. option takes--zero, for many options.  This macro rather than
  64. @code{SWITCH_TAKES_ARG} is used for multi-character option names.
  65.  
  66. By default, this macro is defined as
  67. @code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options
  68. properly.  You need not define @code{WORD_SWITCH_TAKES_ARG} unless you
  69. wish to add additional options which take arguments.  Any redefinition
  70. should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
  71. additional options.
  72.  
  73. @findex SWITCHES_NEED_SPACES
  74. @item SWITCHES_NEED_SPACES
  75. A string-valued C expression which is nonempty if the linker needs a
  76. space between the @samp{-L} or @samp{-o} option and its argument.
  77.  
  78. If this macro is not defined, the default value is 0.
  79.  
  80. @findex CPP_SPEC
  81. @item CPP_SPEC
  82. A C string constant that tells the GNU CC driver program options to
  83. pass to CPP.  It can also specify how to translate options you
  84. give to GNU CC into options for GNU CC to pass to the CPP.
  85.  
  86. Do not define this macro if it does not need to do anything.
  87.  
  88. @findex NO_BUILTIN_SIZE_TYPE
  89. @item NO_BUILTIN_SIZE_TYPE
  90. If this macro is defined, the preprocessor will not define the builtin macro
  91. @code{__SIZE_TYPE__}.  The macro @code{__SIZE_TYPE__} must then be defined
  92. by @code{CPP_SPEC} instead.
  93.  
  94. This should be defined if @code{SIZE_TYPE} depends on target dependent flags
  95. which are not accessible to the preprocessor.  Otherwise, it should not
  96. be defined.
  97.  
  98. @findex NO_BUILTIN_PTRDIFF_TYPE
  99. @item NO_BUILTIN_PTRDIFF_TYPE
  100. If this macro is defined, the preprocessor will not define the builtin macro
  101. @code{__PTRDIFF_TYPE__}.  The macro @code{__PTRDIFF_TYPE__} must then be
  102. defined by @code{CPP_SPEC} instead.
  103.  
  104. This should be defined if @code{PTRDIFF_TYPE} depends on target dependent flags
  105. which are not accessible to the preprocessor.  Otherwise, it should not
  106. be defined.
  107.  
  108. @findex SIGNED_CHAR_SPEC
  109. @item SIGNED_CHAR_SPEC
  110. A C string constant that tells the GNU CC driver program options to
  111. pass to CPP.  By default, this macro is defined to pass the option
  112. @samp{-D__CHAR_UNSIGNED__} to CPP if @code{char} will be treated as
  113. @code{unsigned char} by @code{cc1}.
  114.  
  115. Do not define this macro unless you need to override the default
  116. definition.
  117.  
  118. @findex CC1_SPEC
  119. @item CC1_SPEC
  120. A C string constant that tells the GNU CC driver program options to
  121. pass to @code{cc1}.  It can also specify how to translate options you
  122. give to GNU CC into options for GNU CC to pass to the @code{cc1}.
  123.  
  124. Do not define this macro if it does not need to do anything.
  125.  
  126. @findex CC1PLUS_SPEC
  127. @item CC1PLUS_SPEC
  128. A C string constant that tells the GNU CC driver program options to
  129. pass to @code{cc1plus}.  It can also specify how to translate options you
  130. give to GNU CC into options for GNU CC to pass to the @code{cc1plus}.
  131.  
  132. Do not define this macro if it does not need to do anything.
  133.  
  134. @findex ASM_SPEC
  135. @item ASM_SPEC
  136. A C string constant that tells the GNU CC driver program options to
  137. pass to the assembler.  It can also specify how to translate options
  138. you give to GNU CC into options for GNU CC to pass to the assembler.
  139. See the file @file{sun3.h} for an example of this.
  140.  
  141. Do not define this macro if it does not need to do anything.
  142.  
  143. @findex ASM_FINAL_SPEC
  144. @item ASM_FINAL_SPEC
  145. A C string constant that tells the GNU CC driver program how to
  146. run any programs which cleanup after the normal assembler.
  147. Normally, this is not needed.  See the file @file{mips.h} for
  148. an example of this.
  149.  
  150. Do not define this macro if it does not need to do anything.
  151.  
  152. @findex LINK_SPEC
  153. @item LINK_SPEC
  154. A C string constant that tells the GNU CC driver program options to
  155. pass to the linker.  It can also specify how to translate options you
  156. give to GNU CC into options for GNU CC to pass to the linker.
  157.  
  158. Do not define this macro if it does not need to do anything.
  159.  
  160. @findex LIB_SPEC
  161. @item LIB_SPEC
  162. Another C string constant used much like @code{LINK_SPEC}.  The difference
  163. between the two is that @code{LIB_SPEC} is used at the end of the
  164. command given to the linker.
  165.  
  166. If this macro is not defined, a default is provided that
  167. loads the standard C library from the usual place.  See @file{gcc.c}.
  168.  
  169. @findex STARTFILE_SPEC
  170. @item STARTFILE_SPEC
  171. Another C string constant used much like @code{LINK_SPEC}.  The
  172. difference between the two is that @code{STARTFILE_SPEC} is used at
  173. the very beginning of the command given to the linker.
  174.  
  175. If this macro is not defined, a default is provided that loads the
  176. standard C startup file from the usual place.  See @file{gcc.c}.
  177.  
  178. @findex ENDFILE_SPEC
  179. @item ENDFILE_SPEC
  180. Another C string constant used much like @code{LINK_SPEC}.  The
  181. difference between the two is that @code{ENDFILE_SPEC} is used at
  182. the very end of the command given to the linker.
  183.  
  184. Do not define this macro if it does not need to do anything.
  185.  
  186. @findex LINK_LIBGCC_SPECIAL
  187. @item LINK_LIBGCC_SPECIAL
  188. Define this macro meaning that @code{gcc} should find the library
  189. @file{libgcc.a} by hand, rather than passing the argument @samp{-lgcc}
  190. to tell the linker to do the search; also, @code{gcc} should not
  191. generate @samp{-L} options to pass to the linker (as it normally does).
  192.  
  193. @findex LINK_LIBGCC_SPECIAL_1
  194. @item LINK_LIBGCC_SPECIAL_1
  195. Define this macro meaning that @code{gcc} should find the
  196. library @file{libgcc.a} by hand, rather than passing the argument
  197. @samp{-lgcc} to tell the linker to do the search.
  198.  
  199. @findex RELATIVE_PREFIX_NOT_LINKDIR
  200. @item RELATIVE_PREFIX_NOT_LINKDIR
  201. Define this macro to tell @code{gcc} that it should only translate
  202. a @samp{-B} prefix into a @samp{-L} linker option if the prefix
  203. indicates an absolute file name.
  204.  
  205. @findex STANDARD_EXEC_PREFIX
  206. @item STANDARD_EXEC_PREFIX
  207. Define this macro as a C string constant if you wish to override the
  208. standard choice of @file{/usr/local/lib/gcc-lib/} as the default prefix to
  209. try when searching for the executable files of the compiler.
  210.  
  211. @findex MD_EXEC_PREFIX
  212. @item MD_EXEC_PREFIX
  213. If defined, this macro is an additional prefix to try after
  214. @code{STANDARD_EXEC_PREFIX}.  @code{MD_EXEC_PREFIX} is not searched
  215. when the @samp{-b} option is used, or the compiler is built as a cross
  216. compiler.
  217.  
  218. @findex STANDARD_STARTFILE_PREFIX
  219. @item STANDARD_STARTFILE_PREFIX
  220. Define this macro as a C string constant if you wish to override the
  221. standard choice of @file{/usr/local/lib/} as the default prefix to
  222. try when searching for startup files such as @file{crt0.o}.
  223.  
  224. @findex MD_STARTFILE_PREFIX
  225. @item MD_STARTFILE_PREFIX
  226. If defined, this macro supplies an additional prefix to try after the
  227. standard prefixes.  @code{MD_EXEC_PREFIX} is not searched when the
  228. @samp{-b} option is used, or when the compiler is built as a cross
  229. compiler.
  230.  
  231. @findex MD_STARTFILE_PREFIX_1
  232. @item MD_STARTFILE_PREFIX_1
  233. If defined, this macro supplies yet another prefix to try after the
  234. standard prefixes.  It is not searched when the @samp{-b} option is
  235. used, or when the compiler is built as a cross compiler.
  236.  
  237. @findex LOCAL_INCLUDE_DIR
  238. @item LOCAL_INCLUDE_DIR
  239. Define this macro as a C string constant if you wish to override the
  240. standard choice of @file{/usr/local/include} as the default prefix to
  241. try when searching for local header files.  @code{LOCAL_INCLUDE_DIR}
  242. comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
  243.  
  244. Cross compilers do not use this macro and do not search either
  245. @file{/usr/local/include} or its replacement.
  246.  
  247. @findex SYSTEM_INCLUDE_DIR
  248. @item SYSTEM_INCLUDE_DIR
  249. Define this macro as a C string constant if you wish to specify a
  250. system-specific directory to search for header files before the standard
  251. directory.  @code{SYSTEM_INCLUDE_DIR} comes before
  252. @code{STANDARD_INCLUDE_DIR} in the search order.
  253.  
  254. Cross compilers do not use this macro and do not search the directory
  255. specified.
  256.  
  257. @findex STANDARD_INCLUDE_DIR
  258. @item STANDARD_INCLUDE_DIR
  259. Define this macro as a C string constant if you wish to override the
  260. standard choice of @file{/usr/include} as the default prefix to
  261. try when searching for header files.
  262.  
  263. Cross compilers do not use this macro and do not search either
  264. @file{/usr/include} or its replacement.
  265.  
  266. @findex INCLUDE_DEFAULTS
  267. @item INCLUDE_DEFAULTS
  268. Define this macro if you wish to override the entire default search path
  269. for include files.  The default search path includes
  270. @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
  271. @code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and
  272. @code{STANDARD_INCLUDE_DIR}.  In addition, @code{GPLUSPLUS_INCLUDE_DIR}
  273. and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
  274. and specify private search areas for GCC.  The directory
  275. @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
  276. @c these overfulls are gonna be *lots* of fun.  --mew 2feb93
  277. @c wheeee!  i got them! :-)  but i had to frob the ordering quite a
  278. @c bit, i hope this is not a problem.  didn't seem like it should be.
  279. @c --mew 11feb93
  280.  
  281. The definition should be an initializer for an array of structures.
  282. Each array element should have two elements: the directory name (a
  283. string constant) and a flag for C++-only directories.  Mark the end of
  284. the array with a null element.  For example, here is the definition used
  285. for VMS:
  286.  
  287. @example
  288. #define INCLUDE_DEFAULTS \
  289. @{                                       \
  290.   @{ "GNU_GXX_INCLUDE:", 1@},             \
  291.   @{ "GNU_CC_INCLUDE:", 0@},              \
  292.   @{ "SYS$SYSROOT:[SYSLIB.]", 0@},        \
  293.   @{ ".", 0@},                            \
  294.   @{ 0, 0@}                               \
  295. @}
  296. @end example
  297. @end table
  298.  
  299. Here is the order of prefixes tried for exec files:
  300.  
  301. @enumerate
  302. @item
  303. Any prefixes specified by the user with @samp{-B}.
  304.  
  305. @item
  306. The environment variable @code{GCC_EXEC_PREFIX}, if any.
  307.  
  308. @item
  309. The directories specified by the environment variable @code{COMPILER_PATH}.
  310.  
  311. @item
  312. The macro @code{STANDARD_EXEC_PREFIX}.
  313.  
  314. @item
  315. @file{/usr/lib/gcc/}.
  316.  
  317. @item
  318. The macro @code{MD_EXEC_PREFIX}, if any.
  319. @end enumerate
  320.  
  321. Here is the order of prefixes tried for startfiles:
  322.  
  323. @enumerate
  324. @item
  325. Any prefixes specified by the user with @samp{-B}.
  326.  
  327. @item
  328. The environment variable @code{GCC_EXEC_PREFIX}, if any.
  329.  
  330. @item
  331. The directories specified by the environment variable @code{LIBRARY_PATH}.
  332.  
  333. @item
  334. The macro @code{STANDARD_EXEC_PREFIX}.
  335.  
  336. @item
  337. @file{/usr/lib/gcc/}.
  338.  
  339. @item
  340. The macro @code{MD_EXEC_PREFIX}, if any.
  341.  
  342. @item
  343. The macro @code{MD_STARTFILE_PREFIX}, if any.
  344.  
  345. @item
  346. The macro @code{STANDARD_STARTFILE_PREFIX}.
  347.  
  348. @item
  349. @file{/lib/}.
  350.  
  351. @item
  352. @file{/usr/lib/}.
  353. @end enumerate
  354.  
  355. @node Run-time Target
  356. @section Run-time Target Specification
  357. @cindex run-time target specification
  358. @cindex predefined macros
  359. @cindex target specifications
  360.  
  361. @table @code
  362. @findex CPP_PREDEFINES
  363. @item CPP_PREDEFINES
  364. Define this to be a string constant containing @samp{-D} options to
  365. define the predefined macros that identify this machine and system.
  366. These macros will be predefined unless the @samp{-ansi} option is
  367. specified.
  368.  
  369. In addition, a parallel set of macros are predefined, whose names are
  370. made by appending @samp{__} at the beginning and at the end.  These
  371. @samp{__} macros are permitted by the ANSI standard, so they are
  372. predefined regardless of whether @samp{-ansi} is specified.
  373.  
  374. For example, on the Sun, one can use the following value:
  375.  
  376. @smallexample
  377. "-Dmc68000 -Dsun -Dunix"
  378. @end smallexample
  379.  
  380. The result is to define the macros @code{__mc68000__}, @code{__sun__}
  381. and @code{__unix__} unconditionally, and the macros @code{mc68000},
  382. @code{sun} and @code{unix} provided @samp{-ansi} is not specified.
  383.  
  384. @findex STDC_VALUE
  385. @item STDC_VALUE
  386. Define the value to be assigned to the built-in macro @code{__STDC__}.
  387. The default is the value @samp{1}.
  388.  
  389. @findex extern int target_flags
  390. @item extern int target_flags;
  391. This declaration should be present.
  392.  
  393. @cindex optional hardware or system features
  394. @cindex features, optional, in system conventions
  395. @item TARGET_@dots{}
  396. This series of macros is to allow compiler command arguments to
  397. enable or disable the use of optional features of the target machine.
  398. For example, one machine description serves both the 68000 and
  399. the 68020; a command argument tells the compiler whether it should
  400. use 68020-only instructions or not.  This command argument works
  401. by means of a macro @code{TARGET_68020} that tests a bit in
  402. @code{target_flags}.
  403.  
  404. Define a macro @code{TARGET_@var{featurename}} for each such option.
  405. Its definition should test a bit in @code{target_flags}; for example:
  406.  
  407. @smallexample
  408. #define TARGET_68020 (target_flags & 1)
  409. @end smallexample
  410.  
  411. One place where these macros are used is in the condition-expressions
  412. of instruction patterns.  Note how @code{TARGET_68020} appears
  413. frequently in the 68000 machine description file, @file{m68k.md}.
  414. Another place they are used is in the definitions of the other
  415. macros in the @file{@var{machine}.h} file.
  416.  
  417. @findex TARGET_SWITCHES
  418. @item TARGET_SWITCHES
  419. This macro defines names of command options to set and clear
  420. bits in @code{target_flags}.  Its definition is an initializer
  421. with a subgrouping for each command option.
  422.  
  423. Each subgrouping contains a string constant, that defines the option
  424. name, and a number, which contains the bits to set in
  425. @code{target_flags}.  A negative number says to clear bits instead;
  426. the negative of the number is which bits to clear.  The actual option
  427. name is made by appending @samp{-m} to the specified name.
  428.  
  429. One of the subgroupings should have a null string.  The number in
  430. this grouping is the default value for @code{target_flags}.  Any
  431. target options act starting with that value.
  432.  
  433. Here is an example which defines @samp{-m68000} and @samp{-m68020}
  434. with opposite meanings, and picks the latter as the default:
  435.  
  436. @smallexample
  437. #define TARGET_SWITCHES \
  438.   @{ @{ "68020", 1@},      \
  439.     @{ "68000", -1@},     \
  440.     @{ "", 1@}@}
  441. @end smallexample
  442.  
  443. @findex TARGET_OPTIONS
  444. @item TARGET_OPTIONS
  445. This macro is similar to @code{TARGET_SWITCHES} but defines names of command
  446. options that have values.  Its definition is an initializer with a
  447. subgrouping for each command option. 
  448.  
  449. Each subgrouping contains a string constant, that defines the fixed part
  450. of the option name, and the address of a variable.  The variable, type
  451. @code{char *}, is set to the variable part of the given option if the fixed
  452. part matches.  The actual option name is made by appending @samp{-m} to the
  453. specified name. 
  454.  
  455. Here is an example which defines @samp{-mshort-data-@var{number}}.  If the
  456. given option is @samp{-mshort-data-512}, the variable @code{m88k_short_data}
  457. will be set to the string @code{"512"}. 
  458.  
  459. @c this is an unreported overfull hbox.  should be easy to fix, but i
  460. @c don't know what indenting etc is allowed.  --mew 10feb93
  461. @smallexample
  462. extern char *m88k_short_data;
  463. #define TARGET_OPTIONS @{ @{ "short-data-", &m88k_short_data @} @}
  464. @end smallexample
  465.  
  466. @findex TARGET_VERSION
  467. @item TARGET_VERSION
  468. This macro is a C statement to print on @code{stderr} a string
  469. describing the particular machine description choice.  Every machine
  470. description should define @code{TARGET_VERSION}.  For example:
  471.  
  472. @smallexample
  473. #ifdef MOTOROLA
  474. #define TARGET_VERSION \
  475.   fprintf (stderr, " (68k, Motorola syntax)");
  476. #else
  477. #define TARGET_VERSION \
  478.   fprintf (stderr, " (68k, MIT syntax)");
  479. #endif
  480. @end smallexample
  481.  
  482. @findex OVERRIDE_OPTIONS
  483. @item OVERRIDE_OPTIONS
  484. Sometimes certain combinations of command options do not make sense on
  485. a particular target machine.  You can define a macro
  486. @code{OVERRIDE_OPTIONS} to take account of this.  This macro, if
  487. defined, is executed once just after all the command options have been
  488. parsed.
  489.  
  490. Don't use this macro to turn on various extra optimizations for
  491. @samp{-O}.  That is what @code{OPTIMIZATION_OPTIONS} is for.
  492.  
  493. @findex OPTIMIZATION_OPTIONS
  494. @item OPTIMIZATION_OPTIONS (@var{level})
  495. Some machines may desire to change what optimizations are performed for
  496. various optimization levels.   This macro, if defined, is executed once
  497. just after the optimization level is determined and before the remainder
  498. of the command options have been parsed.  Values set in this macro are
  499. used as the default values for the other command line options.
  500.  
  501. @var{level} is the optimization level specified; 2 if -O2 is specified,
  502. 1 if -O is specified, and 0 if neither is specified.
  503.  
  504. @strong{Do not examine @code{write_symbols} in this macro!}
  505. The debugging options are not supposed to alter the generated code.
  506. @end table
  507.  
  508. @node Storage Layout
  509. @section Storage Layout
  510. @cindex storage layout
  511.  
  512. Note that the definitions of the macros in this table which are sizes or
  513. alignments measured in bits do not need to be constant.  They can be C
  514. expressions that refer to static variables, such as the @code{target_flags}.
  515. @xref{Run-time Target}.
  516.  
  517. @table @code
  518. @findex BITS_BIG_ENDIAN
  519. @item BITS_BIG_ENDIAN
  520. Define this macro to be the value 1 if the most significant bit in a
  521. byte has the lowest number; otherwise define it to be the value zero.
  522. This means that bit-field instructions count from the most significant
  523. bit.  If the machine has no bit-field instructions, then this must still
  524. be defined, but it doesn't matter which value it is defined to.
  525.  
  526. This macro does not affect the way structure fields are packed into
  527. bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
  528.  
  529. @findex BYTES_BIG_ENDIAN
  530. @item BYTES_BIG_ENDIAN
  531. Define this macro to be 1 if the most significant byte in a word has the
  532. lowest number.
  533.  
  534. @findex WORDS_BIG_ENDIAN
  535. @item WORDS_BIG_ENDIAN
  536. Define this macro to be 1 if, in a multiword object, the most
  537. significant word has the lowest number.  This applies to both memory
  538. locations and registers; GNU CC fundamentally assumes that the order of
  539. words in memory is the same as the order in registers.
  540.  
  541. @findex BITS_PER_UNIT
  542. @item BITS_PER_UNIT
  543. Define this macro to be the number of bits in an addressable storage
  544. unit (byte); normally 8.
  545.  
  546. @findex BITS_PER_WORD
  547. @item BITS_PER_WORD
  548. Number of bits in a word; normally 32.
  549.  
  550. @findex MAX_BITS_PER_WORD
  551. @item MAX_BITS_PER_WORD
  552. Maximum number of bits in a word.  If this is undefined, the default is
  553. @code{BITS_PER_WORD}.  Otherwise, it is the constant value that is the
  554. largest value that @code{BITS_PER_WORD} can have at run-time.
  555.  
  556. @findex UNITS_PER_WORD
  557. @item UNITS_PER_WORD
  558. Number of storage units in a word; normally 4.
  559.  
  560. @findex POINTER_SIZE
  561. @item POINTER_SIZE
  562. Width of a pointer, in bits.
  563.  
  564. @findex PROMOTE_MODE
  565. @item PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
  566. A macro to update @var{m} and @var{unsignedp} when an object whose type
  567. is @var{type} and which has the specified mode and signedness is to be
  568. stored in a register.  This macro is only called when @var{type} is a
  569. scalar type.
  570.  
  571. On most RISC machines, which only have operations that operate on a full
  572. register, define this macro to set @var{m} to @code{word_mode} if
  573. @var{m} is an integer mode narrower than @code{BITS_PER_WORD}.  In most
  574. cases, only integer modes should be widened because wider-precision
  575. floating-point operations are usually more expensive than their narrower
  576. counterparts.
  577.  
  578. For most machines, the macro definition does not change @var{unsignedp}.
  579. However, some machines, have instructions that preferentially handle
  580. either signed or unsigned quantities of certain modes.  For example, on
  581. the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
  582. sign-extend the result to 64 bits.  On such machines, set
  583. @var{unsignedp} according to which kind of extension is more efficient.
  584.  
  585. Do not define this macro if it would never modify @var{m}.
  586.  
  587. @findex PROMOTE_FUNCTION_ARGS
  588. @item PROMOTE_FUNCTION_ARGS
  589. Define this macro if the promotion described by @code{PROMOTE_MODE}
  590. should also be done for outgoing function arguments.  
  591.  
  592. @findex PROMOTE_FUNCTION_RETURN
  593. @item PROMOTE_FUNCTION_RETURN
  594. Define this macro if the promotion described by @code{PROMOTE_MODE}
  595. should also be done for the return value of functions.
  596.  
  597. If this macro is defined, @code{FUNCTION_VALUE} must perform the same
  598. promotions done by @code{PROMOTE_MODE}.
  599.  
  600. @findex PARM_BOUNDARY
  601. @item PARM_BOUNDARY
  602. Normal alignment required for function parameters on the stack, in
  603. bits.  All stack parameters receive at least this much alignment
  604. regardless of data type.  On most machines, this is the same as the
  605. size of an integer.
  606.  
  607. @findex STACK_BOUNDARY
  608. @item STACK_BOUNDARY
  609. Define this macro if you wish to preserve a certain alignment for
  610. the stack pointer.  The definition is a C expression
  611. for the desired alignment (measured in bits).
  612.  
  613. @cindex @code{PUSH_ROUNDING}, interaction with @code{STACK_BOUNDARY}
  614. If @code{PUSH_ROUNDING} is not defined, the stack will always be aligned
  615. to the specified boundary.  If @code{PUSH_ROUNDING} is defined and specifies a
  616. less strict alignment than @code{STACK_BOUNDARY}, the stack may be
  617. momentarily unaligned while pushing arguments.
  618.  
  619. @findex FUNCTION_BOUNDARY
  620. @item FUNCTION_BOUNDARY
  621. Alignment required for a function entry point, in bits.
  622.  
  623. @findex BIGGEST_ALIGNMENT
  624. @item BIGGEST_ALIGNMENT
  625. Biggest alignment that any data type can require on this machine, in bits.
  626.  
  627. @findex BIGGEST_FIELD_ALIGNMENT
  628. @item BIGGEST_FIELD_ALIGNMENT
  629. Biggest alignment that any structure field can require on this machine,
  630. in bits.  If defined, this overrides @code{BIGGEST_ALIGNMENT} for
  631. structure fields only.
  632.  
  633. @findex MAX_OFILE_ALIGNMENT
  634. @item MAX_OFILE_ALIGNMENT
  635. Biggest alignment supported by the object file format of this machine.
  636. Use this macro to limit the alignment which can be specified using the
  637. @code{__attribute__ ((aligned (@var{n})))} construct.  If not defined,
  638. the default value is @code{BIGGEST_ALIGNMENT}.
  639.  
  640. @findex DATA_ALIGNMENT
  641. @item DATA_ALIGNMENT (@var{type}, @var{basic-align})
  642. If defined, a C expression to compute the alignment for a static
  643. variable.  @var{type} is the data type, and @var{basic-align} is the
  644. alignment that the object would ordinarily have.  The value of this
  645. macro is used instead of that alignment to align the object.
  646.  
  647. If this macro is not defined, then @var{basic-align} is used.
  648.  
  649. @findex strcpy
  650. One use of this macro is to increase alignment of medium-size data to
  651. make it all fit in fewer cache lines.  Another is to cause character
  652. arrays to be word-aligned so that @code{strcpy} calls that copy
  653. constants to character arrays can be done inline.
  654.  
  655. @findex CONSTANT_ALIGNMENT
  656. @item CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
  657. If defined, a C expression to compute the alignment given to a constant
  658. that is being placed in memory.  @var{constant} is the constant and
  659. @var{basic-align} is the alignment that the object would ordinarily
  660. have.  The value of this macro is used instead of that alignment to
  661. align the object.
  662.  
  663. If this macro is not defined, then @var{basic-align} is used.
  664.  
  665. The typical use of this macro is to increase alignment for string
  666. constants to be word aligned so that @code{strcpy} calls that copy
  667. constants can be done inline.
  668.  
  669. @findex EMPTY_FIELD_BOUNDARY
  670. @item EMPTY_FIELD_BOUNDARY
  671. Alignment in bits to be given to a structure bit field that follows an
  672. empty field such as @code{int : 0;}.
  673.  
  674. Note that @code{PCC_BITFIELD_TYPE_MATTERS} also affects the alignment
  675. that results from an empty field.
  676.  
  677. @findex STRUCTURE_SIZE_BOUNDARY
  678. @item STRUCTURE_SIZE_BOUNDARY
  679. Number of bits which any structure or union's size must be a multiple of.
  680. Each structure or union's size is rounded up to a multiple of this.
  681.  
  682. If you do not define this macro, the default is the same as
  683. @code{BITS_PER_UNIT}.
  684.  
  685. @findex STRICT_ALIGNMENT
  686. @item STRICT_ALIGNMENT
  687. Define this macro to be the value 1 if instructions will fail to work
  688. if given data not on the nominal alignment.  If instructions will merely
  689. go slower in that case, define this macro as 0.
  690.  
  691. @findex PCC_BITFIELD_TYPE_MATTERS
  692. @item PCC_BITFIELD_TYPE_MATTERS
  693. Define this if you wish to imitate the way many other C compilers handle
  694. alignment of bitfields and the structures that contain them.
  695.  
  696. The behavior is that the type written for a bitfield (@code{int},
  697. @code{short}, or other integer type) imposes an alignment for the
  698. entire structure, as if the structure really did contain an ordinary
  699. field of that type.  In addition, the bitfield is placed within the
  700. structure so that it would fit within such a field, not crossing a
  701. boundary for it.
  702.  
  703. Thus, on most machines, a bitfield whose type is written as @code{int}
  704. would not cross a four-byte boundary, and would force four-byte
  705. alignment for the whole structure.  (The alignment used may not be four
  706. bytes; it is controlled by the other alignment parameters.)
  707.  
  708. If the macro is defined, its definition should be a C expression;
  709. a nonzero value for the expression enables this behavior.
  710.  
  711. Note that if this macro is not defined, or its value is zero, some
  712. bitfields may cross more than one alignment boundary.  The compiler can
  713. support such references if there are @samp{insv}, @samp{extv}, and
  714. @samp{extzv} insns that can directly reference memory.
  715.  
  716. The other known way of making bitfields work is to define
  717. @code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
  718. Then every structure can be accessed with fullwords.
  719.  
  720. Unless the machine has bitfield instructions or you define
  721. @code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
  722. @code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
  723.  
  724. If your aim is to make GNU CC use the same conventions for laying out
  725. bitfields as are used by another compiler, here is how to investigate
  726. what the other compiler does.  Compile and run this program:
  727.  
  728. @example
  729. struct foo1
  730. @{
  731.   char x;
  732.   char :0;
  733.   char y;
  734. @};
  735.  
  736. struct foo2
  737. @{
  738.   char x;
  739.   int :0;
  740.   char y;
  741. @};
  742.  
  743. main ()
  744. @{
  745.   printf ("Size of foo1 is %d\n",
  746.           sizeof (struct foo1));
  747.   printf ("Size of foo2 is %d\n",
  748.           sizeof (struct foo2));
  749.   exit (0);
  750. @}
  751. @end example
  752.  
  753. If this prints 2 and 5, then the compiler's behavior is what you would
  754. get from @code{PCC_BITFIELD_TYPE_MATTERS}.
  755.  
  756. @findex BITFIELD_NBYTES_LIMITED
  757. @item BITFIELD_NBYTES_LIMITED
  758. Like PCC_BITFIELD_TYPE_MATTERS except that its effect is limited to
  759. aligning a bitfield within the structure.
  760.  
  761. @findex ROUND_TYPE_SIZE
  762. @item ROUND_TYPE_SIZE (@var{struct}, @var{size}, @var{align})
  763. Define this macro as an expression for the overall size of a structure 
  764. (given by @var{struct} as a tree node) when the size computed from the
  765. fields is @var{size} and the alignment is @var{align}.
  766.  
  767. The default is to round @var{size} up to a multiple of @var{align}.
  768.  
  769. @findex ROUND_TYPE_ALIGN
  770. @item ROUND_TYPE_ALIGN (@var{struct}, @var{computed}, @var{specified})
  771. Define this macro as an expression for the alignment of a structure 
  772. (given by @var{struct} as a tree node) if the alignment computed in the
  773. usual way is @var{computed} and the alignment explicitly specified was
  774. @var{specified}.
  775.  
  776. The default is to use @var{specified} if it is larger; otherwise, use
  777. the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
  778.  
  779. @findex MAX_FIXED_MODE_SIZE
  780. @item MAX_FIXED_MODE_SIZE
  781. An integer expression for the size in bits of the largest integer
  782. machine mode that should actually be used.  All integer machine modes of
  783. this size or smaller can be used for structures and unions with the
  784. appropriate sizes.  If this macro is undefined, @code{GET_MODE_BITSIZE
  785. (DImode)} is assumed.
  786.  
  787. @findex CHECK_FLOAT_VALUE
  788. @item CHECK_FLOAT_VALUE (@var{mode}, @var{value})
  789. A C statement to validate the value @var{value} (of type
  790. @code{double}) for mode @var{mode}.  This means that you check whether
  791. @var{value} fits within the possible range of values for mode
  792. @var{mode} on this target machine.  The mode @var{mode} is always
  793. @code{SFmode} or @code{DFmode}.
  794.  
  795. @findex error
  796. If @var{value} is not valid, you should call @code{error} to print an
  797. error message and then assign some valid value to @var{value}.
  798. Allowing an invalid value to go through the compiler can produce
  799. incorrect assembler code which may even cause Unix assemblers to
  800. crash.
  801.  
  802. This macro need not be defined if there is no work for it to do.
  803.  
  804. @findex TARGET_FLOAT_FORMAT
  805. @item TARGET_FLOAT_FORMAT
  806. A code distinguishing the floating point format of the target machine.
  807. There are three defined values:
  808.  
  809. @table @code
  810. @findex IEEE_FLOAT_FORMAT
  811. @item IEEE_FLOAT_FORMAT
  812. This code indicates IEEE floating point.  It is the default; there is no
  813. need to define this macro when the format is IEEE.
  814.  
  815. @findex VAX_FLOAT_FORMAT
  816. @item VAX_FLOAT_FORMAT
  817. This code indicates the peculiar format used on the Vax.
  818.  
  819. @findex UNKNOWN_FLOAT_FORMAT
  820. @item UNKNOWN_FLOAT_FORMAT
  821. This code indicates any other format.
  822. @end table
  823.  
  824. The value of this macro is compared with @code{HOST_FLOAT_FORMAT}
  825. (@pxref{Config}) to determine whether the target machine has the same
  826. format as the host machine.  If any other formats are actually in use on
  827. supported machines, new codes should be defined for them.
  828. @end table
  829.  
  830. @node Type Layout
  831. @section Layout of Source Language Data Types
  832.  
  833. These macros define the sizes and other characteristics of the standard
  834. basic data types used in programs being compiled.  Unlike the macros in
  835. the previous section, these apply to specific features of C and related
  836. languages, rather than to fundamental aspects of storage layout.
  837.  
  838. @table @code
  839. @findex INT_TYPE_SIZE
  840. @item INT_TYPE_SIZE
  841. A C expression for the size in bits of the type @code{int} on the
  842. target machine.  If you don't define this, the default is one word.
  843.  
  844. @findex SHORT_TYPE_SIZE
  845. @item SHORT_TYPE_SIZE
  846. A C expression for the size in bits of the type @code{short} on the
  847. target machine.  If you don't define this, the default is half a word.
  848. (If this would be less than one storage unit, it is rounded up to one
  849. unit.)
  850.  
  851. @findex LONG_TYPE_SIZE
  852. @item LONG_TYPE_SIZE
  853. A C expression for the size in bits of the type @code{long} on the
  854. target machine.  If you don't define this, the default is one word.
  855.  
  856. @findex LONG_LONG_TYPE_SIZE
  857. @item LONG_LONG_TYPE_SIZE
  858. A C expression for the size in bits of the type @code{long long} on the
  859. target machine.  If you don't define this, the default is two
  860. words.
  861.  
  862. @findex CHAR_TYPE_SIZE
  863. @item CHAR_TYPE_SIZE
  864. A C expression for the size in bits of the type @code{char} on the
  865. target machine.  If you don't define this, the default is one quarter
  866. of a word.  (If this would be less than one storage unit, it is rounded up
  867. to one unit.)
  868.  
  869. @findex FLOAT_TYPE_SIZE
  870. @item FLOAT_TYPE_SIZE
  871. A C expression for the size in bits of the type @code{float} on the
  872. target machine.  If you don't define this, the default is one word.
  873.  
  874. @findex DOUBLE_TYPE_SIZE
  875. @item DOUBLE_TYPE_SIZE
  876. A C expression for the size in bits of the type @code{double} on the
  877. target machine.  If you don't define this, the default is two
  878. words.
  879.  
  880. @findex LONG_DOUBLE_TYPE_SIZE
  881. @item LONG_DOUBLE_TYPE_SIZE
  882. A C expression for the size in bits of the type @code{long double} on
  883. the target machine.  If you don't define this, the default is two
  884. words.
  885.  
  886. @findex DEFAULT_SIGNED_CHAR
  887. @item DEFAULT_SIGNED_CHAR
  888. An expression whose value is 1 or 0, according to whether the type
  889. @code{char} should be signed or unsigned by default.  The user can
  890. always override this default with the options @samp{-fsigned-char}
  891. and @samp{-funsigned-char}.
  892.  
  893. @findex DEFAULT_SHORT_ENUMS
  894. @item DEFAULT_SHORT_ENUMS
  895. A C expression to determine whether to give an @code{enum} type 
  896. only as many bytes as it takes to represent the range of possible values
  897. of that type.  A nonzero value means to do that; a zero value means all
  898. @code{enum} types should be allocated like @code{int}.
  899.  
  900. If you don't define the macro, the default is 0.
  901.  
  902. @findex SIZE_TYPE
  903. @item SIZE_TYPE
  904. A C expression for a string describing the name of the data type to use
  905. for size values.  The typedef name @code{size_t} is defined using the
  906. contents of the string.
  907.  
  908. The string can contain more than one keyword.  If so, separate them with
  909. spaces, and write first any length keyword, then @code{unsigned} if
  910. appropriate, and finally @code{int}.  The string must exactly match one
  911. of the data type names defined in the function
  912. @code{init_decl_processing} in the file @file{c-decl.c}.  You may not
  913. omit @code{int} or change the order---that would cause the compiler to
  914. crash on startup.
  915.  
  916. If you don't define this macro, the default is @code{"long unsigned
  917. int"}.
  918.  
  919. @findex PTRDIFF_TYPE
  920. @item PTRDIFF_TYPE
  921. A C expression for a string describing the name of the data type to use
  922. for the result of subtracting two pointers.  The typedef name
  923. @code{ptrdiff_t} is defined using the contents of the string.  See
  924. @code{SIZE_TYPE} above for more information.
  925.  
  926. If you don't define this macro, the default is @code{"long int"}.
  927.  
  928. @findex WCHAR_TYPE
  929. @item WCHAR_TYPE
  930. A C expression for a string describing the name of the data type to use
  931. for wide characters.  The typedef name @code{wchar_t} is defined using
  932. the contents of the string.  See @code{SIZE_TYPE} above for more
  933. information.
  934.  
  935. If you don't define this macro, the default is @code{"int"}.
  936.  
  937. @findex WCHAR_TYPE_SIZE
  938. @item WCHAR_TYPE_SIZE
  939. A C expression for the size in bits of the data type for wide
  940. characters.  This is used in @code{cpp}, which cannot make use of
  941. @code{WCHAR_TYPE}.
  942.  
  943. @findex OBJC_INT_SELECTORS
  944. @item OBJC_INT_SELECTORS
  945. Define this macro if the type of Objective C selectors should be
  946. @code{int}.
  947.  
  948. If this macro is not defined, then selectors should have the type
  949. @code{struct objc_selector *}.
  950.  
  951. @findex OBJC_SELECTORS_WITHOUT_LABELS
  952. @item OBJC_SELECTORS_WITHOUT_LABELS
  953. Define this macro if the compiler can group all the selectors together
  954. into a vector and use just one label at the beginning of the vector.
  955. Otherwise, the compiler must give each selector its own assembler
  956. label.
  957.  
  958. On certain machines, it is important to have a separate label for each
  959. selector because this enables the linker to eliminate duplicate selectors.
  960.  
  961. @findex TARGET_BELL
  962. @item TARGET_BELL
  963. A C constant expression for the integer value for escape sequence
  964. @samp{\a}.
  965.  
  966. @findex TARGET_TAB
  967. @findex TARGET_BS
  968. @findex TARGET_NEWLINE
  969. @item TARGET_BS
  970. @itemx TARGET_TAB
  971. @itemx TARGET_NEWLINE
  972. C constant expressions for the integer values for escape sequences
  973. @samp{\b}, @samp{\t} and @samp{\n}.
  974.  
  975. @findex TARGET_VT
  976. @findex TARGET_FF
  977. @findex TARGET_CR
  978. @item TARGET_VT
  979. @itemx TARGET_FF
  980. @itemx TARGET_CR
  981. C constant expressions for the integer values for escape sequences
  982. @samp{\v}, @samp{\f} and @samp{\r}.
  983. @end table
  984.  
  985. @node Registers
  986. @section Register Usage
  987. @cindex register usage
  988.  
  989. This section explains how to describe what registers the target machine
  990. has, and how (in general) they can be used.
  991.  
  992. The description of which registers a specific instruction can use is
  993. done with register classes; see @ref{Register Classes}.  For information
  994. on using registers to access a stack frame, see @ref{Frame Registers}.
  995. For passing values in registers, see @ref{Register Arguments}.
  996. For returning values in registers, see @ref{Scalar Return}.
  997.  
  998. @menu
  999. * Register Basics::        Number and kinds of registers.
  1000. * Allocation Order::        Order in which registers are allocated.
  1001. * Values in Registers::        What kinds of values each reg can hold.
  1002. * Leaf Functions::        Renumbering registers for leaf functions.
  1003. * Stack Registers::        Handling a register stack such as 80387.
  1004. * Obsolete Register Macros::    Macros formerly used for the 80387.
  1005. @end menu
  1006.  
  1007. @node Register Basics
  1008. @subsection Basic Characteristics of Registers
  1009.  
  1010. @table @code
  1011. @findex FIRST_PSEUDO_REGISTER
  1012. @item FIRST_PSEUDO_REGISTER
  1013. Number of hardware registers known to the compiler.  They receive
  1014. numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
  1015. pseudo register's number really is assigned the number
  1016. @code{FIRST_PSEUDO_REGISTER}.
  1017.  
  1018. @item FIXED_REGISTERS
  1019. @findex FIXED_REGISTERS
  1020. @cindex fixed register
  1021. An initializer that says which registers are used for fixed purposes
  1022. all throughout the compiled code and are therefore not available for
  1023. general allocation.  These would include the stack pointer, the frame
  1024. pointer (except on machines where that can be used as a general
  1025. register when no frame pointer is needed), the program counter on
  1026. machines where that is considered one of the addressable registers,
  1027. and any other numbered register with a standard use.
  1028.  
  1029. This information is expressed as a sequence of numbers, separated by
  1030. commas and surrounded by braces.  The @var{n}th number is 1 if
  1031. register @var{n} is fixed, 0 otherwise.
  1032.  
  1033. The table initialized from this macro, and the table initialized by
  1034. the following one, may be overridden at run time either automatically,
  1035. by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
  1036. the user with the command options @samp{-ffixed-@var{reg}},
  1037. @samp{-fcall-used-@var{reg}} and @samp{-fcall-saved-@var{reg}}.
  1038.  
  1039. @findex CALL_USED_REGISTERS
  1040. @item CALL_USED_REGISTERS
  1041. @cindex call-used register
  1042. @cindex call-clobbered register
  1043. @cindex call-saved register
  1044. Like @code{FIXED_REGISTERS} but has 1 for each register that is
  1045. clobbered (in general) by function calls as well as for fixed
  1046. registers.  This macro therefore identifies the registers that are not
  1047. available for general allocation of values that must live across
  1048. function calls.
  1049.  
  1050. If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
  1051. automatically saves it on function entry and restores it on function
  1052. exit, if the register is used within the function.
  1053.  
  1054. @findex CONDITIONAL_REGISTER_USAGE
  1055. @findex fixed_regs
  1056. @findex call_used_regs
  1057. @item CONDITIONAL_REGISTER_USAGE
  1058. Zero or more C statements that may conditionally modify two variables
  1059. @code{fixed_regs} and @code{call_used_regs} (both of type @code{char
  1060. []}) after they have been initialized from the two preceding macros.
  1061.  
  1062. This is necessary in case the fixed or call-clobbered registers depend
  1063. on target flags.
  1064.  
  1065. You need not define this macro if it has no work to do.
  1066.  
  1067. @cindex disabling certain registers
  1068. @cindex controlling register usage 
  1069. If the usage of an entire class of registers depends on the target
  1070. flags, you may indicate this to GCC by using this macro to modify
  1071. @code{fixed_regs} and @code{call_used_regs} to 1 for each of the
  1072. registers in the classes which should not be used by GCC.  Also define
  1073. the macro @code{REG_CLASS_FROM_LETTER} to return @code{NO_REGS} if it
  1074. is called with a letter for a class that shouldn't be used.
  1075.  
  1076. (However, if this class is not included in @code{GENERAL_REGS} and all
  1077. of the insn patterns whose constraints permit this class are
  1078. controlled by target switches, then GCC will automatically avoid using
  1079. these registers when the target switches are opposed to them.)
  1080.  
  1081. @findex NON_SAVING_SETJMP
  1082. @item NON_SAVING_SETJMP
  1083. If this macro is defined and has a nonzero value, it means that
  1084. @code{setjmp} and related functions fail to save the registers, or that
  1085. @code{longjmp} fails to restore them.  To compensate, the compiler
  1086. avoids putting variables in registers in functions that use
  1087. @code{setjmp}.
  1088.  
  1089. @findex INCOMING_REGNO
  1090. @item INCOMING_REGNO (@var{out})
  1091. Define this macro if the target machine has register windows.  This C
  1092. expression returns the register number as seen by the called function
  1093. corresponding to the register number @var{out} as seen by the calling
  1094. function.  Return @var{out} if register number @var{out} is not an
  1095. outbound register.
  1096.  
  1097. @findex OUTGOING_REGNO
  1098. @item OUTGOING_REGNO (@var{in})
  1099. Define this macro if the target machine has register windows.  This C
  1100. expression returns the register number as seen by the calling function
  1101. corresponding to the register number @var{in} as seen by the called
  1102. function.  Return @var{in} if register number @var{in} is not an inbound
  1103. register.
  1104.  
  1105. @ignore
  1106. @findex PC_REGNUM
  1107. @item PC_REGNUM
  1108. If the program counter has a register number, define this as that
  1109. register number.  Otherwise, do not define it.
  1110. @end ignore
  1111. @end table
  1112.  
  1113. @node Allocation Order
  1114. @subsection Order of Allocation of Registers
  1115. @cindex order of register allocation
  1116. @cindex register allocation order
  1117.  
  1118. @table @code
  1119. @findex REG_ALLOC_ORDER
  1120. @item REG_ALLOC_ORDER
  1121. If defined, an initializer for a vector of integers, containing the
  1122. numbers of hard registers in the order in which GNU CC should prefer
  1123. to use them (from most preferred to least).
  1124.  
  1125. If this macro is not defined, registers are used lowest numbered first
  1126. (all else being equal).
  1127.  
  1128. One use of this macro is on machines where the highest numbered
  1129. registers must always be saved and the save-multiple-registers
  1130. instruction supports only sequences of consecutive registers.  On such
  1131. machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
  1132. the highest numbered allocatable register first.
  1133.  
  1134. @findex ORDER_REGS_FOR_LOCAL_ALLOC
  1135. @item ORDER_REGS_FOR_LOCAL_ALLOC
  1136. A C statement (sans semicolon) to choose the order in which to allocate
  1137. hard registers for pseudo-registers local to a basic block.
  1138.  
  1139. Store the desired register order in the array @code{reg_alloc_order}.
  1140. Element 0 should be the register to allocate first; element 1, the next
  1141. register; and so on.
  1142.  
  1143. The macro body should not assume anything about the contents of
  1144. @code{reg_alloc_order} before execution of the macro.
  1145.  
  1146. On most machines, it is not necessary to define this macro.
  1147. @end table
  1148.  
  1149. @node Values in Registers
  1150. @subsection How Values Fit in Registers
  1151.  
  1152. This section discusses the macros that describe which kinds of values
  1153. (specifically, which machine modes) each register can hold, and how many
  1154. consecutive registers are needed for a given mode.
  1155.  
  1156. @table @code
  1157. @findex HARD_REGNO_NREGS
  1158. @item HARD_REGNO_NREGS (@var{regno}, @var{mode})
  1159. A C expression for the number of consecutive hard registers, starting
  1160. at register number @var{regno}, required to hold a value of mode
  1161. @var{mode}.
  1162.  
  1163. On a machine where all registers are exactly one word, a suitable
  1164. definition of this macro is
  1165.  
  1166. @smallexample
  1167. #define HARD_REGNO_NREGS(REGNO, MODE)            \
  1168.    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1)  \
  1169.     / UNITS_PER_WORD))
  1170. @end smallexample
  1171.  
  1172. @findex HARD_REGNO_MODE_OK
  1173. @item HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
  1174. A C expression that is nonzero if it is permissible to store a value
  1175. of mode @var{mode} in hard register number @var{regno} (or in several
  1176. registers starting with that one).  For a machine where all registers
  1177. are equivalent, a suitable definition is
  1178.  
  1179. @smallexample
  1180. #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
  1181. @end smallexample
  1182.  
  1183. It is not necessary for this macro to check for the numbers of fixed
  1184. registers, because the allocation mechanism considers them to be always
  1185. occupied.
  1186.  
  1187. @cindex register pairs
  1188. On some machines, double-precision values must be kept in even/odd
  1189. register pairs.  The way to implement that is to define this macro
  1190. to reject odd register numbers for such modes.
  1191.  
  1192. @ignore
  1193. @c I think this is not true now
  1194. GNU CC assumes that it can always move values between registers and
  1195. (suitably addressed) memory locations.  If it is impossible to move a
  1196. value of a certain mode between memory and certain registers, then
  1197. @code{HARD_REGNO_MODE_OK} must not allow this mode in those registers.
  1198. @end ignore
  1199.  
  1200. The minimum requirement for a mode to be OK in a register is that the
  1201. @samp{mov@var{mode}} instruction pattern support moves between the
  1202. register and any other hard register for which the mode is OK; and that
  1203. moving a value into the register and back out not alter it.
  1204.  
  1205. Since the same instruction used to move @code{SImode} will work for all
  1206. narrower integer modes, it is not necessary on any machine for
  1207. @code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
  1208. you define patterns @samp{movhi}, etc., to take advantage of this.  This
  1209. is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
  1210. and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
  1211. to be tieable.
  1212.  
  1213. Many machines have special registers for floating point arithmetic.
  1214. Often people assume that floating point machine modes are allowed only
  1215. in floating point registers.  This is not true.  Any registers that
  1216. can hold integers can safely @emph{hold} a floating point machine
  1217. mode, whether or not floating arithmetic can be done on it in those
  1218. registers.  Integer move instructions can be used to move the values.
  1219.  
  1220. On some machines, though, the converse is true: fixed-point machine
  1221. modes may not go in floating registers.  This is true if the floating
  1222. registers normalize any value stored in them, because storing a
  1223. non-floating value there would garble it.  In this case,
  1224. @code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
  1225. floating registers.  But if the floating registers do not automatically
  1226. normalize, if you can store any bit pattern in one and retrieve it
  1227. unchanged without a trap, then any machine mode may go in a floating
  1228. register, so you can define this macro to say so.
  1229.  
  1230. On some machines, such as the Sparc and the Mips, we get better code
  1231. by defining @code{HARD_REGNO_MODE_OK} to forbid integers in floating
  1232. registers, even though the hardware is capable of handling them.  This
  1233. is because transferring values between floating registers and general
  1234. registers is so slow that it is better to keep the integer in memory.
  1235.  
  1236. The primary significance of special floating registers is rather that
  1237. they are the registers acceptable in floating point arithmetic
  1238. instructions.  However, this is of no concern to
  1239. @code{HARD_REGNO_MODE_OK}.  You handle it by writing the proper
  1240. constraints for those instructions.
  1241.  
  1242. On some machines, the floating registers are especially slow to access,
  1243. so that it is better to store a value in a stack frame than in such a
  1244. register if floating point arithmetic is not being done.  As long as the
  1245. floating registers are not in class @code{GENERAL_REGS}, they will not
  1246. be used unless some pattern's constraint asks for one.
  1247.  
  1248. @findex MODES_TIEABLE_P
  1249. @item MODES_TIEABLE_P (@var{mode1}, @var{mode2})
  1250. A C expression that is nonzero if it is desirable to choose register
  1251. allocation so as to avoid move instructions between a value of mode
  1252. @var{mode1} and a value of mode @var{mode2}.
  1253.  
  1254. If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
  1255. @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are ever different
  1256. for any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1},
  1257. @var{mode2})} must be zero.
  1258. @end table
  1259.  
  1260. @node Leaf Functions
  1261. @subsection Handling Leaf Functions
  1262.  
  1263. @cindex leaf functions
  1264. @cindex functions, leaf
  1265. On some machines, a leaf function (i.e., one which makes no calls) can run
  1266. more efficiently if it does not make its own register window.  Often this
  1267. means it is required to receive its arguments in the registers where they
  1268. are passed by the caller, instead of the registers where they would
  1269. normally arrive.
  1270.  
  1271. The special treatment for leaf functions generally applies only when
  1272. other conditions are met; for example, often they may use only those
  1273. registers for its own variables and temporaries.  We use the term ``leaf
  1274. function'' to mean a function that is suitable for this special
  1275. handling, so that functions with no calls are not necessarily ``leaf
  1276. functions''.
  1277.  
  1278. GNU CC assigns register numbers before it knows whether the function is
  1279. suitable for leaf function treatment.  So it needs to renumber the
  1280. registers in order to output a leaf function.  The following macros
  1281. accomplish this.
  1282.  
  1283. @table @code
  1284. @findex LEAF_REGISTERS
  1285. @item LEAF_REGISTERS
  1286. A C initializer for a vector, indexed by hard register number, which
  1287. contains 1 for a register that is allowable in a candidate for leaf
  1288. function treatment.
  1289.  
  1290. If leaf function treatment involves renumbering the registers, then the
  1291. registers marked here should be the ones before renumbering---those that
  1292. GNU CC would ordinarily allocate.  The registers which will actually be
  1293. used in the assembler code, after renumbering, should not be marked with 1
  1294. in this vector.
  1295.  
  1296. Define this macro only if the target machine offers a way to optimize
  1297. the treatment of leaf functions.
  1298.  
  1299. @findex LEAF_REG_REMAP
  1300. @item LEAF_REG_REMAP (@var{regno})
  1301. A C expression whose value is the register number to which @var{regno}
  1302. should be renumbered, when a function is treated as a leaf function.
  1303.  
  1304. If @var{regno} is a register number which should not appear in a leaf
  1305. function before renumbering, then the expression should yield -1, which
  1306. will cause the compiler to abort.
  1307.  
  1308. Define this macro only if the target machine offers a way to optimize the
  1309. treatment of leaf functions, and registers need to be renumbered to do
  1310. this.
  1311.  
  1312. @findex REG_LEAF_ALLOC_ORDER
  1313. @item REG_LEAF_ALLOC_ORDER
  1314. If defined, an initializer for a vector of integers, containing the
  1315. numbers of hard registers in the order in which the GNU CC should prefer
  1316. to use them (from most preferred to least) in a leaf function.  If this
  1317. macro is not defined, REG_ALLOC_ORDER is used for both non-leaf and
  1318. leaf-functions.
  1319. @c *important*.. is the above all-caps phrase supposed tobe in code
  1320. @c font? --mew 2feb93
  1321. @end table
  1322.  
  1323. @findex leaf_function
  1324. Normally, @code{FUNCTION_PROLOGUE} and @code{FUNCTION_EPILOGUE} must
  1325. treat leaf functions specially.  It can test the C variable
  1326. @code{leaf_function} which is nonzero for leaf functions.  (The variable
  1327. @code{leaf_function} is defined only if @code{LEAF_REGISTERS} is
  1328. defined.)
  1329. @c changed this to fix overfull.  ALSO:  why the "it" at the beginning
  1330. @c of the next paragraph?!  --mew 2feb93 
  1331.  
  1332. @node Stack Registers
  1333. @subsection Registers That Form a Stack
  1334.  
  1335. There are special features to handle computers where some of the
  1336. ``registers'' form a stack, as in the 80387 coprocessor for the 80386.
  1337. Stack registers are normally written by pushing onto the stack, and are
  1338. numbered relative to the top of the stack.
  1339.  
  1340. Currently, GNU CC can only handle one group of stack-like registers, and
  1341. they must be consecutively numbered.
  1342.  
  1343. @table @code
  1344. @findex STACK_REGS
  1345. @item STACK_REGS
  1346. Define this if the machine has any stack-like registers.
  1347.  
  1348. @findex FIRST_STACK_REG
  1349. @item FIRST_STACK_REG
  1350. The number of the first stack-like register.  This one is the top
  1351. of the stack.
  1352.  
  1353. @findex LAST_STACK_REG
  1354. @item LAST_STACK_REG
  1355. The number of the last stack-like register.  This one is the bottom of
  1356. the stack.
  1357. @end table
  1358.  
  1359. @node Obsolete Register Macros
  1360. @subsection Obsolete Macros for Controlling Register Usage
  1361.  
  1362. These features do not work very well.  They exist because they used to
  1363. be required to generate correct code for the 80387 coprocessor of the
  1364. 80386.  They are no longer used by that machine description and may be
  1365. removed in a later version of the compiler.  Don't use them!
  1366.  
  1367. @table @code
  1368. @findex OVERLAPPING_REGNO_P 
  1369. @item OVERLAPPING_REGNO_P (@var{regno})
  1370. If defined, this is a C expression whose value is nonzero if hard
  1371. register number @var{regno} is an overlapping register.  This means a
  1372. hard register which overlaps a hard register with a different number.
  1373. (Such overlap is undesirable, but occasionally it allows a machine to
  1374. be supported which otherwise could not be.)  This macro must return
  1375. nonzero for @emph{all} the registers which overlap each other.  GNU CC
  1376. can use an overlapping register only in certain limited ways.  It can
  1377. be used for allocation within a basic block, and may be spilled for
  1378. reloading; that is all.
  1379.  
  1380. If this macro is not defined, it means that none of the hard registers
  1381. overlap each other.  This is the usual situation.
  1382.  
  1383. @findex INSN_CLOBBERS_REGNO_P
  1384. @item INSN_CLOBBERS_REGNO_P (@var{insn}, @var{regno})
  1385. If defined, this is a C expression whose value should be nonzero if
  1386. the insn @var{insn} has the effect of mysteriously clobbering the
  1387. contents of hard register number @var{regno}.  By ``mysterious'' we
  1388. mean that the insn's RTL expression doesn't describe such an effect.
  1389.  
  1390. If this macro is not defined, it means that no insn clobbers registers
  1391. mysteriously.  This is the usual situation; all else being equal,
  1392. it is best for the RTL expression to show all the activity.
  1393.  
  1394. @cindex death notes
  1395. @findex PRESERVE_DEATH_INFO_REGNO_P
  1396. @item PRESERVE_DEATH_INFO_REGNO_P (@var{regno})
  1397. If defined, this is a C expression whose value is nonzero if accurate
  1398. @code{REG_DEAD} notes are needed for hard register number @var{regno}
  1399. at the time of outputting the assembler code.  When this is so, a few
  1400. optimizations that take place after register allocation and could
  1401. invalidate the death notes are not done when this register is
  1402. involved.
  1403.  
  1404. You would arrange to preserve death info for a register when some of the
  1405. code in the machine description which is executed to write the assembler
  1406. code looks at the death notes.  This is necessary only when the actual
  1407. hardware feature which GNU CC thinks of as a register is not actually a
  1408. register of the usual sort.  (It might, for example, be a hardware
  1409. stack.)
  1410.  
  1411. If this macro is not defined, it means that no death notes need to be
  1412. preserved.  This is the usual situation.
  1413. @end table
  1414.  
  1415. @node Register Classes
  1416. @section Register Classes
  1417. @cindex register class definitions
  1418. @cindex class definitions, register
  1419.  
  1420. On many machines, the numbered registers are not all equivalent.
  1421. For example, certain registers may not be allowed for indexed addressing;
  1422. certain registers may not be allowed in some instructions.  These machine
  1423. restrictions are described to the compiler using @dfn{register classes}.
  1424.  
  1425. You define a number of register classes, giving each one a name and saying
  1426. which of the registers belong to it.  Then you can specify register classes
  1427. that are allowed as operands to particular instruction patterns.
  1428.  
  1429. @findex ALL_REGS
  1430. @findex NO_REGS
  1431. In general, each register will belong to several classes.  In fact, one
  1432. class must be named @code{ALL_REGS} and contain all the registers.  Another
  1433. class must be named @code{NO_REGS} and contain no registers.  Often the
  1434. union of two classes will be another class; however, this is not required.
  1435.  
  1436. @findex GENERAL_REGS
  1437. One of the classes must be named @code{GENERAL_REGS}.  There is nothing
  1438. terribly special about the name, but the operand constraint letters
  1439. @samp{r} and @samp{g} specify this class.  If @code{GENERAL_REGS} is
  1440. the same as @code{ALL_REGS}, just define it as a macro which expands
  1441. to @code{ALL_REGS}.
  1442.  
  1443. Order the classes so that if class @var{x} is contained in class @var{y}
  1444. then @var{x} has a lower class number than @var{y}.
  1445.  
  1446. The way classes other than @code{GENERAL_REGS} are specified in operand
  1447. constraints is through machine-dependent operand constraint letters.
  1448. You can define such letters to correspond to various classes, then use
  1449. them in operand constraints.
  1450.  
  1451. You should define a class for the union of two classes whenever some
  1452. instruction allows both classes.  For example, if an instruction allows
  1453. either a floating point (coprocessor) register or a general register for a
  1454. certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
  1455. which includes both of them.  Otherwise you will get suboptimal code.
  1456.  
  1457. You must also specify certain redundant information about the register
  1458. classes: for each class, which classes contain it and which ones are
  1459. contained in it; for each pair of classes, the largest class contained
  1460. in their union.
  1461.  
  1462. When a value occupying several consecutive registers is expected in a
  1463. certain class, all the registers used must belong to that class.
  1464. Therefore, register classes cannot be used to enforce a requirement for
  1465. a register pair to start with an even-numbered register.  The way to
  1466. specify this requirement is with @code{HARD_REGNO_MODE_OK}.
  1467.  
  1468. Register classes used for input-operands of bitwise-and or shift
  1469. instructions have a special requirement: each such class must have, for
  1470. each fixed-point machine mode, a subclass whose registers can transfer that
  1471. mode to or from memory.  For example, on some machines, the operations for
  1472. single-byte values (@code{QImode}) are limited to certain registers.  When
  1473. this is so, each register class that is used in a bitwise-and or shift
  1474. instruction must have a subclass consisting of registers from which
  1475. single-byte values can be loaded or stored.  This is so that
  1476. @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
  1477.  
  1478. @table @code
  1479. @findex enum reg_class
  1480. @item enum reg_class
  1481. An enumeral type that must be defined with all the register class names
  1482. as enumeral values.  @code{NO_REGS} must be first.  @code{ALL_REGS}
  1483. must be the last register class, followed by one more enumeral value,
  1484. @code{LIM_REG_CLASSES}, which is not a register class but rather
  1485. tells how many classes there are.
  1486.  
  1487. Each register class has a number, which is the value of casting
  1488. the class name to type @code{int}.  The number serves as an index
  1489. in many of the tables described below.
  1490.  
  1491. @findex N_REG_CLASSES
  1492. @item N_REG_CLASSES
  1493. The number of distinct register classes, defined as follows:
  1494.  
  1495. @example
  1496. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  1497. @end example
  1498.  
  1499. @findex REG_CLASS_NAMES
  1500. @item REG_CLASS_NAMES
  1501. An initializer containing the names of the register classes as C string
  1502. constants.  These names are used in writing some of the debugging dumps.
  1503.  
  1504. @findex REG_CLASS_CONTENTS
  1505. @item REG_CLASS_CONTENTS
  1506. An initializer containing the contents of the register classes, as integers
  1507. which are bit masks.  The @var{n}th integer specifies the contents of class
  1508. @var{n}.  The way the integer @var{mask} is interpreted is that
  1509. register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
  1510.  
  1511. When the machine has more than 32 registers, an integer does not suffice.
  1512. Then the integers are replaced by sub-initializers, braced groupings containing
  1513. several integers.  Each sub-initializer must be suitable as an initializer
  1514. for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
  1515.  
  1516. @findex REGNO_REG_CLASS 
  1517. @item REGNO_REG_CLASS (@var{regno})
  1518. A C expression whose value is a register class containing hard register
  1519. @var{regno}.  In general there is more than one such class; choose a class
  1520. which is @dfn{minimal}, meaning that no smaller class also contains the
  1521. register.
  1522.  
  1523. @findex BASE_REG_CLASS
  1524. @item BASE_REG_CLASS
  1525. A macro whose definition is the name of the class to which a valid
  1526. base register must belong.  A base register is one used in an address
  1527. which is the register value plus a displacement.
  1528.  
  1529. @findex INDEX_REG_CLASS
  1530. @item INDEX_REG_CLASS
  1531. A macro whose definition is the name of the class to which a valid
  1532. index register must belong.  An index register is one used in an
  1533. address where its value is either multiplied by a scale factor or
  1534. added to another register (as well as added to a displacement).
  1535.  
  1536. @findex REG_CLASS_FROM_LETTER
  1537. @item REG_CLASS_FROM_LETTER (@var{char})
  1538. A C expression which defines the machine-dependent operand constraint
  1539. letters for register classes.  If @var{char} is such a letter, the
  1540. value should be the register class corresponding to it.  Otherwise,
  1541. the value should be @code{NO_REGS}.  The register letter @samp{r},
  1542. corresponding to class @code{GENERAL_REGS}, will not be passed
  1543. to this macro; you do not need to handle it.
  1544.  
  1545. @findex REGNO_OK_FOR_BASE_P
  1546. @item REGNO_OK_FOR_BASE_P (@var{num})
  1547. A C expression which is nonzero if register number @var{num} is
  1548. suitable for use as a base register in operand addresses.  It may be
  1549. either a suitable hard register or a pseudo register that has been
  1550. allocated such a hard register.
  1551.  
  1552. @findex REGNO_OK_FOR_INDEX_P
  1553. @item REGNO_OK_FOR_INDEX_P (@var{num})
  1554. A C expression which is nonzero if register number @var{num} is
  1555. suitable for use as an index register in operand addresses.  It may be
  1556. either a suitable hard register or a pseudo register that has been
  1557. allocated such a hard register.
  1558.  
  1559. The difference between an index register and a base register is that
  1560. the index register may be scaled.  If an address involves the sum of
  1561. two registers, neither one of them scaled, then either one may be
  1562. labeled the ``base'' and the other the ``index''; but whichever
  1563. labeling is used must fit the machine's constraints of which registers
  1564. may serve in each capacity.  The compiler will try both labelings,
  1565. looking for one that is valid, and will reload one or both registers
  1566. only if neither labeling works.
  1567.  
  1568. @findex PREFERRED_RELOAD_CLASS
  1569. @item PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
  1570. A C expression that places additional restrictions on the register class
  1571. to use when it is necessary to copy value @var{x} into a register in class
  1572. @var{class}.  The value is a register class; perhaps @var{class}, or perhaps
  1573. another, smaller class.  On many machines, the following definition is
  1574. safe: 
  1575.  
  1576. @example
  1577. #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
  1578. @end example
  1579.  
  1580. Sometimes returning a more restrictive class makes better code.  For
  1581. example, on the 68000, when @var{x} is an integer constant that is in range
  1582. for a @samp{moveq} instruction, the value of this macro is always
  1583. @code{DATA_REGS} as long as @var{class} includes the data registers.
  1584. Requiring a data register guarantees that a @samp{moveq} will be used.
  1585.  
  1586. If @var{x} is a @code{const_double}, by returning @code{NO_REGS}
  1587. you can force @var{x} into a memory constant.  This is useful on
  1588. certain machines where immediate floating values cannot be loaded into
  1589. certain kinds of registers.
  1590.  
  1591. @findex PREFERRED_OUTPUT_RELOAD_CLASS
  1592. @item PREFERRED_OUTPUT_RELOAD_CLASS (@var{x}, @var{class})
  1593. Like @code{PREFERRED_RELOAD_CLASS}, but for output reloads instead of
  1594. input reloads.  If you don't define this macro, the default is to use
  1595. @var{class}, unchanged.
  1596.  
  1597. @findex LIMIT_RELOAD_CLASS
  1598. @item LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
  1599. A C expression that places additional restrictions on the register class
  1600. to use when it is necessary to be able to hold a value of mode
  1601. @var{mode} in a reload register for which class @var{class} would
  1602. ordinarily be used.
  1603.  
  1604. Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
  1605. there are certain modes that simply can't go in certain reload classes.
  1606.  
  1607. The value is a register class; perhaps @var{class}, or perhaps another,
  1608. smaller class.
  1609.  
  1610. Don't define this macro unless the target machine has limitations which
  1611. require the macro to do something nontrivial.
  1612.  
  1613. @findex SECONDARY_RELOAD_CLASS
  1614. @findex SECONDARY_INPUT_RELOAD_CLASS
  1615. @findex SECONDARY_OUTPUT_RELOAD_CLASS
  1616. @item SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
  1617. @itemx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
  1618. @itemx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
  1619. Many machines have some registers that cannot be copied directly to or
  1620. from memory or even from other types of registers.  An example is the
  1621. @samp{MQ} register, which on most machines, can only be copied to or
  1622. from general registers, but not memory.  Some machines allow copying all
  1623. registers to and from memory, but require a scratch register for stores
  1624. to some memory locations (e.g., those with symbolic address on the RT,
  1625. and those with certain symbolic address on the Sparc when compiling
  1626. PIC).  In some cases, both an intermediate and a scratch register are
  1627. required.
  1628.  
  1629. You should define these macros to indicate to the reload phase that it may
  1630. need to allocate at least one register for a reload in addition to the
  1631. register to contain the data.  Specifically, if copying @var{x} to a
  1632. register @var{class} in @var{mode} requires an intermediate register,
  1633. you should define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
  1634. largest register class all of whose registers can be used as
  1635. intermediate registers or scratch registers.
  1636.  
  1637. If copying a register @var{class} in @var{mode} to @var{x} requires an
  1638. intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
  1639. should be defined to return the largest register class required.  If the
  1640. requirements for input and output reloads are the same, the macro
  1641. @code{SECONDARY_RELOAD_CLASS} should be used instead of defining both
  1642. macros identically.
  1643.  
  1644. The values returned by these macros are often @code{GENERAL_REGS}.
  1645. Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
  1646. can be directly copied to or from a register of @var{class} in
  1647. @var{mode} without requiring a scratch register.  Do not define this
  1648. macro if it would always return @code{NO_REGS}.
  1649.  
  1650. If a scratch register is required (either with or without an
  1651. intermediate register), you should define patterns for
  1652. @samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
  1653. (@pxref{Standard Names}.  These patterns, which will normally be
  1654. implemented with a @code{define_expand}, should be similar to the
  1655. @samp{mov@var{m}} patterns, except that operand 2 is the scratch
  1656. register. 
  1657.  
  1658. Define constraints for the reload register and scratch register that
  1659. contain a single register class.  If the original reload register (whose
  1660. class is @var{class}) can meet the constraint given in the pattern, the
  1661. value returned by these macros is used for the class of the scratch
  1662. register.  Otherwise, two additional reload registers are required.
  1663. Their classes are obtained from the constraints in the insn pattern.
  1664.  
  1665. @var{x} might be a pseudo-register or a @code{subreg} of a
  1666. pseudo-register, which could either be in a hard register or in memory.
  1667. Use @code{true_regnum} to find out; it will return -1 if the pseudo is
  1668. in memory and the hard register number if it is in a register.
  1669.  
  1670. These macros should not be used in the case where a particular class of
  1671. registers can only be copied to memory and not to another class of
  1672. registers.  In that case, secondary reload registers are not needed and
  1673. would not be helpful.  Instead, a stack location must be used to perform
  1674. the copy and the @code{mov@var{m}} pattern should use memory as a
  1675. intermediate storage.  This case often occurs between floating-point and
  1676. general registers.
  1677.  
  1678. @findex SECONDARY_MEMORY_NEEDED
  1679. @item SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
  1680. Certain machines have the property that some registers cannot be copied
  1681. to some other registers without using memory.  Define this macro on
  1682. those machines to be a C expression that is non-zero if objects of mode
  1683. @var{m} in registers of @var{class1} can only be copied to registers of
  1684. class @var{class2} by storing a register of @var{class1} into memory
  1685. and loading that memory location into a register of @var{class2}.
  1686.  
  1687. Do not define this macro if its value would always be zero. 
  1688.  
  1689. @findex SECONDARY_MEMORY_NEEDED_RTX
  1690. @item SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
  1691. Normally, when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
  1692. will allocate a stack slot when a memory location for a register copy
  1693. is needed.  If this macro is defined, the compiler instead uses the
  1694. memory location defined by this macro.
  1695.  
  1696. @findex SMALL_REGISTER_CLASSES
  1697. @item SMALL_REGISTER_CLASSES
  1698. Normally the compiler will avoid choosing spill registers from registers
  1699. that have been explicitly mentioned in the rtl (these registers are
  1700. normally those used to pass parameters and return values).  However,
  1701. some machines have so few registers of certain classes that there would
  1702. not be enough registers to use as spill registers if this were done.
  1703.  
  1704. You should define @code{SMALL_REGISTER_CLASSES} on those machines.  When
  1705. it is defined, the compiler allows registers explicitly used in the rtl
  1706. to be used as spill registers but prevents the compiler from extending
  1707. the lifetime of these registers.
  1708.  
  1709. Defining this macro is always safe, but unnecessarily defining this macro
  1710. will reduce the amount of optimizations that can be performed in some
  1711. cases.  If this macro is not defined but needs to be, the compiler will
  1712. run out of reload registers and print a fatal error message.
  1713.  
  1714. For most machines, this macro should not be defined.
  1715.  
  1716. @findex CLASS_LIKELY_SPILLED_P
  1717. @item CLASS_LIKELY_SPILLED_P (@var{class})
  1718. A C expression whose value is nonzero if pseudos that have been assigned
  1719. to registers of class @var{class} would likely be spilled because
  1720. registers of @var{class} are needed for spill registers.
  1721.  
  1722. The default value of this macro returns 1 if @var{class} has exactly one
  1723. register and zero otherwise.  On most machines, this default should be
  1724. used.  Only define this macro to some other expression if pseudo
  1725. allocated by @file{local-alloc.c} end up in memory because their hard
  1726. registers were needed for spill regisers.  If this macro returns nonzero
  1727. for those classes, those pseudos will only be allocated by
  1728. @file{global.c}, which knows how to reallocate the pseudo to another
  1729. register.  If there would not be another register available for
  1730. reallocation, you should not change the definition of this macro since
  1731. the only effect of such a definition would be to slow down register
  1732. allocation.
  1733.  
  1734. @findex CLASS_MAX_NREGS
  1735. @item CLASS_MAX_NREGS (@var{class}, @var{mode})
  1736. A C expression for the maximum number of consecutive registers
  1737. of class @var{class} needed to hold a value of mode @var{mode}.
  1738.  
  1739. This is closely related to the macro @code{HARD_REGNO_NREGS}.
  1740. In fact, the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
  1741. should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno}, @var{mode})}
  1742. for all @var{regno} values in the class @var{class}.
  1743.  
  1744. This macro helps control the handling of multiple-word values
  1745. in the reload pass.
  1746. @end table
  1747.  
  1748. Three other special macros describe which operands fit which constraint
  1749. letters.
  1750.  
  1751. @table @code
  1752. @findex CONST_OK_FOR_LETTER_P
  1753. @item CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
  1754. A C expression that defines the machine-dependent operand constraint letters
  1755. that specify particular ranges of integer values.  If @var{c} is one
  1756. of those letters, the expression should check that @var{value}, an integer,
  1757. is in the appropriate range and return 1 if so, 0 otherwise.  If @var{c} is
  1758. not one of those letters, the value should be 0 regardless of @var{value}.
  1759.  
  1760. @findex CONST_DOUBLE_OK_FOR_LETTER_P
  1761. @item CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
  1762. A C expression that defines the machine-dependent operand constraint
  1763. letters that specify particular ranges of @code{const_double} values.
  1764.  
  1765. If @var{c} is one of those letters, the expression should check that
  1766. @var{value}, an RTX of code @code{const_double}, is in the appropriate
  1767. range and return 1 if so, 0 otherwise.  If @var{c} is not one of those
  1768. letters, the value should be 0 regardless of @var{value}.
  1769.  
  1770. @code{const_double} is used for all floating-point constants and for
  1771. @code{DImode} fixed-point constants.  A given letter can accept either
  1772. or both kinds of values.  It can use @code{GET_MODE} to distinguish
  1773. between these kinds.
  1774.  
  1775. @findex EXTRA_CONSTRAINT
  1776. @item EXTRA_CONSTRAINT (@var{value}, @var{c})
  1777. A C expression that defines the optional machine-dependent constraint
  1778. letters that can be used to segregate specific types of operands,
  1779. usually memory references, for the target machine.  Normally this macro
  1780. will not be defined.  If it is required for a particular target machine,
  1781. it should return 1 if @var{value} corresponds to the operand type
  1782. represented by the constraint letter @var{c}.  If @var{c} is not defined
  1783. as an extra constraint, the value returned should be 0 regardless of
  1784. @var{value}.
  1785.  
  1786. For example, on the ROMP, load instructions cannot have their output in r0 if
  1787. the memory reference contains a symbolic address.  Constraint letter
  1788. @samp{Q} is defined as representing a memory address that does
  1789. @emph{not} contain a symbolic address.  An alternative is specified with
  1790. a @samp{Q} constraint on the input and @samp{r} on the output.  The next
  1791. alternative specifies @samp{m} on the input and a register class that
  1792. does not include r0 on the output.
  1793. @end table
  1794.  
  1795. @node Stack and Calling
  1796. @section Stack Layout and Calling Conventions
  1797. @cindex calling conventions
  1798.  
  1799. @menu
  1800. * Frame Layout::
  1801. * Frame Registers::
  1802. * Elimination::            
  1803. * Stack Arguments::
  1804. * Register Arguments::
  1805. * Scalar Return::
  1806. * Aggregate Return::
  1807. * Caller Saves::
  1808. * Function Entry::
  1809. * Profiling::
  1810. @end menu
  1811.  
  1812. @node Frame Layout
  1813. @subsection Basic Stack Layout
  1814. @cindex stack frame layout
  1815. @cindex frame layout
  1816.  
  1817. @table @code
  1818. @findex STACK_GROWS_DOWNWARD
  1819. @item STACK_GROWS_DOWNWARD
  1820. Define this macro if pushing a word onto the stack moves the stack
  1821. pointer to a smaller address.
  1822.  
  1823. When we say, ``define this macro if @dots{},'' it means that the
  1824. compiler checks this macro only with @code{#ifdef} so the precise
  1825. definition used does not matter.
  1826.  
  1827. @findex FRAME_GROWS_DOWNWARD
  1828. @item FRAME_GROWS_DOWNWARD
  1829. Define this macro if the addresses of local variable slots are at negative
  1830. offsets from the frame pointer.
  1831.  
  1832. @findex ARGS_GROW_DOWNWARD
  1833. @item ARGS_GROW_DOWNWARD
  1834. Define this macro if successive arguments to a function occupy decreasing
  1835. addresses on the stack.
  1836.  
  1837. @findex STARTING_FRAME_OFFSET
  1838. @item STARTING_FRAME_OFFSET
  1839. Offset from the frame pointer to the first local variable slot to be allocated.
  1840.  
  1841. If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
  1842. subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
  1843. Otherwise, it is found by adding the length of the first slot to the
  1844. value @code{STARTING_FRAME_OFFSET}.
  1845. @c i'm not sure if the above is still correct.. had to change it to get
  1846. @c rid of an overfull.  --mew 2feb93
  1847.  
  1848. @findex STACK_POINTER_OFFSET
  1849. @item STACK_POINTER_OFFSET
  1850. Offset from the stack pointer register to the first location at which
  1851. outgoing arguments are placed.  If not specified, the default value of
  1852. zero is used.  This is the proper value for most machines.
  1853.  
  1854. If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
  1855. the first location at which outgoing arguments are placed.
  1856.  
  1857. @findex FIRST_PARM_OFFSET
  1858. @item FIRST_PARM_OFFSET (@var{fundecl})
  1859. Offset from the argument pointer register to the first argument's
  1860. address.  On some machines it may depend on the data type of the
  1861. function. 
  1862.  
  1863. If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
  1864. the first argument's address.
  1865.  
  1866. @findex STACK_DYNAMIC_OFFSET
  1867. @item STACK_DYNAMIC_OFFSET (@var{fundecl})
  1868. Offset from the stack pointer register to an item dynamically allocated
  1869. on the stack, e.g., by @code{alloca}.
  1870.  
  1871. The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
  1872. length of the outgoing arguments.  The default is correct for most
  1873. machines.  See @file{function.c} for details.
  1874.  
  1875. @findex DYNAMIC_CHAIN_ADDRESS
  1876. @item DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
  1877. A C expression whose value is RTL representing the address in a stack
  1878. frame where the pointer to the caller's frame is stored.  Assume that
  1879. @var{frameaddr} is an RTL expression for the address of the stack frame
  1880. itself.
  1881.  
  1882. If you don't define this macro, the default is to return the value
  1883. of @var{frameaddr}---that is, the stack frame address is also the
  1884. address of the stack word that points to the previous frame.
  1885.  
  1886. @findex SETUP_FRAME_ADDRESSES
  1887. @item SERTUP_FRAME_ADDRESSES ()
  1888. If defined, a C expression that produces the machine-specific code to
  1889. setup the stack so that arbitrary frames can be accessed.  For example,
  1890. on the Sparc, we must flush all of the register windows to the stack
  1891. before we can access arbitrary stack frames.
  1892. This macro will seldom need to be defined.
  1893.  
  1894. @findex RETURN_ADDR_RTX
  1895. @item RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
  1896. A C expression whose value is RTL representing the value of the return
  1897. address for the frame @var{count} steps up from the current frame.
  1898. @var{frameaddr} is the frame pointer of the @var{count} frame, or
  1899. the frame pointer of the @var{count} @minus{} 1 frame if
  1900. @code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
  1901.  
  1902. @findex RETURN_ADDR_IN_PREVIOUS_FRAME
  1903. @item RETURN_ADDR_IN_PREVIOUS_FRAME
  1904. Define this if the return address of a particular stack frame is accessed
  1905. from the frame pointer of the previous stack frame.
  1906. @end table
  1907.  
  1908. @node Frame Registers
  1909. @subsection Registers That Address the Stack Frame 
  1910.  
  1911. @table @code
  1912. @findex STACK_POINTER_REGNUM
  1913. @item STACK_POINTER_REGNUM
  1914. The register number of the stack pointer register, which must also be a
  1915. fixed register according to @code{FIXED_REGISTERS}.  On most machines,
  1916. the hardware determines which register this is.
  1917.  
  1918. @findex FRAME_POINTER_REGNUM
  1919. @item FRAME_POINTER_REGNUM
  1920. The register number of the frame pointer register, which is used to
  1921. access automatic variables in the stack frame.  On some machines, the
  1922. hardware determines which register this is.  On other machines, you can
  1923. choose any register you wish for this purpose.
  1924.  
  1925. @findex ARG_POINTER_REGNUM
  1926. @item ARG_POINTER_REGNUM
  1927. The register number of the arg pointer register, which is used to access
  1928. the function's argument list.  On some machines, this is the same as the
  1929. frame pointer register.  On some machines, the hardware determines which
  1930. register this is.  On other machines, you can choose any register you
  1931. wish for this purpose.  If this is not the same register as the frame
  1932. pointer register, then you must mark it as a fixed register according to
  1933. @code{FIXED_REGISTERS}, or arrange to be able to eliminate it
  1934. (@pxref{Elimination}).
  1935.  
  1936. @findex STATIC_CHAIN_REGNUM
  1937. @findex STATIC_CHAIN_INCOMING_REGNUM
  1938. @item STATIC_CHAIN_REGNUM
  1939. @itemx STATIC_CHAIN_INCOMING_REGNUM
  1940. Register numbers used for passing a function's static chain pointer.  If
  1941. register windows are used, the register number as seen by the called
  1942. function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register
  1943. number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}.  If
  1944. these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need
  1945. not be defined.@refill
  1946.  
  1947. The static chain register need not be a fixed register.
  1948.  
  1949. If the static chain is passed in memory, these macros should not be
  1950. defined; instead, the next two macros should be defined.
  1951.  
  1952. @findex STATIC_CHAIN
  1953. @findex STATIC_CHAIN_INCOMING
  1954. @item STATIC_CHAIN
  1955. @itemx STATIC_CHAIN_INCOMING
  1956. If the static chain is passed in memory, these macros provide rtx giving
  1957. @code{mem} expressions that denote where they are stored.
  1958. @code{STATIC_CHAIN} and @code{STATIC_CHAIN_INCOMING} give the locations
  1959. as seen by the calling and called functions, respectively.  Often the former
  1960. will be at an offset from the stack pointer and the latter at an offset from
  1961. the frame pointer.@refill
  1962.  
  1963. @findex stack_pointer_rtx
  1964. @findex frame_pointer_rtx
  1965. @findex arg_pointer_rtx
  1966. The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and
  1967. @code{arg_pointer_rtx} will have been initialized prior to the use of these
  1968. macros and should be used to refer to those items.
  1969.  
  1970. If the static chain is passed in a register, the two previous macros should
  1971. be defined instead.
  1972. @end table
  1973.  
  1974. @node Elimination
  1975. @subsection Eliminating Frame Pointer and Arg Pointer
  1976.  
  1977. @table @code
  1978. @findex FRAME_POINTER_REQUIRED
  1979. @item FRAME_POINTER_REQUIRED
  1980. A C expression which is nonzero if a function must have and use a frame
  1981. pointer.  This expression is evaluated  in the reload pass.  If its value is
  1982. nonzero the function will have a frame pointer.
  1983.  
  1984. The expression can in principle examine the current function and decide
  1985. according to the facts, but on most machines the constant 0 or the
  1986. constant 1 suffices.  Use 0 when the machine allows code to be generated
  1987. with no frame pointer, and doing so saves some time or space.  Use 1
  1988. when there is no possible advantage to avoiding a frame pointer.
  1989.  
  1990. In certain cases, the compiler does not know how to produce valid code
  1991. without a frame pointer.  The compiler recognizes those cases and
  1992. automatically gives the function a frame pointer regardless of what
  1993. @code{FRAME_POINTER_REQUIRED} says.  You don't need to worry about
  1994. them.@refill
  1995.  
  1996. In a function that does not require a frame pointer, the frame pointer
  1997. register can be allocated for ordinary usage, unless you mark it as a
  1998. fixed register.  See @code{FIXED_REGISTERS} for more information.
  1999.  
  2000. This macro is ignored and you do not need to define it if the function
  2001. @code{ELIMINABLE_REGS} is defined.
  2002.  
  2003. @findex INITIAL_FRAME_POINTER_OFFSET
  2004. @findex get_frame_size
  2005. @item INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
  2006. A C statement to store in the variable @var{depth-var} the difference
  2007. between the frame pointer and the stack pointer values immediately after
  2008. the function prologue.  The value would be computed from information
  2009. such as the result of @code{get_frame_size ()} and the tables of
  2010. registers @code{regs_ever_live} and @code{call_used_regs}.
  2011.  
  2012. If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
  2013. need not be defined.  Otherwise, it must be defined even if
  2014. @code{FRAME_POINTER_REQUIRED} is defined to always be true; in that
  2015. case, you may set @var{depth-var} to anything.
  2016.  
  2017. @findex ELIMINABLE_REGS
  2018. @item ELIMINABLE_REGS
  2019. If defined, this macro specifies a table of register pairs used to
  2020. eliminate unneeded registers that point into the stack frame.  If it is not
  2021. defined, the only elimination attempted by the compiler is to replace
  2022. references to the frame pointer with references to the stack pointer.
  2023.  
  2024. The definition of this macro is a list of structure initializations, each
  2025. of which specifies an original and replacement register.
  2026.  
  2027. On some machines, the position of the argument pointer is not known until
  2028. the compilation is completed.  In such a case, a separate hard register
  2029. must be used for the argument pointer.  This register can be eliminated by
  2030. replacing it with either the frame pointer or the argument pointer,
  2031. depending on whether or not the frame pointer has been eliminated.
  2032.  
  2033. In this case, you might specify:
  2034. @example
  2035. #define ELIMINABLE_REGS  \
  2036. @{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
  2037.  @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
  2038.  @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
  2039. @end example
  2040.  
  2041. Note that the elimination of the argument pointer with the stack pointer is
  2042. specified first since that is the preferred elimination.
  2043.  
  2044. @findex CAN_ELIMINATE
  2045. @item CAN_ELIMINATE (@var{from-reg}, @var{to-reg})
  2046. A C expression that returns non-zero if the compiler is allowed to try
  2047. to replace register number @var{from-reg} with register number
  2048. @var{to-reg}.  This macro need only be defined if @code{ELIMINABLE_REGS}
  2049. is defined, and will usually be the constant 1, since most of the cases
  2050. preventing register elimination are things that the compiler already
  2051. knows about.
  2052.  
  2053. @findex INITIAL_ELIMINATION_OFFSET
  2054. @item INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
  2055. This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}.  It
  2056. specifies the initial difference between the specified pair of
  2057. registers.  This macro must be defined if @code{ELIMINABLE_REGS} is
  2058. defined.
  2059.  
  2060. @findex LONGJMP_RESTORE_FROM_STACK
  2061. @item LONGJMP_RESTORE_FROM_STACK
  2062. Define this macro if the @code{longjmp} function restores registers from
  2063. the stack frames, rather than from those saved specifically by
  2064. @code{setjmp}.  Certain quantities must not be kept in registers across
  2065. a call to @code{setjmp} on such machines.
  2066. @end table
  2067.  
  2068. @node Stack Arguments
  2069. @subsection Passing Function Arguments on the Stack
  2070. @cindex arguments on stack
  2071. @cindex stack arguments
  2072.  
  2073. The macros in this section control how arguments are passed
  2074. on the stack.  See the following section for other macros that
  2075. control passing certain arguments in registers.
  2076.  
  2077. @table @code
  2078. @findex PROMOTE_PROTOTYPES
  2079. @item PROMOTE_PROTOTYPES
  2080. Define this macro if an argument declared as @code{char} or
  2081. @code{short} in a prototype should actually be passed as an
  2082. @code{int}.  In addition to avoiding errors in certain cases of
  2083. mismatch, it also makes for better code on certain machines.
  2084.  
  2085. @findex PUSH_ROUNDING
  2086. @item PUSH_ROUNDING (@var{npushed})
  2087. A C expression that is the number of bytes actually pushed onto the
  2088. stack when an instruction attempts to push @var{npushed} bytes.
  2089.  
  2090. If the target machine does not have a push instruction, do not define
  2091. this macro.  That directs GNU CC to use an alternate strategy: to
  2092. allocate the entire argument block and then store the arguments into
  2093. it.
  2094.  
  2095. On some machines, the definition
  2096.  
  2097. @example
  2098. #define PUSH_ROUNDING(BYTES) (BYTES)
  2099. @end example
  2100.  
  2101. @noindent
  2102. will suffice.  But on other machines, instructions that appear
  2103. to push one byte actually push two bytes in an attempt to maintain
  2104. alignment.  Then the definition should be
  2105.  
  2106. @example
  2107. #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  2108. @end example
  2109.  
  2110. @findex ACCUMULATE_OUTGOING_ARGS
  2111. @findex current_function_outgoing_args_size
  2112. @item ACCUMULATE_OUTGOING_ARGS
  2113. If defined, the maximum amount of space required for outgoing arguments
  2114. will be computed and placed into the variable
  2115. @code{current_function_outgoing_args_size}.  No space will be pushed
  2116. onto the stack for each call; instead, the function prologue should
  2117. increase the stack frame size by this amount.
  2118.  
  2119. Defining both @code{PUSH_ROUNDING} and @code{ACCUMULATE_OUTGOING_ARGS}
  2120. is not proper.
  2121.  
  2122. @findex REG_PARM_STACK_SPACE
  2123. @item REG_PARM_STACK_SPACE (@var{fndecl})
  2124. Define this macro if functions should assume that stack space has been
  2125. allocated for arguments even when their values are passed in
  2126. registers.
  2127.  
  2128. The value of this macro is the size, in bytes, of the area reserved for
  2129. arguments passed in registers for the function represented by @var{fndecl}.
  2130.  
  2131. This space can be allocated by the caller, or be a part of the
  2132. machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says
  2133. which.
  2134. @c above is overfull.  not sure what to do.  --mew 5feb93  did
  2135. @c something, not sure if it looks good.  --mew 10feb93
  2136.  
  2137. @findex MAYBE_REG_PARM_STACK_SPACE
  2138. @findex FINAL_REG_PARM_STACK_SPACE
  2139. @item MAYBE_REG_PARM_STACK_SPACE
  2140. @item FINAL_REG_PARM_STACK_SPACE (@var{const_size}, @var{var_size})
  2141. Define these macros in addition to the one above if functions might
  2142. allocate stack space for arguments even when their values are passed
  2143. in registers.  These should be used when the stack space allocated
  2144. for arguments in registers is not a simple constant independent of the
  2145. function declaration.
  2146.  
  2147. The value of the first macro is the size, in bytes, of the area that
  2148. we should initially assume would be reserved for arguments passed in registers.
  2149.  
  2150. The value of the second macro is the actual size, in bytes, of the area
  2151. that will be reserved for arguments passed in registers.  This takes two
  2152. arguments: an integer representing the number of bytes of fixed sized
  2153. arguments on the stack, and a tree representing the number of bytes of
  2154. variable sized arguments on the stack.
  2155.  
  2156. When these macros are defined, @code{REG_PARM_STACK_SPACE} will only be
  2157. called for libcall functions, the current function, or for a function
  2158. being called when it is known that such stack space must be allocated.
  2159. In each case this value can be easily computed.
  2160.  
  2161. When deciding whether a called function needs such stack space, and how
  2162. much space to reserve, GNU CC uses these two macros instead of
  2163. @code{REG_PARM_STACK_SPACE}.
  2164.  
  2165. @findex OUTGOING_REG_PARM_STACK_SPACE
  2166. @item OUTGOING_REG_PARM_STACK_SPACE
  2167. Define this if it is the responsibility of the caller to allocate the area
  2168. reserved for arguments passed in registers.
  2169.  
  2170. If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
  2171. whether the space for these arguments counts in the value of
  2172. @code{current_function_outgoing_args_size}.
  2173.  
  2174. @findex STACK_PARMS_IN_REG_PARM_AREA
  2175. @item STACK_PARMS_IN_REG_PARM_AREA
  2176. Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the
  2177. stack parameters don't skip the area specified by it.
  2178. @c i changed this, makes more sens and it should have taken care of the
  2179. @c overfull.. not as specific, tho.  --mew 5feb93
  2180.  
  2181. Normally, when a parameter is not passed in registers, it is placed on the
  2182. stack beyond the @code{REG_PARM_STACK_SPACE} area.  Defining this macro
  2183. suppresses this behavior and causes the parameter to be passed on the
  2184. stack in its natural location.
  2185.  
  2186. @findex RETURN_POPS_ARGS
  2187. @item RETURN_POPS_ARGS (@var{funtype}, @var{stack-size})
  2188. A C expression that should indicate the number of bytes of its own
  2189. arguments that a function pops on returning, or 0 if the
  2190. function pops no arguments and the caller must therefore pop them all
  2191. after the function returns.
  2192.  
  2193. @var{funtype} is a C variable whose value is a tree node that
  2194. describes the function in question.  Normally it is a node of type
  2195. @code{FUNCTION_TYPE} that describes the data type of the function.
  2196. From this it is possible to obtain the data types of the value and
  2197. arguments (if known).
  2198.  
  2199. When a call to a library function is being considered, @var{funtype}
  2200. will contain an identifier node for the library function.  Thus, if
  2201. you need to distinguish among various library functions, you can do so
  2202. by their names.  Note that ``library function'' in this context means
  2203. a function used to perform arithmetic, whose name is known specially
  2204. in the compiler and was not mentioned in the C code being compiled.
  2205.  
  2206. @var{stack-size} is the number of bytes of arguments passed on the
  2207. stack.  If a variable number of bytes is passed, it is zero, and
  2208. argument popping will always be the responsibility of the calling function.
  2209.  
  2210. On the Vax, all functions always pop their arguments, so the definition
  2211. of this macro is @var{stack-size}.  On the 68000, using the standard
  2212. calling convention, no functions pop their arguments, so the value of
  2213. the macro is always 0 in this case.  But an alternative calling
  2214. convention is available in which functions that take a fixed number of
  2215. arguments pop them but other functions (such as @code{printf}) pop
  2216. nothing (the caller pops all).  When this convention is in use,
  2217. @var{funtype} is examined to determine whether a function takes a fixed
  2218. number of arguments.
  2219. @end table
  2220.  
  2221. @node Register Arguments
  2222. @subsection Passing Arguments in Registers
  2223. @cindex arguments in registers
  2224. @cindex registers arguments
  2225.  
  2226. This section describes the macros which let you control how various
  2227. types of arguments are passed in registers or how they are arranged in
  2228. the stack.
  2229.  
  2230. @table @code
  2231. @findex FUNCTION_ARG
  2232. @item FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
  2233. A C expression that controls whether a function argument is passed
  2234. in a register, and which register.
  2235.  
  2236. The arguments are @var{cum}, which summarizes all the previous
  2237. arguments; @var{mode}, the machine mode of the argument; @var{type},
  2238. the data type of the argument as a tree node or 0 if that is not known
  2239. (which happens for C support library functions); and @var{named},
  2240. which is 1 for an ordinary argument and 0 for nameless arguments that
  2241. correspond to @samp{@dots{}} in the called function's prototype.
  2242.  
  2243. The value of the expression should either be a @code{reg} RTX for the
  2244. hard register in which to pass the argument, or zero to pass the
  2245. argument on the stack.
  2246.  
  2247. For machines like the Vax and 68000, where normally all arguments are
  2248. pushed, zero suffices as a definition.
  2249.  
  2250. @cindex @file{stdarg.h} and register arguments
  2251. The usual way to make the ANSI library @file{stdarg.h} work on a machine
  2252. where some arguments are usually passed in registers, is to cause
  2253. nameless arguments to be passed on the stack instead.  This is done
  2254. by making @code{FUNCTION_ARG} return 0 whenever @var{named} is 0.
  2255.  
  2256. @cindex @code{MUST_PASS_IN_STACK}, and @code{FUNCTION_ARG}
  2257. @cindex @code{REG_PARM_STACK_SPACE}, and @code{FUNCTION_ARG}
  2258. You may use the macro @code{MUST_PASS_IN_STACK (@var{mode}, @var{type})}
  2259. in the definition of this macro to determine if this argument is of a
  2260. type that must be passed in the stack.  If @code{REG_PARM_STACK_SPACE}
  2261. is not defined and @code{FUNCTION_ARG} returns non-zero for such an
  2262. argument, the compiler will abort.  If @code{REG_PARM_STACK_SPACE} is
  2263. defined, the argument will be computed in the stack and then loaded into
  2264. a register.
  2265.  
  2266. @findex FUNCTION_INCOMING_ARG
  2267. @item FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
  2268. Define this macro if the target machine has ``register windows'', so
  2269. that the register in which a function sees an arguments is not
  2270. necessarily the same as the one in which the caller passed the
  2271. argument.
  2272.  
  2273. For such machines, @code{FUNCTION_ARG} computes the register in which
  2274. the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
  2275. be defined in a similar fashion to tell the function being called
  2276. where the arguments will arrive.
  2277.  
  2278. If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
  2279. serves both purposes.@refill
  2280.  
  2281. @findex FUNCTION_ARG_PARTIAL_NREGS
  2282. @item FUNCTION_ARG_PARTIAL_NREGS (@var{cum}, @var{mode}, @var{type}, @var{named})
  2283. A C expression for the number of words, at the beginning of an
  2284. argument, must be put in registers.  The value must be zero for
  2285. arguments that are passed entirely in registers or that are entirely
  2286. pushed on the stack.
  2287.  
  2288. On some machines, certain arguments must be passed partially in
  2289. registers and partially in memory.  On these machines, typically the
  2290. first @var{n} words of arguments are passed in registers, and the rest
  2291. on the stack.  If a multi-word argument (a @code{double} or a
  2292. structure) crosses that boundary, its first few words must be passed
  2293. in registers and the rest must be pushed.  This macro tells the
  2294. compiler when this occurs, and how many of the words should go in
  2295. registers.
  2296.  
  2297. @code{FUNCTION_ARG} for these arguments should return the first
  2298. register to be used by the caller for this argument; likewise
  2299. @code{FUNCTION_INCOMING_ARG}, for the called function.
  2300.  
  2301. @findex FUNCTION_ARG_PASS_BY_REFERENCE
  2302. @item FUNCTION_ARG_PASS_BY_REFERENCE (@var{cum}, @var{mode}, @var{type}, @var{named})
  2303. A C expression that indicates when an argument must be passed by reference.
  2304. If nonzero for an argument, a copy of that argument is made in memory and a
  2305. pointer to the argument is passed instead of the argument itself.
  2306. The pointer is passed in whatever way is appropriate for passing a pointer
  2307. to that type.
  2308.  
  2309. On machines where @code{REG_PARM_STACK_SPACE} is not defined, a suitable
  2310. definition of this macro might be
  2311. @smallexample
  2312. #define FUNCTION_ARG_PASS_BY_REFERENCE\
  2313. (CUM, MODE, TYPE, NAMED)  \
  2314.   MUST_PASS_IN_STACK (MODE, TYPE)
  2315. @end smallexample
  2316. @c this is *still* too long.  --mew 5feb93 
  2317.  
  2318. @findex FUNCTION_ARG_CALLEE_COPIES
  2319. @item FUNCTION_ARG_CALLEE_COPIES (@var{cum}, @var{mode}, @var{type}, @var{named})
  2320. If defined, a C expression that indicates when it is the called function's
  2321. responsibility to make a copy of arguments passed by invisible reference.
  2322. Normally, the caller makes a copy and passes the address of the copy to the
  2323. routine being called.  When FUNCTION_ARG_CALLEE_COPIES is defined and is
  2324. nonzero, the caller does not make a copy.  Instead, it passes a pointer to the
  2325. ``live'' value.  The called function must not modify this value.  If it can be
  2326. determined that the value won't be modified, it need not make a copy;
  2327. otherwise a copy must be made.
  2328.  
  2329. @findex CUMULATIVE_ARGS
  2330. @item CUMULATIVE_ARGS
  2331. A C type for declaring a variable that is used as the first argument of
  2332. @code{FUNCTION_ARG} and other related values.  For some target machines,
  2333. the type @code{int} suffices and can hold the number of bytes of
  2334. argument so far.
  2335.  
  2336. There is no need to record in @code{CUMULATIVE_ARGS} anything about the
  2337. arguments that have been passed on the stack.  The compiler has other
  2338. variables to keep track of that.  For target machines on which all
  2339. arguments are passed on the stack, there is no need to store anything in
  2340. @code{CUMULATIVE_ARGS}; however, the data structure must exist and
  2341. should not be empty, so use @code{int}.
  2342.  
  2343. @findex INIT_CUMULATIVE_ARGS
  2344. @item INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname})
  2345. A C statement (sans semicolon) for initializing the variable @var{cum}
  2346. for the state at the beginning of the argument list.  The variable has
  2347. type @code{CUMULATIVE_ARGS}.  The value of @var{fntype} is the tree node
  2348. for the data type of the function which will receive the args, or 0
  2349. if the args are to a compiler support library function.
  2350.  
  2351. When processing a call to a compiler support library function,
  2352. @var{libname} identifies which one.  It is a @code{symbol_ref} rtx which
  2353. contains the name of the function, as a string.  @var{libname} is 0 when
  2354. an ordinary C function call is being processed.  Thus, each time this
  2355. macro is called, either @var{libname} or @var{fntype} is nonzero, but
  2356. never both of them at once.
  2357.  
  2358. @findex INIT_CUMULATIVE_INCOMING_ARGS
  2359. @item INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname})
  2360. Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of
  2361. finding the arguments for the function being compiled.  If this macro is
  2362. undefined, @code{INIT_CUMULATIVE_ARGS} is used instead.
  2363.  
  2364. The value passed for @var{libname} is always 0, since library routines
  2365. with special calling conventions are never compiled with GNU CC.  The
  2366. argument @var{libname} exists for symmetry with
  2367. @code{INIT_CUMULATIVE_ARGS}.
  2368. @c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
  2369. @c --mew 5feb93   i switched the order of the sentences.  --mew 10feb93
  2370.  
  2371. @findex FUNCTION_ARG_ADVANCE
  2372. @item FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
  2373. A C statement (sans semicolon) to update the summarizer variable
  2374. @var{cum} to advance past an argument in the argument list.  The
  2375. values @var{mode}, @var{type} and @var{named} describe that argument.
  2376. Once this is done, the variable @var{cum} is suitable for analyzing
  2377. the @emph{following} argument with @code{FUNCTION_ARG}, etc.@refill
  2378.  
  2379. This macro need not do anything if the argument in question was passed
  2380. on the stack.  The compiler knows how to track the amount of stack space
  2381. used for arguments without any special help.
  2382.  
  2383. @findex FUNCTION_ARG_PADDING
  2384. @item FUNCTION_ARG_PADDING (@var{mode}, @var{type})
  2385. If defined, a C expression which determines whether, and in which direction,
  2386. to pad out an argument with extra space.  The value should be of type
  2387. @code{enum direction}: either @code{upward} to pad above the argument,
  2388. @code{downward} to pad below, or @code{none} to inhibit padding.
  2389.  
  2390. The @emph{amount} of padding is always just enough to reach the next
  2391. multiple of @code{FUNCTION_ARG_BOUNDARY}; this macro does not control
  2392. it.
  2393.  
  2394. This macro has a default definition which is right for most systems.
  2395. For little-endian machines, the default is to pad upward.  For
  2396. big-endian machines, the default is to pad downward for an argument of
  2397. constant size shorter than an @code{int}, and upward otherwise.
  2398.  
  2399. @findex FUNCTION_ARG_BOUNDARY
  2400. @item FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})
  2401. If defined, a C expression that gives the alignment boundary, in bits,
  2402. of an argument with the specified mode and type.  If it is not defined, 
  2403. @code{PARM_BOUNDARY} is used for all arguments.
  2404.  
  2405. @findex FUNCTION_ARG_REGNO_P
  2406. @item FUNCTION_ARG_REGNO_P (@var{regno})
  2407. A C expression that is nonzero if @var{regno} is the number of a hard
  2408. register in which function arguments are sometimes passed.  This does
  2409. @emph{not} include implicit arguments such as the static chain and
  2410. the structure-value address.  On many machines, no registers can be
  2411. used for this purpose since all function arguments are pushed on the
  2412. stack.
  2413. @end table
  2414.  
  2415. @node Scalar Return
  2416. @subsection How Scalar Function Values Are Returned
  2417. @cindex return values in registers
  2418. @cindex values, returned by functions
  2419. @cindex scalars, returned as values
  2420.  
  2421. This section discusses the macros that control returning scalars as
  2422. values---values that can fit in registers.
  2423.  
  2424. @table @code
  2425. @findex TRADITIONAL_RETURN_FLOAT
  2426. @item TRADITIONAL_RETURN_FLOAT
  2427. Define this macro if @samp{-traditional} should not cause functions 
  2428. declared to return @code{float} to convert the value to @code{double}.
  2429.  
  2430. @findex FUNCTION_VALUE
  2431. @item FUNCTION_VALUE (@var{valtype}, @var{func})
  2432. A C expression to create an RTX representing the place where a
  2433. function returns a value of data type @var{valtype}.  @var{valtype} is
  2434. a tree node representing a data type.  Write @code{TYPE_MODE
  2435. (@var{valtype})} to get the machine mode used to represent that type.
  2436. On many machines, only the mode is relevant.  (Actually, on most
  2437. machines, scalar values are returned in the same place regardless of
  2438. mode).@refill
  2439.  
  2440. If @code{PROMOTE_FUNCTION_RETURN} is defined, you must apply the same
  2441. promotion rules specified in @code{PROMOTE_MODE} if @var{valtype} is a
  2442. scalar type.
  2443.  
  2444. If the precise function being called is known, @var{func} is a tree
  2445. node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
  2446. pointer.  This makes it possible to use a different value-returning
  2447. convention for specific functions when all their calls are
  2448. known.@refill
  2449.  
  2450. @code{FUNCTION_VALUE} is not used for return vales with aggregate data
  2451. types, because these are returned in another way.  See
  2452. @code{STRUCT_VALUE_REGNUM} and related macros, below.
  2453.  
  2454. @findex FUNCTION_OUTGOING_VALUE
  2455. @item FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
  2456. Define this macro if the target machine has ``register windows''
  2457. so that the register in which a function returns its value is not
  2458. the same as the one in which the caller sees the value.
  2459.  
  2460. For such machines, @code{FUNCTION_VALUE} computes the register in which
  2461. the caller will see the value.  @code{FUNCTION_OUTGOING_VALUE} should be
  2462. defined in a similar fashion to tell the function where to put the
  2463. value.@refill
  2464.  
  2465. If @code{FUNCTION_OUTGOING_VALUE} is not defined,
  2466. @code{FUNCTION_VALUE} serves both purposes.@refill
  2467.  
  2468. @code{FUNCTION_OUTGOING_VALUE} is not used for return vales with
  2469. aggregate data types, because these are returned in another way.  See
  2470. @code{STRUCT_VALUE_REGNUM} and related macros, below.
  2471.  
  2472. @findex LIBCALL_VALUE
  2473. @item LIBCALL_VALUE (@var{mode})
  2474. A C expression to create an RTX representing the place where a library
  2475. function returns a value of mode @var{mode}.  If the precise function
  2476. being called is known, @var{func} is a tree node
  2477. (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
  2478. pointer.  This makes it possible to use a different value-returning
  2479. convention for specific functions when all their calls are
  2480. known.@refill
  2481.  
  2482. Note that ``library function'' in this context means a compiler
  2483. support routine, used to perform arithmetic, whose name is known
  2484. specially by the compiler and was not mentioned in the C code being
  2485. compiled.
  2486.  
  2487. The definition of @code{LIBRARY_VALUE} need not be concerned aggregate
  2488. data types, because none of the library functions returns such types.
  2489.  
  2490. @findex FUNCTION_VALUE_REGNO_P
  2491. @item FUNCTION_VALUE_REGNO_P (@var{regno})
  2492. A C expression that is nonzero if @var{regno} is the number of a hard
  2493. register in which the values of called function may come back.
  2494.  
  2495. A register whose use for returning values is limited to serving as the
  2496. second of a pair (for a value of type @code{double}, say) need not be
  2497. recognized by this macro.  So for most machines, this definition
  2498. suffices:
  2499.  
  2500. @example
  2501. #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
  2502. @end example
  2503.  
  2504. If the machine has register windows, so that the caller and the called
  2505. function use different registers for the return value, this macro
  2506. should recognize only the caller's register numbers.
  2507.  
  2508. @findex APPLY_RESULT_SIZE
  2509. @item APPLY_RESULT_SIZE
  2510. Define this macro if @samp{untyped_call} and @samp{untyped_return}
  2511. need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for
  2512. saving and restoring an arbitrary return value.
  2513. @end table
  2514.  
  2515. @node Aggregate Return
  2516. @subsection How Large Values Are Returned
  2517. @cindex aggregates as return values
  2518. @cindex large return values
  2519. @cindex returning aggregate values
  2520. @cindex structure value address
  2521.  
  2522. When a function value's mode is @code{BLKmode} (and in some other
  2523. cases), the value is not returned according to @code{FUNCTION_VALUE}
  2524. (@pxref{Scalar Return}).  Instead, the caller passes the address of a
  2525. block of memory in which the value should be stored.  This address
  2526. is called the @dfn{structure value address}.
  2527.  
  2528. This section describes how to control returning structure values in
  2529. memory.
  2530.  
  2531. @table @code
  2532. @findex RETURN_IN_MEMORY
  2533. @item RETURN_IN_MEMORY (@var{type})
  2534. A C expression which can inhibit the returning of certain function
  2535. values in registers, based on the type of value.  A nonzero value says
  2536. to return the function value in memory, just as large structures are
  2537. always returned.  Here @var{type} will be a C expression of type
  2538. @code{tree}, representing the data type of the value.
  2539.  
  2540. Note that values of mode @code{BLKmode} must be explicitly handled
  2541. by this macro.  Also, the option @samp{-fpcc-struct-return}
  2542. takes effect regardless of this macro.  On most systems, it is
  2543. possible to leave the macro undefined; this causes a default
  2544. definition to be used, whose value is the constant 1 for @code{BLKmode}
  2545. values, and 0 otherwise.
  2546.  
  2547. Do not use this macro to indicate that structures and unions should always
  2548. be returned in memory.  You should instead use @code{DEFAULT_PCC_STRUCT_RETURN}
  2549. to indicate this.
  2550.  
  2551. @findex DEFAULT_PCC_STRUCT_RETURN
  2552. @item DEFAULT_PCC_STRUCT_RETURN
  2553. Define this macro to be 1 if all structure and union return values must be
  2554. in memory.  Since this results in slower code, this should be defined
  2555. only if needed for compatibility with other compilers or with an ABI.
  2556. If you define this macro to be 0, then the conventions used for structure
  2557. and union return values are decided by the @code{RETURN_IN_MEMORY} macro.
  2558.  
  2559. If not defined, this defaults to the value 1.
  2560.  
  2561. @findex STRUCT_VALUE_REGNUM
  2562. @item STRUCT_VALUE_REGNUM
  2563. If the structure value address is passed in a register, then
  2564. @code{STRUCT_VALUE_REGNUM} should be the number of that register.
  2565.  
  2566. @findex STRUCT_VALUE
  2567. @item STRUCT_VALUE
  2568. If the structure value address is not passed in a register, define
  2569. @code{STRUCT_VALUE} as an expression returning an RTX for the place
  2570. where the address is passed.  If it returns 0, the address is passed as
  2571. an ``invisible'' first argument.
  2572.  
  2573. @findex STRUCT_VALUE_INCOMING_REGNUM
  2574. @item STRUCT_VALUE_INCOMING_REGNUM
  2575. On some architectures the place where the structure value address
  2576. is found by the called function is not the same place that the
  2577. caller put it.  This can be due to register windows, or it could
  2578. be because the function prologue moves it to a different place.
  2579.  
  2580. If the incoming location of the structure value address is in a
  2581. register, define this macro as the register number.
  2582.  
  2583. @findex STRUCT_VALUE_INCOMING
  2584. @item STRUCT_VALUE_INCOMING
  2585. If the incoming location is not a register, then you should define
  2586. @code{STRUCT_VALUE_INCOMING} as an expression for an RTX for where the
  2587. called function should find the value.  If it should find the value on
  2588. the stack, define this to create a @code{mem} which refers to the frame
  2589. pointer.  A definition of 0 means that the address is passed as an
  2590. ``invisible'' first argument.
  2591.  
  2592. @findex PCC_STATIC_STRUCT_RETURN
  2593. @item PCC_STATIC_STRUCT_RETURN
  2594. Define this macro if the usual system convention on the target machine
  2595. for returning structures and unions is for the called function to return
  2596. the address of a static variable containing the value.  GNU CC does not
  2597. normally use this convention, even if it is the usual one, but does use
  2598. it if @samp{-fpcc-struct-return} is specified.
  2599.  
  2600. Do not define this if the usual system convention is for the caller to
  2601. pass an address to the subroutine.
  2602. @end table
  2603.  
  2604. @node Caller Saves
  2605. @subsection Caller-Saves Register Allocation
  2606.  
  2607. If you enable it, GNU CC can save registers around function calls.  This
  2608. makes it possible to use call-clobbered registers to hold variables that
  2609. must live across calls.
  2610.  
  2611. @table @code
  2612. @findex DEFAULT_CALLER_SAVES
  2613. @item DEFAULT_CALLER_SAVES
  2614. Define this macro if function calls on the target machine do not preserve
  2615. any registers; in other words, if @code{CALL_USED_REGISTERS} has 1
  2616. for all registers.  This macro enables @samp{-fcaller-saves} by default.
  2617. Eventually that option will be enabled by default on all machines and both
  2618. the option and this macro will be eliminated.
  2619.  
  2620. @findex CALLER_SAVE_PROFITABLE
  2621. @item CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls})
  2622. A C expression to determine whether it is worthwhile to consider placing
  2623. a pseudo-register in a call-clobbered hard register and saving and
  2624. restoring it around each function call.  The expression should be 1 when
  2625. this is worth doing, and 0 otherwise.
  2626.  
  2627. If you don't define this macro, a default is used which is good on most
  2628. machines: @code{4 * @var{calls} < @var{refs}}.
  2629. @end table
  2630.  
  2631. @node Function Entry
  2632. @subsection Function Entry and Exit
  2633. @cindex function entry and exit
  2634. @cindex prologue
  2635. @cindex epilogue
  2636.  
  2637. This section describes the macros that output function entry
  2638. (@dfn{prologue}) and exit (@dfn{epilogue}) code.
  2639.  
  2640. @table @code
  2641. @findex FUNCTION_PROLOGUE
  2642. @item FUNCTION_PROLOGUE (@var{file}, @var{size})
  2643. A C compound statement that outputs the assembler code for entry to a
  2644. function.  The prologue is responsible for setting up the stack frame,
  2645. initializing the frame pointer register, saving registers that must be
  2646. saved, and allocating @var{size} additional bytes of storage for the
  2647. local variables.  @var{size} is an integer.  @var{file} is a stdio
  2648. stream to which the assembler code should be output.
  2649.  
  2650. The label for the beginning of the function need not be output by this
  2651. macro.  That has already been done when the macro is run.
  2652.  
  2653. @findex regs_ever_live
  2654. To determine which registers to save, the macro can refer to the array
  2655. @code{regs_ever_live}: element @var{r} is nonzero if hard register
  2656. @var{r} is used anywhere within the function.  This implies the function
  2657. prologue should save register @var{r}, provided it is not one of the
  2658. call-used registers.  (@code{FUNCTION_EPILOGUE} must likewise use
  2659. @code{regs_ever_live}.)
  2660.  
  2661. On machines that have ``register windows'', the function entry code does
  2662. not save on the stack the registers that are in the windows, even if
  2663. they are supposed to be preserved by function calls; instead it takes
  2664. appropriate steps to ``push'' the register stack, if any non-call-used
  2665. registers are used in the function.
  2666.  
  2667. @findex frame_pointer_needed
  2668. On machines where functions may or may not have frame-pointers, the
  2669. function entry code must vary accordingly; it must set up the frame
  2670. pointer if one is wanted, and not otherwise.  To determine whether a
  2671. frame pointer is in wanted, the macro can refer to the variable
  2672. @code{frame_pointer_needed}.  The variable's value will be 1 at run
  2673. time in a function that needs a frame pointer.  @xref{Elimination}.
  2674.  
  2675. The function entry code is responsible for allocating any stack space
  2676. required for the function.  This stack space consists of the regions
  2677. listed below.  In most cases, these regions are allocated in the
  2678. order listed, with the last listed region closest to the top of the
  2679. stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and
  2680. the highest address if it is not defined).  You can use a different order
  2681. for a machine if doing so is more convenient or required for
  2682. compatibility reasons.  Except in cases where required by standard
  2683. or by a debugger, there is no reason why the stack layout used by GCC
  2684. need agree with that used by other compilers for a machine.
  2685.  
  2686. @itemize @bullet
  2687. @item
  2688. @findex current_function_pretend_args_size
  2689. A region of @code{current_function_pretend_args_size} bytes of
  2690. uninitialized space just underneath the first argument arriving on the
  2691. stack.  (This may not be at the very start of the allocated stack region
  2692. if the calling sequence has pushed anything else since pushing the stack
  2693. arguments.  But usually, on such machines, nothing else has been pushed
  2694. yet, because the function prologue itself does all the pushing.)  This
  2695. region is used on machines where an argument may be passed partly in
  2696. registers and partly in memory, and, in some cases to support the
  2697. features in @file{varargs.h} and @file{stdargs.h}.
  2698.  
  2699. @item
  2700. An area of memory used to save certain registers used by the function.
  2701. The size of this area, which may also include space for such things as
  2702. the return address and pointers to previous stack frames, is
  2703. machine-specific and usually depends on which registers have been used
  2704. in the function.  Machines with register windows often do not require
  2705. a save area.
  2706.  
  2707. @item
  2708. A region of at least @var{size} bytes, possibly rounded up to an allocation
  2709. boundary, to contain the local variables of the function.  On some machines,
  2710. this region and the save area may occur in the opposite order, with the
  2711. save area closer to the top of the stack.
  2712.  
  2713. @item
  2714. @cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
  2715. Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
  2716. @code{current_function_outgoing_args_size} bytes to be used for outgoing
  2717. argument lists of the function.  @xref{Stack Arguments}.
  2718. @end itemize
  2719.  
  2720. Normally, it is necessary for the macros @code{FUNCTION_PROLOGUE} and
  2721. @code{FUNCTION_EPILOGUE} to treat leaf functions specially.  The C
  2722. variable @code{leaf_function} is nonzero for such a function.
  2723.  
  2724. @findex EXIT_IGNORE_STACK
  2725. @item EXIT_IGNORE_STACK
  2726. Define this macro as a C expression that is nonzero if the return
  2727. instruction or the function epilogue ignores the value of the stack
  2728. pointer; in other words, if it is safe to delete an instruction to
  2729. adjust the stack pointer before a return from the function.
  2730.  
  2731. Note that this macro's value is relevant only for functions for which
  2732. frame pointers are maintained.  It is never safe to delete a final
  2733. stack adjustment in a function that has no frame pointer, and the
  2734. compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
  2735.  
  2736. @findex FUNCTION_EPILOGUE
  2737. @item FUNCTION_EPILOGUE (@var{file}, @var{size})
  2738. A C compound statement that outputs the assembler code for exit from a
  2739. function.  The epilogue is responsible for restoring the saved
  2740. registers and stack pointer to their values when the function was
  2741. called, and returning control to the caller.  This macro takes the
  2742. same arguments as the macro @code{FUNCTION_PROLOGUE}, and the
  2743. registers to restore are determined from @code{regs_ever_live} and
  2744. @code{CALL_USED_REGISTERS} in the same way.
  2745.  
  2746. On some machines, there is a single instruction that does all the work
  2747. of returning from the function.  On these machines, give that
  2748. instruction the name @samp{return} and do not define the macro
  2749. @code{FUNCTION_EPILOGUE} at all.
  2750.  
  2751. Do not define a pattern named @samp{return} if you want the
  2752. @code{FUNCTION_EPILOGUE} to be used.  If you want the target switches
  2753. to control whether return instructions or epilogues are used, define a
  2754. @samp{return} pattern with a validity condition that tests the target
  2755. switches appropriately.  If the @samp{return} pattern's validity
  2756. condition is false, epilogues will be used.
  2757.  
  2758. On machines where functions may or may not have frame-pointers, the
  2759. function exit code must vary accordingly.  Sometimes the code for these
  2760. two cases is completely different.  To determine whether a frame pointer
  2761. is wanted, the macro can refer to the variable
  2762. @code{frame_pointer_needed}.  The variable's value will be 1 at run time
  2763. in a function that needs a frame pointer.
  2764.  
  2765. Normally, @code{FUNCTION_PROLOGUE} and @code{FUNCTION_EPILOGUE} must
  2766. treat leaf functions specially.  The C variable @code{leaf_function} is
  2767. nonzero for such a function.  @xref{Leaf Functions}.
  2768.  
  2769. On some machines, some functions pop their arguments on exit while
  2770. others leave that for the caller to do.  For example, the 68020 when
  2771. given @samp{-mrtd} pops arguments in functions that take a fixed
  2772. number of arguments.
  2773.  
  2774. @findex current_function_pops_args
  2775. Your definition of the macro @code{RETURN_POPS_ARGS} decides which
  2776. functions pop their own arguments.  @code{FUNCTION_EPILOGUE} needs to
  2777. know what was decided.  The variable that is called
  2778. @code{current_function_pops_args} is the number of bytes of its
  2779. arguments that a function should pop.  @xref{Scalar Return}.
  2780. @c what is the "its arguments" in the above sentence referring to, pray
  2781. @c tell?  --mew 5feb93
  2782.  
  2783. @findex DELAY_SLOTS_FOR_EPILOGUE
  2784. @item DELAY_SLOTS_FOR_EPILOGUE
  2785. Define this macro if the function epilogue contains delay slots to which
  2786. instructions from the rest of the function can be ``moved''.  The
  2787. definition should be a C expression whose value is an integer
  2788. representing the number of delay slots there.
  2789.  
  2790. @findex ELIGIBLE_FOR_EPILOGUE_DELAY
  2791. @item ELIGIBLE_FOR_EPILOGUE_DELAY (@var{insn}, @var{n})
  2792. A C expression that returns 1 if @var{insn} can be placed in delay
  2793. slot number @var{n} of the epilogue.
  2794.  
  2795. The argument @var{n} is an integer which identifies the delay slot now
  2796. being considered (since different slots may have different rules of
  2797. eligibility).  It is never negative and is always less than the number
  2798. of epilogue delay slots (what @code{DELAY_SLOTS_FOR_EPILOGUE} returns).
  2799. If you reject a particular insn for a given delay slot, in principle, it
  2800. may be reconsidered for a subsequent delay slot.  Also, other insns may
  2801. (at least in principle) be considered for the so far unfilled delay
  2802. slot.
  2803.  
  2804. @findex current_function_epilogue_delay_list
  2805. @findex final_scan_insn
  2806. The insns accepted to fill the epilogue delay slots are put in an RTL
  2807. list made with @code{insn_list} objects, stored in the variable
  2808. @code{current_function_epilogue_delay_list}.  The insn for the first
  2809. delay slot comes first in the list.  Your definition of the macro
  2810. @code{FUNCTION_EPILOGUE} should fill the delay slots by outputting the
  2811. insns in this list, usually by calling @code{final_scan_insn}.
  2812.  
  2813. You need not define this macro if you did not define
  2814. @code{DELAY_SLOTS_FOR_EPILOGUE}.
  2815. @end table
  2816.  
  2817. @node Profiling
  2818. @subsection Generating Code for Profiling
  2819. @cindex profiling, code generation
  2820.  
  2821. These macros will help you generate code for profiling.
  2822.  
  2823. @table @code
  2824. @findex FUNCTION_PROFILER 
  2825. @item FUNCTION_PROFILER (@var{file}, @var{labelno})
  2826. A C statement or compound statement to output to @var{file} some
  2827. assembler code to call the profiling subroutine @code{mcount}.
  2828. Before calling, the assembler code must load the address of a
  2829. counter variable into a register where @code{mcount} expects to
  2830. find the address.  The name of this variable is @samp{LP} followed
  2831. by the number @var{labelno}, so you would generate the name using
  2832. @samp{LP%d} in a @code{fprintf}.
  2833.  
  2834. @findex mcount
  2835. The details of how the address should be passed to @code{mcount} are
  2836. determined by your operating system environment, not by GNU CC.  To
  2837. figure them out, compile a small program for profiling using the
  2838. system's installed C compiler and look at the assembler code that
  2839. results.
  2840.  
  2841. @findex PROFILE_BEFORE_PROLOGUE
  2842. @item PROFILE_BEFORE_PROLOGUE
  2843. Define this macro if the code for function profiling should come before
  2844. the function prologue.  Normally, the profiling code comes after.
  2845.  
  2846. @findex FUNCTION_BLOCK_PROFILER
  2847. @findex __bb_init_func
  2848. @item FUNCTION_BLOCK_PROFILER (@var{file}, @var{labelno})
  2849. A C statement or compound statement to output to @var{file} some
  2850. assembler code to initialize basic-block profiling for the current
  2851. object module.  This code should call the subroutine
  2852. @code{__bb_init_func} once per object module, passing it as its sole
  2853. argument the address of a block allocated in the object module.
  2854.  
  2855. The name of the block is a local symbol made with this statement:
  2856.  
  2857. @example
  2858. ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
  2859. @end example
  2860.  
  2861. Of course, since you are writing the definition of
  2862. @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
  2863. can take a short cut in the definition of this macro and use the name
  2864. that you know will result.
  2865. @c do a search for "of course...".  this paragraph is repeated just two
  2866. @c paragraphs below.  something is *wrong*.  --mew 5feb93
  2867.  
  2868. The first word of this block is a flag which will be nonzero if the
  2869. object module has already been initialized.  So test this word first,
  2870. and do not call @code{__bb_init_func} if the flag is nonzero.
  2871.  
  2872. @findex BLOCK_PROFILER
  2873. @item BLOCK_PROFILER (@var{file}, @var{blockno})
  2874. A C statement or compound statement to increment the count associated
  2875. with the basic block number @var{blockno}.  Basic blocks are numbered
  2876. separately from zero within each compilation.  The count associated
  2877. with block number @var{blockno} is at index @var{blockno} in a vector
  2878. of words; the name of this array is a local symbol made with this
  2879. statement:
  2880.  
  2881. @example
  2882. ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 2);
  2883. @end example
  2884.  
  2885. Of course, since you are writing the definition of
  2886. @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
  2887. can take a short cut in the definition of this macro and use the name
  2888. that you know will result.
  2889. @c do a reverse search for "of course...".  this paragraph is repeated
  2890. @c just two paragraphs above.  something is *wrong*.  --mew 5feb93
  2891. @end table
  2892.  
  2893. @node Varargs
  2894. @section Implementing the Varargs Macros
  2895. @cindex varargs implementation
  2896.  
  2897. GNU CC comes with an implementation of @file{varargs.h} and
  2898. @file{stdarg.h} that work without change on machines that pass arguments
  2899. on the stack.  Other machines require their own implementations of
  2900. varargs, and the two machine independent header files must have
  2901. conditionals to include it.
  2902.  
  2903. ANSI @file{stdarg.h} differs from traditional @file{varargs.h} mainly in
  2904. the calling convention for @code{va_start}.  The traditional
  2905. implementation takes just one argument, which is the variable in which
  2906. to store the argument pointer.  The ANSI implementation of
  2907. @code{va_start} takes an additional second argument.  The user is
  2908. supposed to write the last named argument of the function here.
  2909.  
  2910. However, @code{va_start} should not use this argument.  The way to find
  2911. the end of the named arguments is with the built-in functions described
  2912. below.
  2913.  
  2914. @table @code
  2915. @findex __builtin_saveregs
  2916. @item __builtin_saveregs ()
  2917. Use this built-in function to save the argument registers in memory so
  2918. that the varargs mechanism can access them.  Both ANSI and traditional
  2919. versions of @code{va_start} must use @code{__builtin_saveregs}, unless
  2920. you use @code{SETUP_INCOMING_VARARGS} (see below) instead.
  2921.  
  2922. On some machines, @code{__builtin_saveregs} is open-coded under the
  2923. control of the macro @code{EXPAND_BUILTIN_SAVEREGS}.  On other machines,
  2924. it calls a routine written in assembler language, found in
  2925. @file{libgcc2.c}.
  2926.  
  2927. Code generated for the call to @code{__builtin_saveregs} appears at the
  2928. beginning of the function, as opposed to where the call to
  2929. @code{__builtin_saveregs} is written, regardless of what the code is.
  2930. This is because the registers must be saved before the function starts
  2931. to use them for its own purposes.
  2932. @c i rewrote the first sentence above to fix an overfull hbox. --mew
  2933. @c 10feb93 
  2934.  
  2935. @findex __builtin_args_info
  2936. @item __builtin_args_info (@var{category})
  2937. Use this built-in function to find the first anonymous arguments in
  2938. registers.
  2939.  
  2940. In general, a machine may have several categories of registers used for
  2941. arguments, each for a particular category of data types.  (For example,
  2942. on some machines, floating-point registers are used for floating-point
  2943. arguments while other arguments are passed in the general registers.)
  2944. To make non-varargs functions use the proper calling convention, you
  2945. have defined the @code{CUMULATIVE_ARGS} data type to record how many
  2946. registers in each category have been used so far
  2947.  
  2948. @code{__builtin_args_info} accesses the same data structure of type
  2949. @code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
  2950. with it, with @var{category} specifying which word to access.  Thus, the
  2951. value indicates the first unused register in a given category.
  2952.  
  2953. Normally, you would use @code{__builtin_args_info} in the implementation
  2954. of @code{va_start}, accessing each category just once and storing the
  2955. value in the @code{va_list} object.  This is because @code{va_list} will
  2956. have to update the values, and there is no way to alter the
  2957. values accessed by @code{__builtin_args_info}.
  2958.  
  2959. @findex __builtin_next_arg
  2960. @item __builtin_next_arg ()
  2961. This is the equivalent of @code{__builtin_args_info}, for stack
  2962. arguments.  It returns the address of the first anonymous stack
  2963. argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it
  2964. returns the address of the location above the first anonymous stack
  2965. argument. Use it in @code{va_start} to initialize the pointer for
  2966. fetching arguments from the stack. 
  2967.  
  2968. @findex __builtin_classify_type
  2969. @item __builtin_classify_type (@var{object})
  2970. Since each machine has its own conventions for which data types are
  2971. passed in which kind of register, your implementation of @code{va_arg}
  2972. has to embody these conventions.  The easiest way to categorize the
  2973. specified data type is to use @code{__builtin_classify_type} together
  2974. with @code{sizeof} and @code{__alignof__}.
  2975.  
  2976. @code{__builtin_classify_type} ignores the value of @var{object},
  2977. considering only its data type.  It returns an integer describing what
  2978. kind of type that is---integer, floating, pointer, structure, and so on.
  2979.  
  2980. The file @file{typeclass.h} defines an enumeration that you can use to
  2981. interpret the values of @code{__builtin_classify_type}.
  2982. @end table
  2983.  
  2984. These machine description macros help implement varargs: 
  2985.  
  2986. @table @code
  2987. @findex EXPAND_BUILTIN_SAVEREGS
  2988. @item EXPAND_BUILTIN_SAVEREGS (@var{args})
  2989. If defined, is a C expression that produces the machine-specific code
  2990. for a call to @code{__builtin_saveregs}.  This code will be moved to the
  2991. very beginning of the function, before any parameter access are made.
  2992. The return value of this function should be an RTX that contains the
  2993. value to use as the return of @code{__builtin_saveregs}.
  2994.  
  2995. The argument @var{args} is a @code{tree_list} containing the arguments
  2996. that were passed to @code{__builtin_saveregs}.
  2997.  
  2998. If this macro is not defined, the compiler will output an ordinary
  2999. call to the library function @samp{__builtin_saveregs}.
  3000.  
  3001. @c !!! a bug in texinfo; how to make the entry on the @item line allow
  3002. @c more than one line of text... help...  --mew 10feb93
  3003. @findex SETUP_INCOMING_VARARGS
  3004. @item SETUP_INCOMING_VARARGS (@var{args_so_far}, @var{mode}, @var{type},
  3005. @var{pretend_args_size}, @var{second_time})  
  3006. This macro offers an alternative to using @code{__builtin_saveregs} and
  3007. defining the macro @code{EXPAND_BUILTIN_SAVEREGS}.  Use it to store the
  3008. anonymous register arguments into the stack so that all the arguments
  3009. appear to have been passed consecutively on the stack.  Once this is
  3010. done, you can use the standard implementation of varargs that works for
  3011. machines that pass all their arguments on the stack.
  3012.  
  3013. The argument @var{args_so_far} is the @code{CUMULATIVE_ARGS} data
  3014. structure, containing the values that obtain after processing of the
  3015. named arguments.  The arguments @var{mode} and @var{type} describe the
  3016. last named argument---its machine mode and its data type as a tree node.
  3017.  
  3018. The macro implementation should do two things: first, push onto the
  3019. stack all the argument registers @emph{not} used for the named
  3020. arguments, and second, store the size of the data thus pushed into the
  3021. @code{int}-valued variable whose name is supplied as the argument
  3022. @var{pretend_args_size}.  The value that you store here will serve as
  3023. additional offset for setting up the stack frame.
  3024.  
  3025. Because you must generate code to push the anonymous arguments at
  3026. compile time without knowing their data types,
  3027. @code{SETUP_INCOMING_VARARGS} is only useful on machines that have just
  3028. a single category of argument register and use it uniformly for all data
  3029. types.
  3030.  
  3031. If the argument @var{second_time} is nonzero, it means that the
  3032. arguments of the function are being analyzed for the second time.  This
  3033. happens for an inline function, which is not actually compiled until the
  3034. end of the source file.  The macro @code{SETUP_INCOMING_VARARGS} should
  3035. not generate any instructions in this case.
  3036. @end table
  3037.  
  3038. @node Trampolines
  3039. @section Trampolines for Nested Functions
  3040. @cindex trampolines for nested functions
  3041. @cindex nested functions, trampolines for
  3042.  
  3043. A @dfn{trampoline} is a small piece of code that is created at run time
  3044. when the address of a nested function is taken.  It normally resides on
  3045. the stack, in the stack frame of the containing function.  These macros
  3046. tell GNU CC how to generate code to allocate and initialize a
  3047. trampoline.
  3048.  
  3049. The instructions in the trampoline must do two things: load a constant
  3050. address into the static chain register, and jump to the real address of
  3051. the nested function.  On CISC machines such as the m68k, this requires
  3052. two instructions, a move immediate and a jump.  Then the two addresses
  3053. exist in the trampoline as word-long immediate operands.  On RISC
  3054. machines, it is often necessary to load each address into a register in
  3055. two parts.  Then pieces of each address form separate immediate
  3056. operands.
  3057.  
  3058. The code generated to initialize the trampoline must store the variable
  3059. parts---the static chain value and the function address---into the
  3060. immediate operands of the instructions.  On a CISC machine, this is
  3061. simply a matter of copying each address to a memory reference at the
  3062. proper offset from the start of the trampoline.  On a RISC machine, it
  3063. may be necessary to take out pieces of the address and store them
  3064. separately.
  3065.  
  3066. @table @code
  3067. @findex TRAMPOLINE_TEMPLATE
  3068. @item TRAMPOLINE_TEMPLATE (@var{file})
  3069. A C statement to output, on the stream @var{file}, assembler code for a
  3070. block of data that contains the constant parts of a trampoline.  This
  3071. code should not include a label---the label is taken care of
  3072. automatically.
  3073.  
  3074. @findex TRAMPOLINE_SECTION
  3075. @item TRAMPOLINE_SECTION
  3076. The name of a subroutine to switch to the section in which the
  3077. trampoline template is to be placed (@pxref{Sections}).  The default is
  3078. a value of @samp{readonly_data_section}, which places the trampoline in
  3079. the section containing read-only data. 
  3080.  
  3081. @findex TRAMPOLINE_SIZE
  3082. @item TRAMPOLINE_SIZE
  3083. A C expression for the size in bytes of the trampoline, as an integer.
  3084.  
  3085. @findex TRAMPOLINE_ALIGNMENT
  3086. @item TRAMPOLINE_ALIGNMENT
  3087. Alignment required for trampolines, in bits.
  3088.  
  3089. If you don't define this macro, the value of @code{BIGGEST_ALIGNMENT}
  3090. is used for aligning trampolines.
  3091.  
  3092. @findex INITIALIZE_TRAMPOLINE
  3093. @item INITIALIZE_TRAMPOLINE (@var{addr}, @var{fnaddr}, @var{static_chain})
  3094. A C statement to initialize the variable parts of a trampoline.
  3095. @var{addr} is an RTX for the address of the trampoline; @var{fnaddr} is
  3096. an RTX for the address of the nested function; @var{static_chain} is an
  3097. RTX for the static chain value that should be passed to the function
  3098. when it is called.
  3099.  
  3100. @findex ALLOCATE_TRAMPOLINE
  3101. @item ALLOCATE_TRAMPOLINE (@var{fp})
  3102. A C expression to allocate run-time space for a trampoline.  The
  3103. expression value should be an RTX representing a memory reference to the
  3104. space for the trampoline.
  3105.  
  3106. @cindex @code{FUNCTION_EPILOGUE} and trampolines
  3107. @cindex @code{FUNCTION_PROLOGUE} and trampolines
  3108. If this macro is not defined, by default the trampoline is allocated as
  3109. a stack slot.  This default is right for most machines.  The exceptions
  3110. are machines where it is impossible to execute instructions in the stack
  3111. area.  On such machines, you may have to implement a separate stack,
  3112. using this macro in conjunction with @code{FUNCTION_PROLOGUE} and
  3113. @code{FUNCTION_EPILOGUE}.
  3114.  
  3115. @var{fp} points to a data structure, a @code{struct function}, which
  3116. describes the compilation status of the immediate containing function of
  3117. the function which the trampoline is for.  Normally (when
  3118. @code{ALLOCATE_TRAMPOLINE} is not defined), the stack slot for the
  3119. trampoline is in the stack frame of this containing function.  Other
  3120. allocation strategies probably must do something analogous with this
  3121. information.
  3122. @end table
  3123.  
  3124. Implementing trampolines is difficult on many machines because they have
  3125. separate instruction and data caches.  Writing into a stack location
  3126. fails to clear the memory in the instruction cache, so when the program
  3127. jumps to that location, it executes the old contents.
  3128.  
  3129. Here are two possible solutions.  One is to clear the relevant parts of
  3130. the instruction cache whenever a trampoline is set up.  The other is to
  3131. make all trampolines identical, by having them jump to a standard
  3132. subroutine.  The former technique makes trampoline execution faster; the
  3133. latter makes initialization faster.
  3134.  
  3135. To clear the instruction cache when a trampoline is initialized, define
  3136. the following macros which describe the shape of the cache.
  3137.  
  3138. @table @code
  3139. @findex INSN_CACHE_SIZE
  3140. @item INSN_CACHE_SIZE
  3141. The total size in bytes of the cache.
  3142.  
  3143. @findex INSN_CACHE_LINE_WIDTH
  3144. @item INSN_CACHE_LINE_WIDTH
  3145. The length in bytes of each cache line.  The cache is divided into cache
  3146. lines which are disjoint slots, each holding a contiguous chunk of data
  3147. fetched from memory.  Each time data is brought into the cache, an
  3148. entire line is read at once.  The data loaded into a cache line is 
  3149. always aligned on a boundary equal to the line size.
  3150.  
  3151. @findex INSN_CACHE_DEPTH
  3152. @item INSN_CACHE_DEPTH
  3153. The number of alternative cache lines that can hold any particular memory
  3154. location.
  3155. @end table
  3156.  
  3157. To use a standard subroutine, define the following macro.  In addition,
  3158. you must make sure that the instructions in a trampoline fill an entire
  3159. cache line with identical instructions, or else ensure that the
  3160. beginning of the trampoline code is always aligned at the same point in
  3161. its cache line.  Look in @file{m68k.h} as a guide.
  3162.  
  3163. @table @code
  3164. @findex TRANSFER_FROM_TRAMPOLINE
  3165. @item TRANSFER_FROM_TRAMPOLINE
  3166. Define this macro if trampolines need a special subroutine to do their
  3167. work.  The macro should expand to a series of @code{asm} statements
  3168. which will be compiled with GNU CC.  They go in a library function named
  3169. @code{__transfer_from_trampoline}.
  3170.  
  3171. If you need to avoid executing the ordinary prologue code of a compiled
  3172. C function when you jump to the subroutine, you can do so by placing a
  3173. special label of your own in the assembler code.  Use one @code{asm}
  3174. statement to generate an assembler label, and another to make the label
  3175. global.  Then trampolines can use that label to jump directly to your
  3176. special assembler code.
  3177. @end table
  3178.  
  3179. @node Library Calls
  3180. @section Implicit Calls to Library Routines
  3181. @cindex library subroutine names
  3182. @cindex @file{libgcc.a}
  3183.  
  3184. @table @code
  3185. @findex MULSI3_LIBCALL
  3186. @item MULSI3_LIBCALL
  3187. A C string constant giving the name of the function to call for
  3188. multiplication of one signed full-word by another.  If you do not
  3189. define this macro, the default name is used, which is @code{__mulsi3},
  3190. a function defined in @file{libgcc.a}.
  3191.  
  3192. @findex DIVSI3_LIBCALL
  3193. @item DIVSI3_LIBCALL
  3194. A C string constant giving the name of the function to call for
  3195. division of one signed full-word by another.  If you do not define
  3196. this macro, the default name is used, which is @code{__divsi3}, a
  3197. function defined in @file{libgcc.a}.
  3198.  
  3199. @findex UDIVSI3_LIBCALL
  3200. @item UDIVSI3_LIBCALL
  3201. A C string constant giving the name of the function to call for
  3202. division of one unsigned full-word by another.  If you do not define
  3203. this macro, the default name is used, which is @code{__udivsi3}, a
  3204. function defined in @file{libgcc.a}.
  3205.  
  3206. @findex MODSI3_LIBCALL
  3207. @item MODSI3_LIBCALL
  3208. A C string constant giving the name of the function to call for the
  3209. remainder in division of one signed full-word by another.  If you do
  3210. not define this macro, the default name is used, which is
  3211. @code{__modsi3}, a function defined in @file{libgcc.a}.
  3212.  
  3213. @findex UMODSI3_LIBCALL
  3214. @item UMODSI3_LIBCALL
  3215. A C string constant giving the name of the function to call for the
  3216. remainder in division of one unsigned full-word by another.  If you do
  3217. not define this macro, the default name is used, which is
  3218. @code{__umodsi3}, a function defined in @file{libgcc.a}.
  3219.  
  3220. @findex MULDI3_LIBCALL
  3221. @item MULDI3_LIBCALL
  3222. A C string constant giving the name of the function to call for
  3223. multiplication of one signed double-word by another.  If you do not
  3224. define this macro, the default name is used, which is @code{__muldi3},
  3225. a function defined in @file{libgcc.a}.
  3226.  
  3227. @findex DIVDI3_LIBCALL
  3228. @item DIVDI3_LIBCALL
  3229. A C string constant giving the name of the function to call for
  3230. division of one signed double-word by another.  If you do not define
  3231. this macro, the default name is used, which is @code{__divdi3}, a
  3232. function defined in @file{libgcc.a}.
  3233.  
  3234. @findex UDIVDI3_LIBCALL
  3235. @item UDIVDI3_LIBCALL
  3236. A C string constant giving the name of the function to call for
  3237. division of one unsigned full-word by another.  If you do not define
  3238. this macro, the default name is used, which is @code{__udivdi3}, a
  3239. function defined in @file{libgcc.a}.
  3240.  
  3241. @findex MODDI3_LIBCALL
  3242. @item MODDI3_LIBCALL
  3243. A C string constant giving the name of the function to call for the
  3244. remainder in division of one signed double-word by another.  If you do
  3245. not define this macro, the default name is used, which is
  3246. @code{__moddi3}, a function defined in @file{libgcc.a}.
  3247.  
  3248. @findex UMODDI3_LIBCALL
  3249. @item UMODDI3_LIBCALL
  3250. A C string constant giving the name of the function to call for the
  3251. remainder in division of one unsigned full-word by another.  If you do
  3252. not define this macro, the default name is used, which is
  3253. @code{__umoddi3}, a function defined in @file{libgcc.a}.
  3254.  
  3255. @findex TARGET_EDOM
  3256. @cindex @code{EDOM}, implicit usage
  3257. @item TARGET_EDOM
  3258. The value of @code{EDOM} on the target machine, as a C integer constant
  3259. expression.  If you don't define this macro, GNU CC does not attempt to
  3260. deposit the value of @code{EDOM} into @code{errno} directly.  Look in
  3261. @file{/usr/include/errno.h} to find the value of @code{EDOM} on your
  3262. system.
  3263.  
  3264. If you do not define @code{TARGET_EDOM}, then compiled code reports
  3265. domain errors by calling the library function and letting it report the
  3266. error.  If mathematical functions on your system use @code{matherr} when
  3267. there is an error, then you should leave @code{TARGET_EDOM} undefined so
  3268. that @code{matherr} is used normally.
  3269.  
  3270. @findex GEN_ERRNO_RTX
  3271. @cindex @code{errno}, implicit usage
  3272. @item GEN_ERRNO_RTX
  3273. Define this macro as a C expression to create an rtl expression that
  3274. refers to the global ``variable'' @code{errno}.  (On certain systems,
  3275. @code{errno} may not actually be a variable.)  If you don't define this
  3276. macro, a reasonable default is used.
  3277.  
  3278. @findex TARGET_MEM_FUNCTIONS
  3279. @cindex @code{bcopy}, implicit usage
  3280. @cindex @code{memcpy}, implicit usage
  3281. @cindex @code{bzero}, implicit usage
  3282. @cindex @code{memset}, implicit usage
  3283. @item TARGET_MEM_FUNCTIONS
  3284. Define this macro if GNU CC should generate calls to the System V
  3285. (and ANSI C) library functions @code{memcpy} and @code{memset}
  3286. rather than the BSD functions @code{bcopy} and @code{bzero}.
  3287.  
  3288. @findex LIBGCC_NEEDS_DOUBLE
  3289. @item LIBGCC_NEEDS_DOUBLE
  3290. Define this macro if only @code{float} arguments cannot be passed to
  3291. library routines (so they must be converted to @code{double}).  This
  3292. macro affects both how library calls are generated and how the library
  3293. routines in @file{libgcc1.c} accept their arguments.  It is useful on
  3294. machines where floating and fixed point arguments are passed
  3295. differently, such as the i860.
  3296.  
  3297. @findex FLOAT_ARG_TYPE
  3298. @item FLOAT_ARG_TYPE
  3299. Define this macro to override the type used by the library routines to
  3300. pick up arguments of type @code{float}.  (By default, they use a union
  3301. of @code{float} and @code{int}.)
  3302.  
  3303. The obvious choice would be @code{float}---but that won't work with
  3304. traditional C compilers that expect all arguments declared as @code{float}
  3305. to arrive as @code{double}.  To avoid this conversion, the library routines
  3306. ask for the value as some other type and then treat it as a @code{float}.
  3307.  
  3308. On some systems, no other type will work for this.  For these systems,
  3309. you must use @code{LIBGCC_NEEDS_DOUBLE} instead, to force conversion of
  3310. the values @code{double} before they are passed.
  3311.  
  3312. @findex FLOATIFY
  3313. @item FLOATIFY (@var{passed-value})
  3314. Define this macro to override the way library routines redesignate a
  3315. @code{float} argument as a @code{float} instead of the type it was
  3316. passed as.  The default is an expression which takes the @code{float}
  3317. field of the union.
  3318.  
  3319. @findex FLOAT_VALUE_TYPE
  3320. @item FLOAT_VALUE_TYPE
  3321. Define this macro to override the type used by the library routines to
  3322. return values that ought to have type @code{float}.  (By default, they
  3323. use @code{int}.)
  3324.  
  3325. The obvious choice would be @code{float}---but that won't work with
  3326. traditional C compilers gratuitously convert values declared as
  3327. @code{float} into @code{double}.
  3328.  
  3329. @findex INTIFY
  3330. @item INTIFY (@var{float-value})
  3331. Define this macro to override the way the value of a
  3332. @code{float}-returning library routine should be packaged in order to
  3333. return it.  These functions are actually declared to return type 
  3334. @code{FLOAT_VALUE_TYPE} (normally @code{int}).
  3335.  
  3336. These values can't be returned as type @code{float} because traditional
  3337. C compilers would gratuitously convert the value to a @code{double}.
  3338.  
  3339. A local variable named @code{intify} is always available when the macro
  3340. @code{INTIFY} is used.  It is a union of a @code{float} field named
  3341. @code{f} and a field named @code{i} whose type is
  3342. @code{FLOAT_VALUE_TYPE} or @code{int}.
  3343.  
  3344. If you don't define this macro, the default definition works by copying
  3345. the value through that union.
  3346.  
  3347. @findex nongcc_SI_type
  3348. @item nongcc_SI_type
  3349. Define this macro as the name of the data type corresponding to
  3350. @code{SImode} in the system's own C compiler.
  3351.  
  3352. You need not define this macro if that type is @code{long int}, as it usually
  3353. is.
  3354.  
  3355. @findex nongcc_word_type
  3356. @item nongcc_word_type
  3357. Define this macro as the name of the data type corresponding to the 
  3358. word_mode in the system's own C compiler.
  3359.  
  3360. You need not define this macro if that type is @code{long int}, as it usually
  3361. is.
  3362.  
  3363. @findex perform_@dots{}
  3364. @item perform_@dots{}
  3365. Define these macros to supply explicit C statements to carry out various
  3366. arithmetic operations on types @code{float} and @code{double} in the
  3367. library routines in @file{libgcc1.c}.  See that file for a full list
  3368. of these macros and their arguments.
  3369.  
  3370. On most machines, you don't need to define any of these macros, because
  3371. the C compiler that comes with the system takes care of doing them.
  3372.  
  3373. @findex NEXT_OBJC_RUNTIME
  3374. @item NEXT_OBJC_RUNTIME
  3375. Define this macro to generate code for Objective C message sending using
  3376. the calling convention of the NeXT system.  This calling convention
  3377. involves passing the object, the selector and the method arguments all
  3378. at once to the method-lookup library function.
  3379.  
  3380. The default calling convention passes just the object and the selector
  3381. to the lookup function, which returns a pointer to the method.
  3382. @end table
  3383.  
  3384. @node Addressing Modes
  3385. @section Addressing Modes
  3386. @cindex addressing modes
  3387.  
  3388. @table @code
  3389. @findex HAVE_POST_INCREMENT
  3390. @item HAVE_POST_INCREMENT
  3391. Define this macro if the machine supports post-increment addressing.
  3392.  
  3393. @findex HAVE_PRE_INCREMENT
  3394. @findex HAVE_POST_DECREMENT
  3395. @findex HAVE_PRE_DECREMENT
  3396. @item HAVE_PRE_INCREMENT
  3397. @itemx HAVE_POST_DECREMENT
  3398. @itemx HAVE_PRE_DECREMENT
  3399. Similar for other kinds of addressing.
  3400.  
  3401. @findex CONSTANT_ADDRESS_P
  3402. @item CONSTANT_ADDRESS_P (@var{x})
  3403. A C expression that is 1 if the RTX @var{x} is a constant which
  3404. is a valid address.  On most machines, this can be defined as
  3405. @code{CONSTANT_P (@var{x})}, but a few machines are more restrictive
  3406. in which constant addresses are supported.
  3407.  
  3408. @findex CONSTANT_P
  3409. @code{CONSTANT_P} accepts integer-values expressions whose values are
  3410. not explicitly known, such as @code{symbol_ref}, @code{label_ref}, and
  3411. @code{high} expressions and @code{const} arithmetic expressions, in
  3412. addition to @code{const_int} and @code{const_double} expressions.
  3413.  
  3414. @findex MAX_REGS_PER_ADDRESS
  3415. @item MAX_REGS_PER_ADDRESS
  3416. A number, the maximum number of registers that can appear in a valid
  3417. memory address.  Note that it is up to you to specify a value equal to
  3418. the maximum number that @code{GO_IF_LEGITIMATE_ADDRESS} would ever
  3419. accept.
  3420.  
  3421. @findex GO_IF_LEGITIMATE_ADDRESS
  3422. @item GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
  3423. A C compound statement with a conditional @code{goto @var{label};}
  3424. executed if @var{x} (an RTX) is a legitimate memory address on the
  3425. target machine for a memory operand of mode @var{mode}.
  3426.  
  3427. It usually pays to define several simpler macros to serve as
  3428. subroutines for this one.  Otherwise it may be too complicated to
  3429. understand.
  3430.  
  3431. This macro must exist in two variants: a strict variant and a
  3432. non-strict one.  The strict variant is used in the reload pass.  It
  3433. must be defined so that any pseudo-register that has not been
  3434. allocated a hard register is considered a memory reference.  In
  3435. contexts where some kind of register is required, a pseudo-register
  3436. with no hard register must be rejected.
  3437.  
  3438. The non-strict variant is used in other passes.  It must be defined to
  3439. accept all pseudo-registers in every context where some kind of
  3440. register is required.
  3441.  
  3442. @findex REG_OK_STRICT
  3443. Compiler source files that want to use the strict variant of this
  3444. macro define the macro @code{REG_OK_STRICT}.  You should use an
  3445. @code{#ifdef REG_OK_STRICT} conditional to define the strict variant
  3446. in that case and the non-strict variant otherwise.
  3447.  
  3448. Subroutines to check for acceptable registers for various purposes (one
  3449. for base registers, one for index registers, and so on) are typically
  3450. among the subroutines used to define @code{GO_IF_LEGITIMATE_ADDRESS}.
  3451. Then only these subroutine macros need have two variants; the higher
  3452. levels of macros may be the same whether strict or not.@refill
  3453.  
  3454. Normally, constant addresses which are the sum of a @code{symbol_ref}
  3455. and an integer are stored inside a @code{const} RTX to mark them as
  3456. constant.  Therefore, there is no need to recognize such sums
  3457. specifically as legitimate addresses.  Normally you would simply
  3458. recognize any @code{const} as legitimate.
  3459.  
  3460. Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant
  3461. sums that are not marked with  @code{const}.  It assumes that a naked
  3462. @code{plus} indicates indexing.  If so, then you @emph{must} reject such
  3463. naked constant sums as illegitimate addresses, so that none of them will
  3464. be given to @code{PRINT_OPERAND_ADDRESS}.
  3465.  
  3466. @cindex @code{ENCODE_SECTION_INFO} and address validation
  3467. On some machines, whether a symbolic address is legitimate depends on
  3468. the section that the address refers to.  On these machines, define the
  3469. macro @code{ENCODE_SECTION_INFO} to store the information into the
  3470. @code{symbol_ref}, and then check for it here.  When you see a
  3471. @code{const}, you will have to look inside it to find the
  3472. @code{symbol_ref} in order to determine the section.  @xref{Assembler
  3473. Format}.
  3474.  
  3475. @findex saveable_obstack
  3476. The best way to modify the name string is by adding text to the
  3477. beginning, with suitable punctuation to prevent any ambiguity.  Allocate
  3478. the new name in @code{saveable_obstack}.  You will have to modify
  3479. @code{ASM_OUTPUT_LABELREF} to remove and decode the added text and
  3480. output the name accordingly, and define @code{STRIP_NAME_ENCODING} to
  3481. access the original name string.
  3482.  
  3483. You can check the information stored here into the @code{symbol_ref} in
  3484. the definitions of the macros @code{GO_IF_LEGITIMATE_ADDRESS} and
  3485. @code{PRINT_OPERAND_ADDRESS}.
  3486.  
  3487. @findex REG_OK_FOR_BASE_P
  3488. @item REG_OK_FOR_BASE_P (@var{x})
  3489. A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
  3490. RTX) is valid for use as a base register.  For hard registers, it
  3491. should always accept those which the hardware permits and reject the
  3492. others.  Whether the macro accepts or rejects pseudo registers must be
  3493. controlled by @code{REG_OK_STRICT} as described above.  This usually
  3494. requires two variant definitions, of which @code{REG_OK_STRICT}
  3495. controls the one actually used.
  3496.  
  3497. @findex REG_OK_FOR_INDEX_P
  3498. @item REG_OK_FOR_INDEX_P (@var{x})
  3499. A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
  3500. RTX) is valid for use as an index register.
  3501.  
  3502. The difference between an index register and a base register is that
  3503. the index register may be scaled.  If an address involves the sum of
  3504. two registers, neither one of them scaled, then either one may be
  3505. labeled the ``base'' and the other the ``index''; but whichever
  3506. labeling is used must fit the machine's constraints of which registers
  3507. may serve in each capacity.  The compiler will try both labelings,
  3508. looking for one that is valid, and will reload one or both registers
  3509. only if neither labeling works.
  3510.  
  3511. @findex LEGITIMIZE_ADDRESS
  3512. @item LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
  3513. A C compound statement that attempts to replace @var{x} with a valid
  3514. memory address for an operand of mode @var{mode}.  @var{win} will be a
  3515. C statement label elsewhere in the code; the macro definition may use
  3516.  
  3517. @example
  3518. GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
  3519. @end example
  3520.  
  3521. @noindent
  3522. to avoid further processing if the address has become legitimate.
  3523.  
  3524. @findex break_out_memory_refs
  3525. @var{x} will always be the result of a call to @code{break_out_memory_refs},
  3526. and @var{oldx} will be the operand that was given to that function to produce
  3527. @var{x}.
  3528.  
  3529. The code generated by this macro should not alter the substructure of
  3530. @var{x}.  If it transforms @var{x} into a more legitimate form, it
  3531. should assign @var{x} (which will always be a C variable) a new value.
  3532.  
  3533. It is not necessary for this macro to come up with a legitimate
  3534. address.  The compiler has standard ways of doing so in all cases.  In
  3535. fact, it is safe for this macro to do nothing.  But often a
  3536. machine-dependent strategy can generate better code.
  3537.  
  3538. @findex GO_IF_MODE_DEPENDENT_ADDRESS
  3539. @item GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
  3540. A C statement or compound statement with a conditional @code{goto
  3541. @var{label};} executed if memory address @var{x} (an RTX) can have
  3542. different meanings depending on the machine mode of the memory
  3543. reference it is used for or if the address is valid for some modes
  3544. but not others.
  3545.  
  3546. Autoincrement and autodecrement addresses typically have mode-dependent
  3547. effects because the amount of the increment or decrement is the size
  3548. of the operand being addressed.  Some machines have other mode-dependent
  3549. addresses.  Many RISC machines have no mode-dependent addresses.
  3550.  
  3551. You may assume that @var{addr} is a valid address for the machine.
  3552.  
  3553. @findex LEGITIMATE_CONSTANT_P
  3554. @item LEGITIMATE_CONSTANT_P (@var{x})
  3555. A C expression that is nonzero if @var{x} is a legitimate constant for
  3556. an immediate operand on the target machine.  You can assume that
  3557. @var{x} satisfies @code{CONSTANT_P}, so you need not check this.  In fact,
  3558. @samp{1} is a suitable definition for this macro on machines where
  3559. anything @code{CONSTANT_P} is valid.@refill
  3560. @end table
  3561.  
  3562. @node Condition Code
  3563. @section Condition Code Status
  3564. @cindex condition code status
  3565.  
  3566. @findex cc_status
  3567. The file @file{conditions.h} defines a variable @code{cc_status} to
  3568. describe how the condition code was computed (in case the interpretation of
  3569. the condition code depends on the instruction that it was set by).  This
  3570. variable contains the RTL expressions on which the condition code is
  3571. currently based, and several standard flags.
  3572.  
  3573. Sometimes additional machine-specific flags must be defined in the machine
  3574. description header file.  It can also add additional machine-specific
  3575. information by defining @code{CC_STATUS_MDEP}.
  3576.  
  3577. @table @code
  3578. @findex CC_STATUS_MDEP
  3579. @item CC_STATUS_MDEP
  3580. C code for a data type which is used for declaring the @code{mdep}
  3581. component of @code{cc_status}.  It defaults to @code{int}.
  3582.  
  3583. This macro is not used on machines that do not use @code{cc0}.
  3584.  
  3585. @findex CC_STATUS_MDEP_INIT
  3586. @item CC_STATUS_MDEP_INIT
  3587. A C expression to initialize the @code{mdep} field to ``empty''.
  3588. The default definition does nothing, since most machines don't use
  3589. the field anyway.  If you want to use the field, you should probably
  3590. define this macro to initialize it.
  3591.  
  3592. This macro is not used on machines that do not use @code{cc0}.
  3593.  
  3594. @findex NOTICE_UPDATE_CC
  3595. @item NOTICE_UPDATE_CC (@var{exp}, @var{insn})
  3596. A C compound statement to set the components of @code{cc_status}
  3597. appropriately for an insn @var{insn} whose body is @var{exp}.  It is
  3598. this macro's responsibility to recognize insns that set the condition
  3599. code as a byproduct of other activity as well as those that explicitly
  3600. set @code{(cc0)}.
  3601.  
  3602. This macro is not used on machines that do not use @code{cc0}.
  3603.  
  3604. If there are insns that do not set the condition code but do alter
  3605. other machine registers, this macro must check to see whether they
  3606. invalidate the expressions that the condition code is recorded as
  3607. reflecting.  For example, on the 68000, insns that store in address
  3608. registers do not set the condition code, which means that usually
  3609. @code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
  3610. insns.  But suppose that the previous insn set the condition code
  3611. based on location @samp{a4@@(102)} and the current insn stores a new
  3612. value in @samp{a4}.  Although the condition code is not changed by
  3613. this, it will no longer be true that it reflects the contents of
  3614. @samp{a4@@(102)}.  Therefore, @code{NOTICE_UPDATE_CC} must alter
  3615. @code{cc_status} in this case to say that nothing is known about the
  3616. condition code value.
  3617.  
  3618. The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
  3619. with the results of peephole optimization: insns whose patterns are
  3620. @code{parallel} RTXs containing various @code{reg}, @code{mem} or
  3621. constants which are just the operands.  The RTL structure of these
  3622. insns is not sufficient to indicate what the insns actually do.  What
  3623. @code{NOTICE_UPDATE_CC} should do when it sees one is just to run
  3624. @code{CC_STATUS_INIT}.
  3625.  
  3626. A possible definition of @code{NOTICE_UPDATE_CC} is to call a function
  3627. that looks at an attribute (@pxref{Insn Attributes}) named, for example,
  3628. @samp{cc}.  This avoids having detailed information about patterns in
  3629. two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
  3630.  
  3631. @findex EXTRA_CC_MODES
  3632. @item EXTRA_CC_MODES
  3633. A list of names to be used for additional modes for condition code
  3634. values in registers (@pxref{Jump Patterns}).  These names are added
  3635. to @code{enum machine_mode} and all have class @code{MODE_CC}.  By
  3636. convention, they should start with @samp{CC} and end with @samp{mode}.
  3637.  
  3638. You should only define this macro if your machine does not use @code{cc0}
  3639. and only if additional modes are required.
  3640.  
  3641. @findex EXTRA_CC_NAMES
  3642. @item EXTRA_CC_NAMES
  3643. A list of C strings giving the names for the modes listed in
  3644. @code{EXTRA_CC_MODES}.  For example, the Sparc defines this macro and
  3645. @code{EXTRA_CC_MODES} as
  3646.  
  3647. @smallexample
  3648. #define EXTRA_CC_MODES CC_NOOVmode, CCFPmode
  3649. #define EXTRA_CC_NAMES "CC_NOOV", "CCFP"
  3650. @end smallexample
  3651.  
  3652. This macro is not required if @code{EXTRA_CC_MODES} is not defined.
  3653.  
  3654. @findex SELECT_CC_MODE
  3655. @item SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
  3656. Returns a mode from class @code{MODE_CC} to be used when comparison
  3657. operation code @var{op} is applied to rtx @var{x} and @var{y}.  For
  3658. example, on the Sparc, @code{SELECT_CC_MODE} is defined as (see
  3659. @pxref{Jump Patterns} for a description of the reason for this
  3660. definition)
  3661.  
  3662. @smallexample
  3663. #define SELECT_CC_MODE(OP,X,Y) \
  3664.   (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
  3665.    ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)    \
  3666.    : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS    \
  3667.        || GET_CODE (X) == NEG) \
  3668.       ? CC_NOOVmode : CCmode))
  3669. @end smallexample
  3670.  
  3671. This macro is not required if @code{EXTRA_CC_MODES} is not defined.
  3672. @end table
  3673.  
  3674. @node Costs
  3675. @section Describing Relative Costs of Operations
  3676. @cindex costs of instructions
  3677. @cindex relative costs
  3678. @cindex speed of instructions
  3679.  
  3680. These macros let you describe the relative speed of various operations
  3681. on the target machine.
  3682.  
  3683. @table @code
  3684. @findex CONST_COSTS 
  3685. @item CONST_COSTS (@var{x}, @var{code}, @var{outer_code})
  3686. A part of a C @code{switch} statement that describes the relative costs
  3687. of constant RTL expressions.  It must contain @code{case} labels for
  3688. expression codes @code{const_int}, @code{const}, @code{symbol_ref},
  3689. @code{label_ref} and @code{const_double}.  Each case must ultimately
  3690. reach a @code{return} statement to return the relative cost of the use
  3691. of that kind of constant value in an expression.  The cost may depend on
  3692. the precise value of the constant, which is available for examination in
  3693. @var{x}, and the rtx code of the expression in which it is contained,
  3694. found in @var{outer_code}.
  3695.  
  3696. @var{code} is the expression code---redundant, since it can be
  3697. obtained with @code{GET_CODE (@var{x})}.
  3698.  
  3699. @findex RTX_COSTS 
  3700. @findex COSTS_N_INSNS
  3701. @item RTX_COSTS (@var{x}, @var{code}, @var{outer_code})
  3702. Like @code{CONST_COSTS} but applies to nonconstant RTL expressions.
  3703. This can be used, for example, to indicate how costly a multiply
  3704. instruction is.  In writing this macro, you can use the construct
  3705. @code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
  3706. instructions.  @var{outer_code} is the code of the expression in which
  3707. @var{x} is contained.
  3708.  
  3709. This macro is optional; do not define it if the default cost assumptions
  3710. are adequate for the target machine.
  3711.  
  3712. @findex ADDRESS_COST
  3713. @item ADDRESS_COST (@var{address})
  3714. An expression giving the cost of an addressing mode that contains
  3715. @var{address}.  If not defined, the cost is computed from
  3716. the @var{address} expression and the @code{CONST_COSTS} values.
  3717.  
  3718. For most CISC machines, the default cost is a good approximation of the
  3719. true cost of the addressing mode.  However, on RISC machines, all
  3720. instructions normally have the same length and execution time.  Hence
  3721. all addresses will have equal costs.
  3722.  
  3723. In cases where more than one form of an address is known, the form with
  3724. the lowest cost will be used.  If multiple forms have the same, lowest,
  3725. cost, the one that is the most complex will be used.
  3726.  
  3727. For example, suppose an address that is equal to the sum of a register
  3728. and a constant is used twice in the same basic block.  When this macro
  3729. is not defined, the address will be computed in a register and memory
  3730. references will be indirect through that register.  On machines where
  3731. the cost of the addressing mode containing the sum is no higher than
  3732. that of a simple indirect reference, this will produce an additional
  3733. instruction and possibly require an additional register.  Proper
  3734. specification of this macro eliminates this overhead for such machines.
  3735.  
  3736. Similar use of this macro is made in strength reduction of loops.
  3737.  
  3738. @var{address} need not be valid as an address.  In such a case, the cost
  3739. is not relevant and can be any value; invalid addresses need not be
  3740. assigned a different cost.
  3741.  
  3742. On machines where an address involving more than one register is as
  3743. cheap as an address computation involving only one register, defining
  3744. @code{ADDRESS_COST} to reflect this can cause two registers to be live
  3745. over a region of code where only one would have been if
  3746. @code{ADDRESS_COST} were not defined in that manner.  This effect should
  3747. be considered in the definition of this macro.  Equivalent costs should
  3748. probably only be given to addresses with different numbers of registers
  3749. on machines with lots of registers.
  3750.  
  3751. This macro will normally either not be defined or be defined as a
  3752. constant.
  3753.  
  3754. @findex REGISTER_MOVE_COST
  3755. @item REGISTER_MOVE_COST (@var{from}, @var{to})
  3756. A C expression for the cost of moving data from a register in class
  3757. @var{from} to one in class @var{to}.  The classes are expressed using
  3758. the enumeration values such as @code{GENERAL_REGS}.  A value of 4 is the
  3759. default; other values are interpreted relative to that.
  3760.  
  3761. It is not required that the cost always equal 2 when @var{from} is the
  3762. same as @var{to}; on some machines it is expensive to move between
  3763. registers if they are not general registers.
  3764.  
  3765. If reload sees an insn consisting of a single @code{set} between two
  3766. hard registers, and if @code{REGISTER_MOVE_COST} applied to their
  3767. classes returns a value of 2, reload does not check to ensure that the
  3768. constraints of the insn are met.  Setting a cost of other than 2 will
  3769. allow reload to verify that the constraints are met.  You should do this
  3770. if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
  3771.  
  3772. @findex MEMORY_MOVE_COST
  3773. @item MEMORY_MOVE_COST (@var{m})
  3774. A C expression for the cost of moving data of mode @var{m} between a
  3775. register and memory.  A value of 2 is the default; this cost is relative
  3776. to those in @code{REGISTER_MOVE_COST}.
  3777.  
  3778. If moving between registers and memory is more expensive than between
  3779. two registers, you should define this macro to express the relative cost.
  3780.  
  3781. @findex BRANCH_COST
  3782. @item BRANCH_COST
  3783. A C expression for the cost of a branch instruction.  A value of 1 is
  3784. the default; other values are interpreted relative to that.
  3785. @end table
  3786.  
  3787. Here are additional macros which do not specify precise relative costs,
  3788. but only that certain actions are more expensive than GNU CC would
  3789. ordinarily expect.
  3790.  
  3791. @table @code
  3792. @findex SLOW_BYTE_ACCESS
  3793. @item SLOW_BYTE_ACCESS
  3794. Define this macro as a C expression which is nonzero if accessing less
  3795. than a word of memory (i.e. a @code{char} or a @code{short}) is no
  3796. faster than accessing a word of memory, i.e., if such access
  3797. require more than one instruction or if there is no difference in cost
  3798. between byte and (aligned) word loads.
  3799.  
  3800. When this macro is not defined, the compiler will access a field by
  3801. finding the smallest containing object; when it is defined, a fullword
  3802. load will be used if alignment permits.  Unless bytes accesses are
  3803. faster than word accesses, using word accesses is preferable since it
  3804. may eliminate subsequent memory access if subsequent accesses occur to
  3805. other fields in the same word of the structure, but to different bytes.
  3806.  
  3807. @findex SLOW_ZERO_EXTEND
  3808. @item SLOW_ZERO_EXTEND
  3809. Define this macro if zero-extension (of a @code{char} or @code{short}
  3810. to an @code{int}) can be done faster if the destination is a register
  3811. that is known to be zero.
  3812.  
  3813. If you define this macro, you must have instruction patterns that
  3814. recognize RTL structures like this:
  3815.  
  3816. @smallexample
  3817. (set (strict_low_part (subreg:QI (reg:SI @dots{}) 0)) @dots{})
  3818. @end smallexample
  3819.  
  3820. @noindent
  3821. and likewise for @code{HImode}.
  3822.  
  3823. @findex SLOW_UNALIGNED_ACCESS
  3824. @item SLOW_UNALIGNED_ACCESS
  3825. Define this macro to be the value 1 if unaligned accesses have a cost
  3826. many times greater than aligned accesses, for example if they are
  3827. emulated in a trap handler.
  3828.  
  3829. When this macro is non-zero, the compiler will act as if
  3830. @code{STRICT_ALIGNMENT} were non-zero when generating code for block
  3831. moves.  This can cause significantly more instructions to be produced.
  3832. Therefore, do not set this macro non-zero if unaligned accesses only add a
  3833. cycle or two to the time for a memory access.
  3834.  
  3835. If the value of this macro is always zero, it need not be defined.
  3836.  
  3837. @findex DONT_REDUCE_ADDR
  3838. @item DONT_REDUCE_ADDR
  3839. Define this macro to inhibit strength reduction of memory addresses.
  3840. (On some machines, such strength reduction seems to do harm rather
  3841. than good.)
  3842.  
  3843. @findex MOVE_RATIO
  3844. @item MOVE_RATIO
  3845. The number of scalar move insns which should be generated instead of a
  3846. string move insn or a library call.  Increasing the value will always
  3847. make code faster, but eventually incurs high cost in increased code size.
  3848.  
  3849. If you don't define this, a reasonable default is used.
  3850.  
  3851. @findex NO_FUNCTION_CSE
  3852. @item NO_FUNCTION_CSE
  3853. Define this macro if it is as good or better to call a constant
  3854. function address than to call an address kept in a register.
  3855.  
  3856. @findex NO_RECURSIVE_FUNCTION_CSE
  3857. @item NO_RECURSIVE_FUNCTION_CSE
  3858. Define this macro if it is as good or better for a function to call
  3859. itself with an explicit address than to call an address kept in a
  3860. register.
  3861.  
  3862. @findex ADJUST_COST
  3863. @item ADJUST_COST (@var{insn}, @var{link}, @var{dep_insn}, @var{cost})
  3864. A C statement (sans semicolon) to update the integer variable @var{cost}
  3865. based on the relationship between @var{insn} that is dependent on
  3866. @var{dep_insn} through the dependence @var{link}.  The default is to
  3867. make no adjustment to @var{cost}.  This can be used for example to
  3868. specify to the scheduler that an output- or anti-dependence does not
  3869. incur the same cost as a data-dependence.
  3870. @end table
  3871.  
  3872. @node Sections
  3873. @section Dividing the Output into Sections (Texts, Data, @dots{})
  3874. @c the above section title is WAY too long.  maybe cut the part between
  3875. @c the (...)?  --mew 10feb93
  3876.  
  3877. An object file is divided into sections containing different types of
  3878. data.  In the most common case, there are three sections: the @dfn{text
  3879. section}, which holds instructions and read-only data; the @dfn{data
  3880. section}, which holds initialized writable data; and the @dfn{bss
  3881. section}, which holds uninitialized data.  Some systems have other kinds
  3882. of sections.
  3883.  
  3884. The compiler must tell the assembler when to switch sections.  These
  3885. macros control what commands to output to tell the assembler this.  You
  3886. can also define additional sections.
  3887.  
  3888. @table @code
  3889. @findex TEXT_SECTION_ASM_OP
  3890. @item TEXT_SECTION_ASM_OP
  3891. A C expression whose value is a string containing the assembler
  3892. operation that should precede instructions and read-only data.  Normally
  3893. @code{".text"} is right.
  3894.  
  3895. @findex DATA_SECTION_ASM_OP
  3896. @item DATA_SECTION_ASM_OP
  3897. A C expression whose value is a string containing the assembler
  3898. operation to identify the following data as writable initialized data.
  3899. Normally @code{".data"} is right.
  3900.  
  3901. @findex SHARED_SECTION_ASM_OP
  3902. @item SHARED_SECTION_ASM_OP
  3903. if defined, a C expression whose value is a string containing the
  3904. assembler operation to identify the following data as shared data.  If
  3905. not defined, @code{DATA_SECTION_ASM_OP} will be used.
  3906.  
  3907. @findex INIT_SECTION_ASM_OP
  3908. @item INIT_SECTION_ASM_OP
  3909. if defined, a C expression whose value is a string containing the
  3910. assembler operation to identify the following data as initialization
  3911. code.  If not defined, GNU CC will assume such a section does not
  3912. exist.
  3913.  
  3914. @findex EXTRA_SECTIONS
  3915. @findex in_text
  3916. @findex in_data
  3917. @item EXTRA_SECTIONS
  3918. A list of names for sections other than the standard two, which are
  3919. @code{in_text} and @code{in_data}.  You need not define this macro
  3920. on a system with no other sections (that GCC needs to use).
  3921.  
  3922. @findex EXTRA_SECTION_FUNCTIONS
  3923. @findex text_section
  3924. @findex data_section
  3925. @item EXTRA_SECTION_FUNCTIONS
  3926. One or more functions to be defined in @file{varasm.c}.  These
  3927. functions should do jobs analogous to those of @code{text_section} and
  3928. @code{data_section}, for your additional sections.  Do not define this
  3929. macro if you do not define @code{EXTRA_SECTIONS}.
  3930.  
  3931. @findex READONLY_DATA_SECTION
  3932. @item READONLY_DATA_SECTION
  3933. On most machines, read-only variables, constants, and jump tables are
  3934. placed in the text section.  If this is not the case on your machine,
  3935. this macro should be defined to be the name of a function (either
  3936. @code{data_section} or a function defined in @code{EXTRA_SECTIONS}) that
  3937. switches to the section to be used for read-only items.
  3938.  
  3939. If these items should be placed in the text section, this macro should
  3940. not be defined.
  3941.  
  3942. @findex SELECT_SECTION
  3943. @item SELECT_SECTION (@var{exp}, @var{reloc})
  3944. A C statement or statements to switch to the appropriate section for
  3945. output of @var{exp}.  You can assume that @var{exp} is either a
  3946. @code{VAR_DECL} node or a constant of some sort.  @var{reloc}
  3947. indicates whether the initial value of @var{exp} requires link-time
  3948. relocations.  Select the section by calling @code{text_section} or one
  3949. of the alternatives for other sections.
  3950.  
  3951. Do not define this macro if you put all read-only variables and
  3952. constants in the read-only data section (usually the text section).
  3953.  
  3954. @findex SELECT_RTX_SECTION
  3955. @item SELECT_RTX_SECTION (@var{mode}, @var{rtx})
  3956. A C statement or statements to switch to the appropriate section for
  3957. output of @var{rtx} in mode @var{mode}.  You can assume that @var{rtx}
  3958. is some kind of constant in RTL.  The argument @var{mode} is redundant
  3959. except in the case of a @code{const_int} rtx.  Select the section by
  3960. calling @code{text_section} or one of the alternatives for other
  3961. sections.
  3962.  
  3963. Do not define this macro if you put all constants in the read-only
  3964. data section.
  3965.  
  3966. @findex JUMP_TABLES_IN_TEXT_SECTION
  3967. @item JUMP_TABLES_IN_TEXT_SECTION
  3968. Define this macro if jump tables (for @code{tablejump} insns) should be
  3969. output in the text section, along with the assembler instructions.
  3970. Otherwise, the readonly data section is used.
  3971.  
  3972. This macro is irrelevant if there is no separate readonly data section.
  3973.  
  3974. @findex ENCODE_SECTION_INFO
  3975. @item ENCODE_SECTION_INFO (@var{decl})
  3976. Define this macro if references to a symbol must be treated differently
  3977. depending on something about the variable or function named by the
  3978. symbol (such as what section it is in).
  3979.  
  3980. The macro definition, if any, is executed immediately after the rtl for
  3981. @var{decl} has been created and stored in @code{DECL_RTL (@var{decl})}.
  3982. The value of the rtl will be a @code{mem} whose address is a
  3983. @code{symbol_ref}.
  3984.  
  3985. @cindex @code{SYMBOL_REF_FLAG}, in @code{ENCODE_SECTION_INFO}
  3986. The usual thing for this macro to do is to record a flag in the
  3987. @code{symbol_ref} (such as @code{SYMBOL_REF_FLAG}) or to store a
  3988. modified name string in the @code{symbol_ref} (if one bit is not enough
  3989. information).
  3990.  
  3991. @findex STRIP_NAME_ENCODING
  3992. @item STRIP_NAME_ENCODING (@var{var}, @var{sym_name})
  3993. Decode @var{sym_name} and store the real name part in @var{var}, sans
  3994. the characters that encode section info.  Define this macro if
  3995. @code{ENCODE_SECTION_INFO} alters the symbol's name string.
  3996. @end table
  3997.  
  3998. @node PIC
  3999. @section Position Independent Code
  4000. @cindex position independent code
  4001. @cindex PIC
  4002.  
  4003. This section describes macros that help implement generation of position
  4004. independent code.  Simply defining these macros is not enough to
  4005. generate valid PIC; you must also add support to the macros
  4006. @code{GO_IF_LEGITIMATE_ADDRESS} and @code{PRINT_OPERAND_ADDRESS}, as
  4007. well as @code{LEGITIMIZE_ADDRESS}.  You must modify the definition of
  4008. @samp{movsi} to do something appropriate when the source operand
  4009. contains a symbolic address.  You may also need to alter the handling of
  4010. switch statements so that they use relative addresses.
  4011. @c i rearranged the order of the macros above to try to force one of
  4012. @c them to the next line, to eliminate an overfull hbox. --mew 10feb93 
  4013.  
  4014. @table @code
  4015. @findex PIC_OFFSET_TABLE_REGNUM
  4016. @item PIC_OFFSET_TABLE_REGNUM
  4017. The register number of the register used to address a table of static
  4018. data addresses in memory.  In some cases this register is defined by a
  4019. processor's ``application binary interface'' (ABI).  When this macro
  4020. is defined, RTL is generated for this register once, as with the stack
  4021. pointer and frame pointer registers.  If this macro is not defined, it
  4022. is up to the machine-dependent files to allocate such a register (if
  4023. necessary).
  4024.  
  4025. @findex FINALIZE_PIC
  4026. @item FINALIZE_PIC
  4027. By generating position-independent code, when two different programs (A
  4028. and B) share a common library (libC.a), the text of the library can be
  4029. shared whether or not the library is linked at the same address for both
  4030. programs.  In some of these environments, position-independent code
  4031. requires not only the use of different addressing modes, but also
  4032. special code to enable the use of these addressing modes.
  4033.  
  4034. The @code{FINALIZE_PIC} macro serves as a hook to emit these special
  4035. codes once the function is being compiled into assembly code, but not
  4036. before.  (It is not done before, because in the case of compiling an
  4037. inline function, it would lead to multiple PIC prologues being
  4038. included in functions which used inline functions and were compiled to
  4039. assembly language.)
  4040.  
  4041. @findex LEGITIMATE_PIC_OPERAND_P
  4042. @item LEGITIMATE_PIC_OPERAND_P (@var{x})
  4043. A C expression that is nonzero if @var{x} is a legitimate immediate
  4044. operand on the target machine when generating position independent code.
  4045. You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not
  4046. check this.  You can also assume @var{flag_pic} is true, so you need not
  4047. check it either.  You need not define this macro if all constants 
  4048. (including @code{SYMBOL_REF}) can be immediate operands when generating 
  4049. position independent code.
  4050. @end table
  4051.  
  4052. @node Assembler Format
  4053. @section Defining the Output Assembler Language
  4054.  
  4055. This section describes macros whose principal purpose is to describe how
  4056. to write instructions in assembler language--rather than what the
  4057. instructions do.
  4058.  
  4059. @menu
  4060. * File Framework::       Structural information for the assembler file.
  4061. * Data Output::          Output of constants (numbers, strings, addresses).
  4062. * Uninitialized Data::   Output of uninitialized variables.
  4063. * Label Output::         Output and generation of labels.
  4064. * Initialization::       General principles of initialization
  4065.                and termination routines.
  4066. * Macros for Initialization::
  4067.              Specific macros that control the handling of 
  4068.                initialization and termination routines.
  4069. * Instruction Output::   Output of actual instructions.
  4070. * Dispatch Tables::      Output of jump tables.
  4071. * Alignment Output::     Pseudo ops for alignment and skipping data.
  4072. @end menu
  4073.  
  4074. @node File Framework
  4075. @subsection The Overall Framework of an Assembler File 
  4076. @cindex assembler format
  4077. @cindex output of assembler code
  4078.  
  4079. @table @code
  4080. @findex ASM_FILE_START
  4081. @item ASM_FILE_START (@var{stream})
  4082. A C expression which outputs to the stdio stream @var{stream}
  4083. some appropriate text to go at the start of an assembler file.
  4084.  
  4085. Normally this macro is defined to output a line containing
  4086. @samp{#NO_APP}, which is a comment that has no effect on most
  4087. assemblers but tells the GNU assembler that it can save time by not
  4088. checking for certain assembler constructs.
  4089.  
  4090. On systems that use SDB, it is necessary to output certain commands;
  4091. see @file{attasm.h}.
  4092.  
  4093. @findex ASM_FILE_END
  4094. @item ASM_FILE_END (@var{stream})
  4095. A C expression which outputs to the stdio stream @var{stream}
  4096. some appropriate text to go at the end of an assembler file.
  4097.  
  4098. If this macro is not defined, the default is to output nothing
  4099. special at the end of the file.  Most systems don't require any
  4100. definition.
  4101.  
  4102. On systems that use SDB, it is necessary to output certain commands;
  4103. see @file{attasm.h}.
  4104.  
  4105. @findex ASM_IDENTIFY_GCC
  4106. @item ASM_IDENTIFY_GCC (@var{file})
  4107. A C statement to output assembler commands which will identify
  4108. the object file as having been compiled with GNU CC (or another
  4109. GNU compiler).
  4110.  
  4111. If you don't define this macro, the string @samp{gcc_compiled.:}
  4112. is output.  This string is calculated to define a symbol which,
  4113. on BSD systems, will never be defined for any other reason.
  4114. GDB checks for the presence of this symbol when reading the
  4115. symbol table of an executable.
  4116.  
  4117. On non-BSD systems, you must arrange communication with GDB in
  4118. some other fashion.  If GDB is not used on your system, you can
  4119. define this macro with an empty body.
  4120.  
  4121. @findex ASM_COMMENT_START
  4122. @item ASM_COMMENT_START
  4123. A C string constant describing how to begin a comment in the target
  4124. assembler language.  The compiler assumes that the comment will end at
  4125. the end of the line.
  4126.  
  4127. @findex ASM_APP_ON
  4128. @item ASM_APP_ON
  4129. A C string constant for text to be output before each @code{asm}
  4130. statement or group of consecutive ones.  Normally this is
  4131. @code{"#APP"}, which is a comment that has no effect on most
  4132. assemblers but tells the GNU assembler that it must check the lines
  4133. that follow for all valid assembler constructs.
  4134.  
  4135. @findex ASM_APP_OFF
  4136. @item ASM_APP_OFF
  4137. A C string constant for text to be output after each @code{asm}
  4138. statement or group of consecutive ones.  Normally this is
  4139. @code{"#NO_APP"}, which tells the GNU assembler to resume making the
  4140. time-saving assumptions that are valid for ordinary compiler output.
  4141.  
  4142. @findex ASM_OUTPUT_SOURCE_FILENAME
  4143. @item ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
  4144. A C statement to output COFF information or DWARF debugging information
  4145. which indicates that filename @var{name} is the current source file to
  4146. the stdio stream @var{stream}.
  4147.  
  4148. This macro need not be defined if the standard form of output
  4149. for the file format in use is appropriate.
  4150.  
  4151. @findex ASM_OUTPUT_SOURCE_LINE
  4152. @item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
  4153. A C statement to output DBX or SDB debugging information before code
  4154. for line number @var{line} of the current source file to the
  4155. stdio stream @var{stream}.
  4156.  
  4157. This macro need not be defined if the standard form of debugging
  4158. information for the debugger in use is appropriate.
  4159.  
  4160. @findex ASM_OUTPUT_IDENT
  4161. @item ASM_OUTPUT_IDENT (@var{stream}, @var{string})
  4162. A C statement to output something to the assembler file to handle a
  4163. @samp{#ident} directive containing the text @var{string}.  If this
  4164. macro is not defined, nothing is output for a @samp{#ident} directive.
  4165.  
  4166. @findex OBJC_PROLOGUE
  4167. @item OBJC_PROLOGUE
  4168. A C statement to output any assembler statements which are required to
  4169. precede any Objective C object definitions or message sending.  The
  4170. statement is executed only when compiling an Objective C program.
  4171. @end table
  4172.  
  4173. @node Data Output
  4174. @subsection Output of Data
  4175.  
  4176. @table @code
  4177. @findex ASM_OUTPUT_LONG_DOUBLE
  4178. @findex ASM_OUTPUT_DOUBLE
  4179. @findex ASM_OUTPUT_FLOAT
  4180. @item ASM_OUTPUT_LONG_DOUBLE (@var{stream}, @var{value})
  4181. @item ASM_OUTPUT_DOUBLE (@var{stream}, @var{value})
  4182. @item ASM_OUTPUT_FLOAT (@var{stream}, @var{value})
  4183. A C statement to output to the stdio stream @var{stream} an assembler
  4184. instruction to assemble a floating-point constant of @code{TFmode},
  4185. @code{DFmode} or @code{SFmode}, respectively, whose value is
  4186. @var{value}.  @var{value} will be a C expression of type
  4187. @code{REAL_VALUE_TYPE}.  Macros such as
  4188. @code{REAL_VALUE_TO_TARGET_DOUBLE} are useful for writing these
  4189. definitions.
  4190.  
  4191. @findex ASM_OUTPUT_QUADRUPLE_INT
  4192. @findex ASM_OUTPUT_DOUBLE_INT
  4193. @findex ASM_OUTPUT_INT
  4194. @findex ASM_OUTPUT_SHORT
  4195. @findex ASM_OUTPUT_CHAR
  4196. @findex output_addr_const
  4197. @item ASM_OUTPUT_QUADRUPLE_INT (@var{stream}, @var{exp})
  4198. @item ASM_OUTPUT_DOUBLE_INT (@var{stream}, @var{exp})
  4199. @item ASM_OUTPUT_INT (@var{stream}, @var{exp})
  4200. @itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp})
  4201. @itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp})
  4202. A C statement to output to the stdio stream @var{stream} an assembler
  4203. instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
  4204. respectively, whose value is @var{value}.  The argument @var{exp} will
  4205. be an RTL expression which represents a constant value.  Use
  4206. @samp{output_addr_const (@var{stream}, @var{exp})} to output this value
  4207. as an assembler expression.@refill
  4208.  
  4209. For sizes larger than @code{UNITS_PER_WORD}, if the action of a macro
  4210. would be identical to repeatedly calling the macro corresponding to
  4211. a size of @code{UNITS_PER_WORD}, once for each word, you need not define
  4212. the macro.
  4213.  
  4214. @findex ASM_OUTPUT_BYTE
  4215. @item ASM_OUTPUT_BYTE (@var{stream}, @var{value})
  4216. A C statement to output to the stdio stream @var{stream} an assembler
  4217. instruction to assemble a single byte containing the number @var{value}.
  4218.  
  4219. @findex ASM_BYTE_OP
  4220. @item ASM_BYTE_OP
  4221. A C string constant giving the pseudo-op to use for a sequence of
  4222. single-byte constants.  If this macro is not defined, the default is
  4223. @code{"byte"}.
  4224.  
  4225. @findex ASM_OUTPUT_ASCII
  4226. @item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
  4227. A C statement to output to the stdio stream @var{stream} an assembler
  4228. instruction to assemble a string constant containing the @var{len}
  4229. bytes at @var{ptr}.  @var{ptr} will be a C expression of type
  4230. @code{char *} and @var{len} a C expression of type @code{int}.
  4231.  
  4232. If the assembler has a @code{.ascii} pseudo-op as found in the
  4233. Berkeley Unix assembler, do not define the macro
  4234. @code{ASM_OUTPUT_ASCII}.
  4235.  
  4236. @findex ASM_OUTPUT_POOL_PROLOGUE
  4237. @item ASM_OUTPUT_POOL_PROLOGUE (@var{file} @var{funname} @var{fundecl} @var{size})
  4238. A C statement to output assembler commands to define the start of the
  4239. constant pool for a function.  @var{funname} is a string giving
  4240. the name of the function.  Should the return type of the function
  4241. be required, it can be obtained via @var{fundecl}.  @var{size}
  4242. is the size, in bytes, of the constant pool that will be written
  4243. immediately after this call.
  4244.  
  4245. If no constant-pool prefix is required, the usual case, this macro need
  4246. not be defined.
  4247.  
  4248. @findex ASM_OUTPUT_SPECIAL_POOL_ENTRY
  4249. @item ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto})
  4250. A C statement (with or without semicolon) to output a constant in the
  4251. constant pool, if it needs special treatment.  (This macro need not do
  4252. anything for RTL expressions that can be output normally.)
  4253.  
  4254. The argument @var{file} is the standard I/O stream to output the
  4255. assembler code on.  @var{x} is the RTL expression for the constant to
  4256. output, and @var{mode} is the machine mode (in case @var{x} is a
  4257. @samp{const_int}).  @var{align} is the required alignment for the value
  4258. @var{x}; you should output an assembler directive to force this much
  4259. alignment.
  4260.  
  4261. The argument @var{labelno} is a number to use in an internal label for
  4262. the address of this pool entry.  The definition of this macro is
  4263. responsible for outputting the label definition at the proper place.
  4264. Here is how to do this:
  4265.  
  4266. @example
  4267. ASM_OUTPUT_INTERNAL_LABEL (@var{file}, "LC", @var{labelno});
  4268. @end example
  4269.  
  4270. When you output a pool entry specially, you should end with a
  4271. @code{goto} to the label @var{jumpto}.  This will prevent the same pool
  4272. entry from being output a second time in the usual manner.
  4273.  
  4274. You need not define this macro if it would do nothing.
  4275.  
  4276. @findex ASM_OPEN_PAREN
  4277. @findex ASM_CLOSE_PAREN
  4278. @item ASM_OPEN_PAREN
  4279. @itemx ASM_CLOSE_PAREN
  4280. These macros are defined as C string constant, describing the syntax
  4281. in the assembler for grouping arithmetic expressions.  The following
  4282. definitions are correct for most assemblers:
  4283.  
  4284. @example
  4285. #define ASM_OPEN_PAREN "("
  4286. #define ASM_CLOSE_PAREN ")"
  4287. @end example
  4288. @end table
  4289.  
  4290.   These macros are provided by @file{real.h} for writing the definitions
  4291. of @code{ASM_OUTPUT_DOUBLE} and the like:
  4292.  
  4293. @table @code
  4294. @item REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
  4295. @itemx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
  4296. @itemx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
  4297. @findex REAL_VALUE_TO_TARGET_SINGLE
  4298. @findex REAL_VALUE_TO_TARGET_DOUBLE
  4299. @findex REAL_VALUE_TO_TARGET_LONG_DOUBLE
  4300. These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the target's
  4301. floating point representation, and store its bit pattern in the array of
  4302. @code{long int} whose address is @var{l}.  The number of elements in the
  4303. output array is determined by the size of the desired target floating
  4304. point data type: 32 bits of it go in each @code{long int} array
  4305. element.  Each array element holds 32 bits of the result, even if
  4306. @code{long int} is wider than 32 bits on the host machine.
  4307.  
  4308. The array element values are designed so that you can print them out
  4309. using @code{fprintf} in the order they should appear in the target
  4310. machine's memory.
  4311.  
  4312. @item REAL_VALUE_TO_DECIMAL (@var{x}, @var{format}, @var{string})
  4313. @findex REAL_VALUE_TO_DECIMAL
  4314. This macro converts @var{x}, of type @code{REAL_VALUE_TYPE}, to a
  4315. decimal number and stores it as a string into @var{string}.
  4316. You must pass, as @var{string}, the address of a long enough block
  4317. of space to hold the result.
  4318.  
  4319. The argument @var{format} is a @code{printf}-specification that serves
  4320. as a suggestion for how to format the output string.
  4321. @end table
  4322.  
  4323. @node Uninitialized Data
  4324. @subsection Output of Uninitialized Variables
  4325.  
  4326. Each of the macros in this section is used to do the whole job of
  4327. outputting a single uninitialized variable.
  4328.  
  4329. @table @code
  4330. @findex ASM_OUTPUT_COMMON
  4331. @item ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
  4332. A C statement (sans semicolon) to output to the stdio stream
  4333. @var{stream} the assembler definition of a common-label named
  4334. @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
  4335. is the size rounded up to whatever alignment the caller wants.
  4336.  
  4337. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4338. output the name itself; before and after that, output the additional
  4339. assembler syntax for defining the name, and a newline.
  4340.  
  4341. This macro controls how the assembler definitions of uninitialized
  4342. global variables are output.
  4343.  
  4344. @findex ASM_OUTPUT_ALIGNED_COMMON
  4345. @item ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment})
  4346. Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a
  4347. separate, explicit argument.  If you define this macro, it is used in
  4348. place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in
  4349. handling the required alignment of the variable.
  4350.  
  4351. @findex ASM_OUTPUT_SHARED_COMMON
  4352. @item ASM_OUTPUT_SHARED_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
  4353. If defined, it is similar to @code{ASM_OUTPUT_COMMON}, except that it
  4354. is used when @var{name} is shared.  If not defined, @code{ASM_OUTPUT_COMMON}
  4355. will be used.
  4356.  
  4357. @findex ASM_OUTPUT_LOCAL
  4358. @item ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
  4359. A C statement (sans semicolon) to output to the stdio stream
  4360. @var{stream} the assembler definition of a local-common-label named
  4361. @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
  4362. is the size rounded up to whatever alignment the caller wants.
  4363.  
  4364. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4365. output the name itself; before and after that, output the additional
  4366. assembler syntax for defining the name, and a newline.
  4367.  
  4368. This macro controls how the assembler definitions of uninitialized
  4369. static variables are output.
  4370.  
  4371. @findex ASM_OUTPUT_ALIGNED_LOCAL
  4372. @item ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment})
  4373. Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a
  4374. separate, explicit argument.  If you define this macro, it is used in
  4375. place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in
  4376. handling the required alignment of the variable.
  4377.  
  4378. @findex ASM_OUTPUT_SHARED_LOCAL
  4379. @item ASM_OUTPUT_SHARED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
  4380. If defined, it is similar to @code{ASM_OUTPUT_LOCAL}, except that it
  4381. is used when @var{name} is shared.  If not defined, @code{ASM_OUTPUT_LOCAL}
  4382. will be used.
  4383. @end table
  4384.  
  4385. @node Label Output
  4386. @subsection Output and Generation of Labels
  4387.  
  4388. @table @code
  4389. @findex ASM_OUTPUT_LABEL
  4390. @findex assemble_name
  4391. @item ASM_OUTPUT_LABEL (@var{stream}, @var{name})
  4392. A C statement (sans semicolon) to output to the stdio stream
  4393. @var{stream} the assembler definition of a label named @var{name}.
  4394. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4395. output the name itself; before and after that, output the additional
  4396. assembler syntax for defining the name, and a newline.
  4397.  
  4398. @findex ASM_DECLARE_FUNCTION_NAME
  4399. @item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
  4400. A C statement (sans semicolon) to output to the stdio stream
  4401. @var{stream} any text necessary for declaring the name @var{name} of a
  4402. function which is being defined.  This macro is responsible for
  4403. outputting the label definition (perhaps using
  4404. @code{ASM_OUTPUT_LABEL}).  The argument @var{decl} is the
  4405. @code{FUNCTION_DECL} tree node representing the function.
  4406.  
  4407. If this macro is not defined, then the function name is defined in the
  4408. usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
  4409.  
  4410. @findex ASM_DECLARE_FUNCTION_SIZE
  4411. @item ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl})
  4412. A C statement (sans semicolon) to output to the stdio stream
  4413. @var{stream} any text necessary for declaring the size of a function
  4414. which is being defined.  The argument @var{name} is the name of the
  4415. function.  The argument @var{decl} is the @code{FUNCTION_DECL} tree node
  4416. representing the function.
  4417.  
  4418. If this macro is not defined, then the function size is not defined.
  4419.  
  4420. @findex ASM_DECLARE_OBJECT_NAME
  4421. @item ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl})
  4422. A C statement (sans semicolon) to output to the stdio stream
  4423. @var{stream} any text necessary for declaring the name @var{name} of an
  4424. initialized variable which is being defined.  This macro must output the
  4425. label definition (perhaps using @code{ASM_OUTPUT_LABEL}).  The argument
  4426. @var{decl} is the @code{VAR_DECL} tree node representing the variable.
  4427.  
  4428. If this macro is not defined, then the variable name is defined in the
  4429. usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
  4430.  
  4431. @findex ASM_GLOBALIZE_LABEL
  4432. @item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name})
  4433. A C statement (sans semicolon) to output to the stdio stream
  4434. @var{stream} some commands that will make the label @var{name} global;
  4435. that is, available for reference from other files.  Use the expression
  4436. @code{assemble_name (@var{stream}, @var{name})} to output the name
  4437. itself; before and after that, output the additional assembler syntax
  4438. for making that name global, and a newline.
  4439.  
  4440. @findex ASM_OUTPUT_EXTERNAL
  4441. @item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
  4442. A C statement (sans semicolon) to output to the stdio stream
  4443. @var{stream} any text necessary for declaring the name of an external
  4444. symbol named @var{name} which is referenced in this compilation but
  4445. not defined.  The value of @var{decl} is the tree node for the
  4446. declaration.
  4447.  
  4448. This macro need not be defined if it does not need to output anything.
  4449. The GNU assembler and most Unix assemblers don't require anything.
  4450.  
  4451. @findex ASM_OUTPUT_EXTERNAL_LIBCALL
  4452. @item ASM_OUTPUT_EXTERNAL_LIBCALL (@var{stream}, @var{symref})
  4453. A C statement (sans semicolon) to output on @var{stream} an assembler
  4454. pseudo-op to declare a library function name external.  The name of the
  4455. library function is given by @var{symref}, which has type @code{rtx} and
  4456. is a @code{symbol_ref}.
  4457.  
  4458. This macro need not be defined if it does not need to output anything.
  4459. The GNU assembler and most Unix assemblers don't require anything.
  4460.  
  4461. @findex ASM_OUTPUT_LABELREF
  4462. @item ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
  4463. A C statement (sans semicolon) to output to the stdio stream
  4464. @var{stream} a reference in assembler syntax to a label named
  4465. @var{name}.  This should add @samp{_} to the front of the name, if that
  4466. is customary on your operating system, as it is in most Berkeley Unix
  4467. systems.  This macro is used in @code{assemble_name}.
  4468.  
  4469. @findex ASM_OUTPUT_LABELREF_AS_INT
  4470. @item ASM_OUTPUT_LABELREF_AS_INT (@var{file}, @var{label})
  4471. Define this macro for systems that use the program @code{collect2}.
  4472. The definition should be a C statement to output a word containing
  4473. a reference to the label @var{label}.
  4474.  
  4475. @findex ASM_OUTPUT_INTERNAL_LABEL
  4476. @item ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{prefix}, @var{num})
  4477. A C statement to output to the stdio stream @var{stream} a label whose
  4478. name is made from the string @var{prefix} and the number @var{num}.
  4479.  
  4480. It is absolutely essential that these labels be distinct from the labels
  4481. used for user-level functions and variables.  Otherwise, certain programs
  4482. will have name conflicts with internal labels.
  4483.  
  4484. It is desirable to exclude internal labels from the symbol table of the
  4485. object file.  Most assemblers have a naming convention for labels that
  4486. should be excluded; on many systems, the letter @samp{L} at the
  4487. beginning of a label has this effect.  You should find out what
  4488. convention your system uses, and follow it.
  4489.  
  4490. The usual definition of this macro is as follows:
  4491.  
  4492. @example
  4493. fprintf (@var{stream}, "L%s%d:\n", @var{prefix}, @var{num})
  4494. @end example
  4495.  
  4496. @findex ASM_GENERATE_INTERNAL_LABEL
  4497. @item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
  4498. A C statement to store into the string @var{string} a label whose name
  4499. is made from the string @var{prefix} and the number @var{num}.
  4500.  
  4501. This string, when output subsequently by @code{assemble_name}, should
  4502. produce the output that @code{ASM_OUTPUT_INTERNAL_LABEL} would produce
  4503. with the same @var{prefix} and @var{num}.
  4504.  
  4505. If the string begins with @samp{*}, then @code{assemble_name} will
  4506. output the rest of the string unchanged.  It is often convenient for
  4507. @code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way.  If the
  4508. string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets
  4509. to output the string, and may change it.  (Of course,
  4510. @code{ASM_OUTPUT_LABELREF} is also part of your machine description, so
  4511. you should know what it does on your machine.)
  4512.  
  4513. @findex ASM_FORMAT_PRIVATE_NAME
  4514. @item ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
  4515. A C expression to assign to @var{outvar} (which is a variable of type
  4516. @code{char *}) a newly allocated string made from the string
  4517. @var{name} and the number @var{number}, with some suitable punctuation
  4518. added.  Use @code{alloca} to get space for the string.
  4519.  
  4520. The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to
  4521. produce an assembler label for an internal static variable whose name is
  4522. @var{name}.  Therefore, the string must be such as to result in valid
  4523. assembler code.  The argument @var{number} is different each time this
  4524. macro is executed; it prevents conflicts between similarly-named
  4525. internal static variables in different scopes.
  4526.  
  4527. Ideally this string should not be a valid C identifier, to prevent any
  4528. conflict with the user's own symbols.  Most assemblers allow periods
  4529. or percent signs in assembler symbols; putting at least one of these
  4530. between the name and the number will suffice.
  4531.  
  4532. @findex OBJC_GEN_METHOD_LABEL
  4533. @item OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name})
  4534. Define this macro to override the default assembler names used for
  4535. Objective C methods.
  4536.  
  4537. The default name is a unique method number followed by the name of the
  4538. class (e.g.@: @samp{_1_Foo}).  For methods in categories, the name of
  4539. the category is also included in the assembler name (e.g.@:
  4540. @samp{_1_Foo_Bar}).
  4541.  
  4542. These names are safe on most systems, but make debugging difficult since
  4543. the method's selector is not present in the name.  Therefore, particular
  4544. systems define other ways of computing names.
  4545.  
  4546. @var{buf} is an expression of type @code{char *} which gives you a
  4547. buffer in which to store the name; its length is as long as
  4548. @var{class_name}, @var{cat_name} and @var{sel_name} put together, plus
  4549. 50 characters extra.
  4550.  
  4551. The argument @var{is_inst} specifies whether the method is an instance
  4552. method or a class method; @var{class_name} is the name of the class;
  4553. @var{cat_name} is the name of the category (or NULL if the method is not
  4554. in a category); and @var{sel_name} is the name of the selector.
  4555.  
  4556. On systems where the assembler can handle quoted names, you can use this
  4557. macro to provide more human-readable names.
  4558. @end table
  4559.  
  4560. @node Initialization
  4561. @subsection How Initialization Functions Are Handled
  4562. @cindex initialization routines
  4563. @cindex termination routines
  4564. @cindex constructors, output of
  4565. @cindex destructors, output of
  4566.  
  4567. The compiled code for certain languages includes @dfn{constructors}
  4568. (also called @dfn{initialization routines})---functions to initialize
  4569. data in the program when the program is started.  These functions need
  4570. to be called before the program is ``started''---that is to say, before
  4571. @code{main} is called.
  4572.  
  4573. Compiling some languages generates @dfn{destructors} (also called
  4574. @dfn{termination routines}) that should be called when the program
  4575. terminates.
  4576.  
  4577. To make the initialization and termination functions work, the compiler
  4578. must output something in the assembler code to cause those functions to
  4579. be called at the appropriate time.  When you port the compiler to a new
  4580. system, you need to specify how to do this.
  4581.  
  4582. There are two major ways that GCC currently supports the execution of
  4583. initialization and termination functions.  Each way has two variants.
  4584. Much of the structure is common to all four variations.
  4585.  
  4586. @findex __CTOR_LIST__
  4587. @findex __DTOR_LIST__
  4588. The linker must build two lists of these functions---a list of
  4589. initialization functions, called @code{__CTOR_LIST__}, and a list of
  4590. termination functions, called @code{__DTOR_LIST__}.
  4591.  
  4592. Each list always begins with an ignored function pointer (which may hold
  4593. 0, @minus{}1, or a count of the function pointers after it, depending on
  4594. the environment).  This is followed by a series of zero or more function
  4595. pointers to constructors (or destructors), followed by a function
  4596. pointer containing zero.
  4597.  
  4598. Depending on the operating system and its executable file format, either
  4599. @file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup
  4600. time and exit time.  Constructors are called in forward order of the
  4601. list; destructors in reverse order.
  4602.  
  4603. The best way to handle static constructors works only for object file
  4604. formats which provide arbitrarily-named sections.  A section is set
  4605. aside for a list of constructors, and another for a list of destructors.
  4606. Traditionally these are called @samp{.ctors} and @samp{.dtors}.  Each
  4607. object file that defines an initialization function also puts a word in
  4608. the constructor section to point to that function.  The linker
  4609. accumulates all these words into one contiguous @samp{.ctors} section.
  4610. Termination functions are handled similarly.
  4611.  
  4612. To use this method, you need appropriate definitions of the macros
  4613. @code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR}.  Usually
  4614. you can get them by including @file{svr4.h}.
  4615.  
  4616. When arbitrary sections are available, there are two variants, depending
  4617. upon how the code in @file{crtstuff.c} is called.  On systems that
  4618. support an @dfn{init} section which is executed at program startup,
  4619. parts of @file{crtstuff.c} are compiled into that section.  The
  4620. program is linked by the @code{gcc} driver like this:
  4621.  
  4622. @example
  4623. ld -o @var{output_file} crtbegin.o @dots{} crtend.o -lgcc
  4624. @end example
  4625.  
  4626. The head of a function (@code{__do_global_ctors}) appears in the init
  4627. section of @file{crtbegin.o}; the remainder of the function appears in
  4628. the init section of @file{crtend.o}.  The linker will pull these two
  4629. parts of the section together, making a whole function.  If any of the
  4630. user's object files linked into the middle of it contribute code, then that
  4631. code will be executed as part of the body of @code{__do_global_ctors}.
  4632.  
  4633. To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
  4634. macro properly.
  4635.  
  4636. If no init section is available, do not define
  4637. @code{INIT_SECTION_ASM_OP}.  Then @code{__do_global_ctors} is built into
  4638. the text section like all other functions, and resides in
  4639. @file{libgcc.a}.  When GCC compiles any function called @code{main}, it
  4640. inserts a procedure call to @code{__main} as the first executable code
  4641. after the function prologue.  The @code{__main} function, also defined
  4642. in @file{libgcc2.c}, simply calls @file{__do_global_ctors}.
  4643.  
  4644. In file formats that don't support arbitrary sections, there are again
  4645. two variants.  In the simplest variant, the GNU linker (GNU @code{ld})
  4646. and an `a.out' format must be used.  In this case,
  4647. @code{ASM_OUTPUT_CONSTRUCTOR} is defined to produce a @code{.stabs}
  4648. entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
  4649. and with the address of the void function containing the initialization
  4650. code as its value.  The GNU linker recognizes this as a request to add
  4651. the value to a ``set''; the values are accumulated, and are eventually
  4652. placed in the executable as a vector in the format described above, with
  4653. a leading (ignored) count and a trailing zero element.
  4654. @code{ASM_OUTPUT_DESTRUCTOR} is handled similarly.  Since no init
  4655. section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
  4656. the compilation of @code{main} to call @code{__main} as above, starting
  4657. the initialization process.
  4658.  
  4659. The last variant uses neither arbitrary sections nor the GNU linker.
  4660. This is preferable when you want to do dynamic linking and when using
  4661. file formats which the GNU linker does not support, such as `ECOFF'.  In
  4662. this case, @code{ASM_OUTPUT_CONSTRUCTOR} does not produce an
  4663. @code{N_SETT} symbol; initialization and termination functions are
  4664. recognized simply by their names.  This requires an extra program in the
  4665. linkage step, called @code{collect2}.  This program pretends to be the
  4666. linker, for use with GNU CC; it does its job by running the ordinary
  4667. linker, but also arranges to include the vectors of initialization and
  4668. termination functions.  These functions are called via @code{__main} as
  4669. described above.
  4670.  
  4671. Choosing among these configuration options has been simplified by a set
  4672. of operating-system-dependent files in the @file{config} subdirectory.
  4673. These files define all of the relevant parameters.  Usually it is
  4674. sufficient to include one into your specific machine-dependent
  4675. configuration file.  These files are:
  4676.  
  4677. @table @file
  4678. @item aoutos.h
  4679. For operating systems using the `a.out' format.
  4680.  
  4681. @item next.h
  4682. For operating systems using the `MachO' format.
  4683.  
  4684. @item svr3.h
  4685. For System V Release 3 and similar systems using `COFF' format.
  4686.  
  4687. @item svr4.h
  4688. For System V Release 4 and similar systems using `ELF' format.
  4689.  
  4690. @item vms.h
  4691. For the VMS operating system.
  4692. @end table
  4693.  
  4694. @ifinfo
  4695. The following section describes the specific macros that control and
  4696. customize the handling of initialization and termination functions.
  4697. @end ifinfo
  4698.  
  4699. @node Macros for Initialization
  4700. @subsection Macros Controlling Initialization Routines
  4701.  
  4702. Here are the macros that control how the compiler handles initialization
  4703. and termination functions:
  4704.  
  4705. @table @code
  4706. @findex INIT_SECTION_ASM_OP
  4707. @item INIT_SECTION_ASM_OP
  4708. If defined, a C string constant for the assembler operation to identify
  4709. the following data as initialization code.  If not defined, GNU CC will
  4710. assume such a section does not exist.  When you are using special
  4711. sections for initialization and termination functions, this macro also
  4712. controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to run the
  4713. initialization functions.
  4714.  
  4715. @item ASM_OUTPUT_CONSTRUCTOR (@var{stream}, @var{name})
  4716. @findex ASM_OUTPUT_CONSTRUCTOR
  4717. Define this macro as a C statement to output on the stream @var{stream}
  4718. the assembler code to arrange to call the function named @var{name} at
  4719. initialization time.
  4720.  
  4721. Assume that @var{name} is the name of a C function generated
  4722. automatically by the compiler.  This function takes no arguments.  Use
  4723. the function @code{assemble_name} to output the name @var{name}; this
  4724. performs any system-specific syntactic transformations such as adding an
  4725. underscore.
  4726.  
  4727. If you don't define this macro, nothing special is output to arrange to
  4728. call the function.  This is correct when the function will be called in
  4729. some other manner---for example, by means of the @code{collect2} program,
  4730. which looks through the symbol table to find these functions by their
  4731. names.
  4732.  
  4733. @item ASM_OUTPUT_DESTRUCTOR (@var{stream}, @var{name})
  4734. @findex ASM_OUTPUT_DESTRUCTOR
  4735. This is like @code{ASM_OUTPUT_CONSTRUCTOR} but used for termination
  4736. functions rather than initialization functions.
  4737. @end table
  4738.  
  4739. If your system uses @code{collect2} as the means of processing
  4740. constructors, then that program normally uses @code{nm} to scan an
  4741. object file for constructor functions to be called.  On certain kinds of
  4742. systems, you can define these macros to make @code{collect2} work faster
  4743. (and, in some cases, make it work at all):
  4744.  
  4745. @table @code
  4746. @findex OBJECT_FORMAT_COFF
  4747. @item OBJECT_FORMAT_COFF
  4748. Define this macro if the system uses COFF (Common Object File Format)
  4749. object files, so that @code{collect2} can assume this format and scan
  4750. object files directly for dynamic constructor/destructor functions.
  4751.  
  4752. @findex OBJECT_FORMAT_ROSE
  4753. @item OBJECT_FORMAT_ROSE
  4754. Define this macro if the system uses ROSE format object files, so that
  4755. @code{collect2} can assume this format and scan object files directly
  4756. for dynamic constructor/destructor functions.
  4757. @end table
  4758.  
  4759. These macros are effective only in a native compiler; @code{collect2} as
  4760. part of a cross compiler always uses @code{nm}.
  4761.  
  4762. @table @code
  4763. @findex REAL_NM_FILE_NAME
  4764. @item REAL_NM_FILE_NAME
  4765. Define this macro as a C string constant containing the file name to use
  4766. to execute @code{nm}.  The default is to search the path normally for
  4767. @code{nm}.
  4768. @end table
  4769.  
  4770. @node Instruction Output
  4771. @subsection Output of Assembler Instructions
  4772.  
  4773. @table @code
  4774. @findex REGISTER_NAMES
  4775. @item REGISTER_NAMES
  4776. A C initializer containing the assembler's names for the machine
  4777. registers, each one as a C string constant.  This is what translates
  4778. register numbers in the compiler into assembler language.
  4779.  
  4780. @findex ADDITIONAL_REGISTER_NAMES
  4781. @item ADDITIONAL_REGISTER_NAMES
  4782. If defined, a C initializer for an array of structures containing a name
  4783. and a register number.  This macro defines additional names for hard
  4784. registers, thus allowing the @code{asm} option in declarations to refer
  4785. to registers using alternate names.
  4786.  
  4787. @findex ASM_OUTPUT_OPCODE
  4788. @item ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
  4789. Define this macro if you are using an unusual assembler that
  4790. requires different names for the machine instructions.
  4791.  
  4792. The definition is a C statement or statements which output an
  4793. assembler instruction opcode to the stdio stream @var{stream}.  The
  4794. macro-operand @var{ptr} is a variable of type @code{char *} which
  4795. points to the opcode name in its ``internal'' form---the form that is
  4796. written in the machine description.  The definition should output the
  4797. opcode name to @var{stream}, performing any translation you desire, and
  4798. increment the variable @var{ptr} to point at the end of the opcode
  4799. so that it will not be output twice.
  4800.  
  4801. In fact, your macro definition may process less than the entire opcode
  4802. name, or more than the opcode name; but if you want to process text
  4803. that includes @samp{%}-sequences to substitute operands, you must take
  4804. care of the substitution yourself.  Just be sure to increment
  4805. @var{ptr} over whatever text should not be output normally.
  4806.  
  4807. @findex recog_operand
  4808. If you need to look at the operand values, they can be found as the
  4809. elements of @code{recog_operand}.
  4810.  
  4811. If the macro definition does nothing, the instruction is output
  4812. in the usual way.
  4813.  
  4814. @findex FINAL_PRESCAN_INSN
  4815. @item FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
  4816. If defined, a C statement to be executed just prior to the output of
  4817. assembler code for @var{insn}, to modify the extracted operands so
  4818. they will be output differently.
  4819.  
  4820. Here the argument @var{opvec} is the vector containing the operands
  4821. extracted from @var{insn}, and @var{noperands} is the number of
  4822. elements of the vector which contain meaningful data for this insn.
  4823. The contents of this vector are what will be used to convert the insn
  4824. template into assembler code, so you can change the assembler output
  4825. by changing the contents of the vector.
  4826.  
  4827. This macro is useful when various assembler syntaxes share a single
  4828. file of instruction patterns; by defining this macro differently, you
  4829. can cause a large class of instructions to be output differently (such
  4830. as with rearranged operands).  Naturally, variations in assembler
  4831. syntax affecting individual insn patterns ought to be handled by
  4832. writing conditional output routines in those patterns.
  4833.  
  4834. If this macro is not defined, it is equivalent to a null statement.
  4835.  
  4836. @findex PRINT_OPERAND
  4837. @item PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
  4838. A C compound statement to output to stdio stream @var{stream} the
  4839. assembler syntax for an instruction operand @var{x}.  @var{x} is an
  4840. RTL expression.
  4841.  
  4842. @var{code} is a value that can be used to specify one of several ways
  4843. of printing the operand.  It is used when identical operands must be
  4844. printed differently depending on the context.  @var{code} comes from
  4845. the @samp{%} specification that was used to request printing of the
  4846. operand.  If the specification was just @samp{%@var{digit}} then
  4847. @var{code} is 0; if the specification was @samp{%@var{ltr}
  4848. @var{digit}} then @var{code} is the ASCII code for @var{ltr}.
  4849.  
  4850. @findex reg_names
  4851. If @var{x} is a register, this macro should print the register's name.
  4852. The names can be found in an array @code{reg_names} whose type is
  4853. @code{char *[]}.  @code{reg_names} is initialized from
  4854. @code{REGISTER_NAMES}.
  4855.  
  4856. When the machine description has a specification @samp{%@var{punct}}
  4857. (a @samp{%} followed by a punctuation character), this macro is called
  4858. with a null pointer for @var{x} and the punctuation character for
  4859. @var{code}.
  4860.  
  4861. @findex PRINT_OPERAND_PUNCT_VALID_P
  4862. @item PRINT_OPERAND_PUNCT_VALID_P (@var{code})
  4863. A C expression which evaluates to true if @var{code} is a valid
  4864. punctuation character for use in the @code{PRINT_OPERAND} macro.  If
  4865. @code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
  4866. punctuation characters (except for the standard one, @samp{%}) are used
  4867. in this way.
  4868.  
  4869. @findex PRINT_OPERAND_ADDRESS
  4870. @item PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
  4871. A C compound statement to output to stdio stream @var{stream} the
  4872. assembler syntax for an instruction operand that is a memory reference
  4873. whose address is @var{x}.  @var{x} is an RTL expression.
  4874.  
  4875. @cindex @code{ENCODE_SECTION_INFO} usage
  4876. On some machines, the syntax for a symbolic address depends on the
  4877. section that the address refers to.  On these machines, define the macro
  4878. @code{ENCODE_SECTION_INFO} to store the information into the
  4879. @code{symbol_ref}, and then check for it here.  @xref{Assembler Format}.
  4880.  
  4881. @findex DBR_OUTPUT_SEQEND
  4882. @findex dbr_sequence_length
  4883. @item DBR_OUTPUT_SEQEND(@var{file})
  4884. A C statement, to be executed after all slot-filler instructions have
  4885. been output.  If necessary, call @code{dbr_sequence_length} to
  4886. determine the number of slots filled in a sequence (zero if not
  4887. currently outputting a sequence), to decide how many no-ops to output,
  4888. or whatever.
  4889.  
  4890. Don't define this macro if it has nothing to do, but it is helpful in
  4891. reading assembly output if the extent of the delay sequence is made
  4892. explicit (e.g. with white space).
  4893.  
  4894. @findex final_sequence
  4895. Note that output routines for instructions with delay slots must be
  4896. prepared to deal with not being output as part of a sequence (i.e.
  4897. when the scheduling pass is not run, or when no slot fillers could be
  4898. found.)  The variable @code{final_sequence} is null when not
  4899. processing a sequence, otherwise it contains the @code{sequence} rtx
  4900. being output.
  4901.  
  4902. @findex REGISTER_PREFIX
  4903. @findex LOCAL_LABEL_PREFIX
  4904. @findex USER_LABEL_PREFIX
  4905. @findex IMMEDIATE_PREFIX
  4906. @findex asm_fprintf
  4907. @item REGISTER_PREFIX
  4908. @itemx LOCAL_LABEL_PREFIX
  4909. @itemx USER_LABEL_PREFIX
  4910. @itemx IMMEDIATE_PREFIX
  4911. If defined, C string expressions to be used for the @samp{%R}, @samp{%L},
  4912. @samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see
  4913. @file{final.c}).  These are useful when a single @file{md} file must
  4914. support multiple assembler formats.  In that case, the various @file{tm.h}
  4915. files can define these macros differently.
  4916.  
  4917. @findex ASM_OUTPUT_REG_PUSH
  4918. @item ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
  4919. A C expression to output to @var{stream} some assembler code
  4920. which will push hard register number @var{regno} onto the stack.
  4921. The code need not be optimal, since this macro is used only when
  4922. profiling.
  4923.  
  4924. @findex ASM_OUTPUT_REG_POP
  4925. @item ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
  4926. A C expression to output to @var{stream} some assembler code
  4927. which will pop hard register number @var{regno} off of the stack.
  4928. The code need not be optimal, since this macro is used only when
  4929. profiling.
  4930. @end table
  4931.  
  4932. @node Dispatch Tables
  4933. @subsection Output of Dispatch Tables
  4934.  
  4935. @table @code
  4936. @cindex dispatch table
  4937. @findex ASM_OUTPUT_ADDR_DIFF_ELT
  4938. @item ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{value}, @var{rel})
  4939. This macro should be provided on machines where the addresses
  4940. in a dispatch table are relative to the table's own address.
  4941.  
  4942. The definition should be a C statement to output to the stdio stream
  4943. @var{stream} an assembler pseudo-instruction to generate a difference
  4944. between two labels.  @var{value} and @var{rel} are the numbers of two
  4945. internal labels.  The definitions of these labels are output using
  4946. @code{ASM_OUTPUT_INTERNAL_LABEL}, and they must be printed in the same
  4947. way here.  For example,
  4948.  
  4949. @example
  4950. fprintf (@var{stream}, "\t.word L%d-L%d\n",
  4951.          @var{value}, @var{rel})
  4952. @end example
  4953.  
  4954. @findex ASM_OUTPUT_ADDR_VEC_ELT
  4955. @item ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
  4956. This macro should be provided on machines where the addresses
  4957. in a dispatch table are absolute.
  4958.  
  4959. The definition should be a C statement to output to the stdio stream
  4960. @var{stream} an assembler pseudo-instruction to generate a reference to
  4961. a label.  @var{value} is the number of an internal label whose
  4962. definition is output using @code{ASM_OUTPUT_INTERNAL_LABEL}.
  4963. For example,
  4964.  
  4965. @example
  4966. fprintf (@var{stream}, "\t.word L%d\n", @var{value})
  4967. @end example
  4968.  
  4969. @findex ASM_OUTPUT_CASE_LABEL
  4970. @item ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
  4971. Define this if the label before a jump-table needs to be output
  4972. specially.  The first three arguments are the same as for
  4973. @code{ASM_OUTPUT_INTERNAL_LABEL}; the fourth argument is the
  4974. jump-table which follows (a @code{jump_insn} containing an
  4975. @code{addr_vec} or @code{addr_diff_vec}).
  4976.  
  4977. This feature is used on system V to output a @code{swbeg} statement
  4978. for the table.
  4979.  
  4980. If this macro is not defined, these labels are output with
  4981. @code{ASM_OUTPUT_INTERNAL_LABEL}.
  4982.  
  4983. @findex ASM_OUTPUT_CASE_END
  4984. @item ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
  4985. Define this if something special must be output at the end of a
  4986. jump-table.  The definition should be a C statement to be executed
  4987. after the assembler code for the table is written.  It should write
  4988. the appropriate code to stdio stream @var{stream}.  The argument
  4989. @var{table} is the jump-table insn, and @var{num} is the label-number
  4990. of the preceding label.
  4991.  
  4992. If this macro is not defined, nothing special is output at the end of
  4993. the jump-table.
  4994. @end table
  4995.  
  4996. @node Alignment Output
  4997. @subsection Assembler Commands for Alignment
  4998.  
  4999. @table @code
  5000. @findex ASM_OUTPUT_ALIGN_CODE
  5001. @item ASM_OUTPUT_ALIGN_CODE (@var{file})
  5002. A C expression to output text to align the location counter in the way
  5003. that is desirable at a point in the code that is reached only by
  5004. jumping.
  5005.  
  5006. This macro need not be defined if you don't want any special alignment
  5007. to be done at such a time.  Most machine descriptions do not currently
  5008. define the macro.
  5009.  
  5010. @findex ASM_OUTPUT_LOOP_ALIGN
  5011. @item ASM_OUTPUT_LOOP_ALIGN (@var{file})
  5012. A C expression to output text to align the location counter in the way
  5013. that is desirable at the beginning of a loop.
  5014.  
  5015. This macro need not be defined if you don't want any special alignment
  5016. to be done at such a time.  Most machine descriptions do not currently
  5017. define the macro.
  5018.  
  5019. @findex ASM_OUTPUT_SKIP
  5020. @item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
  5021. A C statement to output to the stdio stream @var{stream} an assembler
  5022. instruction to advance the location counter by @var{nbytes} bytes.
  5023. Those bytes should be zero when loaded.  @var{nbytes} will be a C
  5024. expression of type @code{int}.
  5025.  
  5026. @findex ASM_NO_SKIP_IN_TEXT
  5027. @item ASM_NO_SKIP_IN_TEXT
  5028. Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the
  5029. text section because it fails put zeros in the bytes that are skipped.
  5030. This is true on many Unix systems, where the pseudo--op to skip bytes
  5031. produces no-op instructions rather than zeros when used in the text
  5032. section.
  5033.  
  5034. @findex ASM_OUTPUT_ALIGN
  5035. @item ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
  5036. A C statement to output to the stdio stream @var{stream} an assembler
  5037. command to advance the location counter to a multiple of 2 to the
  5038. @var{power} bytes.  @var{power} will be a C expression of type @code{int}.
  5039. @end table
  5040.  
  5041. @node Debugging Info
  5042. @section Controlling Debugging Information Format
  5043. @c this should have some text in here....  --mew 10feb93
  5044.  
  5045. @menu
  5046. * All Debuggers::      Macros that affect all debugging formats uniformly.
  5047. * DBX Options::        Macros enabling specific options in DBX format.
  5048. * DBX Hooks::          Hook macros for varying DBX format.
  5049. * File Names and DBX:: Macros controlling output of file names in DBX format.
  5050. * SDB and DWARF::      Macros for SDB (COFF) and DWARF formats.
  5051. @end menu
  5052.  
  5053. @node All Debuggers
  5054. @subsection Macros Affecting All Debugging Formats
  5055.  
  5056. @table @code
  5057. @findex DBX_REGISTER_NUMBER
  5058. @item DBX_REGISTER_NUMBER (@var{regno})
  5059. A C expression that returns the DBX register number for the compiler
  5060. register number @var{regno}.  In simple cases, the value of this
  5061. expression may be @var{regno} itself.  But sometimes there are some
  5062. registers that the compiler knows about and DBX does not, or vice
  5063. versa.  In such cases, some register may need to have one number in
  5064. the compiler and another for DBX.
  5065.  
  5066. If two registers have consecutive numbers inside GNU CC, and they can be
  5067. used as a pair to hold a multiword value, then they @emph{must} have
  5068. consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.
  5069. Otherwise, debuggers will be unable to access such a pair, because they
  5070. expect register pairs to be consecutive in their own numbering scheme.
  5071.  
  5072. If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that
  5073. does not preserve register pairs, then what you must do instead is
  5074. redefine the actual register numbering scheme.
  5075.  
  5076. @findex DEBUGGER_AUTO_OFFSET
  5077. @item DEBUGGER_AUTO_OFFSET (@var{x})
  5078. A C expression that returns the integer offset value for an automatic
  5079. variable having address @var{x} (an RTL expression).  The default
  5080. computation assumes that @var{x} is based on the frame-pointer and
  5081. gives the offset from the frame-pointer.  This is required for targets
  5082. that produce debugging output for DBX or COFF-style debugging output
  5083. for SDB and allow the frame-pointer to be eliminated when the
  5084. @samp{-g} options is used.
  5085.  
  5086. @findex DEBUGGER_ARG_OFFSET
  5087. @item DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})
  5088. A C expression that returns the integer offset value for an argument
  5089. having address @var{x} (an RTL expression).  The nominal offset is
  5090. @var{offset}.
  5091. @end table
  5092.  
  5093. @node DBX Options
  5094. @subsection Specific Options for DBX Output
  5095.  
  5096. @table @code
  5097. @findex DBX_DEBUGGING_INFO
  5098. @item DBX_DEBUGGING_INFO
  5099. Define this macro if GNU CC should produce debugging output for DBX
  5100. in response to the @samp{-g} option.
  5101.  
  5102. @findex XCOFF_DEBUGGING_INFO
  5103. @item XCOFF_DEBUGGING_INFO
  5104. Define this macro if GNU CC should produce XCOFF format debugging output
  5105. in response to the @samp{-g} option.  This is a variant of DBX format.
  5106.  
  5107. @findex DEFAULT_GDB_EXTENSIONS
  5108. @item DEFAULT_GDB_EXTENSIONS
  5109. Define this macro to control whether GNU CC should by default generate
  5110. GDB's extended version of DBX debugging information (assuming DBX-format
  5111. debugging information is enabled at all).  If you don't define the
  5112. macro, the default is 1: always generate the extended information
  5113. if there is any occasion to.
  5114.  
  5115. @findex DEBUG_SYMS_TEXT
  5116. @item DEBUG_SYMS_TEXT
  5117. Define this macro if all @code{.stabs} commands should be output while
  5118. in the text section.
  5119.  
  5120. @findex ASM_STABS_OP
  5121. @item ASM_STABS_OP
  5122. A C string constant naming the assembler pseudo op to use instead of
  5123. @code{.stabs} to define an ordinary debugging symbol.  If you don't
  5124. define this macro, @code{.stabs} is used.  This macro applies only to
  5125. DBX debugging information format.
  5126.  
  5127. @findex ASM_STABD_OP
  5128. @item ASM_STABD_OP
  5129. A C string constant naming the assembler pseudo op to use instead of
  5130. @code{.stabd} to define a debugging symbol whose value is the current
  5131. location.  If you don't define this macro, @code{.stabd} is used.
  5132. This macro applies only to DBX debugging information format.
  5133.  
  5134. @findex ASM_STABN_OP
  5135. @item ASM_STABN_OP
  5136. A C string constant naming the assembler pseudo op to use instead of
  5137. @code{.stabn} to define a debugging symbol with no name.  If you don't
  5138. define this macro, @code{.stabn} is used.  This macro applies only to
  5139. DBX debugging information format.
  5140.  
  5141. @findex DBX_NO_XREFS
  5142. @item DBX_NO_XREFS
  5143. Define this macro if DBX on your system does not support the construct
  5144. @samp{xs@var{tagname}}.  On some systems, this construct is used to
  5145. describe a forward reference to a structure named @var{tagname}.
  5146. On other systems, this construct is not supported at all.
  5147.  
  5148. @findex DBX_CONTIN_LENGTH
  5149. @item DBX_CONTIN_LENGTH
  5150. A symbol name in DBX-format debugging information is normally
  5151. continued (split into two separate @code{.stabs} directives) when it
  5152. exceeds a certain length (by default, 80 characters).  On some
  5153. operating systems, DBX requires this splitting; on others, splitting
  5154. must not be done.  You can inhibit splitting by defining this macro
  5155. with the value zero.  You can override the default splitting-length by
  5156. defining this macro as an expression for the length you desire.
  5157.  
  5158. @findex DBX_CONTIN_CHAR
  5159. @item DBX_CONTIN_CHAR
  5160. Normally continuation is indicated by adding a @samp{\} character to
  5161. the end of a @code{.stabs} string when a continuation follows.  To use
  5162. a different character instead, define this macro as a character
  5163. constant for the character you want to use.  Do not define this macro
  5164. if backslash is correct for your system.
  5165.  
  5166. @findex DBX_STATIC_STAB_DATA_SECTION
  5167. @item DBX_STATIC_STAB_DATA_SECTION
  5168. Define this macro if it is necessary to go to the data section before
  5169. outputting the @samp{.stabs} pseudo-op for a non-global static
  5170. variable.
  5171.  
  5172. @findex DBX_TYPE_DECL_STABS_CODE
  5173. @item DBX_TYPE_DECL_STABS_CODE
  5174. The value to use in the ``code'' field of the @code{.stabs} directive
  5175. for a typedef.  The default is @code{N_LSYM}.
  5176.  
  5177. @findex DBX_STATIC_CONST_VAR_CODE
  5178. @item DBX_STATIC_CONST_VAR_CODE
  5179. The value to use in the ``code'' field of the @code{.stabs} directive
  5180. for a static variable located in the text section.  DBX format does not
  5181. provide any ``right'' way to do this.  The default is @code{N_FUN}.
  5182.  
  5183. @findex DBX_REGPARM_STABS_CODE
  5184. @item DBX_REGPARM_STABS_CODE
  5185. The value to use in the ``code'' field of the @code{.stabs} directive
  5186. for a parameter passed in registers.  DBX format does not provide any
  5187. ``right'' way to do this.  The default is @code{N_RSYM}.
  5188.  
  5189. @findex DBX_REGPARM_STABS_LETTER
  5190. @item DBX_REGPARM_STABS_LETTER
  5191. The letter to use in DBX symbol data to identify a symbol as a parameter
  5192. passed in registers.  DBX format does not customarily provide any way to
  5193. do this.  The default is @code{'P'}.
  5194.  
  5195. @findex DBX_MEMPARM_STABS_LETTER
  5196. @item DBX_MEMPARM_STABS_LETTER
  5197. The letter to use in DBX symbol data to identify a symbol as a stack
  5198. parameter.  The default is @code{'p'}.
  5199.  
  5200. @findex DBX_FUNCTION_FIRST
  5201. @item DBX_FUNCTION_FIRST
  5202. Define this macro if the DBX information for a function and its
  5203. arguments should precede the assembler code for the function.  Normally,
  5204. in DBX format, the debugging information entirely follows the assembler
  5205. code.
  5206.  
  5207. @findex DBX_LBRAC_FIRST
  5208. @item DBX_LBRAC_FIRST
  5209. Define this macro if the @code{N_LBRAC} symbol for a block should
  5210. precede the debugging information for variables and functions defined in
  5211. that block.  Normally, in DBX format, the @code{N_LBRAC} symbol comes
  5212. first.
  5213. @end table
  5214.  
  5215. @node DBX Hooks
  5216. @subsection Open-Ended Hooks for DBX Format
  5217.  
  5218. @table @code
  5219. @findex DBX_OUTPUT_LBRAC
  5220. @item DBX_OUTPUT_LBRAC (@var{stream}, @var{name})
  5221. Define this macro to say how to output to @var{stream} the debugging
  5222. information for the start of a scope level for variable names.  The
  5223. argument @var{name} is the name of an assembler symbol (for use with
  5224. @code{assemble_name}) whose value is the address where the scope begins.
  5225.  
  5226. @findex DBX_OUTPUT_RBRAC
  5227. @item DBX_OUTPUT_RBRAC (@var{stream}, @var{name})
  5228. Like @code{DBX_OUTPUT_LBRAC}, but for the end of a scope level.
  5229.  
  5230. @findex DBX_OUTPUT_ENUM
  5231. @item DBX_OUTPUT_ENUM (@var{stream}, @var{type})
  5232. Define this macro if the target machine requires special handling to
  5233. output an enumeration type.  The definition should be a C statement
  5234. (sans semicolon) to output the appropriate information to @var{stream}
  5235. for the type @var{type}.
  5236.  
  5237. @findex DBX_OUTPUT_FUNCTION_END
  5238. @item DBX_OUTPUT_FUNCTION_END (@var{stream}, @var{function})
  5239. Define this macro if the target machine requires special output at the
  5240. end of the debugging information for a function.  The definition should
  5241. be a C statement (sans semicolon) to output the appropriate information
  5242. to @var{stream}.  @var{function} is the @code{FUNCTION_DECL} node for
  5243. the function.
  5244.  
  5245. @findex DBX_OUTPUT_STANDARD_TYPES
  5246. @item DBX_OUTPUT_STANDARD_TYPES (@var{syms})
  5247. Define this macro if you need to control the order of output of the
  5248. standard data types at the beginning of compilation.  The argument
  5249. @var{syms} is a @code{tree} which is a chain of all the predefined
  5250. global symbols, including names of data types.
  5251.  
  5252. Normally, DBX output starts with definitions of the types for integers
  5253. and characters, followed by all the other predefined types of the
  5254. particular language in no particular order.
  5255.  
  5256. On some machines, it is necessary to output different particular types
  5257. first.  To do this, define @code{DBX_OUTPUT_STANDARD_TYPES} to output
  5258. those symbols in the necessary order.  Any predefined types that you
  5259. don't explicitly output will be output afterward in no particular order.
  5260.  
  5261. Be careful not to define this macro so that it works only for C.  There
  5262. are no global variables to access most of the built-in types, because
  5263. another language may have another set of types.  The way to output a
  5264. particular type is to look through @var{syms} to see if you can find it.
  5265. Here is an example:
  5266.  
  5267. @smallexample
  5268. @{
  5269.   tree decl;
  5270.   for (decl = syms; decl; decl = TREE_CHAIN (decl))
  5271.     if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
  5272.                  "long int"))
  5273.       dbxout_symbol (decl);
  5274.   @dots{}
  5275. @}
  5276. @end smallexample
  5277.  
  5278. @noindent
  5279. This does nothing if the expected type does not exist.
  5280.  
  5281. See the function @code{init_decl_processing} in @file{c-decl.c} to find
  5282. the names to use for all the built-in C types.
  5283.  
  5284. Here is another way of finding a particular type:
  5285.  
  5286. @c this is still overfull.  --mew 10feb93
  5287. @smallexample
  5288. @{
  5289.   tree decl;
  5290.   for (decl = syms; decl; decl = TREE_CHAIN (decl))
  5291.     if (TREE_CODE (decl) == TYPE_DECL
  5292.         && (TREE_CODE (TREE_TYPE (decl))
  5293.             == INTEGER_CST)
  5294.         && TYPE_PRECISION (TREE_TYPE (decl)) == 16
  5295.         && TYPE_UNSIGNED (TREE_TYPE (decl)))
  5296.       /* @r{This must be @code{unsigned short}.}  */
  5297.       dbxout_symbol (decl);
  5298.   @dots{}
  5299. @}
  5300. @end smallexample
  5301. @end table
  5302.  
  5303. @node File Names and DBX
  5304. @subsection File Names in DBX Format
  5305.  
  5306. @table @code
  5307. @findex DBX_WORKING_DIRECTORY
  5308. @item DBX_WORKING_DIRECTORY
  5309. Define this if DBX wants to have the current directory recorded in each
  5310. object file.
  5311.  
  5312. Note that the working directory is always recorded if GDB extensions are
  5313. enabled.
  5314.  
  5315. @findex DBX_OUTPUT_MAIN_SOURCE_FILENAME
  5316. @item DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name})
  5317. A C statement to output DBX debugging information to the stdio stream
  5318. @var{stream} which indicates that file @var{name} is the main source
  5319. file---the file specified as the input file for compilation.
  5320. This macro is called only once, at the beginning of compilation.
  5321.  
  5322. This macro need not be defined if the standard form of output
  5323. for DBX debugging information is appropriate.
  5324.  
  5325. @findex DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
  5326. @item DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (@var{stream}, @var{name})
  5327. A C statement to output DBX debugging information to the stdio stream
  5328. @var{stream} which indicates that the current directory during
  5329. compilation is named @var{name}.
  5330.  
  5331. This macro need not be defined if the standard form of output
  5332. for DBX debugging information is appropriate.
  5333.  
  5334. @findex DBX_OUTPUT_MAIN_SOURCE_FILE_END
  5335. @item DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name})
  5336. A C statement to output DBX debugging information at the end of
  5337. compilation of the main source file @var{name}.
  5338.  
  5339. If you don't define this macro, nothing special is output at the end
  5340. of compilation, which is correct for most machines.
  5341.  
  5342. @findex DBX_OUTPUT_SOURCE_FILENAME
  5343. @item DBX_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
  5344. A C statement to output DBX debugging information to the stdio stream
  5345. @var{stream} which indicates that file @var{name} is the current source
  5346. file.  This output is generated each time input shifts to a different
  5347. source file as a result of @samp{#include}, the end of an included file,
  5348. or a @samp{#line} command.
  5349.  
  5350. This macro need not be defined if the standard form of output
  5351. for DBX debugging information is appropriate.
  5352. @end table
  5353.  
  5354. @node SDB and DWARF
  5355. @subsection Macros for SDB and DWARF Output
  5356.  
  5357. @table @code
  5358. @findex SDB_DEBUGGING_INFO
  5359. @item SDB_DEBUGGING_INFO
  5360. Define this macro if GNU CC should produce COFF-style debugging output
  5361. for SDB in response to the @samp{-g} option.
  5362.  
  5363. @findex DWARF_DEBUGGING_INFO
  5364. @item DWARF_DEBUGGING_INFO
  5365. Define this macro if GNU CC should produce dwarf format debugging output 
  5366. in response to the @samp{-g} option.
  5367.  
  5368. @findex PUT_SDB_@dots{}
  5369. @item PUT_SDB_@dots{}
  5370. Define these macros to override the assembler syntax for the special
  5371. SDB assembler directives.  See @file{sdbout.c} for a list of these
  5372. macros and their arguments.  If the standard syntax is used, you need
  5373. not define them yourself.
  5374.  
  5375. @findex SDB_DELIM
  5376. @item SDB_DELIM
  5377. Some assemblers do not support a semicolon as a delimiter, even between
  5378. SDB assembler directives.  In that case, define this macro to be the
  5379. delimiter to use (usually @samp{\n}).  It is not necessary to define
  5380. a new set of @code{PUT_SDB_@var{op}} macros if this is the only change
  5381. required.
  5382.  
  5383. @findex SDB_GENERATE_FAKE
  5384. @item SDB_GENERATE_FAKE
  5385. Define this macro to override the usual method of constructing a dummy
  5386. name for anonymous structure and union types.  See @file{sdbout.c} for
  5387. more information.
  5388.  
  5389. @findex SDB_ALLOW_UNKNOWN_REFERENCES
  5390. @item SDB_ALLOW_UNKNOWN_REFERENCES
  5391. Define this macro to allow references to unknown structure,
  5392. union, or enumeration tags to be emitted.  Standard COFF does not
  5393. allow handling of unknown references, MIPS ECOFF has support for
  5394. it.
  5395.  
  5396. @findex SDB_ALLOW_FORWARD_REFERENCES
  5397. @item SDB_ALLOW_FORWARD_REFERENCES
  5398. Define this macro to allow references to structure, union, or
  5399. enumeration tags that have not yet been seen to be handled.  Some
  5400. assemblers choke if forward tags are used, while some require it.
  5401. @end table
  5402.  
  5403. @node Cross-compilation
  5404. @section Cross Compilation and Floating Point Format
  5405. @cindex cross compilation and floating point 
  5406. @cindex floating point format and cross compilation
  5407.  
  5408. While all modern machines use 2's complement representation for integers,
  5409. there are a variety of representations for floating point numbers.  This
  5410. means that in a cross-compiler the representation of floating point numbers
  5411. in the compiled program may be different from that used in the machine
  5412. doing the compilation.
  5413.  
  5414. @findex atof
  5415. Because different representation systems may offer different amounts of
  5416. range and precision, the cross compiler cannot safely use the host
  5417. machine's floating point arithmetic.  Therefore, floating point constants
  5418. must be represented in the target machine's format.  This means that the
  5419. cross compiler cannot use @code{atof} to parse a floating point constant;
  5420. it must have its own special routine to use instead.  Also, constant
  5421. folding must emulate the target machine's arithmetic (or must not be done
  5422. at all).
  5423.  
  5424. The macros in the following table should be defined only if you are cross
  5425. compiling between different floating point formats.
  5426.  
  5427. Otherwise, don't define them.  Then default definitions will be set up which
  5428. use @code{double} as the data type, @code{==} to test for equality, etc.
  5429.  
  5430. You don't need to worry about how many times you use an operand of any
  5431. of these macros.  The compiler never uses operands which have side effects.
  5432.  
  5433. @table @code
  5434. @findex REAL_VALUE_TYPE
  5435. @item REAL_VALUE_TYPE
  5436. A macro for the C data type to be used to hold a floating point value
  5437. in the target machine's format.  Typically this would be a
  5438. @code{struct} containing an array of @code{int}.
  5439.  
  5440. @findex REAL_VALUES_EQUAL
  5441. @item REAL_VALUES_EQUAL (@var{x}, @var{y})
  5442. A macro for a C expression which compares for equality the two values,
  5443. @var{x} and @var{y}, both of type @code{REAL_VALUE_TYPE}.
  5444.  
  5445. @findex REAL_VALUES_LESS
  5446. @item REAL_VALUES_LESS (@var{x}, @var{y})
  5447. A macro for a C expression which tests whether @var{x} is less than
  5448. @var{y}, both values being of type @code{REAL_VALUE_TYPE} and
  5449. interpreted as floating point numbers in the target machine's
  5450. representation.
  5451.  
  5452. @findex REAL_VALUE_LDEXP
  5453. @findex ldexp
  5454. @item REAL_VALUE_LDEXP (@var{x}, @var{scale})
  5455. A macro for a C expression which performs the standard library
  5456. function @code{ldexp}, but using the target machine's floating point
  5457. representation.  Both @var{x} and the value of the expression have
  5458. type @code{REAL_VALUE_TYPE}.  The second argument, @var{scale}, is an
  5459. integer.
  5460.  
  5461. @findex REAL_VALUE_FIX
  5462. @item REAL_VALUE_FIX (@var{x})
  5463. A macro whose definition is a C expression to convert the target-machine
  5464. floating point value @var{x} to a signed integer.  @var{x} has type
  5465. @code{REAL_VALUE_TYPE}.
  5466.  
  5467. @findex REAL_VALUE_UNSIGNED_FIX
  5468. @item REAL_VALUE_UNSIGNED_FIX (@var{x})
  5469. A macro whose definition is a C expression to convert the target-machine
  5470. floating point value @var{x} to an unsigned integer.  @var{x} has type
  5471. @code{REAL_VALUE_TYPE}.
  5472.  
  5473. @findex REAL_VALUE_RNDZINT
  5474. @item REAL_VALUE_RNDZINT (@var{x})
  5475. A macro whose definition is a C expression to round the target-machine
  5476. floating point value @var{x} towards zero to an integer value (but still
  5477. as a floating point number).  @var{x} has type @code{REAL_VALUE_TYPE},
  5478. and so does the value.
  5479.  
  5480. @findex REAL_VALUE_UNSIGNED_RNDZINT
  5481. @item REAL_VALUE_UNSIGNED_RNDZINT (@var{x})
  5482. A macro whose definition is a C expression to round the target-machine
  5483. floating point value @var{x} towards zero to an unsigned integer value
  5484. (but still represented as a floating point number).  @var{x} has type
  5485. @code{REAL_VALUE_TYPE}, and so does the value.
  5486.  
  5487. @findex REAL_VALUE_ATOF
  5488. @item REAL_VALUE_ATOF (@var{string}, @var{mode})
  5489. A macro for a C expression which converts @var{string}, an expression of
  5490. type @code{char *}, into a floating point number in the target machine's
  5491. representation for mode @var{mode}.  The value has type
  5492. @code{REAL_VALUE_TYPE}.
  5493.  
  5494. @findex REAL_INFINITY
  5495. @item REAL_INFINITY
  5496. Define this macro if infinity is a possible floating point value, and
  5497. therefore division by 0 is legitimate.
  5498.  
  5499. @findex REAL_VALUE_ISINF
  5500. @findex isinf
  5501. @item REAL_VALUE_ISINF (@var{x})
  5502. A macro for a C expression which determines whether @var{x}, a floating
  5503. point value, is infinity.  The value has type @code{int}.
  5504. By default, this is defined to call @code{isinf}.
  5505.  
  5506. @findex REAL_VALUE_ISNAN
  5507. @findex isnan
  5508. @item REAL_VALUE_ISNAN (@var{x})
  5509. A macro for a C expression which determines whether @var{x}, a floating
  5510. point value, is a ``nan'' (not-a-number).  The value has type
  5511. @code{int}.  By default, this is defined to call @code{isnan}.
  5512. @end table
  5513.  
  5514. @cindex constant folding and floating point
  5515. Define the following additional macros if you want to make floating
  5516. point constant folding work while cross compiling.  If you don't
  5517. define them, cross compilation is still possible, but constant folding
  5518. will not happen for floating point values.
  5519.  
  5520. @table @code
  5521. @findex REAL_ARITHMETIC
  5522. @item REAL_ARITHMETIC (@var{output}, @var{code}, @var{x}, @var{y})
  5523. A macro for a C statement which calculates an arithmetic operation of
  5524. the two floating point values @var{x} and @var{y}, both of type
  5525. @code{REAL_VALUE_TYPE} in the target machine's representation, to
  5526. produce a result of the same type and representation which is stored
  5527. in @var{output} (which will be a variable).
  5528.  
  5529. The operation to be performed is specified by @var{code}, a tree code
  5530. which will always be one of the following: @code{PLUS_EXPR},
  5531. @code{MINUS_EXPR}, @code{MULT_EXPR}, @code{RDIV_EXPR},
  5532. @code{MAX_EXPR}, @code{MIN_EXPR}.@refill
  5533.  
  5534. @cindex overflow while constant folding
  5535. The expansion of this macro is responsible for checking for overflow.
  5536. If overflow happens, the macro expansion should execute the statement
  5537. @code{return 0;}, which indicates the inability to perform the
  5538. arithmetic operation requested.
  5539.  
  5540. @findex REAL_VALUE_NEGATE
  5541. @item REAL_VALUE_NEGATE (@var{x})
  5542. A macro for a C expression which returns the negative of the floating
  5543. point value @var{x}.  Both @var{x} and the value of the expression
  5544. have type @code{REAL_VALUE_TYPE} and are in the target machine's
  5545. floating point representation.
  5546.  
  5547. There is no way for this macro to report overflow, since overflow
  5548. can't happen in the negation operation.
  5549.  
  5550. @findex REAL_VALUE_TRUNCATE
  5551. @item REAL_VALUE_TRUNCATE (@var{mode}, @var{x})
  5552. A macro for a C expression which converts the floating point value
  5553. @var{x} to mode @var{mode}.
  5554.  
  5555. Both @var{x} and the value of the expression are in the target machine's
  5556. floating point representation and have type @code{REAL_VALUE_TYPE}.
  5557. However, the value should have an appropriate bit pattern to be output
  5558. properly as a floating constant whose precision accords with mode
  5559. @var{mode}.
  5560.  
  5561. There is no way for this macro to report overflow.
  5562.  
  5563. @findex REAL_VALUE_TO_INT
  5564. @item REAL_VALUE_TO_INT (@var{low}, @var{high}, @var{x})
  5565. A macro for a C expression which converts a floating point value
  5566. @var{x} into a double-precision integer which is then stored into
  5567. @var{low} and @var{high}, two variables of type @var{int}.
  5568.  
  5569. @item REAL_VALUE_FROM_INT (@var{x}, @var{low}, @var{high})
  5570. @findex REAL_VALUE_FROM_INT
  5571. A macro for a C expression which converts a double-precision integer
  5572. found in @var{low} and @var{high}, two variables of type @var{int},
  5573. into a floating point value which is then stored into @var{x}.
  5574. @end table
  5575.  
  5576. @node Misc
  5577. @section Miscellaneous Parameters
  5578. @cindex parameters, miscellaneous
  5579.  
  5580. @table @code
  5581. @item PREDICATE_CODES
  5582. @findex PREDICATE_CODES
  5583. Optionally define this if you have added predicates to
  5584. @file{@var{machine}.c}.  This macro is called within an initializer of an
  5585. array of structures.  The first field in the structure is the name of a
  5586. predicate and the second field is an array of rtl codes.  For each
  5587. predicate, list all rtl codes that can be in expressions matched by the
  5588. predicate.  The list should have a trailing comma.  Here is an example
  5589. of two entries in the list for a typical RISC machine:
  5590.  
  5591. @smallexample
  5592. #define PREDICATE_CODES \
  5593.   @{"gen_reg_rtx_operand", @{SUBREG, REG@}@},  \
  5594.   @{"reg_or_short_cint_operand", @{SUBREG, REG, CONST_INT@}@},
  5595. @end smallexample
  5596.  
  5597. Defining this macro does not affect the generated code (however,
  5598. incorrect definitions that omit an rtl code that may be matched by the
  5599. predicate can cause the compiler to malfunction).  Instead, it allows
  5600. the table built by @file{genrecog} to be more compact and efficient,
  5601. thus speeding up the compiler.  The most important predicates to include
  5602. in the list specified by this macro are thoses used in the most insn
  5603. patterns.
  5604.  
  5605. @findex CASE_VECTOR_MODE
  5606. @item CASE_VECTOR_MODE
  5607. An alias for a machine mode name.  This is the machine mode that
  5608. elements of a jump-table should have.
  5609.  
  5610. @findex CASE_VECTOR_PC_RELATIVE
  5611. @item CASE_VECTOR_PC_RELATIVE
  5612. Define this macro if jump-tables should contain relative addresses.
  5613.  
  5614. @findex CASE_DROPS_THROUGH
  5615. @item CASE_DROPS_THROUGH
  5616. Define this if control falls through a @code{case} insn when the index
  5617. value is out of range.  This means the specified default-label is
  5618. actually ignored by the @code{case} insn proper.
  5619.  
  5620. @findex CASE_VALUES_THRESHOLD
  5621. @item CASE_VALUES_THRESHOLD
  5622. Define this to be the smallest number of different values for which it
  5623. is best to use a jump-table instead of a tree of conditional branches.
  5624. The default is four for machines with a @code{casesi} instruction and
  5625. five otherwise.  This is best for most machines.
  5626.  
  5627. @findex BYTE_LOADS_ZERO_EXTEND
  5628. @item BYTE_LOADS_ZERO_EXTEND
  5629. Define this macro if an instruction to load a value narrower than a
  5630. word from memory into a register also zero-extends the value to the whole 
  5631. register.
  5632.  
  5633. @findex BYTE_LOADS_SIGN_EXTEND
  5634. @item BYTE_LOADS_SIGN_EXTEND
  5635. Define this macro if an instruction to load a value narrower than a
  5636. word from memory into a register also sign-extends the value to the whole 
  5637. register.
  5638.  
  5639. @findex IMPLICIT_FIX_EXPR
  5640. @item IMPLICIT_FIX_EXPR
  5641. An alias for a tree code that should be used by default for conversion
  5642. of floating point values to fixed point.  Normally,
  5643. @code{FIX_ROUND_EXPR} is used.@refill
  5644.  
  5645. @findex FIXUNS_TRUNC_LIKE_FIX_TRUNC
  5646. @item FIXUNS_TRUNC_LIKE_FIX_TRUNC
  5647. Define this macro if the same instructions that convert a floating
  5648. point number to a signed fixed point number also convert validly to an
  5649. unsigned one.
  5650.  
  5651. @findex EASY_DIV_EXPR
  5652. @item EASY_DIV_EXPR
  5653. An alias for a tree code that is the easiest kind of division to
  5654. compile code for in the general case.  It may be
  5655. @code{TRUNC_DIV_EXPR}, @code{FLOOR_DIV_EXPR}, @code{CEIL_DIV_EXPR} or
  5656. @code{ROUND_DIV_EXPR}.  These four division operators differ in how
  5657. they round the result to an integer.  @code{EASY_DIV_EXPR} is used
  5658. when it is permissible to use any of those kinds of division and the
  5659. choice should be made on the basis of efficiency.@refill
  5660.  
  5661. @findex MOVE_MAX
  5662. @item MOVE_MAX
  5663. The maximum number of bytes that a single instruction can move quickly
  5664. from memory to memory.
  5665.  
  5666. @findex SHIFT_COUNT_TRUNCATED
  5667. @item SHIFT_COUNT_TRUNCATED
  5668. Defining this macro causes the compiler to omit a sign-extend,
  5669. zero-extend, or bitwise `and' instruction that truncates the count of a
  5670. shift operation to a width equal to the number of bits needed to
  5671. represent the size of the object being shifted.  On machines that have
  5672. instructions that act on bitfields at variable positions, which may
  5673. include `bit test' instructions, defining @code{SHIFT_COUNT_TRUNCATED}
  5674. also enables deletion of truncations of the values that serve as
  5675. arguments to bitfield instructions.
  5676.  
  5677. If both types of instructions truncate the count (for shifts) and
  5678. position (for bitfield operations), or if no variable-position bitfield
  5679. instructions exist, you should define this macro.
  5680.  
  5681. However, on some machines, such as the 80386 and the 680x0, truncation
  5682. only applies to shift operations and not the (real or pretended)
  5683. bitfield operations.  Do not define @code{SHIFT_COUNT_TRUNCATED} on such
  5684. machines.  Instead, add patterns to the @file{md} file that include the
  5685. implied truncation of the shift instructions.
  5686.  
  5687. @findex TRULY_NOOP_TRUNCATION
  5688. @item TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
  5689. A C expression which is nonzero if on this machine it is safe to
  5690. ``convert'' an integer of @var{inprec} bits to one of @var{outprec}
  5691. bits (where @var{outprec} is smaller than @var{inprec}) by merely
  5692. operating on it as if it had only @var{outprec} bits.
  5693.  
  5694. On many machines, this expression can be 1.
  5695.  
  5696. @c rearranged this, removed the phrase "it is reported that".  this was
  5697. @c to fix an overfull hbox.  --mew 10feb93
  5698. When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for
  5699. modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.
  5700. If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
  5701. such cases may improve things.
  5702.  
  5703. @findex STORE_FLAG_VALUE
  5704. @item STORE_FLAG_VALUE
  5705. A C expression describing the value returned by a comparison operator
  5706. with an integral mode and stored by a store-flag instruction
  5707. (@samp{s@var{cond}}) when the condition is true.  This description must
  5708. apply to @emph{all} the @samp{s@var{cond}} patterns and all the
  5709. comparison operators whose results have a @code{MODE_INT} mode.
  5710.  
  5711. A value of 1 or -1 means that the instruction implementing the
  5712. comparison operator returns exactly 1 or -1 when the comparison is true
  5713. and 0 when the comparison is false.  Otherwise, the value indicates
  5714. which bits of the result are guaranteed to be 1 when the comparison is
  5715. true.  This value is interpreted in the mode of the comparison
  5716. operation, which is given by the mode of the first operand in the
  5717. @samp{s@var{cond}} pattern.  Either the low bit or the sign bit of
  5718. @code{STORE_FLAG_VALUE} be on.  Presently, only those bits are used by
  5719. the compiler.
  5720.  
  5721. If @code{STORE_FLAG_VALUE} is neither 1 or -1, the compiler will
  5722. generate code that depends only on the specified bits.  It can also
  5723. replace comparison operators with equivalent operations if they cause
  5724. the required bits to be set, even if the remaining bits are undefined.
  5725. For example, on a machine whose comparison operators return an
  5726. @code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as
  5727. @samp{0x80000000}, saying that just the sign bit is relevant, the
  5728. expression
  5729.  
  5730. @smallexample
  5731. (ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))
  5732. @end smallexample
  5733.  
  5734. @noindent
  5735. can be converted to
  5736.  
  5737. @smallexample
  5738. (ashift:SI @var{x} (const_int @var{n}))
  5739. @end smallexample
  5740.  
  5741. @noindent
  5742. where @var{n} is the appropriate shift count to move the bit being
  5743. tested into the sign bit.
  5744.  
  5745. There is no way to describe a machine that always sets the low-order bit
  5746. for a true value, but does not guarantee the value of any other bits,
  5747. but we do not know of any machine that has such an instruction.  If you
  5748. are trying to port GNU CC to such a machine, include an instruction to
  5749. perform a logical-and of the result with 1 in the pattern for the
  5750. comparison operators and let us know
  5751. @ifset USING
  5752. (@pxref{Bug Reporting,,How to Report Bugs}).
  5753. @end ifset
  5754. @ifclear USING
  5755. (@pxref{Bug Reporting,,How to Report Bugs,gcc.info,Using GCC}).
  5756. @end ifclear
  5757.  
  5758. Often, a machine will have multiple instructions that obtain a value
  5759. from a comparison (or the condition codes).  Here are rules to guide the
  5760. choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions
  5761. to be used:
  5762.  
  5763. @itemize @bullet
  5764. @item
  5765. Use the shortest sequence that yields a valid definition for
  5766. @code{STORE_FLAG_VALUE}.  It is more efficient for the compiler to
  5767. ``normalize'' the value (convert it to, e.g., 1 or 0) than for the
  5768. comparison operators to do so because there may be opportunities to
  5769. combine the normalization with other operations.
  5770.  
  5771. @item
  5772. For equal-length sequences, use a value of 1 or -1, with -1 being
  5773. slightly preferred on machines with expensive jumps and 1 preferred on
  5774. other machines.
  5775.  
  5776. @item
  5777. As a second choice, choose a value of @samp{0x80000001} if instructions
  5778. exist that set both the sign and low-order bits but do not define the
  5779. others.
  5780.  
  5781. @item
  5782. Otherwise, use a value of @samp{0x80000000}.
  5783. @end itemize
  5784.  
  5785. Many machines can produce both the value chosen for
  5786. @code{STORE_FLAG_VALUE} and its negation in the same number of
  5787. instructions.  On those machines, you should also define a pattern for
  5788. those cases, e.g., one matching
  5789.  
  5790. @smallexample
  5791. (set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))
  5792. @end smallexample
  5793.  
  5794. Some machines can also perform @code{and} or @code{plus} operations on
  5795. condition code values with less instructions than the corresponding
  5796. @samp{s@var{cond}} insn followed by @code{and} or @code{plus}.  On those
  5797. machines, define the appropriate patterns.  Use the names @code{incscc}
  5798. and @code{decscc}, respectively, for the the patterns which perform
  5799. @code{plus} or @code{minus} operations on condition code values.  See
  5800. @file{rs6000.md} for some examples.  The GNU Superoptizer can be used to
  5801. find such instruction sequences on other machines.
  5802.  
  5803. You need not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
  5804. instructions.
  5805.  
  5806. @findex FLOAT_STORE_FLAG_VALUE
  5807. @item FLOAT_STORE_FLAG_VALUE
  5808. A C expression that gives a non-zero floating point value that is
  5809. returned when comparison operators with floating-point results are true.
  5810. Define this macro on machine that have comparison operations that return
  5811. floating-point values.  If there are no such operations, do not define
  5812. this macro.
  5813.  
  5814. @findex Pmode
  5815. @item Pmode
  5816. An alias for the machine mode for pointers.  Normally the definition
  5817. can be
  5818.  
  5819. @smallexample
  5820. #define Pmode SImode
  5821. @end smallexample
  5822.  
  5823. @findex FUNCTION_MODE
  5824. @item FUNCTION_MODE
  5825. An alias for the machine mode used for memory references to functions
  5826. being called, in @code{call} RTL expressions.  On most machines this
  5827. should be @code{QImode}.
  5828.  
  5829. @findex INTEGRATE_THRESHOLD
  5830. @item INTEGRATE_THRESHOLD (@var{decl})
  5831. A C expression for the maximum number of instructions above which the
  5832. function @var{decl} should not be inlined.  @var{decl} is a
  5833. @code{FUNCTION_DECL} node.
  5834.  
  5835. The default definition of this macro is 64 plus 8 times the number of
  5836. arguments that the function accepts.  Some people think a larger
  5837. threshold should be used on RISC machines.
  5838.  
  5839. @findex SCCS_DIRECTIVE
  5840. @item SCCS_DIRECTIVE
  5841. Define this if the preprocessor should ignore @code{#sccs} directives
  5842. and print no error message.
  5843.  
  5844. @findex HANDLE_PRAGMA
  5845. @findex #pragma
  5846. @findex pragma
  5847. @item HANDLE_PRAGMA (@var{stream})
  5848. Define this macro if you want to implement any pragmas.  If defined, it
  5849. should be a C statement to be executed when @code{#pragma} is seen.  The
  5850. argument @var{stream} is the stdio input stream from which the source
  5851. text can be read.
  5852.  
  5853. It is generally a bad idea to implement new uses of @code{#pragma}.  The
  5854. only reason to define this macro is for compatibility with other
  5855. compilers that do support @code{#pragma} for the sake of any user
  5856. programs which already use it.
  5857.  
  5858. @findex DOLLARS_IN_IDENTIFIERS
  5859. @item DOLLARS_IN_IDENTIFIERS
  5860. Define this macro to control use of the character @samp{$} in identifier
  5861. names.  The value should be 0, 1, or 2.  0 means @samp{$} is not allowed
  5862. by default; 1 means it is allowed by default if @samp{-traditional} is
  5863. used; 2 means it is allowed by default provided @samp{-ansi} is not used.
  5864. 1 is the default; there is no need to define this macro in that case.
  5865.  
  5866. @findex NO_DOLLAR_IN_LABEL
  5867. @item NO_DOLLAR_IN_LABEL
  5868. Define this macro if the assembler does not accept the character
  5869. @samp{$} in label names.  By default constructors and destructors in
  5870. G++ have @samp{$} in the identifiers.  If this macro is defined,
  5871. @samp{.} is used instead.
  5872.  
  5873. @findex DEFAULT_MAIN_RETURN
  5874. @item DEFAULT_MAIN_RETURN
  5875. Define this macro if the target system expects every program's @code{main}
  5876. function to return a standard ``success'' value by default (if no other
  5877. value is explicitly returned).
  5878.  
  5879. The definition should be a C statement (sans semicolon) to generate the
  5880. appropriate rtl instructions.  It is used only when compiling the end of
  5881. @code{main}.
  5882.  
  5883. @item HAVE_ATEXIT
  5884. @findex HAVE_ATEXIT
  5885. Define this if the target system supports the function
  5886. @code{atexit} from the ANSI C standard.  If this is not defined,
  5887. and @code{INIT_SECTION_ASM_OP} is not defined, a default
  5888. @code{exit} function will be provided to support C++.
  5889.  
  5890. @item EXIT_BODY
  5891. @findex EXIT_BODY
  5892. Define this if your @code{exit} function needs to do something
  5893. besides calling an external function @code{_cleanup} before
  5894. terminating with @code{_exit}.  The @code{EXIT_BODY} macro is
  5895. only needed if netiher @code{HAVE_ATEXIT} nor
  5896. @code{INIT_SECTION_ASM_OP} are defined.
  5897.  
  5898. @findex INSN_SETS_ARE_DELAYED
  5899. @item INSN_SETS_ARE_DELAYED (@var{insn})
  5900. Define this macro as a C expression that is nonzero if it is safe for the
  5901. delay slot scheduler to place instructions in the delay slot of @var{insn},
  5902. even if they appear to use a resource set or clobbered in @var{insn}.
  5903. @var{insn} is always a @code{jump_insn} or an @code{insn}; GNU CC knows that 
  5904. every @code{call_insn} has this behavior.  On machines where some @code{insn} 
  5905. or @code{jump_insn} is really a function call and hence has this behavior, 
  5906. you should define this macro.
  5907.  
  5908. You need not define this macro if it would always return zero.
  5909.  
  5910. @findex INSN_REFERENCES_ARE_DELAYED
  5911. @item INSN_REFERENCES_ARE_DELAYED (@var{insn})
  5912. Define this macro as a C expression that is nonzero if it is safe for the
  5913. delay slot scheduler to place instructions in the delay slot of @var{insn},
  5914. even if they appear to set or clobber a resource referenced in @var{insn}.  
  5915. @var{insn} is always a @code{jump_insn} or an @code{insn}.  On machines where
  5916. some @code{insn} or @code{jump_insn} is really a function call and its operands
  5917. are registers whose use is actually in the subroutine it calls, you should
  5918. define this macro.  Doing so allows the delay slot scheduler to move 
  5919. instructions which copy arguments into the argument registers into the delay 
  5920. slot of @var{insn}.
  5921.  
  5922. You need not define this macro if it would always return zero.
  5923. @end table
  5924.