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