home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / PROGRAM / DJGCC201.ZIP / DOCS / TM.TEX < prev   
Text File  |  1992-03-27  |  219KB  |  5,192 lines

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