Annotation of gcc/gcc.texinfo, revision 1.1.1.6

1.1       root        1: \input texinfo  @c -*-texinfo-*-
                      2: 
                      3: @settitle Using and Porting GNU CC
                      4: @setfilename gcc.info
                      5: 
                      6: @ifinfo
                      7: This file documents the use and the internals of the GNU compiler.
                      8: 
1.1.1.5   root        9: Copyright (C) 1988, 1989 Free Software Foundation, Inc.
1.1       root       10: 
                     11: Permission is granted to make and distribute verbatim copies of
                     12: this manual provided the copyright notice and this permission notice
                     13: are preserved on all copies.
                     14: 
                     15: @ignore
                     16: Permission is granted to process this file through Tex and print the
                     17: results, provided the printed document carries copying permission
                     18: notice identical to this one except for the removal of this paragraph
                     19: (this paragraph not being relevant to the printed manual).
                     20: 
                     21: @end ignore
                     22: Permission is granted to copy and distribute modified versions of this
                     23: manual under the conditions for verbatim copying, provided also that the
1.1.1.6 ! root       24: section entitled ``GNU General Public License'' is included exactly as
1.1       root       25: in the original, and provided that the entire resulting derived work is
                     26: distributed under the terms of a permission notice identical to this one.
                     27: 
                     28: Permission is granted to copy and distribute translations of this manual
                     29: into another language, under the above conditions for modified versions,
1.1.1.6 ! root       30: except that the section entitled ``GNU General Public License'' and
1.1       root       31: this permission notice may be included in translations approved by the
                     32: Free Software Foundation instead of in the original English.
                     33: @end ifinfo
                     34: 
                     35: @setchapternewpage odd
                     36: 
                     37: @titlepage
                     38: @center @titlefont{Using and Porting GNU CC}
                     39: @sp 2
                     40: @center Richard M. Stallman
                     41: @sp 3
1.1.1.6 ! root       42: @center last updated 23 Feb 1989
1.1       root       43: @sp 1
1.1.1.6 ! root       44: @center for version 1.34
1.1       root       45: @page
                     46: @vskip 0pt plus 1filll
1.1.1.5   root       47: Copyright @copyright{} 1988, 1989 Free Software Foundation, Inc.
1.1       root       48: 
                     49: Permission is granted to make and distribute verbatim copies of
                     50: this manual provided the copyright notice and this permission notice
                     51: are preserved on all copies.
                     52: 
                     53: Permission is granted to copy and distribute modified versions of this
                     54: manual under the conditions for verbatim copying, provided also that the
1.1.1.6 ! root       55: section entitled ``GNU General Public License'' is included exactly as
1.1       root       56: in the original, and provided that the entire resulting derived work is
                     57: distributed under the terms of a permission notice identical to this one.
                     58: 
                     59: Permission is granted to copy and distribute translations of this manual
                     60: into another language, under the above conditions for modified versions,
1.1.1.6 ! root       61: <except that the section entitled ``GNU General Public License'' and
1.1       root       62: this permission notice may be included in translations approved by the
                     63: Free Software Foundation instead of in the original English.
                     64: @end titlepage
                     65: @page
                     66: 
                     67: @ifinfo
                     68: @node Top, Copying,, (DIR)
                     69: @ichapter Introduction
                     70: 
                     71: This manual documents how to run, install and port the GNU C compiler, as
                     72: well as its new features and incompatibilities, and how to report bugs.
                     73: 
                     74: @end ifinfo
                     75: @menu
1.1.1.6 ! root       76: * Copying::         GNU General Public License says
1.1       root       77:                      how you can copy and share GNU CC.
                     78: * Contributors::    People who have contributed to GNU CC.
                     79: * Options::         Command options supported by @samp{gcc}.
                     80: * Installation::    How to configure, compile and install GNU CC.
                     81: * Trouble::         If you have trouble installing GNU CC.
                     82: * Incompatibilities:: Incompatibilities of GNU CC.
                     83: * Extensions::      GNU extensions to the C language.
                     84: * Bugs::            How to report bugs (if you want to get them fixed).
                     85: * Portability::     Goals of GNU CC's portability features.
                     86: * Interface::       Function-call interface of GNU CC output.
                     87: * Passes::          Order of passes, what they do, and what each file is for.
                     88: * RTL::             The intermediate representation that most passes work on.
                     89: * Machine Desc::    How to write machine description instruction patterns.
                     90: * Machine Macros::  How to write the machine description C macros.
                     91: @end menu
                     92: 
                     93: @node Copying, Contributors, Top, Top
1.1.1.6 ! root       94: @unnumbered GNU GENERAL PUBLIC LICENSE
        !            95: @center Version 1, February 1989
1.1       root       96: 
1.1.1.6 ! root       97: @display
        !            98: Copyright @copyright{} 1989 Free Software Foundation, Inc.
        !            99: 675 Mass Ave, Cambridge, MA 02139, USA
        !           100: 
        !           101: Everyone is permitted to copy and distribute verbatim copies
        !           102: of this license document, but changing it is not allowed.
        !           103: @end display
        !           104: 
        !           105: @unnumberedsec Preamble
        !           106: 
        !           107:   The license agreements of most software companies try to keep users
        !           108: at the mercy of those companies.  By contrast, our General Public
        !           109: License is intended to guarantee your freedom to share and change free
        !           110: software---to make sure the software is free for all its users.  The
        !           111: General Public License applies to the Free Software Foundation's
        !           112: software and to any other program whose authors commit to using it.
        !           113: You can use it for your programs, too.
        !           114: 
        !           115:   When we speak of free software, we are referring to freedom, not
        !           116: price.  Specifically, the General Public License is designed to make
        !           117: sure that you have the freedom to give away or sell copies of free
        !           118: software, that you receive source code or can get it if you want it,
        !           119: that you can change the software or use pieces of it in new free
        !           120: programs; and that you know you can do these things.
        !           121: 
        !           122:   To protect your rights, we need to make restrictions that forbid
        !           123: anyone to deny you these rights or to ask you to surrender the rights.
        !           124: These restrictions translate to certain responsibilities for you if you
        !           125: distribute copies of the software, or if you modify it.
        !           126: 
        !           127:   For example, if you distribute copies of a such a program, whether
        !           128: gratis or for a fee, you must give the recipients all the rights that
        !           129: you have.  You must make sure that they, too, receive or can get the
1.1       root      130: source code.  And you must tell them their rights.
                    131: 
1.1.1.6 ! root      132:   We protect your rights with two steps: (1) copyright the software, and
        !           133: (2) offer you this license which gives you legal permission to copy,
        !           134: distribute and/or modify the software.
        !           135: 
        !           136:   Also, for each author's protection and ours, we want to make certain
        !           137: that everyone understands that there is no warranty for this free
        !           138: software.  If the software is modified by someone else and passed on, we
        !           139: want its recipients to know that what they have is not the original, so
        !           140: that any problems introduced by others will not reflect on the original
        !           141: authors' reputations.
1.1       root      142: 
1.1.1.6 ! root      143:   The precise terms and conditions for copying, distribution and
        !           144: modification follow.
1.1       root      145: 
1.1.1.6 ! root      146: @iftex
        !           147: @unnumberedsec TERMS AND CONDITIONS
        !           148: @end iftex
        !           149: @ifinfo
        !           150: @center TERMS AND CONDITIONS
        !           151: @end ifinfo
1.1       root      152: 
1.1.1.6 ! root      153: @enumerate
1.1       root      154: @item
1.1.1.6 ! root      155: This License Agreement applies to any program or other work which
        !           156: contains a notice placed by the copyright holder saying it may be
        !           157: distributed under the terms of this General Public License.  The
        !           158: ``Program'', below, refers to any such program or work, and a ``work based
        !           159: on the Program'' means either the Program or any work containing the
        !           160: Program or a portion of it, either verbatim or with modifications.  Each
        !           161: licensee is addressed as ``you''.
        !           162: 
        !           163: @item
        !           164: You may copy and distribute verbatim copies of the Program's source
        !           165: code as you receive it, in any medium, provided that you conspicuously and
        !           166: appropriately publish on each copy an appropriate copyright notice and
        !           167: disclaimer of warranty; keep intact all the notices that refer to this
        !           168: General Public License and to the absence of any warranty; and give any
        !           169: other recipients of the Program a copy of this General Public License
        !           170: along with the Program.  You may charge a fee for the physical act of
        !           171: transferring a copy.
        !           172: 
        !           173: @item
        !           174: You may modify your copy or copies of the Program or any portion of
        !           175: it, and copy and distribute such modifications under the terms of Paragraph
        !           176: 1 above, provided that you also do the following:
1.1       root      177: 
                    178: @itemize @bullet
                    179: @item
1.1.1.6 ! root      180: cause the modified files to carry prominent notices stating that
        !           181: you changed the files and the date of any change; and
1.1       root      182: 
                    183: @item
                    184: cause the whole of any work that you distribute or publish, that
1.1.1.6 ! root      185: in whole or in part contains the Program or any part thereof, either
        !           186: with or without modifications, to be licensed at no charge to all
        !           187: third parties under the terms of this General Public License (except
        !           188: that you may choose to grant warranty protection to some or all
        !           189: third parties, at your option).
        !           190: 
        !           191: @item
        !           192: If the modified program normally reads commands interactively when
        !           193: run, you must cause it, when started running for such interactive use
        !           194: in the simplest and most usual way, to print or display an
        !           195: announcement including an appropriate copyright notice and a notice
        !           196: that there is no warranty (or else, saying that you provide a
        !           197: warranty) and that users may redistribute the program under these
        !           198: conditions, and telling the user how to view a copy of this General
        !           199: Public License.
        !           200: 
        !           201: @item
        !           202: You may charge a fee for the physical act of transferring a
        !           203: copy, and you may at your option offer warranty protection in
        !           204: exchange for a fee.
1.1       root      205: @end itemize
                    206: 
1.1.1.6 ! root      207: Mere aggregation of another independent work with the Program (or its
1.1       root      208: derivative) on a volume of a storage or distribution medium does not bring
1.1.1.6 ! root      209: the other work under the scope of these terms.
1.1       root      210: 
                    211: @item
1.1.1.6 ! root      212: You may copy and distribute the Program (or a portion or derivative of
        !           213: it, under Paragraph 2) in object code or executable form under the terms of
        !           214: Paragraphs 1 and 2 above provided that you also do one of the following:
1.1       root      215: 
                    216: @itemize @bullet
                    217: @item
                    218: accompany it with the complete corresponding machine-readable
                    219: source code, which must be distributed under the terms of
                    220: Paragraphs 1 and 2 above; or,
                    221: 
                    222: @item
                    223: accompany it with a written offer, valid for at least three
1.1.1.6 ! root      224: years, to give any third party free (except for a nominal charge
        !           225: for the cost of distribution) a complete machine-readable copy of the
1.1       root      226: corresponding source code, to be distributed under the terms of
                    227: Paragraphs 1 and 2 above; or,
                    228: 
                    229: @item
                    230: accompany it with the information you received as to where the
                    231: corresponding source code may be obtained.  (This alternative is
                    232: allowed only for noncommercial distribution and only if you
                    233: received the program in object code or executable form alone.)
                    234: @end itemize
                    235: 
1.1.1.6 ! root      236: Source code for a work means the preferred form of the work for making
        !           237: modifications to it.  For an executable file, complete source code means
        !           238: all the source code for all modules it contains; but, as a special
        !           239: exception, it need not include source code for modules which are standard
        !           240: libraries that accompany the operating system on which the executable
        !           241: file runs, or for standard header files or definitions files that
        !           242: accompany that operating system.
        !           243: 
        !           244: @item
        !           245: You may not copy, modify, sublicense, distribute or transfer the
        !           246: Program except as expressly provided under this General Public License.
        !           247: Any attempt otherwise to copy, modify, sublicense, distribute or transfer
        !           248: the Program is void, and will automatically terminate your rights to use
        !           249: the Program under this License.  However, parties who have received
        !           250: copies, or rights to use copies, from you under this General Public
        !           251: License will not have their licenses terminated so long as such parties
        !           252: remain in full compliance.
        !           253: 
        !           254: @item
        !           255: By copying, distributing or modifying the Program (or any work based
        !           256: on the Program) you indicate your acceptance of this license to do so,
        !           257: and all its terms and conditions.
        !           258: 
        !           259: @item
        !           260: Each time you redistribute the Program (or any work based on the
        !           261: Program), the recipient automatically receives a license from the original
        !           262: licensor to copy, distribute or modify the Program subject to these
        !           263: terms and conditions.  You may not impose any further restrictions on the
        !           264: recipients' exercise of the rights granted herein.
        !           265: 
        !           266: @item
        !           267: The Free Software Foundation may publish revised and/or new versions
        !           268: of the General Public License from time to time.  Such new versions will
        !           269: be similar in spirit to the present version, but may differ in detail to
        !           270: address new problems or concerns.
        !           271: 
        !           272: Each version is given a distinguishing version number.  If the Program
        !           273: specifies a version number of the license which applies to it and ``any
        !           274: later version'', you have the option of following the terms and conditions
        !           275: either of that version or of any later version published by the Free
        !           276: Software Foundation.  If the Program does not specify a version number of
        !           277: the license, you may choose any version ever published by the Free Software
        !           278: Foundation.
        !           279: 
        !           280: @item
        !           281: If you wish to incorporate parts of the Program into other free
        !           282: programs whose distribution conditions are different, write to the author
        !           283: to ask for permission.  For software which is copyrighted by the Free
        !           284: Software Foundation, write to the Free Software Foundation; we sometimes
        !           285: make exceptions for this.  Our decision will be guided by the two goals
        !           286: of preserving the free status of all derivatives of our free software and
        !           287: of promoting the sharing and reuse of software generally.
        !           288: 
        !           289: @iftex
        !           290: @heading NO WARRANTY
        !           291: @end iftex
        !           292: @ifinfo
        !           293: @center NO WARRANTY
        !           294: @end ifinfo
        !           295: 
        !           296: @item
        !           297: BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
        !           298: FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
        !           299: OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
        !           300: PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
        !           301: OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
        !           302: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
        !           303: TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
        !           304: PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
        !           305: REPAIR OR CORRECTION.
        !           306: 
        !           307: @item
        !           308: IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
        !           309: ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
        !           310: REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
        !           311: INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
        !           312: ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
        !           313: LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
        !           314: SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
        !           315: WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
        !           316: ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1.1       root      317: @end enumerate
                    318: 
1.1.1.6 ! root      319: @iftex
        !           320: @heading END OF TERMS AND CONDITIONS
        !           321: @end iftex
        !           322: @ifinfo
        !           323: @center END OF TERMS AND CONDITIONS
        !           324: @end ifinfo
        !           325: 
        !           326: @page
        !           327: @unnumberedsec Appendix: How to Apply These Terms to Your New Programs
        !           328: 
        !           329:   If you develop a new program, and you want it to be of the greatest
        !           330: possible use to humanity, the best way to achieve this is to make it
        !           331: free software which everyone can redistribute and change under these
        !           332: terms.
        !           333: 
        !           334:   To do so, attach the following notices to the program.  It is safest to
        !           335: attach them to the start of each source file to most effectively convey
        !           336: the exclusion of warranty; and each file should have at least the
        !           337: ``copyright'' line and a pointer to where the full notice is found.
        !           338: 
        !           339: @smallexample
        !           340: @var{one line to give the program's name and a brief idea of what it does.}
        !           341: Copyright (C) 19@var{yy}  @var{name of author}
        !           342: 
        !           343: This program is free software; you can redistribute it and/or modify
        !           344: it under the terms of the GNU General Public License as published by
        !           345: the Free Software Foundation; either version 1, or (at your option)
        !           346: any later version.
        !           347: 
        !           348: This program is distributed in the hope that it will be useful,
        !           349: but WITHOUT ANY WARRANTY; without even the implied warranty of
        !           350: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !           351: GNU General Public License for more details.
        !           352: 
        !           353: You should have received a copy of the GNU General Public License
        !           354: along with this program; if not, write to the Free Software
        !           355: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
        !           356: @end smallexample
        !           357: 
        !           358: Also add information on how to contact you by electronic and paper mail.
        !           359: 
        !           360: If the program is interactive, make it output a short notice like this
        !           361: when it starts in an interactive mode:
        !           362: 
        !           363: @smallexample
        !           364: Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
        !           365: Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
        !           366: This is free software, and you are welcome to redistribute it
        !           367: under certain conditions; type `show c' for details.
        !           368: @end smallexample
        !           369: 
        !           370: The hypothetical commands `show w' and `show c' should show the
        !           371: appropriate parts of the General Public License.  Of course, the
        !           372: commands you use may be called something other than `show w' and `show
        !           373: c'; they could even be mouse-clicks or menu items---whatever suits your
        !           374: program.
        !           375: 
        !           376: You should also get your employer (if you work as a programmer) or your
        !           377: school, if any, to sign a ``copyright disclaimer'' for the program, if
        !           378: necessary.  Here a sample; alter the names:
        !           379: 
        !           380: @example
        !           381: Yoyodyne, Inc., hereby disclaims all copyright interest in the
        !           382: program `Gnomovision' (a program to direct compilers to make passes
        !           383: at assemblers) written by James Hacker.
        !           384: 
        !           385: @var{signature of Ty Coon}, 1 April 1989
        !           386: Ty Coon, President of Vice
        !           387: @end example
        !           388: 
        !           389: That's all there is to it!
1.1       root      390: 
                    391: @node Contributors, Options, Copying, Top
                    392: @unnumbered Contributors to GNU CC
                    393: 
                    394: In addition to Richard Stallman, several people have written parts
                    395: of GNU CC.
                    396: 
                    397: @itemize @bullet
                    398: @item
                    399: The idea of using RTL and some of the optimization ideas came from the
                    400: U. of Arizona Portable Optimizer, written by Jack Davidson and
                    401: Christopher Fraser.  See ``Register Allocation and Exhaustive Peephole
                    402: Optimization'', Software Practice and Experience 14 (9), Sept. 1984,
                    403: 857-866.
                    404: 
                    405: @item
                    406: Paul Rubin wrote most of the preprocessor.
                    407: 
                    408: @item
1.1.1.6 ! root      409: Leonard Tower wrote parts of the parser, RTL generator, and RTL
1.1       root      410: definitions, and of the Vax machine description.
                    411: 
                    412: @item
                    413: Ted Lemon wrote parts of the RTL reader and printer.
                    414: 
                    415: @item
                    416: Jim Wilson implemented loop strength reduction and some other
                    417: loop optimizations.
                    418: 
                    419: @item
                    420: Nobuyuki Hikichi of Software Research Associates, Tokyo, contributed
                    421: the support for the SONY NEWS machine.
                    422: 
                    423: @item
                    424: Charles LaBrec contributed the support for the Integrated Solutions
                    425: 68020 system.
                    426: 
                    427: @item
                    428: Michael Tiemann of MCC wrote most of the description of the National
                    429: Semiconductor 32000 series cpu.  He also wrote the code for inline
                    430: function integration and for the SPARC cpu and Motorola 88000 cpu
                    431: and part of the Sun FPA support.
                    432: 
                    433: @item
                    434: Jan Stein of the Chalmers Computer Society provided support for
                    435: Genix, as well as part of the 32000 machine description.
                    436: 
                    437: @item
                    438: Randy Smith finished the Sun FPA support.
                    439: 
                    440: @item
                    441: Robert Brown implemented the support for Encore 32000 systems.
                    442: 
                    443: @item
                    444: David Kashtan of SRI adapted GNU CC to the Vomit-Making System.
                    445: 
                    446: @item
                    447: Alex Crain provided changes for the 3b1.
                    448: 
                    449: @item
                    450: Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX for
                    451: the 9000 series 300.
                    452: 
                    453: @item
                    454: William Schelter did most of the work on the Intel 80386 support.
1.1.1.5   root      455: 
                    456: @item
                    457: Christopher Smith did the port for Convex machines.
                    458: 
                    459: @item
                    460: Paul Petersen wrote the machine description for the Alliant FX/8.
1.1       root      461: @end itemize
                    462: 
                    463: @node Options, Installation, Contributors, Top
                    464: @chapter GNU CC Command Options
                    465: 
                    466: The GNU C compiler uses a command syntax much like the Unix C compiler.
                    467: The @code{gcc} program accepts options and file names as operands.
                    468: Multiple single-letter options may @emph{not} be grouped: @samp{-dr} is
                    469: very different from @samp{-d -r}.
                    470: 
                    471: When you invoke GNU CC, it normally does preprocessing, compilation,
                    472: assembly and linking.  File names which end in @samp{.c} are taken as C
1.1.1.5   root      473: source to be preprocessed and compiled; file names ending in @samp{.i}
                    474: are taken as preprocessor output to be compiled; compiler output files
                    475: plus any input files with names ending in @samp{.s} are assembled; then
                    476: the resulting object files, plus any other input files, are linked
                    477: together to produce an executable.
1.1       root      478: 
                    479: Command options allow you to stop this process at an intermediate stage.
                    480: For example, the @samp{-c} option says not to run the linker.  Then the
                    481: output consists of object files output by the assembler.
                    482: 
1.1.1.5   root      483: Other command options are passed on to one stage of processing.  Some
                    484: options control the preprocessor and others the compiler itself.  Yet
                    485: other options control the assembler and linker; these are not documented
                    486: here, but you rarely need to use any of them.
1.1       root      487: 
                    488: Here are the options to control the overall compilation process, including
                    489: those that say whether to link, whether to assemble, and so on.
                    490: 
                    491: @table @samp
                    492: @item -o @var{file}
                    493: Place output in file @var{file}.  This applies regardless to whatever
                    494: sort of output is being produced, whether it be an executable file,
                    495: an object file, an assembler file or preprocessed C code.
                    496: 
                    497: If @samp{-o} is not specified, the default is to put an executable file
                    498: in @file{a.out}, the object file @file{@var{source}.c} in
                    499: @file{@var{source}.o}, an assembler file in @file{@var{source}.s}, and
                    500: preprocessed C on standard output.@refill
                    501: 
                    502: @item -c
                    503: Compile or assemble the source files, but do not link.  Produce object
                    504: files with names made by replacing @samp{.c} or @samp{.s} with
                    505: @samp{.o} at the end of the input file names.  Do nothing at all for
                    506: object files specified as input.
                    507: 
                    508: @item -S
                    509: Compile into assembler code but do not assemble.  The assembler output
                    510: file name is made by replacing @samp{.c} with @samp{.s} at the end of
                    511: the input file name.  Do nothing at all for assembler source files or
                    512: object files specified as input.
                    513: 
                    514: @item -E
                    515: Run only the C preprocessor.  Preprocess all the C source files
                    516: specified and output the results to standard output.
                    517: 
                    518: @item -v
                    519: Compiler driver program prints the commands it executes as it runs
                    520: the preprocessor, compiler proper, assembler and linker.  Some of
                    521: these are directed to print their own version numbers.
                    522: 
1.1.1.5   root      523: @item -pipe
                    524: Use pipes rather than temporary files for communication between the
                    525: various stages of compilation.  This fails to work on some systems
                    526: where the assembler is unable to read from a pipe; but the GNU
                    527: assembler has no trouble.
                    528: 
1.1       root      529: @item -B@var{prefix}
                    530: Compiler driver program tries @var{prefix} as a prefix for each
                    531: program it tries to run.  These programs are @file{cpp}, @file{cc1},
                    532: @file{as} and @file{ld}.
                    533: 
                    534: For each subprogram to be run, the compiler driver first tries the
                    535: @samp{-B} prefix, if any.  If that name is not found, or if @samp{-B}
                    536: was not specified, the driver tries two standard prefixes, which are
                    537: @file{/usr/lib/gcc-} and @file{/usr/local/lib/gcc-}.  If neither of
                    538: those results in a file name that is found, the unmodified program
                    539: name is searched for using the directories specified in your
                    540: @samp{PATH} environment variable.
                    541: 
                    542: The run-time support file @file{gnulib} is also searched for using
                    543: the @samp{-B} prefix, if needed.  If it is not found there, the two
                    544: standard prefixes above are tried, and that is all.  The file is left
                    545: out of the link if it is not found by those means.  Most of the time,
                    546: on most machines, you can do without it.
1.1.1.5   root      547: 
                    548: You can get a similar result from the environment variable;
                    549: @code{GCC_EXEC_PREFIX} if it is defined, its value is used as a prefix
                    550: in the same way.  If both the @samp{-B} option and the
                    551: @code{GCC_EXEC_PREFIX} variable are present, the @samp{-B} option is
                    552: used first and the environment variable value second.
1.1       root      553: @end table
                    554: 
                    555: These options control the details of C compilation itself.
                    556: 
                    557: @table @samp
                    558: @item -ansi
                    559: Support all ANSI standard C programs.
                    560: 
                    561: This turns off certain features of GNU C that are incompatible with
                    562: ANSI C, such as the @code{asm}, @code{inline} and @code{typeof}
                    563: keywords, and predefined macros such as @code{unix} and @code{vax}
                    564: that identify the type of system you are using.  It also enables the
                    565: undesirable and rarely used ANSI trigraph feature.
                    566: 
                    567: The @samp{-ansi} option does not cause non-ANSI programs to be
                    568: rejected gratuitously.  For that, @samp{-pedantic} is required in
                    569: addition to @samp{-ansi}.
                    570: 
                    571: The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
                    572: option is used.  Some header files may notice this macro and refrain
                    573: from declaring certain functions or defining certain macros that the
                    574: ANSI standard doesn't call for; this is to avoid interfering with
                    575: any programs that might use these names for other things.
                    576: 
                    577: @item -traditional
                    578: Attempt to support some aspects of traditional C compilers.
                    579: Specifically:
                    580: 
                    581: @itemize @bullet
                    582: @item
                    583: All @code{extern} declarations take effect globally even if they
                    584: are written inside of a function definition.  This includes implicit
                    585: declarations of functions.
                    586: 
                    587: @item
                    588: The keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
                    589: and @code{volatile} are not recognized.@refill
                    590: 
                    591: @item
                    592: Comparisons between pointers and integers are always allowed.
                    593: 
                    594: @item
                    595: Integer types @code{unsigned short} and @code{unsigned char} promote
                    596: to @code{unsigned int}.
                    597: 
                    598: @item
                    599: Out-of-range floating point literals are not an error.
                    600: 
                    601: @item
1.1.1.2   root      602: All automatic variables not declared @code{register} are preserved by
                    603: @code{longjmp}.  Ordinarily, GNU C follows ANSI C: automatic variables
                    604: not declared @code{volatile} may be clobbered.
                    605: 
                    606: @item
1.1       root      607: In the preprocessor, comments convert to nothing at all, rather than
                    608: to a space.  This allows traditional token concatenation.
                    609: 
                    610: @item
                    611: In the preprocessor, macro arguments are recognized within string
                    612: constants in a macro definition (and their values are stringified,
                    613: though without additional quote marks, when they appear in such a
                    614: context).  The preprocessor always considers a string constant to end
                    615: at a newline.
                    616: 
                    617: @item
                    618: The predefined macro @code{__STDC__} is not defined when you use
                    619: @samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
                    620: which @code{__GNUC__} indicates are not affected by
                    621: @samp{-traditional}).  If you need to write header files that work
                    622: differently depending on whether @samp{-traditional} is in use, by
                    623: testing both of these predefined macros you can distinguish four
                    624: situations: GNU C, traditional GNU C, other ANSI C compilers, and
                    625: other old C compilers.
                    626: @end itemize
                    627: 
                    628: @item -O
                    629: Optimize.  Optimizing compilation takes somewhat more time, and a lot
                    630: more memory for a large function.
                    631: 
                    632: Without @samp{-O}, the compiler's goal is to reduce the cost of
                    633: compilation and to make debugging produce the expected results.
                    634: Statements are independent: if you stop the program with a breakpoint
                    635: between statements, you can then assign a new value to any variable or
                    636: change the program counter to any other statement in the function and
                    637: get exactly the results you would expect from the source code.
                    638: 
                    639: Without @samp{-O}, only variables declared @code{register} are
                    640: allocated in registers.  The resulting compiled code is a little worse
                    641: than produced by PCC without @samp{-O}.
                    642: 
                    643: With @samp{-O}, the compiler tries to reduce code size and execution
                    644: time.
                    645: 
                    646: Some of the @samp{-f} options described below turn specific kinds of
                    647: optimization on or off.
                    648: 
                    649: @item -g
                    650: Produce debugging information in the operating system's native format
                    651: (for DBX or SDB).  GDB also can work with this debugging information.
                    652: 
                    653: Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
                    654: @samp{-O}.  The shortcuts taken by optimized code may occasionally
                    655: produce surprising results: some variables you declared may not exist
                    656: at all; flow of control may briefly move where you did not expect it;
                    657: some statements may not be executed because they compute constant
                    658: results or their values were already at hand; some statements may
                    659: execute in different places because they were moved out of loops.
                    660: Nevertheless it proves possible to debug optimized output.  This makes
                    661: it reasonable to use the optimizer for programs that might have bugs.
                    662: 
                    663: @item -gg
                    664: Produce debugging information in GDB's own format.  This requires the
                    665: GNU assembler and linker in order to work.
                    666: 
                    667: This feature will probably be eliminated.  It was intended to enable
                    668: GDB to read the symbol table faster, but it doesn't result in enough
                    669: of a speedup to be worth the larger object files and executables.  We
1.1.1.2   root      670: are working on other ways of making GDB start even faster, which work
                    671: with DBX format debugging information and could be made to work with
                    672: SDB format.
1.1       root      673: 
                    674: @item -w
                    675: Inhibit all warning messages.
                    676: 
                    677: @item -W
                    678: Print extra warning messages for these events:
                    679: 
                    680: @itemize @bullet
                    681: @item
                    682: An automatic variable is used without first being initialized.
                    683: 
                    684: These warnings are possible only in optimizing compilation,
                    685: because they require data flow information that is computed only
1.1.1.6 ! root      686: when optimizing.  If you don't specify @samp{-O}, you simply won't
        !           687: get these warnings.
        !           688: 
        !           689: These warnings occur only for variables that are candidates for
        !           690: register allocation.  Therefore, they do not occur for a variable that
        !           691: is declared @code{volatile}, or whose address is taken, or whose size
        !           692: is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
        !           693: structures, unions or arrays, even when they are in registers.
        !           694: 
        !           695: Note that there may be no warning about a variable that is used only
        !           696: to compute a value that itself is never used, because such
        !           697: computations may be deleted by data flow analysis before the warnings
        !           698: are printed.
1.1       root      699: 
                    700: These warnings are made optional because GNU CC is not smart
                    701: enough to see all the reasons why the code might be correct
                    702: despite appearing to have an error.  Here is one example of how
                    703: this can happen:
                    704: 
                    705: @example
                    706: @{
                    707:   int x;
                    708:   switch (y)
                    709:     @{
                    710:     case 1: x = 1;
                    711:       break;
                    712:     case 2: x = 4;
                    713:       break;
                    714:     case 3: x = 5;
                    715:     @}
                    716:   foo (x);
                    717: @}
                    718: @end example
                    719: 
                    720: @noindent
                    721: If the value of @code{y} is always 1, 2 or 3, then @code{x} is
                    722: always initialized, but GNU CC doesn't know this.  Here is
                    723: another common case:
                    724: 
                    725: @example
                    726: @{
                    727:   int save_y;
                    728:   if (change_y) save_y = y, y = new_y;
                    729:   @dots{}
                    730:   if (change_y) y = save_y;
                    731: @}
                    732: @end example
                    733: 
                    734: @noindent
                    735: This has no bug because @code{save_y} is used only if it is set.
                    736: 
1.1.1.5   root      737: Some spurious warnings can be avoided if you declare as
                    738: @code{volatile} all the functions you use that never return.
                    739: @xref{Function Attributes}.
                    740: 
1.1       root      741: @item
                    742: A nonvolatile automatic variable might be changed by a call to
                    743: @code{longjmp}.  These warnings as well are possible only in
                    744: optimizing compilation.
                    745: 
                    746: The compiler sees only the calls to @code{setjmp}.  It cannot know
                    747: where @code{longjmp} will be called; in fact, a signal handler could
                    748: call it at any point in the code.  As a result, you may get a warning
                    749: even when there is in fact no problem because @code{longjmp} cannot
                    750: in fact be called at the place which would cause a problem.
                    751: 
                    752: @item
                    753: A function can return either with or without a value.  (Falling
                    754: off the end of the function body is considered returning without
1.1.1.6 ! root      755: a value.)  For example, this function would evoke such a
1.1       root      756: warning:
                    757: 
                    758: @example
                    759: foo (a)
                    760: @{
                    761:   if (a > 0)
                    762:     return a;
                    763: @}
                    764: @end example
                    765: 
                    766: Spurious warnings can occur because GNU CC does not realize that
                    767: certain functions (including @code{abort} and @code{longjmp})
                    768: will never return.
1.1.1.4   root      769: 
                    770: @item
                    771: An expression-statement contains no side effects.
1.1       root      772: @end itemize
                    773: 
                    774: In the future, other useful warnings may also be enabled by this
                    775: option.
                    776: 
                    777: @item -Wimplicit
                    778: Warn whenever a function is implicitly declared.
                    779: 
                    780: @item -Wreturn-type
                    781: Warn whenever a function is defined with a return-type that defaults
                    782: to @code{int}.  Also warn about any @code{return} statement with no
                    783: return-value in a function whose return-type is not @code{void}.
                    784: 
                    785: @item -Wunused
1.1.1.5   root      786: Warn whenever a local variable is unused aside from its declaration,
                    787: and whenever a function is declared static but never defined.
1.1       root      788: 
                    789: @item -Wcomment
                    790: Warn whenever a comment-start sequence @samp{/*} appears in a comment.
                    791: 
                    792: @item -Wall
                    793: All of the above @samp{-W} options combined.
                    794: 
1.1.1.6 ! root      795: @item -Wcast-qual
        !           796: Warn whenever a pointer is cast so as to remove a type qualifier from
        !           797: the target type.  For example, warn if a @code{const char *} is cast
        !           798: to an ordinary @code{char *}.
        !           799: 
1.1       root      800: @item -Wwrite-strings
                    801: Give string constants the type @code{const char[@var{length}]} so that
                    802: copying the address of one into a non-@code{const} @code{char *}
                    803: pointer will get a warning.  These warnings will help you find at
                    804: compile time code that can try to write into a string constant, but
                    805: only if you have been very careful about using @code{const} in
                    806: declarations and prototypes.  Otherwise, it will just be a nuisance;
                    807: this is why we did not make @samp{-Wall} request these warnings.
                    808: 
                    809: @item -p
                    810: Generate extra code to write profile information suitable for the
                    811: analysis program @code{prof}.
                    812: 
                    813: @item -pg
                    814: Generate extra code to write profile information suitable for the
                    815: analysis program @code{gprof}.
                    816: 
1.1.1.6 ! root      817: @item -a
        !           818: Generate extra code to write profile information for basic blocks,
        !           819: suitable for the analysis program @code{tcov}.  Eventually GNU
        !           820: @code{gprof} should be extended to process this data.
        !           821: 
1.1       root      822: @item -l@var{library}
                    823: Search a standard list of directories for a library named
                    824: @var{library}, which is actually a file named
                    825: @file{lib@var{library}.a}.  The linker uses this file as if it
                    826: had been specified precisely by name.
                    827: 
                    828: The directories searched include several standard system directories
                    829: plus any that you specify with @samp{-L}.
                    830: 
                    831: Normally the files found this way are library files---archive files
                    832: whose members are object files.  The linker handles an archive file by
                    833: scanning through it for members which define symbols that have so far
                    834: been referenced but not defined.  But if the file that is found is an
                    835: ordinary object file, it is linked in the usual fashion.  The only
                    836: difference between using an @samp{-l} option and specifying a file name
                    837: is that @samp{-l} searches several directories.
                    838: 
                    839: @item -L@var{dir}
                    840: Add directory @var{dir} to the list of directories to be searched
                    841: for @samp{-l}.
                    842: 
                    843: @item -nostdlib
                    844: Don't use the standard system libraries and startup files when
                    845: linking.  Only the files you specify (plus @file{gnulib}) will be
                    846: passed to the linker.
                    847: 
                    848: @item -m@var{machinespec}
                    849: Machine-dependent option specifying something about the type of target
                    850: machine.  These options are defined by the macro
                    851: @code{TARGET_SWITCHES} in the machine description.  The default for
                    852: the options is also defined by that macro, which enables you to change
                    853: the defaults.@refill
                    854: 
                    855: These are the @samp{-m} options defined in the 68000 machine
                    856: description:
                    857: 
                    858: @table @samp
                    859: @item -m68020
                    860: @itemx -mc68020
                    861: Generate output for a 68020 (rather than a 68000).  This is the
                    862: default if you use the unmodified sources.
                    863: 
                    864: @item -m68000
                    865: @item -mc68000
                    866: Generate output for a 68000 (rather than a 68020).
                    867: 
                    868: @item -m68881
                    869: Generate output containing 68881 instructions for floating point.
                    870: This is the default if you use the unmodified sources.
                    871: 
                    872: @item -mfpa
                    873: Generate output containing Sun FPA instructions for floating point.
                    874: 
                    875: @item -msoft-float
                    876: Generate output containing library calls for floating point.
                    877: 
                    878: @item -mshort
                    879: Consider type @code{int} to be 16 bits wide, like @code{short int}.
                    880: 
                    881: @item -mnobitfield
                    882: Do not use the bit-field instructions.  @samp{-m68000} implies
                    883: @samp{-mnobitfield}.
                    884: 
                    885: @item -mbitfield
                    886: Do use the bit-field instructions.  @samp{-m68020} implies
                    887: @samp{-mbitfield}.  This is the default if you use the unmodified
                    888: sources.
                    889: 
                    890: @item -mrtd
                    891: Use a different function-calling convention, in which functions
                    892: that take a fixed number of arguments return with the @code{rtd}
                    893: instruction, which pops their arguments while returning.  This
                    894: saves one instruction in the caller since there is no need to pop
                    895: the arguments there.
                    896: 
                    897: This calling convention is incompatible with the one normally
                    898: used on Unix, so you cannot use it if you need to call libraries
                    899: compiled with the Unix compiler.
                    900: 
                    901: Also, you must provide function prototypes for all functions that
                    902: take variable numbers of arguments (including @code{printf});
                    903: otherwise incorrect code will be generated for calls to those
                    904: functions.
                    905: 
                    906: In addition, seriously incorrect code will result if you call a
                    907: function with too many arguments.  (Normally, extra arguments are
                    908: harmlessly ignored.)
                    909: 
                    910: The @code{rtd} instruction is supported by the 68010 and 68020
                    911: processors, but not by the 68000.
                    912: @end table
                    913: 
                    914: These @samp{-m} options are defined in the Vax machine description:
                    915: 
                    916: @table @samp
                    917: @item -munix
                    918: Do not output certain jump instructions (@code{aobleq} and so on)
                    919: that the Unix assembler for the Vax cannot handle across long
                    920: ranges.
                    921: 
                    922: @item -mgnu
                    923: Do output those jump instructions, on the assumption that you
                    924: will assemble with the GNU assembler.
                    925: 
                    926: @item -mg
                    927: Output code for g-format floating point numbers instead of d-format.
                    928: @end table
                    929: 
1.1.1.5   root      930: These @samp{-m} switches are supported on the Sparc:
                    931: 
                    932: @table @samp
                    933: @item -mfpu
                    934: Generate output containing floating point instructions.  This is the
                    935: default if you use the unmodified sources.
                    936: 
                    937: @item -msoft-float
                    938: Generate output containing library calls for floating point.
                    939: 
                    940: @item -mno-epilogue
1.1.1.6 ! root      941: Generate separate return instructions for @code{return} statements.
        !           942: This has both advantages and disadvantages; I don't recall what they
        !           943: are.
1.1.1.5   root      944: 
                    945: @item -meager
                    946: Do eager conditional branch scheduling to fill no-op slots.  This
                    947: optimization is new, so we suspect it has bugs; some day it will be
                    948: done by default, but it is optional now so you can test it when you
                    949: are ready.
                    950: 
                    951: @emph{Test it now}, and report the bugs; otherwise we won't find them,
                    952: and this option may become the default with bugs still in it!
                    953: @end table
                    954: 
                    955: These @samp{-m} options are defined in the Convex machine description:
                    956: 
                    957: @table @samp
                    958: @item -mc1
                    959: Generate output for a C1.  This is the default when the compiler is
                    960: configured for a C1.
                    961: 
                    962: @item -mc2
                    963: Generate output for a C2.  This is the default when the compiler is
                    964: configured for a C2.
                    965: 
                    966: @item -margcount
                    967: Generate code which puts an argument count in the word preceding each
                    968: argument list.  Some nonportable Convex and Vax programs need this
                    969: word.  (Debuggers don't; this info is in the symbol table.)
                    970: 
                    971: @item -mnoargcount
                    972: Omit the argument count word.  This is the default if you use the
                    973: unmodified sources.
                    974: @end table
                    975: 
1.1       root      976: @item -f@var{flag}
1.1.1.4   root      977: Specify machine-independent flags.  Most flags have both positive and
                    978: negative forms; the negative form of @samp{-ffoo} would be
                    979: @samp{-fno-foo}.  In the table below, only one of the forms is
                    980: listed---the one which is not the default.  You can figure out the
                    981: other form by either removing @samp{no-} or adding it.
1.1       root      982: 
                    983: @table @samp
1.1.1.6 ! root      984: @item -fpcc-struct-return
        !           985: Use the same convention for returning @code{struct} and @code{union}
        !           986: values that is used by the usual C compiler on your system.  This
        !           987: convention is less efficient for small structures, and on many
        !           988: machines it fails to be reentrant; but it has the advantage of
        !           989: allowing intercallability between GCC-compiled code and PCC-compiled
        !           990: code.
        !           991: 
1.1       root      992: @item -ffloat-store
                    993: Do not store floating-point variables in registers.  This
                    994: prevents undesirable excess precision on machines such as the
                    995: 68000 where the floating registers (of the 68881) keep more
                    996: precision than a @code{double} is supposed to have.
                    997: 
                    998: For most programs, the excess precision does only good, but a few
                    999: programs rely on the precise definition of IEEE floating point.
                   1000: Use @samp{-ffloat-store} for such programs.
                   1001: 
                   1002: @item -fno-asm
                   1003: Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
                   1004: keyword.  These words may then be used as identifiers.
                   1005: 
                   1006: @item -fno-defer-pop
                   1007: Always pop the arguments to each function call as soon as that
                   1008: function returns.  Normally the compiler (when optimizing) lets
                   1009: arguments accumulate on the stack for several function calls and
                   1010: pops them all at once.
                   1011: 
                   1012: @item -fstrength-reduce
                   1013: Perform the optimizations of loop strength reduction and
                   1014: elimination of iteration variables.
                   1015: 
                   1016: @item -fcombine-regs
                   1017: Allow the combine pass to combine an instruction that copies one
                   1018: register into another.  This might or might not produce better
                   1019: code when used in addition to @samp{-O}.  I am interested in
                   1020: hearing about the difference this makes.
                   1021: 
                   1022: @item -fforce-mem
                   1023: Force memory operands to be copied into registers before doing
                   1024: arithmetic on them.  This may produce better code by making all
                   1025: memory references potential common subexpressions.  When they are
                   1026: not common subexpressions, instruction combination should
                   1027: eliminate the separate register-load.  I am interested in hearing
                   1028: about the difference this makes.
                   1029: 
                   1030: @item -fforce-addr
                   1031: Force memory address constants to be copied into registers before
                   1032: doing arithmetic on them.  This may produce better code just as
                   1033: @samp{-fforce-mem} may.  I am interested in hearing about the
                   1034: difference this makes.
                   1035: 
                   1036: @item -fomit-frame-pointer
                   1037: Don't keep the frame pointer in a register for functions that
                   1038: don't need one.  This avoids the instructions to save, set up and
                   1039: restore frame pointers; it also makes an extra register available
                   1040: in many functions.  @strong{It also makes debugging impossible.}
                   1041: 
                   1042: On some machines, such as the Vax, this flag has no effect,
                   1043: because the standard calling sequence automatically handles the
                   1044: frame pointer and nothing is saved by pretending it doesn't
                   1045: exist.  The machine-description macro
                   1046: @code{FRAME_POINTER_REQUIRED} controls whether a target machine
                   1047: supports this flag.  @xref{Registers}.@refill
                   1048: 
                   1049: @item -finline-functions
                   1050: Integrate all simple functions into their callers.  The compiler
                   1051: heuristically decides which functions are simple enough to be
                   1052: worth integrating in this way.
                   1053: 
                   1054: If all calls to a given function are integrated, and the function
                   1055: is declared @code{static}, then the function is normally not
                   1056: output as assembler code in its own right.
                   1057: 
1.1.1.6 ! root     1058: @item -fcaller-saves
        !          1059: Enable values to be allocated in registers that will be clobbered by
        !          1060: function calls, by emitting extra instructions to save and restore the
        !          1061: registers around such calls.  Such allocation is done only when it
        !          1062: seems to result in better code than would otherwise be produced.
        !          1063: 
        !          1064: This option is enabled by default on certain machines, usually those
        !          1065: which have no call-preserved registers to use instead.
        !          1066: 
1.1       root     1067: @item -fkeep-inline-functions
                   1068: Even if all calls to a given function are integrated, and the
                   1069: function is declared @code{static}, nevertheless output a
                   1070: separate run-time callable version of the function.
                   1071: 
                   1072: @item -fwritable-strings
                   1073: Store string constants in the writable data segment and don't
                   1074: uniquize them.  This is for compatibility with old programs which
                   1075: assume they can write into string constants.  Writing into string
                   1076: constants is a very bad idea; ``constants'' should be constant.
                   1077: 
1.1.1.4   root     1078: @item -fcond-mismatch
                   1079: Allow conditional expressions with mismatched types in the second and
                   1080: third arguments.  The value of such an expression is void.
                   1081: 
1.1       root     1082: @item -fno-function-cse
                   1083: Do not put function addresses in registers; make each instruction
                   1084: that calls a constant function contain the function's address
                   1085: explicitly.
                   1086: 
                   1087: This option results in less efficient code, but some strange
                   1088: hacks that alter the assembler output may be confused by the
                   1089: optimizations performed when this option is not used.
                   1090: 
                   1091: @item -fvolatile
                   1092: Consider all memory references through pointers to be volatile.
                   1093: 
1.1.1.4   root     1094: @item -fshared-data
                   1095: Requests that the data and non-@code{const} variables of this
                   1096: compilation be shared data rather than private data.  The distinction
                   1097: makes sense only on certain operating systems, where shared data is
                   1098: shared between processes running the same program, while private data
                   1099: exists in one copy per process.
                   1100: 
1.1       root     1101: @item -funsigned-char
1.1.1.4   root     1102: Let the type @code{char} be the unsigned, like @code{unsigned char}.
1.1       root     1103: 
                   1104: Each kind of machine has a default for what @code{char} should
                   1105: be.  It is either like @code{unsigned char} by default or like
                   1106: @code{signed char} by default.  (Actually, at present, the
                   1107: default is always signed.)
                   1108: 
                   1109: The type @code{char} is always a distinct type from either
                   1110: @code{signed char} or @code{unsigned char}, even though its
                   1111: behavior is always just like one of those two.
                   1112: 
1.1.1.4   root     1113: Note that this is equivalent to @samp{-fno-signed-char}, which is the
                   1114: negative form of @samp{-fsigned-char}.
                   1115: 
1.1       root     1116: @item -fsigned-char
                   1117: Let the type @code{char} be signed, like @code{signed char}.
                   1118: 
1.1.1.4   root     1119: Note that this is equivalent to @samp{-fno-unsigned-char}, which is
                   1120: the negative form of @samp{-funsigned-char}.
                   1121: 
1.1       root     1122: @item -ffixed-@var{reg}
                   1123: Treat the register named @var{reg} as a fixed register; generated
                   1124: code should never refer to it (except perhaps as a stack pointer,
                   1125: frame pointer or in some other fixed role).
                   1126: 
                   1127: @var{reg} must be the name of a register.  The register names
                   1128: accepted are machine-specific and are defined in the
                   1129: @code{REGISTER_NAMES} macro in the machine description macro
                   1130: file.
                   1131: 
1.1.1.4   root     1132: This flag does not have a negative form, because it specifies a
                   1133: three-way choice.
                   1134: 
1.1       root     1135: @item -fcall-used-@var{reg}
                   1136: Treat the register named @var{reg} as an allocatable register
                   1137: that is clobbered by function calls.  It may be allocated for
                   1138: temporaries or variables that do not live across a call.
                   1139: Functions compiled this way will not save and restore the
                   1140: register @var{reg}.
                   1141: 
                   1142: Use of this flag for a register that has a fixed pervasive role
                   1143: in the machine's execution model, such as the stack pointer or
                   1144: frame pointer, will produce disastrous results.
                   1145: 
1.1.1.4   root     1146: This flag does not have a negative form, because it specifies a
                   1147: three-way choice.
                   1148: 
1.1       root     1149: @item -fcall-saved-@var{reg}
                   1150: Treat the register named @var{reg} as an allocatable register
                   1151: saved by functions.  It may be allocated even for temporaries or
                   1152: variables that live across a call.  Functions compiled this way
                   1153: will save and restore the register @var{reg} if they use it.
                   1154: 
                   1155: Use of this flag for a register that has a fixed pervasive role
                   1156: in the machine's execution model, such as the stack pointer or
                   1157: frame pointer, will produce disastrous results.
                   1158: 
                   1159: A different sort of disaster will result from the use of this
                   1160: flag for a register in which function values may be returned.
1.1.1.4   root     1161: 
                   1162: This flag does not have a negative form, because it specifies a
                   1163: three-way choice.
1.1       root     1164: @end table
                   1165: 
                   1166: @item -d@var{letters}
                   1167: Says to make debugging dumps at times specified by @var{letters}.
                   1168: Here are the possible letters:
                   1169: 
                   1170: @table @samp
                   1171: @item r
                   1172: Dump after RTL generation.
                   1173: @item j
                   1174: Dump after first jump optimization.
                   1175: @item J
                   1176: Dump after last jump optimization.
                   1177: @item s
                   1178: Dump after CSE (including the jump optimization that sometimes
                   1179: follows CSE).
                   1180: @item L
                   1181: Dump after loop optimization.
                   1182: @item f
                   1183: Dump after flow analysis.
                   1184: @item c
                   1185: Dump after instruction combination.
                   1186: @item l
                   1187: Dump after local register allocation.
                   1188: @item g
                   1189: Dump after global register allocation.
                   1190: @item m
                   1191: Print statistics on memory usage, at the end of the run.
                   1192: @end table
                   1193: 
                   1194: @item -pedantic
                   1195: Issue all the warnings demanded by strict ANSI standard C; reject
                   1196: all programs that use forbidden extensions.
                   1197: 
                   1198: Valid ANSI standard C programs should compile properly with or without
                   1199: this option (though a rare few will require @samp{-ansi}).  However,
                   1200: without this option, certain GNU extensions and traditional C features
                   1201: are supported as well.  With this option, they are rejected.  There is
                   1202: no reason to @i{use} this option; it exists only to satisfy pedants.
1.1.1.5   root     1203: 
                   1204: @item -static
                   1205: On Suns running version 4, this prevents linking with the shared
                   1206: libraries.  (@samp{-g} has the same effect.)
1.1       root     1207: @end table
                   1208: 
                   1209: These options control the C preprocessor, which is run on each C source
                   1210: file before actual compilation.  If you use the @samp{-E} option, nothing
                   1211: is done except C preprocessing.  Some of these options make sense only
                   1212: together with @samp{-E} because they request preprocessor output that is
                   1213: not suitable for actual compilation.
                   1214: 
                   1215: @table @samp
                   1216: @item -C
                   1217: Tell the preprocessor not to discard comments.  Used with the
                   1218: @samp{-E} option.
                   1219: 
                   1220: @item -I@var{dir}
                   1221: Search directory @var{dir} for include files.
                   1222: 
                   1223: @item -I-
                   1224: Any directories specified with @samp{-I} options before the @samp{-I-}
                   1225: option are searched only for the case of @samp{#include "@var{file}"};
                   1226: they are not searched for @samp{#include <@var{file}>}.
                   1227: 
                   1228: If additional directories are specified with @samp{-I} options after
                   1229: the @samp{-I-}, these directories are searched for all @samp{#include}
                   1230: directives.  (Ordinarily @emph{all} @samp{-I} directories are used
                   1231: this way.)
                   1232: 
                   1233: In addition, the @samp{-I-} option inhibits the use of the current
                   1234: directory as the first search directory for @samp{#include
                   1235: "@var{file}"}.  Therefore, the current directory is searched only if
                   1236: it is requested explicitly with @samp{-I.}.  Specifying both
                   1237: @samp{-I-} and @samp{-I.} allows you to control precisely which
                   1238: directories are searched before the current one and which are searched
                   1239: after.
                   1240: 
                   1241: @item -nostdinc
                   1242: Do not search the standard system directories for header files.  Only
                   1243: the directories you have specified with @samp{-I} options (and the
                   1244: current directory, if appropriate) are searched.
                   1245: 
                   1246: Between @samp{-nostdinc} and @samp{-I-}, you can eliminate all
                   1247: directories from the search path except those you specify.
                   1248: 
                   1249: @item -M
                   1250: Tell the preprocessor to output a rule suitable for @code{make}
                   1251: describing the dependencies of each source file.  For each source
                   1252: file, the preprocessor outputs one @code{make}-rule whose target is
                   1253: the object file name for that source file and whose dependencies are
                   1254: all the files @samp{#include}d in it.  This rule may be a single line
                   1255: or may be continued with @samp{\}-newline if it is long.
                   1256: 
                   1257: @samp{-M} implies @samp{-E}.
                   1258: 
                   1259: @item -MM
                   1260: Like @samp{-M} but the output mentions only the user-header files
                   1261: included with @samp{#include "@var{file}"}.  System header files
                   1262: included with @samp{#include <@var{file}>} are omitted.
                   1263: 
                   1264: @samp{-MM} implies @samp{-E}.
                   1265: 
                   1266: @item -D@var{macro}
                   1267: Define macro @var{macro} with the empty string as its definition.
                   1268: 
                   1269: @item -D@var{macro}=@var{defn}
                   1270: Define macro @var{macro} as @var{defn}.
                   1271: 
                   1272: @item -U@var{macro}
                   1273: Undefine macro @var{macro}.
                   1274: 
                   1275: @item -T
                   1276: Support ANSI C trigraphs.  You don't want to know about this
                   1277: brain-damage.  The @samp{-ansi} option also has this effect.
                   1278: @end table
                   1279: 
                   1280: @node Installation, Trouble, Options, Top
                   1281: @chapter Installing GNU CC
                   1282: 
                   1283: Here is the procedure for installing GNU CC on a Unix system.
                   1284: @menu
                   1285: * VMS Install::   See below for installation on VMS.
                   1286: @end menu
                   1287: @iftex
                   1288: (See below for VMS.)
                   1289: @end iftex
                   1290: 
                   1291: @enumerate
                   1292: @item
                   1293: Edit @file{Makefile}.  If you are using HPUX, or any form of system V,
                   1294: you must make a few changes described in comments at the beginning of
1.1.1.4   root     1295: the file.  Genix requires changes also.
1.1       root     1296: 
                   1297: @item
                   1298: On a Sequent system, go to the Berkeley universe.
                   1299: 
                   1300: @item
1.1.1.2   root     1301: Choose configuration files.  The easy way to do this is to run the
                   1302: command file @file{config.gcc} with a single argument, which is the
1.1.1.4   root     1303: name of the machine (and operating system, in some cases).
                   1304: 
                   1305: Here is a list of the possible arguments:
                   1306: 
                   1307: @table @samp
                   1308: @item vax
                   1309: Vaxes running BSD.
                   1310: @item vms
                   1311: Vaxes running VMS.
                   1312: @item vax-sysv
                   1313: Vaxes running system V.
                   1314: @item i386-sysv
                   1315: Intel 386 PCs running system V.
1.1.1.5   root     1316: @item i386-sysv-gas
                   1317: Intel 386 PCs running system V, using the GNU assembler and GNU
                   1318: linker.
1.1.1.6 ! root     1319: @item sequent-i386
1.1.1.4   root     1320: Sequent with Intel 386 processors.
                   1321: @item sun2
                   1322: Sun 2 running system version 2 or 3.
                   1323: @item sun3
1.1.1.5   root     1324: Sun 3 running system version 2 or 3, with 68881.
                   1325: @item sun3-nfp
                   1326: Sun 3 running system version 2 or 3, without 68881.
                   1327: @item sun3-fpa
                   1328: Sun 3 running system version 2 or 3, with 68881 and fpa.
1.1.1.4   root     1329: @item sun4
                   1330: Sun 4 running system version 2 or 3.
                   1331: @item sun2-os4
                   1332: Sun 2 running system version 4.
                   1333: @item sun3-os4
1.1.1.5   root     1334: Sun 3 running system version 4, with 68881.
                   1335: @item sun3-nfp-os4
                   1336: Sun 3 running system version 4, without 68881.
                   1337: @item sun3-fpa-os4
                   1338: Sun 3 running system version 4, with 68881 and fpa.
1.1.1.4   root     1339: @item sun4-os4
                   1340: Sun 4 running system version 4.
                   1341: @item sun386
                   1342: Sun 386 (``roadrunner'').
1.1.1.5   root     1343: @item alliant
                   1344: Alliant FX/8 computer.  Currently, there are bugs in the support for
                   1345: floating point.  Also note that Alliant's version of dbx does not
                   1346: manage to work with the output from GNU CC.
                   1347: @item convex-c1
                   1348: Convex C1 computer.
                   1349: @item convex-c2
                   1350: Convex C2 computer.
1.1.1.4   root     1351: @item hp9k320
                   1352: HP 9000 series 300 using HPUX assembler.
1.1.1.6 ! root     1353: @item hp9k320g
1.1.1.4   root     1354: HP 9000 series 300 using GNU assembler, linker and debugger.
                   1355: This requires the HP-adapt package which is or will soon be
1.1.1.5   root     1356: available along with the linker.
1.1.1.4   root     1357: @item isi68
                   1358: ISI 68000 or 68020 system.
                   1359: @item news800
                   1360: Sony NEWS 68020 system.
1.1.1.6 ! root     1361: @item next
        !          1362: NeXT system.
1.1.1.4   root     1363: @item 3b1
                   1364: AT&T 3b1, a.k.a. 7300 PC.
                   1365: @item sequent-ns32k
                   1366: Sequent containing ns32000 processors.
                   1367: @item encore
                   1368: Encore ns32000 system.
                   1369: @item genix
                   1370: National Semiconductor ns32000 system.
                   1371: @item 88000
                   1372: Motorola 88000 processor.  This port is not finished.
                   1373: @end table
1.1.1.2   root     1374: 
1.1.1.4   root     1375: Here we spell out what files need to be set up:
1.1       root     1376: 
                   1377: @itemize @bullet
                   1378: @item
                   1379: Make a symbolic link named @file{config.h} to the top-level
                   1380: config file for the machine you are using (@pxref{Config}).  This
                   1381: file is responsible for defining information about the host
                   1382: machine.  It includes @file{tm.h}.
                   1383: 
1.1.1.3   root     1384: The file's name should be @file{xm-@var{machine}.h}, with these
1.1       root     1385: exceptions:
                   1386: 
                   1387: @table @file
1.1.1.3   root     1388: @item xm-vms.h
1.1       root     1389: for vaxen running VMS.
1.1.1.3   root     1390: @item xm-vaxv.h
1.1       root     1391: for vaxen running system V.
1.1.1.3   root     1392: @item xm-i386v.h
1.1       root     1393: for Intel 80386's running system V.
1.1.1.3   root     1394: @item xm-sunos4.h
1.1       root     1395: for Suns (model 2, 3 or 4) running @emph{operating system} version 4.
1.1.1.3   root     1396: (Use @file{xm-m68k.h} or @file{xm-sparc.h} for version 3.)
                   1397: @item xm-sun386i.h
                   1398: for Sun roadrunner running any version of the operating system.
                   1399: @item xm-hp9k320.h
1.1       root     1400: for the HP 9000 series 300.
1.1.1.4   root     1401: @item xm-genix.h
1.1       root     1402: for the ns32000 running Genix
                   1403: @end table
                   1404: 
                   1405: If your system does not support symbolic links, you might want to
                   1406: set up @file{config.h} to contain a @samp{#include} command which
                   1407: refers to the appropriate file.
                   1408: 
                   1409: @item
                   1410: Make a symbolic link named @file{tm.h} to the machine-description
                   1411: macro file for your machine (its name should be
                   1412: @file{tm-@var{machine}.h}).
                   1413: 
                   1414: If your system is a 68000, don't use the file @file{tm-m68k.h}
                   1415: directly.  Instead, use one of these files:
                   1416: 
                   1417: @table @file
                   1418: @item tm-sun3.h
1.1.1.5   root     1419: for Sun 3 machines with 68881.
                   1420: @item tm-sun3-fpa.h
                   1421: for Sun 3 machines with floating point accelerator.
                   1422: @item tm-sun3-nfp.h
                   1423: for Sun 3 machines with no hardware floating point.
1.1       root     1424: @item tm-sun2.h
                   1425: for Sun 2 machines.
                   1426: @item tm-3b1.h
                   1427: for AT&T 3b1 (aka 7300 Unix PC).
                   1428: @item tm-isi68.h
1.1.1.3   root     1429: for Integrated Solutions systems.  This file assumes you
                   1430: use the GNU assembler.
1.1       root     1431: @item tm-news800.h
                   1432: for SONY News systems.
                   1433: @item tm-hp9k320.h
                   1434: for HPUX systems, if you are using GNU CC with the system's
                   1435: assembler and linker.
                   1436: @item tm-hp9k320g.h
                   1437: for HPUX systems, if you are using the GNU assembler, linker and
                   1438: other utilities.  Not all of the pieces of GNU software needed
                   1439: for this mode of operation are as yet in distribution; full
                   1440: instructions will appear here in the future.@refill
                   1441: @end table
                   1442: 
                   1443: For the vax, use @file{tm-vax.h} on BSD Unix, @file{tm-vaxv.h} on
                   1444: system V, or @file{tm-vms.h} on VMS.@refill
                   1445: 
                   1446: For the Motorola 88000, use @file{tm-m88k.h}.  The support for the
                   1447: 88000 has a few unfinished spots because there was no way to run the
1.1.1.2   root     1448: output.  Bugs are suspected in handling of branch-tables and in the
                   1449: function prologue and epilogue.
1.1       root     1450: 
                   1451: For the 80386, don't use @file{tm-i386.h} directly.  Use
                   1452: @file{tm-i386v.h} if the target machine is running system V,
1.1.1.5   root     1453: @file{tm-i386gas.h} if it is running system V but you are using the
                   1454: GNU assembler and linker, @file{tm-seq386.h} for a Sequent 386 system,
                   1455: or @file{tm-compaq.h} for a Compaq, or @file{tm-sun386i.h} for a Sun
                   1456: 386 system.
1.1       root     1457: 
                   1458: For the 32000, use @file{tm-sequent.h} if you are using a Sequent
                   1459: machine, or @file{tm-encore.h} for an Encore machine, or
1.1.1.4   root     1460: @file{tm-genix.h} if you are using Genix version 3; otherwise, perhaps
1.1       root     1461: @file{tm-ns32k.h} will work for you.
                   1462: 
                   1463: Note that Genix has bugs in @code{alloca} and @code{malloc}; you must
                   1464: get the compiled versions of these from GNU Emacs and edit GNU CC's
                   1465: @file{Makefile} to use them.
                   1466: 
                   1467: Note that Encore systems are supported only under BSD.
                   1468: 
1.1.1.6 ! root     1469: For Sparc (Sun 4) machines, use @file{tm-sparc.h} with operating system
        !          1470: version 4, and @file{tm-sun4os3.h} with system version 3.
        !          1471: 
1.1       root     1472: @item
                   1473: Make a symbolic link named @file{md} to the machine description
1.1.1.2   root     1474: pattern file.  Its name should be @file{@var{machine}.md}, but
                   1475: @var{machine} is often not the same as the name used in the
                   1476: @file{tm.h} file because the @file{md} files are more general.
1.1       root     1477: 
                   1478: @item
                   1479: Make a symbolic link named @file{aux-output.c} to the output
                   1480: subroutine file for your machine (its name should be
                   1481: @file{output-@var{machine}.c}).
                   1482: @end itemize
                   1483: 
                   1484: @item
                   1485: Make sure the Bison parser generator is installed.  (This is
                   1486: unnecessary if the Bison output files @file{c-parse.tab.c} and
                   1487: @file{cexp.c} are more recent than @file{c-parse.y} and @file{cexp.y}
                   1488: and you do not plan to change the @samp{.y} files.)
                   1489: 
                   1490: Bison versions older that Sept 8, 1988 will produce incorrect output
                   1491: for @file{c-parse.tab.c}.
                   1492: 
                   1493: @item
                   1494: If you are using a Sun, make sure the environment variable
                   1495: @code{FLOAT_OPTION} is not set.  If this option were set to
                   1496: @code{f68881} when @file{gnulib} is compiled, the resulting code would
                   1497: demand to be linked with a special startup file and will not link
                   1498: properly without special pains.
                   1499: 
                   1500: @item
                   1501: Build the compiler.  Just type @samp{make} in the compiler directory.
                   1502: 
1.1.1.2   root     1503: Ignore any warnings you may see about ``statement not reached'' in the
                   1504: @file{insn-emit.c}; they are normal.  Any other compilation errors may
                   1505: represent bugs in the port to your machine or operating system, and
                   1506: should be investigated and reported (@pxref{Bugs}).
                   1507: 
1.1       root     1508: @item
1.1.1.5   root     1509: If you are using COFF-encapsulation, you must convert @file{gnulib} to
                   1510: a GNU-format library at this point.  See the file @file{README-ENCAP}
                   1511: in the directory containing the GNU binary file utilities, for
                   1512: directions.
                   1513: 
                   1514: @item
1.1       root     1515: Move the first-stage object files and executables into a subdirectory
                   1516: with this command:
                   1517: 
                   1518: @example
                   1519: make stage1
                   1520: @end example
                   1521: 
                   1522: The files are moved into a subdirectory named @file{stage1}.
                   1523: Once installation is complete, you may wish to delete these files
                   1524: with @code{rm -r stage1}.
                   1525: 
                   1526: @item
                   1527: Recompile the compiler with itself, with this command:
                   1528: 
                   1529: @example
                   1530: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/"
                   1531: @end example
                   1532: 
                   1533: On a 68000 or 68020 system lacking floating point hardware,
                   1534: unless you have selected a @file{tm.h} file that expects by default
                   1535: that there is no such hardware, do this instead:
                   1536: 
                   1537: @example
                   1538: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/ -msoft-float"
                   1539: @end example
                   1540: 
                   1541: @item
                   1542: If you wish to test the compiler by compiling it with itself one more
                   1543: time, do this:
                   1544: 
                   1545: @example
                   1546: make stage2
                   1547: make CC=stage2/gcc CFLAGS="-g -O -Bstage2/"
                   1548: foreach file (*.o)
                   1549: cmp $file stage2/$file
                   1550: end
                   1551: @end example
                   1552: 
                   1553: This will notify you if any of these stage 3 object files differs from
                   1554: those of stage 2.  Any difference, no matter how innocuous, indicates
                   1555: that the stage 2 compiler has compiled GNU CC incorrectly, and is
                   1556: therefore a potentially serious bug which you should investigate and
                   1557: report (@pxref{Bugs}).
                   1558: 
                   1559: Aside from the @samp{-B} option, the options should be the same as
                   1560: when you made stage 2.
                   1561: 
                   1562: @item
                   1563: Install the compiler driver, the compiler's passes and run-time support.
                   1564: You can use the following command:
                   1565: 
                   1566: @example
                   1567: make install
                   1568: @end example
                   1569: 
                   1570: @noindent
                   1571: This copies the files @file{cc1}, @file{cpp} and @file{gnulib} to
                   1572: files @file{gcc-cc1}, @file{gcc-cpp} and @file{gcc-gnulib} in
                   1573: directory @file{/usr/local/lib}, which is where the compiler driver
                   1574: program looks for them.  It also copies the driver program @file{gcc}
1.1.1.6 ! root     1575: into the directory @file{/usr/local/bin}, so that it appears in typical
1.1       root     1576: execution search paths.@refill
                   1577: 
                   1578: @strong{Warning: there is a bug in @code{alloca} in the Sun library.
                   1579: To avoid this bug, install the binaries of GNU CC that were compiled
                   1580: by GNU CC.  They use @code{alloca} as a built-in function and never
                   1581: the one in the library.}
                   1582: 
                   1583: @strong{Warning: the GNU CPP may not work for @file{ioctl.h},
                   1584: @file{ttychars.h} and other system header files unless the
                   1585: @samp{-traditional} option is used.}  The bug is in the header files:
                   1586: at least on some machines, they rely on behavior that is incompatible
                   1587: with ANSI C.  This behavior consists of substituting for macro
                   1588: argument names when they appear inside of character constants.  The
                   1589: @samp{-traditional} option tells GNU CC to behave the way these
                   1590: headers expect.
                   1591: 
                   1592: Because of this problem, you might prefer to configure GNU CC to use
                   1593: the system's own C preprocessor.  To do so, make the file
                   1594: @file{/usr/local/lib/gcc-cpp} a link to @file{/lib/cpp}.
                   1595: 
                   1596: Alternatively, on Sun systems and 4.3BSD at least, you can correct the
                   1597: include files by running the shell script @file{fixincludes}.  This
                   1598: installs modified, corrected copies of the files @file{ioctl.h},
                   1599: @file{ttychars.h} and many others, in a special directory where only
1.1.1.2   root     1600: GNU CC will normally look for them.  This script will work on various
1.1.1.6 ! root     1601: systems because it chooses the files by searching all the system
1.1.1.2   root     1602: headers for the problem cases that we know about.
1.1       root     1603: @end enumerate
                   1604: 
                   1605: If you cannot install the compiler's passes and run-time support in
                   1606: @file{/usr/local/lib}, you can alternatively use the @samp{-B} option to
                   1607: specify a prefix by which they may be found.  The compiler concatenates
                   1608: the prefix with the names  @file{cpp}, @file{cc1} and @file{gnulib}.
                   1609: Thus, you can put the files in a directory @file{/usr/foo/gcc} and
                   1610: specify @samp{-B/usr/foo/gcc/} when you run GNU CC.
                   1611: 
                   1612: Also, you can specify an alternative default directory for these files
                   1613: by setting the Make variable @code{libdir} when you make GNU CC.
                   1614: 
                   1615: @node VMS Install,, Installation, Installation
                   1616: @section Installing GNU CC on VMS
                   1617: 
1.1.1.4   root     1618: The VMS version of GNU CC is distributed in a backup saveset containing
                   1619: both source code and precompiled binaries.
                   1620: 
                   1621: Sometimes the binaries will be from an older version that the sources,
                   1622: because we don't always have time to update them.  In this case, you
                   1623: should use the binaries you get to recompile the sources.  If you must
1.1       root     1624: recompile, here is how:
                   1625: 
                   1626: @enumerate
                   1627: @item
1.1.1.3   root     1628: Copy the file @file{tm-vms.h} to @file{tm.h}, @file{xm-vms.h} to
1.1       root     1629: @file{config.h}, @file{vax.md} to @file{md.} and @file{output-vax.c}
                   1630: to @file{aux-output.c}.@refill
                   1631: 
                   1632: @item
                   1633: Type @samp{@@make} to do recompile everything.
1.1.1.5   root     1634: 
                   1635: If you are compiling with a version of GCC older than 1.33, specify
                   1636: @samp{/DEFINE=("inline=")} as an option in all the compilations.  This
                   1637: requires editing all the @code{gcc} commands in @file{make-cc1.com}.
                   1638: (The older versions had problems supporting @code{inline}.)  Once you
                   1639: have a working 1.33 or newer GCC, you can change this file back.
1.1       root     1640: @end enumerate
                   1641: 
                   1642: To install the @samp{GCC} command so you can use the compiler easily, in
                   1643: the same manner as you use the VMS C compiler, you must install the VMS CLD
                   1644: file for GNU CC as follows:
                   1645: 
                   1646: @enumerate
                   1647: @item
                   1648: Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
                   1649: to point to the directories where the GNU CC executables
                   1650: (@samp{gcc-cpp}, @samp{gcc-cc1}, etc.) and the C include files are
                   1651: kept.  This should be done with the commands:@refill
                   1652: 
                   1653: @example
                   1654: $ assign /super /system disk:[gcc] gnu_cc
                   1655: $ assign /super /system disk:[gcc.include] gnu_cc_include
                   1656: @end example
                   1657: 
                   1658: @noindent
                   1659: with the appropriate disk and directory names.  These commands can be
                   1660: placed in your system startup file so they will be executed whenever
                   1661: the machine is rebooted.
                   1662: 
                   1663: @item
                   1664: Install the @samp{GCC} command with the command line:
                   1665: 
                   1666: @example
                   1667: $ set command /table=sys$library:dcltables gnu_cc:gcc
                   1668: @end example
                   1669: 
                   1670: @noindent
                   1671: Now you can invoke the compiler with a command like @samp{gcc /verbose
                   1672: file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
                   1673: Unix.
                   1674: @end enumerate
                   1675: 
1.1.1.5   root     1676: There is a known problem on VMS: @code{const} global variables don't
                   1677: work compatibly with the VMS C compiler; we don't know a way to get
                   1678: them to the linker properly.
                   1679: 
1.1       root     1680: @node Trouble, Incompatibilities, Installation, Top
                   1681: @chapter Known Causes of Trouble with GNU CC.
                   1682: 
                   1683: Here are some of the things that have caused trouble for people installing
                   1684: or using GNU CC.
                   1685: 
                   1686: @itemize @bullet
                   1687: @item
                   1688: On certain systems, defining certain environment variables such as
                   1689: @samp{CC} can interfere with the functioning of @code{make}.
                   1690: 
                   1691: @item
                   1692: Cross compilation can run into trouble for certain machines because
                   1693: some target machines' assemblers require floating point numbers to be
                   1694: written as @emph{integer} constants in certain contexts.
                   1695: 
                   1696: The compiler writes these integer constants by examining the floating
                   1697: point value as an integer and printing that integer, because this is
                   1698: simple to write and independent of the details of the floating point
                   1699: representation.  But this does not work if the compiler is running on
                   1700: a different machine with an incompatible floating point format, or
                   1701: even a different byte-ordering.
                   1702: 
1.1.1.5   root     1703: In addition, correct constant folding of floating point values
                   1704: requires representing them in the target machine's format.
                   1705: (The C standard does not quite require this, but in practice
                   1706: it is the only way to win.)
                   1707: 
                   1708: It is now possible to overcome these problems by defining macros such
                   1709: as @code{REAL_VALUE_TYPE}.  But doing so is a substantial amount of
                   1710: work for each target machine.  @xref{Cross-compilation}.
1.1       root     1711: 
                   1712: @item
                   1713: DBX rejects some files produced by GNU CC, though it accepts similar
                   1714: constructs in output from PCC.  Until someone can supply a coherent
                   1715: description of what is valid DBX input and what is not, there is
                   1716: nothing I can do about these problems.  You are on your own.
1.1.1.2   root     1717: 
                   1718: @item
                   1719: Users often think it is a bug when GNU CC reports an error for code
                   1720: like this:
                   1721: 
                   1722: @example
                   1723: int foo (short);
                   1724: 
                   1725: int foo (x)
                   1726:      short x;
                   1727: @{@dots{}@}
                   1728: @end example
                   1729: 
1.1.1.4   root     1730: The error message is correct: this code really is erroneous, because the
                   1731: old-style non-prototype definition passes subword integers in their
                   1732: promoted types.  In other words, the argument is really an @code{int},
                   1733: not a @code{short}.  The correct prototype is this:
1.1.1.2   root     1734: 
                   1735: @example
                   1736: int foo (int);
                   1737: @end example
                   1738: 
                   1739: @item
                   1740: Users often think it is a bug when GNU CC reports an error for code
                   1741: like this:
                   1742: 
                   1743: @example
                   1744: int foo (struct mumble *);
                   1745: 
                   1746: struct mumble @{ @dots{} @};
                   1747: 
                   1748: int foo (struct mumble *x)
                   1749: @{ @dots{} @}
                   1750: @end example
                   1751: 
                   1752: This code really is erroneous, because the scope of @code{struct
                   1753: mumble} the prototype is limited to the argument list containing it.
                   1754: It does not refer to the @code{struct mumble} defined with file scope
                   1755: immediately below---they are two unrelated types with similar names in
                   1756: different scopes.
                   1757: 
                   1758: But in the definition of @code{foo}, the file-scope type is used
                   1759: because that is available to be inherited.  Thus, the definition and
                   1760: the prototype do not match, and you get an error.
                   1761: 
                   1762: This behavior may seem silly, but it's what the ANSI standard
                   1763: specifies.  It is easy enough for you to make your code work by moving
                   1764: the definition of @code{struct mumble} above the prototype.  I don't
                   1765: think it's worth being incompatible for.
1.1       root     1766: @end itemize
                   1767: 
                   1768: @node Incompatibilities, Extensions, Trouble, Top
                   1769: @chapter Incompatibilities of GNU CC
                   1770: 
                   1771: There are several noteworthy incompatibilities between GNU C and most
                   1772: existing (non-ANSI) versions of C.
                   1773: 
                   1774: Ultimately our intention is that the @samp{-traditional} option will
                   1775: eliminate most of these incompatibilities by telling GNU C to behave
                   1776: like the other C compilers.
                   1777: 
                   1778: @itemize @bullet
                   1779: @item
                   1780: GNU CC normally makes string constants read-only.  If several
                   1781: identical-looking string constants are used, GNU CC stores only one
                   1782: copy of the string.
                   1783: 
                   1784: One consequence is that you cannot call @code{mktemp} with a string
                   1785: constant argument.  The function @code{mktemp} always alters the
                   1786: string its argument points to.
                   1787: 
                   1788: Another consequence is that @code{sscanf} does not work on some
                   1789: systems when passed a string constant as its format control string.
                   1790: This is because @code{sscanf} incorrectly tries to write into the
1.1.1.4   root     1791: string constant.  Likewise @code{fscanf} and @code{scanf}.
1.1       root     1792: 
                   1793: The best solution to these problems is to change the program to use
                   1794: @code{char}-array variables with initialization strings for these
                   1795: purposes instead of string constants.  But if this is not possible,
                   1796: you can use the @samp{-fwritable-strings} flag, which directs GNU CC
                   1797: to handle string constants the same way most C compilers do.
                   1798: 
                   1799: @item
                   1800: GNU CC does not substitute macro arguments when they appear inside of
                   1801: string constants.  For example, the following macro in GNU CC
                   1802: 
                   1803: @example
                   1804: #define foo(a) "a"
                   1805: @end example
                   1806: 
                   1807: @noindent
                   1808: will produce output @samp{"a"} regardless of what the argument @var{a} is.
                   1809: 
                   1810: The @samp{-traditional} option directs GNU CC to handle such cases
                   1811: (among others) in the old-fashioned (non-ANSI) fashion.
                   1812: 
                   1813: @item
                   1814: When you use @code{setjmp} and @code{longjmp}, the only automatic
                   1815: variables guaranteed to remain valid are those declared
                   1816: @code{volatile}.  This is a consequence of automatic register
                   1817: allocation.  Consider this function:
                   1818: 
                   1819: @example
                   1820: jmp_buf j;
                   1821: 
                   1822: foo ()
                   1823: @{
                   1824:   int a, b;
                   1825: 
                   1826:   a = fun1 ();
                   1827:   if (setjmp (j))
                   1828:     return a;
                   1829: 
                   1830:   a = fun2 ();
                   1831:   /* @r{@code{longjmp (j)} may be occur in @code{fun3}.} */
                   1832:   return a + fun3 ();
                   1833: @}
                   1834: @end example
                   1835: 
                   1836: Here @code{a} may or may not be restored to its first value when the
                   1837: @code{longjmp} occurs.  If @code{a} is allocated in a register, then
                   1838: its first value is restored; otherwise, it keeps the last value stored
                   1839: in it.
                   1840: 
                   1841: If you use the @samp{-W} option with the @samp{-O} option, you will
                   1842: get a warning when GNU CC thinks such a problem might be possible.
                   1843: 
1.1.1.2   root     1844: The @samp{-traditional} option directs GNU C to put variables in
                   1845: the stack by default, rather than in registers, in functions that
                   1846: call @code{setjmp}.  This results in the behavior found in
                   1847: traditional C compilers.
                   1848: 
1.1       root     1849: @item
                   1850: Declarations of external variables and functions within a block apply
                   1851: only to the block containing the declaration.  In other words, they
                   1852: have the same scope as any other declaration in the same place.
                   1853: 
                   1854: In some other C compilers, a @code{extern} declaration affects all the
                   1855: rest of the file even if it happens within a block.
                   1856: 
                   1857: The @samp{-traditional} option directs GNU C to treat all @code{extern}
                   1858: declarations as global, like traditional compilers.
                   1859: 
                   1860: @item
                   1861: In traditional C, you can combine @code{long}, etc., with a typedef name,
                   1862: as shown here:
                   1863: 
                   1864: @example
                   1865: typedef int foo;
                   1866: typedef long foo bar;
                   1867: @end example
                   1868: 
                   1869: In ANSI C, this is not allowed: @code{long} and other type modifiers
                   1870: require an explicit @code{int}.  Because this criterion is expressed
                   1871: by Bison grammar rules rather than C code, the @samp{-traditional}
                   1872: flag cannot alter it.
                   1873: 
                   1874: @item
                   1875: PCC allows typedef names to be used as function parameters.  The
                   1876: difficulty described immediately above applies here too.
                   1877: 
                   1878: @item
                   1879: PCC allows whitespace in the middle of compound assignment operators
                   1880: such as @samp{+=}.  GNU CC, following the ANSI standard, does not
                   1881: allow this.  The difficulty described immediately above applies here
                   1882: too.
                   1883: 
                   1884: @item
                   1885: GNU CC will flag unterminated character constants inside of preprocessor
                   1886: conditionals that fail.  Some programs have English comments enclosed in
                   1887: conditionals that are guaranteed to fail; if these comments contain
                   1888: apostrophes, GNU CC will probably report an error.  For example,
                   1889: this code would produce an error:
                   1890: 
                   1891: @example
                   1892: #if 0
                   1893: You can't expect this to work.
                   1894: #endif
                   1895: @end example
                   1896: 
                   1897: The best solution to such a problem is to put the text into an actual
                   1898: C comment delimited by @samp{/*@dots{}*/}.  However,
                   1899: @samp{-traditional} suppresses these error messages.
                   1900: 
                   1901: @item
                   1902: When compiling functions that return @code{float}, PCC converts it to
                   1903: a double.  GNU CC actually returns a @code{float}.  If you are concerned
                   1904: with PCC compatibility, you should declare your functions to return
                   1905: @code{double}; you might as well say what you mean.
                   1906: 
                   1907: @item
                   1908: When compiling functions that return structures or unions, GNU CC
1.1.1.6 ! root     1909: output code normally uses a method different from that used on most
        !          1910: versions of Unix.  As a result, code compiled with GNU CC cannot call
        !          1911: a structure-returning function compiled with PCC, and vice versa.
1.1       root     1912: 
1.1.1.6 ! root     1913: The method used by GNU CC is as follows: a structure or union which is 1,
1.1       root     1914: 2, 4 or 8 bytes long is returned like a scalar.  A structure or union
                   1915: with any other size is stored into an address supplied by the caller
                   1916: in a special, fixed register.
                   1917: 
                   1918: PCC usually handles all sizes of structures and unions by returning
                   1919: the address of a block of static storage containing the value.  This
1.1.1.6 ! root     1920: method is not used in GNU CC because it is slower and nonreentrant.
1.1.1.5   root     1921: 
1.1.1.6 ! root     1922: You can tell GNU CC to use the PCC convention with the option
        !          1923: @samp{-fpcc-struct-return}.
1.1       root     1924: @end itemize
                   1925: 
                   1926: @node Extensions, Bugs, Incompatibilities, Top
                   1927: @chapter GNU Extensions to the C Language
                   1928: 
                   1929: GNU C provides several language features not found in ANSI standard C.
                   1930: (The @samp{-pedantic} option directs GNU CC to print a warning message if
                   1931: any of these features is used.)  To test for the availability of these
                   1932: features in conditional compilation, check for a predefined macro
                   1933: @code{__GNUC__}, which is always defined under GNU CC.
                   1934: 
                   1935: @menu
                   1936: * Statement Exprs::     Putting statements and declarations inside expressions.
                   1937: * Naming Types::        Giving a name to the type of some expression.
                   1938: * Typeof::             @code{typeof}: referring to the type of an expression.
                   1939: * Lvalues::            Using @samp{?:}, @samp{,} and casts in lvalues.
                   1940: * Conditionals::       Omitting the middle operand of a @samp{?:} expression.
                   1941: * Zero-Length::                Zero-length arrays.
                   1942: * Variable-Length::    Arrays whose length is computed at run time.
                   1943: * Subscripting::       Any array can be subscripted, even if not an lvalue.
                   1944: * Pointer Arith::      Arithmetic on @code{void}-pointers and function pointers.
1.1.1.5   root     1945: * Initializers::       Non-constant initializers.
1.1       root     1946: * Constructors::       Constructor expressions give structures, unions
                   1947:                         or arrays as values.
1.1.1.5   root     1948: * Function Attributes:: Declaring that functions have no side effects,
                   1949:                         or that they can never return.
1.1       root     1950: * Dollar Signs::        Dollar sign is allowed in identifiers.
                   1951: * Alignment::           Inquiring about the alignment of a type or variable.
                   1952: * Inline::              Defining inline functions (as fast as macros).
                   1953: * Extended Asm::       Assembler instructions with C expressions as operands.
                   1954:                         (With them you can define ``built-in'' functions.)
                   1955: * Asm Labels::         Specifying the assembler name to use for a C symbol.
1.1.1.5   root     1956: * Global Reg Vars::     Defining global variables which reside in registers.
1.1       root     1957: @end menu
                   1958: 
                   1959: @node Statement Exprs, Naming Types, Extensions, Extensions
                   1960: @section Statements and Declarations inside of Expressions
                   1961: 
                   1962: A compound statement in parentheses may appear inside an expression in GNU
                   1963: C.  This allows you to declare variables within an expression.  For
                   1964: example:
                   1965: 
                   1966: @example
                   1967: (@{ int y = foo (); int z;
                   1968:    if (y > 0) z = y;
                   1969:    else z = - y;
                   1970:    z; @})
                   1971: @end example
                   1972: 
                   1973: @noindent
                   1974: is a valid (though slightly more complex than necessary) expression
                   1975: for the absolute value of @code{foo ()}.
                   1976: 
                   1977: This feature is especially useful in making macro definitions ``safe'' (so
                   1978: that they evaluate each operand exactly once).  For example, the
                   1979: ``maximum'' function is commonly defined as a macro in standard C as
                   1980: follows:
                   1981: 
                   1982: @example
                   1983: #define max(a,b) ((a) > (b) ? (a) : (b))
                   1984: @end example
                   1985: 
                   1986: @noindent
                   1987: But this definition computes either @var{a} or @var{b} twice, with bad
                   1988: results if the operand has side effects.  In GNU C, if you know the
                   1989: type of the operands (here let's assume @code{int}), you can define
                   1990: the macro safely as follows:
                   1991: 
                   1992: @example
                   1993: #define maxint(a,b) \
                   1994:   (@{int _a = (a), _b = (b); _a > _b ? _a : _b; @})
                   1995: @end example
                   1996: 
                   1997: Embedded statements are not allowed in constant expressions, such as
                   1998: the value of an enumeration constant, the width of a bit field, or
                   1999: the initial value of a static variable.
                   2000: 
                   2001: If you don't know the type of the operand, you can still do this, but you
                   2002: must use @code{typeof} (@pxref{Typeof}) or type naming (@pxref{Naming
                   2003: Types}).
                   2004: 
                   2005: @node Naming Types, Typeof, Statement Exprs, Extensions
                   2006: @section Naming an Expression's Type
                   2007: 
                   2008: You can give a name to the type of an expression using a @code{typedef}
                   2009: declaration with an initializer.  Here is how to define @var{name} as a
                   2010: type name for the type of @var{exp}:
                   2011: 
                   2012: @example
                   2013: typedef @var{name} = @var{exp};
                   2014: @end example
                   2015: 
                   2016: This is useful in conjunction with the statements-within-expressions
                   2017: feature.  Here is how the two together can be used to define a safe
                   2018: ``maximum'' macro that operates on any arithmetic type:
                   2019: 
                   2020: @example
                   2021: #define max(a,b) \
                   2022:   (@{typedef _ta = (a), _tb = (b);  \
                   2023:     _ta _a = (a); _tb _b = (b);     \
                   2024:     _a > _b ? _a : _b; @})
                   2025: @end example
                   2026: 
                   2027: The reason for using names that start with underscores for the local
                   2028: variables is to avoid conflicts with variable names that occur within the
                   2029: expressions that are substituted for @code{a} and @code{b}.  Eventually we
                   2030: hope to design a new form of declaration syntax that allows you to declare
                   2031: variables whose scopes start only after their initializers; this will be a
                   2032: more reliable way to prevent such conflicts.
                   2033: 
                   2034: @node Typeof, Lvalues, Naming Types, Extensions
                   2035: @section Referring to a Type with @code{typeof}
                   2036: 
                   2037: Another way to refer to the type of an expression is with @code{typeof}.
                   2038: The syntax of using of this keyword looks like @code{sizeof}, but the
                   2039: construct acts semantically like a type name defined with @code{typedef}.
                   2040: 
                   2041: There are two ways of writing the argument to @code{typeof}: with an
                   2042: expression or with a type.  Here is an example with an expression:
                   2043: 
                   2044: @example
                   2045: typeof (x[0](1))
                   2046: @end example
                   2047: 
                   2048: @noindent
                   2049: This assumes that @code{x} is an array of functions; the type described
                   2050: is that of the values of the functions.
                   2051: 
                   2052: Here is an example with a typename as the argument:
                   2053: 
                   2054: @example
                   2055: typeof (int *)
                   2056: @end example
                   2057: 
                   2058: @noindent
                   2059: Here the type described is that of pointers to @code{int}.
                   2060: 
                   2061: A @code{typeof}-construct can be used anywhere a typedef name could be
                   2062: used.  For example, you can use it in a declaration, in a cast, or inside
                   2063: of @code{sizeof} or @code{typeof}.
                   2064: 
                   2065: @itemize @bullet
                   2066: @item
                   2067: This declares @code{y} with the type of what @code{x} points to.
                   2068: 
                   2069: @example
                   2070: typeof (*x) y;
                   2071: @end example
                   2072: 
                   2073: @item
                   2074: This declares @code{y} as an array of such values.
                   2075: 
                   2076: @example
                   2077: typeof (*x) y[4];
                   2078: @end example
                   2079: 
                   2080: @item
                   2081: This declares @code{y} as an array of pointers to characters:
                   2082: 
                   2083: @example
                   2084: typeof (typeof (char *)[4]) y;
                   2085: @end example
                   2086: 
                   2087: @noindent
                   2088: It is equivalent to the following traditional C declaration:
                   2089: 
                   2090: @example
                   2091: char *y[4];
                   2092: @end example
                   2093: 
                   2094: To see the meaning of the declaration using @code{typeof}, and why it
                   2095: might be a useful way to write, let's rewrite it with these macros:
                   2096: 
                   2097: @example
                   2098: #define pointer(T)  typeof(T *)
                   2099: #define array(T, N) typeof(T [N])
                   2100: @end example
                   2101: 
                   2102: @noindent
                   2103: Now the declaration can be rewritten this way:
                   2104: 
                   2105: @example
                   2106: array (pointer (char), 4) y;
                   2107: @end example
                   2108: 
                   2109: @noindent
                   2110: Thus, @samp{array (pointer (char), 4)} is the type of arrays of 4
                   2111: pointers to @code{char}.
                   2112: @end itemize
                   2113: 
                   2114: @node Lvalues, Conditionals, Typeof, Extensions
                   2115: @section Generalized Lvalues
                   2116: 
                   2117: Compound expressions, conditional expressions and casts are allowed as
                   2118: lvalues provided their operands are lvalues.  This means that you can take
                   2119: their addresses or store values into them.
                   2120: 
                   2121: For example, a compound expression can be assigned, provided the last
                   2122: expression in the sequence is an lvalue.  These two expressions are
                   2123: equivalent:
                   2124: 
                   2125: @example
                   2126: (a, b) += 5
                   2127: a, (b += 5)
                   2128: @end example
                   2129: 
                   2130: Similarly, the address of the compound expression can be taken.  These two
                   2131: expressions are equivalent:
                   2132: 
                   2133: @example
                   2134: &(a, b)
                   2135: a, &b
                   2136: @end example
                   2137: 
                   2138: A conditional expression is a valid lvalue if its type is not void and the
                   2139: true and false branches are both valid lvalues.  For example, these two
                   2140: expressions are equivalent:
                   2141: 
                   2142: @example
                   2143: (a ? b : c) = 5
                   2144: (a ? b = 5 : (c = 5))
                   2145: @end example
                   2146: 
                   2147: A cast is a valid lvalue if its operand is valid.  Taking the address of
                   2148: the cast is the same as taking the address without a cast, except for the
                   2149: type of the result.  For example, these two expressions are equivalent (but
                   2150: the second may be valid when the type of @samp{a} does not permit a cast to
                   2151: @samp{int *}).
                   2152: 
                   2153: @example
                   2154: &(int *)a
                   2155: (int **)&a
                   2156: @end example
                   2157: 
                   2158: A simple assignment whose left-hand side is a cast works by converting the
                   2159: right-hand side first to the specified type, then to the type of the inner
                   2160: left-hand side expression.  After this is stored, the value is converter
                   2161: back to the specified type to become the value of the assignment.  Thus, if
                   2162: @samp{a} has type @samp{char *}, the following two expressions are
                   2163: equivalent:
                   2164: 
                   2165: @example
                   2166: (int)a = 5
                   2167: (int)(a = (char *)5)
                   2168: @end example
                   2169: 
                   2170: An assignment-with-arithmetic operation such as @samp{+=} applied to a cast
                   2171: performs the arithmetic using the type resulting from the cast, and then
                   2172: continues as in the previous case.  Therefore, these two expressions are
                   2173: equivalent:
                   2174: 
                   2175: @example
                   2176: (int)a += 5
                   2177: (int)(a = (char *) ((int)a + 5))
                   2178: @end example
                   2179: 
                   2180: @node Conditionals, Zero-Length, Lvalues, Extensions
                   2181: @section Conditional Expressions with Omitted Middle-Operands
                   2182: 
                   2183: The middle operand in a conditional expression may be omitted.  Then
                   2184: if the first operand is nonzero, its value is the value of the conditional
                   2185: expression.
                   2186: 
                   2187: Therefore, the expression
                   2188: 
                   2189: @example
                   2190: x ? : y
                   2191: @end example
                   2192: 
                   2193: @noindent
                   2194: has the value of @code{x} if that is nonzero; otherwise, the value of
                   2195: @code{y}.
                   2196: 
                   2197: This example is perfectly equivalent to
                   2198: 
                   2199: @example
                   2200: x ? x : y
                   2201: @end example
                   2202: 
                   2203: @noindent
                   2204: In this simple case, the ability to omit the middle operand is not
                   2205: especially useful.  When it becomes useful is when the first operand does,
                   2206: or may (if it is a macro argument), contain a side effect.  Then repeating
                   2207: the operand in the middle would perform the side effect twice.  Omitting
                   2208: the middle operand uses the value already computed without the undesirable
                   2209: effects of recomputing it.
                   2210: 
                   2211: @node Zero-Length, Variable-Length, Conditionals, Extensions
                   2212: @section Arrays of Length Zero
                   2213: 
                   2214: Zero-length arrays are allowed in GNU C.  They are very useful as the last
                   2215: element of a structure which is really a header for a variable-length
                   2216: object:
                   2217: 
                   2218: @example
                   2219: struct line @{
                   2220:   int length;
                   2221:   char contents[0];
                   2222: @};
                   2223: 
                   2224: @{
                   2225:   struct line *thisline 
                   2226:     = (struct line *) malloc (sizeof (struct line) + this_length);
                   2227:   thisline->length = this_length;
                   2228: @}
                   2229: @end example
                   2230: 
                   2231: In standard C, you would have to give @code{contents} a length of 1, which
                   2232: means either you waste space or complicate the argument to @code{malloc}.
                   2233: 
                   2234: @node Variable-Length, Subscripting, Zero-Length, Extensions
                   2235: @section Arrays of Variable Length
                   2236: 
                   2237: Variable-length automatic arrays are allowed in GNU C.  These arrays are
                   2238: declared like any other automatic arrays, but with a length that is not a
                   2239: constant expression.  The storage is allocated at that time and
                   2240: deallocated when the brace-level is exited.  For example:
                   2241: 
                   2242: @example
                   2243: FILE *concat_fopen (char *s1, char *s2, char *mode)
                   2244: @{
                   2245:   char str[strlen (s1) + strlen (s2) + 1];
                   2246:   strcpy (str, s1);
                   2247:   strcat (str, s2);
                   2248:   return fopen (str, mode);
                   2249: @}
                   2250: @end example
                   2251: 
                   2252: You can also define structure types containing variable-length arrays, and
                   2253: use them even for arguments or function values, as shown here:
                   2254: 
                   2255: @example
                   2256: int foo;
                   2257: 
                   2258: struct entry
                   2259: @{
                   2260:   char data[foo];
                   2261: @};
                   2262: 
                   2263: struct entry
                   2264: tester (struct entry arg)
                   2265: @{
                   2266:   struct entry new;
                   2267:   int i;
                   2268:   for (i = 0; i < foo; i++)
                   2269:     new.data[i] = arg.data[i] + 1;
                   2270:   return new;
                   2271: @}
                   2272: @end example
                   2273: 
                   2274: @noindent
                   2275: (Eventually there will be a way to say that the size of the array is
                   2276: another member of the same structure.)
                   2277: 
                   2278: The length of an array is computed on entry to the brace-level where the
                   2279: array is declared and is remembered for the scope of the array in case you
                   2280: access it with @code{sizeof}.
                   2281: 
                   2282: Jumping or breaking out of the scope of the array name will also deallocate
                   2283: the storage.  Jumping into the scope is not allowed; you will get an error
                   2284: message for it.
                   2285: 
                   2286: You can use the function @code{alloca} to get an effect much like
                   2287: variable-length arrays.  The function @code{alloca} is available in
                   2288: many other C implementations (but not in all).  On the other hand,
                   2289: variable-length arrays are more elegant.
                   2290: 
                   2291: There are other differences between these two methods.  Space allocated
                   2292: with @code{alloca} exists until the containing @emph{function} returns.
                   2293: The space for a variable-length array is deallocated as soon as the array
                   2294: name's scope ends.  (If you use both variable-length arrays and
                   2295: @code{alloca} in the same function, deallocation of a variable-length array
                   2296: will also deallocate anything more recently allocated with @code{alloca}.)
                   2297: 
                   2298: @node Subscripting, Pointer Arith, Variable-Length, Extensions
                   2299: @section Non-Lvalue Arrays May Have Subscripts
                   2300: 
                   2301: Subscripting is allowed on arrays that are not lvalues, even though the
                   2302: unary @samp{&} operator is not.  For example, this is valid in GNU C though
                   2303: not valid in other C dialects:
                   2304: 
                   2305: @example
                   2306: struct foo @{int a[4];@};
                   2307: 
                   2308: struct foo f();
                   2309: 
                   2310: bar (int index)
                   2311: @{
                   2312:   return f().a[index];
                   2313: @}
                   2314: @end example
                   2315: 
                   2316: @node Pointer Arith, Initializers, Subscripting, Extensions
                   2317: @section Arithmetic on @code{void}-Pointers and Function Pointers
                   2318: 
                   2319: In GNU C, addition and subtraction operations are supported on pointers to
                   2320: @code{void} and on pointers to functions.  This is done by treating the
                   2321: size of a @code{void} or of a function as 1.
                   2322: 
                   2323: A consequence of this is that @code{sizeof} is also allowed on @code{void}
                   2324: and on function types, and returns 1.
                   2325: 
                   2326: @node Initializers, Constructors, Pointer Arith, Extensions
                   2327: @section Non-Constant Initializers
                   2328: 
                   2329: The elements of an aggregate initializer are not required to be constant
                   2330: expressions in GNU C.  Here is an example of an initializer with run-time
                   2331: varying elements:
                   2332: 
                   2333: @example
                   2334: foo (float f, float g)
                   2335: @{
                   2336:   float beat_freqs[2] = @{ f-g, f+g @};
                   2337:   @dots{}
                   2338: @}
                   2339: @end example
                   2340: 
1.1.1.5   root     2341: @node Constructors, Function Attributes, Initializers, Extensions
1.1       root     2342: @section Constructor Expressions
                   2343: 
                   2344: GNU C supports constructor expressions.  A constructor looks like a cast
                   2345: containing an initializer.  Its value is an object of the type specified in
                   2346: the cast, containing the elements specified in the initializer.  The type
                   2347: must be a structure, union or array type.
                   2348: 
                   2349: Assume that @code{struct foo} and @code{structure} are declared as shown:
                   2350: 
                   2351: @example
                   2352: struct foo @{int a; char b[2];@} structure;
                   2353: @end example
                   2354: 
                   2355: @noindent
                   2356: Here is an example of constructing a @samp{struct foo} with a constructor:
                   2357: 
                   2358: @example
                   2359: structure = ((struct foo) @{x + y, 'a', 0@});
                   2360: @end example
                   2361: 
                   2362: @noindent
                   2363: This is equivalent to writing the following:
                   2364: 
                   2365: @example
                   2366: @{
                   2367:   struct foo temp = @{x + y, 'a', 0@};
                   2368:   structure = temp;
                   2369: @}
                   2370: @end example
                   2371: 
                   2372: You can also construct an array.  If all the elements of the constructor
                   2373: are (made up of) simple constant expressions, suitable for use in
                   2374: initializers, then the constructor is an lvalue and can be coerced to a
                   2375: pointer to its first element, as shown here:
                   2376: 
                   2377: @example
                   2378: char **foo = (char *[]) @{ "x", "y", "z" @};
                   2379: @end example
                   2380: 
                   2381: Array constructors whose elements are not simple constants are not very
                   2382: useful, because the constructor is not an lvalue.  There are only two valid
                   2383: ways to use it: to subscript it, or initialize an array variable with it.
                   2384: The former is probably slower than a @code{switch} statement, while the
                   2385: latter does the same thing an ordinary C initializer would do.
                   2386: 
                   2387: @example
                   2388: output = ((int[]) @{ 2, x, 28 @}) [input];
                   2389: @end example
                   2390: 
1.1.1.5   root     2391: @node Function Attributes, Dollar Signs, Constructors
                   2392: @section Declaring Attributes of Functions
                   2393: 
                   2394: In GNU C, you declare certain things about functions called in your program
                   2395: which help the compiler optimize function calls.
                   2396: 
                   2397: A few functions, such as @code{abort} and @code{exit}, cannot return.
                   2398: These functions should be declared @code{volatile}.  For example,
                   2399: 
                   2400: @example
                   2401: extern volatile void abort ();
                   2402: @end example
                   2403: 
                   2404: @noindent
                   2405: tells the compiler that it can assume that @code{abort} will not return.
                   2406: This makes slightly better code, but more importantly it helps avoid
                   2407: spurious warnings of uninitialized variables.
                   2408: 
                   2409: Many functions do not examine any values except their arguments, and
                   2410: have no effects except the return value.  Such a function can be subject
                   2411: to common subexpression elimination and loop optimization just as an
                   2412: arithmetic operator would be.  These functions should be declared
                   2413: @code{const}.  For example,
                   2414: 
                   2415: @example
                   2416: extern const void square ();
                   2417: @end example
                   2418: 
                   2419: @noindent
                   2420: says that the hypothetical function @code{square} is safe to call
                   2421: fewer times than the program says.
                   2422: 
                   2423: Note that a function that has pointer arguments and examines the data
                   2424: pointed to must @emph{not} be declared @code{const}.  Likewise, a
                   2425: function that calls a non-@code{const} function must not be
                   2426: @code{const}.
                   2427: 
                   2428: Some people object to this feature, claiming that ANSI C's @code{#pragma}
                   2429: should be used instead.  There are two reasons I did not do this.
                   2430: 
                   2431: @enumerate
                   2432: @item
                   2433: It is impossible to generate @code{#pragma} commands from a macro.
                   2434: 
                   2435: @item
                   2436: The @code{#pragma} command is just as likely as these keywords to mean
                   2437: something else in another compiler.
                   2438: @end enumerate
                   2439: 
                   2440: These two reasons apply to @emph{any} application whatever: as far as
                   2441: I can see, @code{#pragma} is never useful.
                   2442: 
                   2443: @node Dollar Signs, Alignment, Function Attributes, Extensions
1.1       root     2444: @section Dollar Signs in Identifier Names
                   2445: 
                   2446: In GNU C, you may use dollar signs in identifier names.  This is because
                   2447: many traditional C implementations allow such identifiers.
                   2448: 
                   2449: @node Alignment, Inline, Dollar Signs, Extensions
                   2450: @section Inquiring about the Alignment of a Type or Variable
                   2451: 
                   2452: The keyword @code{__alignof} allows you to inquire about how an object
                   2453: is aligned, or the minimum alignment usually required by a type.  Its
                   2454: syntax is just like @code{sizeof}.
                   2455: 
                   2456: For example, if the target machine requires a @code{double} value to be
                   2457: aligned on an 8-byte boundary, then @code{__alignof (double)} is 8.  This
                   2458: is true on many RISC machines.  On more traditional machine designs,
                   2459: @code{__alignof (double)} is 4 or even 2.
                   2460: 
                   2461: Some machines never actually require alignment; they allow reference to any
                   2462: data type even at an odd addresses.  For these machines, @code{__alignof}
                   2463: reports the @emph{recommended} alignment of a type.
                   2464: 
                   2465: When the operand of @code{__alignof} is an lvalue rather than a type, the
                   2466: value is the largest alignment that the lvalue is known to have.  It may
                   2467: have this alignment as a result of its data type, or because it is part of
                   2468: a structure and inherits alignment from that structure. For example, after
                   2469: this declaration:
                   2470: 
                   2471: @example
                   2472: struct foo @{ int x; char y; @} foo1;
                   2473: @end example
                   2474: 
                   2475: @noindent
                   2476: the value of @code{__alignof (foo1.y)} is probably 2 or 4, the same as
                   2477: @code{__alignof (int)}, even though the data type of @code{foo1.y} does not
                   2478: itself demand any alignment.@refill
                   2479: 
                   2480: @node Inline, Extended Asm, Alignment, Extensions
                   2481: @section An Inline Function is As Fast As a Macro
                   2482: 
                   2483: By declaring a function @code{inline}, you can direct GNU CC to integrate
                   2484: that function's code into the code for its callers.  This makes execution
                   2485: faster by eliminating the function-call overhead; in addition, if any of
                   2486: the actual argument values are constant, their known values may permit
                   2487: simplifications at compile time so that not all of the inline function's
                   2488: code needs to be included.
                   2489: 
                   2490: To declare a function inline, use the @code{inline} keyword in its
                   2491: declaration, like this:
                   2492: 
                   2493: @example
                   2494: inline int
                   2495: inc (int *a)
                   2496: @{
                   2497:   (*a)++;
                   2498: @}
                   2499: @end example
                   2500: 
                   2501: You can also make all ``simple enough'' functions inline with the
                   2502: option @samp{-finline-functions}.  Note that certain usages in a
                   2503: function definition can make it unsuitable for inline substitution.
                   2504: 
                   2505: When a function is both inline and @code{static}, if all calls to the
                   2506: function are integrated into the caller, then the function's own assembler
                   2507: code is never referenced.  In this case, GNU CC does not actually output
                   2508: assembler code for the function, unless you specify the option
                   2509: @samp{-fkeep-inline-functions}.  Some calls cannot be integrated for
                   2510: various reasons (in particular, calls that precede the function's
                   2511: definition cannot be integrated, and neither can recursive calls within the
                   2512: definition).  If there is a nonintegrated call, then the function is
                   2513: compiled to assembler code as usual.
                   2514: 
                   2515: When an inline function is not @code{static}, then the compiler must assume
                   2516: that there may be calls from other source files; since a global symbol can
                   2517: be defined only once in any program, the function must not be defined in
                   2518: the other source files, so the calls therein cannot be integrated.
                   2519: Therefore, a non-@code{static} inline function is always compiled on its
                   2520: own in the usual fashion.
                   2521: 
                   2522: @node Extended Asm, Asm Labels, Inline, Extensions
                   2523: @section Assembler Instructions with C Expression Operands
                   2524: 
                   2525: In an assembler instruction using @code{asm}, you can now specify the
                   2526: operands of the instruction using C expressions.  This means no more
                   2527: guessing which registers or memory locations will contain the data you want
                   2528: to use.
                   2529: 
                   2530: You must specify an assembler instruction template much like what appears
                   2531: in a machine description, plus an operand constraint string for each
                   2532: operand.
                   2533: 
                   2534: For example, here is how to use the 68881's @code{fsinx} instruction:
                   2535: 
                   2536: @example
                   2537: asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
                   2538: @end example
                   2539: 
                   2540: @noindent
                   2541: Here @code{angle} is the C expression for the input operand while
                   2542: @code{result} is that of the output operand.  Each has @samp{"f"} as its
                   2543: operand constraint, saying that a floating-point register is required.  The
1.1.1.5   root     2544: @samp{=} in @samp{=f} indicates that the operand is an output; all output
1.1.1.4   root     2545: operands' constraints must use @samp{=}.  The constraints use the same
                   2546: language used in the machine description (@pxref{Constraints}).
1.1       root     2547: 
                   2548: Each operand is described by an operand-constraint string followed by the C
                   2549: expression in parentheses.  A colon separates the assembler template from
                   2550: the first output operand, and another separates the last output operand
                   2551: from the first input, if any.  Commas separate output operands and separate
1.1.1.4   root     2552: inputs.  The total number of operands is limited to the maximum number of
1.1       root     2553: operands in any instruction pattern in the machine description.
                   2554: 
1.1.1.4   root     2555: If there are no output operands, and there are input operands, then there
                   2556: must be two consecutive colons surrounding the place where the output
                   2557: operands would go.
                   2558: 
1.1       root     2559: Output operand expressions must be lvalues; the compiler can check this.
                   2560: The input operands need not be lvalues.  The compiler cannot check whether
                   2561: the operands have data types that are reasonable for the instruction being
                   2562: executed.  It does not parse the assembler instruction template and does
                   2563: not know what it means, or whether it is valid assembler input.  The
                   2564: extended @code{asm} feature is most often used for machine instructions
                   2565: that the compiler itself does not know exist.
                   2566: 
                   2567: The output operands must be write-only; GNU CC will assume that the values
                   2568: in these operands before the instruction are dead and need not be
                   2569: generated.  For an operand that is read-write, or in which not all bits are
                   2570: written and the other bits contain useful information, you must logically
                   2571: split its function into two separate operands, one input operand and one
                   2572: write-only output operand.  The connection between them is expressed by
                   2573: constraints which say they need to be in the same location when the
                   2574: instruction executes.  You can use the same C expression for both operands,
                   2575: or different expressions.  For example, here we write the (fictitious)
                   2576: @samp{combine} instruction with @code{bar} as its read-only source operand
                   2577: and @code{foo} as its read-write destination:
                   2578: 
                   2579: @example
                   2580: asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
                   2581: @end example
                   2582: 
                   2583: @noindent
                   2584: The constraint @samp{"0"} for operand 1 says that it must occupy the same
1.1.1.5   root     2585: location as operand 0.  A digit in constraint is allowed only in an input
                   2586: operand, and it must refer to an output operand.
1.1       root     2587: 
                   2588: Only a digit in the constraint can guarantee that one operand will be in
                   2589: the same place as another.  The mere fact that @code{foo} is the value of
                   2590: both operands is not enough to guarantee that they will be in the same
                   2591: place in the generated assembler code.  The following would not work:
                   2592: 
                   2593: @example
                   2594: asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
                   2595: @end example
                   2596: 
                   2597: Various optimizations or reloading could cause operands 0 and 1 to be in
                   2598: different registers; GNU CC knows no reason not to do so.  For example, the
                   2599: compiler might find a copy of the value of @code{foo} in one register and
                   2600: use it for operand 1, but generate the output operand 0 in a different
                   2601: register (copying it afterward to @code{foo}'s own address).  Of course,
                   2602: since the register for operand 1 is not even mentioned in the assembler
                   2603: code, the result will not work, but GNU CC can't tell that.
                   2604: 
                   2605: Unless an output operand has the @samp{&} constraint modifier, GNU CC may
                   2606: allocate it in the same register as an unrelated input operand, on the
                   2607: assumption that the inputs are consumed before the outputs are produced.
                   2608: This assumption may be false if the assembler code actually consists of
                   2609: more than one instruction.  In such a case, use @samp{&} for each output
                   2610: operand that may not overlap an input.  @xref{Modifiers}.
                   2611: 
1.1.1.4   root     2612: Some instructions clobber specific hard registers.  To describe this, write
                   2613: a third colon after the input operands, followed by the names of the
                   2614: clobbered hard registers (given as strings).  Here is a realistic example
                   2615: for the vax:
1.1       root     2616: 
                   2617: @example
                   2618: asm volatile ("movc3 %0,%1,%2"
                   2619:               : /* no outputs */
                   2620:               : "g" (from), "g" (to), "g" (count)
                   2621:               : "r0", "r1", "r2", "r3", "r4", "r5");
                   2622: @end example
                   2623: 
1.1.1.4   root     2624: You can put multiple assembler instructions together in a single @code{asm}
                   2625: template, separated with semicolons.  The input operands are guaranteed not
                   2626: to use any of the clobbered registers, and neither will the output
                   2627: operands' addresses, so you can read and write the clobbered registers as
                   2628: many times as you like.  Here is an example of multiple instructions in a
                   2629: template; it assumes that the subroutine @code{_foo} accepts arguments in
                   2630: registers 9 and 10:
                   2631: 
                   2632: @example
                   2633: asm ("movl %0,r9;movl %1,r10;call _foo"
                   2634:      : /* no outputs */
                   2635:      : "g" (from), "g" (to)
                   2636:      : "r9", "r10");
                   2637: @end example
                   2638: 
1.1       root     2639: Usually the most convenient way to use these @code{asm} instructions is to
                   2640: encapsulate them in macros that look like functions.  For example,
                   2641: 
                   2642: @example
                   2643: #define sin(x)       \
                   2644: (@{ double __value, __arg = (x);   \
                   2645:    asm ("fsinx %1,%0": "=f" (__value): "f" (__arg));  \
                   2646:    __value; @})
                   2647: @end example
                   2648: 
                   2649: @noindent
                   2650: Here the variable @code{__arg} is used to make sure that the instruction
                   2651: operates on a proper @code{double} value, and to accept only those
                   2652: arguments @code{x} which can convert automatically to a @code{double}.
                   2653: 
                   2654: Another way to make sure the instruction operates on the correct data type
                   2655: is to use a cast in the @code{asm}.  This is different from using a
                   2656: variable @code{__arg} in that it converts more different types.  For
                   2657: example, if the desired type were @code{int}, casting the argument to
                   2658: @code{int} would accept a pointer with no complaint, while assigning the
                   2659: argument to an @code{int} variable named @code{__arg} would warn about
                   2660: using a pointer unless the caller explicitly casts it.
                   2661: 
1.1.1.4   root     2662: If an @code{asm} has output operands, GNU CC assumes for optimization
                   2663: purposes that the instruction has no side effects except to change the
                   2664: output operands.  This does not mean that instructions with a side effect
                   2665: cannot be used, but you must be careful, because the compiler may eliminate
                   2666: them if the output operands aren't used, or move them out of loops, or
                   2667: replace two with one if they constitute a common subexpression.  Also, if
                   2668: your instruction does have a side effect on a variable that otherwise
                   2669: appears not to change, the old value of the variable may be reused later if
                   2670: it happens to be found in a register.
1.1       root     2671: 
                   2672: You can prevent an @code{asm} instruction from being deleted, moved or
                   2673: combined by writing the keyword @code{volatile} after the @code{asm}.  For
                   2674: example:
                   2675: 
                   2676: @example
                   2677: #define set_priority(x)  \
                   2678: asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
                   2679: @end example
                   2680: 
1.1.1.4   root     2681: If there are no output operands, the instruction will not be deleted or
                   2682: moved.
                   2683: 
1.1       root     2684: It is a natural idea to look for a way to give access to the condition
                   2685: code left by the assembler instruction.  However, when we attempted to
                   2686: implement this, we found no way to make it work reliably.  The problem
                   2687: is that output operands might need reloading, which would result in
                   2688: additional following ``store'' instructions.  On most machines, these
                   2689: instructions would alter the condition code before there was time to
                   2690: test it.  This problem doesn't arise for ordinary ``test'' and
                   2691: ``compare'' instructions because they don't have any output operands.
                   2692: 
1.1.1.5   root     2693: @node Asm Labels, Global Reg Vars, Extended Asm, Extensions
1.1       root     2694: @section Controlling Names Used in Assembler Code
                   2695: 
                   2696: You can specify the name to be used in the assembler code for a C function
                   2697: or variable by writing the @code{asm} keyword after the declarator as
                   2698: follows:
                   2699: 
                   2700: @example
                   2701: int foo asm ("myfoo") = 2;
                   2702: @end example
                   2703: 
                   2704: @noindent
                   2705: This specifies that the name to be used for the variable @code{foo} in
                   2706: the assembler code should be @samp{myfoo} rather than the usual
                   2707: @samp{_foo}.
                   2708: 
                   2709: On systems where an underscore is normally prepended to the name of a C
                   2710: function or variable, this feature allows you to define names for the
                   2711: linker that do not start with an underscore.
                   2712: 
                   2713: You cannot use @code{asm} in this way in a function @emph{definition}; but
                   2714: you can get the same effect by writing a declaration for the function
                   2715: before its definition and putting @code{asm} there, like this:
                   2716: 
                   2717: @example
                   2718: extern func () asm ("FUNC");
                   2719: 
                   2720: func (x, y)
                   2721:      int x, y;
                   2722: @dots{}
                   2723: @end example
                   2724: 
                   2725: It is up to you to make sure that the assembler names you choose do not
                   2726: conflict with any other assembler symbols.  Also, you must not use a
                   2727: register name; that would produce completely invalid assembler code.  GNU
                   2728: CC does not as yet have the ability to store static variables in registers.
                   2729: Perhaps that will be added.
                   2730: 
1.1.1.5   root     2731: @node Global Reg Vars,, Asm Labels, Extensions
                   2732: @section Global Variables in Registers
                   2733: 
                   2734: A few programs, such as programming language interpreters, may have a
                   2735: couple of global variables that are accessed so often that it is worth
                   2736: while to reserve registers throughout the program just for them.
                   2737: 
                   2738: You can define a global register variable in GNU C like this:
                   2739: 
                   2740: @example
                   2741: register int *foo asm ("a5");
                   2742: @end example
                   2743: 
                   2744: @noindent
                   2745: Here @code{a5} is the name of the register which should be used.  Choose a
                   2746: register which is normally saved and restored by function calls on your
                   2747: machine, so that library routines will not clobber it.
                   2748: 
                   2749: Naturally the register name is cpu-dependent, so you would need to
                   2750: conditionalize your program according to cpu type.  The register
                   2751: @code{a5} would be a good choice on a 68000 for a variable of pointer
                   2752: type.  On machines with register windows, be sure to choose a ``global''
                   2753: register that is not affected by the function call mechanism.
                   2754: 
                   2755: In addition, operating systems on one type of cpu may differ in how they
                   2756: name the registers; then you would need additional conditionals.  For
                   2757: example, some 68000 operating systems call this register @code{%a5}.
                   2758: 
                   2759: Eventually there may be a way of asking the compiler to choose a register
                   2760: automatically, but first we need to figure out how it should choose and
1.1.1.6 ! root     2761: how to enable you to guide the choice.  No solution is evident.
1.1.1.5   root     2762: 
                   2763: Defining a global register variable in a certain register reserves that
                   2764: register entirely for this use, at least within the current compilation.
                   2765: The register will not be allocated for any other purpose in the functions
                   2766: in the current compilation.  The register will not be saved and restored by
                   2767: these functions.  Stores into this register are never deleted even if they
                   2768: would appear to be dead, but references may be deleted or moved or
                   2769: simplified.
                   2770: 
                   2771: It is not safe to access the global register variables from signal
                   2772: handlers, or from more than one thread of control, because the system
                   2773: library routines may temporarily use the register for other things (unless
                   2774: you recompile them specially for the task at hand).
                   2775: 
                   2776: It is not safe for one function that uses a global register variable to
                   2777: call another such function @code{foo} by way of a third function
                   2778: @code{lose} that was compiled without knowledge of this variable (i.e. in a
                   2779: different source file in which the variable wasn't declared).  This is
                   2780: because @code{lose} might save the register and put some other value there.
                   2781: For example, you can't expect a global register variable to be available in
                   2782: the comparison-function that you pass to @code{qsort}, since @code{qsort}
                   2783: might have put something else in that register.  (If you are prepared to
                   2784: recompile @code{qsort} with the same global register variable, you can
                   2785: solve this problem.)
                   2786: 
                   2787: If you want to recompile @code{qsort} or other source files which do not
                   2788: actually use your global register variable, so that they will not use that
                   2789: register for any other purpose, then it suffices to specify the compiler
                   2790: option @samp{-ffixed-@var{reg}}.  You need not actually add a global
                   2791: register declaration to their source code.
                   2792: 
                   2793: A function which can alter the value of a global register variable cannot
                   2794: safely be called from a function compiled without this variable, because it
                   2795: could clobber the value the caller expects to find there on return.
                   2796: Therefore, the function which is the entry point into the part of the
                   2797: program that uses the global register variable must explicitly save and
                   2798: restore the value which belongs to its caller.
                   2799: 
                   2800: On most machines, @code{longjmp} will restore to each global register
                   2801: variable the value it had at the time of the @code{setjmp}.  On some
                   2802: machines, however, @code{longjmp} will not change the value of global
                   2803: register variables.  To be portable, the function that called @code{setjmp}
                   2804: should make other arrangements to save the values of the global register
                   2805: variables, and to restore them if a @code{longjmp}.  This way, the the same
                   2806: thing will happen regardless of what @code{longjmp} does.
                   2807: 
                   2808: All global register variable declarations must precede all function
                   2809: definitions.  If such a declaration could appear after function
                   2810: definitions, the declaration would be too late to prevent the register from
                   2811: being used for other purposes in the preceding functions.
                   2812: 
1.1.1.6 ! root     2813: Global register variables may not have initial values, because an
        !          2814: executable file has no means to supply initial contents for a register.
        !          2815: 
1.1       root     2816: @node Bugs, Portability, Extensions, Top
                   2817: @chapter Reporting Bugs
                   2818: 
                   2819: Your bug reports play an essential role in making GNU CC reliable.
                   2820: 
                   2821: Reporting a bug may help you by bringing a solution to your problem, or it
                   2822: may not.  But in any case the important function of a bug report is to help
                   2823: the entire community by making the next version of GNU CC work better.  Bug
                   2824: reports are your contribution to the maintenance of GNU CC.
                   2825: 
                   2826: In order for a bug report to serve its purpose, you must include the
                   2827: information that makes for fixing the bug.
                   2828: 
                   2829: @menu
                   2830: * Criteria:  Bug Criteria.   Have you really found a bug?
                   2831: * Reporting: Bug Reporting.  How to report a bug effectively.
                   2832: @end menu
                   2833: 
                   2834: @node Bug Criteria, Bug Reporting, Bugs, Bugs
                   2835: @section Have You Found a Bug?
                   2836: 
                   2837: If you are not sure whether you have found a bug, here are some guidelines:
                   2838: 
                   2839: @itemize @bullet
                   2840: @item
                   2841: If the compiler gets a fatal signal, for any input whatever, that is a
                   2842: compiler bug.  Reliable compilers never crash.
                   2843: 
                   2844: @item
                   2845: If the compiler produces invalid assembly code, for any input whatever
                   2846: (except an @code{asm} statement), that is a compiler bug, unless the
                   2847: compiler reports errors (not just warnings) which would ordinarily
                   2848: prevent the assembler from being run.
                   2849: 
                   2850: @item
                   2851: If the compiler produces valid assembly code that does not correctly
                   2852: execute the input source code, that is a compiler bug.
                   2853: 
                   2854: However, you must double-check to make sure, because you may have run
                   2855: into an incompatibility between GNU C and traditional C
                   2856: (@pxref{Incompatibilities}).  These incompatibilities might be considered
                   2857: bugs, but they are inescapable consequences of valuable features.
                   2858: 
                   2859: Or you may have a program whose behavior is undefined, which happened
                   2860: by chance to give the desired results with another C compiler.
                   2861: 
                   2862: For example, in many nonoptimizing compilers, you can write @samp{x;}
                   2863: at the end of a function instead of @samp{return x;}, with the same
                   2864: results.  But the value of the function is undefined if @samp{return}
                   2865: is omitted; it is not a bug when GNU CC produces different results.
                   2866: 
                   2867: Problems often result from expressions with two increment operators,
                   2868: as in @samp{f (*p++, *p++)}.  Your previous compiler might have
                   2869: interpreted that expression the way you intended; GNU CC might
                   2870: interpret it another way; neither compiler is wrong.
                   2871: 
                   2872: After you have localized the error to a single source line, it should
                   2873: be easy to check for these things.  If your program is correct and
                   2874: well defined, you have found a compiler bug.
                   2875: 
                   2876: @item
                   2877: If the compiler produces an error message for valid input, that is a
                   2878: compiler bug.
                   2879: 
                   2880: Note that the following is not valid input, and the error message for
                   2881: it is not a bug:
                   2882: 
                   2883: @example
                   2884: int foo (char);
                   2885: 
                   2886: int
                   2887: foo (x)
                   2888:      char x;
                   2889: @{ @dots{} @}
                   2890: @end example
                   2891: 
                   2892: @noindent
                   2893: The prototype says to pass a @code{char}, while the definition says to
                   2894: pass an @code{int} and treat the value as a @code{char}.  This is what
                   2895: the ANSI standard says, and it makes sense.
                   2896: 
                   2897: @item
                   2898: If the compiler does not produce an error message for invalid input,
                   2899: that is a compiler bug.  However, you should note that your idea of
                   2900: ``invalid input'' might be my idea of ``an extension'' or ``support
                   2901: for traditional practice''.
                   2902: 
                   2903: @item
                   2904: If you are an experienced user of C compilers, your suggestions
                   2905: for improvement of GNU CC are welcome in any case.
                   2906: @end itemize
                   2907: 
                   2908: @node Bug Reporting,, Bug Criteria, Bugs
                   2909: @section How to Report Bugs
                   2910: 
                   2911: Send bug reports for GNU C to one of these addresses:
                   2912: 
                   2913: @example
                   2914: bug-gcc@@prep.ai.mit.edu
                   2915: @{ucbvax|mit-eddie|uunet@}!prep.ai.mit.edu!bug-gcc
                   2916: @end example
                   2917: 
                   2918: As a last resort, snail them to:
                   2919: 
                   2920: @example
                   2921: GNU Compiler Bugs
                   2922: 545 Tech Sq
                   2923: Cambridge, MA 02139
                   2924: @end example
                   2925: 
                   2926: The fundamental principle of reporting bugs usefully is this:
                   2927: @strong{report all the facts}.  If you are not sure whether to mention a
                   2928: fact or leave it out, mention it!
                   2929: 
                   2930: Often people omit facts because they think they know what causes the
                   2931: problem and they conclude that some details don't matter.  Thus, you might
                   2932: assume that the name of the variable you use in an example does not matter.
                   2933: Well, probably it doesn't, but one cannot be sure.  Perhaps the bug is a
                   2934: stray memory reference which happens to fetch from the location where that
                   2935: name is stored in memory; perhaps, if the name were different, the contents
                   2936: of that location would fool the compiler into doing the right thing despite
                   2937: the bug.  Play it safe and give an exact example.
                   2938: 
                   2939: If you want to enable me to fix the bug, you should include all these
                   2940: things:
                   2941: 
                   2942: @itemize @bullet
                   2943: @item
                   2944: The version of GNU CC.  You can get this by running it with the
                   2945: @samp{-v} option.
                   2946: 
                   2947: Without this, I won't know whether there is any point in looking for
                   2948: the bug in the current version of GNU CC.
                   2949: 
                   2950: @item
                   2951: A complete input file that will reproduce the bug.  If the bug is in
                   2952: the C preprocessor, send me a source file and any header files that it
                   2953: requires.  If the bug is in the compiler proper (@file{cc1}), run your
                   2954: source file through the C preprocessor by doing @samp{gcc -E
                   2955: @var{sourcefile} > @var{outfile}}, then include the contents of
                   2956: @var{outfile} in the bug report.  (Any @samp{-I}, @samp{-D} or
                   2957: @samp{-U} options that you used in actual compilation should also be
                   2958: used when doing this.)
                   2959: 
                   2960: A single statement is not enough of an example.  In order to compile
                   2961: it, it must be embedded in a function definition; and the bug might
                   2962: depend on the details of how this is done.
                   2963: 
                   2964: Without a real example I can compile, all I can do about your bug
                   2965: report is wish you luck.  It would be futile to try to guess how to
                   2966: provoke the bug.  For example, bugs in register allocation and
                   2967: reloading frequently depend on every little detail of the function
                   2968: they happen in.
                   2969: 
                   2970: @item
                   2971: The command arguments you gave GNU CC to compile that example and
                   2972: observe the bug.  For example, did you use @samp{-O}?  To guarantee
                   2973: you won't omit something important, list them all.
                   2974: 
                   2975: If I were to try to guess the arguments, I would probably guess wrong
                   2976: and then I would not encounter the bug.
                   2977: 
                   2978: @item
                   2979: The names of the files that you used for @file{tm.h} and @file{md}
                   2980: when you installed the compiler.
                   2981: 
                   2982: @item
                   2983: The type of machine you are using, and the operating system name and
                   2984: version number.
                   2985: 
                   2986: @item
                   2987: A description of what behavior you observe that you believe is
                   2988: incorrect.  For example, ``It gets a fatal signal,'' or, ``There is an
                   2989: incorrect assembler instruction in the output.''
                   2990: 
                   2991: Of course, if the bug is that the compiler gets a fatal signal, then I
                   2992: will certainly notice it.  But if the bug is incorrect output, I might
                   2993: not notice unless it is glaringly wrong.  I won't study all the
                   2994: assembler code from a 50-line C program just on the off chance that it
                   2995: might be wrong.
                   2996: 
                   2997: Even if the problem you experience is a fatal signal, you should still
                   2998: say so explicitly.  Suppose something strange is going on, such as,
                   2999: your copy of the compiler is out of synch, or you have encountered a
                   3000: bug in the C library on your system.  (This has happened!)  Your copy
                   3001: might crash and mine would not.  If you @i{told} me to expect a crash,
                   3002: then when mine fails to crash, I would know that the bug was not
                   3003: happening for me.  If you had not told me to expect a crash, then I
                   3004: would not be able to draw any conclusion from my observations.
                   3005: 
                   3006: In cases where GNU CC generates incorrect code, if you send me a small
                   3007: complete sample program I will find the error myself by running the
                   3008: program under a debugger.  If you send me a large example or a part of
                   3009: a larger program, I cannot do this; you must debug the compiled
                   3010: program and narrow the problem down to one source line.  Tell me which
                   3011: source line it is, and what you believe is incorrect about the code
                   3012: generated for that line.
                   3013: 
                   3014: @item
                   3015: If you send me examples of output from GNU CC, please use @samp{-g}
                   3016: when you make them.  The debugging information includes source line
                   3017: numbers which are essential for correlating the output with the input.
                   3018: 
                   3019: @item
                   3020: If you wish to suggest changes to the GNU CC source, send me context
                   3021: diffs.  If you even discuss something in the GNU CC source, refer to
                   3022: it by context, not by line number.
                   3023: 
                   3024: The line numbers in my development sources don't match those in your
                   3025: sources.  Your line numbers would convey no useful information to me.
                   3026: 
                   3027: @item
                   3028: Additional information from a debugger might enable me to find
                   3029: a problem on a machine which I do not have available myself.
                   3030: However, you need to think when you collect this information if
                   3031: you want it to have any chance of being useful.
                   3032: 
                   3033: For example, many people send just a backtrace, but that is never
                   3034: useful by itself.  A simple backtrace with arguments conveys little
                   3035: about GNU CC because the compiler is largely data-driven; the same
                   3036: functions are called over and over for different RTL insns, doing
                   3037: different things depending on the details of the insn.
                   3038: 
                   3039: Most of the arguments listed in the backtrace are useless because they
                   3040: are pointers to RTL list structure.  The numeric values of the
                   3041: pointers, which the debugger prints in the backtrace, have no
                   3042: significance whatever; all that matters is the contents of the objects
                   3043: they point to (and most of the contents are other such pointers).
                   3044: 
                   3045: In addition, most compiler passes consist of one or more loops that
                   3046: scan the RTL insn sequence.  The most vital piece of information about
                   3047: such a loop--which insn it has reached--is usually in a local variable,
                   3048: not in an argument.
                   3049: 
                   3050: What you need to provide in addition to a backtrace are the values of
                   3051: the local variables for several stack frames up.  When a local
                   3052: variable or an argument is an RTX, first print its value and then use
                   3053: the GDB command @code{pr} to print the RTL expression that it points
                   3054: to.  (If GDB doesn't run on your machine, use your debugger to call
                   3055: the function @code{debug_rtx} with the RTX as an argument.)  In
                   3056: general, whenever a variable is a pointer, its value is no use
                   3057: without the data it points to.
                   3058: 
                   3059: In addition, include a debugging dump from just before the pass
                   3060: in which the crash happens.  Most bugs involve a series of insns,
                   3061: not just one.
                   3062: @end itemize
                   3063: 
                   3064: Here are some things that are not necessary:
                   3065: 
                   3066: @itemize @bullet
                   3067: @item
                   3068: A description of the envelope of the bug.
                   3069: 
                   3070: Often people who encounter a bug spend a lot of time investigating
                   3071: which changes to the input file will make the bug go away and which
                   3072: changes will not affect it.
                   3073: 
                   3074: This is often time consuming and not very useful, because the way I
                   3075: will find the bug is by running a single example under the debugger
                   3076: with breakpoints, not by pure deduction from a series of examples.
                   3077: 
                   3078: Of course, if you can find a simpler example to report @emph{instead}
                   3079: of the original one, that is a convenience for me.  Errors in the
                   3080: output will be easier to spot, running under the debugger will take
                   3081: less time, etc.  Most GNU CC bugs involve just one function, so the
                   3082: most straightforward way to simplify an example is to delete all the
                   3083: function definitions except the one where the bug occurs.  Those
                   3084: earlier in the file may be replaced by external declarations if the
                   3085: crucial function depends on them.
                   3086: 
                   3087: However, simplification is not vital; if you don't want to do this,
                   3088: report the bug anyway.
                   3089: 
                   3090: @item
                   3091: A patch for the bug.
                   3092: 
                   3093: A patch for the bug does help me if it is a good one.  But don't omit
                   3094: the necessary information, such as the test case, because I might see
                   3095: problems with your patch and decide to fix the problem another way.
                   3096: 
                   3097: Sometimes with a program as complicated as GNU CC it is very hard to
                   3098: construct an example that will make the program follow a certain path
                   3099: through the code.  If you don't send me the example, I won't be able
                   3100: to construct one, so I won't be able to verify that the bug is fixed.
                   3101: 
                   3102: @item
                   3103: A guess about what the bug is or what it depends on.
                   3104: 
                   3105: Such guesses are usually wrong.  Even I can't guess right about such
                   3106: things without using the debugger to find the facts.
                   3107: @end itemize
                   3108: 
                   3109: @node Portability, Interface, Bugs, Top
                   3110: @chapter GNU CC and Portability
                   3111: 
                   3112: The main goal of GNU CC was to make a good, fast compiler for machines in
                   3113: the class that the GNU system aims to run on: 32-bit machines that address
                   3114: 8-bit bytes and have several general registers.  Elegance, theoretical
                   3115: power and simplicity are only secondary.
                   3116: 
                   3117: GNU CC gets most of the information about the target machine from a machine
                   3118: description which gives an algebraic formula for each of the machine's
                   3119: instructions.  This is a very clean way to describe the target.  But when
                   3120: the compiler needs information that is difficult to express in this
                   3121: fashion, I have not hesitated to define an ad-hoc parameter to the machine
                   3122: description.  The purpose of portability is to reduce the total work needed
                   3123: on the compiler; it was not of interest for its own sake.
                   3124: 
                   3125: GNU CC does not contain machine dependent code, but it does contain code
                   3126: that depends on machine parameters such as endianness (whether the most
                   3127: significant byte has the highest or lowest address of the bytes in a word)
                   3128: and the availability of autoincrement addressing.  In the RTL-generation
                   3129: pass, it is often necessary to have multiple strategies for generating code
                   3130: for a particular kind of syntax tree, strategies that are usable for different
                   3131: combinations of parameters.  Often I have not tried to address all possible
                   3132: cases, but only the common ones or only the ones that I have encountered.
                   3133: As a result, a new target may require additional strategies.  You will know
                   3134: if this happens because the compiler will call @code{abort}.  Fortunately,
                   3135: the new strategies can be added in a machine-independent fashion, and will
                   3136: affect only the target machines that need them.
                   3137: 
                   3138: @node Interface, Passes, Portability, Top
                   3139: @chapter Interfacing to GNU CC Output
                   3140: 
                   3141: GNU CC is normally configured to use the same function calling convention
                   3142: normally in use on the target system.  This is done with the
                   3143: machine-description macros described (@pxref{Machine Macros}).
                   3144: 
                   3145: However, returning of structure and union values is done differently on
                   3146: some target machines.  As a result, functions compiled with PCC
                   3147: returning such types cannot be called from code compiled with GNU CC,
                   3148: and vice versa.  This does not cause trouble often because few Unix
                   3149: library routines return structures or unions.
                   3150: 
                   3151: GNU CC code returns structures and unions that are 1, 2, 4 or 8 bytes
                   3152: long in the same registers used for @code{int} or @code{double} return
                   3153: values.  (GNU CC typically allocates variables of such types in
                   3154: registers also.)  Structures and unions of other sizes are returned by
                   3155: storing them into an address passed by the caller (usually in a
                   3156: register).  The machine-description macros @code{STRUCT_VALUE} and
                   3157: @code{STRUCT_INCOMING_VALUE} tell GNU CC where to pass this address.
                   3158: 
                   3159: By contrast, PCC on most target machines returns structures and unions
                   3160: of any size by copying the data into an area of static storage, and then
                   3161: returning the address of that storage as if it were a pointer value.
                   3162: The caller must copy the data from that memory area to the place where
                   3163: the value is wanted.  This is slower than the method used by GNU CC, and
                   3164: fails to be reentrant.
                   3165: 
                   3166: On some target machines, such as RISC machines and the 80386, the
                   3167: standard system convention is to pass to the subroutine the address of
                   3168: where to return the value.  On these machines, GNU CC has been
                   3169: configured to be compatible with the standard compiler, when this method
                   3170: is used.  It may not be compatible for structures of 1, 2, 4 or 8 bytes.
                   3171: 
                   3172: GNU CC uses the system's standard convention for passing arguments.  On
                   3173: some machines, the first few arguments are passed in registers; in
                   3174: others, all are passed on the stack.  It would be possible to use
                   3175: registers for argument passing on any machine, and this would probably
                   3176: result in a significant speedup.  But the result would be complete
                   3177: incompatibility with code that follows the standard convention.  So this
                   3178: change is practical only if you are switching to GNU CC as the sole C
                   3179: compiler for the system.  We may implement register argument passing on
                   3180: certain machines once we have a complete GNU system so that we can
                   3181: compile the libraries with GNU CC.
                   3182: 
                   3183: If you use @code{longjmp}, beware of automatic variables.  ANSI C says that
                   3184: automatic variables that are not declared @code{volatile} have undefined
                   3185: values after a @code{longjmp}.  And this is all GNU CC promises to do,
                   3186: because it is very difficult to restore register variables correctly, and
                   3187: one of GNU CC's features is that it can put variables in registers without
                   3188: your asking it to.
                   3189: 
                   3190: If you want a variable to be unaltered by @code{longjmp}, and you don't
                   3191: want to write @code{volatile} because old C compilers don't accept it,
                   3192: just take the address of the variable.  If a variable's address is ever
                   3193: taken, even if just to compute it and ignore it, then the variable cannot
                   3194: go in a register:
                   3195: 
                   3196: @example
                   3197: @{
                   3198:   int careful;
                   3199:   &careful;
                   3200:   @dots{}
                   3201: @}
                   3202: @end example
                   3203: 
                   3204: Code compiled with GNU CC may call certain library routines.  Most of
                   3205: them handle arithmetic for which there are no instructions.  This
                   3206: includes multiply and divide on some machines, and floating point
                   3207: operations on any machine for which floating point support is disabled
                   3208: with @samp{-msoft-float}.  Some standard parts of the C library, such as
                   3209: @code{bcopy} or @code{memcpy}, are also called automatically.  The usual
                   3210: function call interface is used for calling the library routines.
                   3211: 
                   3212: These library routines should be defined in the library @file{gnulib},
                   3213: which GNU CC automatically searches whenever it links a program.  On
                   3214: machines that have multiply and divide instructions, if hardware
                   3215: floating point is in use, normally @file{gnulib} is not needed, but it
                   3216: is searched just in case.
                   3217: 
                   3218: Each arithmetic function is defined in @file{gnulib.c} to use the
                   3219: corresponding C arithmetic operator.  As long as the file is compiled
                   3220: with another C compiler, which supports all the C arithmetic operators,
                   3221: this file will work portably.  However, @file{gnulib.c} does not work if
                   3222: compiled with GNU CC, because each arithmetic function would compile
                   3223: into a call to itself!
                   3224: 
                   3225: @node Passes, RTL, Interface, Top
                   3226: @chapter Passes and Files of the Compiler
                   3227: 
                   3228: The overall control structure of the compiler is in @file{toplev.c}.  This
                   3229: file is responsible for initialization, decoding arguments, opening and
                   3230: closing files, and sequencing the passes.
                   3231: 
                   3232: The parsing pass is invoked only once, to parse the entire input.  The RTL
                   3233: intermediate code for a function is generated as the function is parsed, a
                   3234: statement at a time.  Each statement is read in as a syntax tree and then
                   3235: converted to RTL; then the storage for the tree for the statement is
                   3236: reclaimed.  Storage for types (and the expressions for their sizes),
                   3237: declarations, and a representation of the binding contours and how they nest,
                   3238: remains until the function is finished being compiled; these are all needed
                   3239: to output the debugging information.
                   3240: 
                   3241: Each time the parsing pass reads a complete function definition or
                   3242: top-level declaration, it calls the function
                   3243: @code{rest_of_compilation} or @code{rest_of_decl_compilation} in
                   3244: @file{toplev.c}, which are responsible for all further processing
                   3245: necessary, ending with output of the assembler language.  All other
                   3246: compiler passes run, in sequence, within @code{rest_of_compilation}.
                   3247: When that function returns from compiling a function definition, the
                   3248: storage used for that function definition's compilation is entirely
                   3249: freed, unless it is an inline function (@pxref{Inline}).
                   3250: 
                   3251: Here is a list of all the passes of the compiler and their source files.
                   3252: Also included is a description of where debugging dumps can be requested
                   3253: with @samp{-d} options.
                   3254: 
                   3255: @itemize @bullet
                   3256: @item
                   3257: Parsing.  This pass reads the entire text of a function definition,
                   3258: constructing partial syntax trees.  This and RTL generation are no longer
                   3259: truly separate passes (formerly they were), but it is easier to think
                   3260: of them as separate.
                   3261: 
                   3262: The tree representation does not entirely follow C syntax, because it is
                   3263: intended to support other languages as well.
                   3264: 
                   3265: C data type analysis is also done in this pass, and every tree node
                   3266: that represents an expression has a data type attached.  Variables are
                   3267: represented as declaration nodes.
                   3268: 
                   3269: Constant folding and associative-law simplifications are also done
                   3270: during this pass.
                   3271: 
                   3272: The source files for parsing are @file{c-parse.y}, @file{c-decl.c},
                   3273: @file{c-typeck.c}, @file{c-convert.c}, @file{stor-layout.c},
                   3274: @file{fold-const.c}, and @file{tree.c}.  The last three files are
                   3275: intended to be language-independent.  There are also header files
                   3276: @file{c-parse.h}, @file{c-tree.h}, @file{tree.h} and @file{tree.def}.
                   3277: The last two define the format of the tree representation.@refill
                   3278: 
                   3279: @item
                   3280: RTL generation.  This is the conversion of syntax tree into RTL code.
                   3281: It is actually done statement-by-statement during parsing, but for
                   3282: most purposes it can be thought of as a separate pass.
                   3283: 
                   3284: This is where the bulk of target-parameter-dependent code is found,
                   3285: since often it is necessary for strategies to apply only when certain
                   3286: standard kinds of instructions are available.  The purpose of named
                   3287: instruction patterns is to provide this information to the RTL
                   3288: generation pass.
                   3289: 
                   3290: Optimization is done in this pass for @code{if}-conditions that are
                   3291: comparisons, boolean operations or conditional expressions.  Tail
                   3292: recursion is detected at this time also.  Decisions are made about how
                   3293: best to arrange loops and how to output @code{switch} statements.
                   3294: 
                   3295: The source files for RTL generation are @file{stmt.c}, @file{expr.c},
                   3296: @file{explow.c}, @file{expmed.c}, @file{optabs.c} and @file{emit-rtl.c}.
                   3297: Also, the file @file{insn-emit.c}, generated from the machine description
                   3298: by the program @code{genemit}, is used in this pass.  The header files
                   3299: @file{expr.h} is used for communication within this pass.@refill
                   3300: 
                   3301: The header files @file{insn-flags.h} and @file{insn-codes.h},
                   3302: generated from the machine description by the programs @code{genflags}
                   3303: and @code{gencodes}, tell this pass which standard names are available
                   3304: for use and which patterns correspond to them.@refill
                   3305: 
                   3306: Aside from debugging information output, none of the following passes
                   3307: refers to the tree structure representation of the function (only
                   3308: part of which is saved).
                   3309: 
                   3310: The decision of whether the function can and should be expanded inline
                   3311: in its subsequent callers is made at the end of rtl generation.  The
                   3312: function must meet certain criteria, currently related to the size of
                   3313: the function and the types and number of parameters it has.  Note that
                   3314: this function may contain loops, recursive calls to itself
                   3315: (tail-recursive functions can be inlined!), gotos, in short, all
                   3316: constructs supported by GNU CC.
                   3317: 
                   3318: The option @samp{-dr} causes a debugging dump of the RTL code after
                   3319: this pass.  This dump file's name is made by appending @samp{.rtl} to
                   3320: the input file name.
                   3321: 
                   3322: @item
                   3323: Jump optimization.  This pass simplifies jumps to the following
                   3324: instruction, jumps across jumps, and jumps to jumps.  It deletes
                   3325: unreferenced labels and unreachable code, except that unreachable code
                   3326: that contains a loop is not recognized as unreachable in this pass.
                   3327: (Such loops are deleted later in the basic block analysis.)
                   3328: 
                   3329: Jump optimization is performed two or three times.  The first time is
                   3330: immediately following RTL generation.  The second time is after CSE,
                   3331: but only if CSE says repeated jump optimization is needed.  The
                   3332: last time is right before the final pass.  That time, cross-jumping
                   3333: and deletion of no-op move instructions are done together with the
                   3334: optimizations described above.
                   3335: 
                   3336: The source file of this pass is @file{jump.c}.
                   3337: 
                   3338: The option @samp{-dj} causes a debugging dump of the RTL code after
                   3339: this pass is run for the first time.  This dump file's name is made by
                   3340: appending @samp{.jump} to the input file name.
                   3341: 
                   3342: @item
                   3343: Register scan.  This pass finds the first and last use of each
                   3344: register, as a guide for common subexpression elimination.  Its source
                   3345: is in @file{regclass.c}.
                   3346: 
                   3347: @item
                   3348: Common subexpression elimination.  This pass also does constant
                   3349: propagation.  Its source file is @file{cse.c}.  If constant
                   3350: propagation causes conditional jumps to become unconditional or to
                   3351: become no-ops, jump optimization is run again when CSE is finished.
                   3352: 
                   3353: The option @samp{-ds} causes a debugging dump of the RTL code after
                   3354: this pass.  This dump file's name is made by appending @samp{.cse} to
                   3355: the input file name.
                   3356: 
                   3357: @item
                   3358: Loop optimization.  This pass moves constant expressions out of loops.
                   3359: Its source file is @file{loop.c}.
                   3360: 
                   3361: The option @samp{-dL} causes a debugging dump of the RTL code after
                   3362: this pass.  This dump file's name is made by appending @samp{.loop} to
                   3363: the input file name.
                   3364: 
                   3365: @item
                   3366: Stupid register allocation is performed at this point in a
                   3367: nonoptimizing compilation.  It does a little data flow analysis as
                   3368: well.  When stupid register allocation is in use, the next pass
                   3369: executed is the reloading pass; the others in between are skipped.
                   3370: The source file is @file{stupid.c}.
                   3371: 
                   3372: @item
                   3373: Data flow analysis (@file{flow.c}).  This pass divides the program
                   3374: into basic blocks (and in the process deletes unreachable loops); then
                   3375: it computes which pseudo-registers are live at each point in the
                   3376: program, and makes the first instruction that uses a value point at
                   3377: the instruction that computed the value.
                   3378: 
                   3379: This pass also deletes computations whose results are never used, and
                   3380: combines memory references with add or subtract instructions to make
                   3381: autoincrement or autodecrement addressing.
                   3382: 
                   3383: The option @samp{-df} causes a debugging dump of the RTL code after
                   3384: this pass.  This dump file's name is made by appending @samp{.flow} to
                   3385: the input file name.  If stupid register allocation is in use, this
                   3386: dump file reflects the full results of such allocation.
                   3387: 
                   3388: @item
                   3389: Instruction combination (@file{combine.c}).  This pass attempts to
                   3390: combine groups of two or three instructions that are related by data
                   3391: flow into single instructions.  It combines the RTL expressions for
                   3392: the instructions by substitution, simplifies the result using algebra,
                   3393: and then attempts to match the result against the machine description.
                   3394: 
                   3395: The option @samp{-dc} causes a debugging dump of the RTL code after
                   3396: this pass.  This dump file's name is made by appending @samp{.combine}
                   3397: to the input file name.
                   3398: 
                   3399: @item
                   3400: Register class preferencing.  The RTL code is scanned to find out
                   3401: which register class is best for each pseudo register.  The source
                   3402: file is @file{regclass.c}.
                   3403: 
                   3404: @item
                   3405: Local register allocation (@file{local-alloc.c}).  This pass allocates
                   3406: hard registers to pseudo registers that are used only within one basic
                   3407: block.  Because the basic block is linear, it can use fast and
                   3408: powerful techniques to do a very good job.
                   3409: 
                   3410: The option @samp{-dl} causes a debugging dump of the RTL code after
                   3411: this pass.  This dump file's name is made by appending @samp{.lreg} to
                   3412: the input file name.
                   3413: 
                   3414: @item
                   3415: Global register allocation (@file{global-alloc.c}).  This pass
                   3416: allocates hard registers for the remaining pseudo registers (those
                   3417: whose life spans are not contained in one basic block).
                   3418: 
                   3419: @item
                   3420: Reloading.  This pass renumbers pseudo registers with the hardware
                   3421: registers numbers they were allocated.  Pseudo registers that did not
                   3422: get hard registers are replaced with stack slots.  Then it finds
                   3423: instructions that are invalid because a value has failed to end up in
                   3424: a register, or has ended up in a register of the wrong kind.  It fixes
                   3425: up these instructions by reloading the problematical values
                   3426: temporarily into registers.  Additional instructions are generated to
                   3427: do the copying.
                   3428: 
                   3429: Source files are @file{reload.c} and @file{reload1.c}, plus the header
                   3430: @file{reload.h} used for communication between them.
                   3431: 
                   3432: The option @samp{-dg} causes a debugging dump of the RTL code after
                   3433: this pass.  This dump file's name is made by appending @samp{.greg} to
                   3434: the input file name.
                   3435: 
                   3436: @item
                   3437: Jump optimization is repeated, this time including cross-jumping
1.1.1.5   root     3438: and deletion of no-op move instructions.
1.1       root     3439: 
                   3440: The option @samp{-dJ} causes a debugging dump of the RTL code after
                   3441: this pass.  This dump file's name is made by appending @samp{.jump2}
                   3442: to the input file name.
                   3443: 
                   3444: @item
                   3445: Final.  This pass outputs the assembler code for the function.  It is
                   3446: also responsible for identifying spurious test and compare
1.1.1.5   root     3447: instructions.  Machine-specific peephole optimizations are performed
                   3448: at the same time.  The function entry and exit sequences are generated
1.1       root     3449: directly as assembler code in this pass; they never exist as RTL.
                   3450: 
                   3451: The source files are @file{final.c} plus @file{insn-output.c}; the
                   3452: latter is generated automatically from the machine description by the
                   3453: tool @file{genoutput}.  The header file @file{conditions.h} is used
                   3454: for communication between these files.
                   3455: 
                   3456: @item
                   3457: Debugging information output.  This is run after final because it must
                   3458: output the stack slot offsets for pseudo registers that did not get
                   3459: hard registers.  Source files are @file{dbxout.c} for DBX symbol table
                   3460: format and @file{symout.c} for GDB's own symbol table format.
                   3461: @end itemize
                   3462: 
                   3463: Some additional files are used by all or many passes:
                   3464: 
                   3465: @itemize @bullet
                   3466: @item
                   3467: Every pass uses @file{machmode.def}, which defines the machine modes.
                   3468: 
                   3469: @item
                   3470: All the passes that work with RTL use the header files @file{rtl.h}
                   3471: and @file{rtl.def}, and subroutines in file @file{rtl.c}.  The tools
                   3472: @code{gen*} also use these files to read and work with the machine
                   3473: description RTL.
                   3474: 
                   3475: @item
                   3476: Several passes refer to the header file @file{insn-config.h} which
                   3477: contains a few parameters (C macro definitions) generated
                   3478: automatically from the machine description RTL by the tool
                   3479: @code{genconfig}.
                   3480: 
                   3481: @item
                   3482: Several passes use the instruction recognizer, which consists of
                   3483: @file{recog.c} and @file{recog.h}, plus the files @file{insn-recog.c}
                   3484: and @file{insn-extract.c} that are generated automatically from the
                   3485: machine description by the tools @file{genrecog} and
                   3486: @file{genextract}.@refill
                   3487: 
                   3488: @item
                   3489: Several passes use the header files @file{regs.h} which defines the
                   3490: information recorded about pseudo register usage, and @file{basic-block.h}
                   3491: which defines the information recorded about basic blocks.
                   3492: 
                   3493: @item
                   3494: @file{hard-reg-set.h} defines the type @code{HARD_REG_SET}, a bit-vector
                   3495: with a bit for each hard register, and some macros to manipulate it.
                   3496: This type is just @code{int} if the machine has few enough hard registers;
                   3497: otherwise it is an array of @code{int} and some of the macros expand
                   3498: into loops.
                   3499: @end itemize
                   3500: 
                   3501: @node RTL, Machine Desc, Passes, Top
                   3502: @chapter RTL Representation
                   3503: 
                   3504: Most of the work of the compiler is done on an intermediate representation
                   3505: called register transfer language.  In this language, the instructions to be
                   3506: output are described, pretty much one by one, in an algebraic form that
                   3507: describes what the instruction does.
                   3508: 
                   3509: RTL is inspired by Lisp lists.  It has both an internal form, made up of
                   3510: structures that point at other structures, and a textual form that is used
                   3511: in the machine description and in printed debugging dumps.  The textual
                   3512: form uses nested parentheses to indicate the pointers in the internal form.
                   3513: 
                   3514: @menu
                   3515: * RTL Objects::       Expressions vs vectors vs strings vs integers.
                   3516: * Accessors::         Macros to access expression operands or vector elts.
                   3517: * Flags::             Other flags in an RTL expression.
                   3518: * Machine Modes::     Describing the size and format of a datum.
                   3519: * Constants::         Expressions with constant values.
                   3520: * Regs and Memory::   Expressions representing register contents or memory.
                   3521: * Arithmetic::        Expressions representing arithmetic on other expressions.
                   3522: * Comparisons::       Expressions representing comparison of expressions.
                   3523: * Bit Fields::        Expressions representing bit-fields in memory or reg.
                   3524: * Conversions::       Extending, truncating, floating or fixing.
                   3525: * RTL Declarations::  Declaring volatility, constancy, etc.
                   3526: * Side Effects::      Expressions for storing in registers, etc.
                   3527: * Incdec::            Embedded side-effects for autoincrement addressing.
                   3528: * Assembler::        Representing @code{asm} with operands.
                   3529: * Insns::             Expression types for entire insns.
                   3530: * Calls::            RTL representation of function call insns.
                   3531: * Sharing::           Some expressions are unique; others *must* be copied.
                   3532: @end menu
                   3533: 
                   3534: @node RTL Objects, Accessors, RTL, RTL
                   3535: @section RTL Object Types
                   3536: 
                   3537: RTL uses four kinds of objects: expressions, integers, strings and vectors.
                   3538: Expressions are the most important ones.  An RTL expression (``RTX'', for
                   3539: short) is a C structure, but it is usually referred to with a pointer; a
                   3540: type that is given the typedef name @code{rtx}.
                   3541: 
                   3542: An integer is simply an @code{int}, and a string is a @code{char *}.
                   3543: Within RTL code, strings appear only inside @samp{symbol_ref} expressions,
                   3544: but they appear in other contexts in the RTL expressions that make up
                   3545: machine descriptions.  Their written form uses decimal digits.
                   3546: 
                   3547: A string is a sequence of characters.  In core it is represented as a
                   3548: @code{char *} in usual C fashion, and it is written in C syntax as well.
                   3549: However, strings in RTL may never be null.  If you write an empty string in
                   3550: a machine description, it is represented in core as a null pointer rather
                   3551: than as a pointer to a null character.  In certain contexts, these null
                   3552: pointers instead of strings are valid.
                   3553: 
                   3554: A vector contains an arbitrary, specified number of pointers to
                   3555: expressions.  The number of elements in the vector is explicitly present in
                   3556: the vector.  The written form of a vector consists of square brackets
                   3557: (@samp{[@dots{}]}) surrounding the elements, in sequence and with
                   3558: whitespace separating them.  Vectors of length zero are not created; null
                   3559: pointers are used instead.
                   3560: 
                   3561: Expressions are classified by @dfn{expression codes} (also called RTX
                   3562: codes).  The expression code is a name defined in @file{rtl.def}, which is
                   3563: also (in upper case) a C enumeration constant.  The possible expression
                   3564: codes and their meanings are machine-independent.  The code of an RTX can
                   3565: be extracted with the macro @code{GET_CODE (@var{x})} and altered with
                   3566: @code{PUT_CODE (@var{x}, @var{newcode})}.
                   3567: 
                   3568: The expression code determines how many operands the expression contains,
                   3569: and what kinds of objects they are.  In RTL, unlike Lisp, you cannot tell
                   3570: by looking at an operand what kind of object it is.  Instead, you must know
                   3571: from its context---from the expression code of the containing expression.
                   3572: For example, in an expression of code @samp{subreg}, the first operand is
                   3573: to be regarded as an expression and the second operand as an integer.  In
                   3574: an expression of code @samp{plus}, there are two operands, both of which
                   3575: are to be regarded as expressions.  In a @samp{symbol_ref} expression,
                   3576: there is one operand, which is to be regarded as a string.
                   3577: 
                   3578: Expressions are written as parentheses containing the name of the
                   3579: expression type, its flags and machine mode if any, and then the operands
                   3580: of the expression (separated by spaces).
                   3581: 
                   3582: Expression code names in the @samp{md} file are written in lower case,
                   3583: but when they appear in C code they are written in upper case.  In this
                   3584: manual, they are shown as follows: @samp{const_int}.
                   3585: 
                   3586: In a few contexts a null pointer is valid where an expression is normally
1.1.1.4   root     3587: wanted.  The written form of this is @code{(nil)}.
1.1       root     3588: 
                   3589: @node Accessors, Flags, RTL Objects, RTL
                   3590: @section Access to Operands
                   3591: 
                   3592: For each expression type @file{rtl.def} specifies the number of contained
                   3593: objects and their kinds, with four possibilities: @samp{e} for expression
                   3594: (actually a pointer to an expression), @samp{i} for integer, @samp{s} for
                   3595: string, and @samp{E} for vector of expressions.  The sequence of letters
                   3596: for an expression code is called its @dfn{format}.  Thus, the format of
                   3597: @samp{subreg} is @samp{ei}.@refill
                   3598: 
                   3599: Two other format characters are used occasionally: @samp{u} and @samp{0}.
                   3600: @samp{u} is equivalent to @samp{e} except that it is printed differently in
                   3601: debugging dumps, and @samp{0} means a slot whose contents do not fit any
                   3602: normal category.  @samp{0} slots are not printed at all in dumps, and are
                   3603: often used in special ways by small parts of the compiler.@refill
                   3604: 
                   3605: There are macros to get the number of operands and the format of an
                   3606: expression code:
                   3607: 
                   3608: @table @code
                   3609: @item GET_RTX_LENGTH (@var{code})
                   3610: Number of operands of an RTX of code @var{code}.
                   3611: 
                   3612: @item GET_RTX_FORMAT (@var{code})
                   3613: The format of an RTX of code @var{code}, as a C string.
                   3614: @end table
                   3615: 
                   3616: Operands of expressions are accessed using the macros @code{XEXP},
                   3617: @code{XINT} and @code{XSTR}.  Each of these macros takes two arguments: an
                   3618: expression-pointer (RTX) and an operand number (counting from zero).
                   3619: Thus,@refill
                   3620: 
                   3621: @example
                   3622: XEXP (@var{x}, 2)
                   3623: @end example
                   3624: 
                   3625: @noindent
                   3626: accesses operand 2 of expression @var{x}, as an expression.
                   3627: 
                   3628: @example
                   3629: XINT (@var{x}, 2)
                   3630: @end example
                   3631: 
                   3632: @noindent
                   3633: accesses the same operand as an integer.  @code{XSTR}, used in the same
                   3634: fashion, would access it as a string.
                   3635: 
                   3636: Any operand can be accessed as an integer, as an expression or as a string.
                   3637: You must choose the correct method of access for the kind of value actually
                   3638: stored in the operand.  You would do this based on the expression code of
                   3639: the containing expression.  That is also how you would know how many
                   3640: operands there are.
                   3641: 
                   3642: For example, if @var{x} is a @samp{subreg} expression, you know that it has
                   3643: two operands which can be correctly accessed as @code{XEXP (@var{x}, 0)}
                   3644: and @code{XINT (@var{x}, 1)}.  If you did @code{XINT (@var{x}, 0)}, you
                   3645: would get the address of the expression operand but cast as an integer;
                   3646: that might occasionally be useful, but it would be cleaner to write
                   3647: @code{(int) XEXP (@var{x}, 0)}.  @code{XEXP (@var{x}, 1)} would also
                   3648: compile without error, and would return the second, integer operand cast as
                   3649: an expression pointer, which would probably result in a crash when
                   3650: accessed.  Nothing stops you from writing @code{XEXP (@var{x}, 28)} either,
                   3651: but this will access memory past the end of the expression with
                   3652: unpredictable results.@refill
                   3653: 
                   3654: Access to operands which are vectors is more complicated.  You can use the
                   3655: macro @code{XVEC} to get the vector-pointer itself, or the macros
                   3656: @code{XVECEXP} and @code{XVECLEN} to access the elements and length of a
                   3657: vector.
                   3658: 
                   3659: @table @code
                   3660: @item XVEC (@var{exp}, @var{idx})
                   3661: Access the vector-pointer which is operand number @var{idx} in @var{exp}.
                   3662: 
                   3663: @item XVECLEN (@var{exp}, @var{idx})
                   3664: Access the length (number of elements) in the vector which is
                   3665: in operand number @var{idx} in @var{exp}.  This value is an @code{int}.
                   3666: 
                   3667: @item XVECEXP (@var{exp}, @var{idx}, @var{eltnum})
                   3668: Access element number @var{eltnum} in the vector which is
                   3669: in operand number @var{idx} in @var{exp}.  This value is an RTX.
                   3670: 
                   3671: It is up to you to make sure that @var{eltnum} is not negative
                   3672: and is less than @code{XVECLEN (@var{exp}, @var{idx})}.
                   3673: @end table
                   3674: 
                   3675: All the macros defined in this section expand into lvalues and therefore
                   3676: can be used to assign the operands, lengths and vector elements as well as
                   3677: to access them.
                   3678: 
                   3679: @node Flags, Machine Modes, Accessors, RTL
                   3680: @section Flags in an RTL Expression
                   3681: 
                   3682: RTL expressions contain several flags (one-bit bit-fields) that are used
                   3683: in certain types of expression.  Most often they are accessed with the
                   3684: following macros:
                   3685: 
                   3686: @table @code
                   3687: @item MEM_VOLATILE_P (@var{x})
                   3688: In @samp{mem} expressions, nonzero for volatile memory references.
                   3689: Stored in the @code{volatil} field and printed as @samp{/v}.
                   3690: 
                   3691: @item MEM_IN_STRUCT_P (@var{x})
                   3692: In @samp{mem} expressions, nonzero for reference to an entire
                   3693: structure, union or array, or to a component of one.  Zero for
                   3694: references to a scalar variable or through a pointer to a scalar.
                   3695: Stored in the @code{in_struct} field and printed as @samp{/s}.
                   3696: 
                   3697: @item REG_USER_VAR_P (@var{x})
                   3698: In a @samp{reg}, nonzero if it corresponds to a variable present in
                   3699: the user's source code.  Zero for temporaries generated internally by
                   3700: the compiler.  Stored in the @code{volatil} field and printed as
                   3701: @samp{/v}.
                   3702: 
                   3703: @item REG_FUNCTION_VALUE_P (@var{x})
                   3704: Nonzero in a @samp{reg} if it is the place in which this function's
                   3705: value is going to be returned.  (This happens only in a hard
                   3706: register.)  Stored in the @code{integrated} field and printed as
                   3707: @samp{/i}.
                   3708: 
                   3709: The same hard register may be used also for collecting the values of
                   3710: functions called by this one, but @code{REG_FUNCTION_VALUE_P} is zero
                   3711: in this kind of use.
                   3712: 
                   3713: @item RTX_UNCHANGING_P (@var{x})
                   3714: Nonzero in a @samp{reg} or @samp{mem} if the value is not changed
                   3715: explicitly by the current function.  (If it is a memory reference then
                   3716: it may be changed by other functions or by aliasing.)  Stored in the
                   3717: @code{unchanging} field and printed as @samp{/u}.
                   3718: 
                   3719: @item RTX_INTEGRATED_P (@var{insn})
                   3720: Nonzero in an insn if it resulted from an in-line function call.
                   3721: Stored in the @code{integrated} field and printed as @samp{/i}.  This
                   3722: may be deleted; nothing currently depends on it.
                   3723: 
                   3724: @item INSN_DELETED_P (@var{insn})
                   3725: In an insn, nonzero if the insn has been deleted.  Stored in the
                   3726: @code{volatil} field and printed as @samp{/v}.
                   3727: 
                   3728: @item CONSTANT_POOL_ADDRESS_P (@var{x})
                   3729: Nonzero in a @samp{symbol_ref} if it refers to part of the current
                   3730: function's ``constants pool''.  These are addresses close to the
                   3731: beginning of the function, and GNU CC assumes they can be addressed
                   3732: directly (perhaps with the help of base registers).  Stored in the
                   3733: @code{unchanging} field and printed as @samp{/u}.
                   3734: @end table
                   3735: 
                   3736: These are the fields which the above macros refer to:
                   3737: 
                   3738: @table @code
                   3739: @item used
                   3740: This flag is used only momentarily, at the end of RTL generation for a
                   3741: function, to count the number of times an expression appears in insns.
                   3742: Expressions that appear more than once are copied, according to the
                   3743: rules for shared structure (@pxref{Sharing}).
                   3744: 
                   3745: @item volatil
                   3746: This flag is used in @samp{mem} and @samp{reg} expressions and in insns.
                   3747: In RTL dump files, it is printed as @samp{/v}.
                   3748: 
                   3749: In a @samp{mem} expression, it is 1 if the memory reference is volatile.
                   3750: Volatile memory references may not be deleted, reordered or combined.
                   3751: 
                   3752: In a @samp{reg} expression, it is 1 if the value is a user-level variable.
                   3753: 0 indicates an internal compiler temporary.
                   3754: 
                   3755: In an insn, 1 means the insn has been deleted.
                   3756: 
                   3757: @item in_struct
                   3758: This flag is used in @samp{mem} expressions.  It is 1 if the memory
                   3759: datum referred to is all or part of a structure or array; 0 if it is (or
                   3760: might be) a scalar variable.  A reference through a C pointer has 0
                   3761: because the pointer might point to a scalar variable.
                   3762: 
                   3763: This information allows the compiler to determine something about possible
                   3764: cases of aliasing.
                   3765: 
                   3766: In an RTL dump, this flag is represented as @samp{/s}.
                   3767: 
                   3768: @item unchanging
                   3769: This flag is used in @samp{reg} and @samp{mem} expressions.  1 means
                   3770: that the value of the expression never changes (at least within the
                   3771: current function).
                   3772: 
                   3773: In an RTL dump, this flag is represented as @samp{/u}.
                   3774: 
                   3775: @item integrated
                   3776: In some kinds of expressions, including insns, this flag means the
                   3777: rtl was produced by procedure integration.
                   3778: 
                   3779: In a @samp{reg} expression, this flag indicates the register
                   3780: containing the value to be returned by the current function.  On
                   3781: machines that pass parameters in registers, the same register number
                   3782: may be used for parameters as well, but this flag is not set on such
                   3783: uses.
                   3784: @end table
                   3785: 
                   3786: @node Machine Modes, Constants, Flags, RTL
                   3787: @section Machine Modes
                   3788: 
                   3789: A machine mode describes a size of data object and the representation used
                   3790: for it.  In the C code, machine modes are represented by an enumeration
                   3791: type, @code{enum machine_mode}, defined in @file{machmode.def}.  Each RTL
                   3792: expression has room for a machine mode and so do certain kinds of tree
                   3793: expressions (declarations and types, to be precise).
                   3794: 
                   3795: In debugging dumps and machine descriptions, the machine mode of an RTL
                   3796: expression is written after the expression code with a colon to separate
                   3797: them.  The letters @samp{mode} which appear at the end of each machine mode
                   3798: name are omitted.  For example, @code{(reg:SI 38)} is a @samp{reg}
                   3799: expression with machine mode @code{SImode}.  If the mode is
                   3800: @code{VOIDmode}, it is not written at all.
                   3801: 
                   3802: Here is a table of machine modes.
                   3803: 
                   3804: @table @code
                   3805: @item QImode
                   3806: ``Quarter-Integer'' mode represents a single byte treated as an integer.
                   3807: 
                   3808: @item HImode
                   3809: ``Half-Integer'' mode represents a two-byte integer.
                   3810: 
                   3811: @item SImode
                   3812: ``Single Integer'' mode represents a four-byte integer.
                   3813: 
                   3814: @item DImode
                   3815: ``Double Integer'' mode represents an eight-byte integer.
                   3816: 
                   3817: @item TImode
                   3818: ``Tetra Integer'' (?) mode represents a sixteen-byte integer.
                   3819: 
                   3820: @item SFmode
                   3821: ``Single Floating'' mode represents a single-precision (four byte) floating
                   3822: point number.
                   3823: 
                   3824: @item DFmode
                   3825: ``Double Floating'' mode represents a double-precision (eight byte) floating
                   3826: point number.
                   3827: 
                   3828: @item TFmode
                   3829: ``Tetra Floating'' mode represents a quadruple-precision (sixteen byte)
                   3830: floating point number.
                   3831: 
                   3832: @item BLKmode
                   3833: ``Block'' mode represents values that are aggregates to which none of
                   3834: the other modes apply.  In RTL, only memory references can have this mode,
                   3835: and only if they appear in string-move or vector instructions.  On machines
                   3836: which have no such instructions, @code{BLKmode} will not appear in RTL.
                   3837: 
                   3838: @item VOIDmode
                   3839: Void mode means the absence of a mode or an unspecified mode.
                   3840: For example, RTL expressions of code @samp{const_int} have mode
                   3841: @code{VOIDmode} because they can be taken to have whatever mode the context
                   3842: requires.  In debugging dumps of RTL, @code{VOIDmode} is expressed by
                   3843: the absence of any mode.
                   3844: 
                   3845: @item EPmode
                   3846: ``Entry Pointer'' mode is intended to be used for function variables in
                   3847: Pascal and other block structured languages.  Such values contain
                   3848: both a function address and a static chain pointer for access to
                   3849: automatic variables of outer levels.  This mode is only partially
                   3850: implemented since C does not use it.
                   3851: 
                   3852: @item CSImode@r{, @dots{}}
                   3853: ``Complex Single Integer'' mode stands for a complex number represented
                   3854: as a pair of @code{SImode} integers.  Any of the integer and floating modes
                   3855: may have @samp{C} prefixed to its name to obtain a complex number mode.
                   3856: For example, there are @code{CQImode}, @code{CSFmode}, and @code{CDFmode}.
                   3857: Since C does not support complex numbers, these machine modes are only
                   3858: partially implemented.
                   3859: 
                   3860: @item BImode
                   3861: This is the machine mode of a bit-field in a structure.  It is used
                   3862: only in the syntax tree, never in RTL, and in the syntax tree it appears
                   3863: only in declaration nodes.  In C, it appears only in @code{FIELD_DECL}
                   3864: nodes for structure fields defined with a bit size.
                   3865: @end table
                   3866: 
                   3867: The machine description defines @code{Pmode} as a C macro which expands
                   3868: into the machine mode used for addresses.  Normally this is @code{SImode}.
                   3869: 
                   3870: The only modes which a machine description @i{must} support are
                   3871: @code{QImode}, @code{SImode}, @code{SFmode} and @code{DFmode}.  The
                   3872: compiler will attempt to use @code{DImode} for two-word structures and
                   3873: unions, but it would not be hard to program it to avoid this.  Likewise,
                   3874: you can arrange for the C type @code{short int} to avoid using
                   3875: @code{HImode}.  In the long term it would be desirable to make the set of
                   3876: available machine modes machine-dependent and eliminate all assumptions
                   3877: about specific machine modes or their uses from the machine-independent
                   3878: code of the compiler.
                   3879: 
1.1.1.4   root     3880: To help begin this process, the machine modes are divided into mode
                   3881: classes.  These are represented by the enumeration type @code{enum
                   3882: mode_class} defined in @file{rtl.h}.  The possible mode classes are:
                   3883: 
                   3884: @table @code
                   3885: @item MODE_INT
                   3886: Integer modes.  By default these are @code{QImode}, @code{HImode},
                   3887: @code{SImode}, @code{DImode}, @code{TImode}, and also @code{BImode}.
                   3888: 
                   3889: @item MODE_FLOAT
                   3890: Floating-point modes.  By default these are @code{QFmode},
                   3891: @code{HFmode}, @code{SFmode}, @code{DFmode} and @code{TFmode}, but the
                   3892: MC68881 also defines @code{XFmode} to be an 80-bit extended-precision
                   3893: floating-point mode.
                   3894: 
                   3895: @item MODE_COMPLEX_INT
                   3896: Complex integer modes.  By default these are @code{CQImode},
                   3897: @code{CHImode}, @code{CSImode}, @code{CDImode} and @code{CTImode}.
                   3898: 
                   3899: @item MODE_COMPLEX_FLOAT
                   3900: Complex floating-point modes.  By default these are @code{CQFmode},
                   3901: @code{CHFmode}, @code{CSFmode}, @code{CDFmode} and @code{CTFmode},
                   3902: 
                   3903: @item MODE_FUNCTION
                   3904: Algol or Pascal function variables including a static chain.
                   3905: (These are not currently implemented).
                   3906: 
                   3907: @item MODE_RANDOM
                   3908: This is a catchall mode class for modes which don't fit into the above
                   3909: classes.  Currently @code{VOIDmode}, @code{BLKmode} and @code{EPmode}
                   3910: are in @code{MODE_RANDOM}.
                   3911: @end table
                   3912: 
1.1       root     3913: Here are some C macros that relate to machine modes:
                   3914: 
                   3915: @table @code
                   3916: @item GET_MODE (@var{x})
                   3917: Returns the machine mode of the RTX @var{x}.
                   3918: 
                   3919: @item PUT_MODE (@var{x}, @var{newmode})
                   3920: Alters the machine mode of the RTX @var{x} to be @var{newmode}.
                   3921: 
1.1.1.4   root     3922: @item NUM_MACHINE_MODES
                   3923: Stands for the number of machine modes available on the target
                   3924: machine.  This is one greater than the largest numeric value of any
                   3925: machine mode.
                   3926: 
                   3927: @item GET_MODE_NAME (@var{m})
                   3928: Returns the name of mode @var{m} as a string.
                   3929: 
                   3930: @item GET_MODE_CLASS (@var{m})
                   3931: Returns the mode class of mode @var{m}.
                   3932: 
1.1       root     3933: @item GET_MODE_SIZE (@var{m})
                   3934: Returns the size in bytes of a datum of mode @var{m}.
                   3935: 
                   3936: @item GET_MODE_BITSIZE (@var{m})
                   3937: Returns the size in bits of a datum of mode @var{m}.
                   3938: 
                   3939: @item GET_MODE_UNIT_SIZE (@var{m})
                   3940: Returns the size in bits of the subunits of a datum of mode @var{m}.
                   3941: This is the same as @code{GET_MODE_SIZE} except in the case of
                   3942: complex modes and @code{EPmode}.  For them, the unit size is the
                   3943: size of the real or imaginary part, or the size of the function
                   3944: pointer or the context pointer.
                   3945: @end table
                   3946: 
                   3947: @node Constants, Regs and Memory, Machine Modes, RTL
                   3948: @section Constant Expression Types
                   3949: 
                   3950: The simplest RTL expressions are those that represent constant values.
                   3951: 
                   3952: @table @code
                   3953: @item (const_int @var{i})
                   3954: This type of expression represents the integer value @var{i}.  @var{i}
                   3955: is customarily accessed with the macro @code{INTVAL} as in
                   3956: @code{INTVAL (@var{exp})}, which is equivalent to @code{XINT (@var{exp}, 0)}.
                   3957: 
                   3958: There is only one expression object for the integer value zero;
                   3959: it is the value of the variable @code{const0_rtx}.  Likewise, the
                   3960: only expression for integer value one is found in @code{const1_rtx}.
                   3961: Any attempt to create an expression of code @samp{const_int} and
                   3962: value zero or one will return @code{const0_rtx} or @code{const1_rtx}
                   3963: as appropriate.
                   3964: 
                   3965: @item (const_double:@var{m} @var{i0} @var{i1})
1.1.1.6 ! root     3966: Represents a 64-bit constant of mode @var{m}.  All floating point
1.1       root     3967: constants are represented in this way, and so are 64-bit @code{DImode}
                   3968: integer constants.
                   3969: 
                   3970: The two integers @var{i0} and @var{i1} together contain the bits of
                   3971: the value.  If the constant is floating point (either single or double
                   3972: precision), then they represent a @code{double}.  To convert them to a
                   3973: @code{double}, do
                   3974: 
                   3975: @example
                   3976: union @{ double d; int i[2];@} u;
                   3977: u.i[0] = XINT (x, 0);
                   3978: u.i[1] = XINT (x, 1);
                   3979: @end example
                   3980: 
                   3981: @noindent
                   3982: and then refer to @code{u.d}.
                   3983: 
                   3984: The global variables @code{dconst0_rtx} and @code{fconst0_rtx} hold
                   3985: @samp{const_double} expressions with value 0, in modes @code{DFmode} and
                   3986: @code{SFmode}, respectively.
                   3987: 
                   3988: @item (symbol_ref @var{symbol})
                   3989: Represents the value of an assembler label for data.  @var{symbol} is
                   3990: a string that describes the name of the assembler label.  If it starts
                   3991: with a @samp{*}, the label is the rest of @var{symbol} not including
                   3992: the @samp{*}.  Otherwise, the label is @var{symbol}, prefixed with
                   3993: @samp{_}.
                   3994: 
                   3995: @item (label_ref @var{label})
                   3996: Represents the value of an assembler label for code.  It contains one
                   3997: operand, an expression, which must be a @samp{code_label} that appears
                   3998: in the instruction sequence to identify the place where the label
                   3999: should go.
                   4000: 
                   4001: The reason for using a distinct expression type for code label
                   4002: references is so that jump optimization can distinguish them.
                   4003: 
                   4004: @item (const @var{exp})
                   4005: Represents a constant that is the result of an assembly-time
                   4006: arithmetic computation.  The operand, @var{exp}, is an expression that
                   4007: contains only constants (@samp{const_int}, @samp{symbol_ref} and
                   4008: @samp{label_ref} expressions) combined with @samp{plus} and
                   4009: @samp{minus}.  However, not all combinations are valid, since the
                   4010: assembler cannot do arbitrary arithmetic on relocatable symbols.
                   4011: @end table
                   4012: 
                   4013: @node Regs and Memory, Arithmetic, Constants, RTL
                   4014: @section Registers and Memory
                   4015: 
                   4016: Here are the RTL expression types for describing access to machine
                   4017: registers and to main memory.
                   4018: 
                   4019: @table @code
                   4020: @item (reg:@var{m} @var{n})
                   4021: For small values of the integer @var{n} (less than
                   4022: @code{FIRST_PSEUDO_REGISTER}), this stands for a reference to machine
                   4023: register number @var{n}: a @dfn{hard register}.  For larger values of
                   4024: @var{n}, it stands for a temporary value or @dfn{pseudo register}.
                   4025: The compiler's strategy is to generate code assuming an unlimited
                   4026: number of such pseudo registers, and later convert them into hard
                   4027: registers or into memory references.
                   4028: 
                   4029: The symbol @code{FIRST_PSEUDO_REGISTER} is defined by the machine
                   4030: description, since the number of hard registers on the machine is an
                   4031: invariant characteristic of the machine.  Note, however, that not
                   4032: all of the machine registers must be general registers.  All the
                   4033: machine registers that can be used for storage of data are given
                   4034: hard register numbers, even those that can be used only in certain
                   4035: instructions or can hold only certain types of data.
                   4036: 
                   4037: Each pseudo register number used in a function's RTL code is
                   4038: represented by a unique @samp{reg} expression.
                   4039: 
                   4040: @var{m} is the machine mode of the reference.  It is necessary because
                   4041: machines can generally refer to each register in more than one mode.
                   4042: For example, a register may contain a full word but there may be
                   4043: instructions to refer to it as a half word or as a single byte, as
                   4044: well as instructions to refer to it as a floating point number of
                   4045: various precisions.
                   4046: 
                   4047: Even for a register that the machine can access in only one mode,
                   4048: the mode must always be specified.
                   4049: 
                   4050: A hard register may be accessed in various modes throughout one
                   4051: function, but each pseudo register is given a natural mode
                   4052: and is accessed only in that mode.  When it is necessary to describe
                   4053: an access to a pseudo register using a nonnatural mode, a @samp{subreg}
                   4054: expression is used.
                   4055: 
                   4056: A @samp{reg} expression with a machine mode that specifies more than
                   4057: one word of data may actually stand for several consecutive registers.
                   4058: If in addition the register number specifies a hardware register, then
                   4059: it actually represents several consecutive hardware registers starting
                   4060: with the specified one.
                   4061: 
1.1.1.5   root     4062: Such multi-word hardware register @samp{reg} expressions must not be live
1.1       root     4063: across the boundary of a basic block.  The lifetime analysis pass does not
                   4064: know how to record properly that several consecutive registers are
                   4065: actually live there, and therefore register allocation would be confused.
                   4066: The CSE pass must go out of its way to make sure the situation does
                   4067: not arise.
                   4068: 
                   4069: @item (subreg:@var{m} @var{reg} @var{wordnum})
                   4070: @samp{subreg} expressions are used to refer to a register in a machine
                   4071: mode other than its natural one, or to refer to one register of
                   4072: a multi-word @samp{reg} that actually refers to several registers.
                   4073: 
                   4074: Each pseudo-register has a natural mode.  If it is necessary to
                   4075: operate on it in a different mode---for example, to perform a fullword
                   4076: move instruction on a pseudo-register that contains a single byte---
                   4077: the pseudo-register must be enclosed in a @samp{subreg}.  In such
                   4078: a case, @var{wordnum} is zero.
                   4079: 
                   4080: The other use of @samp{subreg} is to extract the individual registers
                   4081: of a multi-register value.  Machine modes such as @code{DImode} and
                   4082: @code{EPmode} indicate values longer than a word, values which usually
                   4083: require two consecutive registers.  To access one of the registers,
                   4084: use a @samp{subreg} with mode @code{SImode} and a @var{wordnum} that
                   4085: says which register.
                   4086: 
                   4087: The compilation parameter @code{WORDS_BIG_ENDIAN}, if defined, says
                   4088: that word number zero is the most significant part; otherwise, it is
                   4089: the least significant part.
                   4090: 
                   4091: Between the combiner pass and the reload pass, it is possible to have
                   4092: a @samp{subreg} which contains a @samp{mem} instead of a @samp{reg} as
                   4093: its first operand.  The reload pass eliminates these cases by
                   4094: reloading the @samp{mem} into a suitable register.
                   4095: 
                   4096: Note that it is not valid to access a @code{DFmode} value in @code{SFmode}
                   4097: using a @samp{subreg}.  On some machines the most significant part of a
                   4098: @code{DFmode} value does not have the same format as a single-precision
                   4099: floating value.
                   4100: 
                   4101: @item (cc0)
                   4102: This refers to the machine's condition code register.  It has no
                   4103: operands and may not have a machine mode.  It may be validly used in
                   4104: only two contexts: as the destination of an assignment (in test and
                   4105: compare instructions) and in comparison operators comparing against
                   4106: zero (@samp{const_int} with value zero; that is to say,
                   4107: @code{const0_rtx}).
                   4108: 
                   4109: There is only one expression object of code @samp{cc0}; it is the
                   4110: value of the variable @code{cc0_rtx}.  Any attempt to create an
                   4111: expression of code @samp{cc0} will return @code{cc0_rtx}.
                   4112: 
                   4113: One special thing about the condition code register is that
                   4114: instructions can set it implicitly.  On many machines, nearly all
                   4115: instructions set the condition code based on the value that they
                   4116: compute or store.  It is not necessary to record these actions
                   4117: explicitly in the RTL because the machine description includes a
                   4118: prescription for recognizing the instructions that do so (by means of
                   4119: the macro @code{NOTICE_UPDATE_CC}).  Only instructions whose sole
                   4120: purpose is to set the condition code, and instructions that use the
                   4121: condition code, need mention @code{(cc0)}.
                   4122: 
                   4123: @item (pc)
                   4124: This represents the machine's program counter.  It has no operands and
                   4125: may not have a machine mode.  @code{(pc)} may be validly used only in
                   4126: certain specific contexts in jump instructions.
                   4127: 
                   4128: There is only one expression object of code @samp{pc}; it is the value
                   4129: of the variable @code{pc_rtx}.  Any attempt to create an expression of
                   4130: code @samp{pc} will return @code{pc_rtx}.
                   4131: 
                   4132: All instructions that do not jump alter the program counter implicitly
                   4133: by incrementing it, but there is no need to mention this in the RTL.
                   4134: 
                   4135: @item (mem:@var{m} @var{addr})
                   4136: This RTX represents a reference to main memory at an address
                   4137: represented by the expression @var{addr}.  @var{m} specifies how large
                   4138: a unit of memory is accessed.
                   4139: @end table
                   4140: 
                   4141: @node Arithmetic, Comparisons, Regs and Memory, RTL
                   4142: @section RTL Expressions for Arithmetic
                   4143: 
                   4144: @table @code
                   4145: @item (plus:@var{m} @var{x} @var{y})
                   4146: Represents the sum of the values represented by @var{x} and @var{y}
                   4147: carried out in machine mode @var{m}.  This is valid only if
                   4148: @var{x} and @var{y} both are valid for mode @var{m}.
                   4149: 
                   4150: @item (minus:@var{m} @var{x} @var{y})
                   4151: Like @samp{plus} but represents subtraction.
                   4152: 
1.1.1.6 ! root     4153: @item (compare @var{x} @var{y})
1.1       root     4154: Represents the result of subtracting @var{y} from @var{x}
                   4155: for purposes of comparison.  The absence of a machine mode
1.1.1.6 ! root     4156: in the @samp{compare} expression indicates that the result is
1.1       root     4157: computed without overflow, as if with infinite precision.
                   4158: 
                   4159: Of course, machines can't really subtract with infinite precision.
                   4160: However, they can pretend to do so when only the sign of the
                   4161: result will be used, which is the case when the result is stored
                   4162: in @code{(cc0)}.  And that is the only way this kind of expression
                   4163: may validly be used: as a value to be stored in the condition codes.
                   4164: 
                   4165: @item (neg:@var{m} @var{x})
                   4166: Represents the negation (subtraction from zero) of the value
                   4167: represented by @var{x}, carried out in mode @var{m}.  @var{x} must be
                   4168: valid for mode @var{m}.
                   4169: 
                   4170: @item (mult:@var{m} @var{x} @var{y})
                   4171: Represents the signed product of the values represented by @var{x} and
                   4172: @var{y} carried out in machine mode @var{m}.  If
                   4173: @var{x} and @var{y} are both valid for mode @var{m}, this is ordinary
                   4174: size-preserving multiplication.  Alternatively, both @var{x} and @var{y}
                   4175: may be valid for a different, narrower mode.  This represents the
                   4176: kind of multiplication that generates a product wider than the operands.
                   4177: Widening multiplication and same-size multiplication are completely
                   4178: distinct and supported by different machine instructions; machines may
                   4179: support one but not the other.@refill
                   4180: 
1.1.1.5   root     4181: @samp{mult} may be used for floating point multiplication as well.
1.1       root     4182: Then @var{m} is a floating point machine mode.
                   4183: 
                   4184: @item (umult:@var{m} @var{x} @var{y})
                   4185: Like @samp{mult} but represents unsigned multiplication.  It may be
                   4186: used in both same-size and widening forms, like @samp{mult}.
                   4187: @samp{umult} is used only for fixed-point multiplication.
                   4188: 
                   4189: @item (div:@var{m} @var{x} @var{y})
                   4190: Represents the quotient in signed division of @var{x} by @var{y},
                   4191: carried out in machine mode @var{m}.  If @var{m} is a floating-point
                   4192: mode, it represents the exact quotient; otherwise, the integerized
                   4193: quotient.  If @var{x} and @var{y} are both valid for mode @var{m},
                   4194: this is ordinary size-preserving division.  Some machines have
                   4195: division instructions in which the operands and quotient widths are
                   4196: not all the same; such instructions are represented by @samp{div}
                   4197: expressions in which the machine modes are not all the same.
                   4198: 
                   4199: @item (udiv:@var{m} @var{x} @var{y})
                   4200: Like @samp{div} but represents unsigned division.
                   4201: 
                   4202: @item (mod:@var{m} @var{x} @var{y})
                   4203: @itemx (umod:@var{m} @var{x} @var{y})
                   4204: Like @samp{div} and @samp{udiv} but represent the remainder instead of
                   4205: the quotient.
                   4206: 
                   4207: @item (not:@var{m} @var{x})
                   4208: Represents the bitwise complement of the value represented by @var{x},
                   4209: carried out in mode @var{m}, which must be a fixed-point machine mode.
                   4210: @var{x} must be valid for mode @var{m}, which must be a fixed-point mode.
                   4211: 
                   4212: @item (and:@var{m} @var{x} @var{y})
                   4213: Represents the bitwise logical-and of the values represented by
                   4214: @var{x} and @var{y}, carried out in machine mode @var{m}.  This is
                   4215: valid only if @var{x} and @var{y} both are valid for mode @var{m},
                   4216: which must be a fixed-point mode.
                   4217: 
                   4218: @item (ior:@var{m} @var{x} @var{y})
                   4219: Represents the bitwise inclusive-or of the values represented by
                   4220: @var{x} and @var{y}, carried out in machine mode @var{m}.  This is
                   4221: valid only if @var{x} and @var{y} both are valid for mode @var{m},
                   4222: which must be a fixed-point mode.
                   4223: 
                   4224: @item (xor:@var{m} @var{x} @var{y})
                   4225: Represents the bitwise exclusive-or of the values represented by
                   4226: @var{x} and @var{y}, carried out in machine mode @var{m}.  This is
                   4227: valid only if @var{x} and @var{y} both are valid for mode @var{m},
                   4228: which must be a fixed-point mode.
                   4229: 
                   4230: @item (lshift:@var{m} @var{x} @var{c})
                   4231: Represents the result of logically shifting @var{x} left by @var{c}
                   4232: places.  @var{x} must be valid for the mode @var{m}, a fixed-point
                   4233: machine mode.  @var{c} must be valid for a fixed-point mode;
                   4234: which mode is determined by the mode called for in the machine
                   4235: description entry for the left-shift instruction.  For example,
                   4236: on the Vax, the mode of @var{c} is @code{QImode} regardless of @var{m}.
                   4237: 
                   4238: On some machines, negative values of @var{c} may be meaningful; this
                   4239: is why logical left shift and arithmetic left shift are distinguished.
                   4240: For example, Vaxes have no right-shift instructions, and right shifts
                   4241: are represented as left-shift instructions whose counts happen
                   4242: to be negative constants or else computed (in a previous instruction)
                   4243: by negation.
                   4244: 
                   4245: @item (ashift:@var{m} @var{x} @var{c})
                   4246: Like @samp{lshift} but for arithmetic left shift.
                   4247: 
                   4248: @item (lshiftrt:@var{m} @var{x} @var{c})
                   4249: @itemx (ashiftrt:@var{m} @var{x} @var{c})
                   4250: Like @samp{lshift} and @samp{ashift} but for right shift.
                   4251: 
                   4252: @item (rotate:@var{m} @var{x} @var{c})
                   4253: @itemx (rotatert:@var{m} @var{x} @var{c})
                   4254: Similar but represent left and right rotate.
                   4255: 
                   4256: @item (abs:@var{m} @var{x})
                   4257: Represents the absolute value of @var{x}, computed in mode @var{m}.
                   4258: @var{x} must be valid for @var{m}.
                   4259: 
                   4260: @item (sqrt:@var{m} @var{x})
                   4261: Represents the square root of @var{x}, computed in mode @var{m}.
                   4262: @var{x} must be valid for @var{m}.  Most often @var{m} will be
                   4263: a floating point mode.
                   4264: 
                   4265: @item (ffs:@var{m} @var{x})
                   4266: Represents the one plus the index of the least significant 1-bit in
                   4267: @var{x}, represented as an integer of mode @var{m}.  (The value is
                   4268: zero if @var{x} is zero.)  The mode of @var{x} need not be @var{m};
                   4269: depending on the target machine, various mode combinations may be
                   4270: valid.
                   4271: @end table
                   4272: 
                   4273: @node Comparisons, Bit Fields, Arithmetic, RTL
                   4274: @section Comparison Operations
                   4275: 
                   4276: Comparison operators test a relation on two operands and are considered to
                   4277: represent the value 1 if the relation holds, or zero if it does not.  The
                   4278: mode of the comparison is determined by the operands; they must both be
                   4279: valid for a common machine mode.  A comparison with both operands constant
                   4280: would be invalid as the machine mode could not be deduced from it, but such
                   4281: a comparison should never exist in RTL due to constant folding.
                   4282: 
                   4283: Inequality comparisons come in two flavors, signed and unsigned.  Thus,
                   4284: there are distinct expression codes @samp{gt} and @samp{gtu} for signed and
                   4285: unsigned greater-than.  These can produce different results for the same
                   4286: pair of integer values: for example, 1 is signed greater-than -1 but not
                   4287: unsigned greater-than, because -1 when regarded as unsigned is actually
                   4288: @code{0xffffffff} which is greater than 1.
                   4289: 
                   4290: The signed comparisons are also used for floating point values.  Floating
                   4291: point comparisons are distinguished by the machine modes of the operands.
                   4292: 
                   4293: The comparison operators may be used to compare the condition codes
                   4294: @code{(cc0)} against zero, as in @code{(eq (cc0) (const_int 0))}.  Such a
                   4295: construct actually refers to the result of the preceding instruction in
                   4296: which the condition codes were set.  The above example stands for 1 if the
                   4297: condition codes were set to say ``zero'' or ``equal'', 0 otherwise.
                   4298: Although the same comparison operators are used for this as may be used in
                   4299: other contexts on actual data, no confusion can result since the machine
                   4300: description would never allow both kinds of uses in the same context.
                   4301: 
                   4302: @table @code
                   4303: @item (eq @var{x} @var{y})
                   4304: 1 if the values represented by @var{x} and @var{y} are equal,
                   4305: otherwise 0.
                   4306: 
                   4307: @item (ne @var{x} @var{y})
                   4308: 1 if the values represented by @var{x} and @var{y} are not equal,
                   4309: otherwise 0.
                   4310: 
                   4311: @item (gt @var{x} @var{y})
                   4312: 1 if the @var{x} is greater than @var{y}.  If they are fixed-point,
                   4313: the comparison is done in a signed sense.
                   4314: 
                   4315: @item (gtu @var{x} @var{y})
                   4316: Like @samp{gt} but does unsigned comparison, on fixed-point numbers only.
                   4317: 
                   4318: @item (lt @var{x} @var{y})
                   4319: @item (ltu @var{x} @var{y})
                   4320: Like @samp{gt} and @samp{gtu} but test for ``less than''.
                   4321: 
                   4322: @item (ge @var{x} @var{y})
                   4323: @item (geu @var{x} @var{y})
                   4324: Like @samp{gt} and @samp{gtu} but test for ``greater than or equal''.
                   4325: 
                   4326: @item (le @var{x} @var{y})
                   4327: @item (leu @var{x} @var{y})
                   4328: Like @samp{gt} and @samp{gtu} but test for ``less than or equal''.
                   4329: 
                   4330: @item (if_then_else @var{cond} @var{then} @var{else})
                   4331: This is not a comparison operation but is listed here because it is
                   4332: always used in conjunction with a comparison operation.  To be
                   4333: precise, @var{cond} is a comparison expression.  This expression
                   4334: represents a choice, according to @var{cond}, between the value
                   4335: represented by @var{then} and the one represented by @var{else}.
                   4336: 
                   4337: On most machines, @samp{if_then_else} expressions are valid only
                   4338: to express conditional jumps.
                   4339: @end table
                   4340: 
                   4341: @node Bit Fields, Conversions, Comparisons, RTL
                   4342: @section Bit-fields
                   4343: 
                   4344: Special expression codes exist to represent bit-field instructions.
                   4345: These types of expressions are lvalues in RTL; they may appear
                   4346: on the left side of a assignment, indicating insertion of a value
                   4347: into the specified bit field.
                   4348: 
                   4349: @table @code
                   4350: @item (sign_extract:SI @var{loc} @var{size} @var{pos})
                   4351: This represents a reference to a sign-extended bit-field contained or
                   4352: starting in @var{loc} (a memory or register reference).  The bit field
                   4353: is @var{size} bits wide and starts at bit @var{pos}.  The compilation
                   4354: option @code{BITS_BIG_ENDIAN} says which end of the memory unit
                   4355: @var{pos} counts from.
                   4356: 
                   4357: Which machine modes are valid for @var{loc} depends on the machine,
                   4358: but typically @var{loc} should be a single byte when in memory
                   4359: or a full word in a register.
                   4360: 
                   4361: @item (zero_extract:SI @var{loc} @var{size} @var{pos})
                   4362: Like @samp{sign_extract} but refers to an unsigned or zero-extended
                   4363: bit field.  The same sequence of bits are extracted, but they
                   4364: are filled to an entire word with zeros instead of by sign-extension.
                   4365: @end table
                   4366: 
                   4367: @node Conversions, RTL Declarations, Bit Fields, RTL
                   4368: @section Conversions
                   4369: 
                   4370: All conversions between machine modes must be represented by
                   4371: explicit conversion operations.  For example, an expression
                   4372: which is the sum of a byte and a full word cannot be written as
                   4373: @code{(plus:SI (reg:QI 34) (reg:SI 80))} because the @samp{plus}
                   4374: operation requires two operands of the same machine mode.
                   4375: Therefore, the byte-sized operand is enclosed in a conversion
                   4376: operation, as in
                   4377: 
                   4378: @example
                   4379: (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
                   4380: @end example
                   4381: 
                   4382: The conversion operation is not a mere placeholder, because there
                   4383: may be more than one way of converting from a given starting mode
                   4384: to the desired final mode.  The conversion operation code says how
                   4385: to do it.
                   4386: 
                   4387: @table @code
                   4388: @item (sign_extend:@var{m} @var{x})
                   4389: Represents the result of sign-extending the value @var{x}
                   4390: to machine mode @var{m}.  @var{m} must be a fixed-point mode
                   4391: and @var{x} a fixed-point value of a mode narrower than @var{m}.
                   4392: 
                   4393: @item (zero_extend:@var{m} @var{x})
                   4394: Represents the result of zero-extending the value @var{x}
                   4395: to machine mode @var{m}.  @var{m} must be a fixed-point mode
                   4396: and @var{x} a fixed-point value of a mode narrower than @var{m}.
                   4397: 
                   4398: @item (float_extend:@var{m} @var{x})
                   4399: Represents the result of extending the value @var{x}
                   4400: to machine mode @var{m}.  @var{m} must be a floating point mode
                   4401: and @var{x} a floating point value of a mode narrower than @var{m}.
                   4402: 
                   4403: @item (truncate:@var{m} @var{x})
                   4404: Represents the result of truncating the value @var{x}
                   4405: to machine mode @var{m}.  @var{m} must be a fixed-point mode
                   4406: and @var{x} a fixed-point value of a mode wider than @var{m}.
                   4407: 
                   4408: @item (float_truncate:@var{m} @var{x})
                   4409: Represents the result of truncating the value @var{x}
                   4410: to machine mode @var{m}.  @var{m} must be a floating point mode
                   4411: and @var{x} a floating point value of a mode wider than @var{m}.
                   4412: 
                   4413: @item (float:@var{m} @var{x})
                   4414: Represents the result of converting fixed point value @var{x},
                   4415: regarded as signed, to floating point mode @var{m}.
                   4416: 
                   4417: @item (unsigned_float:@var{m} @var{x})
                   4418: Represents the result of converting fixed point value @var{x},
                   4419: regarded as unsigned, to floating point mode @var{m}.
                   4420: 
                   4421: @item (fix:@var{m} @var{x})
                   4422: When @var{m} is a fixed point mode, represents the result of
                   4423: converting floating point value @var{x} to mode @var{m}, regarded as
                   4424: signed.  How rounding is done is not specified, so this operation may
                   4425: be used validly in compiling C code only for integer-valued operands.
                   4426: 
                   4427: @item (unsigned_fix:@var{m} @var{x})
                   4428: Represents the result of converting floating point value @var{x} to
                   4429: fixed point mode @var{m}, regarded as unsigned.  How rounding is done
                   4430: is not specified.
                   4431: 
                   4432: @item (fix:@var{m} @var{x})
                   4433: When @var{m} is a floating point mode, represents the result of
                   4434: converting floating point value @var{x} (valid for mode @var{m}) to an
                   4435: integer, still represented in floating point mode @var{m}, by rounding
                   4436: towards zero.
                   4437: @end table
                   4438: 
                   4439: @node RTL Declarations, Side Effects, Conversions, RTL
                   4440: @section Declarations
                   4441: 
                   4442: Declaration expression codes do not represent arithmetic operations
                   4443: but rather state assertions about their operands.
                   4444: 
                   4445: @table @code
                   4446: @item (strict_low_part (subreg:@var{m} (reg:@var{n} @var{r}) 0))
                   4447: This expression code is used in only one context: operand 0 of a
                   4448: @samp{set} expression.  In addition, the operand of this expression
                   4449: must be a @samp{subreg} expression.
                   4450: 
                   4451: The presence of @samp{strict_low_part} says that the part of the
                   4452: register which is meaningful in mode @var{n}, but is not part of
                   4453: mode @var{m}, is not to be altered.  Normally, an assignment to such
                   4454: a subreg is allowed to have undefined effects on the rest of the
                   4455: register when @var{m} is less than a word.
                   4456: @end table
                   4457: 
                   4458: @node Side Effects, Incdec, RTL Declarations, RTL
                   4459: @section Side Effect Expressions
                   4460: 
                   4461: The expression codes described so far represent values, not actions.
                   4462: But machine instructions never produce values; they are meaningful
                   4463: only for their side effects on the state of the machine.  Special
                   4464: expression codes are used to represent side effects.
                   4465: 
                   4466: The body of an instruction is always one of these side effect codes;
                   4467: the codes described above, which represent values, appear only as
                   4468: the operands of these.
                   4469: 
                   4470: @table @code
                   4471: @item (set @var{lval} @var{x})
                   4472: Represents the action of storing the value of @var{x} into the place
                   4473: represented by @var{lval}.  @var{lval} must be an expression
                   4474: representing a place that can be stored in: @samp{reg} (or
                   4475: @samp{subreg} or @samp{strict_low_part}), @samp{mem}, @samp{pc} or
                   4476: @samp{cc0}.@refill
                   4477: 
                   4478: If @var{lval} is a @samp{reg}, @samp{subreg} or @samp{mem}, it has a
                   4479: machine mode; then @var{x} must be valid for that mode.@refill
                   4480: 
                   4481: If @var{lval} is a @samp{reg} whose machine mode is less than the full
                   4482: width of the register, then it means that the part of the register
                   4483: specified by the machine mode is given the specified value and the
                   4484: rest of the register receives an undefined value.  Likewise, if
                   4485: @var{lval} is a @samp{subreg} whose machine mode is narrower than
                   4486: @code{SImode}, the rest of the register can be changed in an undefined way.
                   4487: 
                   4488: If @var{lval} is a @samp{strict_low_part} of a @samp{subreg}, then the
                   4489: part of the register specified by the machine mode of the
                   4490: @samp{subreg} is given the value @var{x} and the rest of the register
                   4491: is not changed.@refill
                   4492: 
                   4493: If @var{lval} is @code{(cc0)}, it has no machine mode, and @var{x} may
                   4494: have any mode.  This represents a ``test'' or ``compare'' instruction.@refill
                   4495: 
                   4496: If @var{lval} is @code{(pc)}, we have a jump instruction, and the
                   4497: possibilities for @var{x} are very limited.  It may be a
                   4498: @samp{label_ref} expression (unconditional jump).  It may be an
                   4499: @samp{if_then_else} (conditional jump), in which case either the
                   4500: second or the third operand must be @code{(pc)} (for the case which
                   4501: does not jump) and the other of the two must be a @samp{label_ref}
                   4502: (for the case which does jump).  @var{x} may also be a @samp{mem} or
                   4503: @code{(plus:SI (pc) @var{y})}, where @var{y} may be a @samp{reg} or a
                   4504: @samp{mem}; these unusual patterns are used to represent jumps through
                   4505: branch tables.@refill
                   4506: 
                   4507: @item (return)
                   4508: Represents a return from the current function, on machines where this
                   4509: can be done with one instruction, such as Vaxes.  On machines where a
                   4510: multi-instruction ``epilogue'' must be executed in order to return
                   4511: from the function, returning is done by jumping to a label which
                   4512: precedes the epilogue, and the @samp{return} expression code is never
                   4513: used.
                   4514: 
                   4515: @item (call @var{function} @var{nargs})
                   4516: Represents a function call.  @var{function} is a @samp{mem} expression
                   4517: whose address is the address of the function to be called.
                   4518: @var{nargs} is an expression which can be used for two purposes: on
                   4519: some machines it represents the number of bytes of stack argument; on
                   4520: others, it represents the number of argument registers.
                   4521: 
                   4522: Each machine has a standard machine mode which @var{function} must
                   4523: have.  The machine description defines macro @code{FUNCTION_MODE} to
                   4524: expand into the requisite mode name.  The purpose of this mode is to
                   4525: specify what kind of addressing is allowed, on machines where the
                   4526: allowed kinds of addressing depend on the machine mode being
                   4527: addressed.
                   4528: 
                   4529: @item (clobber @var{x})
                   4530: Represents the storing or possible storing of an unpredictable,
                   4531: undescribed value into @var{x}, which must be a @samp{reg} or
                   4532: @samp{mem} expression.
                   4533: 
                   4534: One place this is used is in string instructions that store standard
                   4535: values into particular hard registers.  It may not be worth the
                   4536: trouble to describe the values that are stored, but it is essential to
                   4537: inform the compiler that the registers will be altered, lest it
                   4538: attempt to keep data in them across the string instruction.
                   4539: 
                   4540: @var{x} may also be null---a null C pointer, no expression at all.
                   4541: Such a @code{(clobber (null))} expression means that all memory
                   4542: locations must be presumed clobbered.
                   4543: 
                   4544: Note that the machine description classifies certain hard registers as
                   4545: ``call-clobbered''.  All function call instructions are assumed by
                   4546: default to clobber these registers, so there is no need to use
                   4547: @samp{clobber} expressions to indicate this fact.  Also, each function
1.1.1.6 ! root     4548: call is assumed to have the potential to alter any memory location,
        !          4549: unless the function is declared @code{const}.
1.1       root     4550: 
1.1.1.4   root     4551: When a @samp{clobber} expression for a register appears inside a
                   4552: @samp{parallel} with other side effects, GNU CC guarantees that the
                   4553: register is unoccupied both before and after that insn.  Therefore, it
                   4554: is safe for the assembler code produced by the insn to use the
                   4555: register as a temporary.  You can clobber either a specific hard
                   4556: register or a pseudo register; in the latter case, GNU CC will
                   4557: allocate a hard register that is available there for use as a
                   4558: temporary.
                   4559: 
1.1       root     4560: @item (use @var{x})
                   4561: Represents the use of the value of @var{x}.  It indicates that the
                   4562: value in @var{x} at this point in the program is needed, even though
                   4563: it may not be apparent why this is so.  Therefore, the compiler will
1.1.1.4   root     4564: not attempt to delete previous instructions whose only effect is to
                   4565: store a value in @var{x}.  @var{x} must be a @samp{reg} expression.
1.1       root     4566: 
                   4567: @item (parallel [@var{x0} @var{x1} @dots{}])
                   4568: Represents several side effects performed in parallel.  The square
                   4569: brackets stand for a vector; the operand of @samp{parallel} is a
                   4570: vector of expressions.  @var{x0}, @var{x1} and so on are individual
1.1.1.4   root     4571: side effect expressions---expressions of code @samp{set}, @samp{call},
1.1       root     4572: @samp{return}, @samp{clobber} or @samp{use}.@refill
                   4573: 
                   4574: ``In parallel'' means that first all the values used in the individual
                   4575: side-effects are computed, and second all the actual side-effects are
                   4576: performed.  For example,
                   4577: 
                   4578: @example
                   4579: (parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
                   4580:            (set (mem:SI (reg:SI 1)) (reg:SI 1))])
                   4581: @end example
                   4582: 
                   4583: @noindent
                   4584: says unambiguously that the values of hard register 1 and the memory
                   4585: location addressed by it are interchanged.  In both places where
                   4586: @code{(reg:SI 1)} appears as a memory address it refers to the value
1.1.1.4   root     4587: in register 1 @emph{before} the execution of the insn.
                   4588: 
                   4589: It follows that it is @emph{incorrect} to use @samp{parallel} and
                   4590: expect the result of one @samp{set} to be available for the next one.
                   4591: For example, people sometimes attempt to represent a jump-if-zero
                   4592: instruction this way:
                   4593: 
                   4594: @example
                   4595: (parallel [(set (cc0) (reg:SI 34))
                   4596:           (set (pc) (if_then_else
                   4597:                        (eq (cc0) (const_int 0))
                   4598:                        (label_ref @dots{})
                   4599:                        (pc)))])
                   4600: @end example
                   4601: 
                   4602: @noindent
                   4603: But this is incorrect, because it says that the jump condition depends
                   4604: on the condition code value @emph{before} this instruction, not on the
                   4605: new value that is set by this instruction.
1.1       root     4606: 
1.1.1.5   root     4607: Peephole optimization, which takes place in together with final assembly
                   4608: code output, can produce insns whose patterns consist of a @samp{parallel}
1.1       root     4609: whose elements are the operands needed to output the resulting
                   4610: assembler code--often @samp{reg}, @samp{mem} or constant expressions.
                   4611: This would not be well-formed RTL at any other stage in compilation,
                   4612: but it is ok then because no further optimization remains to be done.
1.1.1.4   root     4613: However, the definition of the macro @code{NOTICE_UPDATE_CC} must
                   4614: deal with such insns if you define any peephole optimizations.
1.1       root     4615: 
                   4616: @item (sequence [@var{insns} @dots{}])
                   4617: Represents a sequence of insns.  Each of the @var{insns} that appears
                   4618: in the vector is suitable for appearing in the chain of insns, so it
                   4619: must be an @samp{insn}, @samp{jump_insn}, @samp{call_insn},
                   4620: @samp{code_label}, @samp{barrier} or @samp{note}.
                   4621: 
                   4622: A @samp{sequence} RTX never appears in an actual insn.  It represents
                   4623: the sequence of insns that result from a @samp{define_expand}
                   4624: @emph{before} those insns are passed to @code{emit_insn} to insert
                   4625: them in the chain of insns.  When actually inserted, the individual
                   4626: sub-insns are separated out and the @samp{sequence} is forgotten.
                   4627: @end table
                   4628: 
                   4629: Three expression codes appear in place of a side effect, as the body of an
                   4630: insn, though strictly speaking they do not describe side effects as such:
                   4631: 
                   4632: @table @code
                   4633: @item (asm_input @var{s})
                   4634: Represents literal assembler code as described by the string @var{s}.
                   4635: 
                   4636: @item (addr_vec:@var{m} [@var{lr0} @var{lr1} @dots{}])
                   4637: Represents a table of jump addresses.  The vector elements @var{lr0},
                   4638: etc., are @samp{label_ref} expressions.  The mode @var{m} specifies
                   4639: how much space is given to each address; normally @var{m} would be
                   4640: @code{Pmode}.
                   4641: 
                   4642: @item (addr_diff_vec:@var{m} @var{base} [@var{lr0} @var{lr1} @dots{}])
                   4643: Represents a table of jump addresses expressed as offsets from
                   4644: @var{base}.  The vector elements @var{lr0}, etc., are @samp{label_ref}
                   4645: expressions and so is @var{base}.  The mode @var{m} specifies how much
                   4646: space is given to each address-difference.@refill
                   4647: @end table
                   4648: 
                   4649: @node Incdec, Assembler, Side Effects, RTL
                   4650: @section Embedded Side-Effects on Addresses
                   4651: 
                   4652: Four special side-effect expression codes appear as memory addresses.
                   4653: 
                   4654: @table @code
                   4655: @item (pre_dec:@var{m} @var{x})
                   4656: Represents the side effect of decrementing @var{x} by a standard
                   4657: amount and represents also the value that @var{x} has after being
                   4658: decremented.  @var{x} must be a @samp{reg} or @samp{mem}, but most
                   4659: machines allow only a @samp{reg}.  @var{m} must be the machine mode
                   4660: for pointers on the machine in use.  The amount @var{x} is decremented
                   4661: by is the length in bytes of the machine mode of the containing memory
                   4662: reference of which this expression serves as the address.  Here is an
                   4663: example of its use:@refill
                   4664: 
                   4665: @example
                   4666: (mem:DF (pre_dec:SI (reg:SI 39)))
                   4667: @end example
                   4668: 
                   4669: @noindent
                   4670: This says to decrement pseudo register 39 by the length of a @code{DFmode}
                   4671: value and use the result to address a @code{DFmode} value.
                   4672: 
                   4673: @item (pre_inc:@var{m} @var{x})
                   4674: Similar, but specifies incrementing @var{x} instead of decrementing it.
                   4675: 
                   4676: @item (post_dec:@var{m} @var{x})
                   4677: Represents the same side effect as @samp{pre_decrement} but a different
                   4678: value.  The value represented here is the value @var{x} has @i{before}
                   4679: being decremented.
                   4680: 
                   4681: @item (post_inc:@var{m} @var{x})
                   4682: Similar, but specifies incrementing @var{x} instead of decrementing it.
                   4683: @end table
                   4684: 
                   4685: These embedded side effect expressions must be used with care.  Instruction
                   4686: patterns may not use them.  Until the @samp{flow} pass of the compiler,
                   4687: they may occur only to represent pushes onto the stack.  The @samp{flow}
                   4688: pass finds cases where registers are incremented or decremented in one
                   4689: instruction and used as an address shortly before or after; these cases are
                   4690: then transformed to use pre- or post-increment or -decrement.
                   4691: 
                   4692: Explicit popping of the stack could be represented with these embedded
                   4693: side effect operators, but that would not be safe; the instruction
                   4694: combination pass could move the popping past pushes, thus changing
                   4695: the meaning of the code.
                   4696: 
                   4697: An instruction that can be represented with an embedded side effect
                   4698: could also be represented using @samp{parallel} containing an additional
                   4699: @samp{set} to describe how the address register is altered.  This is not
                   4700: done because machines that allow these operations at all typically
                   4701: allow them wherever a memory address is called for.  Describing them as
                   4702: additional parallel stores would require doubling the number of entries
                   4703: in the machine description.
                   4704: 
                   4705: @node Assembler, Insns, IncDec, RTL
                   4706: @section Assembler Instructions as Expressions
                   4707: 
                   4708: The RTX code @samp{asm_operands} represents a value produced by a
                   4709: user-specified assembler instruction.  It is used to represent
                   4710: an @code{asm} statement with arguments.  An @code{asm} statement with
                   4711: a single output operand, like this:
                   4712: 
                   4713: @example
1.1.1.6 ! root     4714: asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
1.1       root     4715: @end example
                   4716: 
                   4717: @noindent
                   4718: is represented using a single @samp{asm_operands} RTX which represents
                   4719: the value that is stored in @code{outputvar}:
                   4720: 
                   4721: @example
                   4722: (set @var{rtx-for-outputvar}
                   4723:      (asm_operands "foo %1,%2,%0" "a" 0
                   4724:                    [@var{rtx-for-addition-result} @var{rtx-for-*z}]
                   4725:                    [(asm_input:@var{m1} "g")
                   4726:                     (asm_input:@var{m2} "di")]))
                   4727: @end example
                   4728: 
                   4729: @noindent
                   4730: Here the operands of the @samp{asm_operands} RTX are the assembler
                   4731: template string, the output-operand's constraint, the index-number of the
                   4732: output operand among the output operands specified, a vector of input
                   4733: operand RTX's, and a vector of input-operand modes and constraints.  The
                   4734: mode @var{m1} is the mode of the sum @code{x+y}; @var{m2} is that of
                   4735: @code{*z}.
                   4736: 
                   4737: When an @code{asm} statement has multiple output values, its insn has
                   4738: several such @samp{set} RTX's inside of a @samp{parallel}.  Each @samp{set}
                   4739: contains a @samp{asm_operands}; all of these share the same assembler
                   4740: template and vectors, but each contains the constraint for the respective
                   4741: output operand.  They are also distinguished by the output-operand index
                   4742: number, which is 0, 1, @dots{} for successive output operands.
                   4743: 
                   4744: @node Insns, Calls, Assembler, RTL
                   4745: @section Insns
                   4746: 
                   4747: The RTL representation of the code for a function is a doubly-linked
                   4748: chain of objects called @dfn{insns}.  Insns are expressions with
                   4749: special codes that are used for no other purpose.  Some insns are
                   4750: actual instructions; others represent dispatch tables for @code{switch}
                   4751: statements; others represent labels to jump to or various sorts of
                   4752: declarative information.
                   4753: 
                   4754: In addition to its own specific data, each insn must have a unique id-number
                   4755: that distinguishes it from all other insns in the current function, and
                   4756: chain pointers to the preceding and following insns.  These three fields
                   4757: occupy the same position in every insn, independent of the expression code
                   4758: of the insn.  They could be accessed with @code{XEXP} and @code{XINT},
                   4759: but instead three special macros are always used:
                   4760: 
                   4761: @table @code
                   4762: @item INSN_UID (@var{i})
                   4763: Accesses the unique id of insn @var{i}.
                   4764: 
                   4765: @item PREV_INSN (@var{i})
                   4766: Accesses the chain pointer to the insn preceding @var{i}.
                   4767: If @var{i} is the first insn, this is a null pointer.
                   4768: 
                   4769: @item NEXT_INSN (@var{i})
                   4770: Accesses the chain pointer to the insn following @var{i}.
                   4771: If @var{i} is the last insn, this is a null pointer.
                   4772: @end table
                   4773: 
                   4774: The @code{NEXT_INSN} and @code{PREV_INSN} pointers must always
1.1.1.6 ! root     4775: correspond: if @var{insn} is not the first insn,
1.1       root     4776: 
                   4777: @example
                   4778: NEXT_INSN (PREV_INSN (@var{insn})) == @var{insn}
                   4779: @end example
                   4780: 
                   4781: @noindent
                   4782: is always true.
                   4783: 
                   4784: Every insn has one of the following six expression codes:
                   4785: 
                   4786: @table @samp
                   4787: @item insn
                   4788: The expression code @samp{insn} is used for instructions that do not jump
                   4789: and do not do function calls.  Insns with code @samp{insn} have four
                   4790: additional fields beyond the three mandatory ones listed above.
                   4791: These four are described in a table below.
                   4792: 
                   4793: @item jump_insn
                   4794: The expression code @samp{jump_insn} is used for instructions that may jump
                   4795: (or, more generally, may contain @samp{label_ref} expressions).
                   4796: @samp{jump_insn} insns have the same extra fields as @samp{insn} insns,
                   4797: accessed in the same way.
                   4798: 
                   4799: @item call_insn
                   4800: The expression code @samp{call_insn} is used for instructions that may do
                   4801: function calls.  It is important to distinguish these instructions because
                   4802: they imply that certain registers and memory locations may be altered
                   4803: unpredictably.
                   4804: 
                   4805: @samp{call_insn} insns have the same extra fields as @samp{insn} insns,
                   4806: accessed in the same way.
                   4807: 
                   4808: @item code_label
                   4809: A @samp{code_label} insn represents a label that a jump insn can jump to.
                   4810: It contains one special field of data in addition to the three standard ones.
                   4811: It is used to hold the @dfn{label number}, a number that identifies this
                   4812: label uniquely among all the labels in the compilation (not just in the
                   4813: current function).  Ultimately, the label is represented in the assembler
                   4814: output as an assembler label @samp{L@var{n}} where @var{n} is the label number.
                   4815: 
                   4816: @item barrier
                   4817: Barriers are placed in the instruction stream after unconditional
                   4818: jump instructions to indicate that the jumps are unconditional.
                   4819: They contain no information beyond the three standard fields.
                   4820: 
                   4821: @item note
                   4822: @samp{note} insns are used to represent additional debugging and
                   4823: declarative information.  They contain two nonstandard fields, an
                   4824: integer which is accessed with the macro @code{NOTE_LINE_NUMBER} and a
                   4825: string accessed with @code{NOTE_SOURCE_FILE}.
                   4826: 
                   4827: If @code{NOTE_LINE_NUMBER} is positive, the note represents the
                   4828: position of a source line and @code{NOTE_SOURCE_FILE} is the source file name
                   4829: that the line came from.  These notes control generation of line
                   4830: number data in the assembler output.
                   4831: 
                   4832: Otherwise, @code{NOTE_LINE_NUMBER} is not really a line number but a
                   4833: code with one of the following values (and @code{NOTE_SOURCE_FILE}
                   4834: must contain a null pointer):
                   4835: 
                   4836: @table @code
                   4837: @item NOTE_INSN_DELETED
                   4838: Such a note is completely ignorable.  Some passes of the compiler
                   4839: delete insns by altering them into notes of this kind.
                   4840: 
                   4841: @item NOTE_INSN_BLOCK_BEG
                   4842: @itemx NOTE_INSN_BLOCK_END
                   4843: These types of notes indicate the position of the beginning and end
                   4844: of a level of scoping of variable names.  They control the output
                   4845: of debugging information.
                   4846: 
                   4847: @item NOTE_INSN_LOOP_BEG
                   4848: @itemx NOTE_INSN_LOOP_END
                   4849: These types of notes indicate the position of the beginning and end
                   4850: of a @code{while} or @code{for} loop.  They enable the loop optimizer
                   4851: to find loops quickly.
1.1.1.6 ! root     4852: @item NOTE_INSN_FUNCTION_END
        !          4853: Appears near the end of the function body, just before the label that
        !          4854: @code{return} statements jump to (on machine where a single instruction
        !          4855: does not suffice for returning).  This note may be deleted by jump
        !          4856: optimization.
        !          4857: @item NOTE_INSN_SETJMP
        !          4858: Appears following each call to @code{setjmp} or a related function.
1.1       root     4859: @end table
                   4860: @end table
                   4861: 
1.1.1.6 ! root     4862: The machine mode of an insn is normally zero (@code{VOIDmode}), but the
        !          4863: reload pass sets it to @code{QImode} if the insn needs reloading.
        !          4864: 
1.1       root     4865: Here is a table of the extra fields of @samp{insn}, @samp{jump_insn}
                   4866: and @samp{call_insn} insns:
                   4867: 
                   4868: @table @code
                   4869: @item PATTERN (@var{i})
                   4870: An expression for the side effect performed by this insn.
                   4871: 
1.1.1.6 ! root     4872: @item INSN_CODE (@var{i})
        !          4873: An integer that says which pattern in the machine description matches
        !          4874: this insn, or -1 if the matching has not yet been attempted.
        !          4875: 
        !          4876: Such matching is never attempted and this field is not used on an insn
        !          4877: whose pattern consists of a single @samp{use}, @samp{clobber},
        !          4878: @samp{asm}, @samp{addr_vec} or @samp{addr_diff_vec} expression.
1.1       root     4879: 
                   4880: @item LOG_LINKS (@var{i})
                   4881: A list (chain of @samp{insn_list} expressions) of previous ``related''
                   4882: insns: insns which store into registers values that are used for the
                   4883: first time in this insn.  (An additional constraint is that neither a
                   4884: jump nor a label may come between the related insns).  This list is
                   4885: set up by the flow analysis pass; it is a null pointer until then.
                   4886: 
1.1.1.6 ! root     4887: @item REG_NOTES (@var{i})
        !          4888: A list (chain of @samp{expr_list} expressions) giving information
        !          4889: about the usage of registers in this insn.  This list is set up by the
        !          4890: flow analysis pass; it is a null pointer until then.
1.1       root     4891: @end table
                   4892: 
                   4893: The @code{LOG_LINKS} field of an insn is a chain of @samp{insn_list}
                   4894: expressions.  Each of these has two operands: the first is an insn,
                   4895: and the second is another @samp{insn_list} expression (the next one in
                   4896: the chain).  The last @samp{insn_list} in the chain has a null pointer
                   4897: as second operand.  The significant thing about the chain is which
                   4898: insns appear in it (as first operands of @samp{insn_list}
                   4899: expressions).  Their order is not significant.
                   4900: 
                   4901: The @code{REG_NOTES} field of an insn is a similar chain but of
1.1.1.5   root     4902: @samp{expr_list} expressions instead of @samp{insn_list}.  There are
                   4903: several kinds of register notes, which are distinguished by the machine
                   4904: mode of the @samp{expr_list}, which in a register note is really
                   4905: understood as being an @code{enum reg_note}.  The first operand @var{op}
                   4906: of the @samp{expr_list} is data whose meaning depends on the kind of
                   4907: note.  Here are the kinds of register note:
1.1       root     4908: 
                   4909: @table @code
                   4910: @item REG_DEAD
                   4911: The register @var{op} dies in this insn; that is to say, altering the
                   4912: value immediately after this insn would not affect the future behavior
                   4913: of the program.
                   4914: 
                   4915: @item REG_INC
                   4916: The register @var{op} is incremented (or decremented; at this level
                   4917: there is no distinction) by an embedded side effect inside this insn.
                   4918: This means it appears in a @code{POST_INC}, @code{PRE_INC},
                   4919: @code{POST_DEC} or @code{PRE_DEC} RTX.
                   4920: 
                   4921: @item REG_EQUIV
                   4922: The register that is set by this insn will be equal to @var{op} at run
                   4923: time, and could validly be replaced in all its occurrences by
                   4924: @var{op}.  (``Validly'' here refers to the data flow of the program;
                   4925: simple replacement may make some insns invalid.)
                   4926: 
                   4927: The value which the insn explicitly copies into the register may look
                   4928: different from @var{op}, but they will be equal at run time.
                   4929: 
                   4930: For example, when a constant is loaded into a register that is never
                   4931: assigned any other value, this kind of note is used.
                   4932: 
                   4933: When a parameter is copied into a pseudo-register at entry to a function,
                   4934: a note of this kind records that the register is equivalent to the stack
                   4935: slot where the parameter was passed.  Although in this case the register
                   4936: may be set by other insns, it is still valid to replace the register
                   4937: by the stack slot throughout the function.
                   4938: 
                   4939: @item REG_EQUAL
                   4940: The register that is set by this insn will be equal to @var{op} at run
                   4941: time at the end of this insn (but not necessarily elsewhere in the
                   4942: function).
                   4943: 
                   4944: The RTX @var{op} is typically an arithmetic expression.  For example,
                   4945: when a sequence of insns such as a library call is used to perform an
                   4946: arithmetic operation, this kind of note is attached to the insn that
                   4947: produces or copies the final value.  It tells the CSE pass how to
                   4948: think of that value.
                   4949: 
                   4950: @item REG_RETVAL
                   4951: This insn copies the value of a library call, and @var{op} is the
                   4952: first insn that was generated to set up the arguments for the library
                   4953: call.
                   4954: 
                   4955: Flow analysis uses this note to delete all of a library call whose
                   4956: result is dead.
                   4957: 
                   4958: @item REG_WAS_0
                   4959: The register @var{op} contained zero before this insn.  You can rely
                   4960: on this note if it is present; its absence implies nothing.
                   4961: 
                   4962: @item REG_LIBCALL
                   4963: This is the inverse of @code{REG_RETVAL}: it is placed on the first
                   4964: insn of a library call, and it points to the last one.
                   4965: 
                   4966: Loop optimization uses this note to move an entire library call out
                   4967: of a loop when its value is constant.
                   4968: 
                   4969: @item REG_NONNEG
                   4970: The register @var{op} is known to have nonnegative value when this
                   4971: insn is reached.
                   4972: @end table
                   4973: 
                   4974: (The only difference between the expression codes @samp{insn_list} and
                   4975: @samp{expr_list} is that the first operand of an @samp{insn_list} is
                   4976: assumed to be an insn and is printed in debugging dumps as the insn's
                   4977: unique id; the first operand of an @samp{expr_list} is printed in the
                   4978: ordinary way as an expression.)
                   4979: 
                   4980: @node Calls, Sharing, Insns, RTL
                   4981: @section RTL Representation of Function-Call Insns
                   4982: 
                   4983: Insns that call subroutines have the RTL expression code @samp{call_insn}.
                   4984: These insns must satisfy special rules, and their bodies must use a special
                   4985: RTL expression code, @samp{call}.
                   4986: 
                   4987: A @samp{call} expression has two operands, as follows:
                   4988: 
                   4989: @example
1.1.1.6 ! root     4990: (call (mem:@var{fm} @var{addr}) @var{nbytes})
1.1       root     4991: @end example
                   4992: 
                   4993: @noindent
                   4994: Here @var{nbytes} is an operand that represents the number of bytes of
                   4995: argument data being passed to the subroutine, @var{fm} is a machine mode
                   4996: (which must equal as the definition of the @code{FUNCTION_MODE} macro in
                   4997: the machine description) and @var{addr} represents the address of the
                   4998: subroutine.
                   4999: 
                   5000: For a subroutine that returns no value, the @samp{call} RTX as shown above
                   5001: is the entire body of the insn.
                   5002: 
                   5003: For a subroutine that returns a value whose mode is not @code{BLKmode},
                   5004: the value is returned in a hard register.  If this register's number is
                   5005: @var{r}, then the body of the call insn looks like this:
                   5006: 
                   5007: @example
                   5008: (set (reg:@var{m} @var{r})
                   5009:      (call @var{nbytes} (mem:@var{fm} @var{addr})))
                   5010: @end example
                   5011: 
                   5012: @noindent
                   5013: This RTL expression makes it clear (to the optimizer passes) that the
                   5014: appropriate register receives a useful value in this insn.
                   5015: 
                   5016: Immediately after RTL generation, if the value of the subroutine is
                   5017: actually used, this call insn is always followed closely by an insn which
                   5018: refers to the register @var{r}.  This remains true through all the
                   5019: optimizer passes until cross jumping occurs.
                   5020: 
                   5021: The following insn has one of two forms.  Either it copies the value into a
                   5022: pseudo-register, like this:
                   5023: 
                   5024: @example
                   5025: (set (reg:@var{m} @var{p}) (reg:@var{m} @var{r}))
                   5026: @end example
                   5027: 
                   5028: @noindent
                   5029: or (in the case where the calling function will simply return whatever
                   5030: value the call produced, and no operation is needed to do this):
                   5031: 
                   5032: @example
                   5033: (use (reg:@var{m} @var{r}))
                   5034: @end example
                   5035: 
                   5036: @noindent
                   5037: Between the call insn and this following insn there may intervene only a
                   5038: stack-adjustment insn (and perhaps some @samp{note} insns).
                   5039: 
                   5040: When a subroutine returns a @code{BLKmode} value, it is handled by
                   5041: passing to the subroutine the address of a place to store the value.
                   5042: So the call insn itself does not ``return'' any value, and it has the
                   5043: same RTL form as a call that returns nothing.
                   5044: 
                   5045: @node Sharing,, Calls, RTL
                   5046: @section Structure Sharing Assumptions
                   5047: 
                   5048: The compiler assumes that certain kinds of RTL expressions are unique;
                   5049: there do not exist two distinct objects representing the same value.
                   5050: In other cases, it makes an opposite assumption: that no RTL expression
                   5051: object of a certain kind appears in more than one place in the
                   5052: containing structure.
                   5053: 
                   5054: These assumptions refer to a single function; except for the RTL
                   5055: objects that describe global variables and external functions,
                   5056: no RTL objects are common to two functions.
                   5057: 
                   5058: @itemize @bullet
                   5059: @item
                   5060: Each pseudo-register has only a single @samp{reg} object to represent it,
                   5061: and therefore only a single machine mode.
                   5062: 
                   5063: @item
                   5064: For any symbolic label, there is only one @samp{symbol_ref} object
                   5065: referring to it.
                   5066: 
                   5067: @item
                   5068: There is only one @samp{const_int} expression with value zero,
                   5069: and only one with value one.
                   5070: 
                   5071: @item
                   5072: There is only one @samp{pc} expression.
                   5073: 
                   5074: @item
                   5075: There is only one @samp{cc0} expression.
                   5076: 
                   5077: @item
                   5078: There is only one @samp{const_double} expression with mode
                   5079: @code{SFmode} and value zero, and only one with mode @code{DFmode} and
                   5080: value zero.
                   5081: 
                   5082: @item
                   5083: No @samp{label_ref} appears in more than one place in the RTL
                   5084: structure; in other words, it is safe to do a tree-walk of all the
                   5085: insns in the function and assume that each time a @samp{label_ref} is
                   5086: seen it is distinct from all others that are seen.
                   5087: 
                   5088: @item
                   5089: Only one @samp{mem} object is normally created for each static
                   5090: variable or stack slot, so these objects are frequently shared in all
                   5091: the places they appear.  However, separate but equal objects for these
                   5092: variables are occasionally made.
                   5093: 
                   5094: @item
1.1.1.5   root     5095: When a single @code{asm} statement has multiple output operands,
                   5096: a distinct @code{asm_operands} RTX is made for each output operand.
                   5097: However, these all share the vector which contains the sequence of
                   5098: input operands.  Because this sharing is used later on to test whether
                   5099: two @code{asm_operands} RTX's come from the same statement, the sharing
                   5100: must be guaranteed to be preserved.
                   5101: 
                   5102: @item
1.1       root     5103: No RTL object appears in more than one place in the RTL structure
                   5104: except as described above.  Many passes of the compiler rely on this
                   5105: by assuming that they can modify RTL objects in place without unwanted
                   5106: side-effects on other insns.
                   5107: 
                   5108: @item
                   5109: During initial RTL generation, shared structure is freely introduced.
                   5110: After all the RTL for a function has been generated, all shared
                   5111: structure is copied by @code{unshare_all_rtl} in @file{emit-rtl.c},
                   5112: after which the above rules are guaranteed to be followed.
                   5113: 
                   5114: @item
                   5115: During the combiner pass, shared structure with an insn can exist
                   5116: temporarily.  However, the shared structure is copied before the
                   5117: combiner is finished with the insn.  This is done by
                   5118: @code{copy_substitutions} in @samp{combine.c}.
                   5119: @end itemize
                   5120: 
                   5121: @node Machine Desc, Machine Macros, RTL, Top
                   5122: @chapter Machine Descriptions
                   5123: 
                   5124: A machine description has two parts: a file of instruction patterns
                   5125: (@file{.md} file) and a C header file of macro definitions.
                   5126: 
                   5127: The @file{.md} file for a target machine contains a pattern for each
                   5128: instruction that the target machine supports (or at least each instruction
                   5129: that is worth telling the compiler about).  It may also contain comments.
                   5130: A semicolon causes the rest of the line to be a comment, unless the semicolon
                   5131: is inside a quoted string.
                   5132: 
                   5133: See the next chapter for information on the C header file.
                   5134: 
                   5135: @menu
                   5136: * Patterns::            How to write instruction patterns.
                   5137: * Example::             An explained example of a @samp{define_insn} pattern.
                   5138: * RTL Template::        The RTL template defines what insns match a pattern.
                   5139: * Output Template::     The output template says how to make assembler code
                   5140:                           from such an insn.
                   5141: * Output Statement::    For more generality, write C code to output 
                   5142:                           the assembler code.
                   5143: * Constraints::         When not all operands are general operands.
                   5144: * Standard Names::      Names mark patterns to use for code generation.
                   5145: * Pattern Ordering::    When the order of patterns makes a difference.
                   5146: * Dependent Patterns::  Having one pattern may make you need another.
                   5147: * Jump Patterns::       Special considerations for patterns for jump insns.
                   5148: * Peephole Definitions::Defining machine-specific peephole optimizations.
                   5149: * Expander Definitions::Generating a sequence of several RTL insns
                   5150:                          for a standard operation.
                   5151: @end menu
                   5152: 
                   5153: @node Patterns, Example, Machine Desc, Machine Desc
                   5154: @section Everything about Instruction Patterns
                   5155: 
                   5156: Each instruction pattern contains an incomplete RTL expression, with pieces
                   5157: to be filled in later, operand constraints that restrict how the pieces can
                   5158: be filled in, and an output pattern or C code to generate the assembler
                   5159: output, all wrapped up in a @samp{define_insn} expression.
                   5160: 
                   5161: A @samp{define_insn} is an RTL expression containing four or five operands:
                   5162: 
                   5163: @enumerate
                   5164: @item
                   5165: An optional name.  The presence of a name indicate that this instruction
                   5166: pattern can perform a certain standard job for the RTL-generation
                   5167: pass of the compiler.  This pass knows certain names and will use
                   5168: the instruction patterns with those names, if the names are defined
                   5169: in the machine description.
                   5170: 
                   5171: The absence of a name is indicated by writing an empty string
                   5172: where the name should go.  Nameless instruction patterns are never
                   5173: used for generating RTL code, but they may permit several simpler insns
                   5174: to be combined later on.
                   5175: 
                   5176: Names that are not thus known and used in RTL-generation have no
                   5177: effect; they are equivalent to no name at all.
                   5178: 
                   5179: @item
                   5180: The @dfn{RTL template} (@pxref{RTL Template}) is a vector of
                   5181: incomplete RTL expressions which show what the instruction should look
                   5182: like.  It is incomplete because it may contain @samp{match_operand}
                   5183: and @samp{match_dup} expressions that stand for operands of the
                   5184: instruction.
                   5185: 
                   5186: If the vector has only one element, that element is what the
                   5187: instruction should look like.  If the vector has multiple elements,
                   5188: then the instruction looks like a @samp{parallel} expression
                   5189: containing that many elements as described.
                   5190: 
                   5191: @item
                   5192: A condition.  This is a string which contains a C expression that is
                   5193: the final test to decide whether an insn body matches this pattern.
                   5194: 
                   5195: For a named pattern, the condition (if present) may not depend on
                   5196: the data in the insn being matched, but only the target-machine-type
                   5197: flags.  The compiler needs to test these conditions during
                   5198: initialization in order to learn exactly which named instructions are
                   5199: available in a particular run.
                   5200: 
                   5201: For nameless patterns, the condition is applied only when matching an
                   5202: individual insn, and only after the insn has matched the pattern's
                   5203: recognition template.  The insn's operands may be found in the vector
                   5204: @code{operands}.
                   5205: 
                   5206: @item
                   5207: The @dfn{output template}: a string that says how to output matching
                   5208: insns as assembler code.  @samp{%} in this string specifies where
                   5209: to substitute the value of an operand.  @xref{Output Template}.
                   5210: 
                   5211: When simple substitution isn't general enough, you can specify a piece
                   5212: of C code to compute the output.  @xref{Output Statement}.
                   5213: 
                   5214: @item
                   5215: Optionally, some @dfn{machine-specific information}.  The meaning
                   5216: of this information is defined only by an individual machine description;
                   5217: typically it might say whether this insn alters the condition codes,
                   5218: or how many bytes of output it generates.
                   5219: 
                   5220: This operand is written as a string containing a C initializer
                   5221: (complete with braces) for the structure type @code{INSN_MACHINE_INFO},
                   5222: whose definition is up to you (@pxref{Misc}).
                   5223: @end enumerate
                   5224: 
                   5225: @node Example, RTL Template, Patterns, Machine Desc
                   5226: @section Example of @samp{define_insn}
                   5227: 
                   5228: Here is an actual example of an instruction pattern, for the 68000/68020.
                   5229: 
                   5230: @example
                   5231: (define_insn "tstsi"
                   5232:   [(set (cc0)
                   5233:         (match_operand:SI 0 "general_operand" "rm"))]
                   5234:   ""
                   5235:   "*
                   5236: @{ if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
                   5237:     return \"tstl %0\";
                   5238:   return \"cmpl #0,%0\"; @}")
                   5239: @end example
                   5240: 
                   5241: This is an instruction that sets the condition codes based on the value of
                   5242: a general operand.  It has no condition, so any insn whose RTL description
                   5243: has the form shown may be handled according to this pattern.  The name
                   5244: @samp{tstsi} means ``test a @code{SImode} value'' and tells the RTL generation
                   5245: pass that, when it is necessary to test such a value, an insn to do so
                   5246: can be constructed using this pattern.
                   5247: 
                   5248: The output control string is a piece of C code which chooses which
                   5249: output template to return based on the kind of operand and the specific
                   5250: type of CPU for which code is being generated.
                   5251: 
                   5252: @samp{"rm"} is an operand constraint.  Its meaning is explained below.
                   5253: 
                   5254: @node RTL Template, Output Template, Example, Machine Desc
                   5255: @section RTL Template for Generating and Recognizing Insns
                   5256: 
                   5257: The RTL template is used to define which insns match the particular pattern
                   5258: and how to find their operands.  For named patterns, the RTL template also
                   5259: says how to construct an insn from specified operands.
                   5260: 
                   5261: Construction involves substituting specified operands into a copy of the
                   5262: template.  Matching involves determining the values that serve as the
                   5263: operands in the insn being matched.  Both of these activities are
                   5264: controlled by special expression types that direct matching and
                   5265: substitution of the operands.
                   5266: 
                   5267: @table @code
                   5268: @item (match_operand:@var{m} @var{n} @var{testfn} @var{constraint})
                   5269: This expression is a placeholder for operand number @var{n} of
                   5270: the insn.  When constructing an insn, operand number @var{n}
                   5271: will be substituted at this point.  When matching an insn, whatever
                   5272: appears at this position in the insn will be taken as operand
                   5273: number @var{n}; but it must satisfy @var{testfn} or this instruction
                   5274: pattern will not match at all.
                   5275: 
                   5276: Operand numbers must be chosen consecutively counting from zero in
                   5277: each instruction pattern.  There may be only one @samp{match_operand}
                   5278: expression in the pattern for each operand number.  Usually operands
                   5279: are numbered in the order of appearance in @samp{match_operand}
                   5280: expressions.
                   5281: 
                   5282: @var{testfn} is a string that is the name of a C function that accepts
                   5283: two arguments, a machine mode and an expression.  During matching,
                   5284: the function will be called with @var{m} as the mode argument
                   5285: and the putative operand as the other argument.  If it returns zero,
                   5286: this instruction pattern fails to match.  @var{testfn} may be
                   5287: an empty string; then it means no test is to be done on the operand.
                   5288: 
                   5289: @var{constraint} is explained later (@pxref{Constraints}).
                   5290: 
                   5291: Most often, @var{testfn} is @code{"general_operand"}.  It checks
                   5292: that the putative operand is either a constant, a register or a
                   5293: memory reference, and that it is valid for mode @var{m}.
                   5294: 
                   5295: For an operand that must be a register, @var{testfn} should be
                   5296: @code{"register_operand"}.  It would be valid to use
                   5297: @code{"general_operand"}, since the reload pass would copy any
                   5298: non-register operands through registers, but this would make GNU CC do
                   5299: extra work, and it would prevent the register allocator from doing the
                   5300: best possible job.
                   5301: 
                   5302: For an operand that must be a constant, either @var{testfn} should be
                   5303: @code{"immediate_operand"}, or the instruction pattern's extra
                   5304: condition should check for constants, or both.  You cannot expect the
                   5305: constraints to do this work!  If the constraints allow only constants,
                   5306: but the predicate allows something else, the compiler will crash when
                   5307: that case arises.
                   5308: 
                   5309: @item (match_dup @var{n})
                   5310: This expression is also a placeholder for operand number @var{n}.
                   5311: It is used when the operand needs to appear more than once in the
                   5312: insn.
                   5313: 
                   5314: In construction, @samp{match_dup} behaves exactly like
                   5315: @samp{match_operand}: the operand is substituted into the insn being
                   5316: constructed.  But in matching, @samp{match_dup} behaves differently.
                   5317: It assumes that operand number @var{n} has already been determined by
                   5318: a @samp{match_operand} appearing earlier in the recognition template,
                   5319: and it matches only an identical-looking expression.
                   5320: 
1.1.1.4   root     5321: @item (match_operator:@var{m} @var{n} "@var{predicate}" [@var{operands}@dots{}])
                   5322: This pattern is a kind of placeholder for a variable RTL expression
                   5323: code.
                   5324: 
                   5325: When constructing an insn, it stands for an RTL expression whose
                   5326: expression code is taken from that of operand @var{n}, and whose
                   5327: operands are constructed from the patterns @var{operands}.
                   5328: 
                   5329: When matching an expression, it matches an expression if the function
                   5330: @var{predicate} returns nonzero on that expression @emph{and} the
                   5331: patterns @var{operands} match the operands of the expression.
                   5332: 
                   5333: Suppose that the function @code{commutative_operator} is defined as
                   5334: follows, to match any expression whose operator is one of the six
                   5335: commutative arithmetic operators of RTL and whose mode is @var{mode}:
                   5336: 
                   5337: @example
                   5338: int
                   5339: commutative_operator (x, mode)
                   5340:      rtx x;
                   5341:      enum machine_mode mode;
                   5342: @{
                   5343:   enum rtx_code code = GET_CODE (x);
                   5344:   if (GET_MODE (x) != mode)
                   5345:     return 0;
                   5346:   return (code == PLUS || code == MULT || code == UMULT
                   5347:           || code == AND || code == IOR || code == XOR);
                   5348: @}
                   5349: @end example
                   5350: 
                   5351: Then the following pattern will match any RTL expression consisting
                   5352: of a commutative operator applied to two general operands:
                   5353: 
                   5354: @example
                   5355: (match_operator:SI 2 "commutative_operator"
                   5356:   [(match_operand:SI 3 "general_operand" "g")
                   5357:    (match_operand:SI 4 "general_operand" "g")])
                   5358: @end example
                   5359: 
                   5360: Here the vector @code{[@var{operands}@dots{}]} contains two patterns
                   5361: because the expressions to be matched all contain two operands.
                   5362: 
                   5363: When this pattern does match, the two operands of the commutative
                   5364: operator are recorded as operands 3 and 4 of the insn.  (This is done
1.1.1.5   root     5365: by the two instances of @samp{match_operand}.)  Operand 2 of the insn
1.1.1.4   root     5366: will be the entire commutative expression: use @code{GET_CODE
                   5367: (operands[2])} to see which commutative operator was used.
                   5368: 
                   5369: The machine mode @var{m} of @samp{match_operator} works like that of
                   5370: @samp{match_operand}: it is passed as the second argument to the
                   5371: predicate function, and that function is solely responsible for
                   5372: deciding whether the expression to be matched ``has'' that mode.
                   5373: 
                   5374: When constructing an insn, argument 2 of the gen-function will specify
                   5375: the operation (i.e. the expression code) for the expression to be
                   5376: made.  It should be an RTL expression, whose expression code is copied
                   5377: into a new expression whose operands are arguments 3 and 4 of the
                   5378: gen-function.  The subexpressions of argument 2 are not used;
                   5379: only its expression code matters.
                   5380: 
                   5381: There is no way to specify constraints in @samp{match_operator}.  The
                   5382: operand of the insn which corresponds to the @samp{match_operator}
                   5383: never has any constraints because it is never reloaded as a whole.
                   5384: However, if parts of its @var{operands} are matched by
                   5385: @samp{match_operand} patterns, those parts may have constraints of
                   5386: their own.
                   5387: 
1.1       root     5388: @item (address (match_operand:@var{m} @var{n} "address_operand" ""))
                   5389: This complex of expressions is a placeholder for an operand number
                   5390: @var{n} in a ``load address'' instruction: an operand which specifies
                   5391: a memory location in the usual way, but for which the actual operand
                   5392: value used is the address of the location, not the contents of the
                   5393: location.
                   5394: 
                   5395: @samp{address} expressions never appear in RTL code, only in machine
                   5396: descriptions.  And they are used only in machine descriptions that do
                   5397: not use the operand constraint feature.  When operand constraints are
                   5398: in use, the letter @samp{p} in the constraint serves this purpose.
                   5399: 
                   5400: @var{m} is the machine mode of the @emph{memory location being
                   5401: addressed}, not the machine mode of the address itself.  That mode is
                   5402: always the same on a given target machine (it is @code{Pmode}, which
                   5403: normally is @code{SImode}), so there is no point in mentioning it;
                   5404: thus, no machine mode is written in the @samp{address} expression.  If
                   5405: some day support is added for machines in which addresses of different
                   5406: kinds of objects appear differently or are used differently (such as
                   5407: the PDP-10), different formats would perhaps need different machine
                   5408: modes and these modes might be written in the @samp{address}
                   5409: expression.
                   5410: @end table
                   5411: 
                   5412: @node Output Template, Output Statement, RTL Template, Machine Desc
                   5413: @section Output Templates and Operand Substitution
                   5414: 
1.1.1.6 ! root     5415: The @dfn{output template} is a string which specifies how to output the
        !          5416: assembler code for an instruction pattern.  Most of the template is a
        !          5417: fixed string which is output literally.  The character @samp{%} is used
        !          5418: to specify where to substitute an operand; it can also be used to
        !          5419: identify places where different variants of the assembler require
1.1       root     5420: different syntax.
                   5421: 
                   5422: In the simplest case, a @samp{%} followed by a digit @var{n} says to output
                   5423: operand @var{n} at that point in the string.
                   5424: 
                   5425: @samp{%} followed by a letter and a digit says to output an operand in an
                   5426: alternate fashion.  Four letters have standard, built-in meanings described
                   5427: below.  The machine description macro @code{PRINT_OPERAND} can define
                   5428: additional letters with nonstandard meanings.
                   5429: 
                   5430: @samp{%c@var{digit}} can be used to substitute an operand that is a
                   5431: constant value without the syntax that normally indicates an immediate
                   5432: operand.
                   5433: 
                   5434: @samp{%n@var{digit}} is like @samp{%c@var{digit}} except that the value of
                   5435: the constant is negated before printing.
                   5436: 
                   5437: @samp{%a@var{digit}} can be used to substitute an operand as if it were a
                   5438: memory reference, with the actual operand treated as the address.  This may
                   5439: be useful when outputting a ``load address'' instruction, because often the
                   5440: assembler syntax for such an instruction requires you to write the operand
                   5441: as if it were a memory reference.
                   5442: 
                   5443: @samp{%l@var{digit}} is used to substitute a @code{label_ref} into a jump
                   5444: instruction.
                   5445: 
                   5446: @samp{%} followed by a punctuation character specifies a substitution that
                   5447: does not use an operand.  Only one case is standard: @samp{%%} outputs a
                   5448: @samp{%} into the assembler code.  Other nonstandard cases can be
                   5449: defined in the @code{PRINT_OPERAND} macro.
                   5450: 
                   5451: The template may generate multiple assembler instructions.  Write the text
                   5452: for the instructions, with @samp{\;} between them.
                   5453: 
1.1.1.6 ! root     5454: When the RTL contains two operands which are required by constraint to match
1.1       root     5455: each other, the output template must refer only to the lower-numbered operand.
                   5456: Matching operands are not always identical, and the rest of the compiler
                   5457: arranges to put the proper RTL expression for printing into the lower-numbered
                   5458: operand.
                   5459: 
                   5460: One use of nonstandard letters or punctuation following @samp{%} is to
                   5461: distinguish between different assembler languages for the same machine; for
                   5462: example, Motorola syntax versus MIT syntax for the 68000.  Motorola syntax
                   5463: requires periods in most opcode names, while MIT syntax does not.  For
                   5464: example, the opcode @samp{movel} in MIT syntax is @samp{move.l} in Motorola
                   5465: syntax.  The same file of patterns is used for both kinds of output syntax,
                   5466: but the character sequence @samp{%.} is used in each place where Motorola
                   5467: syntax wants a period.  The @code{PRINT_OPERAND} macro for Motorola syntax
                   5468: defines the sequence to output a period; the macro for MIT syntax defines
                   5469: it to do nothing.
                   5470: 
                   5471: @node Output Statement, Constraints, Output Template, Machine Desc
                   5472: @section C Statements for Generating Assembler Output
                   5473: 
                   5474: Often a single fixed template string cannot produce correct and efficient
                   5475: assembler code for all the cases that are recognized by a single
                   5476: instruction pattern.  For example, the opcodes may depend on the kinds of
                   5477: operands; or some unfortunate combinations of operands may require extra
                   5478: machine instructions.
                   5479: 
                   5480: If the output control string starts with a @samp{*}, then it is not an
                   5481: output template but rather a piece of C program that should compute a
                   5482: template.  It should execute a @code{return} statement to return the
                   5483: template-string you want.  Most such templates use C string literals, which
                   5484: require doublequote characters to delimit them.  To include these
                   5485: doublequote characters in the string, prefix each one with @samp{\}.
                   5486: 
                   5487: The operands may be found in the array @code{operands}, whose C data type
                   5488: is @code{rtx []}.
                   5489: 
                   5490: It is possible to output an assembler instruction and then go on to output
                   5491: or compute more of them, using the subroutine @code{output_asm_insn}.  This
                   5492: receives two arguments: a template-string and a vector of operands.  The
                   5493: vector may be @code{operands}, or it may be another array of @code{rtx}
                   5494: that you declare locally and initialize yourself.
                   5495: 
                   5496: When an insn pattern has multiple alternatives in its constraints, often
1.1.1.5   root     5497: the appearance of the assembler code is determined mostly by which alternative
1.1       root     5498: was matched.  When this is so, the C code can test the variable
                   5499: @code{which_alternative}, which is the ordinal number of the alternative
                   5500: that was actually satisfied (0 for the first, 1 for the second alternative,
                   5501: etc.).
                   5502: 
                   5503: For example, suppose there are two opcodes for storing zero, @samp{clrreg}
                   5504: for registers and @samp{clrmem} for memory locations.  Here is how
                   5505: a pattern could use @code{which_alternative} to choose between them:
                   5506: 
                   5507: @example
                   5508: (define_insn ""
                   5509:   [(set (match_operand:SI 0 "general_operand" "r,m")
                   5510:         (const_int 0))]
                   5511:   ""
                   5512:   "*
                   5513:   return (which_alternative == 0
                   5514:           ? \"clrreg %0\" : \"clrmem %0\");
                   5515:   ")
                   5516: @end example
                   5517: 
                   5518: @node Constraints, Standard Names, Output Statement, Machine Desc
                   5519: @section Operand Constraints
                   5520: 
                   5521: Each @samp{match_operand} in an instruction pattern can specify a
                   5522: constraint for the type of operands allowed.  Constraints can say whether
                   5523: an operand may be in a register, and which kinds of register; whether the
                   5524: operand can be a memory reference, and which kinds of address; whether the
                   5525: operand may be an immediate constant, and which possible values it may
                   5526: have.  Constraints can also require two operands to match.
                   5527: 
                   5528: @menu
                   5529: * Simple Constraints::  Basic use of constraints.
                   5530: * Multi-Alternative::   When an insn has two alternative constraint-patterns.
                   5531: * Class Preferences::   Constraints guide which hard register to put things in.
                   5532: * Modifiers::           More precise control over effects of constraints.
                   5533: * No Constraints::      Describing a clean machine without constraints.
                   5534: @end menu
                   5535: 
                   5536: @node Simple Constraints, Multi-Alternative, Constraints, Constraints
                   5537: @subsection Simple Constraints
                   5538: 
                   5539: The simplest kind of constraint is a string full of letters, each of
                   5540: which describes one kind of operand that is permitted.  Here are
                   5541: the letters that are allowed:
                   5542: 
                   5543: @table @asis
                   5544: @item @samp{m}
                   5545: A memory operand is allowed, with any kind of address that the machine
                   5546: supports in general.
                   5547: 
                   5548: @item @samp{o}
                   5549: A memory operand is allowed, but only if the address is
                   5550: @dfn{offsetable}.  This means that adding a small integer (actually,
                   5551: the width in bytes of the operand, as determined by its machine mode)
                   5552: may be added to the address and the result is also a valid memory
                   5553: address.
                   5554: 
                   5555: For example, an address which is constant is offsetable; so is an
                   5556: address that is the sum of a register and a constant (as long as a
                   5557: slightly larger constant is also within the range of address-offsets
                   5558: supported by the machine); but an autoincrement or autodecrement
                   5559: address is not offsetable.  More complicated indirect/indexed
                   5560: addresses may or may not be offsetable depending on the other
                   5561: addressing modes that the machine supports.
                   5562: 
                   5563: Note that in an output operand which can be matched by another
                   5564: operand, the constraint letter @samp{o} is valid only when accompanied
                   5565: by both @samp{<} (if the target machine has predecrement addressing)
                   5566: and @samp{>} (if the target machine has preincrement addressing).
                   5567: 
                   5568: When the constraint letter @samp{o} is used, the reload pass may
                   5569: generate instructions which copy a nonoffsetable address into an index
                   5570: register.  The idea is that the register can be used as a replacement
                   5571: offsetable address.  But this method requires that there be patterns
                   5572: to copy any kind of address into a register.  Auto-increment
                   5573: and auto-decrement addresses are an exception; there need not be an
                   5574: instruction that can copy such an address into a register, because
                   5575: reload handles these cases specially.
                   5576: 
                   5577: Most older machine designs have ``load address'' instructions which do
                   5578: just what is needed here.  Some RISC machines do not advertise such
                   5579: instructions, but the possible addresses on these machines are very
                   5580: limited, so it is easy to fake them.
                   5581: 
                   5582: @item @samp{<}
                   5583: A memory operand with autodecrement addressing (either predecrement or
                   5584: postdecrement) is allowed.
                   5585: 
                   5586: @item @samp{>}
                   5587: A memory operand with autoincrement addressing (either preincrement or
                   5588: postincrement) is allowed.
                   5589: 
                   5590: @item @samp{r}
                   5591: A register operand is allowed provided that it is in a general
                   5592: register.
                   5593: 
                   5594: @item @samp{d}, @samp{a}, @samp{f}, @dots{}
                   5595: Other letters can be defined in machine-dependent fashion to stand for
                   5596: particular classes of registers.  @samp{d}, @samp{a} and @samp{f} are
                   5597: defined on the 68000/68020 to stand for data, address and floating
                   5598: point registers.
                   5599: 
                   5600: @item @samp{i}
                   5601: An immediate integer operand (one with constant value) is allowed.
                   5602: This includes symbolic constants whose values will be known only at
                   5603: assembly time.
                   5604: 
                   5605: @item @samp{n}
                   5606: An immediate integer operand with a known numeric value is allowed.
                   5607: Many systems cannot support assembly-time constants for operands less
                   5608: than a word wide.  Constraints for these operands should use @samp{n}
                   5609: rather than @samp{i}.
                   5610: 
                   5611: @item @samp{I}, @samp{J}, @samp{K}, @dots{}
                   5612: Other letters in the range @samp{I} through @samp{M} may be defined in
                   5613: a machine-dependent fashion to permit immediate integer operands with
                   5614: explicit integer values in specified ranges.  For example, on the
                   5615: 68000, @samp{I} is defined to stand for the range of values 1 to 8.
                   5616: This is the range permitted as a shift count in the shift
                   5617: instructions.
                   5618: 
                   5619: @item @samp{F}
                   5620: An immediate floating operand (expression code @samp{const_double}) is
                   5621: allowed.
                   5622: 
                   5623: @item @samp{G}, @samp{H}
                   5624: @samp{G} and @samp{H} may be defined in a machine-dependent fashion to
                   5625: permit immediate floating operands in particular ranges of values.
                   5626: 
                   5627: @item @samp{s}
                   5628: An immediate integer operand whose value is not an explicit integer is
                   5629: allowed.
                   5630: 
                   5631: This might appear strange; if an insn allows a constant operand with a
                   5632: value not known at compile time, it certainly must allow any known
                   5633: value.  So why use @samp{s} instead of @samp{i}?  Sometimes it allows
                   5634: better code to be generated.
                   5635: 
                   5636: For example, on the 68000 in a fullword instruction it is possible to
                   5637: use an immediate operand; but if the immediate value is between -32
                   5638: and 31, better code results from loading the value into a register and
                   5639: using the register.  This is because the load into the register can be
                   5640: done with a @samp{moveq} instruction.  We arrange for this to happen
                   5641: by defining the letter @samp{K} to mean ``any integer outside the
                   5642: range -32 to 31'', and then specifying @samp{Ks} in the operand
                   5643: constraints.
                   5644: 
                   5645: @item @samp{g}
                   5646: Any register, memory or immediate integer operand is allowed, except for
                   5647: registers that are not general registers.
                   5648: 
                   5649: @item @samp{@var{n}} (a digit)
                   5650: An operand that matches operand number @var{n} is allowed.
                   5651: If a digit is used together with letters, the digit should come last.
                   5652: 
                   5653: This is called a @dfn{matching constraint} and what it really means is
                   5654: that the assembler has only a single operand that fills two roles
                   5655: considered separate in the RTL insn.  For example, an add insn has two
                   5656: input operands and one output operand in the RTL, but on most machines
                   5657: an add instruction really has only two operands, one of them an
                   5658: input-output operand.
                   5659: 
                   5660: Matching constraints work only in circumstances like that add insn.
                   5661: More precisely, the matching constraint must appear in an input-only
                   5662: operand and the operand that it matches must be an output-only operand
1.1.1.5   root     5663: with a lower number.  Thus, operand @var{n} must have @samp{=} in its
                   5664: constraint.
1.1       root     5665: 
                   5666: For operands to match in a particular case usually means that they
                   5667: are identical-looking RTL expressions.  But in a few special cases
                   5668: specific kinds of dissimilarity are allowed.  For example, @code{*x}
                   5669: as an input operand will match @code{*x++} as an output operand.
                   5670: For proper results in such cases, the output template should always
                   5671: use the output-operand's number when printing the operand.
                   5672: 
                   5673: @item @samp{p}
                   5674: An operand that is a valid memory address is allowed.  This is
                   5675: for ``load address'' and ``push address'' instructions.
                   5676: 
                   5677: If @samp{p} is used in the constraint, the test-function in the
                   5678: @samp{match_operand} must be @code{address_operand}.
                   5679: @end table
                   5680: 
                   5681: In order to have valid assembler code, each operand must satisfy
                   5682: its constraint.  But a failure to do so does not prevent the pattern
                   5683: from applying to an insn.  Instead, it directs the compiler to modify
                   5684: the code so that the constraint will be satisfied.  Usually this is
                   5685: done by copying an operand into a register.
                   5686: 
                   5687: Contrast, therefore, the two instruction patterns that follow:
                   5688: 
                   5689: @example
                   5690: (define_insn ""
                   5691:   [(set (match_operand:SI 0 "general_operand" "r")
                   5692:         (plus:SI (match_dup 0)
                   5693:                  (match_operand:SI 1 "general_operand" "r")))]
                   5694:   ""
                   5695:   "@dots{}")
                   5696: @end example
                   5697: 
                   5698: @noindent
                   5699: which has two operands, one of which must appear in two places, and
                   5700: 
                   5701: @example
                   5702: (define_insn ""
                   5703:   [(set (match_operand:SI 0 "general_operand" "r")
                   5704:         (plus:SI (match_operand:SI 1 "general_operand" "0")
                   5705:                  (match_operand:SI 2 "general_operand" "r")))]
                   5706:   ""
                   5707:   "@dots{}")
                   5708: @end example
                   5709: 
                   5710: @noindent
                   5711: which has three operands, two of which are required by a constraint to be
                   5712: identical.  If we are considering an insn of the form
                   5713: 
                   5714: @example
                   5715: (insn @var{n} @var{prev} @var{next}
                   5716:   (set (reg:SI 3)
                   5717:        (plus:SI (reg:SI 6) (reg:SI 109)))
                   5718:   @dots{})
                   5719: @end example
                   5720: 
                   5721: @noindent
                   5722: the first pattern would not apply at all, because this insn does not
                   5723: contain two identical subexpressions in the right place.  The pattern would
                   5724: say, ``That does not look like an add instruction; try other patterns.''
                   5725: The second pattern would say, ``Yes, that's an add instruction, but there
                   5726: is something wrong with it.''  It would direct the reload pass of the
                   5727: compiler to generate additional insns to make the constraint true.  The
                   5728: results might look like this:
                   5729: 
                   5730: @example
                   5731: (insn @var{n2} @var{prev} @var{n}
                   5732:   (set (reg:SI 3) (reg:SI 6))
                   5733:   @dots{})
                   5734: 
                   5735: (insn @var{n} @var{n2} @var{next}
                   5736:   (set (reg:SI 3)
                   5737:        (plus:SI (reg:SI 3) (reg:SI 109)))
                   5738:   @dots{})
                   5739: @end example
                   5740: 
                   5741: It is up to you to make sure that each operand, in each pattern, has
                   5742: constraints that can handle any RTL expression that could be present for
                   5743: that operand.  (When multiple alternatives are in use, each pattern must,
                   5744: for each possible combination of operand expressions, have at least one
                   5745: alternative which can handle that combination of operands.)  The
                   5746: constraints don't need to @emph{allow} any possible operand---when this is
                   5747: the case, they do not constrain---but they must at least point the way to
                   5748: reloading any possible operand so that it will fit.
                   5749: 
                   5750: @itemize @bullet
                   5751: @item
                   5752: If the constraint accepts whatever operands the predicate permits,
                   5753: there is no problem: reloading is never necessary for this operand.
                   5754: 
                   5755: For example, an operand whose constraints permit everything except
                   5756: registers is safe provided its predicate rejects registers.
                   5757: 
                   5758: An operand whose predicate accepts only constant values is safe
                   5759: provided its constraints include the letter @samp{i}.  If any possible
                   5760: constant value is accepted, then nothing less than @samp{i} will do;
1.1.1.5   root     5761: if the predicate is more selective, then the constraints may also be
1.1       root     5762: more selective.
                   5763: 
                   5764: @item
                   5765: Any operand expression can be reloaded by copying it into a register.
                   5766: So if an operand's constraints allow some kind of register, it is
                   5767: certain to be safe.  It need not permit all classes of registers; the
                   5768: compiler knows how to copy a register into another register of the
                   5769: proper class in order to make an instruction valid.
                   5770: 
                   5771: @item
                   5772: A nonoffsetable memory reference can be reloaded by copying the
                   5773: address into a register.  So if the constraint uses the letter
                   5774: @samp{o}, all memory references are taken care of.
                   5775: 
                   5776: @item
                   5777: A constant operand can be reloaded by storing it in memory; it then
                   5778: becomes an offsetable memory reference.  So if the constraint uses the
                   5779: letters @samp{o} or @samp{m}, constant operands are not a problem.
                   5780: @end itemize
                   5781: 
                   5782: If the operand's predicate can recognize registers, but the constraint does
                   5783: not permit them, it can make the compiler crash.  When this operand happens
                   5784: to be a register, the reload pass will be stymied, because it does not know
                   5785: how to copy a register temporarily into memory.
                   5786: 
                   5787: @node Multi-Alternative, Class Preferences, Simple Constraints, Constraints
                   5788: @subsection Multiple Alternative Constraints
                   5789: 
                   5790: Sometimes a single instruction has multiple alternative sets of possible
                   5791: operands.  For example, on the 68000, a logical-or instruction can combine
                   5792: register or an immediate value into memory, or it can combine any kind of
                   5793: operand into a register; but it cannot combine one memory location into
                   5794: another.
                   5795: 
                   5796: These constraints are represented as multiple alternatives.  An alternative
                   5797: can be described by a series of letters for each operand.  The overall
                   5798: constraint for an operand is made from the letters for this operand
                   5799: from the first alternative, a comma, the letters for this operand from
                   5800: the second alternative, a comma, and so on until the last alternative.
                   5801: Here is how it is done for fullword logical-or on the 68000:
                   5802: 
                   5803: @example
                   5804: (define_insn "iorsi3"
                   5805:   [(set (match_operand:SI 0 "general_operand" "=%m,d")
                   5806:         (ior:SI (match_operand:SI 1 "general_operand" "0,0")
                   5807:                 (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
                   5808:   @dots{})
                   5809: @end example
                   5810: 
                   5811: The first alternative has @samp{m} (memory) for operand 0, @samp{0} for
                   5812: operand 1 (meaning it must match operand 0), and @samp{dKs} for operand 2.
                   5813: The second alternative has @samp{d} (data register) for operand 0, @samp{0}
                   5814: for operand 1, and @samp{dmKs} for operand 2.  The @samp{=} and @samp{%} in
                   5815: the constraint for operand 0 are not part of any alternative; their meaning
                   5816: is explained in the next section.
                   5817: 
                   5818: If all the operands fit any one alternative, the instruction is valid.
                   5819: Otherwise, for each alternative, the compiler counts how many instructions
                   5820: must be added to copy the operands so that that alternative applies.
                   5821: The alternative requiring the least copying is chosen.  If two alternatives
                   5822: need the same amount of copying, the one that comes first is chosen.
                   5823: These choices can be altered with the @samp{?} and @samp{!} characters:
                   5824: 
                   5825: @table @samp
                   5826: @item ?
                   5827: Disparage slightly the alternative that the @samp{?} appears in,
                   5828: as a choice when no alternative applies exactly.  The compiler regards
                   5829: this alternative as one unit more costly for each @samp{?} that appears
                   5830: in it.
                   5831: 
                   5832: @item !
                   5833: Disparage severely the alternative that the @samp{!} appears in.
                   5834: When operands must be copied into registers, the compiler will
                   5835: never choose this alternative as the one to strive for.
                   5836: @end table
                   5837: 
1.1.1.5   root     5838: When an insn pattern has multiple alternatives in its constraints, often
                   5839: the appearance of the assembler code is determined mostly by which
1.1       root     5840: alternative was matched.  When this is so, the C code for writing the
                   5841: assembler code can use the variable @code{which_alternative}, which is
1.1.1.5   root     5842: the ordinal number of the alternative that was actually satisfied (0 for
                   5843: the first, 1 for the second alternative, etc.).  For example:
1.1       root     5844: 
                   5845: @example
                   5846: (define_insn ""
                   5847:   [(set (match_operand:SI 0 "general_operand" "r,m")
                   5848:         (const_int 0))]
                   5849:   ""
                   5850:   "*
                   5851:   return (which_alternative == 0
                   5852:           ? \"clrreg %0\" : \"clrmem %0\");
                   5853:   ")
                   5854: @end example
                   5855: 
                   5856: @node Class Preferences, Modifiers, Multi-Alternative, Constraints
                   5857: @subsection Register Class Preferences
                   5858: 
                   5859: The operand constraints have another function: they enable the compiler
                   5860: to decide which kind of hardware register a pseudo register is best
                   5861: allocated to.  The compiler examines the constraints that apply to the
                   5862: insns that use the pseudo register, looking for the machine-dependent
                   5863: letters such as @samp{d} and @samp{a} that specify classes of registers.
                   5864: The pseudo register is put in whichever class gets the most ``votes''.
                   5865: The constraint letters @samp{g} and @samp{r} also vote: they vote in
                   5866: favor of a general register.  The machine description says which registers
                   5867: are considered general.
                   5868: 
                   5869: Of course, on some machines all registers are equivalent, and no register
                   5870: classes are defined.  Then none of this complexity is relevant.
                   5871: 
                   5872: @node Modifiers, No Constraints, Class Preferences, Constraints
                   5873: @subsection Constraint Modifier Characters
                   5874: 
                   5875: @table @samp
                   5876: @item =
                   5877: Means that this operand is write-only for this instruction: the previous
                   5878: value is discarded and replaced by output data.
                   5879: 
                   5880: @item +
                   5881: Means that this operand is both read and written by the instruction.
                   5882: 
                   5883: When the compiler fixes up the operands to satisfy the constraints,
                   5884: it needs to know which operands are inputs to the instruction and
                   5885: which are outputs from it.  @samp{=} identifies an output; @samp{+}
                   5886: identifies an operand that is both input and output; all other operands
                   5887: are assumed to be input only.
                   5888: 
                   5889: @item &
                   5890: Means (in a particular alternative) that this operand is written
                   5891: before the instruction is finished using the input operands.
                   5892: Therefore, this operand may not lie in a register that is used as an
                   5893: input operand or as part of any memory address.
                   5894: 
                   5895: @samp{&} applies only to the alternative in which it is written.  In
                   5896: constraints with multiple alternatives, sometimes one alternative
                   5897: requires @samp{&} while others do not.  See, for example, the
                   5898: @samp{movdf} insn of the 68000.
                   5899: 
                   5900: @samp{&} does not obviate the need to write @samp{=}.
                   5901: 
                   5902: @item %
                   5903: Declares the instruction to be commutative for this operand and the
                   5904: following operand.  This means that the compiler may interchange the
                   5905: two operands if that is the cheapest way to make all operands fit the
                   5906: constraints.  This is often used in patterns for addition instructions
                   5907: that really have only two operands: the result must go in one of the
                   5908: arguments.  Here for example, is how the 68000 halfword-add
                   5909: instruction is defined:
                   5910: 
                   5911: @example
                   5912: (define_insn "addhi3"
                   5913:   [(set (match_operand:HI 0 "general_operand" "=m,r")
                   5914:      (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
                   5915:               (match_operand:HI 2 "general_operand" "di,g")))]
                   5916:   @dots{})
                   5917: @end example
                   5918: 
                   5919: Note that in previous versions of GNU CC the @samp{%} constraint
                   5920: modifier always applied to operands 1 and 2 regardless of which
                   5921: operand it was written in.  The usual custom was to write it in
                   5922: operand 0.  Now it must be in operand 1 if the operands to be
                   5923: exchanged are 1 and 2.
                   5924: 
                   5925: @item #
                   5926: Says that all following characters, up to the next comma, are to be
                   5927: ignored as a constraint.  They are significant only for choosing
                   5928: register preferences.
                   5929: 
                   5930: @item *
                   5931: Says that the following character should be ignored when choosing
                   5932: register preferences.  @samp{*} has no effect on the meaning of the
                   5933: constraint as a constraint.
                   5934: 
                   5935: Here is an example: the 68000 has an instruction to sign-extend a
                   5936: halfword in a data register, and can also sign-extend a value by
                   5937: copying it into an address register.  While either kind of register is
                   5938: acceptable, the constraints on an address-register destination are
                   5939: less strict, so it is best if register allocation makes an address
                   5940: register its goal.  Therefore, @samp{*} is used so that the @samp{d}
                   5941: constraint letter (for data register) is ignored when computing
                   5942: register preferences.
                   5943: 
                   5944: @example
                   5945: (define_insn "extendhisi2"
                   5946:   [(set (match_operand:SI 0 "general_operand" "=*d,a")
                   5947:         (sign_extend:SI
                   5948:          (match_operand:HI 1 "general_operand" "0,g")))]
                   5949:   @dots{})
                   5950: @end example
                   5951: @end table
                   5952: 
                   5953: @node No Constraints,, Modifiers, Constraints
                   5954: @subsection Not Using Constraints
                   5955: 
                   5956: Some machines are so clean that operand constraints are not required.  For
                   5957: example, on the Vax, an operand valid in one context is valid in any other
                   5958: context.  On such a machine, every operand constraint would be @samp{g},
                   5959: excepting only operands of ``load address'' instructions which are
                   5960: written as if they referred to a memory location's contents but actual
                   5961: refer to its address.  They would have constraint @samp{p}.
                   5962: 
                   5963: For such machines, instead of writing @samp{g} and @samp{p} for all
                   5964: the constraints, you can choose to write a description with empty constraints.
                   5965: Then you write @samp{""} for the constraint in every @samp{match_operand}.
                   5966: Address operands are identified by writing an @samp{address} expression
                   5967: around the @samp{match_operand}, not by their constraints.
                   5968: 
                   5969: When the machine description has just empty constraints, certain parts
1.1.1.6 ! root     5970: of compilation are skipped, making the compiler faster.  However,
        !          5971: few machines actually do not need constraints; all machine descriptions
        !          5972: now in existence use constraints.
1.1       root     5973: 
                   5974: @node Standard Names, Pattern Ordering, Constraints, Machine Desc
                   5975: @section Standard Names for Patterns Used in Generation
                   5976: 
                   5977: Here is a table of the instruction names that are meaningful in the RTL
                   5978: generation pass of the compiler.  Giving one of these names to an
                   5979: instruction pattern tells the RTL generation pass that it can use the
                   5980: pattern in to accomplish a certain task.
                   5981: 
                   5982: @table @asis
                   5983: @item @samp{mov@var{m}}
                   5984: Here @var{m} is a two-letter machine mode name, in lower case.  This
                   5985: instruction pattern moves data with that machine mode from operand 1 to
                   5986: operand 0.  For example, @samp{movsi} moves full-word data.
                   5987: 
                   5988: If operand 0 is a @samp{subreg} with mode @var{m} of a register whose
                   5989: natural mode is wider than @var{m}, the effect of this instruction is
                   5990: to store the specified value in the part of the register that corresponds
                   5991: to mode @var{m}.  The effect on the rest of the register is undefined.
                   5992: 
                   5993: This class of patterns is special in several ways.  First of all, each
                   5994: of these names @emph{must} be defined, because there is no other way
                   5995: to copy a datum from one place to another.
                   5996: 
                   5997: Second, these patterns are not used solely in the RTL generation pass.
                   5998: Even the reload pass can generate move insns to copy values from stack
                   5999: slots into temporary registers.  When it does so, one of the operands
                   6000: is a hard register and the other is an operand that can have a reload.
                   6001: 
                   6002: Therefore, when given such a pair of operands, the pattern must
                   6003: generate RTL which needs no temporary registers---no registers other
                   6004: than the operands.  For example, if you support the pattern with a
                   6005: @code{define_expand}, then in such a case you mustn't call
                   6006: @code{force_reg} or any other such function which might generate new
                   6007: pseudo registers.
                   6008: 
                   6009: This requirement exists even for subword modes on a RISC machine where
                   6010: fetching those modes from memory normally requires several insns and
                   6011: some temporary registers.  Look in @file{spur.md} to see how the
                   6012: requirement is satisfied.
                   6013: 
                   6014: The variety of operands that have reloads depends on the rest of the
                   6015: machine description, but typically on a RISC machine these can only be
                   6016: pseudo registers that did not get hard registers, while on other
                   6017: machines explicit memory references will get optional reloads.
                   6018: 
                   6019: In addition, the constraints must allow any hard register to be moved
                   6020: to any other hard register (provided that @code{HARD_REGNO_MODE_OK}
                   6021: permits mode @var{m} in each of the registers).
                   6022: 
                   6023: @item @samp{movstrict@var{m}}
                   6024: Like @samp{mov@var{m}} except that if operand 0 is a @samp{subreg}
                   6025: with mode @var{m} of a register whose natural mode is wider,
                   6026: the @samp{movstrict@var{m}} instruction is guaranteed not to alter
                   6027: any of the register except the part which belongs to mode @var{m}.
                   6028: 
                   6029: @item @samp{add@var{m}3}
                   6030: Add operand 2 and operand 1, storing the result in operand 0.  All operands
                   6031: must have mode @var{m}.  This can be used even on two-address machines, by
                   6032: means of constraints requiring operands 1 and 0 to be the same location.
                   6033: 
                   6034: @item @samp{sub@var{m}3}, @samp{mul@var{m}3}, @samp{umul@var{m}3}, @samp{div@var{m}3}, @samp{udiv@var{m}3}, @samp{mod@var{m}3}, @samp{umod@var{m}3}, @samp{and@var{m}3}, @samp{ior@var{m}3}, @samp{xor@var{m}3}
                   6035: Similar, for other arithmetic operations.
                   6036: 
                   6037: There are special considerations for register classes for logical-and
                   6038: instructions, affecting also the macro @code{PREFERRED_RELOAD_CLASS}.
                   6039: They apply not only to the patterns with these standard names, but to
                   6040: any patterns that will match such an instruction.  @xref{Register
                   6041: Classes}.
                   6042: 
                   6043: @item @samp{mulhisi3}
                   6044: Multiply operands 1 and 2, which have mode @code{HImode}, and store
                   6045: a @code{SImode} product in operand 0.
                   6046: 
                   6047: @item @samp{mulqihi3}, @samp{mulsidi3}
                   6048: Similar widening-multiplication instructions of other widths.
                   6049: 
                   6050: @item @samp{umulqihi3}, @samp{umulhisi3}, @samp{umulsidi3}
                   6051: Similar widening-multiplication instructions that do unsigned
                   6052: multiplication.
                   6053: 
                   6054: @item @samp{divmod@var{m}4}
                   6055: Signed division that produces both a quotient and a remainder.
                   6056: Operand 1 is divided by operand 2 to produce a quotient stored
                   6057: in operand 0 and a remainder stored in operand 3.
                   6058: 
                   6059: @item @samp{udivmod@var{m}4}
                   6060: Similar, but does unsigned division.
                   6061: 
                   6062: @item @samp{divmod@var{m}@var{n}4}
                   6063: Like @samp{divmod@var{m}4} except that only the dividend has mode
                   6064: @var{m}; the divisor, quotient and remainder have mode @var{n}.
                   6065: For example, the Vax has a @samp{divmoddisi4} instruction
                   6066: (but it is omitted from the machine description, because it
                   6067: is so slow that it is faster to compute remainders by the
                   6068: circumlocution that the compiler will use if this instruction is
                   6069: not available).
                   6070: 
                   6071: @item @samp{ashl@var{m}3}
                   6072: Arithmetic-shift operand 1 left by a number of bits specified by
                   6073: operand 2, and store the result in operand 0.  Operand 2 has
                   6074: mode @code{SImode}, not mode @var{m}.
                   6075: 
                   6076: @item @samp{ashr@var{m}3}, @samp{lshl@var{m}3}, @samp{lshr@var{m}3}, @samp{rotl@var{m}3}, @samp{rotr@var{m}3}
                   6077: Other shift and rotate instructions.
                   6078: 
                   6079: Logical and arithmetic left shift are the same.  Machines that do not
                   6080: allow negative shift counts often have only one instruction for
                   6081: shifting left.  On such machines, you should define a pattern named
                   6082: @samp{ashl@var{m}3} and leave @samp{lshl@var{m}3} undefined.
                   6083: 
                   6084: There are special considerations for register classes for shift
                   6085: instructions, affecting also the macro @code{PREFERRED_RELOAD_CLASS}.
                   6086: They apply not only to the patterns with these standard names, but to
                   6087: any patterns that will match such an instruction.  @xref{Register
                   6088: Classes}.
                   6089: 
                   6090: @item @samp{neg@var{m}2}
                   6091: Negate operand 1 and store the result in operand 0.
                   6092: 
                   6093: @item @samp{abs@var{m}2}
                   6094: Store the absolute value of operand 1 into operand 0.
                   6095: 
                   6096: @item @samp{sqrt@var{m}2}
                   6097: Store the square root of operand 1 into operand 0.
                   6098: 
                   6099: @item @samp{ffs@var{m}2}
                   6100: Store into operand 0 one plus the index of the least significant 1-bit
                   6101: of operand 1.  If operand 1 is zero, store zero.  @var{m} is the mode
                   6102: of operand 0; operand 1's mode is specified by the instruction
                   6103: pattern, and the compiler will convert the operand to that mode before
                   6104: generating the instruction.
                   6105: 
                   6106: @item @samp{one_cmpl@var{m}2}
                   6107: Store the bitwise-complement of operand 1 into operand 0.
                   6108: 
                   6109: @item @samp{cmp@var{m}}
                   6110: Compare operand 0 and operand 1, and set the condition codes.
                   6111: The RTL pattern should look like this:
                   6112: 
                   6113: @example
1.1.1.6 ! root     6114: (set (cc0) (compare (match_operand:@var{m} 0 @dots{})
        !          6115:                     (match_operand:@var{m} 1 @dots{})))
1.1       root     6116: @end example
                   6117: 
                   6118: Each such definition in the machine description, for integer mode
                   6119: @var{m}, must have a corresponding @samp{tst@var{m}} pattern, because
                   6120: optimization can simplify the compare into a test when operand 1 is
                   6121: zero.
                   6122: 
                   6123: @item @samp{tst@var{m}}
                   6124: Compare operand 0 against zero, and set the condition codes.
                   6125: The RTL pattern should look like this:
                   6126: 
                   6127: @example
                   6128: (set (cc0) (match_operand:@var{m} 0 @dots{}))
                   6129: @end example
                   6130: 
                   6131: @item @samp{movstr@var{m}}
                   6132: Block move instruction.  The addresses of the destination and source
                   6133: strings are the first two operands, and both are in mode @code{Pmode}.
                   6134: The number of bytes to move is the third operand, in mode @var{m}.
1.1.1.5   root     6135: The fourth operand is the known shared alignment of the source and
                   6136: destination, in the form of a @code{const_int} rtx.
1.1       root     6137: 
                   6138: @item @samp{cmpstr@var{m}}
                   6139: Block compare instruction, with operands like @samp{movstr@var{m}}
                   6140: except that the two memory blocks are compared byte by byte
                   6141: in lexicographic order.  The effect of the instruction is to set
                   6142: the condition codes.
                   6143: 
                   6144: @item @samp{float@var{m}@var{n}2}
                   6145: Convert operand 1 (valid for fixed point mode @var{m}) to floating
                   6146: point mode @var{n} and store in operand 0 (which has mode @var{n}).
                   6147: 
                   6148: @item @samp{fix@var{m}@var{n}2}
                   6149: Convert operand 1 (valid for floating point mode @var{m}) to fixed
                   6150: point mode @var{n} as a signed number and store in operand 0 (which
                   6151: has mode @var{n}).  This instruction's result is defined only when
                   6152: the value of operand 1 is an integer.
                   6153: 
                   6154: @item @samp{fixuns@var{m}@var{n}2}
                   6155: Convert operand 1 (valid for floating point mode @var{m}) to fixed
                   6156: point mode @var{n} as an unsigned number and store in operand 0 (which
                   6157: has mode @var{n}).  This instruction's result is defined only when the
                   6158: value of operand 1 is an integer.
                   6159: 
                   6160: @item @samp{ftrunc@var{m}2}
                   6161: Convert operand 1 (valid for floating point mode @var{m}) to an
                   6162: integer value, still represented in floating point mode @var{m}, and
                   6163: store it in operand 0 (valid for floating point mode @var{m}).
                   6164: 
                   6165: @item @samp{fix_trunc@var{m}@var{n}2}
                   6166: Like @samp{fix@var{m}@var{n}2} but works for any floating point value
                   6167: of mode @var{m} by converting the value to an integer.
                   6168: 
                   6169: @item @samp{fixuns_trunc@var{m}@var{n}2}
                   6170: Like @samp{fixuns@var{m}@var{n}2} but works for any floating point
                   6171: value of mode @var{m} by converting the value to an integer.
                   6172: 
                   6173: @item @samp{trunc@var{m}@var{n}}
                   6174: Truncate operand 1 (valid for mode @var{m}) to mode @var{n} and
                   6175: store in operand 0 (which has mode @var{n}).  Both modes must be fixed
                   6176: point or both floating point.
                   6177: 
                   6178: @item @samp{extend@var{m}@var{n}}
                   6179: Sign-extend operand 1 (valid for mode @var{m}) to mode @var{n} and
                   6180: store in operand 0 (which has mode @var{n}).  Both modes must be fixed
                   6181: point or both floating point.
                   6182: 
                   6183: @item @samp{zero_extend@var{m}@var{n}}
                   6184: Zero-extend operand 1 (valid for mode @var{m}) to mode @var{n} and
                   6185: store in operand 0 (which has mode @var{n}).  Both modes must be fixed
                   6186: point.
                   6187: 
                   6188: @item @samp{extv}
                   6189: Extract a bit-field from operand 1 (a register or memory operand),
                   6190: where operand 2 specifies the width in bits and operand 3 the starting
                   6191: bit, and store it in operand 0.  Operand 0 must have @code{Simode}.
                   6192: Operand 1 may have mode @code{QImode} or @code{SImode}; often
                   6193: @code{SImode} is allowed only for registers.  Operands 2 and 3 must be
                   6194: valid for @code{SImode}.
                   6195: 
                   6196: The RTL generation pass generates this instruction only with constants
                   6197: for operands 2 and 3.
                   6198: 
                   6199: The bit-field value is sign-extended to a full word integer
                   6200: before it is stored in operand 0.
                   6201: 
                   6202: @item @samp{extzv}
                   6203: Like @samp{extv} except that the bit-field value is zero-extended.
                   6204: 
                   6205: @item @samp{insv}
                   6206: Store operand 3 (which must be valid for @code{SImode}) into a
                   6207: bit-field in operand 0, where operand 1 specifies the width in bits
                   6208: and operand 2 the starting bit.  Operand 0 may have mode @code{QImode}
                   6209: or @code{SImode}; often @code{SImode} is allowed only for registers.
                   6210: Operands 1 and 2 must be valid for @code{SImode}.
                   6211: 
                   6212: The RTL generation pass generates this instruction only with constants
                   6213: for operands 1 and 2.
                   6214: 
                   6215: @item @samp{s@var{cond}}
                   6216: Store zero or nonzero in the operand according to the condition codes.
                   6217: Value stored is nonzero iff the condition @var{cond} is true.
                   6218: @var{cond} is the name of a comparison operation expression code, such
                   6219: as @samp{eq}, @samp{lt} or @samp{leu}.
                   6220: 
                   6221: You specify the mode that the operand must have when you write the
                   6222: @code{match_operand} expression.  The compiler automatically sees
                   6223: which mode you have used and supplies an operand of that mode.
                   6224: 
                   6225: The value stored for a true condition must have 1 as its low bit.
                   6226: Otherwise the instruction is not suitable and must be omitted from the
                   6227: machine description.  You must tell the compiler exactly which value
                   6228: is stored by defining the macro @code{STORE_FLAG_VALUE}.
                   6229: 
                   6230: @item @samp{b@var{cond}}
                   6231: Conditional branch instruction.  Operand 0 is a @samp{label_ref}
                   6232: that refers to the label to jump to.  Jump if the condition codes
                   6233: meet condition @var{cond}.
                   6234: 
                   6235: @item @samp{call}
                   6236: Subroutine call instruction returning no value.  Operand 0 is the
                   6237: function to call; operand 1 is the number of bytes of arguments pushed
                   6238: (in mode @code{SImode}, except it is normally a @samp{const_int});
                   6239: operand 2 is the number of registers used as operands.
                   6240: 
                   6241: On most machines, operand 2 is not actually stored into the RTL
                   6242: pattern.  It is supplied for the sake of some RISC machines which need
                   6243: to put this information into the assembler code; they can put it in
                   6244: the RTL instead of operand 1.
                   6245: 
                   6246: Operand 0 should be a @samp{mem} RTX whose address is the address of
                   6247: the function.
                   6248: 
                   6249: @item @samp{call_value}
                   6250: Subroutine call instruction returning a value.  Operand 0 is the hard
                   6251: register in which the value is returned.  There are three more
                   6252: operands, the same as the three operands of the @samp{call}
                   6253: instruction (but with numbers increased by one).
                   6254: 
                   6255: Subroutines that return @code{BLKmode} objects use the @samp{call}
                   6256: insn.
                   6257: 
                   6258: @item @samp{return}
                   6259: Subroutine return instruction.  This instruction pattern name should be
                   6260: defined only if a single instruction can do all the work of returning
                   6261: from a function.
                   6262: 
                   6263: @item @samp{casesi}
                   6264: Instruction to jump through a dispatch table, including bounds checking.
                   6265: This instruction takes five operands:
                   6266: 
                   6267: @enumerate
                   6268: @item
                   6269: The index to dispatch on, which has mode @code{SImode}.
                   6270: 
                   6271: @item
                   6272: The lower bound for indices in the table, an integer constant.
                   6273: 
                   6274: @item
1.1.1.6 ! root     6275: The total range of indices in the table---the largest index
        !          6276: minus the smallest one (both inclusive).
1.1       root     6277: 
                   6278: @item
                   6279: A label to jump to if the index has a value outside the bounds.
                   6280: (If the machine-description macro @code{CASE_DROPS_THROUGH} is defined,
                   6281: then an out-of-bounds index drops through to the code following
                   6282: the jump table instead of jumping to this label.  In that case,
                   6283: this label is not actually used by the @samp{casesi} instruction,
                   6284: but it is always provided as an operand.)
                   6285: 
                   6286: @item
                   6287: A label that precedes the table itself.
                   6288: @end enumerate
                   6289: 
                   6290: The table is a @samp{addr_vec} or @samp{addr_diff_vec} inside of a
                   6291: @samp{jump_insn}.  The number of elements in the table is one plus the
                   6292: difference between the upper bound and the lower bound.
                   6293: 
                   6294: @item @samp{tablejump}
                   6295: Instruction to jump to a variable address.  This is a low-level
                   6296: capability which can be used to implement a dispatch table when there
                   6297: is no @samp{casesi} pattern.
                   6298: 
                   6299: This pattern requires two operands: the address or offset, and a label
                   6300: which should immediately precede the jump table.  If the macro
                   6301: @code{CASE_VECTOR_PC_RELATIVE} is defined then the first operand is an
                   6302: absolute address to jump to; otherwise, it is an offset which counts
                   6303: from the address of the table.
                   6304: 
                   6305: The @samp{tablejump} insn is always the last insn before the jump
                   6306: table it uses.  Its assembler code normally has no need to use the
                   6307: second operand, but you should incorporate it in the RTL pattern so
                   6308: that the jump optimizer will not delete the table as unreachable code.
                   6309: @end table
                   6310: 
                   6311: @node Pattern Ordering, Dependent Patterns, Standard Names, Machine Desc
                   6312: @section When the Order of Patterns Matters
                   6313: 
                   6314: Sometimes an insn can match more than one instruction pattern.  Then the
                   6315: pattern that appears first in the machine description is the one used.
                   6316: Therefore, more specific patterns (patterns that will match fewer things)
                   6317: and faster instructions (those that will produce better code when they
                   6318: do match) should usually go first in the description.
                   6319: 
                   6320: In some cases the effect of ordering the patterns can be used to hide
                   6321: a pattern when it is not valid.  For example, the 68000 has an
                   6322: instruction for converting a fullword to floating point and another
                   6323: for converting a byte to floating point.  An instruction converting
                   6324: an integer to floating point could match either one.  We put the
                   6325: pattern to convert the fullword first to make sure that one will
                   6326: be used rather than the other.  (Otherwise a large integer might
                   6327: be generated as a single-byte immediate quantity, which would not work.)
                   6328: Instead of using this pattern ordering it would be possible to make the
                   6329: pattern for convert-a-byte smart enough to deal properly with any
                   6330: constant value.
                   6331: 
                   6332: @node Dependent Patterns, Jump Patterns, Pattern Ordering, Machine Desc
                   6333: @section Interdependence of Patterns
                   6334: 
                   6335: Every machine description must have a named pattern for each of the
                   6336: conditional branch names @samp{b@var{cond}}.  The recognition template
                   6337: must always have the form
                   6338: 
                   6339: @example
                   6340: (set (pc)
                   6341:      (if_then_else (@var{cond} (cc0) (const_int 0))
                   6342:                    (label_ref (match_operand 0 "" ""))
                   6343:                    (pc)))
                   6344: @end example
                   6345: 
                   6346: @noindent
                   6347: In addition, every machine description must have an anonymous pattern
                   6348: for each of the possible reverse-conditional branches.  These patterns
                   6349: look like
                   6350: 
                   6351: @example
                   6352: (set (pc)
                   6353:      (if_then_else (@var{cond} (cc0) (const_int 0))
                   6354:                    (pc)
                   6355:                    (label_ref (match_operand 0 "" ""))))
                   6356: @end example
                   6357: 
                   6358: @noindent
                   6359: They are necessary because jump optimization can turn direct-conditional
                   6360: branches into reverse-conditional branches.
                   6361: 
                   6362: The compiler does more with RTL than just create it from patterns
                   6363: and recognize the patterns: it can perform arithmetic expression codes
                   6364: when constant values for their operands can be determined.  As a result,
                   6365: sometimes having one pattern can require other patterns.  For example, the
                   6366: Vax has no `and' instruction, but it has `and not' instructions.  Here
                   6367: is the definition of one of them:
                   6368: 
                   6369: @example
                   6370: (define_insn "andcbsi2"
                   6371:   [(set (match_operand:SI 0 "general_operand" "")
                   6372:         (and:SI (match_dup 0)
                   6373:                 (not:SI (match_operand:SI
                   6374:                           1 "general_operand" ""))))]
                   6375:   ""
                   6376:   "bicl2 %1,%0")
                   6377: @end example
                   6378: 
                   6379: @noindent
                   6380: If operand 1 is an explicit integer constant, an instruction constructed
                   6381: using that pattern can be simplified into an `and' like this:
                   6382: 
                   6383: @example
                   6384: (set (reg:SI 41)
                   6385:      (and:SI (reg:SI 41)
                   6386:              (const_int 0xffff7fff)))
                   6387: @end example
                   6388: 
                   6389: @noindent
                   6390: (where the integer constant is the one's complement of what
                   6391: appeared in the original instruction).
                   6392: 
                   6393: To avoid a fatal error, the compiler must have a pattern that recognizes
                   6394: such an instruction.  Here is what is used:
                   6395: 
                   6396: @example
                   6397: (define_insn ""
                   6398:   [(set (match_operand:SI 0 "general_operand" "")
                   6399:         (and:SI (match_dup 0)
                   6400:                 (match_operand:SI 1 "general_operand" "")))]
                   6401:   "GET_CODE (operands[1]) == CONST_INT"
                   6402:   "*
                   6403: @{ operands[1]
                   6404:     = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[1]));
                   6405:   return \"bicl2 %1,%0\";
                   6406: @}")
                   6407: @end example
                   6408: 
                   6409: @noindent
                   6410: Whereas a pattern to match a general `and' instruction is impossible to
                   6411: support on the Vax, this pattern is possible because it matches only a
                   6412: constant second argument: a special case that can be output as an `and not'
                   6413: instruction.
                   6414: 
                   6415: A ``compare'' instruction whose RTL looks like this:
                   6416: 
                   6417: @example
1.1.1.6 ! root     6418: (set (cc0) (compare @var{operand} (const_int 0)))
1.1       root     6419: @end example
                   6420: 
                   6421: @noindent
                   6422: may be simplified by optimization into a ``test'' like this:
                   6423: 
                   6424: @example
                   6425: (set (cc0) @var{operand})
                   6426: @end example
                   6427: 
                   6428: @noindent
                   6429: So in the machine description, each ``compare'' pattern for an integer
                   6430: mode must have a corresponding ``test'' pattern that will match the
                   6431: result of such simplification.
                   6432: 
                   6433: In some cases machines support instructions identical except for the
                   6434: machine mode of one or more operands.  For example, there may be
                   6435: ``sign-extend halfword'' and ``sign-extend byte'' instructions whose
                   6436: patterns are
                   6437: 
                   6438: @example
                   6439: (set (match_operand:SI 0 @dots{})
                   6440:      (extend:SI (match_operand:HI 1 @dots{})))
                   6441: 
                   6442: (set (match_operand:SI 0 @dots{})
                   6443:      (extend:SI (match_operand:QI 1 @dots{})))
                   6444: @end example
                   6445: 
                   6446: @noindent
                   6447: Constant integers do not specify a machine mode, so an instruction to
                   6448: extend a constant value could match either pattern.  The pattern it
                   6449: actually will match is the one that appears first in the file.  For correct
                   6450: results, this must be the one for the widest possible mode (@code{HImode},
                   6451: here).  If the pattern matches the @code{QImode} instruction, the results
                   6452: will be incorrect if the constant value does not actually fit that mode.
                   6453: 
                   6454: Such instructions to extend constants are rarely generated because they are
                   6455: optimized away, but they do occasionally happen in nonoptimized
                   6456: compilations.
                   6457: 
                   6458: When an instruction has the constraint letter @samp{o}, the reload
                   6459: pass may generate instructions which copy a nonoffsetable address into
                   6460: an index register.  The idea is that the register can be used as a
                   6461: replacement offsetable address.  In order for these generated
                   6462: instructions to work, there must be patterns to copy any kind of valid
                   6463: address into a register.
                   6464: 
                   6465: Most older machine designs have ``load address'' instructions which do
                   6466: just what is needed here.  Some RISC machines do not advertise such
                   6467: instructions, but the possible addresses on these machines are very
                   6468: limited, so it is easy to fake them.
                   6469: 
                   6470: Auto-increment and auto-decrement addresses are an exception; there
                   6471: need not be an instruction that can copy such an address into a
                   6472: register, because reload handles these cases in a different manner.
                   6473: 
                   6474: @node Jump Patterns, Peephole Definitions, Dependent Patterns, Machine Desc
                   6475: @section Defining Jump Instruction Patterns
                   6476: 
                   6477: GNU CC assumes that the machine has a condition code.  A comparison insn
                   6478: sets the condition code, recording the results of both signed and unsigned
                   6479: comparison of the given operands.  A separate branch insn tests the
                   6480: condition code and branches or not according its value.  The branch insns
                   6481: come in distinct signed and unsigned flavors.  Many common machines, such
                   6482: as the Vax, the 68000 and the 32000, work this way.
                   6483: 
                   6484: Some machines have distinct signed and unsigned compare instructions, and
                   6485: only one set of conditional branch instructions.  The easiest way to handle
                   6486: these machines is to treat them just like the others until the final stage
                   6487: where assembly code is written.  At this time, when outputting code for the
                   6488: compare instruction, peek ahead at the following branch using
                   6489: @code{NEXT_INSN (insn)}.  (The variable @code{insn} refers to the insn
                   6490: being output, in the output-writing code in an instruction pattern.)  If
                   6491: the RTL says that is an unsigned branch, output an unsigned compare;
                   6492: otherwise output a signed compare.  When the branch itself is output, you
                   6493: can treat signed and unsigned branches identically.
                   6494: 
                   6495: The reason you can do this is that GNU CC always generates a pair of
                   6496: consecutive RTL insns, one to set the condition code and one to test it,
                   6497: and keeps the pair inviolate until the end.
                   6498: 
                   6499: To go with this technique, you must define the machine-description macro
                   6500: @code{NOTICE_UPDATE_CC} to do @code{CC_STATUS_INIT}; in other words, no
                   6501: compare instruction is superfluous.
                   6502: 
                   6503: Some machines have compare-and-branch instructions and no condition code.
                   6504: A similar technique works for them.  When it is time to ``output'' a
                   6505: compare instruction, record its operands in two static variables.  When
                   6506: outputting the branch-on-condition-code instruction that follows, actually
                   6507: output a compare-and-branch instruction that uses the remembered operands.
                   6508: 
                   6509: It also works to define patterns for compare-and-branch instructions.
                   6510: In optimizing compilation, the pair of compare and branch instructions
1.1.1.5   root     6511: will be combined according to these patterns.  But this does not happen
1.1       root     6512: if optimization is not requested.  So you must use one of the solutions
                   6513: above in addition to any special patterns you define.
                   6514: 
                   6515: @node Peephole Definitions, Expander Definitions, Jump Patterns, Machine Desc
                   6516: @section Defining Machine-Specific Peephole Optimizers
                   6517: 
                   6518: In addition to instruction patterns the @file{md} file may contain
                   6519: definitions of machine-specific peephole optimizations.
                   6520: 
                   6521: The combiner does not notice certain peephole optimizations when the data
                   6522: flow in the program does not suggest that it should try them.  For example,
                   6523: sometimes two consecutive insns related in purpose can be combined even
                   6524: though the second one does not appear to use a register computed in the
                   6525: first one.  A machine-specific peephole optimizer can detect such
                   6526: opportunities.
                   6527: 
                   6528: A definition looks like this:
                   6529: 
                   6530: @example
                   6531: (define_peephole
                   6532:   [@var{insn-pattern-1}
                   6533:    @var{insn-pattern-2}
                   6534:    @dots{}]
                   6535:   "@var{condition}"
                   6536:   "@var{template}"
                   6537:   "@var{machine-specific info}")
                   6538: @end example
                   6539: 
                   6540: @noindent
                   6541: The last string operand may be omitted if you are not using any
                   6542: machine-specific information in this machine description.  If present,
                   6543: it must obey the same rules as in a @samp{define_insn}.
                   6544: 
                   6545: In this skeleton, @var{insn-pattern-1} and so on are patterns to match
1.1.1.5   root     6546: consecutive insns.  The optimization applies to a sequence of insns when
                   6547: @var{insn-pattern-1} matches the first one, @var{insn-pattern-2} matches
                   6548: the next, and so on.@refill
1.1       root     6549: 
                   6550: @var{insn-pattern-1} and so on look @emph{almost} like the second operand
                   6551: of @code{define_insn}.  There is one important difference: this pattern is
                   6552: an RTX, not a vector.  If the @code{define_insn} pattern would be a vector
                   6553: of one element, the @var{insn-pattern} should be just that element, no
                   6554: vector.  If the @code{define_insn} pattern would have multiple elements
                   6555: then the @var{insn-pattern} must place the vector inside an explicit
                   6556: @code{parallel} RTX.@refill
                   6557: 
1.1.1.5   root     6558: The operands of the insns are matched with @code{match_operands} and
                   6559: @code{match_dup}, as usual.  What is not usual is that the operand numbers
                   6560: apply to all the insn patterns in the definition.  So, you can check for
                   6561: identical operands in two insns by using @code{match_operand} in one insn
                   6562: and @code{match_dup} in the other.
1.1       root     6563: 
                   6564: The operand constraints used in @code{match_operand} patterns do not have
                   6565: any direct effect on the applicability of the optimization, but they will
                   6566: be validated afterward, so write constraints that are sure to fit whenever
                   6567: the optimization is applied.  It is safe to use @code{"g"} for each
                   6568: operand.
                   6569: 
1.1.1.5   root     6570: Once a sequence of insns matches the patterns, the @var{condition} is
                   6571: checked.  This is a C expression which makes the final decision whether to
                   6572: perform the optimization (we do so if the expression is nonzero).  If
1.1       root     6573: @var{condition} is omitted (in other words, the string is empty) then the
1.1.1.5   root     6574: optimization is applied to every sequence of insns that matches the
1.1       root     6575: patterns.
                   6576: 
1.1.1.5   root     6577: The defined peephole optimizations are applied after register allocation
                   6578: is complete.  Therefore, the peephole definition can check which
                   6579: operands have ended up in which kinds of registers, just by looking at
                   6580: the operands.
1.1       root     6581: 
                   6582: The way to refer to the operands in @var{condition} is to write
                   6583: @code{operands[@var{i}]} for operand number @var{i} (as matched by
                   6584: @code{(match_operand @var{i} @dots{})}).  Use the variable @code{insn} to
                   6585: refer to the last of the insns being matched; use @code{PREV_INSN} to find
                   6586: the preceding insns (but be careful to skip over any @samp{note} insns that
                   6587: intervene).@refill
                   6588: 
                   6589: When optimizing computations with intermediate results, you can use
                   6590: @var{condition} to match only when the intermediate results are not used
                   6591: elsewhere.  Use the C expression @code{dead_or_set_p (@var{insn},
                   6592: @var{op})}, where @var{insn} is the insn in which you expect the value to
                   6593: be used for the last time (from the value of @code{insn}, together with use
                   6594: of @code{PREV_INSN}), and @var{op} is the intermediate value (from
                   6595: @code{operands[@var{i}]}).@refill
                   6596: 
1.1.1.5   root     6597: Applying the optimization means replacing the sequence of insns with one
                   6598: new insn.  The @var{template} controls ultimate output of assembler code
                   6599: for this combined insn.  It works exactly like the template of a
                   6600: @code{define_insn}.  Operand numbers in this template are the same ones
                   6601: used in matching the original sequence of insns.
1.1       root     6602: 
                   6603: The result of a defined peephole optimizer does not need to match any of
1.1.1.5   root     6604: the insn patterns in the machine description; it does not even have an
                   6605: opportunity to match them.  The peephole optimizer definition itself serves
                   6606: as the insn pattern to control how the insn is output.
                   6607: 
                   6608: Defined peephole optimizers are run as assembler code is being output,
                   6609: so the insns they produce are never combined or rearranged in any way.
1.1       root     6610: 
                   6611: Here is an example, taken from the 68000 machine description:
                   6612: 
                   6613: @example
                   6614: (define_peephole
                   6615:   [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
                   6616:    (set (match_operand:DF 0 "register_operand" "f")
                   6617:         (match_operand:DF 1 "register_operand" "ad"))]
                   6618:   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
                   6619:   "*
                   6620: @{
                   6621:   rtx xoperands[2];
                   6622:   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
                   6623: #ifdef MOTOROLA
                   6624:   output_asm_insn (\"move.l %1,(sp)\", xoperands);
                   6625:   output_asm_insn (\"move.l %1,-(sp)\", operands);
                   6626:   return \"fmove.d (sp)+,%0\";
                   6627: #else
                   6628:   output_asm_insn (\"movel %1,sp@@\", xoperands);
                   6629:   output_asm_insn (\"movel %1,sp@@-\", operands);
                   6630:   return \"fmoved sp@@+,%0\";
                   6631: #endif
                   6632: @}
                   6633: ")
                   6634: @end example
                   6635: 
                   6636: The effect of this optimization is to change
                   6637: 
                   6638: @example
                   6639: jbsr _foobar
                   6640: addql #4,sp
                   6641: movel d1,sp@@-
                   6642: movel d0,sp@@-
                   6643: fmoved sp@@+,fp0
                   6644: @end example
                   6645: 
                   6646: @noindent
                   6647: into
                   6648: 
                   6649: @example
                   6650: jbsr _foobar
                   6651: movel d1,sp@@
                   6652: movel d0,sp@@-
                   6653: fmoved sp@@+,fp0
                   6654: @end example
                   6655: 
1.1.1.5   root     6656: @ignore
                   6657: If a peephole matches a sequence including one or more jump insns, you must
                   6658: take account of the flags such as @code{CC_REVERSED} which specify that the
                   6659: condition codes are represented in an unusual manner.  The compiler
                   6660: automatically alters any ordinary conditional jumps which occur in such
                   6661: situations, but the compiler cannot alter jumps which have been replaced by
                   6662: peephole optimizations.  So it is up to you to alter the assembler code
                   6663: that the peephole produces.  Supply C code to write the assembler output,
                   6664: and in this C code check the condition code status flags and change the
                   6665: assembler code as appropriate.
                   6666: @end ignore
                   6667: 
1.1       root     6668: @node Expander Definitions,, Peephole Definitions, Machine Desc
                   6669: @section Defining RTL Sequences for Code Generation
                   6670: 
                   6671: On some target machines, some standard pattern names for RTL generation
                   6672: cannot be handled with single insn, but a sequence of RTL insns can
                   6673: represent them.  For these target machines, you can write a
                   6674: @samp{define_expand} to specify how to generate the sequence of RTL.
                   6675: 
                   6676: A @samp{define_expand} is an RTL expression that looks almost like a
                   6677: @samp{define_insn}; but, unlike the latter, a @samp{define_expand} is used
                   6678: only for RTL generation and it can produce more than one RTL insn.
                   6679: 
                   6680: A @samp{define_expand} RTX has four operands:
                   6681: 
                   6682: @itemize @bullet
                   6683: @item
                   6684: The name.  Each @samp{define_expand} must have a name, since the only
                   6685: use for it is to refer to it by name.
                   6686: 
                   6687: @item
                   6688: The RTL template.  This is just like the RTL template for a
                   6689: @samp{define_peephole} in that it is a vector of RTL expressions
                   6690: each being one insn.
                   6691: 
                   6692: @item
                   6693: The condition, a string containing a C expression.  This expression is
                   6694: used to express how the availability of this pattern depends on
                   6695: subclasses of target machine, selected by command-line options when
                   6696: GNU CC is run.  This is just like the condition of a
                   6697: @samp{define_insn} that has a standard name.
                   6698: 
                   6699: @item
                   6700: The preparation statements, a string containing zero or more C
                   6701: statements which are to be executed before RTL code is generated from
                   6702: the RTL template.
                   6703: 
                   6704: Usually these statements prepare temporary registers for use as
                   6705: internal operands in the RTL template, but they can also generate RTL
                   6706: insns directly by calling routines such as @samp{emit_insn}, etc.
                   6707: Any such insns precede the ones that come from the RTL template.
                   6708: @end itemize
                   6709: 
                   6710: The RTL template, in addition to controlling generation of RTL insns,
                   6711: also describes the operands that need to be specified when this pattern
                   6712: is used.  In particular, it gives a predicate for each operand.
                   6713: 
                   6714: A true operand, which need to be specified in order to generate RTL from
                   6715: the pattern, should be described with a @samp{match_operand} in its first
                   6716: occurrence in the RTL template.  This enters information on the operand's
                   6717: predicate into the tables that record such things.  GNU CC uses the
                   6718: information to preload the operand into a register if that is required for
                   6719: valid RTL code.  If the operand is referred to more than once, subsequent
                   6720: references should use @samp{match_dup}.
                   6721: 
                   6722: The RTL template may also refer to internal ``operands'' which are
                   6723: temporary registers or labels used only within the sequence made by the
                   6724: @samp{define_expand}.  Internal operands are substituted into the RTL
                   6725: template with @samp{match_dup}, never with @samp{match_operand}.  The
                   6726: values of the internal operands are not passed in as arguments by the
                   6727: compiler when it requests use of this pattern.  Instead, they are computed
                   6728: within the pattern, in the preparation statements.  These statements
                   6729: compute the values and store them into the appropriate elements of
                   6730: @code{operands} so that @samp{match_dup} can find them.
                   6731: 
                   6732: There are two special macros defined for use in the preparation statements:
                   6733: @code{DONE} and @code{FAIL}.  Use them with a following semicolon,
                   6734: as a statement.
                   6735: 
                   6736: @table @code
                   6737: @item DONE
                   6738: Use the @code{DONE} macro to end RTL generation for the pattern.  The
                   6739: only RTL insns resulting from the pattern on this occasion will be
                   6740: those already emitted by explicit calls to @code{emit_insn} within the
                   6741: preparation statements; the RTL template will not be generated.
                   6742: 
                   6743: @item FAIL
                   6744: Make the pattern fail on this occasion.  When a pattern fails, it means
                   6745: that the pattern was not truly available.  The calling routines in the
                   6746: compiler will try other strategies for code generation using other patterns.
                   6747: 
                   6748: Failure is currently supported only for binary operations (addition,
                   6749: multiplication, shifting, etc.).
                   6750: 
                   6751: Do not emit any insns explicitly with @code{emit_insn} before failing.
                   6752: @end table
                   6753: 
                   6754: Here is an example, the definition of left-shift for the SPUR chip:
                   6755: 
                   6756: @example
                   6757: (define_expand "ashlsi3"
                   6758:   [(set (match_operand:SI 0 "register_operand" "")
                   6759:         (ashift:SI
                   6760:           (match_operand:SI 1 "register_operand" "")
                   6761:           (match_operand:SI 2 "nonmemory_operand" "")))]
                   6762:   ""
                   6763:   "
                   6764: @{
                   6765:   if (GET_CODE (operands[2]) != CONST_INT
                   6766:       || (unsigned) INTVAL (operands[2]) > 3)
                   6767:     FAIL;
                   6768: @}")
                   6769: @end example
                   6770: 
                   6771: @noindent
                   6772: This example uses @samp{define_expand} so that it can generate an RTL insn
                   6773: for shifting when the shift-count is in the supported range of 0 to 3 but
                   6774: fail in other cases where machine insns aren't available.  When it fails,
                   6775: the compiler tries another strategy using different patterns (such as, a
                   6776: library call).
                   6777: 
                   6778: If the compiler were able to handle nontrivial condition-strings in
                   6779: patterns with names, then there would be possible to use a
                   6780: @samp{define_insn} in that case.  Here is another case (zero-extension on
                   6781: the 68000) which makes more use of the power of @samp{define_expand}:
                   6782: 
                   6783: @example
                   6784: (define_expand "zero_extendhisi2"
                   6785:   [(set (match_operand:SI 0 "general_operand" "")
                   6786:         (const_int 0))
                   6787:    (set (strict_low_part 
                   6788:           (subreg:HI
                   6789:             (match_operand:SI 0 "general_operand" "")
                   6790:             0))
                   6791:         (match_operand:HI 1 "general_operand" ""))]
                   6792:   ""
                   6793:   "operands[1] = make_safe_from (operands[1], operands[0]);")
                   6794: @end example
                   6795: 
                   6796: @noindent
                   6797: Here two RTL insns are generated, one to clear the entire output operand
                   6798: and the other to copy the input operand into its low half.  This sequence
                   6799: is incorrect if the input operand refers to [the old value of] the output
                   6800: operand, so the preparation statement makes sure this isn't so.  The
                   6801: function @code{make_safe_from} copies the @code{operands[1]} into a
                   6802: temporary register if it refers to @code{operands[0]}.  It does this
                   6803: by emitting another RTL insn.
                   6804: 
                   6805: Finally, a third example shows the use of an internal operand.
                   6806: Zero-extension on the SPUR chip is done by @samp{and}-ing the result
                   6807: against a halfword mask.  But this mask cannot be represented by a
                   6808: @samp{const_int} because the constant value is too large to be legitimate
                   6809: on this machine.  So it must be copied into a register with
                   6810: @code{force_reg} and then the register used in the @samp{and}.
                   6811: 
                   6812: @example
                   6813: (define_expand "zero_extendhisi2"
                   6814:   [(set (match_operand:SI 0 "register_operand" "")
                   6815:         (and:SI (subreg:SI
                   6816:                   (match_operand:HI 1 "register_operand" "")
                   6817:                   0)
                   6818:                 (match_dup 2)))]
                   6819:   ""
                   6820:   "operands[2]
                   6821:      = force_reg (SImode, gen_rtx (CONST_INT,
                   6822:                                    VOIDmode, 65535)); ")
                   6823: @end example
                   6824: 
                   6825: @node Machine Macros, Config, Machine Desc, Top
                   6826: @chapter Machine Description Macros
                   6827: 
                   6828: The other half of the machine description is a C header file conventionally
                   6829: given the name @file{tm-@var{machine}.h}.  The file @file{tm.h} should be a
                   6830: link to it.  The header file @file{config.h} includes @file{tm.h} and most
                   6831: compiler source files include @file{config.h}.
                   6832: 
                   6833: @menu
                   6834: * Run-time Target::     Defining -m options like -m68000 and -m68020.
                   6835: * Storage Layout::      Defining sizes and alignments of data types.
                   6836: * Registers::           Naming and describing the hardware registers.
                   6837: * Register Classes::    Defining the classes of hardware registers.
                   6838: * Stack Layout::        Defining which way the stack grows and by how much.
                   6839: * Library Names::       Specifying names of subroutines to call automatically.
                   6840: * Addressing Modes::    Defining addressing modes valid for memory operands.
                   6841: * Condition Code::      Defining how insns update the condition code.
                   6842: * Assembler Format::    Defining how to write insns and pseudo-ops to output.
1.1.1.5   root     6843: * Cross-compilation::   Handling floating point for cross-compilers.
1.1       root     6844: * Misc::                Everything else.
                   6845: @end menu
                   6846: 
                   6847: @node Run-time Target, Storage Layout, Machine Macros, Machine Macros
                   6848: @section Run-time Target Specification
                   6849: 
                   6850: @table @code
                   6851: @item CPP_PREDEFINES
                   6852: Define this to be a string constant containing @samp{-D} options to
                   6853: define the predefined macros that identify this machine and system.
                   6854: These macros will be predefined unless the @samp{-ansi} option is
                   6855: specified.
                   6856: 
1.1.1.4   root     6857: In addition, a parallel set of macros are predefined, whose names are
                   6858: made by appending @samp{__} at the beginning and at the end.  These
                   6859: @samp{__} macros are permitted by the ANSI standard, so they are
                   6860: predefined regardless of whether @samp{-ansi} is specified.
                   6861: 
                   6862: For example, on the Sun, one can use the following value:
1.1       root     6863: 
                   6864: @example
                   6865: "-Dmc68000 -Dsun -Dunix"
                   6866: @end example
                   6867: 
1.1.1.5   root     6868: The result is to define the macros @samp{__mc68000__}, @samp{__sun__}
1.1.1.4   root     6869: and @samp{__unix__} unconditionally, and the macros @samp{mc68000},
                   6870: @samp{sun} and @samp{unix} provided @samp{-ansi} is not specified.
                   6871: 
1.1       root     6872: @item CPP_SPEC
                   6873: A C string constant that tells the GNU CC driver program options to
                   6874: pass to CPP.  It can also specify how to translate options you
                   6875: give to GNU CC into options for GNU CC to pass to the CPP.
                   6876: 
                   6877: Do not define this macro if it does not need to do anything.
                   6878: 
                   6879: @item CC1_SPEC
                   6880: A C string constant that tells the GNU CC driver program options to
                   6881: pass to CC1.  It can also specify how to translate options you
                   6882: give to GNU CC into options for GNU CC to pass to the CC1.
                   6883: 
                   6884: Do not define this macro if it does not need to do anything.
                   6885: 
                   6886: @item extern int target_flags;
                   6887: This declaration should be present.
                   6888: 
                   6889: @item TARGET_@dots{}
                   6890: This series of macros is to allow compiler command arguments to
                   6891: enable or disable the use of optional features of the target machine.
                   6892: For example, one machine description serves both the 68000 and
                   6893: the 68020; a command argument tells the compiler whether it should
                   6894: use 68020-only instructions or not.  This command argument works
                   6895: by means of a macro @code{TARGET_68020} that tests a bit in
                   6896: @code{target_flags}.
                   6897: 
                   6898: Define a macro @code{TARGET_@var{featurename}} for each such option.
                   6899: Its definition should test a bit in @code{target_flags}; for example:
                   6900: 
                   6901: @example
                   6902: #define TARGET_68020 (target_flags & 1)
                   6903: @end example
                   6904: 
                   6905: One place where these macros are used is in the condition-expressions
                   6906: of instruction patterns.  Note how @code{TARGET_68020} appears
                   6907: frequently in the 68000 machine description file, @file{m68k.md}.
                   6908: Another place they are used is in the definitions of the other
                   6909: macros in the @file{tm-@var{machine}.h} file.
                   6910: 
                   6911: @item TARGET_SWITCHES
                   6912: This macro defines names of command options to set and clear
                   6913: bits in @code{target_flags}.  Its definition is an initializer
                   6914: with a subgrouping for each command option.
                   6915: 
                   6916: Each subgrouping contains a string constant, that defines the option
                   6917: name, and a number, which contains the bits to set in
                   6918: @code{target_flags}.  A negative number says to clear bits instead;
                   6919: the negative of the number is which bits to clear.  The actual option
                   6920: name is made by appending @samp{-m} to the specified name.
                   6921: 
                   6922: One of the subgroupings should have a null string.  The number in
                   6923: this grouping is the default value for @code{target_flags}.  Any
                   6924: target options act starting with that value.
                   6925: 
                   6926: Here is an example which defines @samp{-m68000} and @samp{-m68020}
                   6927: with opposite meanings, and picks the latter as the default:
                   6928: 
                   6929: @example
                   6930: #define TARGET_SWITCHES \
                   6931:   @{ @{ "68020", 1@},      \
                   6932:     @{ "68000", -1@},     \
                   6933:     @{ "", 1@}@}
                   6934: @end example
                   6935: 
                   6936: @item OVERRIDE_OPTIONS
                   6937: Sometimes certain combinations of command options do not make sense on
                   6938: a particular target machine.  You can define a macro
                   6939: @code{OVERRIDE_OPTIONS} to take account of this.  This macro, if
                   6940: defined, is executed once just after all the command options have been
                   6941: parsed.
                   6942: @end table
                   6943: 
                   6944: @node Storage Layout, Registers, Run-time Target, Machine Macros
                   6945: @section Storage Layout
                   6946: 
                   6947: Note that the definitions of the macros in this table which are sizes or
                   6948: alignments measured in bits do not need to be constant.  They can be C
                   6949: expressions that refer to static variables, such as the @code{target_flags}.
                   6950: @xref{Run-time Target}.
                   6951: 
                   6952: @table @code
                   6953: @item BITS_BIG_ENDIAN
                   6954: Define this macro if the most significant bit in a byte has the lowest
                   6955: number.  This means that bit-field instructions count from the most
                   6956: significant bit.  If the machine has no bit-field instructions, this
                   6957: macro is irrelevant.
                   6958: 
                   6959: @item BYTES_BIG_ENDIAN
                   6960: Define this macro if the most significant byte in a word has the
                   6961: lowest number.
                   6962: 
                   6963: @item WORDS_BIG_ENDIAN
                   6964: Define this macro if, in a multiword object, the most significant
                   6965: word has the lowest number.
                   6966: 
                   6967: @item BITS_PER_UNIT
                   6968: Number of bits in an addressable storage unit (byte); normally 8.
                   6969: 
                   6970: @item BITS_PER_WORD
                   6971: Number of bits in a word; normally 32.
                   6972: 
                   6973: @item UNITS_PER_WORD
                   6974: Number of storage units in a word; normally 4.
                   6975: 
                   6976: @item POINTER_SIZE
                   6977: Width of a pointer, in bits.
                   6978: 
                   6979: @item POINTER_BOUNDARY
                   6980: Alignment required for pointers stored in memory, in bits.
                   6981: 
                   6982: @item PARM_BOUNDARY
                   6983: Alignment required for function parameters on the stack, in bits.
                   6984: 
                   6985: @item STACK_BOUNDARY
                   6986: Define this macro if you wish to preserve a certain alignment for
                   6987: the stack pointer at all times.  The definition is a C expression
                   6988: for the desired alignment (measured in bits).
                   6989: 
                   6990: @item FUNCTION_BOUNDARY
                   6991: Alignment required for a function entry point, in bits.
                   6992: 
                   6993: @item BIGGEST_ALIGNMENT
                   6994: Biggest alignment that any data type can require on this machine, in bits.
                   6995: 
                   6996: @item EMPTY_FIELD_BOUNDARY
                   6997: Alignment in bits to be given to a structure bit field that follows an
                   6998: empty field such as @code{int : 0;}.
                   6999: 
                   7000: @item STRUCTURE_SIZE_BOUNDARY
                   7001: Number of bits which any structure or union's size must be a multiple of.
                   7002: Each structure or union's size is rounded up to a multiple of this.
                   7003: 
                   7004: If you do not define this macro, the default is the same as
                   7005: @code{BITS_PER_UNIT}.
                   7006: 
                   7007: @item STRICT_ALIGNMENT
                   7008: Define this if instructions will fail to work if given data not
                   7009: on the nominal alignment.  If instructions will merely go slower
                   7010: in that case, do not define this macro.
                   7011: 
                   7012: @item PCC_BITFIELD_TYPE_MATTERS
                   7013: Define this if you wish to imitate a certain bizarre behavior pattern
                   7014: of some instances of PCC: a bit field whose declared type is
                   7015: @code{int} has the same effect on the size and alignment of a
                   7016: structure as an actual @code{int} would have.
                   7017: 
                   7018: Just what effect that is in GNU CC depends on other parameters, but on
                   7019: most machines it would force the structure's alignment and size to a
                   7020: multiple of 32 or @code{BIGGEST_ALIGNMENT} bits.
                   7021: 
                   7022: @item CHECK_FLOAT_VALUE (@var{mode}, @var{value})
                   7023: A C statement to validate the value @var{value} (or type
                   7024: @code{double}) for mode @var{mode}.  This means that you check whether
                   7025: @var{value} fits within the possible range of values for mode
                   7026: @var{mode} on this target machine.  The mode @var{mode} is always
                   7027: @code{SFmode} or @code{DFmode}.
                   7028: 
                   7029: If @var{value} is not valid, you should call @code{error} to print an
                   7030: error message and then assign some valid value to @var{value}.
                   7031: Allowing an invalid value to go through the compiler can produce
                   7032: incorrect assembler code which may even cause Unix assemblers to
                   7033: crash.
                   7034: 
                   7035: This macro need not be defined if there is no work for it to do.
                   7036: @end table
                   7037: 
                   7038: @node Registers, Register Classes, Storage Layout, Machine Macros
                   7039: @section Register Usage
                   7040: 
                   7041: @table @code
                   7042: @item FIRST_PSEUDO_REGISTER
                   7043: Number of hardware registers known to the compiler.  They receive
                   7044: numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
                   7045: pseudo register's number really is assigned the number
                   7046: @code{FIRST_PSEUDO_REGISTER}.
                   7047: 
                   7048: @item FIXED_REGISTERS
                   7049: An initializer that says which registers are used for fixed purposes
                   7050: all throughout the compiled code and are therefore not available for
                   7051: general allocation.  These would include the stack pointer, the frame
                   7052: pointer (except on machines where that can be used as a general
                   7053: register when no frame pointer is needed), the program counter on
                   7054: machines where that is considered one of the addressable registers,
                   7055: and any other numbered register with a standard use.
                   7056: 
                   7057: This information is expressed as a sequence of numbers, separated by
                   7058: commas and surrounded by braces.  The @var{n}th number is 1 if
                   7059: register @var{n} is fixed, 0 otherwise.
                   7060: 
                   7061: The table initialized from this macro, and the table initialized by
                   7062: the following one, may be overridden at run time either automatically,
                   7063: by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
                   7064: the user with the command options @samp{-ffixed-@var{reg}},
                   7065: @samp{-fcall-used-@var{reg}} and @samp{-fcall-saved-@var{reg}}.
                   7066: 
                   7067: @item CALL_USED_REGISTERS
                   7068: Like @code{FIXED_REGISTERS} but has 1 for each register that is
                   7069: clobbered (in general) by function calls as well as for fixed
                   7070: registers.  This macro therefore identifies the registers that are not
                   7071: available for general allocation of values that must live across
                   7072: function calls.
                   7073: 
                   7074: If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
                   7075: automatically saves it on function entry and restores it on function
                   7076: exit, if the register is used within the function.
                   7077: 
1.1.1.6 ! root     7078: @item DEFAULT_CALLER_SAVES
        !          7079: Define this macro if the target machine if function calls do not preserve
        !          7080: any registers; in other words, if @code{CALL_USED_REGISTERS} has 1
        !          7081: for all registers.  This macro enables @samp{-fcaller-saves} by default.
        !          7082: Eventually that option will be enabled by default on all machines and both
        !          7083: the option and this macro will be eliminated.
        !          7084: 
1.1       root     7085: @item CONDITIONAL_REGISTER_USAGE
                   7086: Zero or more C statements that may conditionally modify two variables
                   7087: @code{fixed_regs} and @code{call_used_regs} (both of type @code{char
                   7088: []}) after they have been initialized from the two preceding macros.
                   7089: 
                   7090: This is necessary in case the fixed or call-clobbered registers depend
                   7091: on target flags.
                   7092: 
                   7093: You need not define this macro if it has no work to do.
                   7094: 
                   7095: If the usage of an entire class of registers depends on the target
1.1.1.5   root     7096: flags, you may indicate this to GCC by using this macro to modify
1.1       root     7097: @code{fixed_regs} and @code{call_used_regs} to 1 for each of the
1.1.1.5   root     7098: registers in the classes which should not be used by GCC.  Also define
1.1       root     7099: the macro @code{REG_CLASS_FROM_LETTER} to return @code{NO_REGS} if it
                   7100: is called with a letter for a class that shouldn't be used.
                   7101: 
                   7102: (However, if this class is not included in @code{GENERAL_REGS} and all
                   7103: of the insn patterns whose constraints permit this class are
                   7104: controlled by target switches, then GCC will automatically avoid using
                   7105: these registers when the target switches are opposed to them.)
                   7106: 
                   7107: @item OVERLAPPING_REGNO_P (@var{regno})
1.1.1.5   root     7108: If defined, this is a C expression whose value is nonzero if hard
                   7109: register number @var{regno} is an overlapping register.  This means a
                   7110: hard register which overlaps a hard register with a different number.
                   7111: (Such overlap is undesirable, but occasionally it allows a machine to
                   7112: be supported which otherwise could not be.)  This macro must return
                   7113: nonzero for @emph{all} the registers which overlap each other.  GNU CC
                   7114: can use an overlapping register only in certain limited ways.  It can
                   7115: be used for allocation within a basic block, and may be spilled for
                   7116: reloading; that is all.
1.1       root     7117: 
                   7118: If this macro is not defined, it means that none of the hard registers
                   7119: overlap each other.  This is the usual situation.
                   7120: 
                   7121: @item INSN_CLOBBERS_REGNO_P (@var{insn}, @var{regno})
                   7122: If defined, this is a C expression whose value should be nonzero if
                   7123: the insn @var{insn} has the effect of mysteriously clobbering the
                   7124: contents of hard register number @var{regno}.  By ``mysterious'' we
                   7125: mean that the insn's RTL expression doesn't describe such an effect.
                   7126: 
                   7127: If this macro is not defined, it means that no insn clobbers registers
                   7128: mysteriously.  This is the usual situation; all else being equal,
                   7129: it is best for the RTL expression to show all the activity.
                   7130: 
                   7131: @item PRESERVE_DEATH_INFO_REGNO_P (@var{regno})
                   7132: If defined, this is a C expression whose value is nonzero if accurate
                   7133: @code{REG_DEAD} notes are needed for hard register number @var{regno}
                   7134: at the time of outputting the assembler code.  When this is so, a few
                   7135: optimizations that take place after register allocation and could
                   7136: invalidate the death notes are not done when this register is
                   7137: involved.
                   7138: 
                   7139: You would arrange to preserve death info for a register when some
                   7140: of the code in the machine description which is executed to write
                   7141: the assembler code looks at the the death notes.  This is
                   7142: necessary only when the actual hardware feature which GNU CC
                   7143: thinks of as a register is not actually a register of the usual sort.
                   7144: (It might, for example, be a hardware stack.)
                   7145: 
                   7146: If this macro is not defined, it means that no death notes need to be
                   7147: preserved.  This is the usual situation.
                   7148: 
                   7149: @item HARD_REGNO_REGS (@var{regno}, @var{mode})
                   7150: A C expression for the number of consecutive hard registers, starting
                   7151: at register number @var{regno}, required to hold a value of mode
                   7152: @var{mode}.
                   7153: 
                   7154: On a machine where all registers are exactly one word, a suitable
                   7155: definition of this macro is
                   7156: 
                   7157: @example
                   7158: #define HARD_REGNO_NREGS(REGNO, MODE)            \
                   7159:    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1)  \
                   7160:     / UNITS_PER_WORD))
                   7161: @end example
                   7162: 
                   7163: @item HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
                   7164: A C expression that is nonzero if it is permissible to store a value
                   7165: of mode @var{mode} in hard register number @var{regno} (or in several
                   7166: registers starting with that one).  For a machine where all registers
                   7167: are equivalent, a suitable definition is
                   7168: 
                   7169: @example
                   7170: #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
                   7171: @end example
                   7172: 
                   7173: It is not necessary for this macro to check for fixed register numbers
                   7174: because the allocation mechanism considers them to be always occupied.
                   7175: 
                   7176: Many machines have special registers for floating point arithmetic.
                   7177: Often people assume that floating point machine modes are allowed only
                   7178: in floating point registers.  This is not true.  Any registers that
                   7179: can hold integers can safely @emph{hold} a floating point machine
                   7180: mode, whether or not floating arithmetic can be done on it in those
                   7181: registers.
                   7182: 
                   7183: The true significance of special floating registers is rather than
                   7184: non-floating-point machine modes @emph{may not} go in those registers.
                   7185: This is true if the floating registers normalize any value stored in
                   7186: them, because storing a non-floating value there would garble it.  If
                   7187: the floating registers do not automatically normalize, if you can
                   7188: store any bit pattern in one and retrieve it unchanged without a trap,
                   7189: then any machine mode may go in a floating register and this macro
                   7190: should say so.
                   7191: 
                   7192: Sometimes there are floating registers that are especially slow to
                   7193: access, so that it is better to store a value in a stack frame than in
                   7194: such a register if floating point arithmetic is not being done.  As long
                   7195: as the floating registers are not in class @code{GENERAL_REGS}, they
                   7196: will not be used unless some insn's constraint asks for one.
                   7197: 
                   7198: It is obligatory to support floating point `move' instructions into
                   7199: and out of any registers that can hold fixed point values, because
                   7200: unions and structures (which have modes @samp{SImode} or
                   7201: @samp{DImode}) can be in those registers and they may have floating
                   7202: point members.
                   7203: 
                   7204: There may also be a need to support fixed point `move' instructions in
                   7205: and out of floating point registers.  Unfortunately, I have forgotten
                   7206: why this was so, and I don't know whether it is still true.  If
                   7207: @code{HARD_REGNO_MODE_OK} rejects fixed point values in floating point
                   7208: registers, then the constraints of the fixed point `move' instructions
                   7209: must be designed to avoid ever trying to reload into a floating point
                   7210: register.
                   7211: 
                   7212: @item MODES_TIEABLE_P (@var{mode1}, @var{mode2})
                   7213: A C expression that is nonzero if it is desirable to choose register
                   7214: allocation so as to avoid move instructions between a value of mode
                   7215: @var{mode1} and a value of mode @var{mode2}.
                   7216: 
                   7217: If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
                   7218: @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are ever different
                   7219: for any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1},
                   7220: @var{mode2})} must be zero.
                   7221: 
                   7222: @item PC_REGNUM
                   7223: If the program counter has a register number, define this as that
                   7224: register number.  Otherwise, do not define it.
                   7225: 
                   7226: @item STACK_POINTER_REGNUM
                   7227: The register number of the stack pointer register, which must also be
                   7228: a fixed register according to @code{FIXED_REGISTERS}.  On many
                   7229: machines, the hardware determines which register this is.
                   7230: 
                   7231: @item FRAME_POINTER_REGNUM
                   7232: The register number of the frame pointer register, which is used to
                   7233: access automatic variables in the stack frame.  On some machines, the
                   7234: hardware determines which register this is.  On other machines, you
                   7235: can choose any register you wish for this purpose.
                   7236: 
                   7237: @item FRAME_POINTER_REQUIRED
                   7238: A C expression which is nonzero if a function must have and use a
                   7239: frame pointer.  This expression is evaluated in the reload pass, in
                   7240: the function @code{reload}, and it can in principle examine the
                   7241: current function and decide according to the facts, but on most
                   7242: machines the constant 0 or the constant 1 suffices.  Use 0 when the
                   7243: machine allows code to be generated with no frame pointer, and doing
                   7244: so saves some time or space.  Use 1 when there is no possible
                   7245: advantage to avoiding a frame pointer.
                   7246: 
1.1.1.5   root     7247: In certain cases, the compiler does not know how to produce valid code
                   7248: without a frame pointer.  The compiler recognizes those cases and
                   7249: automatically gives the function a frame pointer regardless of what
1.1       root     7250: @code{FRAME_POINTER_REQUIRED} says.  You don't need to worry about
                   7251: them.@refill
                   7252: 
                   7253: In a function that does not require a frame pointer, the frame pointer
                   7254: register can be allocated for ordinary usage, unless you mark it as a
                   7255: fixed register.  See @code{FIXED_REGISTERS} for more information.
                   7256: 
                   7257: @item ARG_POINTER_REGNUM
                   7258: The register number of the arg pointer register, which is used to
                   7259: access the function's argument list.  On some machines, this is the
                   7260: same as the frame pointer register.  On some machines, the hardware
                   7261: determines which register this is.  On other machines, you can choose
                   7262: any register you wish for this purpose.  If this is not the same
                   7263: register as the frame pointer register, then you must mark it as a
                   7264: fixed register according to @code{FIXED_REGISTERS}.
                   7265: 
                   7266: @item STATIC_CHAIN_REGNUM
                   7267: The register number used for passing a function's static chain
                   7268: pointer.  This is needed for languages such as Pascal and Algol where
                   7269: functions defined within other functions can access the local
                   7270: variables of the outer functions; it is not currently used because C
                   7271: does not provide this feature, but you must define the macro.
                   7272: 
                   7273: The static chain register need not be a fixed register.
                   7274: 
                   7275: @item STRUCT_VALUE_REGNUM
                   7276: When a function's value's mode is @code{BLKmode}, the value is not
                   7277: returned according to @code{FUNCTION_VALUE}.  Instead, the caller
                   7278: passes the address of a block of memory in which the value should be
                   7279: stored.
                   7280: 
                   7281: If this value is passed in a register, then @code{STRUCT_VALUE_REGNUM}
                   7282: should be the number of that register.
                   7283: 
                   7284: @item STRUCT_VALUE
                   7285: If the structure value address is not passed in a register, define
                   7286: @code{STRUCT_VALUE} as an expression returning an RTX for the place
                   7287: where the address is passed.  If it returns a @samp{mem} RTX, the
                   7288: address is passed as an ``invisible'' first argument.
                   7289: 
                   7290: @item STRUCT_VALUE_INCOMING_REGNUM
                   7291: On some architectures the place where the structure value address
                   7292: is found by the called function is not the same place that the
                   7293: caller put it.  This can be due to register windows, or it could
                   7294: be because the function prologue moves it to a different place.
                   7295: 
                   7296: If the incoming location of the structure value address is in a
                   7297: register, define this macro as the register number.
                   7298: 
                   7299: @item STRUCT_VALUE_INCOMING
                   7300: If the incoming location is not a register, define
                   7301: @code{STRUCT_VALUE_INCOMING} as an expression for an RTX for where the
                   7302: called function should find the value.  If it should find the value on
                   7303: the stack, define this to create a @samp{mem} which refers to the
                   7304: frame pointer.  If the value is a @samp{mem}, the compiler assumes it
                   7305: is for an invisible first argument, and leaves space for it when
                   7306: finding the first real argument.
                   7307: 
                   7308: @item REG_ALLOC_ORDER
                   7309: If defined, an initializer for a vector of integers, containing the
                   7310: numbers of hard registers in the order in which the GNU CC should
                   7311: prefer to use them (from most preferred to least).
                   7312: 
                   7313: If this macro is not defined, registers are used lowest numbered first
                   7314: (all else being equal).
                   7315: 
                   7316: One use of this macro is on the 360, where the highest numbered
                   7317: registers must always be saved and the save-multiple-registers
                   7318: instruction supports only sequences of consecutive registers.  This
                   7319: macro is defined to cause the highest numbered allocatable registers
                   7320: to be used first.
                   7321: @end table
                   7322: 
                   7323: @node Register Classes, Stack Layout, Registers, Machine Macros
                   7324: @section Register Classes
                   7325: 
                   7326: On many machines, the numbered registers are not all equivalent.
                   7327: For example, certain registers may not be allowed for indexed addressing;
                   7328: certain registers may not be allowed in some instructions.  These machine
                   7329: restrictions are described to the compiler using @dfn{register classes}.
                   7330: 
                   7331: You define a number of register classes, giving each one a name and saying
                   7332: which of the registers belong to it.  Then you can specify register classes
                   7333: that are allowed as operands to particular instruction patterns.
                   7334: 
                   7335: In general, each register will belong to several classes.  In fact, one
                   7336: class must be named @code{ALL_REGS} and contain all the registers.  Another
                   7337: class must be named @code{NO_REGS} and contain no registers.  Often the
                   7338: union of two classes will be another class; however, this is not required.
                   7339: 
                   7340: One of the classes must be named @code{GENERAL_REGS}.  There is nothing
                   7341: terribly special about the name, but the operand constraint letters
                   7342: @samp{r} and @samp{g} specify this class.  If @code{GENERAL_REGS} is
                   7343: the same as @code{ALL_REGS}, just define it as a macro which expands
                   7344: to @code{ALL_REGS}.
                   7345: 
                   7346: The way classes other than @code{GENERAL_REGS} are specified in operand
                   7347: constraints is through machine-dependent operand constraint letters.
                   7348: You can define such letters to correspond to various classes, then use
                   7349: them in operand constraints.
                   7350: 
                   7351: You should define a class for the union of two classes whenever some
                   7352: instruction allows both classes.  For example, if an instruction allows
                   7353: either a floating-point (coprocessor) register or a general register for a
                   7354: certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
                   7355: which includes both of them.  Otherwise you will get suboptimal code.
                   7356: 
                   7357: You must also specify certain redundant information about the register
                   7358: classes: for each class, which classes contain it and which ones are
                   7359: contained in it; for each pair of classes, the largest class contained
                   7360: in their union.
                   7361: 
                   7362: Register classes used for input-operands of bitwise-and or shift
                   7363: instructions have a special requirement: each such class must have, for
                   7364: each fixed-point machine mode, a subclass whose registers can transfer that
                   7365: mode to or from memory.  For example, on some machines, the operations for
                   7366: single-byte values (@code{QImode}) are limited to certain registers.  When
                   7367: this is so, each register class that is used in a bitwise-and or shift
                   7368: instruction must have a subclass consisting of registers from which
                   7369: single-byte values can be loaded or stored.  This is so that
                   7370: @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
                   7371: 
                   7372: @table @code
                   7373: @item enum reg_class
                   7374: An enumeral type that must be defined with all the register class names
                   7375: as enumeral values.  @code{NO_REGS} must be first.  @code{ALL_REGS}
                   7376: must be the last register class, followed by one more enumeral value,
                   7377: @code{LIM_REG_CLASSES}, which is not a register class but rather
                   7378: tells how many classes there are.
                   7379: 
                   7380: Each register class has a number, which is the value of casting
                   7381: the class name to type @code{int}.  The number serves as an index
                   7382: in many of the tables described below.
                   7383: 
                   7384: @item N_REG_CLASSES
                   7385: The number of distinct register classes, defined as follows:
                   7386: 
                   7387: @example
                   7388: #define N_REG_CLASSES (int) LIM_REG_CLASSES
                   7389: @end example
                   7390: 
                   7391: @item REG_CLASS_NAMES
                   7392: An initializer containing the names of the register classes as C string
                   7393: constants.  These names are used in writing some of the debugging dumps.
                   7394: 
                   7395: @item REG_CLASS_CONTENTS
                   7396: An initializer containing the contents of the register classes, as integers
                   7397: which are bit masks.  The @var{n}th integer specifies the contents of class
                   7398: @var{n}.  The way the integer @var{mask} is interpreted is that
                   7399: register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
                   7400: 
                   7401: When the machine has more than 32 registers, an integer does not suffice.
                   7402: Then the integers are replaced by sub-initializers, braced groupings containing
                   7403: several integers.  Each sub-initializer must be suitable as an initializer
                   7404: for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
                   7405: 
                   7406: @item REGNO_REG_CLASS (@var{regno})
                   7407: A C expression whose value is a register class containing hard register
                   7408: @var{regno}.  In general there is more that one such class; choose a class
                   7409: which is @dfn{minimal}, meaning that no smaller class also contains the
                   7410: register.
                   7411: 
                   7412: @item BASE_REG_CLASS
                   7413: A macro whose definition is the name of the class to which a valid
                   7414: base register must belong.  A base register is one used in an address
                   7415: which is the register value plus a displacement.
                   7416: 
                   7417: @item INDEX_REG_CLASS
                   7418: A macro whose definition is the name of the class to which a valid
                   7419: index register must belong.  An index register is one used in an
                   7420: address where its value is either multiplied by a scale factor or
                   7421: added to another register (as well as added to a displacement).
                   7422: 
                   7423: @item REG_CLASS_FROM_LETTER (@var{char})
                   7424: A C expression which defines the machine-dependent operand constraint
                   7425: letters for register classes.  If @var{char} is such a letter, the
                   7426: value should be the register class corresponding to it.  Otherwise,
                   7427: the value should be @code{NO_REGS}.
                   7428: 
                   7429: @item REGNO_OK_FOR_BASE_P (@var{num})
                   7430: A C expression which is nonzero if register number @var{num} is
                   7431: suitable for use as a base register in operand addresses.  It may be
                   7432: either a suitable hard register or a pseudo register that has been
                   7433: allocated such a hard register.
                   7434: 
                   7435: @item REGNO_OK_FOR_INDEX_P (@var{num})
                   7436: A C expression which is nonzero if register number @var{num} is
                   7437: suitable for use as an index register in operand addresses.  It may be
                   7438: either a suitable hard register or a pseudo register that has been
                   7439: allocated such a hard register.
                   7440: 
                   7441: The difference between an index register and a base register is that
                   7442: the index register may be scaled.  If an address involves the sum of
                   7443: two registers, neither one of them scaled, then either one may be
                   7444: labeled the ``base'' and the other the ``index''; but whichever
                   7445: labeling is used must fit the machine's constraints of which registers
                   7446: may serve in each capacity.  The compiler will try both labelings,
                   7447: looking for one that is valid, and will reload one or both registers
                   7448: only if neither labeling works.
                   7449: 
                   7450: @item PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
                   7451: A C expression that places additional restrictions on the register class
                   7452: to use when it is necessary to copy value @var{x} into a register in class
                   7453: @var{class}.  The value is a register class; perhaps @var{class}, or perhaps
                   7454: another, smaller class.  On many machines, the definition
                   7455: 
                   7456: @example
                   7457: #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
                   7458: @end example
                   7459: 
                   7460: @noindent
                   7461: is safe.
                   7462: 
                   7463: Sometimes returning a more restrictive class makes better code.  For
                   7464: example, on the 68000, when @var{x} is an integer constant that is in range
                   7465: for a @samp{moveq} instruction, the value of this macro is always
                   7466: @code{DATA_REGS} as long as @var{class} includes the data registers.
                   7467: Requiring a data register guarantees that a @samp{moveq} will be used.
                   7468: 
                   7469: If @var{x} is a @samp{const_double}, by returning @code{NO_REGS}
                   7470: you can force @var{x} into a memory constant.  This is useful on
                   7471: certain machines where immediate floating values cannot be loaded into
                   7472: certain kinds of registers.
                   7473: 
                   7474: In a shift instruction or a bitwise-and instruction, the mode of @var{x},
                   7475: the value being reloaded, may not be the same as the mode of the
                   7476: instruction's operand.  (They will both be fixed-point modes, however.)  In
                   7477: such a case, @var{class} may not be a safe value to return.  @var{class} is
                   7478: certainly valid for the instruction, but it may not be valid for reloading
                   7479: @var{x}.  This problem can occur on machines such as the 68000 and 80386
                   7480: where some registers can handle full-word values but cannot handle
                   7481: single-byte values.
                   7482: 
                   7483: On such machines, this macro must examine the mode of @var{x} and return a
                   7484: subclass of @var{class} which can handle loads and stores of that mode.  On
                   7485: the 68000, where address registers cannot handle @code{QImode}, if @var{x}
                   7486: has @code{QImode} then you must return @code{DATA_REGS}.  If @var{class} is
                   7487: @code{ADDR_REGS}, then there is no correct value to return; but the shift
                   7488: and bitwise-and instructions don't use @code{ADDR_REGS}, so this fatal case
                   7489: never arises.
                   7490: 
                   7491: @item CLASS_MAX_NREGS (@var{class}, @var{mode})
                   7492: A C expression for the maximum number of consecutive registers
                   7493: of class @var{class} needed to hold a value of mode @var{mode}.
                   7494: 
                   7495: This is closely related to the macro @code{HARD_REGNO_NREGS}.
                   7496: In fact, the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
                   7497: should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno}, @var{mode})}
                   7498: for all @var{regno} values in the class @var{class}.
                   7499: 
                   7500: This macro helps control the handling of multiple-word values
                   7501: in the reload pass.
                   7502: @end table
                   7503: 
                   7504: Two other special macros describe which constants fit which constraint
                   7505: letters.
                   7506: 
                   7507: @table @code
                   7508: @item CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
                   7509: A C expression that defines the machine-dependent operand constraint letters
                   7510: that specify particular ranges of integer values.  If @var{c} is one
                   7511: of those letters, the expression should check that @var{value}, an integer,
                   7512: is in the appropriate range and return 1 if so, 0 otherwise.  If @var{c} is
                   7513: not one of those letters, the value should be 0 regardless of @var{value}.
                   7514: 
                   7515: @item CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
                   7516: A C expression that defines the machine-dependent operand constraint
                   7517: letters that specify particular ranges of floating values.  If @var{c} is
                   7518: one of those letters, the expression should check that @var{value}, an RTX
                   7519: of code @samp{const_double}, is in the appropriate range and return 1 if
                   7520: so, 0 otherwise.  If @var{c} is not one of those letters, the value should
                   7521: be 0 regardless of @var{value}.
                   7522: @end table
                   7523: 
                   7524: @node Stack Layout, Library Names, Register Classes, Machine Macros
                   7525: @section Describing Stack Layout
                   7526: 
                   7527: @table @code
                   7528: @item STACK_GROWS_DOWNWARD
                   7529: Define this macro if pushing a word onto the stack moves the stack
                   7530: pointer to a smaller address.
                   7531: 
                   7532: When we say, ``define this macro if @dots{},'' it means that the
                   7533: compiler checks this macro only with @code{#ifdef} so the precise
                   7534: definition used does not matter.
                   7535: 
                   7536: @item FRAME_GROWS_DOWNWARD
                   7537: Define this macro if the addresses of local variable slots are at negative
                   7538: offsets from the frame pointer.
                   7539: 
                   7540: @item STARTING_FRAME_OFFSET
                   7541: Offset from the frame pointer to the first local variable slot to be allocated.
                   7542: 
                   7543: If @code{FRAME_GROWS_DOWNWARD}, the next slot's offset is found by
                   7544: subtracting the length of the first slot from @code{STARTING_FRAME_OFFSET}.
                   7545: Otherwise, it is found by adding the length of the first slot to
                   7546: the value @code{STARTING_FRAME_OFFSET}.
                   7547: 
                   7548: @item PUSH_ROUNDING (@var{npushed})
                   7549: A C expression that is the number of bytes actually pushed onto the
                   7550: stack when an instruction attempts to push @var{npushed} bytes.
                   7551: 
                   7552: If the target machine does not have a push instruction, do not define
                   7553: this macro.  That directs GNU CC to use an alternate strategy: to
                   7554: allocate the entire argument block and then store the arguments into
                   7555: it.
                   7556: 
                   7557: On some machines, the definition
                   7558: 
                   7559: @example
                   7560: #define PUSH_ROUNDING(BYTES) (BYTES)
                   7561: @end example
                   7562: 
                   7563: @noindent
                   7564: will suffice.  But on other machines, instructions that appear
                   7565: to push one byte actually push two bytes in an attempt to maintain
                   7566: alignment.  Then the definition should be
                   7567: 
                   7568: @example
                   7569: #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
                   7570: @end example
                   7571: 
                   7572: @item FIRST_PARM_OFFSET (@var{fundecl})
                   7573: Offset from the argument pointer register to the first argument's
                   7574: address.  On some machines it may depend on the data type of the
                   7575: function.  (In the next version of GNU CC, the argument will be
                   7576: changed to the function data type rather than its declaration.)
                   7577: 
                   7578: @item FIRST_PARM_CALLER_OFFSET (@var{fundecl})
                   7579: Define this macro on machines where register parameters have shadow
                   7580: locations on the stack, at addresses below the nominal parameter.
                   7581: This matters because certain arguments cannot be passed on the stack.
                   7582: On these machines, such arguments must be stored into the shadow
                   7583: locations.
                   7584: 
                   7585: This macro should expand into a C expression whose value is the offset
                   7586: of the first parameter's shadow location from the nominal stack
                   7587: pointer value.  (That value is itself computed by adding the value of
                   7588: @code{STACK_POINTER_OFFSET} to the stack pointer register.)
                   7589: 
1.1.1.6 ! root     7590: @item STACK_ARGS_ADJUST (@var{size})
        !          7591: Define this macro if the machine requires padding on the stack for
        !          7592: certain function calls.  This is padding on a per-function-call basis,
        !          7593: not padding for individual arguments.
        !          7594: 
        !          7595: The definition should be a C expression for the total size to be
        !          7596: pushed on the stack in a call whose arguments (including their
        !          7597: individual padding) occupy @var{size} bytes.
        !          7598: 
1.1       root     7599: @item RETURN_POPS_ARGS (@var{funtype})
                   7600: A C expression that should be 1 if a function pops its own arguments
                   7601: on returning, or 0 if the function pops no arguments and the caller
                   7602: must therefore pop them all after the function returns.
                   7603: 
                   7604: @var{funtype} is a C variable whose value is a tree node that
                   7605: describes the function in question.  Normally it is a node of type
                   7606: @code{FUNCTION_TYPE} that describes the data type of the function.
                   7607: From this it is possible to obtain the data types of the value and
                   7608: arguments (if known).
                   7609: 
                   7610: When a call to a library function is being considered, @var{funtype}
                   7611: will contain an identifier node for the library function.  Thus, if
                   7612: you need to distinguish among various library functions, you can do so
                   7613: by their names.  Note that ``library function'' in this context means
                   7614: a function used to perform arithmetic, whose name is known specially
                   7615: in the compiler and was not mentioned in the C code being compiled.
                   7616: 
                   7617: On the Vax, all functions always pop their arguments, so the
                   7618: definition of this macro is 1.  On the 68000, using the standard
                   7619: calling convention, no functions pop their arguments, so the value of
                   7620: the macro is always 0 in this case.  But an alternative calling
                   7621: convention is available in which functions that take a fixed number of
                   7622: arguments pop them but other functions (such as @code{printf}) pop
                   7623: nothing (the caller pops all).  When this convention is in use,
                   7624: @var{funtype} is examined to determine whether a function takes a
                   7625: fixed number of arguments.
                   7626: 
                   7627: @item FUNCTION_VALUE (@var{valtype}, @var{func})
                   7628: A C expression to create an RTX representing the place where a
                   7629: function returns a value of data type @var{valtype}.  @var{valtype} is
                   7630: a tree node representing a data type.  Write @code{TYPE_MODE
                   7631: (@var{valtype})} to get the machine mode used to represent that type.
                   7632: On many machines, only the mode is relevant.  (Actually, on most
                   7633: machines, scalar values are returned in the same place regardless of
                   7634: mode).@refill
                   7635: 
                   7636: If the precise function being called is known, @var{func} is a tree
                   7637: node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
                   7638: pointer.  This makes it possible to use a different value-returning
                   7639: convention for specific functions when all their calls are
                   7640: known.@refill
                   7641: 
                   7642: @item FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
                   7643: Define this macro if the target machine has ``register windows''
                   7644: so that the register in which a function returns its value is not
                   7645: the same as the one in which the caller sees the value.
                   7646: 
                   7647: For such machines, @code{FUNCTION_VALUE} computes the register in
                   7648: which the caller will see the value, and
                   7649: @code{FUNCTION_OUTGOING_VALUE} should be defined in a similar fashion
                   7650: to tell the function where to put the value.@refill
                   7651: 
                   7652: If @code{FUNCTION_OUTGOING_VALUE} is not defined,
                   7653: @code{FUNCTION_VALUE} serves both purposes.@refill
                   7654: 
                   7655: @item LIBCALL_VALUE (@var{mode})
                   7656: A C expression to create an RTX representing the place where a library
                   7657: function returns a value of mode @var{mode}.  If the precise function
                   7658: being called is known, @var{func} is a tree node
                   7659: (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
                   7660: pointer.  This makes it possible to use a different value-returning
                   7661: convention for specific functions when all their calls are
                   7662: known.@refill
                   7663: 
                   7664: Note that ``library function'' in this context means a compiler
                   7665: support routine, used to perform arithmetic, whose name is known
                   7666: specially by the compiler and was not mentioned in the C code being
                   7667: compiled.
                   7668: 
                   7669: @item FUNCTION_VALUE_REGNO_P (@var{regno})
                   7670: A C expression that is nonzero if @var{regno} is the number of a hard
                   7671: register in which the values of called function may come back.
                   7672: 
                   7673: A register whose use for returning values is limited to serving as the
                   7674: second of a pair (for a value of type @code{double}, say) need not be
                   7675: recognized by this macro.  So for most machines, this definition
                   7676: suffices:
                   7677: 
                   7678: @example
                   7679: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
                   7680: @end example
                   7681: 
                   7682: If the machine has register windows, so that the caller and the called
                   7683: function use different registers for the return value, this macro
                   7684: should recognize only the caller's register numbers.
                   7685: 
                   7686: @item FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
                   7687: A C expression that controls whether a function argument is passed
                   7688: in a register, and which register.
                   7689: 
                   7690: The arguments are @var{cum}, which summarizes all the previous
                   7691: arguments; @var{mode}, the machine mode of the argument; @var{type},
                   7692: the data type of the argument as a tree node or 0 if that is not known
                   7693: (which happens for C support library functions); and @var{named},
                   7694: which is 1 for an ordinary argument and 0 for nameless arguments that
                   7695: correspond to @samp{...} in the called function's prototype.
                   7696: 
                   7697: The value of the expression should either be a @samp{reg} RTX for the
                   7698: hard register in which to pass the argument, or zero to pass the
                   7699: argument on the stack.
                   7700: 
                   7701: For the Vax and 68000, where normally all arguments are pushed, zero
                   7702: suffices as a definition.
                   7703: 
                   7704: @item FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
                   7705: Define this macro if the target machine has ``register windows'', so
                   7706: that the register in which a function sees an arguments is not
                   7707: necessarily the same as the one in which the caller passed the
                   7708: argument.
                   7709: 
                   7710: For such machines, @code{FUNCTION_ARG} computes the register in which
                   7711: the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
                   7712: be defined in a similar fashion to tell the function being called
                   7713: where the arguments will arrive.
                   7714: 
                   7715: If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
                   7716: serves both purposes.@refill
                   7717: 
                   7718: @item FUNCTION_ARG_PARTIAL_NREGS (@var{cum}, @var{mode}, @var{type}, @var{named})
                   7719: A C expression for the number of words, at the beginning of an
                   7720: argument, must be put in registers.  The value must be zero for
                   7721: arguments that are passed entirely in registers or that are entirely
                   7722: pushed on the stack.
                   7723: 
                   7724: On some machines, certain arguments must be passed partially in
                   7725: registers and partially in memory.  On these machines, typically the
                   7726: first @var{n} words of arguments are passed in registers, and the rest
                   7727: on the stack.  If a multi-word argument (a @code{double} or a
                   7728: structure) crosses that boundary, its first few words must be passed
                   7729: in registers and the rest must be pushed.  This macro tells the
                   7730: compiler when this occurs, and how many of the words should go in
                   7731: registers.
                   7732: 
                   7733: @code{FUNCTION_ARG} for these arguments should return the first
                   7734: register to be used by the caller for this argument; likewise
                   7735: @code{FUNCTION_INCOMING_ARG}, for the called function.
                   7736: 
                   7737: @item CUMULATIVE_ARGS
                   7738: A C type for declaring a variable that is used as the first argument
                   7739: of @code{FUNCTION_ARG} and other related values.  For some target
                   7740: machines, the type @code{int} suffices and can hold the number of
                   7741: bytes of argument so far.
                   7742: 
                   7743: @item INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype})
                   7744: A C statement (sans semicolon) for initializing the variable @var{cum}
                   7745: for the state at the beginning of the argument list.  The variable has
                   7746: type @code{CUMULATIVE_ARGS}.  The value of @var{fntype} is the tree node
                   7747: for the data type of the function which will receive the args, or 0
                   7748: if the args are to a compiler support library function.
                   7749: 
                   7750: @item FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
                   7751: Update the summarizer variable @var{cum} to advance past an argument
                   7752: in the argument list.  The values @var{mode}, @var{type} and
                   7753: @var{named} describe that argument.  Once this is done, the variable
                   7754: @var{cum} is suitable for analyzing the @emph{following} argument
                   7755: with @code{FUNCTION_ARG}, etc.@refill
                   7756: 
                   7757: @item FUNCTION_ARG_REGNO_P (@var{regno})
                   7758: A C expression that is nonzero if @var{regno} is the number of a hard
                   7759: register in which function arguments are sometimes passed.  This does
                   7760: @emph{not} include implicit arguments such as the static chain and
                   7761: the structure-value address.  On many machines, no registers can be
                   7762: used for this purpose since all function arguments are pushed on the
                   7763: stack.
                   7764: 
                   7765: @item FUNCTION_ARG_PADDING (@var{mode}, @var{size})
                   7766: If defined, a C expression which determines whether, and in which direction,
                   7767: to pad out an argument with extra space.  The value should be of type
                   7768: @code{enum direction}: either @code{upward} to pad above the argument,
                   7769: @code{downward} to pad below, or @code{none} to inhibit padding.
                   7770: 
                   7771: The argument @var{size} is an RTX which describes the size of the
                   7772: argument, in bytes.  It should be used only if @var{mode} is
                   7773: @code{BLKmode}.  Otherwise, @var{size} is 0.
                   7774: 
                   7775: This macro does not control the @emph{amount} of padding; that is
                   7776: always just enough to reach the next multiple of @code{PARM_BOUNDARY}.
                   7777: 
                   7778: This macro has a default definition which is right for most systems.
                   7779: For little-endian machines, the default is to pad upward.  For
                   7780: big-endian machines, the default is to pad downward for an argument of
                   7781: constant size shorter than an @code{int}, and upward otherwise.
                   7782: 
                   7783: @item FUNCTION_PROLOGUE (@var{file}, @var{size})
                   7784: A C compound statement that outputs the assembler code for entry to a
                   7785: function.  The prologue is responsible for setting up the stack frame,
                   7786: initializing the frame pointer register, saving registers that must be
                   7787: saved, and allocating @var{size} additional bytes of storage for the
                   7788: local variables.  @var{size} is an integer.  @var{file} is a stdio
                   7789: stream to which the assembler code should be output.
                   7790: 
                   7791: The label for the beginning of the function need not be output by this
                   7792: macro.  That has already been done when the macro is run.
                   7793: 
                   7794: To determine which registers to save, the macro can refer to the array
                   7795: @code{regs_ever_live}: element @var{r} is nonzero if hard register
                   7796: @var{r} is used anywhere within the function.  This implies the
                   7797: function prologue should save register @var{r}, but not if it is one
                   7798: of the call-used registers.
                   7799: 
                   7800: On machines where functions may or may not have frame-pointers, the
                   7801: function entry code must vary accordingly; it must set up the frame
                   7802: pointer if one is wanted, and not otherwise.  To determine whether a
                   7803: frame pointer is in wanted, the macro can refer to the variable
                   7804: @code{frame_pointer_needed}.  The variable's value will be 1 at run
                   7805: time in a function that needs a frame pointer.
                   7806: 
                   7807: @item FUNCTION_PROFILER (@var{file}, @var{labelno})
                   7808: A C statement or compound statement to output to @var{file} some
                   7809: assembler code to call the profiling subroutine @code{mcount}.
                   7810: Before calling, the assembler code must load the address of a
                   7811: counter variable into a register where @code{mcount} expects to
                   7812: find the address.  The name of this variable is @samp{LP} followed
                   7813: by the number @var{labelno}, so you would generate the name using
                   7814: @samp{LP%d} in a @code{fprintf}.
                   7815: 
                   7816: The details of how the address should be passed to @code{mcount} are
                   7817: determined by your operating system environment, not by GNU CC.  To
                   7818: figure them out, compile a small program for profiling using the
                   7819: system's installed C compiler and look at the assembler code that
                   7820: results.
                   7821: 
1.1.1.6 ! root     7822: @item FUNCTION_BLOCK_PROFILER (@var{file}, @var{labelno})
        !          7823: A C statement or compound statement to output to @var{file} some
        !          7824: assembler code to initialize basic-block profiling for the current
        !          7825: object module.  This code should call the subroutine
        !          7826: @code{__bb_init_func} once per object module, passing it as its sole
        !          7827: argument the address of a block allocated in the object module.
        !          7828: 
        !          7829: The name of the block is a local symbol made with this statement:
        !          7830: 
        !          7831: @example
        !          7832: ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
        !          7833: @end example
        !          7834: 
        !          7835: Of course, since you are writing the definition of
        !          7836: @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
        !          7837: can take a short cut in the definition of this macro and use the name
        !          7838: that you know will result.
        !          7839: 
        !          7840: The first word of this block is a flag which will be nonzero if the
        !          7841: object module has already been initialized.  So test this word first,
        !          7842: and do not call @code{__bb_init_func} if the flag is nonzero.
        !          7843: 
        !          7844: @item BLOCK_PROFILER (@var{file}, @var{blockno})
        !          7845: A C statement or compound statement to increment the count associated
        !          7846: with the basic block number @var{blockno}.  Basic blocks are numbered
        !          7847: separately from zero within each compilation.  The count associated
        !          7848: with block number @var{blockno} is at index @var{blockno} in a vector
        !          7849: of words; the name of this array is a local symbol made with this
        !          7850: statement:
        !          7851: 
        !          7852: @example
        !          7853: ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 2);
        !          7854: @end example
        !          7855: 
        !          7856: Of course, since you are writing the definition of
        !          7857: @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
        !          7858: can take a short cut in the definition of this macro and use the name
        !          7859: that you know will result.
        !          7860: 
1.1       root     7861: @item EXIT_IGNORES_STACK
                   7862: Define this macro as a C expression that is nonzero if the return
                   7863: instruction or the function epilogue ignores the value of the stack
                   7864: pointer; in other words, if it is safe to delete an instruction to
                   7865: adjust the stack pointer before a return from the function.
                   7866: 
                   7867: Note that this macro's value is relevant only for for which frame
                   7868: pointers are maintained.  It is never possible to delete a final stack
                   7869: adjustment in a function that has no frame pointer, and the compiler
                   7870: knows this regardless of @code{EXIT_IGNORES_STACK}.
                   7871: 
                   7872: @item FUNCTION_EPILOGUE (@var{file}, @var{size})
                   7873: A C compound statement that outputs the assembler code for exit from a
                   7874: function.  The epilogue is responsible for restoring the saved
                   7875: registers and stack pointer to their values when the function was
                   7876: called, and returning control to the caller.  This macro takes the
                   7877: same arguments as the macro @code{FUNCTION_PROLOGUE}, and the
                   7878: registers to restore are determined from @code{regs_ever_live} and
                   7879: @code{CALL_USED_REGISTERS} in the same way.
                   7880: 
                   7881: On some machines, there is a single instruction that does all the work
                   7882: of returning from the function.  On these machines, give that
                   7883: instruction the name @samp{return} and do not define the macro
                   7884: @code{FUNCTION_EPILOGUE} at all.
                   7885: 
                   7886: Do not define a pattern named @samp{return} if you want the
                   7887: @code{FUNCTION_EPILOGUE} to be used.  If you want the target switches
                   7888: to control whether return instructions or epilogues are used, define a
                   7889: @samp{return} pattern with a validity condition that tests the target
                   7890: switches appropriately.  If the @samp{return} pattern's validity
                   7891: condition is false, epilogues will be used.
                   7892: 
                   7893: On machines where functions may or may not have frame-pointers, the
                   7894: function exit code must vary accordingly.  Sometimes the code for
                   7895: these two cases is completely different.  To determine whether a frame
                   7896: pointer is in wanted, the macro can refer to the variable
                   7897: @code{frame_pointer_needed}.  The variable's value will be 1 at run
                   7898: time in a function that needs a frame pointer.
                   7899: 
                   7900: On some machines, some functions pop their arguments on exit while
                   7901: others leave that for the caller to do.  For example, the 68020 when
                   7902: given @samp{-mrtd} pops arguments in functions that take a fixed
                   7903: number of arguments.
                   7904: 
                   7905: Your definition of the macro @code{RETURN_POPS_ARGS} decides which
                   7906: functions pop their own arguments.  @code{FUNCTION_EPILOGUE} needs to
                   7907: know what was decided.  The variable @code{current_function_pops_args}
                   7908: is nonzero if the function should pop its own arguments.  If so, use
                   7909: the variable @code{current_function_args_size} as the number of bytes
                   7910: to pop.
                   7911: 
                   7912: @item FIX_FRAME_POINTER_ADDRESS (@var{addr}, @var{depth})
                   7913: A C compound statement to alter a memory address that uses the frame
                   7914: pointer register so that it uses the stack pointer register instead.
                   7915: This must be done in the instructions that load parameter values into
                   7916: registers, when the reload pass determines that a frame pointer is not
                   7917: necessary for the function.  @var{addr} will be a C variable name, and
                   7918: the updated address should be stored in that variable.  @var{depth}
                   7919: will be the current depth of stack temporaries (number of bytes of
                   7920: arguments currently pushed).  The change in offset between a
                   7921: frame-pointer-relative address and a stack-pointer-relative address
                   7922: must include @var{depth}.
                   7923: 
                   7924: Even if your machine description specifies there will always be a
                   7925: frame pointer in the frame pointer register, you must still define
                   7926: @code{FIX_FRAME_POINTER_ADDRESS}, but the definition will never be
                   7927: executed at run time, so it may be empty.
                   7928: @end table
                   7929: 
                   7930: @node Library Names, Addressing Modes, Stack Layout, Machine Macros
                   7931: @section Library Subroutine Names
                   7932: 
                   7933: @table @code
1.1.1.5   root     7934: @item MULSI3_LIBCALL
                   7935: A C string constant giving the name of the function to call for
                   7936: multiplication of one signed full-word by another.  If you do not
                   7937: define this macro, the default name is used, which is @code{__mulsi3},
                   7938: a function defined in @file{gnulib}.
                   7939: 
                   7940: @item UMULSI3_LIBCALL
                   7941: A C string constant giving the name of the function to call for
                   7942: multiplication of one unsigned full-word by another.  If you do not
                   7943: define this macro, the default name is used, which is
                   7944: @code{__umulsi3}, a function defined in @file{gnulib}.
                   7945: 
                   7946: @item DIVSI3_LIBCALL
                   7947: A C string constant giving the name of the function to call for
                   7948: division of one signed full-word by another.  If you do not define
                   7949: this macro, the default name is used, which is @code{__divsi3}, a
                   7950: function defined in @file{gnulib}.
                   7951: 
1.1       root     7952: @item UDIVSI3_LIBCALL
                   7953: A C string constant giving the name of the function to call for
1.1.1.5   root     7954: division of one unsigned full-word by another.  If you do not define
                   7955: this macro, the default name is used, which is @code{__udivsi3}, a
                   7956: function defined in @file{gnulib}.
                   7957: 
                   7958: @item MODSI3_LIBCALL
                   7959: A C string constant giving the name of the function to call for the
                   7960: remainder in division of one signed full-word by another.  If you do
                   7961: not define this macro, the default name is used, which is
                   7962: @code{__modsi3}, a function defined in @file{gnulib}.
1.1       root     7963: 
                   7964: @item UMODSI3_LIBCALL
                   7965: A C string constant giving the name of the function to call for the
1.1.1.5   root     7966: remainder in division of one unsigned full-word by another.  If you do
                   7967: not define this macro, the default name is used, which is
                   7968: @code{__umodsi3}, a function defined in @file{gnulib}.
1.1       root     7969: 
                   7970: @item TARGET_MEM_FUNCTIONS
                   7971: Define this macro if GNU CC should generate calls to the System V
                   7972: (and ANSI C) library functions @code{memcpy} and @code{memset}
                   7973: rather than the BSD functions @code{bcopy} and @code{bzero}.
                   7974: @end table
                   7975: 
1.1.1.5   root     7976: @node Addressing Modes, Cross-compilation, Library Names, Machine Macros
1.1       root     7977: @section Addressing Modes
                   7978: 
                   7979: @table @code
                   7980: @item HAVE_POST_INCREMENT
                   7981: Define this macro if the machine supports post-increment addressing.
                   7982: 
                   7983: @item HAVE_PRE_INCREMENT
                   7984: @itemx HAVE_POST_DECREMENT
                   7985: @itemx HAVE_PRE_DECREMENT
                   7986: Similar for other kinds of addressing.
                   7987: 
                   7988: @item CONSTANT_ADDRESS_P (@var{x})
                   7989: A C expression that is 1 if the RTX @var{x} is a constant whose value
                   7990: is an integer.  This includes integers whose values are not explicitly
                   7991: known, such as @samp{symbol_ref} and @samp{label_ref} expressions and
                   7992: @samp{const} arithmetic expressions.
                   7993: 
                   7994: On most machines, this can be defined as @code{CONSTANT_P (@var{x})},
                   7995: but a few machines are more restrictive in which constant addresses
                   7996: are supported.
                   7997: 
                   7998: @item MAX_REGS_PER_ADDRESS
                   7999: A number, the maximum number of registers that can appear in a valid
                   8000: memory address.
                   8001: 
                   8002: @item GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
                   8003: A C compound statement with a conditional @code{goto @var{label};}
                   8004: executed if @var{x} (an RTX) is a legitimate memory address on the
                   8005: target machine for a memory operand of mode @var{mode}.
                   8006: 
                   8007: It usually pays to define several simpler macros to serve as
                   8008: subroutines for this one.  Otherwise it may be too complicated to
                   8009: understand.
                   8010: 
                   8011: This macro must exist in two variants: a strict variant and a
                   8012: non-strict one.  The strict variant is used in the reload pass.  It
                   8013: must be defined so that any pseudo-register that has not been
                   8014: allocated a hard register is considered a memory reference.  In
                   8015: contexts where some kind of register is required, a pseudo-register
                   8016: with no hard register must be rejected.
                   8017: 
                   8018: The non-strict variant is used in other passes.  It must be defined to
                   8019: accept all pseudo-registers in every context where some kind of
                   8020: register is required.
                   8021: 
                   8022: Compiler source files that want to use the strict variant of this
                   8023: macro define the macro @code{REG_OK_STRICT}.  You should use an
                   8024: @code{#ifdef REG_OK_STRICT} conditional to define the strict variant
                   8025: in that case and the non-strict variant otherwise.
                   8026: 
                   8027: Typically among the subroutines used to define
                   8028: @code{GO_IF_LEGITIMATE_ADDRESS} are subroutines to check for
                   8029: acceptable registers for various purposes (one for base registers, one
                   8030: for index registers, and so on).  Then only these subroutine macros
                   8031: need have two variants; the higher levels of macros may be the same
                   8032: whether strict or not.@refill
                   8033: 
                   8034: @item REG_OK_FOR_BASE_P (@var{x})
1.1.1.5   root     8035: A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
1.1       root     8036: RTX) is valid for use as a base register.  For hard registers, it
                   8037: should always accept those which the hardware permits and reject the
                   8038: others.  Whether the macro accepts or rejects pseudo registers must be
                   8039: controlled by @code{REG_OK_STRICT} as described above.  This usually
                   8040: requires two variant definitions, of which @code{REG_OK_STRICT}
                   8041: controls the one actually used.
                   8042: 
                   8043: @item REG_OK_FOR_INDEX_P (@var{x})
1.1.1.5   root     8044: A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
1.1       root     8045: RTX) is valid for use as an index register.
                   8046: 
                   8047: The difference between an index register and a base register is that
                   8048: the index register may be scaled.  If an address involves the sum of
                   8049: two registers, neither one of them scaled, then either one may be
                   8050: labeled the ``base'' and the other the ``index''; but whichever
                   8051: labeling is used must fit the machine's constraints of which registers
                   8052: may serve in each capacity.  The compiler will try both labelings,
                   8053: looking for one that is valid, and will reload one or both registers
                   8054: only if neither labeling works.
                   8055: 
                   8056: @item LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
                   8057: A C compound statement that attempts to replace @var{x} with a valid
                   8058: memory address for an operand of mode @var{mode}.  @var{win} will be a
                   8059: C statement label elsewhere in the code; the macro definition may use
                   8060: 
                   8061: @example
                   8062: GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
                   8063: @end example
                   8064: 
                   8065: @noindent
                   8066: to avoid further processing if the address has become legitimate.
                   8067: 
                   8068: @var{x} will always be the result of a call to @code{break_out_memory_refs},
                   8069: and @var{oldx} will be the operand that was given to that function to produce
                   8070: @var{x}.
                   8071: 
                   8072: The code generated by this macro should not alter the substructure of
                   8073: @var{x}.  If it transforms @var{x} into a more legitimate form, it
                   8074: should assign @var{x} (which will always be a C variable) a new value.
                   8075: 
                   8076: It is not necessary for this macro to come up with a legitimate
                   8077: address.  The compiler has standard ways of doing so in all cases.  In
                   8078: fact, it is safe for this macro to do nothing.  But often a
                   8079: machine-dependent strategy can generate better code.
                   8080: 
                   8081: @item GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
                   8082: A C statement or compound statement with a conditional @code{goto
                   8083: @var{label};} executed if memory address @var{x} (an RTX) can have
                   8084: different meanings depending on the machine mode of the memory
                   8085: reference it is used for.
                   8086: 
                   8087: Autoincrement and autodecrement addresses typically have mode-dependent
                   8088: effects because the amount of the increment or decrement is the size
                   8089: of the operand being addressed.  Some machines have other mode-dependent
                   8090: addresses.  Many RISC machines have no mode-dependent addresses.
                   8091: 
                   8092: You may assume that @var{addr} is a valid address for the machine.
                   8093: 
                   8094: @item LEGITIMATE_CONSTANT_P (@var{x})
                   8095: A C expression that is nonzero if @var{x} is a legitimate constant for
                   8096: an immediate operand on the target machine.  You can assume that
                   8097: either @var{x} is a @samp{const_double} or it satisfies
                   8098: @code{CONSTANT_P}, so you need not check these things.  In fact,
                   8099: @samp{1} is a suitable definition for this macro on machines where any
                   8100: @samp{const_double} is valid and anything @code{CONSTANT_P} is valid.@refill
                   8101: @end table
                   8102: 
1.1.1.5   root     8103: @node Cross-compilation, Misc, Addressing Modes, Machine Macros
                   8104: @section Cross Compilation and Floating-Point Format
                   8105: 
                   8106: While all modern machines use 2's compliment representation for integers,
                   8107: there are a variety of representations for floating point numbers.  This
                   8108: means that in a cross-compiler the representation of floating point numbers
                   8109: in the compiled program may be different from that used in the machine
                   8110: doing the compilation.
                   8111: 
                   8112: Because different representation systems may offer different amounts of
                   8113: range and precision, the cross compiler cannot safely use the host
                   8114: machine's floating point arithmetic.  Therefore, floating point constants
                   8115: must be represented in the target machine's format.  This means that the
                   8116: cross compiler cannot use @code{atof} to parse a floating point constant;
                   8117: it must have its own special routine to use instead.  Also, constant
                   8118: folding must emulate the target machine's arithmetic (or must not be done
                   8119: at all).
                   8120: 
                   8121: The macros in the following table should be defined only if you are cross
                   8122: compiling between different floating point formats.
                   8123: 
                   8124: Otherwise, don't define them. Then default definitions will be set up which
                   8125: use @code{double} as the data type, @code{==} to test for equality, etc.
                   8126: 
                   8127: You don't need to worry about how many times you use an operand of any
                   8128: of these macros.  The compiler never uses operands which have side effects.
                   8129: 
                   8130: @table @code
                   8131: @item REAL_VALUE_TYPE
                   8132: A macro for the C data type to be used to hold a floating point value
                   8133: in the target machine's format.  Typically this would be a
                   8134: @code{struct} containing an array of @code{int}.
                   8135: 
                   8136: @item REAL_VALUES_EQUAL (@var{x}, @var{y})
                   8137: A macro for a C expression which compares for equality the two values,
                   8138: @var{x} and @var{y}, both of type @code{REAL_VALUE_TYPE}.
                   8139: 
                   8140: @item REAL_VALUES_LESS (@var{x}, @var{y})
                   8141: A macro for a C expression which tests whether @var{x} is less than
                   8142: @var{y}, both values being of type @code{REAL_VALUE_TYPE} and
                   8143: interpreted as floating point numbers in the target machine's
                   8144: representation.
                   8145: 
                   8146: @item REAL_VALUE_LDEXP (@var{x}, @var{scale})
                   8147: A macro for a C expression which performs the standard library
                   8148: function @code{ldexp}, but using the target machine's floating point
                   8149: representation.  Both @var{x} and the value of the expression have
                   8150: type @code{REAL_VALUE_TYPE}.  The second argument, @var{scale}, is an
                   8151: integer.
                   8152: 
                   8153: @item REAL_VALUE_ATOF (@var{string})
                   8154: A macro for a C expression which converts @var{string}, an expression
                   8155: of type @code{char *}, into a floating point number in the target
                   8156: machine's representation.  The value has type @code{REAL_VALUE_TYPE}.
                   8157: @end table
                   8158: 
                   8159: Define the following additional macros if you want to make floating
                   8160: point constant folding work while cross compiling.  If you don't
                   8161: define them, cross compilation is still possible, but constant folding
                   8162: will not happen for floating point values.
                   8163: 
                   8164: @table @code
                   8165: @item REAL_ARITHMETIC (@var{output}, @var{code}, @var{x}, @var{y})
                   8166: A macro for a C statement which calculates an arithmetic operation of
                   8167: the two floating point values @var{x} and @var{y}, both of type
                   8168: @code{REAL_VALUE_TYPE} in the target machine's representation, to
                   8169: produce a result of the same type and representation which is stored
                   8170: in @var{output} (which will be a variable).
                   8171: 
                   8172: The operation to be performed is specified by @var{code}, a tree code
                   8173: which will always be one of the following: @code{PLUS_EXPR},
                   8174: @code{MINUS_EXPR}, @code{MULT_EXPR}, @code{RDIV_EXPR},
                   8175: @code{MAX_EXPR}, @code{MIN_EXPR}.@refill
                   8176: 
                   8177: The expansion of this macro is responsible for checking for overflow.
                   8178: If overflow happens, the macro expansion should execute the statement
                   8179: @code{return 0;}, which indicates the inability to perform the
                   8180: arithmetic operation requested.
                   8181: 
                   8182: @item REAL_VALUE_NEGATE (@var{x})
                   8183: A macro for a C expression which returns the negative of the floating
                   8184: point value @var{x}.  Both @var{x} and the value of the expression
                   8185: have type @code{REAL_VALUE_TYPE} and are in the target machine's
                   8186: floating point representation.
                   8187: 
                   8188: There is no way for this macro to report overflow, since overflow
                   8189: can't happen in the negation operation.
                   8190: 
                   8191: @item REAL_VALUE_TO_INT (@var{low}, @var{high}, @var{x})
                   8192: A macro for a C expression which converts a floating point value
                   8193: @var{x} into a double-precision integer which is then stored into
                   8194: @var{low} and @var{high}, two variables of type @var{int}.
                   8195: 
                   8196: @item REAL_VALUE_FROM_INT (@var{x}, @var{low}, @var{high})
                   8197: A macro for a C expression which converts a double-precision integer
                   8198: found in @var{low} and @var{high}, two variables of type @var{int},
                   8199: into a floating point value which is then stored into @var{x}.
                   8200: @end table
                   8201: 
                   8202: @node Misc, Condition Code, Cross-compilation, Machine Macros
1.1       root     8203: @section Miscellaneous Parameters
                   8204: 
                   8205: @table @code
                   8206: @item CASE_VECTOR_MODE
                   8207: An alias for a machine mode name.  This is the machine mode that
                   8208: elements of a jump-table should have.
                   8209: 
                   8210: @item CASE_VECTOR_PC_RELATIVE
                   8211: Define this macro if jump-tables should contain relative addresses.
                   8212: 
                   8213: @item CASE_DROPS_THROUGH
                   8214: Define this if control falls through a @code{case} insn when the index
                   8215: value is out of range.  This means the specified default-label is
                   8216: actually ignored by the @code{case} insn proper.
                   8217: 
                   8218: @item IMPLICIT_FIX_EXPR
                   8219: An alias for a tree code that should be used by default for conversion
                   8220: of floating point values to fixed point.  Normally,
                   8221: @code{FIX_ROUND_EXPR} is used.@refill
                   8222: 
                   8223: @item FIXUNS_TRUNC_LIKE_FIX_TRUNC
                   8224: Define this macro if the same instructions that convert a floating
                   8225: point number to a signed fixed point number also convert validly to an
                   8226: unsigned one.
                   8227: 
                   8228: @item EASY_DIV_EXPR
                   8229: An alias for a tree code that is the easiest kind of division to
                   8230: compile code for in the general case.  It may be
                   8231: @code{TRUNC_DIV_EXPR}, @code{FLOOR_DIV_EXPR}, @code{CEIL_DIV_EXPR} or
                   8232: @code{ROUND_DIV_EXPR}.  These four division operators differ in how
                   8233: they round the result to an integer.  @code{EASY_DIV_EXPR} is used
                   8234: when it is permissible to use any of those kinds of division and the
                   8235: choice should be made on the basis of efficiency.@refill
                   8236: 
                   8237: @item DEFAULT_SIGNED_CHAR
                   8238: An expression whose value is 1 or 0, according to whether the type
                   8239: @code{char} should be signed or unsigned by default.  The user can
                   8240: always override this default with the options @samp{-fsigned-char}
                   8241: and @samp{-funsigned-char}.
                   8242: 
                   8243: @item SCCS_DIRECTIVE
                   8244: Define this if the preprocessor should ignore @code{#sccs} directives
                   8245: and print no error message.
                   8246: 
                   8247: @item IDENT_DIRECTIVE
                   8248: Define this if the preprocessor should ignore @code{#ident} directives
                   8249: and print no error message.
                   8250: 
                   8251: @item MOVE_MAX
                   8252: The maximum number of bytes that a single instruction can move quickly
                   8253: from memory to memory.
                   8254: 
                   8255: @item INT_TYPE_SIZE
                   8256: A C expression for the size in bits of the type @code{int} on the
                   8257: target machine.
                   8258: 
                   8259: @item SLOW_BYTE_ACCESS
                   8260: Define this macro as a C expression which is nonzero if accessing less
                   8261: than a word of memory (i.e. a @code{char} or a @code{short}) is slow
                   8262: (requires more than one instruction).
                   8263: 
                   8264: @item SLOW_ZERO_EXTEND
                   8265: Define this macro if zero-extension (of a @code{char} or @code{short}
                   8266: to an @code{int}) can be done faster if the destination is a register
                   8267: that is known to be zero.
                   8268: 
                   8269: If you define this macro, you must have instruction patterns that
                   8270: recognize RTL structures like this:
                   8271: 
                   8272: @example
                   8273: (set (strict-low-part (subreg:QI (reg:SI @dots{}) 0)) @dots{})
                   8274: @end example
                   8275: 
                   8276: @noindent
                   8277: and likewise for @code{HImode}.
                   8278: 
                   8279: @item SHIFT_COUNT_TRUNCATED
                   8280: Define this macro if shift instructions ignore all but the lowest few
                   8281: bits of the shift count.  It implies that a sign-extend or zero-extend
                   8282: instruction for the shift count can be omitted.
                   8283: 
                   8284: @item TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
                   8285: A C expression which is nonzero if on this machine it is safe to
                   8286: ``convert'' an integer of @var{inprec} bits to one of @var{outprec}
                   8287: bits (where @var{outprec} is smaller than @var{inprec}) by merely
                   8288: operating on it as if it had only @var{outprec} bits.
                   8289: 
                   8290: On many machines, this expression can be 1.
                   8291: 
                   8292: @item NO_FUNCTION_CSE
                   8293: Define this macro if it is as good or better to call a constant
                   8294: function address than to call an address kept in a register.
                   8295: 
                   8296: @item PROMOTE_PROTOTYPES
                   8297: Define this macro if an argument declared as @code{char} or
                   8298: @code{short} in a prototype should actually be passed as an
                   8299: @code{int}.  In addition to avoiding errors in certain cases of
                   8300: mismatch, it also makes for better code on certain machines.
                   8301: 
                   8302: @item STORE_FLAG_VALUE
                   8303: A C expression for the value stored by a store-flag instruction
                   8304: (@code{s@var{cond}}) when the condition is true.  This is usually 1 or
                   8305: -1; it is required to be an odd number.
                   8306: 
                   8307: Do not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
                   8308: instructions.
                   8309: 
                   8310: @item Pmode
                   8311: An alias for the machine mode for pointers.  Normally the definition
                   8312: can be
                   8313: 
                   8314: @example
                   8315: #define Pmode SImode
                   8316: @end example
                   8317: 
                   8318: @item FUNCTION_MODE
                   8319: An alias for the machine mode used for memory references to functions
                   8320: being called, in @samp{call} RTL expressions.  On most machines this
                   8321: should be @code{QImode}.
                   8322: 
                   8323: @item INSN_MACHINE_INFO
                   8324: This macro should expand into a C structure type to use for the
                   8325: machine-dependent info field specified with the optional last argument
                   8326: in @samp{define_insn} and @samp{define_peephole} patterns.  For example,
                   8327: it might expand into @samp{struct machine_info}; then it would be up
                   8328: to you to define this structure in the @file{tm.h} file.
                   8329: 
                   8330: You do not need to define this macro if you do not write the optional
                   8331: last argument in any of the patterns in the machine description.
                   8332: 
                   8333: @item CONST_COSTS (@var{x}, @var{code})
                   8334: A part of a C @code{switch} statement that describes the relative
                   8335: costs of constant RTL expressions.  It must contain @code{case} labels
                   8336: for expression codes @samp{const_int}, @samp{const}, @samp{symbol_ref}, @samp{label_ref}
                   8337: and @samp{const_double}.  Each case must ultimately reach a
                   8338: @code{return} statement to return the relative cost of the use of that
                   8339: kind of constant value in an expression.  The cost may depend on the
                   8340: precise value of the constant, which is available for examination in
                   8341: @var{x}.
                   8342: 
                   8343: @var{code} is the expression code---redundant, since it can be
                   8344: obtained with @code{GET_CODE (@var{x})}.
                   8345: 
                   8346: @item DOLLARS_IN_IDENTIFIERS
                   8347: Define this to be nonzero if the character @samp{$} should be allowed
                   8348: by default in identifier names.
                   8349: @end table
                   8350: 
                   8351: @node Condition Code, Assembler Format, Misc, Machine Macros
                   8352: @section Condition Code Information
                   8353: 
                   8354: The file @file{conditions.h} defines a variable @code{cc_status} to
                   8355: describe how the condition code was computed (in case the interpretation of
                   8356: the condition code depends on the instruction that it was set by).  This
                   8357: variable contains the RTL expressions on which the condition code is
                   8358: currently based, and several standard flags.
                   8359: 
                   8360: Sometimes additional machine-specific flags must be defined in the machine
                   8361: description header file.  It can also add additional machine-specific
                   8362: information by defining @code{CC_STATUS_MDEP}.
                   8363: 
                   8364: @table @code
                   8365: @item CC_STATUS_MDEP
                   8366: C code for a data type which is used for declaring the @code{mdep}
                   8367: component of @code{cc_status}.  It defaults to @code{int}.
                   8368: 
                   8369: @item CC_STATUS_MDEP_INIT
                   8370: A C expression for the initial value of the @code{mdep} field.  It
                   8371: defaults to 0.
                   8372: 
                   8373: @item NOTICE_UPDATE_CC (@var{exp}, @var{insn})
                   8374: A C compound statement to set the components of @code{cc_status}
                   8375: appropriately for an insn @var{insn} whose body is @var{exp}.  It is
                   8376: this macro's responsibility to recognize insns that set the condition
                   8377: code as a byproduct of other activity as well as those that explicitly
                   8378: set @code{(cc0)}.
                   8379: 
                   8380: If there are insn that do not set the condition code but do alter
                   8381: other machine registers, this macro must check to see whether they
                   8382: invalidate the expressions that the condition code is recorded as
                   8383: reflecting.  For example, on the 68000, insns that store in address
                   8384: registers do not set the condition code, which means that usually
                   8385: @code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
                   8386: insns.  But suppose that the previous insn set the condition code
                   8387: based on location @samp{a4@@(102)} and the current insn stores a new
                   8388: value in @samp{a4}.  Although the condition code is not changed by
                   8389: this, it will no longer be true that it reflects the contents of
                   8390: @samp{a4@@(102)}.  Therefore, @code{NOTICE_UPDATE_CC} must alter
                   8391: @code{cc_status} in this case to say that nothing is known about the
                   8392: condition code value.
                   8393: 
                   8394: The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
                   8395: with the results of peephole optimization: insns whose patterns are
                   8396: @samp{parallel} RTXs containing various @samp{reg}, @samp{mem} or
                   8397: constants which are just the operands.  The RTL structure of these
                   8398: insns is not sufficient to indicate what the insns actually do.  What
                   8399: @code{NOTICE_UPDATE_CC} should do when it sees one is just to run
                   8400: @code{CC_STATUS_INIT}.
                   8401: @end table
                   8402: 
                   8403: @node Assembler Format,, Condition Code, Machine Macros
                   8404: @section Output of Assembler Code
                   8405: 
                   8406: @table @code
                   8407: @item ASM_SPEC
                   8408: A C string constant that tells the GNU CC driver program options to
                   8409: pass to the assembler.  It can also specify how to translate options
                   8410: you give to GNU CC into options for GNU CC to pass to the assembler.
                   8411: See the file @file{tm-sun3.h} for an example of this.
                   8412: 
                   8413: Do not define this macro if it does not need to do anything.
                   8414: 
                   8415: @item LINK_SPEC
                   8416: A C string constant that tells the GNU CC driver program options to
                   8417: pass to the linker.  It can also specify how to translate options you
                   8418: give to GNU CC into options for GNU CC to pass to the linker.
                   8419: 
                   8420: Do not define this macro if it does not need to do anything.
                   8421: 
                   8422: @item LIB_SPEC
                   8423: Another C string constant used much like @code{LINK_SPEC}.  The difference
                   8424: between the two is that @code{LIBS_SPEC} is used at the end of the
                   8425: command given to the linker.
                   8426: 
                   8427: If this macro is not defined, a default is provided that
                   8428: loads the standard C library from the usual place.  See @file{gcc.c}.
                   8429: 
                   8430: @item STARTFILE_SPEC
                   8431: Another C string constant used much like @code{LINK_SPEC}.  The
                   8432: difference between the two is that @code{STARTFILE_SPEC} is used at
                   8433: the very beginning of the command given to the linker.
                   8434: 
                   8435: If this macro is not defined, a default is provided that loads the
                   8436: standard C startup file from the usual place.  See @file{gcc.c}.
                   8437: 
1.1.1.4   root     8438: @item STANDARD_STARTFILE_PREFIX
                   8439: Define this macro as a C string constant if you wish to override the
                   8440: standard choice of @file{/lib/} as the default prefix for where to
                   8441: find the startup files such as @file{crt0.o}.
                   8442: 
1.1       root     8443: @item ASM_FILE_START (@var{stream})
                   8444: A C expression which outputs to the stdio stream @var{stream}
                   8445: some appropriate text to go at the start of an assembler file.
                   8446: 
                   8447: Normally this macro is defined to output a line containing
                   8448: @samp{#NO_APP}, which is a comment that has no effect on most
                   8449: assemblers but tells the GNU assembler that it can save time by not
                   8450: checking for certain assembler constructs.
                   8451: 
                   8452: On systems that use SDB, it is necessary to output certain commands;
                   8453: see @file{tm-attasm.h}.
                   8454: 
                   8455: @item ASM_APP_ON
                   8456: A C string constant for text to be output before each @code{asm}
                   8457: statement or group of consecutive ones.  Normally this is
                   8458: @code{"#APP"}, which is a comment that has no effect on most
                   8459: assemblers but tells the GNU assembler that it must check the lines
                   8460: that follow for all valid assembler constructs.
                   8461: 
                   8462: @item ASM_APP_OFF
                   8463: A C string constant for text to be output after each @code{asm}
                   8464: statement or group of consecutive ones.  Normally this is
                   8465: @code{"#NO_APP"}, which tells the GNU assembler to resume making the
                   8466: time-saving assumptions that are valid for ordinary compiler output.
                   8467: 
                   8468: @item TEXT_SECTION_ASM_OP
                   8469: A C string constant for the assembler operation that should precede
                   8470: instructions and read-only data.  Normally @code{".text"} is right.
                   8471: 
                   8472: @item DATA_SECTION_ASM_OP
                   8473: A C string constant for the assembler operation to identify the
                   8474: following data as writable initialized data.  Normally @code{".data"}
                   8475: is right.
                   8476: 
                   8477: @item REGISTER_NAMES
                   8478: A C initializer containing the assembler's names for the machine
                   8479: registers, each one as a C string constant.  This is what translates
                   8480: register numbers in the compiler into assembler language.
                   8481: 
                   8482: @item DBX_REGISTER_NUMBER (@var{regno})
                   8483: A C expression that returns the DBX register number for the compiler
                   8484: register number @var{regno}.  In simple cases, the value of this
                   8485: expression may be @var{regno} itself.  But sometimes there are some
                   8486: registers that the compiler knows about and DBX does not, or vice
                   8487: versa.  In such cases, some register may need to have one number in
                   8488: the compiler and another for DBX.
                   8489: 
                   8490: @item DBX_DEBUGGING_INFO
                   8491: Define this macro if GNU CC should produce debugging output for DBX
                   8492: in response to the @samp{-g} option.
                   8493: 
                   8494: @item SDB_DEBUGGING_INFO
                   8495: Define this macro if GNU CC should produce debugging output for SDB
                   8496: in response to the @samp{-g} option.
                   8497: 
                   8498: @item PUT_SDB_@var{op}
                   8499: Define these macros to override the assembler syntax for the special
                   8500: SDB assembler directives.  See @file{sdbout.c} for a list of these
                   8501: macros and their arguments.  If the standard syntax is used, you need
                   8502: not define them yourself.
                   8503: 
                   8504: @item SDB_GENERATE_FAKE
                   8505: Define this macro to override the usual method of constructing a dummy
                   8506: name for anonymous structure and union types.  See @file{sdbout.c} for
                   8507: more infomation.
                   8508: 
                   8509: @item DBX_NO_XREFS
                   8510: Define this macro if DBX on your system does not support the construct
                   8511: @samp{xs@var{tagname}}.  On some systems, this construct is used to
                   8512: describe a forward reference to a structure named @var{tagname}.
                   8513: On other systems, this construct is not supported at all.
                   8514: 
                   8515: @item DBX_CONTIN_LENGTH
                   8516: A symbol name in DBX-format debugging information is normally
                   8517: continued (split into two separate @code{.stabs} directives) when it
                   8518: exceeds a certain length (by default, 80 characters).  On some
                   8519: operating systems, DBX requires this splitting; on others, splitting
                   8520: must not be done.  You can inhibit splitting by defining this macro
                   8521: with the value zero.  You can override the default splitting-length by
                   8522: defining this macro as an expression for the length you desire.
                   8523: 
                   8524: @item DBX_CONTIN_CHAR
                   8525: Normally continuation is indicated by adding a @samp{\} character to
                   8526: the end of a @code{.stabs} string when a continuation follows.  To use
                   8527: a different character instead, define this macro as a character
                   8528: constant for the character you want to use.  Do not define this macro
                   8529: if backslash is correct for your system.
                   8530: 
                   8531: @item ASM_OUTPUT_LABEL (@var{stream}, @var{name})
                   8532: A C statement (sans semicolon) to output to the stdio stream
                   8533: @var{stream} the assembler definition of a label named @var{name}.  Use
                   8534: the expression @code{assemble_name (@var{stream}, @var{name})} to output
                   8535: the name itself; before and after that, output the additional
                   8536: assembler syntax for defining the name, and a newline.
                   8537: 
                   8538: @item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
                   8539: A C statement (sans semicolon) to output to the stdio stream
                   8540: @var{stream} any text necessary for declaring the name @var{name} of a
                   8541: function which is being defined.  This macro is responsible for
                   8542: outputting the label definition (perhaps using
                   8543: @code{ASM_OUTPUT_LABEL}).  The argument @var{decl} is the
                   8544: @code{FUNCTION_DECL} tree node representing the function.
                   8545: 
                   8546: If this macro is not defined, then the function name is defined in the
                   8547: usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
                   8548: 
                   8549: @item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name})
                   8550: A C statement (sans semicolon) to output to the stdio stream
                   8551: @var{stream} some commands that will make the label @var{name} global;
                   8552: that is, available for reference from other files.  Use the expression
                   8553: @code{assemble_name (@var{stream}, @var{name})} to output the name
                   8554: itself; before and after that, output the additional assembler syntax
                   8555: for making that name global, and a newline.
                   8556: 
                   8557: @item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{name}, @var{decl})
                   8558: A C statement (sans semicolon) to output to the stdio stream
                   8559: @var{stream} any text necessary for declaring the name of an external
                   8560: symbol named @var{name} which is referenced in this compilation but
                   8561: not defined.  The value of @var{decl} is the tree node for the
                   8562: declaration.
                   8563: 
                   8564: This macro need not be defined if it does not need to output anything.
                   8565: The GNU assembler and most Unix assemblers don't require anything.
                   8566: 
                   8567: @item ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
                   8568: A C statement to output to the stdio stream @var{stream} a reference in
                   8569: assembler syntax to a label named @var{name}.  The character @samp{_}
                   8570: should be added to the front of the name, if that is customary on your
                   8571: operating system, as it is in most Berkeley Unix systems.  This macro
                   8572: is used in @code{assemble_name}.
                   8573: 
                   8574: @item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
                   8575: A C statement to store into the string @var{string} a label whose
                   8576: name is made from the string @var{prefix} and the number @var{num}.
                   8577: 
                   8578: This string, when output subsequently by @code{ASM_OUTPUT_LABELREF},
                   8579: should produce the same output that @code{ASM_OUTPUT_INTERNAL_LABEL}
                   8580: would produce with the same @var{prefix} and @var{num}.
                   8581: 
                   8582: @item ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{prefix}, @var{num})
                   8583: A C statement to output to the stdio stream @var{stream} a label whose
                   8584: name is made from the string @var{prefix} and the number @var{num}.
                   8585: These labels are used for internal purposes, and there is no reason
                   8586: for them to appear in the symbol table of the object file.  On many
                   8587: systems, the letter @samp{L} at the beginning of a label has this
                   8588: effect.  The usual definition of this macro is as follows:
                   8589: 
                   8590: @example
                   8591: fprintf (@var{stream}, "L%s%d:\n", @var{prefix}, @var{num})
                   8592: @end example
                   8593: 
                   8594: @item ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
                   8595: Define this if the label before a jump-table needs to be output
                   8596: specially.  The first three arguments are the same as for
                   8597: @code{ASM_OUTPUT_INTERNAL_LABEL}; the fourth argument is the
                   8598: jump-table which follows (a @samp{jump_insn} containing an
                   8599: @samp{addr_vec} or @samp{addr_diff_vec}).
                   8600: 
                   8601: This feature is used on system V to output a @code{swbeg} statement
                   8602: for the table.
                   8603: 
                   8604: If this macro is not defined, these labels are output with
                   8605: @code{ASM_OUTPUT_INTERNAL_LABEL}.
                   8606: 
                   8607: @item ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
                   8608: Define this if something special must be output at the end of a jump-table.
                   8609: The definition should be a C statement to be executed after the assembler
                   8610: code for the table is written.  It should write the appropriate code to
                   8611: stdio stream @var{stream}.  The argument @var{table} is the jump-table
                   8612: insn, and @var{num} is the label-number of the preceding label.
                   8613: 
                   8614: If this macro is not defined, nothing special is output at the end of
                   8615: the jump-table.
                   8616: 
1.1.1.4   root     8617: @item ASM_OUTPUT_ALIGN_CODE (@var{file})
                   8618: A C expression to output text to align the location counter in the way
                   8619: that is desirable at a point in the code that is reached only by
                   8620: jumping.
                   8621: 
                   8622: This macro need not be defined if you don't want any special alignment
                   8623: to be done at such a time.  Most machine descriptions do not currently
                   8624: define the macro.
                   8625: 
1.1       root     8626: @item ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
                   8627: A C expression to assign to @var{outvar} (which is a variable of type
                   8628: @code{char *}) a newly allocated string made from the string
                   8629: @var{name} and the number @var{number}, with some suitable punctuation
                   8630: added.  Use @code{alloca} to get space for the string.
                   8631: 
                   8632: This string will be used as the argument to @code{ASM_OUTPUT_LABELREF}
                   8633: to produce an assembler label for an internal static variable whose
                   8634: name is @var{name}.  Therefore, the string must be such as to result
                   8635: in valid assembler code.  The argument @var{number} is different each
                   8636: time this macro is executed; it prevents conflicts between
                   8637: similarly-named internal static variables in different scopes.
                   8638: 
                   8639: Ideally this string should not be a valid C identifier, to prevent any
                   8640: conflict with the user's own symbols.  Most assemblers allow periods
                   8641: or percent signs in assembler symbols; putting at least one of these
                   8642: between the name and the number will suffice.
                   8643: 
                   8644: @item ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
                   8645: A C expression to output to @var{stream} some assembler code
                   8646: which will push hard register number @var{regno} onto the stack.
                   8647: The code need not be optimal, since this macro is used only when
                   8648: profiling.
                   8649: 
                   8650: @item ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
                   8651: A C expression to output to @var{stream} some assembler code
                   8652: which will pop hard register number @var{regno} off of the stack.
                   8653: The code need not be optimal, since this macro is used only when
                   8654: profiling.
                   8655: 
                   8656: @item ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{value}, @var{rel})
                   8657: This macro should be provided on machines where the addresses
                   8658: in a dispatch table are relative to the table's own address.
                   8659: 
                   8660: The definition should be a C statement to output to the stdio stream
                   8661: @var{stream} an assembler pseudo-instruction to generate a difference
                   8662: between two labels.  @var{value} and @var{rel} are the numbers of two
                   8663: internal labels.  The definitions of these labels are output using
                   8664: @code{ASM_OUTPUT_INTERNAL_LABEL}, and they must be printed in the same
                   8665: way here.  For example,
                   8666: 
                   8667: @example
                   8668: fprintf (@var{stream}, "\t.word L%d-L%d\n",
                   8669:          @var{value}, @var{rel})
                   8670: @end example
                   8671: 
                   8672: @item ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
                   8673: This macro should be provided on machines where the addresses
                   8674: in a dispatch table are absolute.
                   8675: 
                   8676: The definition should be a C statement to output to the stdio stream
                   8677: @var{stream} an assembler pseudo-instruction to generate a reference to
                   8678: a label.  @var{value} is the number of an internal label whose
                   8679: definition is output using @code{ASM_OUTPUT_INTERNAL_LABEL}.
                   8680: For example,
                   8681: 
                   8682: @example
                   8683: fprintf (@var{stream}, "\t.word L%d\n", @var{value})
                   8684: @end example
                   8685: 
                   8686: @item ASM_OUTPUT_DOUBLE (@var{stream}, @var{value})
                   8687: A C statement to output to the stdio stream @var{stream} an assembler
                   8688: instruction to assemble a @code{double} constant whose value is
                   8689: @var{value}.  @var{value} will be a C expression of type
                   8690: @code{double}.
                   8691: 
                   8692: @item ASM_OUTPUT_FLOAT (@var{stream}, @var{value})
                   8693: A C statement to output to the stdio stream @var{stream} an assembler
                   8694: instruction to assemble a @code{float} constant whose value is
                   8695: @var{value}.  @var{value} will be a C expression of type @code{float}.
                   8696: 
                   8697: @item ASM_OUTPUT_INT (@var{stream}, @var{exp})
                   8698: @itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp})
                   8699: @itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp})
                   8700: A C statement to output to the stdio stream @var{stream} an assembler
                   8701: instruction to assemble a @code{int}, @code{short} or @code{char}
                   8702: constant whose value is @var{value}.  The argument @var{exp} will be
                   8703: an RTL expression which represents a constant value.  Use
                   8704: @samp{output_addr_const (@var{exp})} to output this value as an
                   8705: assembler expression.@refill
                   8706: 
                   8707: @item ASM_OUTPUT_BYTE (@var{stream}, @var{value})
                   8708: A C statement to output to the stdio stream @var{stream} an assembler
                   8709: instruction to assemble a single byte containing the number @var{value}.
                   8710: 
                   8711: @item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
                   8712: A C statement to output to the stdio stream @var{stream} an assembler
                   8713: instruction to assemble a string constant containing the @var{len}
                   8714: bytes at @var{ptr}.  @var{ptr} will be a C expression of type
                   8715: @code{char *} and @var{len} a C expression of type @code{int}.
                   8716: 
                   8717: If the assembler has a @code{.ascii} pseudo-op as found in the
                   8718: Berkeley Unix assembler, do not define the macro
                   8719: @code{ASM_OUTPUT_ASCII}.
                   8720: 
                   8721: @item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
                   8722: A C statement to output to the stdio stream @var{stream} an assembler
                   8723: instruction to advance the location counter by @var{nbytes} bytes.
                   8724: @var{nbytes} will be a C expression of type @code{int}.
                   8725: 
                   8726: @item ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
                   8727: A C statement to output to the stdio stream @var{stream} an assembler
                   8728: instruction to advance the location counter to a multiple of 2 to the
                   8729: @var{power} bytes.  @var{power} will be a C expression of type @code{int}.
                   8730: 
                   8731: @item ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size})
                   8732: A C statement (sans semicolon) to output to the stdio stream
                   8733: @var{stream} the assembler definition of a common-label named @var{name}
                   8734: whose size is @var{size} bytes.  Use the expression
                   8735: @code{assemble_name (@var{stream}, @var{name})} to output the name
                   8736: itself; before and after that, output the additional assembler syntax
                   8737: for defining the name, and a newline.
                   8738: 
                   8739: This macro controls how the assembler definitions of uninitialized
                   8740: global variables are output.
                   8741: 
                   8742: @item ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size})
                   8743: A C statement (sans semicolon) to output to the stdio stream
                   8744: @var{stream} the assembler definition of a local-common-label named
                   8745: @var{name} whose size is @var{size} bytes.  Use the expression
                   8746: @code{assemble_name (@var{stream}, @var{name})} to output the name
                   8747: itself; before and after that, output the additional assembler syntax
                   8748: for defining the name, and a newline.
                   8749: 
                   8750: This macro controls how the assembler definitions of uninitialized
                   8751: static variables are output.
                   8752: 
                   8753: @item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
                   8754: A C statment to output DBX or SDB debugging information before code
                   8755: for line number @var{line} of the current source file to the
                   8756: stdio stream @var{stream}.
                   8757: 
                   8758: This macro need not be defined if the standard form of debugging
                   8759: information for the debugger in use is appropriate.
                   8760: 
                   8761: @item ASM_OUTPUT_IDENT (@var{stream}, @var{string})
                   8762: A C statement to output something to the assembler file to handle a
                   8763: @samp{#ident} directive containing the text @var{string}.  If this
                   8764: macro is not defined, the assembler code @samp{.ident "@var{string}"}
                   8765: will be output by default.
                   8766: 
                   8767: This macro is significant only if @code{IDENT_DIRECTIVE} is defined.
                   8768: 
                   8769: @item TARGET_BELL
                   8770: A C constant expression for the integer value for escape sequence
                   8771: @samp{\a}.
                   8772: 
                   8773: @item TARGET_BS
                   8774: @itemx TARGET_TAB
                   8775: @itemx TARGET_NEWLINE
                   8776: C constant expressions for the integer values for escape sequences
                   8777: @samp{\b}, @samp{\t} and @samp{\n}.
                   8778: 
                   8779: @item TARGET_VT
                   8780: @itemx TARGET_FF
                   8781: @itemx TARGET_CR
                   8782: C constant expressions for the integer values for escape sequences
                   8783: @samp{\v}, @samp{\f} and @samp{\r}.
                   8784: 
                   8785: @item ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
                   8786: Define this macro if you are using an unusual assembler that
                   8787: requires different names for the machine instructions.
                   8788: 
                   8789: The definition is a C statement or statements which output an
                   8790: assembler instruction opcode to the stdio stream @var{stream}.  The
                   8791: macro-operand @var{ptr} is a variable of type @code{char *} which
                   8792: points to the opcode name in its ``internal'' form---the form that is
                   8793: written in the machine description.  The definition should output the
                   8794: opcode name to @var{stream}, performing any translation you desire, and
                   8795: increment the variable @var{ptr} to point at the end of the opcode
                   8796: so that it will not be output twice.
                   8797: 
                   8798: In fact, your macro definition may process less than the entire opcode
                   8799: name, or more than the opcode name; but if you want to process text
                   8800: that includes @samp{%}-sequences to substitute operands, you must take
                   8801: care of the substitution yourself.  Just be sure to increment
                   8802: @var{ptr} over whatever text should not be output normally.
                   8803: 
                   8804: If the macro definition does nothing, the instruction is output
                   8805: in the usual way.
                   8806: 
                   8807: @item FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
                   8808: If defined, a C statement to be executed just prior to the output of
                   8809: assembler code for @var{insn}, to modify the extracted operands so
                   8810: they will be output differently.
                   8811: 
                   8812: Here the argument @var{opvec} is the vector containing the operands
                   8813: extracted from @var{insn}, and @var{noperands} is the number of
                   8814: elements of the vector which contain meaningful data for this insn.
                   8815: The contents of this vector are what will be used to convert the insn
                   8816: template into assembler code, so you can change the assembler output
                   8817: by changing the contents of the vector.
                   8818: 
                   8819: This macro is useful when various assembler syntaxes share a single
                   8820: file of instruction patterns; by defining this macro differently, you
                   8821: can cause a large class of instructions to be output differently (such
                   8822: as with rearranged operands).  Naturally, variations in assembler
                   8823: syntax affecting individual insn patterns ought to be handled by
                   8824: writing conditional output routines in those patterns.
                   8825: 
                   8826: If this macro is not defined, it is equivalent to a null statement.
                   8827: 
                   8828: @item PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
                   8829: A C compound statement to output to stdio stream @var{stream} the
                   8830: assembler syntax for an instruction operand @var{x}.  @var{x} is an
                   8831: RTL expression.
                   8832: 
                   8833: @var{code} is a value that can be used to specify one of several ways
                   8834: of printing the operand.  It is used when identical operands must be
                   8835: printed differently depending on the context.  @var{code} comes from
                   8836: the @samp{%} specification that was used to request printing of the
                   8837: operand.  If the specification was just @samp{%@var{digit}} then
                   8838: @var{code} is 0; if the specification was @samp{%@var{ltr}
                   8839: @var{digit}} then @var{code} is the ASCII code for @var{ltr}.
                   8840: 
                   8841: If @var{x} is a register, this macro should print the register's name.
                   8842: The names can be found in an array @code{reg_names} whose type is
                   8843: @code{char *[]}.  @code{reg_names} is initialized from
                   8844: @code{REGISTER_NAMES}.
                   8845: 
                   8846: When the machine description has a specification @samp{%@var{punct}}
                   8847: (a @samp{%} followed by a punctuation character), this macro is called
                   8848: with a null pointer for @var{x} and the punctuation character for
                   8849: @var{code}.
                   8850: 
                   8851: @item PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
                   8852: A C compound statement to output to stdio stream @var{stream} the
                   8853: assembler syntax for an instruction operand that is a memory reference
                   8854: whose address is @var{x}.  @var{x} is an RTL expression.
                   8855: 
                   8856: @item ASM_OPEN_PAREN
                   8857: @itemx ASM_CLOSE_PAREN
                   8858: These macros are defined as C string constant, describing the syntax
                   8859: in the assembler for grouping arithmetic expressions.  The following
                   8860: definitions are correct for most assemblers:
                   8861: 
                   8862: @example
                   8863: #define ASM_OPEN_PAREN "("
                   8864: #define ASM_CLOSE_PAREN ")"
                   8865: @end example
                   8866: @end table
                   8867: 
                   8868: @node Config,, Machine Macros, Top
                   8869: @chapter The Configuration File
                   8870: 
1.1.1.3   root     8871: The configuration file @file{xm-@var{machine}.h} contains macro definitions
                   8872: that describe the machine and system on which the compiler is running.
                   8873: Most of the values in it are actually the same on all machines that GNU CC
                   8874: runs on, so large parts of all configuration files are identical.  But
1.1       root     8875: there are some macros that vary:
                   8876: 
                   8877: @table @code
                   8878: @item FAILURE_EXIT_CODE
                   8879: A C expression for the status code to be returned when the compiler
                   8880: exits after serious errors.
                   8881: 
                   8882: @item SUCCESS_EXIT_CODE
                   8883: A C expression for the status code to be returned when the compiler
                   8884: exits without serious errors.
                   8885: @end table
                   8886: 
1.1.1.3   root     8887: In addition, configuration files for system V define @code{bcopy},
                   8888: @code{bzero} and @code{bcmp} as aliases.  Some files define @code{alloca}
                   8889: as a macro when compiled with GNU CC, in order to take advantage of the
                   8890: benefit of GNU CC's built-in @code{alloca}.
                   8891: 
1.1       root     8892: @contents
                   8893: @bye

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.