Annotation of gcc/gcc.texinfo, revision 1.1.1.9

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.9 ! root       24: sections entitled ``GNU General Public License'' and ``Protect Your
        !            25: Freedom---Fight `Look And Feel'@w{}'' are included exactly as in the
        !            26: original, and provided that the entire resulting derived work is
        !            27: distributed under the terms of a permission notice identical to this
        !            28: one.
1.1       root       29: 
                     30: Permission is granted to copy and distribute translations of this manual
                     31: into another language, under the above conditions for modified versions,
1.1.1.9 ! root       32: except that the sections entitled ``GNU General Public License'' and
        !            33: ``Protect Your Freedom---Fight `Look And Feel'@w{}'' and this permission
        !            34: notice may be included in translations approved by the Free Software
        !            35: Foundation instead of in the original English.
1.1       root       36: @end ifinfo
                     37: 
                     38: @setchapternewpage odd
                     39: 
                     40: @titlepage
                     41: @center @titlefont{Using and Porting GNU CC}
                     42: @sp 2
                     43: @center Richard M. Stallman
                     44: @sp 3
1.1.1.9 ! root       45: @center last updated 21 February 1990
1.1       root       46: @sp 1
1.1.1.9 ! root       47: @center for version 1.37.1
1.1       root       48: @page
                     49: @vskip 0pt plus 1filll
1.1.1.5   root       50: Copyright @copyright{} 1988, 1989 Free Software Foundation, Inc.
1.1       root       51: 
                     52: Permission is granted to make and distribute verbatim copies of
                     53: this manual provided the copyright notice and this permission notice
                     54: are preserved on all copies.
                     55: 
                     56: Permission is granted to copy and distribute modified versions of this
                     57: manual under the conditions for verbatim copying, provided also that the
1.1.1.9 ! root       58: sections entitled ``GNU General Public License'' and ``Protect Your
        !            59: Freedom---Fight `Look And Feel'@w{}'' are included exactly as in the
        !            60: original, and provided that the entire resulting derived work is
        !            61: distributed under the terms of a permission notice identical to this
        !            62: one.
1.1       root       63: 
                     64: Permission is granted to copy and distribute translations of this manual
                     65: into another language, under the above conditions for modified versions,
1.1.1.9 ! root       66: except that the sections entitled ``GNU General Public License'' and
        !            67: ``Protect Your Freedom---Fight `Look And Feel'@w{}'' and this permission
        !            68: notice may be included in translations approved by the Free Software
        !            69: Foundation instead of in the original English.
1.1       root       70: @end titlepage
                     71: @page
                     72: 
                     73: @ifinfo
                     74: @node Top, Copying,, (DIR)
                     75: @ichapter Introduction
                     76: 
                     77: This manual documents how to run, install and port the GNU C compiler, as
                     78: well as its new features and incompatibilities, and how to report bugs.
                     79: 
                     80: @end ifinfo
                     81: @menu
1.1.1.6   root       82: * Copying::         GNU General Public License says
1.1       root       83:                      how you can copy and share GNU CC.
                     84: * Contributors::    People who have contributed to GNU CC.
1.1.1.9 ! root       85: * Boycott::        Protect your freedom---fight ``look and feel''.
1.1       root       86: * Options::         Command options supported by @samp{gcc}.
                     87: * Installation::    How to configure, compile and install GNU CC.
                     88: * Trouble::         If you have trouble installing GNU CC.
                     89: * Incompatibilities:: Incompatibilities of GNU CC.
                     90: * Extensions::      GNU extensions to the C language.
                     91: * Bugs::            How to report bugs (if you want to get them fixed).
                     92: * Portability::     Goals of GNU CC's portability features.
                     93: * Interface::       Function-call interface of GNU CC output.
                     94: * Passes::          Order of passes, what they do, and what each file is for.
                     95: * RTL::             The intermediate representation that most passes work on.
                     96: * Machine Desc::    How to write machine description instruction patterns.
                     97: * Machine Macros::  How to write the machine description C macros.
1.1.1.8   root       98: * Config::          Writing the @file{xm-@var{machine}.h} file.
1.1       root       99: @end menu
                    100: 
                    101: @node Copying, Contributors, Top, Top
1.1.1.6   root      102: @unnumbered GNU GENERAL PUBLIC LICENSE
                    103: @center Version 1, February 1989
1.1       root      104: 
1.1.1.6   root      105: @display
                    106: Copyright @copyright{} 1989 Free Software Foundation, Inc.
                    107: 675 Mass Ave, Cambridge, MA 02139, USA
                    108: 
                    109: Everyone is permitted to copy and distribute verbatim copies
                    110: of this license document, but changing it is not allowed.
                    111: @end display
                    112: 
                    113: @unnumberedsec Preamble
                    114: 
                    115:   The license agreements of most software companies try to keep users
                    116: at the mercy of those companies.  By contrast, our General Public
                    117: License is intended to guarantee your freedom to share and change free
                    118: software---to make sure the software is free for all its users.  The
                    119: General Public License applies to the Free Software Foundation's
                    120: software and to any other program whose authors commit to using it.
                    121: You can use it for your programs, too.
                    122: 
                    123:   When we speak of free software, we are referring to freedom, not
                    124: price.  Specifically, the General Public License is designed to make
                    125: sure that you have the freedom to give away or sell copies of free
                    126: software, that you receive source code or can get it if you want it,
                    127: that you can change the software or use pieces of it in new free
                    128: programs; and that you know you can do these things.
                    129: 
                    130:   To protect your rights, we need to make restrictions that forbid
                    131: anyone to deny you these rights or to ask you to surrender the rights.
                    132: These restrictions translate to certain responsibilities for you if you
                    133: distribute copies of the software, or if you modify it.
                    134: 
                    135:   For example, if you distribute copies of a such a program, whether
                    136: gratis or for a fee, you must give the recipients all the rights that
                    137: you have.  You must make sure that they, too, receive or can get the
1.1       root      138: source code.  And you must tell them their rights.
                    139: 
1.1.1.6   root      140:   We protect your rights with two steps: (1) copyright the software, and
                    141: (2) offer you this license which gives you legal permission to copy,
                    142: distribute and/or modify the software.
                    143: 
                    144:   Also, for each author's protection and ours, we want to make certain
                    145: that everyone understands that there is no warranty for this free
                    146: software.  If the software is modified by someone else and passed on, we
                    147: want its recipients to know that what they have is not the original, so
                    148: that any problems introduced by others will not reflect on the original
                    149: authors' reputations.
1.1       root      150: 
1.1.1.6   root      151:   The precise terms and conditions for copying, distribution and
                    152: modification follow.
1.1       root      153: 
1.1.1.6   root      154: @iftex
                    155: @unnumberedsec TERMS AND CONDITIONS
                    156: @end iftex
                    157: @ifinfo
                    158: @center TERMS AND CONDITIONS
                    159: @end ifinfo
1.1       root      160: 
1.1.1.6   root      161: @enumerate
1.1       root      162: @item
1.1.1.6   root      163: This License Agreement applies to any program or other work which
                    164: contains a notice placed by the copyright holder saying it may be
                    165: distributed under the terms of this General Public License.  The
                    166: ``Program'', below, refers to any such program or work, and a ``work based
                    167: on the Program'' means either the Program or any work containing the
                    168: Program or a portion of it, either verbatim or with modifications.  Each
                    169: licensee is addressed as ``you''.
                    170: 
                    171: @item
                    172: You may copy and distribute verbatim copies of the Program's source
                    173: code as you receive it, in any medium, provided that you conspicuously and
                    174: appropriately publish on each copy an appropriate copyright notice and
                    175: disclaimer of warranty; keep intact all the notices that refer to this
                    176: General Public License and to the absence of any warranty; and give any
                    177: other recipients of the Program a copy of this General Public License
                    178: along with the Program.  You may charge a fee for the physical act of
                    179: transferring a copy.
                    180: 
                    181: @item
                    182: You may modify your copy or copies of the Program or any portion of
                    183: it, and copy and distribute such modifications under the terms of Paragraph
                    184: 1 above, provided that you also do the following:
1.1       root      185: 
                    186: @itemize @bullet
                    187: @item
1.1.1.6   root      188: cause the modified files to carry prominent notices stating that
                    189: you changed the files and the date of any change; and
1.1       root      190: 
                    191: @item
                    192: cause the whole of any work that you distribute or publish, that
1.1.1.6   root      193: in whole or in part contains the Program or any part thereof, either
                    194: with or without modifications, to be licensed at no charge to all
                    195: third parties under the terms of this General Public License (except
                    196: that you may choose to grant warranty protection to some or all
                    197: third parties, at your option).
                    198: 
                    199: @item
                    200: If the modified program normally reads commands interactively when
                    201: run, you must cause it, when started running for such interactive use
                    202: in the simplest and most usual way, to print or display an
                    203: announcement including an appropriate copyright notice and a notice
                    204: that there is no warranty (or else, saying that you provide a
                    205: warranty) and that users may redistribute the program under these
                    206: conditions, and telling the user how to view a copy of this General
                    207: Public License.
                    208: 
                    209: @item
                    210: You may charge a fee for the physical act of transferring a
                    211: copy, and you may at your option offer warranty protection in
                    212: exchange for a fee.
1.1       root      213: @end itemize
                    214: 
1.1.1.6   root      215: Mere aggregation of another independent work with the Program (or its
1.1       root      216: derivative) on a volume of a storage or distribution medium does not bring
1.1.1.6   root      217: the other work under the scope of these terms.
1.1       root      218: 
                    219: @item
1.1.1.6   root      220: You may copy and distribute the Program (or a portion or derivative of
                    221: it, under Paragraph 2) in object code or executable form under the terms of
                    222: Paragraphs 1 and 2 above provided that you also do one of the following:
1.1       root      223: 
                    224: @itemize @bullet
                    225: @item
                    226: accompany it with the complete corresponding machine-readable
                    227: source code, which must be distributed under the terms of
                    228: Paragraphs 1 and 2 above; or,
                    229: 
                    230: @item
                    231: accompany it with a written offer, valid for at least three
1.1.1.6   root      232: years, to give any third party free (except for a nominal charge
                    233: for the cost of distribution) a complete machine-readable copy of the
1.1       root      234: corresponding source code, to be distributed under the terms of
                    235: Paragraphs 1 and 2 above; or,
                    236: 
                    237: @item
                    238: accompany it with the information you received as to where the
                    239: corresponding source code may be obtained.  (This alternative is
                    240: allowed only for noncommercial distribution and only if you
                    241: received the program in object code or executable form alone.)
                    242: @end itemize
                    243: 
1.1.1.6   root      244: Source code for a work means the preferred form of the work for making
                    245: modifications to it.  For an executable file, complete source code means
                    246: all the source code for all modules it contains; but, as a special
                    247: exception, it need not include source code for modules which are standard
                    248: libraries that accompany the operating system on which the executable
                    249: file runs, or for standard header files or definitions files that
                    250: accompany that operating system.
                    251: 
                    252: @item
                    253: You may not copy, modify, sublicense, distribute or transfer the
                    254: Program except as expressly provided under this General Public License.
                    255: Any attempt otherwise to copy, modify, sublicense, distribute or transfer
                    256: the Program is void, and will automatically terminate your rights to use
                    257: the Program under this License.  However, parties who have received
                    258: copies, or rights to use copies, from you under this General Public
                    259: License will not have their licenses terminated so long as such parties
                    260: remain in full compliance.
                    261: 
                    262: @item
                    263: By copying, distributing or modifying the Program (or any work based
                    264: on the Program) you indicate your acceptance of this license to do so,
                    265: and all its terms and conditions.
                    266: 
                    267: @item
                    268: Each time you redistribute the Program (or any work based on the
                    269: Program), the recipient automatically receives a license from the original
                    270: licensor to copy, distribute or modify the Program subject to these
                    271: terms and conditions.  You may not impose any further restrictions on the
                    272: recipients' exercise of the rights granted herein.
                    273: 
                    274: @item
                    275: The Free Software Foundation may publish revised and/or new versions
                    276: of the General Public License from time to time.  Such new versions will
                    277: be similar in spirit to the present version, but may differ in detail to
                    278: address new problems or concerns.
                    279: 
                    280: Each version is given a distinguishing version number.  If the Program
                    281: specifies a version number of the license which applies to it and ``any
                    282: later version'', you have the option of following the terms and conditions
                    283: either of that version or of any later version published by the Free
                    284: Software Foundation.  If the Program does not specify a version number of
                    285: the license, you may choose any version ever published by the Free Software
                    286: Foundation.
                    287: 
                    288: @item
                    289: If you wish to incorporate parts of the Program into other free
                    290: programs whose distribution conditions are different, write to the author
                    291: to ask for permission.  For software which is copyrighted by the Free
                    292: Software Foundation, write to the Free Software Foundation; we sometimes
                    293: make exceptions for this.  Our decision will be guided by the two goals
                    294: of preserving the free status of all derivatives of our free software and
                    295: of promoting the sharing and reuse of software generally.
                    296: 
                    297: @iftex
                    298: @heading NO WARRANTY
                    299: @end iftex
                    300: @ifinfo
                    301: @center NO WARRANTY
                    302: @end ifinfo
                    303: 
                    304: @item
                    305: BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
                    306: FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
                    307: OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
                    308: PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
                    309: OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
                    310: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
                    311: TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
                    312: PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
                    313: REPAIR OR CORRECTION.
                    314: 
                    315: @item
                    316: IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
                    317: ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
                    318: REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
                    319: INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
                    320: ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
                    321: LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
                    322: SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
                    323: WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
                    324: ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1.1       root      325: @end enumerate
                    326: 
1.1.1.6   root      327: @iftex
                    328: @heading END OF TERMS AND CONDITIONS
                    329: @end iftex
                    330: @ifinfo
                    331: @center END OF TERMS AND CONDITIONS
                    332: @end ifinfo
                    333: 
                    334: @page
                    335: @unnumberedsec Appendix: How to Apply These Terms to Your New Programs
                    336: 
                    337:   If you develop a new program, and you want it to be of the greatest
                    338: possible use to humanity, the best way to achieve this is to make it
                    339: free software which everyone can redistribute and change under these
                    340: terms.
                    341: 
                    342:   To do so, attach the following notices to the program.  It is safest to
                    343: attach them to the start of each source file to most effectively convey
                    344: the exclusion of warranty; and each file should have at least the
                    345: ``copyright'' line and a pointer to where the full notice is found.
                    346: 
                    347: @smallexample
                    348: @var{one line to give the program's name and a brief idea of what it does.}
                    349: Copyright (C) 19@var{yy}  @var{name of author}
                    350: 
                    351: This program is free software; you can redistribute it and/or modify
                    352: it under the terms of the GNU General Public License as published by
                    353: the Free Software Foundation; either version 1, or (at your option)
                    354: any later version.
                    355: 
                    356: This program is distributed in the hope that it will be useful,
                    357: but WITHOUT ANY WARRANTY; without even the implied warranty of
                    358: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    359: GNU General Public License for more details.
                    360: 
                    361: You should have received a copy of the GNU General Public License
                    362: along with this program; if not, write to the Free Software
                    363: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
                    364: @end smallexample
                    365: 
                    366: Also add information on how to contact you by electronic and paper mail.
                    367: 
                    368: If the program is interactive, make it output a short notice like this
                    369: when it starts in an interactive mode:
                    370: 
                    371: @smallexample
                    372: Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
                    373: Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
                    374: This is free software, and you are welcome to redistribute it
                    375: under certain conditions; type `show c' for details.
                    376: @end smallexample
                    377: 
                    378: The hypothetical commands `show w' and `show c' should show the
                    379: appropriate parts of the General Public License.  Of course, the
                    380: commands you use may be called something other than `show w' and `show
                    381: c'; they could even be mouse-clicks or menu items---whatever suits your
                    382: program.
                    383: 
                    384: You should also get your employer (if you work as a programmer) or your
                    385: school, if any, to sign a ``copyright disclaimer'' for the program, if
                    386: necessary.  Here a sample; alter the names:
                    387: 
                    388: @example
                    389: Yoyodyne, Inc., hereby disclaims all copyright interest in the
                    390: program `Gnomovision' (a program to direct compilers to make passes
                    391: at assemblers) written by James Hacker.
                    392: 
                    393: @var{signature of Ty Coon}, 1 April 1989
                    394: Ty Coon, President of Vice
                    395: @end example
                    396: 
                    397: That's all there is to it!
1.1       root      398: 
1.1.1.9 ! root      399: @node Contributors, Boycott, Copying, Top
1.1       root      400: @unnumbered Contributors to GNU CC
                    401: 
                    402: In addition to Richard Stallman, several people have written parts
                    403: of GNU CC.
                    404: 
                    405: @itemize @bullet
                    406: @item
                    407: The idea of using RTL and some of the optimization ideas came from the
                    408: U. of Arizona Portable Optimizer, written by Jack Davidson and
                    409: Christopher Fraser.  See ``Register Allocation and Exhaustive Peephole
                    410: Optimization'', Software Practice and Experience 14 (9), Sept. 1984,
                    411: 857-866.
                    412: 
                    413: @item
                    414: Paul Rubin wrote most of the preprocessor.
                    415: 
                    416: @item
1.1.1.6   root      417: Leonard Tower wrote parts of the parser, RTL generator, and RTL
1.1       root      418: definitions, and of the Vax machine description.
                    419: 
                    420: @item
                    421: Ted Lemon wrote parts of the RTL reader and printer.
                    422: 
                    423: @item
                    424: Jim Wilson implemented loop strength reduction and some other
                    425: loop optimizations.
                    426: 
                    427: @item
                    428: Nobuyuki Hikichi of Software Research Associates, Tokyo, contributed
1.1.1.8   root      429: the support for the Sony NEWS machine.
1.1       root      430: 
                    431: @item
                    432: Charles LaBrec contributed the support for the Integrated Solutions
                    433: 68020 system.
                    434: 
                    435: @item
                    436: Michael Tiemann of MCC wrote most of the description of the National
                    437: Semiconductor 32000 series cpu.  He also wrote the code for inline
                    438: function integration and for the SPARC cpu and Motorola 88000 cpu
                    439: and part of the Sun FPA support.
                    440: 
                    441: @item
                    442: Jan Stein of the Chalmers Computer Society provided support for
                    443: Genix, as well as part of the 32000 machine description.
                    444: 
                    445: @item
                    446: Randy Smith finished the Sun FPA support.
                    447: 
                    448: @item
                    449: Robert Brown implemented the support for Encore 32000 systems.
                    450: 
                    451: @item
                    452: David Kashtan of SRI adapted GNU CC to the Vomit-Making System.
                    453: 
                    454: @item
                    455: Alex Crain provided changes for the 3b1.
                    456: 
                    457: @item
                    458: Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX for
                    459: the 9000 series 300.
                    460: 
                    461: @item
                    462: William Schelter did most of the work on the Intel 80386 support.
1.1.1.5   root      463: 
                    464: @item
                    465: Christopher Smith did the port for Convex machines.
                    466: 
                    467: @item
                    468: Paul Petersen wrote the machine description for the Alliant FX/8.
1.1.1.7   root      469: 
                    470: @item
1.1.1.8   root      471: Alain Lichnewsky ported GNU CC to the Mips cpu.
                    472: 
                    473: @item
                    474: Devon Bowen, Dale Wiles and Kevin Zachmann ported GNU CC to the Tahoe.
                    475: 
                    476: @item
                    477: Jonathan Stone wrote the machine description for the Pyramid computer.
1.1       root      478: @end itemize
                    479: 
1.1.1.9 ! root      480: @node Boycott, Options, Contributors, Top
        !           481: @chapter Protect Your Freedom---Fight ``Look And Feel''
        !           482: 
        !           483: Ashton-Tate, Apple, Lotus and Xerox are trying to create a new form of
        !           484: legal monopoly: a copyright on a class of user interfaces.  These
        !           485: monopolies would cause serious problems for users and developers of
        !           486: computer software and systems.
        !           487: 
        !           488: Until three years ago, the law seemed clear: no one could restrict
        !           489: others from using a user interface; programmers were free to implement
        !           490: any interface they chose.  Imitating interfaces, sometimes with changes,
        !           491: was standard practice in the computer field.  The interfaces we know
        !           492: evolved gradually in this way; for example, the Macintosh user interface
        !           493: drew ideas from the Xerox interface, which in turn drew on work done at
        !           494: Stanford and SRI.  1-2-3 imitated VisiCalc, and dBase imitated a database
        !           495: program from JPL.
        !           496: 
        !           497: Most computer companies, and nearly all computer users, were happy with
        !           498: this state of affairs.  The companies that are suing say it does not
        !           499: offer ``enough incentive'' to develop their products, but they must have
        !           500: considered it ``enough'' when they made their decision to do so.  It
        !           501: seems they are not satisfied with the opportunity to continue to compete
        !           502: in the marketplace---not even with a head start.
        !           503: 
        !           504: If Xerox, Lotus, Apple and Ashton-Tate are permitted to make law through
        !           505: the courts, the precedent will hobble the software industry:
        !           506: 
        !           507: @itemize @bullet
        !           508: @item
        !           509: Gratuitous incompatibilites will burden users.  Imagine if each
        !           510: car manufacturer had to arrange the pedals in a different order.
        !           511: 
        !           512: @item
        !           513: Software will become and remain more expensive.  Users will be
        !           514: ``locked in'' to proprietary interfaces, for which there is no real
        !           515: competition.
        !           516: 
        !           517: @item
        !           518: Large companies have an unfair advantage wherever lawsuits become
        !           519: commonplace.  Since they can easily afford to sue, they can intimidate
        !           520: small companies with threats even when they don't really have a case.
        !           521: 
        !           522: @item
        !           523: User interface improvements will come slower, since incremental
        !           524: evolution through creative imitation will no longer be permitted.
        !           525: 
        !           526: @item
        !           527: Even Apple, etc., will find it harder to make improvements if
        !           528: they can no longer adapt the good ideas that others introduce, for
        !           529: fear of weakening their own legal positions.  Some users suggest that
        !           530: this stagnation may already have started.
        !           531: @end itemize
        !           532: 
        !           533: Here are some things you can do to protect your freedom to write
        !           534: programs:
        !           535: 
        !           536: @itemize @bullet
        !           537: @item
        !           538: Don't buy from Xerox, Lotus, Apple or Ashton-Tate.  Buy from their
        !           539: competitors or from the defendants they are suing.
        !           540: 
        !           541: @item
        !           542: Don't develop software to work with the systems made by these companies.
        !           543: 
        !           544: @item
        !           545: Port your existing software to competing systems, so that you encourage
        !           546: users to switch.
        !           547: 
        !           548: @item
        !           549: Write letters to company presidents to let them know their conduct
        !           550: is unacceptable.
        !           551: 
        !           552: @item
        !           553: Tell your friends and colleagues about this issue and how it threatens
        !           554: to ruin the computer industry.
        !           555: 
        !           556: @item
        !           557: Join the League for Programming Freedom.  Phone (617) 492-0023 or write to:
        !           558: 
        !           559: @example
        !           560: League for Programming Freedom
        !           561: 1 Kendall Square #143
        !           562: P.O. Box 9171
        !           563: Cambridge, MA 02139       league@@prep.ai.mit.edu
        !           564: @end example
        !           565: 
        !           566: @item
        !           567: Above all, don't work for the look-and-feel plaintiffs, and don't
        !           568: accept contracts from them.
        !           569: 
        !           570: @item
        !           571: Write to or phone your elected representatives to show them how
        !           572: important this issue is.
        !           573: 
        !           574: @example
        !           575: Senator So and So       Representative So and So
        !           576: United States Senate    House of Representatives
        !           577: Washington, DC 20510    Washington, DC 20515
        !           578: @end example
        !           579: 
        !           580: You can phone senators and representatives at (202) 225-3121.
        !           581: @end itemize
        !           582: 
        !           583: Express your opinion!  You can make a difference.
        !           584: 
        !           585: @node Options, Installation, Boycott, Top
1.1       root      586: @chapter GNU CC Command Options
                    587: 
                    588: The GNU C compiler uses a command syntax much like the Unix C compiler.
                    589: The @code{gcc} program accepts options and file names as operands.
                    590: Multiple single-letter options may @emph{not} be grouped: @samp{-dr} is
1.1.1.8   root      591: very different from @w{@samp{-d -r}}.
1.1       root      592: 
                    593: When you invoke GNU CC, it normally does preprocessing, compilation,
                    594: assembly and linking.  File names which end in @samp{.c} are taken as C
1.1.1.5   root      595: source to be preprocessed and compiled; file names ending in @samp{.i}
                    596: are taken as preprocessor output to be compiled; compiler output files
                    597: plus any input files with names ending in @samp{.s} are assembled; then
                    598: the resulting object files, plus any other input files, are linked
                    599: together to produce an executable.
1.1       root      600: 
                    601: Command options allow you to stop this process at an intermediate stage.
                    602: For example, the @samp{-c} option says not to run the linker.  Then the
                    603: output consists of object files output by the assembler.
                    604: 
1.1.1.5   root      605: Other command options are passed on to one stage of processing.  Some
                    606: options control the preprocessor and others the compiler itself.  Yet
                    607: other options control the assembler and linker; these are not documented
                    608: here, but you rarely need to use any of them.
1.1       root      609: 
                    610: Here are the options to control the overall compilation process, including
                    611: those that say whether to link, whether to assemble, and so on.
                    612: 
                    613: @table @samp
                    614: @item -o @var{file}
                    615: Place output in file @var{file}.  This applies regardless to whatever
                    616: sort of output is being produced, whether it be an executable file,
                    617: an object file, an assembler file or preprocessed C code.
                    618: 
                    619: If @samp{-o} is not specified, the default is to put an executable file
                    620: in @file{a.out}, the object file @file{@var{source}.c} in
                    621: @file{@var{source}.o}, an assembler file in @file{@var{source}.s}, and
                    622: preprocessed C on standard output.@refill
                    623: 
                    624: @item -c
                    625: Compile or assemble the source files, but do not link.  Produce object
                    626: files with names made by replacing @samp{.c} or @samp{.s} with
                    627: @samp{.o} at the end of the input file names.  Do nothing at all for
                    628: object files specified as input.
                    629: 
                    630: @item -S
                    631: Compile into assembler code but do not assemble.  The assembler output
                    632: file name is made by replacing @samp{.c} with @samp{.s} at the end of
                    633: the input file name.  Do nothing at all for assembler source files or
                    634: object files specified as input.
                    635: 
                    636: @item -E
                    637: Run only the C preprocessor.  Preprocess all the C source files
                    638: specified and output the results to standard output.
                    639: 
                    640: @item -v
                    641: Compiler driver program prints the commands it executes as it runs
                    642: the preprocessor, compiler proper, assembler and linker.  Some of
                    643: these are directed to print their own version numbers.
                    644: 
1.1.1.5   root      645: @item -pipe
                    646: Use pipes rather than temporary files for communication between the
                    647: various stages of compilation.  This fails to work on some systems
                    648: where the assembler is unable to read from a pipe; but the GNU
                    649: assembler has no trouble.
                    650: 
1.1       root      651: @item -B@var{prefix}
                    652: Compiler driver program tries @var{prefix} as a prefix for each
                    653: program it tries to run.  These programs are @file{cpp}, @file{cc1},
                    654: @file{as} and @file{ld}.
                    655: 
                    656: For each subprogram to be run, the compiler driver first tries the
                    657: @samp{-B} prefix, if any.  If that name is not found, or if @samp{-B}
                    658: was not specified, the driver tries two standard prefixes, which are
                    659: @file{/usr/lib/gcc-} and @file{/usr/local/lib/gcc-}.  If neither of
                    660: those results in a file name that is found, the unmodified program
                    661: name is searched for using the directories specified in your
                    662: @samp{PATH} environment variable.
                    663: 
                    664: The run-time support file @file{gnulib} is also searched for using
                    665: the @samp{-B} prefix, if needed.  If it is not found there, the two
                    666: standard prefixes above are tried, and that is all.  The file is left
                    667: out of the link if it is not found by those means.  Most of the time,
                    668: on most machines, you can do without it.
1.1.1.5   root      669: 
                    670: You can get a similar result from the environment variable;
                    671: @code{GCC_EXEC_PREFIX} if it is defined, its value is used as a prefix
                    672: in the same way.  If both the @samp{-B} option and the
                    673: @code{GCC_EXEC_PREFIX} variable are present, the @samp{-B} option is
                    674: used first and the environment variable value second.
1.1.1.8   root      675: 
                    676: @item -b@var{prefix}
                    677: The argument @var{prefix} is used as a second prefix for the compiler
                    678: executables and libraries.  This prefix is optional: the compiler tries
                    679: each file first with it, then without it.  This prefix follows the
                    680: prefix specified with @samp{-B} or the default prefixes.
                    681: 
                    682: Thus, @samp{-bvax- -Bcc/} in the presence of environment variable
                    683: @code{GCC_EXEC_PREFIX} with definition @file{/u/foo/} causes GNU CC to
                    684: try the following file names for the preprocessor executable:
                    685: 
                    686: @example
                    687: cc/vax-cpp
                    688: cc/cpp
                    689: /u/foo/vax-cpp
                    690: /u/foo/cpp
                    691: /usr/local/lib/gcc-vax-cpp
                    692: /usr/local/lib/gcc-cpp
                    693: /usr/lib/gcc-vax-cpp
                    694: /usr/lib/gcc-cpp
                    695: @end example
1.1       root      696: @end table
                    697: 
                    698: These options control the details of C compilation itself.
                    699: 
                    700: @table @samp
                    701: @item -ansi
                    702: Support all ANSI standard C programs.
                    703: 
                    704: This turns off certain features of GNU C that are incompatible with
                    705: ANSI C, such as the @code{asm}, @code{inline} and @code{typeof}
                    706: keywords, and predefined macros such as @code{unix} and @code{vax}
                    707: that identify the type of system you are using.  It also enables the
                    708: undesirable and rarely used ANSI trigraph feature.
                    709: 
1.1.1.8   root      710: The alternate keywords @code{__asm__}, @code{__inline__} and
                    711: @code{__typeof__} continue to work despite @samp{-ansi}.  You would not
1.1.1.7   root      712: want to use them in an ANSI C program, of course, but it useful to put
                    713: them in header files that might be included in compilations done with
1.1.1.8   root      714: @samp{-ansi}.  Alternate predefined macros such as @code{__unix__} and
                    715: @code{__vax__} are also available, with or without @samp{-ansi}.
1.1.1.7   root      716: 
1.1       root      717: The @samp{-ansi} option does not cause non-ANSI programs to be
                    718: rejected gratuitously.  For that, @samp{-pedantic} is required in
                    719: addition to @samp{-ansi}.
                    720: 
                    721: The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
                    722: option is used.  Some header files may notice this macro and refrain
                    723: from declaring certain functions or defining certain macros that the
1.1.1.7   root      724: ANSI standard doesn't call for; this is to avoid interfering with any
                    725: programs that might use these names for other things.
1.1       root      726: 
                    727: @item -traditional
                    728: Attempt to support some aspects of traditional C compilers.
                    729: Specifically:
                    730: 
                    731: @itemize @bullet
                    732: @item
                    733: All @code{extern} declarations take effect globally even if they
                    734: are written inside of a function definition.  This includes implicit
                    735: declarations of functions.
                    736: 
                    737: @item
                    738: The keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
                    739: and @code{volatile} are not recognized.@refill
                    740: 
                    741: @item
                    742: Comparisons between pointers and integers are always allowed.
                    743: 
                    744: @item
                    745: Integer types @code{unsigned short} and @code{unsigned char} promote
                    746: to @code{unsigned int}.
                    747: 
                    748: @item
                    749: Out-of-range floating point literals are not an error.
                    750: 
                    751: @item
1.1.1.8   root      752: String ``constants'' are not necessarily constant; they are stored in
                    753: writable space, and identical looking constants are allocated
                    754: separately.
                    755: 
                    756: @item
1.1.1.2   root      757: All automatic variables not declared @code{register} are preserved by
                    758: @code{longjmp}.  Ordinarily, GNU C follows ANSI C: automatic variables
                    759: not declared @code{volatile} may be clobbered.
                    760: 
                    761: @item
1.1       root      762: In the preprocessor, comments convert to nothing at all, rather than
                    763: to a space.  This allows traditional token concatenation.
                    764: 
                    765: @item
                    766: In the preprocessor, macro arguments are recognized within string
                    767: constants in a macro definition (and their values are stringified,
                    768: though without additional quote marks, when they appear in such a
                    769: context).  The preprocessor always considers a string constant to end
                    770: at a newline.
                    771: 
                    772: @item
                    773: The predefined macro @code{__STDC__} is not defined when you use
                    774: @samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
                    775: which @code{__GNUC__} indicates are not affected by
                    776: @samp{-traditional}).  If you need to write header files that work
                    777: differently depending on whether @samp{-traditional} is in use, by
                    778: testing both of these predefined macros you can distinguish four
                    779: situations: GNU C, traditional GNU C, other ANSI C compilers, and
                    780: other old C compilers.
                    781: @end itemize
                    782: 
                    783: @item -O
                    784: Optimize.  Optimizing compilation takes somewhat more time, and a lot
                    785: more memory for a large function.
                    786: 
                    787: Without @samp{-O}, the compiler's goal is to reduce the cost of
                    788: compilation and to make debugging produce the expected results.
                    789: Statements are independent: if you stop the program with a breakpoint
                    790: between statements, you can then assign a new value to any variable or
                    791: change the program counter to any other statement in the function and
                    792: get exactly the results you would expect from the source code.
                    793: 
                    794: Without @samp{-O}, only variables declared @code{register} are
                    795: allocated in registers.  The resulting compiled code is a little worse
                    796: than produced by PCC without @samp{-O}.
                    797: 
                    798: With @samp{-O}, the compiler tries to reduce code size and execution
                    799: time.
                    800: 
                    801: Some of the @samp{-f} options described below turn specific kinds of
                    802: optimization on or off.
                    803: 
                    804: @item -g
                    805: Produce debugging information in the operating system's native format
                    806: (for DBX or SDB).  GDB also can work with this debugging information.
                    807: 
                    808: Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
                    809: @samp{-O}.  The shortcuts taken by optimized code may occasionally
                    810: produce surprising results: some variables you declared may not exist
                    811: at all; flow of control may briefly move where you did not expect it;
                    812: some statements may not be executed because they compute constant
                    813: results or their values were already at hand; some statements may
                    814: execute in different places because they were moved out of loops.
                    815: Nevertheless it proves possible to debug optimized output.  This makes
                    816: it reasonable to use the optimizer for programs that might have bugs.
                    817: 
                    818: @item -gg
1.1.1.8   root      819: Produce debugging information in the old GDB format.  This is obsolete.
1.1       root      820: 
                    821: @item -w
                    822: Inhibit all warning messages.
                    823: 
                    824: @item -W
                    825: Print extra warning messages for these events:
                    826: 
                    827: @itemize @bullet
                    828: @item
                    829: An automatic variable is used without first being initialized.
                    830: 
                    831: These warnings are possible only in optimizing compilation,
                    832: because they require data flow information that is computed only
1.1.1.6   root      833: when optimizing.  If you don't specify @samp{-O}, you simply won't
                    834: get these warnings.
                    835: 
                    836: These warnings occur only for variables that are candidates for
                    837: register allocation.  Therefore, they do not occur for a variable that
                    838: is declared @code{volatile}, or whose address is taken, or whose size
                    839: is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
                    840: structures, unions or arrays, even when they are in registers.
                    841: 
                    842: Note that there may be no warning about a variable that is used only
                    843: to compute a value that itself is never used, because such
                    844: computations may be deleted by data flow analysis before the warnings
                    845: are printed.
1.1       root      846: 
                    847: These warnings are made optional because GNU CC is not smart
                    848: enough to see all the reasons why the code might be correct
                    849: despite appearing to have an error.  Here is one example of how
                    850: this can happen:
                    851: 
                    852: @example
                    853: @{
                    854:   int x;
                    855:   switch (y)
                    856:     @{
                    857:     case 1: x = 1;
                    858:       break;
                    859:     case 2: x = 4;
                    860:       break;
                    861:     case 3: x = 5;
                    862:     @}
                    863:   foo (x);
                    864: @}
                    865: @end example
                    866: 
                    867: @noindent
                    868: If the value of @code{y} is always 1, 2 or 3, then @code{x} is
                    869: always initialized, but GNU CC doesn't know this.  Here is
                    870: another common case:
                    871: 
                    872: @example
                    873: @{
                    874:   int save_y;
                    875:   if (change_y) save_y = y, y = new_y;
                    876:   @dots{}
                    877:   if (change_y) y = save_y;
                    878: @}
                    879: @end example
                    880: 
                    881: @noindent
                    882: This has no bug because @code{save_y} is used only if it is set.
                    883: 
1.1.1.5   root      884: Some spurious warnings can be avoided if you declare as
                    885: @code{volatile} all the functions you use that never return.
                    886: @xref{Function Attributes}.
                    887: 
1.1       root      888: @item
                    889: A nonvolatile automatic variable might be changed by a call to
                    890: @code{longjmp}.  These warnings as well are possible only in
                    891: optimizing compilation.
                    892: 
                    893: The compiler sees only the calls to @code{setjmp}.  It cannot know
                    894: where @code{longjmp} will be called; in fact, a signal handler could
                    895: call it at any point in the code.  As a result, you may get a warning
                    896: even when there is in fact no problem because @code{longjmp} cannot
                    897: in fact be called at the place which would cause a problem.
                    898: 
                    899: @item
                    900: A function can return either with or without a value.  (Falling
                    901: off the end of the function body is considered returning without
1.1.1.6   root      902: a value.)  For example, this function would evoke such a
1.1       root      903: warning:
                    904: 
                    905: @example
                    906: foo (a)
                    907: @{
                    908:   if (a > 0)
                    909:     return a;
                    910: @}
                    911: @end example
                    912: 
                    913: Spurious warnings can occur because GNU CC does not realize that
                    914: certain functions (including @code{abort} and @code{longjmp})
                    915: will never return.
1.1.1.4   root      916: 
                    917: @item
                    918: An expression-statement contains no side effects.
1.1       root      919: @end itemize
                    920: 
                    921: In the future, other useful warnings may also be enabled by this
                    922: option.
                    923: 
                    924: @item -Wimplicit
                    925: Warn whenever a function is implicitly declared.
                    926: 
                    927: @item -Wreturn-type
                    928: Warn whenever a function is defined with a return-type that defaults
                    929: to @code{int}.  Also warn about any @code{return} statement with no
                    930: return-value in a function whose return-type is not @code{void}.
                    931: 
                    932: @item -Wunused
1.1.1.5   root      933: Warn whenever a local variable is unused aside from its declaration,
1.1.1.8   root      934: whenever a function is declared static but never defined, and whenever
                    935: a statement computes a result that is explicitly not used.
1.1.1.7   root      936: 
                    937: @item -Wswitch
                    938: Warn whenever a @code{switch} statement has an index of enumeral type
                    939: and lacks a @code{case} for one or more of the named codes of that
                    940: enumeration.  (The presence of a @code{default} label prevents this
                    941: warning.)  @code{case} labels outside the enumeration range also
                    942: provoke warnings when this option is used.
                    943: 
1.1       root      944: @item -Wcomment
                    945: Warn whenever a comment-start sequence @samp{/*} appears in a comment.
                    946: 
1.1.1.7   root      947: @item -Wtrigraphs
                    948: Warn if any trigraphs are encountered (assuming they are enabled).
                    949: 
1.1       root      950: @item -Wall
1.1.1.8   root      951: All of the above @samp{-W} options combined.  These are all the
                    952: options which pertain to usage that we recommend avoiding and that we
                    953: believe is easy to avoid, even in conjunction with macros.
                    954: 
                    955: The other @samp{-W@dots{}} options below are not implied by @samp{-Wall}
                    956: because certain kinds of useful macros are almost impossible to write
                    957: without causing those warnings.
                    958: 
                    959: @item -Wshadow
                    960: Warn whenever a local variable shadows another local variable.
                    961: 
                    962: @item -Wid-clash-@var{len}
                    963: Warn whenever two distinct identifiers match in the first @var{len}
                    964: characters.  This may help you prepare a program that will compile
                    965: with certain obsolete, brain-damaged compilers.
                    966: 
                    967: @item -Wpointer-arith
                    968: Warn about anything that depends on the ``size of'' a function type or
                    969: of @code{void}.  GNU C assigns these types a size of 1, for
                    970: convenience in calculations with @code{void *} pointers and pointers
                    971: to functions.
1.1       root      972: 
1.1.1.6   root      973: @item -Wcast-qual
                    974: Warn whenever a pointer is cast so as to remove a type qualifier from
                    975: the target type.  For example, warn if a @code{const char *} is cast
                    976: to an ordinary @code{char *}.
                    977: 
1.1       root      978: @item -Wwrite-strings
                    979: Give string constants the type @code{const char[@var{length}]} so that
                    980: copying the address of one into a non-@code{const} @code{char *}
                    981: pointer will get a warning.  These warnings will help you find at
                    982: compile time code that can try to write into a string constant, but
                    983: only if you have been very careful about using @code{const} in
                    984: declarations and prototypes.  Otherwise, it will just be a nuisance;
                    985: this is why we did not make @samp{-Wall} request these warnings.
                    986: 
                    987: @item -p
                    988: Generate extra code to write profile information suitable for the
                    989: analysis program @code{prof}.
                    990: 
                    991: @item -pg
                    992: Generate extra code to write profile information suitable for the
                    993: analysis program @code{gprof}.
                    994: 
1.1.1.6   root      995: @item -a
1.1.1.8   root      996: Generate extra code to write profile information for basic blocks, which
                    997: will record the number of times each basic block is executed.  This data
                    998: could be analyzed by a program like @code{tcov}.  Note, however, that
                    999: the format of the data is not what @code{tcov} expects.  Eventually GNU
1.1.1.6   root     1000: @code{gprof} should be extended to process this data.
                   1001: 
1.1       root     1002: @item -l@var{library}
                   1003: Search a standard list of directories for a library named
                   1004: @var{library}, which is actually a file named
                   1005: @file{lib@var{library}.a}.  The linker uses this file as if it
                   1006: had been specified precisely by name.
                   1007: 
                   1008: The directories searched include several standard system directories
                   1009: plus any that you specify with @samp{-L}.
                   1010: 
                   1011: Normally the files found this way are library files---archive files
                   1012: whose members are object files.  The linker handles an archive file by
                   1013: scanning through it for members which define symbols that have so far
                   1014: been referenced but not defined.  But if the file that is found is an
                   1015: ordinary object file, it is linked in the usual fashion.  The only
                   1016: difference between using an @samp{-l} option and specifying a file name
                   1017: is that @samp{-l} searches several directories.
                   1018: 
                   1019: @item -L@var{dir}
                   1020: Add directory @var{dir} to the list of directories to be searched
                   1021: for @samp{-l}.
                   1022: 
                   1023: @item -nostdlib
1.1.1.9 ! root     1024: Don't use the standard system libraries and startup files when linking.
        !          1025: Only the files you specify will be passed to the linker.
1.1       root     1026: 
                   1027: @item -m@var{machinespec}
                   1028: Machine-dependent option specifying something about the type of target
                   1029: machine.  These options are defined by the macro
                   1030: @code{TARGET_SWITCHES} in the machine description.  The default for
                   1031: the options is also defined by that macro, which enables you to change
                   1032: the defaults.@refill
                   1033: 
                   1034: These are the @samp{-m} options defined in the 68000 machine
                   1035: description:
                   1036: 
                   1037: @table @samp
                   1038: @item -m68020
                   1039: @itemx -mc68020
                   1040: Generate output for a 68020 (rather than a 68000).  This is the
                   1041: default if you use the unmodified sources.
                   1042: 
                   1043: @item -m68000
                   1044: @item -mc68000
                   1045: Generate output for a 68000 (rather than a 68020).
                   1046: 
                   1047: @item -m68881
                   1048: Generate output containing 68881 instructions for floating point.
                   1049: This is the default if you use the unmodified sources.
                   1050: 
                   1051: @item -mfpa
                   1052: Generate output containing Sun FPA instructions for floating point.
                   1053: 
                   1054: @item -msoft-float
                   1055: Generate output containing library calls for floating point.
                   1056: 
                   1057: @item -mshort
                   1058: Consider type @code{int} to be 16 bits wide, like @code{short int}.
                   1059: 
                   1060: @item -mnobitfield
                   1061: Do not use the bit-field instructions.  @samp{-m68000} implies
                   1062: @samp{-mnobitfield}.
                   1063: 
                   1064: @item -mbitfield
                   1065: Do use the bit-field instructions.  @samp{-m68020} implies
                   1066: @samp{-mbitfield}.  This is the default if you use the unmodified
                   1067: sources.
                   1068: 
                   1069: @item -mrtd
                   1070: Use a different function-calling convention, in which functions
                   1071: that take a fixed number of arguments return with the @code{rtd}
                   1072: instruction, which pops their arguments while returning.  This
                   1073: saves one instruction in the caller since there is no need to pop
                   1074: the arguments there.
                   1075: 
                   1076: This calling convention is incompatible with the one normally
                   1077: used on Unix, so you cannot use it if you need to call libraries
                   1078: compiled with the Unix compiler.
                   1079: 
                   1080: Also, you must provide function prototypes for all functions that
                   1081: take variable numbers of arguments (including @code{printf});
                   1082: otherwise incorrect code will be generated for calls to those
                   1083: functions.
                   1084: 
                   1085: In addition, seriously incorrect code will result if you call a
                   1086: function with too many arguments.  (Normally, extra arguments are
                   1087: harmlessly ignored.)
                   1088: 
                   1089: The @code{rtd} instruction is supported by the 68010 and 68020
                   1090: processors, but not by the 68000.
                   1091: @end table
                   1092: 
                   1093: These @samp{-m} options are defined in the Vax machine description:
                   1094: 
                   1095: @table @samp
                   1096: @item -munix
                   1097: Do not output certain jump instructions (@code{aobleq} and so on)
                   1098: that the Unix assembler for the Vax cannot handle across long
                   1099: ranges.
                   1100: 
                   1101: @item -mgnu
                   1102: Do output those jump instructions, on the assumption that you
                   1103: will assemble with the GNU assembler.
                   1104: 
                   1105: @item -mg
                   1106: Output code for g-format floating point numbers instead of d-format.
                   1107: @end table
                   1108: 
1.1.1.5   root     1109: These @samp{-m} switches are supported on the Sparc:
                   1110: 
                   1111: @table @samp
                   1112: @item -mfpu
                   1113: Generate output containing floating point instructions.  This is the
                   1114: default if you use the unmodified sources.
                   1115: 
1.1.1.9 ! root     1116: @ignore
1.1.1.5   root     1117: @item -msoft-float
                   1118: Generate output containing library calls for floating point.
                   1119: 
1.1.1.9 ! root     1120: @end ignore
1.1.1.5   root     1121: @item -mno-epilogue
1.1.1.6   root     1122: Generate separate return instructions for @code{return} statements.
                   1123: This has both advantages and disadvantages; I don't recall what they
                   1124: are.
1.1.1.5   root     1125: @end table
                   1126: 
                   1127: These @samp{-m} options are defined in the Convex machine description:
                   1128: 
                   1129: @table @samp
                   1130: @item -mc1
                   1131: Generate output for a C1.  This is the default when the compiler is
                   1132: configured for a C1.
                   1133: 
                   1134: @item -mc2
                   1135: Generate output for a C2.  This is the default when the compiler is
                   1136: configured for a C2.
                   1137: 
                   1138: @item -margcount
                   1139: Generate code which puts an argument count in the word preceding each
                   1140: argument list.  Some nonportable Convex and Vax programs need this
                   1141: word.  (Debuggers don't; this info is in the symbol table.)
                   1142: 
                   1143: @item -mnoargcount
                   1144: Omit the argument count word.  This is the default if you use the
                   1145: unmodified sources.
                   1146: @end table
                   1147: 
1.1       root     1148: @item -f@var{flag}
1.1.1.4   root     1149: Specify machine-independent flags.  Most flags have both positive and
                   1150: negative forms; the negative form of @samp{-ffoo} would be
                   1151: @samp{-fno-foo}.  In the table below, only one of the forms is
                   1152: listed---the one which is not the default.  You can figure out the
                   1153: other form by either removing @samp{no-} or adding it.
1.1       root     1154: 
                   1155: @table @samp
1.1.1.6   root     1156: @item -fpcc-struct-return
                   1157: Use the same convention for returning @code{struct} and @code{union}
                   1158: values that is used by the usual C compiler on your system.  This
                   1159: convention is less efficient for small structures, and on many
                   1160: machines it fails to be reentrant; but it has the advantage of
                   1161: allowing intercallability between GCC-compiled code and PCC-compiled
                   1162: code.
                   1163: 
1.1       root     1164: @item -ffloat-store
                   1165: Do not store floating-point variables in registers.  This
                   1166: prevents undesirable excess precision on machines such as the
                   1167: 68000 where the floating registers (of the 68881) keep more
                   1168: precision than a @code{double} is supposed to have.
                   1169: 
                   1170: For most programs, the excess precision does only good, but a few
                   1171: programs rely on the precise definition of IEEE floating point.
                   1172: Use @samp{-ffloat-store} for such programs.
                   1173: 
                   1174: @item -fno-asm
                   1175: Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1.1.1.7   root     1176: keyword.  These words may then be used as identifiers.  You can
1.1.1.8   root     1177: use @code{__asm__}, @code{__inline__} and @code{__typeof__} instead.
1.1       root     1178: 
                   1179: @item -fno-defer-pop
                   1180: Always pop the arguments to each function call as soon as that
                   1181: function returns.  Normally the compiler (when optimizing) lets
                   1182: arguments accumulate on the stack for several function calls and
                   1183: pops them all at once.
                   1184: 
                   1185: @item -fstrength-reduce
                   1186: Perform the optimizations of loop strength reduction and
                   1187: elimination of iteration variables.
                   1188: 
                   1189: @item -fcombine-regs
                   1190: Allow the combine pass to combine an instruction that copies one
                   1191: register into another.  This might or might not produce better
                   1192: code when used in addition to @samp{-O}.  I am interested in
                   1193: hearing about the difference this makes.
                   1194: 
                   1195: @item -fforce-mem
                   1196: Force memory operands to be copied into registers before doing
                   1197: arithmetic on them.  This may produce better code by making all
                   1198: memory references potential common subexpressions.  When they are
                   1199: not common subexpressions, instruction combination should
                   1200: eliminate the separate register-load.  I am interested in hearing
                   1201: about the difference this makes.
                   1202: 
                   1203: @item -fforce-addr
                   1204: Force memory address constants to be copied into registers before
                   1205: doing arithmetic on them.  This may produce better code just as
                   1206: @samp{-fforce-mem} may.  I am interested in hearing about the
                   1207: difference this makes.
                   1208: 
                   1209: @item -fomit-frame-pointer
                   1210: Don't keep the frame pointer in a register for functions that
                   1211: don't need one.  This avoids the instructions to save, set up and
                   1212: restore frame pointers; it also makes an extra register available
                   1213: in many functions.  @strong{It also makes debugging impossible.}
                   1214: 
                   1215: On some machines, such as the Vax, this flag has no effect,
                   1216: because the standard calling sequence automatically handles the
                   1217: frame pointer and nothing is saved by pretending it doesn't
                   1218: exist.  The machine-description macro
                   1219: @code{FRAME_POINTER_REQUIRED} controls whether a target machine
                   1220: supports this flag.  @xref{Registers}.@refill
                   1221: 
                   1222: @item -finline-functions
                   1223: Integrate all simple functions into their callers.  The compiler
                   1224: heuristically decides which functions are simple enough to be
                   1225: worth integrating in this way.
                   1226: 
                   1227: If all calls to a given function are integrated, and the function
                   1228: is declared @code{static}, then the function is normally not
                   1229: output as assembler code in its own right.
                   1230: 
1.1.1.6   root     1231: @item -fcaller-saves
                   1232: Enable values to be allocated in registers that will be clobbered by
                   1233: function calls, by emitting extra instructions to save and restore the
                   1234: registers around such calls.  Such allocation is done only when it
                   1235: seems to result in better code than would otherwise be produced.
                   1236: 
                   1237: This option is enabled by default on certain machines, usually those
                   1238: which have no call-preserved registers to use instead.
                   1239: 
1.1       root     1240: @item -fkeep-inline-functions
                   1241: Even if all calls to a given function are integrated, and the
                   1242: function is declared @code{static}, nevertheless output a
                   1243: separate run-time callable version of the function.
                   1244: 
                   1245: @item -fwritable-strings
1.1.1.8   root     1246: Store string constants in the writable data segment and don't uniquize
                   1247: them.  This is for compatibility with old programs which assume they can
                   1248: write into string constants.  @samp{-traditional} also has this effect.
                   1249: 
                   1250: Writing into string constants is a very bad idea; ``constants'' should
                   1251: be constant.
1.1       root     1252: 
1.1.1.4   root     1253: @item -fcond-mismatch
                   1254: Allow conditional expressions with mismatched types in the second and
                   1255: third arguments.  The value of such an expression is void.
                   1256: 
1.1       root     1257: @item -fno-function-cse
                   1258: Do not put function addresses in registers; make each instruction
                   1259: that calls a constant function contain the function's address
                   1260: explicitly.
                   1261: 
                   1262: This option results in less efficient code, but some strange
                   1263: hacks that alter the assembler output may be confused by the
                   1264: optimizations performed when this option is not used.
                   1265: 
                   1266: @item -fvolatile
                   1267: Consider all memory references through pointers to be volatile.
                   1268: 
1.1.1.4   root     1269: @item -fshared-data
                   1270: Requests that the data and non-@code{const} variables of this
                   1271: compilation be shared data rather than private data.  The distinction
                   1272: makes sense only on certain operating systems, where shared data is
                   1273: shared between processes running the same program, while private data
                   1274: exists in one copy per process.
                   1275: 
1.1       root     1276: @item -funsigned-char
1.1.1.4   root     1277: Let the type @code{char} be the unsigned, like @code{unsigned char}.
1.1       root     1278: 
                   1279: Each kind of machine has a default for what @code{char} should
                   1280: be.  It is either like @code{unsigned char} by default or like
                   1281: @code{signed char} by default.  (Actually, at present, the
                   1282: default is always signed.)
                   1283: 
                   1284: The type @code{char} is always a distinct type from either
                   1285: @code{signed char} or @code{unsigned char}, even though its
                   1286: behavior is always just like one of those two.
                   1287: 
1.1.1.4   root     1288: Note that this is equivalent to @samp{-fno-signed-char}, which is the
                   1289: negative form of @samp{-fsigned-char}.
                   1290: 
1.1       root     1291: @item -fsigned-char
                   1292: Let the type @code{char} be signed, like @code{signed char}.
                   1293: 
1.1.1.4   root     1294: Note that this is equivalent to @samp{-fno-unsigned-char}, which is
                   1295: the negative form of @samp{-funsigned-char}.
                   1296: 
1.1.1.8   root     1297: @item -fdelayed-branch
                   1298: If supported for the target machine, attempt to reorder instructions
                   1299: to exploit instruction slots available after delayed branch
                   1300: instructions.
                   1301: 
1.1       root     1302: @item -ffixed-@var{reg}
                   1303: Treat the register named @var{reg} as a fixed register; generated
                   1304: code should never refer to it (except perhaps as a stack pointer,
                   1305: frame pointer or in some other fixed role).
                   1306: 
                   1307: @var{reg} must be the name of a register.  The register names
                   1308: accepted are machine-specific and are defined in the
                   1309: @code{REGISTER_NAMES} macro in the machine description macro
                   1310: file.
                   1311: 
1.1.1.4   root     1312: This flag does not have a negative form, because it specifies a
                   1313: three-way choice.
                   1314: 
1.1       root     1315: @item -fcall-used-@var{reg}
                   1316: Treat the register named @var{reg} as an allocatable register
                   1317: that is clobbered by function calls.  It may be allocated for
                   1318: temporaries or variables that do not live across a call.
                   1319: Functions compiled this way will not save and restore the
                   1320: register @var{reg}.
                   1321: 
                   1322: Use of this flag for a register that has a fixed pervasive role
                   1323: in the machine's execution model, such as the stack pointer or
                   1324: frame pointer, will produce disastrous results.
                   1325: 
1.1.1.4   root     1326: This flag does not have a negative form, because it specifies a
                   1327: three-way choice.
                   1328: 
1.1       root     1329: @item -fcall-saved-@var{reg}
                   1330: Treat the register named @var{reg} as an allocatable register
                   1331: saved by functions.  It may be allocated even for temporaries or
                   1332: variables that live across a call.  Functions compiled this way
                   1333: will save and restore the register @var{reg} if they use it.
                   1334: 
                   1335: Use of this flag for a register that has a fixed pervasive role
                   1336: in the machine's execution model, such as the stack pointer or
                   1337: frame pointer, will produce disastrous results.
                   1338: 
                   1339: A different sort of disaster will result from the use of this
                   1340: flag for a register in which function values may be returned.
1.1.1.4   root     1341: 
                   1342: This flag does not have a negative form, because it specifies a
                   1343: three-way choice.
1.1       root     1344: @end table
                   1345: 
                   1346: @item -d@var{letters}
                   1347: Says to make debugging dumps at times specified by @var{letters}.
                   1348: Here are the possible letters:
                   1349: 
                   1350: @table @samp
                   1351: @item r
                   1352: Dump after RTL generation.
                   1353: @item j
                   1354: Dump after first jump optimization.
                   1355: @item s
                   1356: Dump after CSE (including the jump optimization that sometimes
                   1357: follows CSE).
                   1358: @item L
                   1359: Dump after loop optimization.
                   1360: @item f
                   1361: Dump after flow analysis.
                   1362: @item c
                   1363: Dump after instruction combination.
                   1364: @item l
                   1365: Dump after local register allocation.
                   1366: @item g
                   1367: Dump after global register allocation.
1.1.1.8   root     1368: @item d
                   1369: Dump after delayed branch scheduling.
                   1370: @item J
                   1371: Dump after last jump optimization.
1.1       root     1372: @item m
                   1373: Print statistics on memory usage, at the end of the run.
                   1374: @end table
                   1375: 
                   1376: @item -pedantic
                   1377: Issue all the warnings demanded by strict ANSI standard C; reject
                   1378: all programs that use forbidden extensions.
                   1379: 
                   1380: Valid ANSI standard C programs should compile properly with or without
                   1381: this option (though a rare few will require @samp{-ansi}).  However,
                   1382: without this option, certain GNU extensions and traditional C features
                   1383: are supported as well.  With this option, they are rejected.  There is
                   1384: no reason to @i{use} this option; it exists only to satisfy pedants.
1.1.1.5   root     1385: 
1.1.1.8   root     1386: @samp{-pedantic} does not cause warning messages for use of the
                   1387: alternate keywords whose names begin and end with @samp{__}.
                   1388: @xref{Alternate Keywords}.
                   1389: 
1.1.1.5   root     1390: @item -static
                   1391: On Suns running version 4, this prevents linking with the shared
                   1392: libraries.  (@samp{-g} has the same effect.)
1.1       root     1393: @end table
                   1394: 
                   1395: These options control the C preprocessor, which is run on each C source
                   1396: file before actual compilation.  If you use the @samp{-E} option, nothing
                   1397: is done except C preprocessing.  Some of these options make sense only
                   1398: together with @samp{-E} because they request preprocessor output that is
                   1399: not suitable for actual compilation.
                   1400: 
                   1401: @table @samp
                   1402: @item -C
                   1403: Tell the preprocessor not to discard comments.  Used with the
                   1404: @samp{-E} option.
                   1405: 
                   1406: @item -I@var{dir}
                   1407: Search directory @var{dir} for include files.
                   1408: 
                   1409: @item -I-
                   1410: Any directories specified with @samp{-I} options before the @samp{-I-}
                   1411: option are searched only for the case of @samp{#include "@var{file}"};
                   1412: they are not searched for @samp{#include <@var{file}>}.
                   1413: 
                   1414: If additional directories are specified with @samp{-I} options after
                   1415: the @samp{-I-}, these directories are searched for all @samp{#include}
                   1416: directives.  (Ordinarily @emph{all} @samp{-I} directories are used
                   1417: this way.)
                   1418: 
                   1419: In addition, the @samp{-I-} option inhibits the use of the current
1.1.1.8   root     1420: directory (where the current input file came from) as the first search
                   1421: directory for @samp{#include "@var{file}"}.  There is no way to override
                   1422: this effect of @samp{-I-}.  With @samp{-I.} you can specify searching
                   1423: the directory which was current when the compiler was invoked.  That is
                   1424: not exactly the same as what the preprocessor does by default, but it is
                   1425: often satisfactory.
                   1426: 
                   1427: @samp{-I-} does not inhibit the use of the standard system directories
                   1428: for header files.  Thus, @samp{-I-} and @samp{-nostdinc} are
                   1429: independent.
                   1430: 
                   1431: @item -i @var{file}
                   1432: Process @var{file} as input, discarding the resulting output, before
                   1433: processing the regular input file.  Because the output generated from
                   1434: @var{file} is discarded, the only effect of @samp{-i @var{file}} is to
                   1435: make the macros defined in @var{file} available for use in the main
                   1436: input.
1.1       root     1437: 
                   1438: @item -nostdinc
                   1439: Do not search the standard system directories for header files.  Only
                   1440: the directories you have specified with @samp{-I} options (and the
                   1441: current directory, if appropriate) are searched.
                   1442: 
                   1443: Between @samp{-nostdinc} and @samp{-I-}, you can eliminate all
                   1444: directories from the search path except those you specify.
                   1445: 
                   1446: @item -M
                   1447: Tell the preprocessor to output a rule suitable for @code{make}
                   1448: describing the dependencies of each source file.  For each source
                   1449: file, the preprocessor outputs one @code{make}-rule whose target is
                   1450: the object file name for that source file and whose dependencies are
                   1451: all the files @samp{#include}d in it.  This rule may be a single line
                   1452: or may be continued with @samp{\}-newline if it is long.
                   1453: 
                   1454: @samp{-M} implies @samp{-E}.
                   1455: 
                   1456: @item -MM
                   1457: Like @samp{-M} but the output mentions only the user-header files
                   1458: included with @samp{#include "@var{file}"}.  System header files
                   1459: included with @samp{#include <@var{file}>} are omitted.
                   1460: 
                   1461: @samp{-MM} implies @samp{-E}.
                   1462: 
                   1463: @item -D@var{macro}
1.1.1.8   root     1464: Define macro @var{macro} with the  string @samp{1} as its definition.
1.1       root     1465: 
                   1466: @item -D@var{macro}=@var{defn}
                   1467: Define macro @var{macro} as @var{defn}.
                   1468: 
                   1469: @item -U@var{macro}
                   1470: Undefine macro @var{macro}.
                   1471: 
1.1.1.7   root     1472: @item -trigraphs
1.1       root     1473: Support ANSI C trigraphs.  You don't want to know about this
                   1474: brain-damage.  The @samp{-ansi} option also has this effect.
                   1475: @end table
                   1476: 
                   1477: @node Installation, Trouble, Options, Top
                   1478: @chapter Installing GNU CC
                   1479: 
                   1480: Here is the procedure for installing GNU CC on a Unix system.
1.1.1.8   root     1481: 
1.1       root     1482: @menu
1.1.1.8   root     1483: * Other Dir::     Compiling in a separate directory (not where the source is).
                   1484: * Sun Install::   See below for installation on the Sun.
                   1485: * 3B1 Install::   See below for installation on the 3B1.
1.1       root     1486: * VMS Install::   See below for installation on VMS.
1.1.1.9 ! root     1487: * HPUX Install::  See below for installation on HPUX.
1.1       root     1488: @end menu
                   1489: @iftex
1.1.1.9 ! root     1490: See below for VMS systems, and modified procedures needed on Sun
        !          1491: systems, 3b1 machines and HPUX.  The following section says how to
        !          1492: compile in a separate directory on Unix; here we assume you compile in
        !          1493: the same directory that contains the source files.
1.1       root     1494: @end iftex
                   1495: 
                   1496: @enumerate
                   1497: @item
                   1498: Edit @file{Makefile}.  If you are using HPUX, or any form of system V,
                   1499: you must make a few changes described in comments at the beginning of
1.1.1.9 ! root     1500: the file.  Genix requires changes also, and so does the Pyramid.
1.1       root     1501: 
                   1502: @item
                   1503: On a Sequent system, go to the Berkeley universe.
                   1504: 
                   1505: @item
1.1.1.2   root     1506: Choose configuration files.  The easy way to do this is to run the
1.1.1.8   root     1507: command file @file{config.gcc} with a single argument, which specifies
                   1508: the type of machine (and in some cases which operating system).
1.1.1.4   root     1509: 
                   1510: Here is a list of the possible arguments:
                   1511: 
                   1512: @table @samp
                   1513: @item vax
                   1514: Vaxes running BSD.
                   1515: @item vms
                   1516: Vaxes running VMS.
                   1517: @item vax-sysv
                   1518: Vaxes running system V.
                   1519: @item i386-sysv
                   1520: Intel 386 PCs running system V.
1.1.1.5   root     1521: @item i386-sysv-gas
                   1522: Intel 386 PCs running system V, using the GNU assembler and GNU
                   1523: linker.
1.1.1.6   root     1524: @item sequent-i386
1.1.1.4   root     1525: Sequent with Intel 386 processors.
1.1.1.8   root     1526: @item i386-aix
                   1527: Intel 386 PCs or PS/2s running AIX.
1.1.1.4   root     1528: @item sun2
                   1529: Sun 2 running system version 2 or 3.
                   1530: @item sun3
1.1.1.5   root     1531: Sun 3 running system version 2 or 3, with 68881.
1.1.1.7   root     1532: Note there we do not provide a configuration file to use an FPA
1.1.1.8   root     1533: by default, because programs that establish signal handlers for
1.1.1.7   root     1534: floating point traps inherently cannot work with the FPA.
1.1.1.5   root     1535: @item sun3-nfp
                   1536: Sun 3 running system version 2 or 3, without 68881.
1.1.1.4   root     1537: @item sun4
1.1.1.8   root     1538: Sun 4 running system version 2 or 3.  @xref{Incompatibilities},
                   1539: for calling convention incompatibilities on the Sun 4 (sparc).
1.1.1.4   root     1540: @item sun2-os4
                   1541: Sun 2 running system version 4.
                   1542: @item sun3-os4
1.1.1.5   root     1543: Sun 3 running system version 4, with 68881.
                   1544: @item sun3-nfp-os4
                   1545: Sun 3 running system version 4, without 68881.
1.1.1.4   root     1546: @item sun4-os4
1.1.1.8   root     1547: Sun 4 running system version 4.  @xref{Incompatibilities},
                   1548: for calling convention incompatibilities on the Sun 4 (sparc).
1.1.1.4   root     1549: @item sun386
                   1550: Sun 386 (``roadrunner'').
1.1.1.5   root     1551: @item alliant
1.1.1.8   root     1552: Alliant FX/8 computer.  Note that the standard installed C compiler in
                   1553: Concentrix 5.0 has a bug which prevent it from compiling GNU CC
                   1554: correctly.  You can patch the compiler bug as follows:
                   1555: 
                   1556: @example
                   1557: cp /bin/pcc ./pcc
1.1.1.9 ! root     1558: adb -w ./pcc - << EOF
1.1.1.8   root     1559: 15f6?w 6610
                   1560: EOF
                   1561: @end example
                   1562: 
                   1563: Then you must use the @samp{-ip12} option when compiling GNU CC
                   1564: with the patched compiler, as shown here:
                   1565: 
                   1566: @example
                   1567: make CC="./pcc -ip12" CFLAGS=-w
                   1568: @end example
                   1569: 
                   1570: Note also that Alliant's version of DBX does not manage to work with the
                   1571: output from GNU CC.
                   1572: @item tahoe
                   1573: The tahoe computer (running BSD, and using DBX).
                   1574: @item decstation
                   1575: The DEC 3100 Mips machine (``pmax'').  Note that GNU CC cannot generate
                   1576: debugging information in the unusual format used on the Mips.
                   1577: @item mips-sysv
                   1578: The Mips computer, RS series, with the System V environment as default.
                   1579: Note that GNU CC cannot generate debugging information in the unusual
                   1580: format used on the Mips.
                   1581: @item mips-bsd43
                   1582: The Mips computer, RS series, with the BSD 4.3 environment as default.
                   1583: Note that GNU CC cannot generate debugging information in the unusual
                   1584: format used on the Mips.
1.1.1.7   root     1585: @item mips
1.1.1.8   root     1586: The Mips computer, M series.  Note that GNU CC cannot generate debugging
                   1587: information in the unusual format used on the Mips.
                   1588: @item iris
                   1589: The Mips computer, as delivered by Iris.  Note that GNU CC cannot
                   1590: generate debugging information in the unusual format used on the Mips.
1.1.1.5   root     1591: @item convex-c1
                   1592: Convex C1 computer.
                   1593: @item convex-c2
                   1594: Convex C2 computer.
1.1.1.8   root     1595: @item pyramid
                   1596: Pyramid computer.
1.1.1.4   root     1597: @item hp9k320
1.1.1.7   root     1598: HP 9000 series 300 using HPUX assembler.  Note there is no
                   1599: support in GNU CC for HP's debugger; thus, @samp{-g} is not
                   1600: available in this configuration.
1.1.1.8   root     1601: @item hp9k320-gas
1.1.1.4   root     1602: HP 9000 series 300 using GNU assembler, linker and debugger.
1.1.1.7   root     1603: This requires the HP-adapt package, which is available along with
                   1604: the GNU linker as part of the ``binutils'' distribution.
                   1605: This is on the GNU CC distribution tape.
1.1.1.8   root     1606: @item hp9k320-old
                   1607: HP 9000 series 300 using HPUX assembler, in operating system versions
                   1608: older than 6.5.  Note there is no support in GNU CC for HP's debugger;
                   1609: thus, @samp{-g} is not available in this configuration.
                   1610: @item hp9k320-bsd
                   1611: HP 9000 series 300 running BSD.
1.1.1.4   root     1612: @item isi68
1.1.1.8   root     1613: ISI 68000 or 68020 system with a 68881.
                   1614: @item isi68-nfp
                   1615: ISI 68000 or 68020 system without a 68881.
1.1.1.4   root     1616: @item news800
                   1617: Sony NEWS 68020 system.
1.1.1.6   root     1618: @item next
                   1619: NeXT system.
1.1.1.7   root     1620: @item altos
                   1621: Altos 3068.  Note that you must use the GNU assembler, linker and
                   1622: debugger, with COFF-encapsulation.  Also, you must fix a kernel
                   1623: bug.  Details in the file @file{ALTOS-README}.
1.1.1.4   root     1624: @item 3b1
1.1.1.8   root     1625: AT&T 3b1, a.k.a. 7300 PC.  Note that special procedures are needed
                   1626: to compile GNU CC with this machine's standard C compiler, due to
                   1627: bugs in that compiler.  @xref{3b1 Install}.  You can bootstrap it
                   1628: more easily with previous versions of GNU CC if you have them.
1.1.1.9 ! root     1629: @item 3b1-gas
        !          1630: AT&T 3b1 using the GNU assembler.
1.1.1.4   root     1631: @item sequent-ns32k
                   1632: Sequent containing ns32000 processors.
                   1633: @item encore
                   1634: Encore ns32000 system.
                   1635: @item genix
                   1636: National Semiconductor ns32000 system.
                   1637: @item 88000
                   1638: Motorola 88000 processor.  This port is not finished.
                   1639: @end table
1.1.1.2   root     1640: 
1.1.1.4   root     1641: Here we spell out what files need to be set up:
1.1       root     1642: 
                   1643: @itemize @bullet
                   1644: @item
                   1645: Make a symbolic link named @file{config.h} to the top-level
                   1646: config file for the machine you are using (@pxref{Config}).  This
                   1647: file is responsible for defining information about the host
                   1648: machine.  It includes @file{tm.h}.
                   1649: 
1.1.1.7   root     1650: The file is located in the subdirectory @file{config}.  Its name
                   1651: should be @file{xm-@var{machine}.h}, with these exceptions:
1.1       root     1652: 
                   1653: @table @file
1.1.1.3   root     1654: @item xm-vms.h
1.1       root     1655: for vaxen running VMS.
1.1.1.3   root     1656: @item xm-vaxv.h
1.1       root     1657: for vaxen running system V.
1.1.1.3   root     1658: @item xm-i386v.h
1.1       root     1659: for Intel 80386's running system V.
1.1.1.3   root     1660: @item xm-sun386i.h
                   1661: for Sun roadrunner running any version of the operating system.
                   1662: @item xm-hp9k320.h
1.1       root     1663: for the HP 9000 series 300.
1.1.1.4   root     1664: @item xm-genix.h
1.1       root     1665: for the ns32000 running Genix
                   1666: @end table
                   1667: 
                   1668: If your system does not support symbolic links, you might want to
                   1669: set up @file{config.h} to contain a @samp{#include} command which
                   1670: refers to the appropriate file.
                   1671: 
                   1672: @item
                   1673: Make a symbolic link named @file{tm.h} to the machine-description
1.1.1.7   root     1674: macro file for your machine.  It should be in the subdirectory
                   1675: @file{config} and its name should be @file{tm-@var{machine}.h}.
1.1       root     1676: 
                   1677: If your system is a 68000, don't use the file @file{tm-m68k.h}
                   1678: directly.  Instead, use one of these files:
                   1679: 
                   1680: @table @file
                   1681: @item tm-sun3.h
1.1.1.5   root     1682: for Sun 3 machines with 68881.
                   1683: @item tm-sun3-nfp.h
                   1684: for Sun 3 machines with no hardware floating point.
1.1.1.8   root     1685: @item tm-sun3os3.h
                   1686: for Sun 3 machines with 68881, running Sunos version 3.
                   1687: @item tm-sun3os3nf.h
                   1688: for Sun 3 machines with no hardware floating point, running Sunos
                   1689: version 3.
1.1       root     1690: @item tm-sun2.h
                   1691: for Sun 2 machines.
                   1692: @item tm-3b1.h
                   1693: for AT&T 3b1 (aka 7300 Unix PC).
                   1694: @item tm-isi68.h
1.1.1.3   root     1695: for Integrated Solutions systems.  This file assumes you
                   1696: use the GNU assembler.
1.1.1.8   root     1697: @item tm-isi68-nfp.h
                   1698: for Integrated Solutions systems without a 68881.  This file assumes you
                   1699: use the GNU assembler.
1.1       root     1700: @item tm-news800.h
1.1.1.8   root     1701: for Sony NEWS systems.
1.1       root     1702: @item tm-hp9k320.h
                   1703: for HPUX systems, if you are using GNU CC with the system's
                   1704: assembler and linker.
                   1705: @item tm-hp9k320g.h
                   1706: for HPUX systems, if you are using the GNU assembler, linker and
                   1707: other utilities.  Not all of the pieces of GNU software needed
                   1708: for this mode of operation are as yet in distribution; full
                   1709: instructions will appear here in the future.@refill
                   1710: @end table
                   1711: 
                   1712: For the vax, use @file{tm-vax.h} on BSD Unix, @file{tm-vaxv.h} on
                   1713: system V, or @file{tm-vms.h} on VMS.@refill
                   1714: 
                   1715: For the Motorola 88000, use @file{tm-m88k.h}.  The support for the
1.1.1.9 ! root     1716: 88000 does not currently work; it requires extensive changes which
        !          1717: we hope to reconcile in version 2.
1.1       root     1718: 
                   1719: For the 80386, don't use @file{tm-i386.h} directly.  Use
                   1720: @file{tm-i386v.h} if the target machine is running system V,
1.1.1.5   root     1721: @file{tm-i386gas.h} if it is running system V but you are using the
                   1722: GNU assembler and linker, @file{tm-seq386.h} for a Sequent 386 system,
                   1723: or @file{tm-compaq.h} for a Compaq, or @file{tm-sun386i.h} for a Sun
                   1724: 386 system.
1.1       root     1725: 
1.1.1.8   root     1726: For the Mips computer, there are five choices: @file{tm-mips.h} for the
                   1727: M series, @file{tm-mips-bsd.h} for the RS series with BSD,
                   1728: @file{tm-mips-sysv.h} for the RS series with System V, @file{tm-iris.h}
                   1729: for the Iris version of the machine, and @file{tm-decstatn.h} for the
                   1730: Decstation.
                   1731: 
1.1       root     1732: For the 32000, use @file{tm-sequent.h} if you are using a Sequent
                   1733: machine, or @file{tm-encore.h} for an Encore machine, or
1.1.1.4   root     1734: @file{tm-genix.h} if you are using Genix version 3; otherwise, perhaps
1.1       root     1735: @file{tm-ns32k.h} will work for you.
                   1736: 
                   1737: Note that Genix has bugs in @code{alloca} and @code{malloc}; you must
                   1738: get the compiled versions of these from GNU Emacs and edit GNU CC's
                   1739: @file{Makefile} to use them.
                   1740: 
                   1741: Note that Encore systems are supported only under BSD.
                   1742: 
1.1.1.6   root     1743: For Sparc (Sun 4) machines, use @file{tm-sparc.h} with operating system
                   1744: version 4, and @file{tm-sun4os3.h} with system version 3.
                   1745: 
1.1       root     1746: @item
                   1747: Make a symbolic link named @file{md} to the machine description
1.1.1.7   root     1748: pattern file.  It should be in the @file{config} subdirectory and its
                   1749: name should be @file{@var{machine}.md}; but @var{machine} is often not
                   1750: the same as the name used in the @file{tm.h} file because the
                   1751: @file{md} files are more general.
1.1       root     1752: 
                   1753: @item
                   1754: Make a symbolic link named @file{aux-output.c} to the output
1.1.1.7   root     1755: subroutine file for your machine.  It should be in the @file{config}
                   1756: subdirectory and its name should be @file{out-@var{machine}.c}.
1.1       root     1757: @end itemize
                   1758: 
                   1759: @item
                   1760: Make sure the Bison parser generator is installed.  (This is
                   1761: unnecessary if the Bison output files @file{c-parse.tab.c} and
                   1762: @file{cexp.c} are more recent than @file{c-parse.y} and @file{cexp.y}
                   1763: and you do not plan to change the @samp{.y} files.)
                   1764: 
1.1.1.9 ! root     1765: Bison versions older than Sept 8, 1988 will produce incorrect output
1.1       root     1766: for @file{c-parse.tab.c}.
                   1767: 
                   1768: @item
                   1769: Build the compiler.  Just type @samp{make} in the compiler directory.
                   1770: 
1.1.1.2   root     1771: Ignore any warnings you may see about ``statement not reached'' in the
                   1772: @file{insn-emit.c}; they are normal.  Any other compilation errors may
                   1773: represent bugs in the port to your machine or operating system, and
                   1774: should be investigated and reported (@pxref{Bugs}).
                   1775: 
1.1.1.9 ! root     1776: Some commercial compilers fail to compile GNU CC because they have bugs
        !          1777: or limitations.  For example, the Microsoft compiler is said to run out
        !          1778: of macro space.  Some Ultrix compilers run out of expression space; then
        !          1779: you need to break up the statement where the problem happens.
1.1.1.7   root     1780: 
                   1781: @item
1.1.1.5   root     1782: If you are using COFF-encapsulation, you must convert @file{gnulib} to
                   1783: a GNU-format library at this point.  See the file @file{README-ENCAP}
                   1784: in the directory containing the GNU binary file utilities, for
                   1785: directions.
                   1786: 
                   1787: @item
1.1       root     1788: Move the first-stage object files and executables into a subdirectory
                   1789: with this command:
                   1790: 
                   1791: @example
                   1792: make stage1
                   1793: @end example
                   1794: 
                   1795: The files are moved into a subdirectory named @file{stage1}.
                   1796: Once installation is complete, you may wish to delete these files
                   1797: with @code{rm -r stage1}.
                   1798: 
                   1799: @item
                   1800: Recompile the compiler with itself, with this command:
                   1801: 
                   1802: @example
                   1803: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/"
                   1804: @end example
                   1805: 
                   1806: On a 68000 or 68020 system lacking floating point hardware,
                   1807: unless you have selected a @file{tm.h} file that expects by default
                   1808: that there is no such hardware, do this instead:
                   1809: 
                   1810: @example
                   1811: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/ -msoft-float"
                   1812: @end example
                   1813: 
                   1814: @item
                   1815: If you wish to test the compiler by compiling it with itself one more
1.1.1.7   root     1816: time, do this (in C shell):
1.1       root     1817: 
                   1818: @example
                   1819: make stage2
                   1820: make CC=stage2/gcc CFLAGS="-g -O -Bstage2/"
                   1821: foreach file (*.o)
                   1822: cmp $file stage2/$file
                   1823: end
                   1824: @end example
                   1825: 
1.1.1.7   root     1826: @noindent
1.1       root     1827: Aside from the @samp{-B} option, the options should be the same as
                   1828: when you made stage 2.
                   1829: 
1.1.1.7   root     1830: The @code{foreach} command (written in C shell) will notify you if any of
                   1831: these stage 3 object files differs from those of stage 2.  On BSD systems,
                   1832: any difference, no matter how innocuous, indicates that the stage 2
                   1833: compiler has compiled GNU CC incorrectly, and is therefore a potentially
                   1834: serious bug which you should investigate and report (@pxref{Bugs}).
                   1835: 
                   1836: On systems that use COFF object files, bytes 5 to 8 will always be
                   1837: different, since it is a timestamp.  On these systems, you can do the
                   1838: comparison as follows (in Bourne shell):
                   1839: 
                   1840: @example
                   1841: for file in *.o; do
                   1842: echo $file
                   1843: tail +10 $file > foo1
                   1844: tail +10 stage2/$file > foo2
                   1845: cmp foo1 foo2
                   1846: done
                   1847: @end example
                   1848: 
1.1       root     1849: @item
                   1850: Install the compiler driver, the compiler's passes and run-time support.
                   1851: You can use the following command:
                   1852: 
                   1853: @example
                   1854: make install
                   1855: @end example
                   1856: 
                   1857: @noindent
                   1858: This copies the files @file{cc1}, @file{cpp} and @file{gnulib} to
                   1859: files @file{gcc-cc1}, @file{gcc-cpp} and @file{gcc-gnulib} in
                   1860: directory @file{/usr/local/lib}, which is where the compiler driver
                   1861: program looks for them.  It also copies the driver program @file{gcc}
1.1.1.6   root     1862: into the directory @file{/usr/local/bin}, so that it appears in typical
1.1       root     1863: execution search paths.@refill
                   1864: 
                   1865: @strong{Warning: there is a bug in @code{alloca} in the Sun library.
                   1866: To avoid this bug, install the binaries of GNU CC that were compiled
                   1867: by GNU CC.  They use @code{alloca} as a built-in function and never
                   1868: the one in the library.}
                   1869: 
                   1870: @strong{Warning: the GNU CPP may not work for @file{ioctl.h},
                   1871: @file{ttychars.h} and other system header files unless the
                   1872: @samp{-traditional} option is used.}  The bug is in the header files:
                   1873: at least on some machines, they rely on behavior that is incompatible
                   1874: with ANSI C.  This behavior consists of substituting for macro
                   1875: argument names when they appear inside of character constants.  The
                   1876: @samp{-traditional} option tells GNU CC to behave the way these
                   1877: headers expect.
                   1878: 
                   1879: Because of this problem, you might prefer to configure GNU CC to use
                   1880: the system's own C preprocessor.  To do so, make the file
                   1881: @file{/usr/local/lib/gcc-cpp} a link to @file{/lib/cpp}.
                   1882: 
                   1883: Alternatively, on Sun systems and 4.3BSD at least, you can correct the
                   1884: include files by running the shell script @file{fixincludes}.  This
                   1885: installs modified, corrected copies of the files @file{ioctl.h},
                   1886: @file{ttychars.h} and many others, in a special directory where only
1.1.1.2   root     1887: GNU CC will normally look for them.  This script will work on various
1.1.1.6   root     1888: systems because it chooses the files by searching all the system
1.1.1.2   root     1889: headers for the problem cases that we know about.
1.1       root     1890: @end enumerate
                   1891: 
                   1892: If you cannot install the compiler's passes and run-time support in
                   1893: @file{/usr/local/lib}, you can alternatively use the @samp{-B} option to
                   1894: specify a prefix by which they may be found.  The compiler concatenates
                   1895: the prefix with the names  @file{cpp}, @file{cc1} and @file{gnulib}.
                   1896: Thus, you can put the files in a directory @file{/usr/foo/gcc} and
                   1897: specify @samp{-B/usr/foo/gcc/} when you run GNU CC.
                   1898: 
                   1899: Also, you can specify an alternative default directory for these files
                   1900: by setting the Make variable @code{libdir} when you make GNU CC.
                   1901: 
1.1.1.8   root     1902: @node Other Dir, Sun Install, Installation, Installation
                   1903: @section Compilation in a Separate Directory
1.1       root     1904: 
1.1.1.8   root     1905: If you wish to build the object files and executables in a directory
                   1906: other than the one containing the source files, here is what you must
                   1907: do differently:
                   1908: 
                   1909: @enumerate
                   1910: @item
                   1911: Go to that directory before running @file{config.gcc}:
                   1912: 
                   1913: @example
                   1914: mkdir gcc-sun3
                   1915: cd gcc-sun3
                   1916: @end example
1.1.1.4   root     1917: 
1.1.1.8   root     1918: On systems that do not support symbolic links, this directory must be
                   1919: on the same file system as the source code directory.
                   1920: 
                   1921: @item
                   1922: Specify where to find @file{config.gcc} when you run it:
                   1923: 
                   1924: @example
                   1925: ../gcc-1.36/config.gcc @dots{}
                   1926: @end example
                   1927: 
                   1928: @item
                   1929: Specify where to find the sources, as an argument to @file{config.gcc}:
                   1930: 
                   1931: @example
                   1932: ../gcc-1.36/config.gcc -srcdir=../gcc-1.36 sun3
                   1933: @end example
                   1934: 
                   1935: The @samp{-srcdir=@var{dir}} option is not needed when the source
                   1936: directory is the parent of the current directory, because
                   1937: @file{config.gcc} detects that case automatically.
                   1938: @end enumerate
                   1939: 
                   1940: Now, you can run @code{make} in that directory.  You need not repeat the
                   1941: configuration steps shown above, when ordinary source files change.  You
                   1942: must, however, run @code{config.gcc} again when the configuration files
                   1943: change, if your system does not support symbolic links.
                   1944: 
                   1945: @node Sun Install, 3b1 Install, Other Dir, Installation
                   1946: @section Installing GNU CC on the Sun
                   1947: 
                   1948: Make sure the environment variable @code{FLOAT_OPTION} is not set when
                   1949: you compile @file{gnulib}.  If this option were set to @code{f68881}
                   1950: when @file{gnulib} is compiled, the resulting code would demand to be
                   1951: linked with a special startup file and would not link properly without
                   1952: special pains.  
                   1953: 
                   1954: There is a bug in @code{alloca} in certain versions of the Sun library. 
                   1955: To avoid this bug, install the binaries of GNU CC that were compiled by
                   1956: GNU CC.  They use @code{alloca} as a built-in function and never the one
                   1957: in the library.  
                   1958: 
                   1959: Some versions of the Sun compiler crash when compiling GNU CC.
                   1960: The problem is a segmentation fault in cpp.
                   1961: 
                   1962: This problem seems to be due to the bulk of data in the environment
                   1963: variables.  You may be able to avoid it by using the following
                   1964: command to compile GNU CC with Sun CC:
                   1965: 
                   1966: @example
                   1967: make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
                   1968: @end example
                   1969: 
                   1970: @node 3b1 Install, VMS Install, Sun Install, Installation
                   1971: @section Installing GNU CC on the 3b1
                   1972: 
                   1973: Installing GNU CC on the 3b1 is difficult if you do not already have
                   1974: GNU CC running, due to bugs in the installed C compiler.  However,
                   1975: the following procedure might work.  We are unable to test it.
1.1       root     1976: 
                   1977: @enumerate
                   1978: @item
1.1.1.8   root     1979: Comment out the @samp{#include "config.h"} line on line 37 of
                   1980: @file{cccp.c} and do @samp{make cpp}.  This makes a preliminary version
                   1981: of GNU cpp.  
1.1       root     1982: 
                   1983: @item
1.1.1.8   root     1984: Save the old @file{/lib/cpp} and copy the preliminary GNU cpp to that
                   1985: file name.  
1.1.1.5   root     1986: 
1.1.1.8   root     1987: @item
                   1988: Undo your change in @file{cccp.c}, or reinstall the original version,
                   1989: and do @samp{make cpp} again.  
                   1990: 
                   1991: @item
                   1992: Copy this final version of GNU cpp into @file{/lib/cpp}.
                   1993: 
                   1994: @item
1.1.1.9 ! root     1995: Replace every occurrence of @code{obstack_free} in @file{tree.c}
1.1.1.8   root     1996: with @code{_obstack_free}.  
                   1997: 
                   1998: @item
                   1999: Run @code{make} to get the first-stage GNU CC.
                   2000: 
                   2001: @item
                   2002: Reinstall the original version of @file{/lib/cpp}.
                   2003: 
                   2004: @item
                   2005: Now you can compile GNU CC with itself and install it in the normal
                   2006: fashion.
1.1       root     2007: @end enumerate
                   2008: 
1.1.1.9 ! root     2009: If you have installed an earlier version of GCC, you can compile the
        !          2010: newer version with that.  However, you will run into trouble compiling
        !          2011: @file{gnulib}, since that is normally compiled with CC.  To solve the
        !          2012: problem, uncomment this line in @file{Makefile}:
        !          2013: 
        !          2014: @example
        !          2015: CCLIBFLAGS = -B/usr/local/lib/gcc- -tp -Wp,-traditional
        !          2016: @end example
        !          2017: 
        !          2018: @node VMS Install, HPUX Install, 3B1 Install, Installation
1.1.1.8   root     2019: @section Installing GNU CC on VMS
                   2020: 
                   2021: The VMS version of GNU CC is distributed in a backup saveset containing
                   2022: both source code and precompiled binaries.
                   2023: 
                   2024: To install the @file{gcc} command so you can use the compiler easily, in
1.1       root     2025: the same manner as you use the VMS C compiler, you must install the VMS CLD
                   2026: file for GNU CC as follows:
                   2027: 
                   2028: @enumerate
                   2029: @item
                   2030: Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
                   2031: to point to the directories where the GNU CC executables
1.1.1.8   root     2032: (@file{gcc-cpp}, @file{gcc-cc1}, etc.) and the C include files are
1.1       root     2033: kept.  This should be done with the commands:@refill
                   2034: 
                   2035: @example
1.1.1.8   root     2036: $ assign /super /system disk:[gcc.] gnu_cc
                   2037: $ assign /super /system disk:[gcc.include.] gnu_cc_include
1.1       root     2038: @end example
                   2039: 
                   2040: @noindent
                   2041: with the appropriate disk and directory names.  These commands can be
                   2042: placed in your system startup file so they will be executed whenever
1.1.1.8   root     2043: the machine is rebooted.  You may, if you choose, do this via the
                   2044: @file{GCC_INSTALL.COM} script in the @file{[GCC]} directory.
1.1       root     2045: 
                   2046: @item
1.1.1.8   root     2047: Install the @file{GCC} command with the command line:
1.1       root     2048: 
                   2049: @example
1.1.1.8   root     2050: $ set command /table=sys$library:dcltables gnu_cc:[000000]gcc
1.1       root     2051: @end example
                   2052: 
1.1.1.7   root     2053: @item
                   2054: To install the help file, do the following:
                   2055: 
                   2056: @example
                   2057: $ lib/help sys$library:helplib.hlb gcc.hlp
                   2058: @end example
                   2059: 
1.1       root     2060: @noindent
                   2061: Now you can invoke the compiler with a command like @samp{gcc /verbose
                   2062: file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
                   2063: Unix.
                   2064: @end enumerate
                   2065: 
1.1.1.8   root     2066: We try to put corresponding binaries and sources on the VMS distribution
                   2067: tape.  But sometimes the binaries will be from an older version that the
                   2068: sources, because we don't always have time to update them.  (Use the
                   2069: @samp{/verbose} option to determine the version number of the binaries and
                   2070: compare it with the source file @file{version.c} to tell whether this is
                   2071: so.)  In this case, you should use the binaries you get to recompile the
                   2072: sources.  If you must recompile, here is how:
                   2073: 
                   2074: @enumerate
                   2075: @item
                   2076: Copy the file @file{tm-vms.h} to @file{tm.h}, @file{xm-vms.h} to
                   2077: @file{config.h}, @file{vax.md} to @file{md.} and @file{out-vax.c}
                   2078: to @file{aux-output.c}.  The files to be copied are found in the
                   2079: subdirectory named @file{config}; they should be copied to the
                   2080: main directory of GNU CC.@refill
                   2081: 
                   2082: @item
                   2083: Setup the logical names and command tables as defined above.  In
                   2084: addition, define the vms logical name @samp{GNU_BISON} to point at the
                   2085: to the directories where the Bison executable is kept.  This should be
                   2086: done with the command:@refill
                   2087: 
                   2088: @example
                   2089: $ assign /super /system disk:[bison.] gnu_bison
                   2090: @end example
                   2091: 
                   2092: You may, if you choose, use the @file{INSTALL_BISON.COM} script in the
                   2093: @file{[BISON]} directory.
                   2094: 
                   2095: @item
                   2096: Install the @samp{BISON} command with the command line:@refill
                   2097: 
                   2098: @example
                   2099: $ set command /table=sys$library:dcltables gnu_bison:[000000]bison
                   2100: @end example
                   2101: 
                   2102: @item
                   2103: Type @samp{@@make} to do recompile everything.
                   2104: 
                   2105: If you are compiling with a version of GNU CC older than 1.33, specify
                   2106: @samp{/DEFINE=("inline=")} as an option in all the compilations.  This
                   2107: requires editing all the @code{gcc} commands in @file{make-cc1.com}.
                   2108: (The older versions had problems supporting @code{inline}.)  Once you
                   2109: have a working 1.33 or newer GNU CC, you can change this file back.
                   2110: @end enumerate
                   2111: 
1.1.1.5   root     2112: There is a known problem on VMS: @code{const} global variables don't
                   2113: work compatibly with the VMS C compiler; we don't know a way to get
                   2114: them to the linker properly.
                   2115: 
1.1.1.7   root     2116: Note that GNU CC on VMS does not generate debugging information to
                   2117: describe the program's symbols.  It is not straightforward to implement
                   2118: this, and we have no time to spend on it, but we might consent to
                   2119: install a very modular implementation if you write it.  You will
                   2120: probably have to modify GAS as well as GNU CC.
                   2121: 
1.1.1.9 ! root     2122: @node HPUX Install,, VMS Install, Installation
        !          2123: @section Installing GNU CC on HPUX
        !          2124: 
        !          2125: To install GNU CC on HPUX, you must start by editing the file
        !          2126: @file{Makefile}.  Search for the string @samp{HPUX} to find comments
        !          2127: saying what to change.  You need to change some variable definitions and
        !          2128: (if you are using GAS) some lines in the rule for the target
        !          2129: @samp{gnulib}.
        !          2130: 
        !          2131: To compile with the HPUX C compiler, you must specify get the file
        !          2132: @file{alloca.c} from GNU Emacs.  Then, when you run @code{make}, use
        !          2133: this argument:
        !          2134: 
        !          2135: @example
        !          2136: make ALLOCA=alloca.o
        !          2137: @end example
        !          2138: 
        !          2139: When recompiling GNU CC with itself, do not define @code{ALLOCA}.
        !          2140: Instead, an @samp{-I} option needs to be added to @code{CFLAGS} as
        !          2141: follows:
        !          2142: 
        !          2143: @example
        !          2144: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/ -I../binutils/hp-include"
        !          2145: @end example
        !          2146: 
1.1       root     2147: @node Trouble, Incompatibilities, Installation, Top
                   2148: @chapter Known Causes of Trouble with GNU CC.
                   2149: 
                   2150: Here are some of the things that have caused trouble for people installing
                   2151: or using GNU CC.
                   2152: 
                   2153: @itemize @bullet
                   2154: @item
                   2155: On certain systems, defining certain environment variables such as
1.1.1.8   root     2156: @code{CC} can interfere with the functioning of @code{make}.
1.1       root     2157: 
                   2158: @item
                   2159: Cross compilation can run into trouble for certain machines because
                   2160: some target machines' assemblers require floating point numbers to be
                   2161: written as @emph{integer} constants in certain contexts.
                   2162: 
                   2163: The compiler writes these integer constants by examining the floating
                   2164: point value as an integer and printing that integer, because this is
                   2165: simple to write and independent of the details of the floating point
                   2166: representation.  But this does not work if the compiler is running on
                   2167: a different machine with an incompatible floating point format, or
                   2168: even a different byte-ordering.
                   2169: 
1.1.1.5   root     2170: In addition, correct constant folding of floating point values
                   2171: requires representing them in the target machine's format.
                   2172: (The C standard does not quite require this, but in practice
                   2173: it is the only way to win.)
                   2174: 
                   2175: It is now possible to overcome these problems by defining macros such
                   2176: as @code{REAL_VALUE_TYPE}.  But doing so is a substantial amount of
                   2177: work for each target machine.  @xref{Cross-compilation}.
1.1       root     2178: 
                   2179: @item
                   2180: DBX rejects some files produced by GNU CC, though it accepts similar
                   2181: constructs in output from PCC.  Until someone can supply a coherent
                   2182: description of what is valid DBX input and what is not, there is
                   2183: nothing I can do about these problems.  You are on your own.
1.1.1.2   root     2184: 
                   2185: @item
                   2186: Users often think it is a bug when GNU CC reports an error for code
                   2187: like this:
                   2188: 
                   2189: @example
                   2190: int foo (short);
                   2191: 
                   2192: int foo (x)
                   2193:      short x;
                   2194: @{@dots{}@}
                   2195: @end example
                   2196: 
1.1.1.4   root     2197: The error message is correct: this code really is erroneous, because the
                   2198: old-style non-prototype definition passes subword integers in their
                   2199: promoted types.  In other words, the argument is really an @code{int},
                   2200: not a @code{short}.  The correct prototype is this:
1.1.1.2   root     2201: 
                   2202: @example
                   2203: int foo (int);
                   2204: @end example
                   2205: 
                   2206: @item
                   2207: Users often think it is a bug when GNU CC reports an error for code
                   2208: like this:
                   2209: 
                   2210: @example
                   2211: int foo (struct mumble *);
                   2212: 
                   2213: struct mumble @{ @dots{} @};
                   2214: 
                   2215: int foo (struct mumble *x)
                   2216: @{ @dots{} @}
                   2217: @end example
                   2218: 
                   2219: This code really is erroneous, because the scope of @code{struct
                   2220: mumble} the prototype is limited to the argument list containing it.
                   2221: It does not refer to the @code{struct mumble} defined with file scope
                   2222: immediately below---they are two unrelated types with similar names in
                   2223: different scopes.
                   2224: 
                   2225: But in the definition of @code{foo}, the file-scope type is used
                   2226: because that is available to be inherited.  Thus, the definition and
                   2227: the prototype do not match, and you get an error.
                   2228: 
                   2229: This behavior may seem silly, but it's what the ANSI standard
                   2230: specifies.  It is easy enough for you to make your code work by moving
                   2231: the definition of @code{struct mumble} above the prototype.  I don't
                   2232: think it's worth being incompatible for.
1.1       root     2233: @end itemize
                   2234: 
                   2235: @node Incompatibilities, Extensions, Trouble, Top
                   2236: @chapter Incompatibilities of GNU CC
                   2237: 
                   2238: There are several noteworthy incompatibilities between GNU C and most
1.1.1.9 ! root     2239: existing (non-ANSI) versions of C.  The @samp{-traditional} option
        !          2240: eliminates most of these incompatibilities, @emph{but not all}, by
        !          2241: telling GNU C to behave like older C compilers.
1.1       root     2242: 
                   2243: @itemize @bullet
                   2244: @item
                   2245: GNU CC normally makes string constants read-only.  If several
                   2246: identical-looking string constants are used, GNU CC stores only one
                   2247: copy of the string.
                   2248: 
                   2249: One consequence is that you cannot call @code{mktemp} with a string
                   2250: constant argument.  The function @code{mktemp} always alters the
                   2251: string its argument points to.
                   2252: 
                   2253: Another consequence is that @code{sscanf} does not work on some
                   2254: systems when passed a string constant as its format control string.
                   2255: This is because @code{sscanf} incorrectly tries to write into the
1.1.1.4   root     2256: string constant.  Likewise @code{fscanf} and @code{scanf}.
1.1       root     2257: 
                   2258: The best solution to these problems is to change the program to use
                   2259: @code{char}-array variables with initialization strings for these
                   2260: purposes instead of string constants.  But if this is not possible,
                   2261: you can use the @samp{-fwritable-strings} flag, which directs GNU CC
                   2262: to handle string constants the same way most C compilers do.
1.1.1.8   root     2263: @samp{-traditional} also has this effect, among others.
1.1       root     2264: 
                   2265: @item
                   2266: GNU CC does not substitute macro arguments when they appear inside of
                   2267: string constants.  For example, the following macro in GNU CC
                   2268: 
                   2269: @example
                   2270: #define foo(a) "a"
                   2271: @end example
                   2272: 
                   2273: @noindent
1.1.1.8   root     2274: will produce output @code{"a"} regardless of what the argument @var{a} is.
1.1       root     2275: 
                   2276: The @samp{-traditional} option directs GNU CC to handle such cases
                   2277: (among others) in the old-fashioned (non-ANSI) fashion.
                   2278: 
                   2279: @item
                   2280: When you use @code{setjmp} and @code{longjmp}, the only automatic
                   2281: variables guaranteed to remain valid are those declared
                   2282: @code{volatile}.  This is a consequence of automatic register
                   2283: allocation.  Consider this function:
                   2284: 
                   2285: @example
                   2286: jmp_buf j;
                   2287: 
                   2288: foo ()
                   2289: @{
                   2290:   int a, b;
                   2291: 
                   2292:   a = fun1 ();
                   2293:   if (setjmp (j))
                   2294:     return a;
                   2295: 
                   2296:   a = fun2 ();
                   2297:   /* @r{@code{longjmp (j)} may be occur in @code{fun3}.} */
                   2298:   return a + fun3 ();
                   2299: @}
                   2300: @end example
                   2301: 
                   2302: Here @code{a} may or may not be restored to its first value when the
                   2303: @code{longjmp} occurs.  If @code{a} is allocated in a register, then
                   2304: its first value is restored; otherwise, it keeps the last value stored
                   2305: in it.
                   2306: 
                   2307: If you use the @samp{-W} option with the @samp{-O} option, you will
                   2308: get a warning when GNU CC thinks such a problem might be possible.
                   2309: 
1.1.1.2   root     2310: The @samp{-traditional} option directs GNU C to put variables in
                   2311: the stack by default, rather than in registers, in functions that
                   2312: call @code{setjmp}.  This results in the behavior found in
                   2313: traditional C compilers.
                   2314: 
1.1       root     2315: @item
                   2316: Declarations of external variables and functions within a block apply
                   2317: only to the block containing the declaration.  In other words, they
                   2318: have the same scope as any other declaration in the same place.
                   2319: 
                   2320: In some other C compilers, a @code{extern} declaration affects all the
                   2321: rest of the file even if it happens within a block.
                   2322: 
                   2323: The @samp{-traditional} option directs GNU C to treat all @code{extern}
                   2324: declarations as global, like traditional compilers.
                   2325: 
                   2326: @item
                   2327: In traditional C, you can combine @code{long}, etc., with a typedef name,
                   2328: as shown here:
                   2329: 
                   2330: @example
                   2331: typedef int foo;
                   2332: typedef long foo bar;
                   2333: @end example
                   2334: 
                   2335: In ANSI C, this is not allowed: @code{long} and other type modifiers
                   2336: require an explicit @code{int}.  Because this criterion is expressed
                   2337: by Bison grammar rules rather than C code, the @samp{-traditional}
                   2338: flag cannot alter it.
                   2339: 
                   2340: @item
                   2341: PCC allows typedef names to be used as function parameters.  The
                   2342: difficulty described immediately above applies here too.
                   2343: 
                   2344: @item
                   2345: PCC allows whitespace in the middle of compound assignment operators
                   2346: such as @samp{+=}.  GNU CC, following the ANSI standard, does not
                   2347: allow this.  The difficulty described immediately above applies here
                   2348: too.
                   2349: 
                   2350: @item
                   2351: GNU CC will flag unterminated character constants inside of preprocessor
                   2352: conditionals that fail.  Some programs have English comments enclosed in
                   2353: conditionals that are guaranteed to fail; if these comments contain
                   2354: apostrophes, GNU CC will probably report an error.  For example,
                   2355: this code would produce an error:
                   2356: 
                   2357: @example
                   2358: #if 0
                   2359: You can't expect this to work.
                   2360: #endif
                   2361: @end example
                   2362: 
                   2363: The best solution to such a problem is to put the text into an actual
                   2364: C comment delimited by @samp{/*@dots{}*/}.  However,
                   2365: @samp{-traditional} suppresses these error messages.
                   2366: 
                   2367: @item
                   2368: When compiling functions that return @code{float}, PCC converts it to
                   2369: a double.  GNU CC actually returns a @code{float}.  If you are concerned
                   2370: with PCC compatibility, you should declare your functions to return
                   2371: @code{double}; you might as well say what you mean.
                   2372: 
                   2373: @item
                   2374: When compiling functions that return structures or unions, GNU CC
1.1.1.6   root     2375: output code normally uses a method different from that used on most
                   2376: versions of Unix.  As a result, code compiled with GNU CC cannot call
                   2377: a structure-returning function compiled with PCC, and vice versa.
1.1       root     2378: 
1.1.1.6   root     2379: The method used by GNU CC is as follows: a structure or union which is 1,
1.1       root     2380: 2, 4 or 8 bytes long is returned like a scalar.  A structure or union
                   2381: with any other size is stored into an address supplied by the caller
                   2382: in a special, fixed register.
                   2383: 
                   2384: PCC usually handles all sizes of structures and unions by returning
                   2385: the address of a block of static storage containing the value.  This
1.1.1.6   root     2386: method is not used in GNU CC because it is slower and nonreentrant.
1.1.1.5   root     2387: 
1.1.1.6   root     2388: You can tell GNU CC to use the PCC convention with the option
                   2389: @samp{-fpcc-struct-return}.
1.1.1.8   root     2390: 
                   2391: @item
                   2392: On the Sparc, GNU CC uses an incompatible calling convention for
                   2393: structures.  It passes them by including their contents in the argument
                   2394: list, whereas the standard compiler passes them effectively by
                   2395: reference.
                   2396: 
                   2397: This really ought to be fixed, but such calling conventions are not
                   2398: yet supported in GNU CC, so it isn't straightforward to fix it.
                   2399: 
                   2400: The convention for structure returning is also incompatible, and
                   2401: @samp{-fpcc-struct-return} does not help.
1.1       root     2402: @end itemize
                   2403: 
                   2404: @node Extensions, Bugs, Incompatibilities, Top
                   2405: @chapter GNU Extensions to the C Language
                   2406: 
                   2407: GNU C provides several language features not found in ANSI standard C.
                   2408: (The @samp{-pedantic} option directs GNU CC to print a warning message if
                   2409: any of these features is used.)  To test for the availability of these
                   2410: features in conditional compilation, check for a predefined macro
                   2411: @code{__GNUC__}, which is always defined under GNU CC.
                   2412: 
                   2413: @menu
                   2414: * Statement Exprs::     Putting statements and declarations inside expressions.
                   2415: * Naming Types::        Giving a name to the type of some expression.
1.1.1.9 ! root     2416: * Typeof::              @code{typeof}: referring to the type of an expression.
        !          2417: * Lvalues::             Using @samp{?:}, @samp{,} and casts in lvalues.
        !          2418: * Conditionals::        Omitting the middle operand of a @samp{?:} expression.
        !          2419: * Zero-Length::         Zero-length arrays.
        !          2420: * Variable-Length::     Arrays whose length is computed at run time.
        !          2421: * Subscripting::        Any array can be subscripted, even if not an lvalue.
        !          2422: * Pointer Arith::       Arithmetic on @code{void}-pointers and function pointers.
        !          2423: * Initializers::        Non-constant initializers.
        !          2424: * Constructors::        Constructor expressions give structures, unions
        !          2425:                          or arrays as values.
1.1.1.5   root     2426: * Function Attributes:: Declaring that functions have no side effects,
1.1.1.9 ! root     2427:                          or that they can never return.
1.1       root     2428: * Dollar Signs::        Dollar sign is allowed in identifiers.
                   2429: * Alignment::           Inquiring about the alignment of a type or variable.
                   2430: * Inline::              Defining inline functions (as fast as macros).
1.1.1.9 ! root     2431: * Extended Asm::        Assembler instructions with C expressions as operands.
        !          2432:                          (With them you can define ``built-in'' functions.)
        !          2433: * Asm Labels::          Specifying the assembler name to use for a C symbol.
1.1.1.8   root     2434: * Explicit Reg Vars::   Defining variables residing in specified registers.
                   2435: * Alternate Keywords::  @code{__const__}, @code{__asm__}, etc., for header files.
1.1       root     2436: @end menu
                   2437: 
                   2438: @node Statement Exprs, Naming Types, Extensions, Extensions
                   2439: @section Statements and Declarations inside of Expressions
                   2440: 
                   2441: A compound statement in parentheses may appear inside an expression in GNU
                   2442: C.  This allows you to declare variables within an expression.  For
                   2443: example:
                   2444: 
                   2445: @example
                   2446: (@{ int y = foo (); int z;
                   2447:    if (y > 0) z = y;
                   2448:    else z = - y;
                   2449:    z; @})
                   2450: @end example
                   2451: 
                   2452: @noindent
                   2453: is a valid (though slightly more complex than necessary) expression
                   2454: for the absolute value of @code{foo ()}.
                   2455: 
                   2456: This feature is especially useful in making macro definitions ``safe'' (so
                   2457: that they evaluate each operand exactly once).  For example, the
                   2458: ``maximum'' function is commonly defined as a macro in standard C as
                   2459: follows:
                   2460: 
                   2461: @example
                   2462: #define max(a,b) ((a) > (b) ? (a) : (b))
                   2463: @end example
                   2464: 
                   2465: @noindent
                   2466: But this definition computes either @var{a} or @var{b} twice, with bad
                   2467: results if the operand has side effects.  In GNU C, if you know the
                   2468: type of the operands (here let's assume @code{int}), you can define
                   2469: the macro safely as follows:
                   2470: 
                   2471: @example
                   2472: #define maxint(a,b) \
                   2473:   (@{int _a = (a), _b = (b); _a > _b ? _a : _b; @})
                   2474: @end example
                   2475: 
                   2476: Embedded statements are not allowed in constant expressions, such as
                   2477: the value of an enumeration constant, the width of a bit field, or
                   2478: the initial value of a static variable.
                   2479: 
                   2480: If you don't know the type of the operand, you can still do this, but you
                   2481: must use @code{typeof} (@pxref{Typeof}) or type naming (@pxref{Naming
                   2482: Types}).
                   2483: 
                   2484: @node Naming Types, Typeof, Statement Exprs, Extensions
                   2485: @section Naming an Expression's Type
                   2486: 
                   2487: You can give a name to the type of an expression using a @code{typedef}
                   2488: declaration with an initializer.  Here is how to define @var{name} as a
                   2489: type name for the type of @var{exp}:
                   2490: 
                   2491: @example
                   2492: typedef @var{name} = @var{exp};
                   2493: @end example
                   2494: 
                   2495: This is useful in conjunction with the statements-within-expressions
                   2496: feature.  Here is how the two together can be used to define a safe
                   2497: ``maximum'' macro that operates on any arithmetic type:
                   2498: 
                   2499: @example
                   2500: #define max(a,b) \
                   2501:   (@{typedef _ta = (a), _tb = (b);  \
                   2502:     _ta _a = (a); _tb _b = (b);     \
                   2503:     _a > _b ? _a : _b; @})
                   2504: @end example
                   2505: 
                   2506: The reason for using names that start with underscores for the local
                   2507: variables is to avoid conflicts with variable names that occur within the
                   2508: expressions that are substituted for @code{a} and @code{b}.  Eventually we
                   2509: hope to design a new form of declaration syntax that allows you to declare
                   2510: variables whose scopes start only after their initializers; this will be a
                   2511: more reliable way to prevent such conflicts.
                   2512: 
                   2513: @node Typeof, Lvalues, Naming Types, Extensions
                   2514: @section Referring to a Type with @code{typeof}
                   2515: 
                   2516: Another way to refer to the type of an expression is with @code{typeof}.
                   2517: The syntax of using of this keyword looks like @code{sizeof}, but the
                   2518: construct acts semantically like a type name defined with @code{typedef}.
                   2519: 
                   2520: There are two ways of writing the argument to @code{typeof}: with an
                   2521: expression or with a type.  Here is an example with an expression:
                   2522: 
                   2523: @example
                   2524: typeof (x[0](1))
                   2525: @end example
                   2526: 
                   2527: @noindent
                   2528: This assumes that @code{x} is an array of functions; the type described
                   2529: is that of the values of the functions.
                   2530: 
                   2531: Here is an example with a typename as the argument:
                   2532: 
                   2533: @example
                   2534: typeof (int *)
                   2535: @end example
                   2536: 
                   2537: @noindent
                   2538: Here the type described is that of pointers to @code{int}.
                   2539: 
1.1.1.7   root     2540: If you are writing a header file that must work when included in ANSI C
1.1.1.8   root     2541: programs, write @code{__typeof__} instead of @code{typeof}.
1.1.1.7   root     2542: @xref{Alternate Keywords}.
                   2543: 
1.1       root     2544: A @code{typeof}-construct can be used anywhere a typedef name could be
                   2545: used.  For example, you can use it in a declaration, in a cast, or inside
                   2546: of @code{sizeof} or @code{typeof}.
                   2547: 
                   2548: @itemize @bullet
                   2549: @item
                   2550: This declares @code{y} with the type of what @code{x} points to.
                   2551: 
                   2552: @example
                   2553: typeof (*x) y;
                   2554: @end example
                   2555: 
                   2556: @item
                   2557: This declares @code{y} as an array of such values.
                   2558: 
                   2559: @example
                   2560: typeof (*x) y[4];
                   2561: @end example
                   2562: 
                   2563: @item
                   2564: This declares @code{y} as an array of pointers to characters:
                   2565: 
                   2566: @example
                   2567: typeof (typeof (char *)[4]) y;
                   2568: @end example
                   2569: 
                   2570: @noindent
                   2571: It is equivalent to the following traditional C declaration:
                   2572: 
                   2573: @example
                   2574: char *y[4];
                   2575: @end example
                   2576: 
                   2577: To see the meaning of the declaration using @code{typeof}, and why it
                   2578: might be a useful way to write, let's rewrite it with these macros:
                   2579: 
                   2580: @example
                   2581: #define pointer(T)  typeof(T *)
                   2582: #define array(T, N) typeof(T [N])
                   2583: @end example
                   2584: 
                   2585: @noindent
                   2586: Now the declaration can be rewritten this way:
                   2587: 
                   2588: @example
                   2589: array (pointer (char), 4) y;
                   2590: @end example
                   2591: 
                   2592: @noindent
1.1.1.8   root     2593: Thus, @code{array (pointer (char), 4)} is the type of arrays of 4
1.1       root     2594: pointers to @code{char}.
                   2595: @end itemize
                   2596: 
                   2597: @node Lvalues, Conditionals, Typeof, Extensions
                   2598: @section Generalized Lvalues
                   2599: 
                   2600: Compound expressions, conditional expressions and casts are allowed as
                   2601: lvalues provided their operands are lvalues.  This means that you can take
                   2602: their addresses or store values into them.
                   2603: 
                   2604: For example, a compound expression can be assigned, provided the last
                   2605: expression in the sequence is an lvalue.  These two expressions are
                   2606: equivalent:
                   2607: 
                   2608: @example
                   2609: (a, b) += 5
                   2610: a, (b += 5)
                   2611: @end example
                   2612: 
                   2613: Similarly, the address of the compound expression can be taken.  These two
                   2614: expressions are equivalent:
                   2615: 
                   2616: @example
                   2617: &(a, b)
                   2618: a, &b
                   2619: @end example
                   2620: 
                   2621: A conditional expression is a valid lvalue if its type is not void and the
                   2622: true and false branches are both valid lvalues.  For example, these two
                   2623: expressions are equivalent:
                   2624: 
                   2625: @example
                   2626: (a ? b : c) = 5
                   2627: (a ? b = 5 : (c = 5))
                   2628: @end example
                   2629: 
                   2630: A cast is a valid lvalue if its operand is valid.  Taking the address of
                   2631: the cast is the same as taking the address without a cast, except for the
                   2632: type of the result.  For example, these two expressions are equivalent (but
1.1.1.8   root     2633: the second may be valid when the type of @code{a} does not permit a cast to
                   2634: @code{int *}).
1.1       root     2635: 
                   2636: @example
                   2637: &(int *)a
                   2638: (int **)&a
                   2639: @end example
                   2640: 
                   2641: A simple assignment whose left-hand side is a cast works by converting the
                   2642: right-hand side first to the specified type, then to the type of the inner
                   2643: left-hand side expression.  After this is stored, the value is converter
                   2644: back to the specified type to become the value of the assignment.  Thus, if
1.1.1.8   root     2645: @code{a} has type @code{char *}, the following two expressions are
1.1       root     2646: equivalent:
                   2647: 
                   2648: @example
                   2649: (int)a = 5
                   2650: (int)(a = (char *)5)
                   2651: @end example
                   2652: 
                   2653: An assignment-with-arithmetic operation such as @samp{+=} applied to a cast
                   2654: performs the arithmetic using the type resulting from the cast, and then
                   2655: continues as in the previous case.  Therefore, these two expressions are
                   2656: equivalent:
                   2657: 
                   2658: @example
                   2659: (int)a += 5
                   2660: (int)(a = (char *) ((int)a + 5))
                   2661: @end example
                   2662: 
                   2663: @node Conditionals, Zero-Length, Lvalues, Extensions
                   2664: @section Conditional Expressions with Omitted Middle-Operands
                   2665: 
                   2666: The middle operand in a conditional expression may be omitted.  Then
                   2667: if the first operand is nonzero, its value is the value of the conditional
                   2668: expression.
                   2669: 
                   2670: Therefore, the expression
                   2671: 
                   2672: @example
                   2673: x ? : y
                   2674: @end example
                   2675: 
                   2676: @noindent
                   2677: has the value of @code{x} if that is nonzero; otherwise, the value of
                   2678: @code{y}.
                   2679: 
                   2680: This example is perfectly equivalent to
                   2681: 
                   2682: @example
                   2683: x ? x : y
                   2684: @end example
                   2685: 
                   2686: @noindent
                   2687: In this simple case, the ability to omit the middle operand is not
                   2688: especially useful.  When it becomes useful is when the first operand does,
                   2689: or may (if it is a macro argument), contain a side effect.  Then repeating
                   2690: the operand in the middle would perform the side effect twice.  Omitting
                   2691: the middle operand uses the value already computed without the undesirable
                   2692: effects of recomputing it.
                   2693: 
                   2694: @node Zero-Length, Variable-Length, Conditionals, Extensions
                   2695: @section Arrays of Length Zero
                   2696: 
                   2697: Zero-length arrays are allowed in GNU C.  They are very useful as the last
                   2698: element of a structure which is really a header for a variable-length
                   2699: object:
                   2700: 
                   2701: @example
                   2702: struct line @{
                   2703:   int length;
                   2704:   char contents[0];
                   2705: @};
                   2706: 
                   2707: @{
                   2708:   struct line *thisline 
                   2709:     = (struct line *) malloc (sizeof (struct line) + this_length);
                   2710:   thisline->length = this_length;
                   2711: @}
                   2712: @end example
                   2713: 
                   2714: In standard C, you would have to give @code{contents} a length of 1, which
                   2715: means either you waste space or complicate the argument to @code{malloc}.
                   2716: 
                   2717: @node Variable-Length, Subscripting, Zero-Length, Extensions
                   2718: @section Arrays of Variable Length
                   2719: 
                   2720: Variable-length automatic arrays are allowed in GNU C.  These arrays are
                   2721: declared like any other automatic arrays, but with a length that is not a
                   2722: constant expression.  The storage is allocated at that time and
                   2723: deallocated when the brace-level is exited.  For example:
                   2724: 
                   2725: @example
                   2726: FILE *concat_fopen (char *s1, char *s2, char *mode)
                   2727: @{
                   2728:   char str[strlen (s1) + strlen (s2) + 1];
                   2729:   strcpy (str, s1);
                   2730:   strcat (str, s2);
                   2731:   return fopen (str, mode);
                   2732: @}
                   2733: @end example
                   2734: 
1.1.1.7   root     2735: You can also use variable-length arrays as arguments to functions:
1.1       root     2736: 
                   2737: @example
                   2738: struct entry
1.1.1.7   root     2739: tester (int len, char data[len])
1.1       root     2740: @{
1.1.1.7   root     2741:   @dots{}
1.1       root     2742: @}
                   2743: @end example
                   2744: 
                   2745: The length of an array is computed on entry to the brace-level where the
                   2746: array is declared and is remembered for the scope of the array in case you
                   2747: access it with @code{sizeof}.
                   2748: 
                   2749: Jumping or breaking out of the scope of the array name will also deallocate
                   2750: the storage.  Jumping into the scope is not allowed; you will get an error
                   2751: message for it.
                   2752: 
                   2753: You can use the function @code{alloca} to get an effect much like
                   2754: variable-length arrays.  The function @code{alloca} is available in
                   2755: many other C implementations (but not in all).  On the other hand,
                   2756: variable-length arrays are more elegant.
                   2757: 
                   2758: There are other differences between these two methods.  Space allocated
                   2759: with @code{alloca} exists until the containing @emph{function} returns.
                   2760: The space for a variable-length array is deallocated as soon as the array
                   2761: name's scope ends.  (If you use both variable-length arrays and
                   2762: @code{alloca} in the same function, deallocation of a variable-length array
                   2763: will also deallocate anything more recently allocated with @code{alloca}.)
                   2764: 
                   2765: @node Subscripting, Pointer Arith, Variable-Length, Extensions
                   2766: @section Non-Lvalue Arrays May Have Subscripts
                   2767: 
                   2768: Subscripting is allowed on arrays that are not lvalues, even though the
                   2769: unary @samp{&} operator is not.  For example, this is valid in GNU C though
                   2770: not valid in other C dialects:
                   2771: 
                   2772: @example
                   2773: struct foo @{int a[4];@};
                   2774: 
                   2775: struct foo f();
                   2776: 
                   2777: bar (int index)
                   2778: @{
                   2779:   return f().a[index];
                   2780: @}
                   2781: @end example
                   2782: 
                   2783: @node Pointer Arith, Initializers, Subscripting, Extensions
                   2784: @section Arithmetic on @code{void}-Pointers and Function Pointers
                   2785: 
                   2786: In GNU C, addition and subtraction operations are supported on pointers to
                   2787: @code{void} and on pointers to functions.  This is done by treating the
                   2788: size of a @code{void} or of a function as 1.
                   2789: 
                   2790: A consequence of this is that @code{sizeof} is also allowed on @code{void}
                   2791: and on function types, and returns 1.
                   2792: 
1.1.1.8   root     2793: The option @samp{-Wpointer-arith} requests a warning if these extensions
                   2794: are used.
                   2795: 
1.1       root     2796: @node Initializers, Constructors, Pointer Arith, Extensions
                   2797: @section Non-Constant Initializers
                   2798: 
1.1.1.8   root     2799: The elements of an aggregate initializer for an automatic variable are
                   2800: not required to be constant expressions in GNU C.  Here is an example of
                   2801: an initializer with run-time varying elements:
1.1       root     2802: 
                   2803: @example
                   2804: foo (float f, float g)
                   2805: @{
                   2806:   float beat_freqs[2] = @{ f-g, f+g @};
                   2807:   @dots{}
                   2808: @}
                   2809: @end example
                   2810: 
1.1.1.5   root     2811: @node Constructors, Function Attributes, Initializers, Extensions
1.1       root     2812: @section Constructor Expressions
                   2813: 
                   2814: GNU C supports constructor expressions.  A constructor looks like a cast
                   2815: containing an initializer.  Its value is an object of the type specified in
                   2816: the cast, containing the elements specified in the initializer.  The type
                   2817: must be a structure, union or array type.
                   2818: 
                   2819: Assume that @code{struct foo} and @code{structure} are declared as shown:
                   2820: 
                   2821: @example
                   2822: struct foo @{int a; char b[2];@} structure;
                   2823: @end example
                   2824: 
                   2825: @noindent
1.1.1.8   root     2826: Here is an example of constructing a @code{struct foo} with a constructor:
1.1       root     2827: 
                   2828: @example
                   2829: structure = ((struct foo) @{x + y, 'a', 0@});
                   2830: @end example
                   2831: 
                   2832: @noindent
                   2833: This is equivalent to writing the following:
                   2834: 
                   2835: @example
                   2836: @{
                   2837:   struct foo temp = @{x + y, 'a', 0@};
                   2838:   structure = temp;
                   2839: @}
                   2840: @end example
                   2841: 
                   2842: You can also construct an array.  If all the elements of the constructor
                   2843: are (made up of) simple constant expressions, suitable for use in
                   2844: initializers, then the constructor is an lvalue and can be coerced to a
                   2845: pointer to its first element, as shown here:
                   2846: 
                   2847: @example
                   2848: char **foo = (char *[]) @{ "x", "y", "z" @};
                   2849: @end example
                   2850: 
                   2851: Array constructors whose elements are not simple constants are not very
                   2852: useful, because the constructor is not an lvalue.  There are only two valid
                   2853: ways to use it: to subscript it, or initialize an array variable with it.
                   2854: The former is probably slower than a @code{switch} statement, while the
                   2855: latter does the same thing an ordinary C initializer would do.
                   2856: 
                   2857: @example
                   2858: output = ((int[]) @{ 2, x, 28 @}) [input];
                   2859: @end example
                   2860: 
1.1.1.8   root     2861: @node Function Attributes, Dollar Signs, Constructors, Extensions
1.1.1.5   root     2862: @section Declaring Attributes of Functions
                   2863: 
                   2864: In GNU C, you declare certain things about functions called in your program
                   2865: which help the compiler optimize function calls.
                   2866: 
                   2867: A few functions, such as @code{abort} and @code{exit}, cannot return.
                   2868: These functions should be declared @code{volatile}.  For example,
                   2869: 
                   2870: @example
                   2871: extern volatile void abort ();
                   2872: @end example
                   2873: 
                   2874: @noindent
                   2875: tells the compiler that it can assume that @code{abort} will not return.
                   2876: This makes slightly better code, but more importantly it helps avoid
                   2877: spurious warnings of uninitialized variables.
                   2878: 
                   2879: Many functions do not examine any values except their arguments, and
                   2880: have no effects except the return value.  Such a function can be subject
                   2881: to common subexpression elimination and loop optimization just as an
                   2882: arithmetic operator would be.  These functions should be declared
                   2883: @code{const}.  For example,
                   2884: 
                   2885: @example
                   2886: extern const void square ();
                   2887: @end example
                   2888: 
                   2889: @noindent
                   2890: says that the hypothetical function @code{square} is safe to call
                   2891: fewer times than the program says.
                   2892: 
                   2893: Note that a function that has pointer arguments and examines the data
                   2894: pointed to must @emph{not} be declared @code{const}.  Likewise, a
                   2895: function that calls a non-@code{const} function must not be
                   2896: @code{const}.
                   2897: 
                   2898: Some people object to this feature, claiming that ANSI C's @code{#pragma}
                   2899: should be used instead.  There are two reasons I did not do this.
                   2900: 
                   2901: @enumerate
                   2902: @item
                   2903: It is impossible to generate @code{#pragma} commands from a macro.
                   2904: 
                   2905: @item
                   2906: The @code{#pragma} command is just as likely as these keywords to mean
                   2907: something else in another compiler.
                   2908: @end enumerate
                   2909: 
                   2910: These two reasons apply to @emph{any} application whatever: as far as
                   2911: I can see, @code{#pragma} is never useful.
                   2912: 
                   2913: @node Dollar Signs, Alignment, Function Attributes, Extensions
1.1       root     2914: @section Dollar Signs in Identifier Names
                   2915: 
                   2916: In GNU C, you may use dollar signs in identifier names.  This is because
                   2917: many traditional C implementations allow such identifiers.
                   2918: 
1.1.1.9 ! root     2919: Dollar signs are allowed if you specify @samp{-traditional}; they are
        !          2920: not allowed if you specify @samp{-ansi}.  Whether they are allowed by
        !          2921: default depends on the target machine; usually, they are not.
        !          2922: 
1.1       root     2923: @node Alignment, Inline, Dollar Signs, Extensions
                   2924: @section Inquiring about the Alignment of a Type or Variable
                   2925: 
1.1.1.8   root     2926: The keyword @code{__alignof__} allows you to inquire about how an object
1.1       root     2927: is aligned, or the minimum alignment usually required by a type.  Its
                   2928: syntax is just like @code{sizeof}.
                   2929: 
                   2930: For example, if the target machine requires a @code{double} value to be
1.1.1.8   root     2931: aligned on an 8-byte boundary, then @code{__alignof__ (double)} is 8.
                   2932: This is true on many RISC machines.  On more traditional machine
                   2933: designs, @code{__alignof__ (double)} is 4 or even 2.
1.1       root     2934: 
                   2935: Some machines never actually require alignment; they allow reference to any
1.1.1.8   root     2936: data type even at an odd addresses.  For these machines, @code{__alignof__}
1.1       root     2937: reports the @emph{recommended} alignment of a type.
                   2938: 
1.1.1.8   root     2939: When the operand of @code{__alignof__} is an lvalue rather than a type, the
1.1       root     2940: value is the largest alignment that the lvalue is known to have.  It may
                   2941: have this alignment as a result of its data type, or because it is part of
                   2942: a structure and inherits alignment from that structure. For example, after
                   2943: this declaration:
                   2944: 
                   2945: @example
                   2946: struct foo @{ int x; char y; @} foo1;
                   2947: @end example
                   2948: 
                   2949: @noindent
1.1.1.8   root     2950: the value of @code{__alignof__ (foo1.y)} is probably 2 or 4, the same as
                   2951: @code{__alignof__ (int)}, even though the data type of @code{foo1.y}
                   2952: does not itself demand any alignment.@refill
1.1       root     2953: 
                   2954: @node Inline, Extended Asm, Alignment, Extensions
                   2955: @section An Inline Function is As Fast As a Macro
                   2956: 
                   2957: By declaring a function @code{inline}, you can direct GNU CC to integrate
                   2958: that function's code into the code for its callers.  This makes execution
                   2959: faster by eliminating the function-call overhead; in addition, if any of
                   2960: the actual argument values are constant, their known values may permit
                   2961: simplifications at compile time so that not all of the inline function's
                   2962: code needs to be included.
                   2963: 
                   2964: To declare a function inline, use the @code{inline} keyword in its
                   2965: declaration, like this:
                   2966: 
                   2967: @example
                   2968: inline int
                   2969: inc (int *a)
                   2970: @{
                   2971:   (*a)++;
                   2972: @}
                   2973: @end example
                   2974: 
1.1.1.7   root     2975: (If you are writing a header file to be included in ANSI C programs, write
1.1.1.8   root     2976: @code{__inline__} instead of @code{inline}.  @xref{Alternate Keywords}.)
1.1.1.7   root     2977: 
                   2978: You can also make all ``simple enough'' functions inline with the option
                   2979: @samp{-finline-functions}.  Note that certain usages in a function
                   2980: definition can make it unsuitable for inline substitution.
1.1       root     2981: 
                   2982: When a function is both inline and @code{static}, if all calls to the
1.1.1.8   root     2983: function are integrated into the caller, and the function's address is
                   2984: never used, then the function's own assembler code is never referenced.
                   2985: In this case, GNU CC does not actually output assembler code for the
                   2986: function, unless you specify the option @samp{-fkeep-inline-functions}.
                   2987: Some calls cannot be integrated for various reasons (in particular,
                   2988: calls that precede the function's definition cannot be integrated, and
                   2989: neither can recursive calls within the definition).  If there is a
                   2990: nonintegrated call, then the function is compiled to assembler code as
                   2991: usual.  The function must also be compiled as usual if the program
                   2992: refers to its address, because that can't be inlined.
1.1       root     2993: 
                   2994: When an inline function is not @code{static}, then the compiler must assume
                   2995: that there may be calls from other source files; since a global symbol can
                   2996: be defined only once in any program, the function must not be defined in
                   2997: the other source files, so the calls therein cannot be integrated.
                   2998: Therefore, a non-@code{static} inline function is always compiled on its
                   2999: own in the usual fashion.
                   3000: 
1.1.1.8   root     3001: If you specify both @code{inline} and @code{extern} in the function
                   3002: definition, then the definition is used only for inlining.  In no case
                   3003: is the function compiled on its own, not even if you refer to its
                   3004: address explicitly.  Such an address becomes an external reference, as
                   3005: if you had only declared the function, and had not defined it.
                   3006: 
                   3007: This combination of @code{inline} and @code{extern} has almost the
                   3008: effect of a macro.  The way to use it is to put a function definition in
                   3009: a header file with these keywords, and put another copy of the
                   3010: definition (lacking @code{inline} and @code{extern}) in a library file.
                   3011: The definition in the header file will cause most calls to the function
                   3012: to be inlined.  If any uses of the function remain, they will refer to
                   3013: the single copy in the library.
                   3014: 
1.1       root     3015: @node Extended Asm, Asm Labels, Inline, Extensions
                   3016: @section Assembler Instructions with C Expression Operands
                   3017: 
                   3018: In an assembler instruction using @code{asm}, you can now specify the
                   3019: operands of the instruction using C expressions.  This means no more
                   3020: guessing which registers or memory locations will contain the data you want
                   3021: to use.
                   3022: 
                   3023: You must specify an assembler instruction template much like what appears
                   3024: in a machine description, plus an operand constraint string for each
                   3025: operand.
                   3026: 
                   3027: For example, here is how to use the 68881's @code{fsinx} instruction:
                   3028: 
                   3029: @example
                   3030: asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
                   3031: @end example
                   3032: 
                   3033: @noindent
                   3034: Here @code{angle} is the C expression for the input operand while
                   3035: @code{result} is that of the output operand.  Each has @samp{"f"} as its
                   3036: operand constraint, saying that a floating-point register is required.  The
1.1.1.5   root     3037: @samp{=} in @samp{=f} indicates that the operand is an output; all output
1.1.1.4   root     3038: operands' constraints must use @samp{=}.  The constraints use the same
                   3039: language used in the machine description (@pxref{Constraints}).
1.1       root     3040: 
                   3041: Each operand is described by an operand-constraint string followed by the C
                   3042: expression in parentheses.  A colon separates the assembler template from
                   3043: the first output operand, and another separates the last output operand
                   3044: from the first input, if any.  Commas separate output operands and separate
1.1.1.4   root     3045: inputs.  The total number of operands is limited to the maximum number of
1.1       root     3046: operands in any instruction pattern in the machine description.
                   3047: 
1.1.1.4   root     3048: If there are no output operands, and there are input operands, then there
                   3049: must be two consecutive colons surrounding the place where the output
                   3050: operands would go.
                   3051: 
1.1       root     3052: Output operand expressions must be lvalues; the compiler can check this.
                   3053: The input operands need not be lvalues.  The compiler cannot check whether
                   3054: the operands have data types that are reasonable for the instruction being
                   3055: executed.  It does not parse the assembler instruction template and does
                   3056: not know what it means, or whether it is valid assembler input.  The
                   3057: extended @code{asm} feature is most often used for machine instructions
                   3058: that the compiler itself does not know exist.
                   3059: 
                   3060: The output operands must be write-only; GNU CC will assume that the values
                   3061: in these operands before the instruction are dead and need not be
1.1.1.8   root     3062: generated.  Extended asm does not support input-output or read-write
                   3063: operands.  For this reason, the constraint character @samp{+}, which
                   3064: indicates such an operand, may not be used.
                   3065: 
                   3066: When the assembler instruction has a read-write operand, or an operand
                   3067: in which only some of the bits are to be changed, you must logically
1.1       root     3068: split its function into two separate operands, one input operand and one
                   3069: write-only output operand.  The connection between them is expressed by
                   3070: constraints which say they need to be in the same location when the
1.1.1.8   root     3071: instruction executes.  You can use the same C expression for both
                   3072: operands, or different expressions.  For example, here we write the
                   3073: (fictitious) @samp{combine} instruction with @code{bar} as its read-only
                   3074: source operand and @code{foo} as its read-write destination:
1.1       root     3075: 
                   3076: @example
                   3077: asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
                   3078: @end example
                   3079: 
                   3080: @noindent
                   3081: The constraint @samp{"0"} for operand 1 says that it must occupy the same
1.1.1.5   root     3082: location as operand 0.  A digit in constraint is allowed only in an input
                   3083: operand, and it must refer to an output operand.
1.1       root     3084: 
                   3085: Only a digit in the constraint can guarantee that one operand will be in
                   3086: the same place as another.  The mere fact that @code{foo} is the value of
                   3087: both operands is not enough to guarantee that they will be in the same
                   3088: place in the generated assembler code.  The following would not work:
                   3089: 
                   3090: @example
                   3091: asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
                   3092: @end example
                   3093: 
                   3094: Various optimizations or reloading could cause operands 0 and 1 to be in
                   3095: different registers; GNU CC knows no reason not to do so.  For example, the
                   3096: compiler might find a copy of the value of @code{foo} in one register and
                   3097: use it for operand 1, but generate the output operand 0 in a different
                   3098: register (copying it afterward to @code{foo}'s own address).  Of course,
                   3099: since the register for operand 1 is not even mentioned in the assembler
                   3100: code, the result will not work, but GNU CC can't tell that.
                   3101: 
                   3102: Unless an output operand has the @samp{&} constraint modifier, GNU CC may
                   3103: allocate it in the same register as an unrelated input operand, on the
                   3104: assumption that the inputs are consumed before the outputs are produced.
                   3105: This assumption may be false if the assembler code actually consists of
                   3106: more than one instruction.  In such a case, use @samp{&} for each output
                   3107: operand that may not overlap an input.  @xref{Modifiers}.
                   3108: 
1.1.1.4   root     3109: Some instructions clobber specific hard registers.  To describe this, write
                   3110: a third colon after the input operands, followed by the names of the
                   3111: clobbered hard registers (given as strings).  Here is a realistic example
                   3112: for the vax:
1.1       root     3113: 
                   3114: @example
                   3115: asm volatile ("movc3 %0,%1,%2"
                   3116:               : /* no outputs */
                   3117:               : "g" (from), "g" (to), "g" (count)
                   3118:               : "r0", "r1", "r2", "r3", "r4", "r5");
                   3119: @end example
                   3120: 
1.1.1.4   root     3121: You can put multiple assembler instructions together in a single @code{asm}
1.1.1.7   root     3122: template, separated either with newlines (written as @samp{\n}) or with
                   3123: semicolons if the assembler allows such semicolons.  The GNU assembler
                   3124: allows semicolons and all Unix assemblers seem to do so.  The input
                   3125: operands are guaranteed not to use any of the clobbered registers, and
                   3126: neither will the output operands' addresses, so you can read and write the
                   3127: clobbered registers as many times as you like.  Here is an example of
                   3128: multiple instructions in a template; it assumes that the subroutine
                   3129: @code{_foo} accepts arguments in registers 9 and 10:
1.1.1.4   root     3130: 
                   3131: @example
                   3132: asm ("movl %0,r9;movl %1,r10;call _foo"
                   3133:      : /* no outputs */
                   3134:      : "g" (from), "g" (to)
                   3135:      : "r9", "r10");
                   3136: @end example
                   3137: 
1.1.1.7   root     3138: If you want to test the condition code produced by an assembler instruction,
                   3139: you must include a branch and a label in the @code{asm} construct, as follows:
                   3140: 
                   3141: @example
                   3142: asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
                   3143:      : "g" (result)
                   3144:      : "g" (input));
                   3145: @end example
                   3146: 
                   3147: @noindent
                   3148: This assumes your assembler supports local labels, as the GNU assembler
                   3149: and most Unix assemblers do.
                   3150: 
1.1       root     3151: Usually the most convenient way to use these @code{asm} instructions is to
                   3152: encapsulate them in macros that look like functions.  For example,
                   3153: 
                   3154: @example
                   3155: #define sin(x)       \
                   3156: (@{ double __value, __arg = (x);   \
                   3157:    asm ("fsinx %1,%0": "=f" (__value): "f" (__arg));  \
                   3158:    __value; @})
                   3159: @end example
                   3160: 
                   3161: @noindent
                   3162: Here the variable @code{__arg} is used to make sure that the instruction
                   3163: operates on a proper @code{double} value, and to accept only those
                   3164: arguments @code{x} which can convert automatically to a @code{double}.
                   3165: 
                   3166: Another way to make sure the instruction operates on the correct data type
                   3167: is to use a cast in the @code{asm}.  This is different from using a
                   3168: variable @code{__arg} in that it converts more different types.  For
                   3169: example, if the desired type were @code{int}, casting the argument to
                   3170: @code{int} would accept a pointer with no complaint, while assigning the
                   3171: argument to an @code{int} variable named @code{__arg} would warn about
                   3172: using a pointer unless the caller explicitly casts it.
                   3173: 
1.1.1.4   root     3174: If an @code{asm} has output operands, GNU CC assumes for optimization
                   3175: purposes that the instruction has no side effects except to change the
                   3176: output operands.  This does not mean that instructions with a side effect
                   3177: cannot be used, but you must be careful, because the compiler may eliminate
                   3178: them if the output operands aren't used, or move them out of loops, or
                   3179: replace two with one if they constitute a common subexpression.  Also, if
                   3180: your instruction does have a side effect on a variable that otherwise
                   3181: appears not to change, the old value of the variable may be reused later if
                   3182: it happens to be found in a register.
1.1       root     3183: 
                   3184: You can prevent an @code{asm} instruction from being deleted, moved or
                   3185: combined by writing the keyword @code{volatile} after the @code{asm}.  For
                   3186: example:
                   3187: 
                   3188: @example
                   3189: #define set_priority(x)  \
                   3190: asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
                   3191: @end example
                   3192: 
1.1.1.7   root     3193: @noindent
                   3194: (However, an instruction without output operands will not be deleted
                   3195: or moved, regardless, unless it is unreachable.)
1.1.1.4   root     3196: 
1.1       root     3197: It is a natural idea to look for a way to give access to the condition
                   3198: code left by the assembler instruction.  However, when we attempted to
                   3199: implement this, we found no way to make it work reliably.  The problem
                   3200: is that output operands might need reloading, which would result in
                   3201: additional following ``store'' instructions.  On most machines, these
                   3202: instructions would alter the condition code before there was time to
                   3203: test it.  This problem doesn't arise for ordinary ``test'' and
                   3204: ``compare'' instructions because they don't have any output operands.
                   3205: 
1.1.1.7   root     3206: If you are writing a header file that should be includable in ANSI C
1.1.1.8   root     3207: programs, write @code{__asm__} instead of @code{asm}.  @xref{Alternate
1.1.1.7   root     3208: Keywords}.
                   3209: 
1.1.1.8   root     3210: @node Asm Labels, Explicit Reg Vars, Extended Asm, Extensions
1.1       root     3211: @section Controlling Names Used in Assembler Code
                   3212: 
1.1.1.8   root     3213: You can specify the name to be used in the assembler code for a C
                   3214: function or variable by writing the @code{asm} (or @code{__asm__})
                   3215: keyword after the declarator as follows:
1.1       root     3216: 
                   3217: @example
                   3218: int foo asm ("myfoo") = 2;
                   3219: @end example
                   3220: 
                   3221: @noindent
                   3222: This specifies that the name to be used for the variable @code{foo} in
                   3223: the assembler code should be @samp{myfoo} rather than the usual
                   3224: @samp{_foo}.
                   3225: 
                   3226: On systems where an underscore is normally prepended to the name of a C
                   3227: function or variable, this feature allows you to define names for the
                   3228: linker that do not start with an underscore.
                   3229: 
                   3230: You cannot use @code{asm} in this way in a function @emph{definition}; but
                   3231: you can get the same effect by writing a declaration for the function
                   3232: before its definition and putting @code{asm} there, like this:
                   3233: 
                   3234: @example
                   3235: extern func () asm ("FUNC");
                   3236: 
                   3237: func (x, y)
                   3238:      int x, y;
                   3239: @dots{}
                   3240: @end example
                   3241: 
                   3242: It is up to you to make sure that the assembler names you choose do not
                   3243: conflict with any other assembler symbols.  Also, you must not use a
                   3244: register name; that would produce completely invalid assembler code.  GNU
                   3245: CC does not as yet have the ability to store static variables in registers.
                   3246: Perhaps that will be added.
                   3247: 
1.1.1.8   root     3248: @node Explicit Reg Vars, Alternate Keywords, Asm Labels, Extensions
                   3249: @section Variables in Specified Registers
                   3250: 
                   3251: GNU C allows you to put a few global variables into specified hardware
                   3252: registers.  You can also specify the register in which an ordinary
                   3253: register variable should be allocated.
                   3254: 
                   3255: @itemize @bullet
                   3256: @item
                   3257: Global register variables reserve registers throughout the program.
                   3258: This may be useful in programs such as programming language
                   3259: interpreters which have a couple of global variables that are accessed
                   3260: very often.
                   3261: 
                   3262: @item
                   3263: Local register variables in specific registers do not reserve the
                   3264: registers.  The compiler's data flow analysis is capable of
                   3265: determining where the specified registers contain live values, and
                   3266: where they are available for other uses.  These local variables are
                   3267: sometimes convenient for use with the extended @code{asm} feature
                   3268: (@pxref{Extended Asm}).
                   3269: @end itemize
                   3270: 
                   3271: @menu
                   3272: * Global Reg Vars::
                   3273: * Local Reg Vars::
                   3274: @end menu
1.1.1.5   root     3275: 
1.1.1.8   root     3276: @node Global Reg Vars, Local Reg Vars, Explicit Reg Vars, Explicit Reg Vars
                   3277: @subsection Defining Global Register Variables
1.1.1.5   root     3278: 
                   3279: You can define a global register variable in GNU C like this:
                   3280: 
                   3281: @example
                   3282: register int *foo asm ("a5");
                   3283: @end example
                   3284: 
                   3285: @noindent
                   3286: Here @code{a5} is the name of the register which should be used.  Choose a
                   3287: register which is normally saved and restored by function calls on your
                   3288: machine, so that library routines will not clobber it.
                   3289: 
                   3290: Naturally the register name is cpu-dependent, so you would need to
                   3291: conditionalize your program according to cpu type.  The register
                   3292: @code{a5} would be a good choice on a 68000 for a variable of pointer
                   3293: type.  On machines with register windows, be sure to choose a ``global''
1.1.1.8   root     3294: register that is not affected magically by the function call mechanism.
1.1.1.5   root     3295: 
                   3296: In addition, operating systems on one type of cpu may differ in how they
                   3297: name the registers; then you would need additional conditionals.  For
                   3298: example, some 68000 operating systems call this register @code{%a5}.
                   3299: 
                   3300: Eventually there may be a way of asking the compiler to choose a register
                   3301: automatically, but first we need to figure out how it should choose and
1.1.1.6   root     3302: how to enable you to guide the choice.  No solution is evident.
1.1.1.5   root     3303: 
                   3304: Defining a global register variable in a certain register reserves that
                   3305: register entirely for this use, at least within the current compilation.
                   3306: The register will not be allocated for any other purpose in the functions
                   3307: in the current compilation.  The register will not be saved and restored by
                   3308: these functions.  Stores into this register are never deleted even if they
                   3309: would appear to be dead, but references may be deleted or moved or
                   3310: simplified.
                   3311: 
                   3312: It is not safe to access the global register variables from signal
                   3313: handlers, or from more than one thread of control, because the system
                   3314: library routines may temporarily use the register for other things (unless
                   3315: you recompile them specially for the task at hand).
                   3316: 
                   3317: It is not safe for one function that uses a global register variable to
                   3318: call another such function @code{foo} by way of a third function
                   3319: @code{lose} that was compiled without knowledge of this variable (i.e. in a
                   3320: different source file in which the variable wasn't declared).  This is
                   3321: because @code{lose} might save the register and put some other value there.
                   3322: For example, you can't expect a global register variable to be available in
                   3323: the comparison-function that you pass to @code{qsort}, since @code{qsort}
                   3324: might have put something else in that register.  (If you are prepared to
                   3325: recompile @code{qsort} with the same global register variable, you can
                   3326: solve this problem.)
                   3327: 
                   3328: If you want to recompile @code{qsort} or other source files which do not
                   3329: actually use your global register variable, so that they will not use that
                   3330: register for any other purpose, then it suffices to specify the compiler
                   3331: option @samp{-ffixed-@var{reg}}.  You need not actually add a global
                   3332: register declaration to their source code.
                   3333: 
                   3334: A function which can alter the value of a global register variable cannot
                   3335: safely be called from a function compiled without this variable, because it
                   3336: could clobber the value the caller expects to find there on return.
                   3337: Therefore, the function which is the entry point into the part of the
                   3338: program that uses the global register variable must explicitly save and
                   3339: restore the value which belongs to its caller.
                   3340: 
                   3341: On most machines, @code{longjmp} will restore to each global register
                   3342: variable the value it had at the time of the @code{setjmp}.  On some
                   3343: machines, however, @code{longjmp} will not change the value of global
                   3344: register variables.  To be portable, the function that called @code{setjmp}
                   3345: should make other arrangements to save the values of the global register
1.1.1.9 ! root     3346: variables, and to restore them in a @code{longjmp}.  This way, the the same
1.1.1.5   root     3347: thing will happen regardless of what @code{longjmp} does.
                   3348: 
                   3349: All global register variable declarations must precede all function
                   3350: definitions.  If such a declaration could appear after function
                   3351: definitions, the declaration would be too late to prevent the register from
                   3352: being used for other purposes in the preceding functions.
                   3353: 
1.1.1.6   root     3354: Global register variables may not have initial values, because an
                   3355: executable file has no means to supply initial contents for a register.
                   3356: 
1.1.1.9 ! root     3357: @node Local Reg Vars,, Global Reg Vars, Explicit Reg Vars
1.1.1.8   root     3358: @subsection Specifying Registers for Local Variables
                   3359: 
                   3360: You can define a local register variable with a specified register
                   3361: like this:
                   3362: 
                   3363: @example
                   3364: register int *foo asm ("a5");
                   3365: @end example
                   3366: 
                   3367: @noindent
                   3368: Here @code{a5} is the name of the register which should be used.  Note
                   3369: that this is the same syntax used for defining global register
                   3370: variables, but for a local variable it would appear within a function.
                   3371: 
                   3372: Naturally the register name is cpu-dependent, but this is not a
                   3373: problem, since specific registers are most often useful with explicit
                   3374: assembler instructions (@pxref{Extended Asm}).  Both of these things
                   3375: generally require that you conditionalize your program according to
                   3376: cpu type.
                   3377: 
                   3378: In addition, operating systems on one type of cpu may differ in how they
                   3379: name the registers; then you would need additional conditionals.  For
                   3380: example, some 68000 operating systems call this register @code{%a5}.
                   3381: 
                   3382: Eventually there may be a way of asking the compiler to choose a register
                   3383: automatically, but first we need to figure out how it should choose and
                   3384: how to enable you to guide the choice.  No solution is evident.
                   3385: 
                   3386: Defining such a register variable does not reserve the register; it
                   3387: remains available for other uses in places where flow control
                   3388: determines the variable's value is not live.  However, these registers
                   3389: made unavailable for use in the reload pass.  I would not be surprised
                   3390: if excessive use of this feature leaves the compiler too few available
                   3391: registers to compile certain functions.
                   3392: 
                   3393: @node Alternate Keywords,, Explicit Reg Vars, Extensions
1.1.1.7   root     3394: @section Alternate Keywords
                   3395: 
                   3396: The option @samp{-traditional} disables certain keywords; @samp{-ansi}
                   3397: disables certain others.  This causes trouble when you want to use GNU C
                   3398: extensions, or ANSI C features, in a general-purpose header file that
                   3399: should be usable by all programs, including ANSI C programs and traditional
                   3400: ones.  The keywords @code{asm}, @code{typeof} and @code{inline} cannot be
                   3401: used since they won't work in a program compiled with @samp{-ansi}, while
                   3402: the keywords @code{const}, @code{volatile}, @code{signed}, @code{typeof}
                   3403: and @code{inline} won't work in a program compiled with
                   3404: @samp{-traditional}.@refill
                   3405: 
1.1.1.8   root     3406: The way to solve these problems is to put @samp{__} at the beginning and
                   3407: end of each problematical keyword.  For example, use @code{__asm__}
                   3408: instead of @code{asm}, @code{__const__} instead of @code{const}, and
                   3409: @code{__inline__} instead of @code{inline}.
1.1.1.7   root     3410: 
                   3411: Other C compilers won't accept these alternative keywords; if you want to
                   3412: compile with another compiler, you can define the alternate keywords as
                   3413: macros to replace them with the customary keywords.  It looks like this:
                   3414: 
                   3415: @example
                   3416: #ifndef __GNUC__
1.1.1.8   root     3417: #define __asm__ asm
1.1.1.7   root     3418: #endif
                   3419: @end example
                   3420: 
1.1       root     3421: @node Bugs, Portability, Extensions, Top
                   3422: @chapter Reporting Bugs
                   3423: 
                   3424: Your bug reports play an essential role in making GNU CC reliable.
                   3425: 
                   3426: Reporting a bug may help you by bringing a solution to your problem, or it
                   3427: may not.  But in any case the important function of a bug report is to help
                   3428: the entire community by making the next version of GNU CC work better.  Bug
                   3429: reports are your contribution to the maintenance of GNU CC.
                   3430: 
                   3431: In order for a bug report to serve its purpose, you must include the
                   3432: information that makes for fixing the bug.
                   3433: 
                   3434: @menu
                   3435: * Criteria:  Bug Criteria.   Have you really found a bug?
                   3436: * Reporting: Bug Reporting.  How to report a bug effectively.
                   3437: @end menu
                   3438: 
                   3439: @node Bug Criteria, Bug Reporting, Bugs, Bugs
                   3440: @section Have You Found a Bug?
                   3441: 
                   3442: If you are not sure whether you have found a bug, here are some guidelines:
                   3443: 
                   3444: @itemize @bullet
                   3445: @item
                   3446: If the compiler gets a fatal signal, for any input whatever, that is a
                   3447: compiler bug.  Reliable compilers never crash.
                   3448: 
                   3449: @item
                   3450: If the compiler produces invalid assembly code, for any input whatever
                   3451: (except an @code{asm} statement), that is a compiler bug, unless the
                   3452: compiler reports errors (not just warnings) which would ordinarily
                   3453: prevent the assembler from being run.
                   3454: 
                   3455: @item
                   3456: If the compiler produces valid assembly code that does not correctly
                   3457: execute the input source code, that is a compiler bug.
                   3458: 
                   3459: However, you must double-check to make sure, because you may have run
                   3460: into an incompatibility between GNU C and traditional C
                   3461: (@pxref{Incompatibilities}).  These incompatibilities might be considered
                   3462: bugs, but they are inescapable consequences of valuable features.
                   3463: 
                   3464: Or you may have a program whose behavior is undefined, which happened
                   3465: by chance to give the desired results with another C compiler.
                   3466: 
                   3467: For example, in many nonoptimizing compilers, you can write @samp{x;}
                   3468: at the end of a function instead of @samp{return x;}, with the same
1.1.1.8   root     3469: results.  But the value of the function is undefined if @code{return}
1.1       root     3470: is omitted; it is not a bug when GNU CC produces different results.
                   3471: 
                   3472: Problems often result from expressions with two increment operators,
1.1.1.8   root     3473: as in @code{f (*p++, *p++)}.  Your previous compiler might have
1.1       root     3474: interpreted that expression the way you intended; GNU CC might
1.1.1.8   root     3475: interpret it another way.  Neither compiler is wrong.  The bug is
                   3476: in your code.
1.1       root     3477: 
                   3478: After you have localized the error to a single source line, it should
                   3479: be easy to check for these things.  If your program is correct and
                   3480: well defined, you have found a compiler bug.
                   3481: 
                   3482: @item
                   3483: If the compiler produces an error message for valid input, that is a
                   3484: compiler bug.
                   3485: 
                   3486: Note that the following is not valid input, and the error message for
                   3487: it is not a bug:
                   3488: 
                   3489: @example
                   3490: int foo (char);
                   3491: 
                   3492: int
                   3493: foo (x)
                   3494:      char x;
                   3495: @{ @dots{} @}
                   3496: @end example
                   3497: 
                   3498: @noindent
                   3499: The prototype says to pass a @code{char}, while the definition says to
                   3500: pass an @code{int} and treat the value as a @code{char}.  This is what
                   3501: the ANSI standard says, and it makes sense.
                   3502: 
                   3503: @item
                   3504: If the compiler does not produce an error message for invalid input,
                   3505: that is a compiler bug.  However, you should note that your idea of
                   3506: ``invalid input'' might be my idea of ``an extension'' or ``support
                   3507: for traditional practice''.
                   3508: 
                   3509: @item
                   3510: If you are an experienced user of C compilers, your suggestions
                   3511: for improvement of GNU CC are welcome in any case.
                   3512: @end itemize
                   3513: 
                   3514: @node Bug Reporting,, Bug Criteria, Bugs
                   3515: @section How to Report Bugs
                   3516: 
                   3517: Send bug reports for GNU C to one of these addresses:
                   3518: 
                   3519: @example
                   3520: bug-gcc@@prep.ai.mit.edu
                   3521: @{ucbvax|mit-eddie|uunet@}!prep.ai.mit.edu!bug-gcc
                   3522: @end example
                   3523: 
1.1.1.8   root     3524: @strong{Do not send bug reports to @samp{info-gcc}, or to the newsgroup
                   3525: @samp{gnu.gcc}.} Most users of GNU CC do not want to receive bug
                   3526: reports.  Those that do, have asked to be on @samp{bug-gcc}.
                   3527: 
                   3528: The mailing list @samp{bug-gcc} has a newsgroup which serves as a
                   3529: repeater.  The mailing list and the newsgroup carry exactly the same
                   3530: messages.  Often people think of posting bug reports to the newsgroup
                   3531: instead of mailing them.  This appears to work, but it has one problem
                   3532: which can be crucial: a newsgroup posting does not contain a mail path
                   3533: back to the sender.  Thus, if I need to ask for more information, I
                   3534: may be unable to reach you.  For this reason, it is better to send bug
                   3535: reports to the mailing list.
                   3536: 
                   3537: As a last resort, send bug reports on paper to:
1.1       root     3538: 
                   3539: @example
                   3540: GNU Compiler Bugs
                   3541: 545 Tech Sq
                   3542: Cambridge, MA 02139
                   3543: @end example
                   3544: 
                   3545: The fundamental principle of reporting bugs usefully is this:
1.1.1.8   root     3546: @strong{report all the facts}.  If you are not sure whether to state a
                   3547: fact or leave it out, state it!
1.1       root     3548: 
                   3549: Often people omit facts because they think they know what causes the
                   3550: problem and they conclude that some details don't matter.  Thus, you might
                   3551: assume that the name of the variable you use in an example does not matter.
                   3552: Well, probably it doesn't, but one cannot be sure.  Perhaps the bug is a
                   3553: stray memory reference which happens to fetch from the location where that
                   3554: name is stored in memory; perhaps, if the name were different, the contents
                   3555: of that location would fool the compiler into doing the right thing despite
1.1.1.8   root     3556: the bug.  Play it safe and give a specific, complete example.  That is the
                   3557: easiest thing for you to do, and the most helpful.
1.1       root     3558: 
1.1.1.8   root     3559: Keep in mind that the purpose of a bug report is to enable me to fix
                   3560: the bug if it is not known.  It isn't very important what happens if
                   3561: the bug is already known.  Therefore, always write your bug reports on
                   3562: the assumption that the bug is not known.
                   3563: 
                   3564: Sometimes people give a few sketchy facts and ask, ``Does this ring a
                   3565: bell?''  Those bug reports are useless, and I urge everyone to
                   3566: @emph{refuse to respond to them} except to chide the sender to report
                   3567: bugs properly.
                   3568: 
                   3569: To enable me to fix the bug, you should include all these things:
1.1       root     3570: 
                   3571: @itemize @bullet
                   3572: @item
                   3573: The version of GNU CC.  You can get this by running it with the
                   3574: @samp{-v} option.
                   3575: 
                   3576: Without this, I won't know whether there is any point in looking for
                   3577: the bug in the current version of GNU CC.
                   3578: 
                   3579: @item
                   3580: A complete input file that will reproduce the bug.  If the bug is in
                   3581: the C preprocessor, send me a source file and any header files that it
                   3582: requires.  If the bug is in the compiler proper (@file{cc1}), run your
                   3583: source file through the C preprocessor by doing @samp{gcc -E
                   3584: @var{sourcefile} > @var{outfile}}, then include the contents of
                   3585: @var{outfile} in the bug report.  (Any @samp{-I}, @samp{-D} or
                   3586: @samp{-U} options that you used in actual compilation should also be
                   3587: used when doing this.)
                   3588: 
                   3589: A single statement is not enough of an example.  In order to compile
                   3590: it, it must be embedded in a function definition; and the bug might
                   3591: depend on the details of how this is done.
                   3592: 
                   3593: Without a real example I can compile, all I can do about your bug
                   3594: report is wish you luck.  It would be futile to try to guess how to
                   3595: provoke the bug.  For example, bugs in register allocation and
                   3596: reloading frequently depend on every little detail of the function
                   3597: they happen in.
                   3598: 
                   3599: @item
                   3600: The command arguments you gave GNU CC to compile that example and
                   3601: observe the bug.  For example, did you use @samp{-O}?  To guarantee
                   3602: you won't omit something important, list them all.
                   3603: 
                   3604: If I were to try to guess the arguments, I would probably guess wrong
                   3605: and then I would not encounter the bug.
                   3606: 
                   3607: @item
                   3608: The names of the files that you used for @file{tm.h} and @file{md}
                   3609: when you installed the compiler.
                   3610: 
                   3611: @item
                   3612: The type of machine you are using, and the operating system name and
                   3613: version number.
                   3614: 
                   3615: @item
                   3616: A description of what behavior you observe that you believe is
                   3617: incorrect.  For example, ``It gets a fatal signal,'' or, ``There is an
                   3618: incorrect assembler instruction in the output.''
                   3619: 
                   3620: Of course, if the bug is that the compiler gets a fatal signal, then I
                   3621: will certainly notice it.  But if the bug is incorrect output, I might
                   3622: not notice unless it is glaringly wrong.  I won't study all the
                   3623: assembler code from a 50-line C program just on the off chance that it
                   3624: might be wrong.
                   3625: 
                   3626: Even if the problem you experience is a fatal signal, you should still
                   3627: say so explicitly.  Suppose something strange is going on, such as,
                   3628: your copy of the compiler is out of synch, or you have encountered a
                   3629: bug in the C library on your system.  (This has happened!)  Your copy
                   3630: might crash and mine would not.  If you @i{told} me to expect a crash,
                   3631: then when mine fails to crash, I would know that the bug was not
                   3632: happening for me.  If you had not told me to expect a crash, then I
                   3633: would not be able to draw any conclusion from my observations.
                   3634: 
1.1.1.8   root     3635: Often the observed symptom is incorrect output when your program is run.
                   3636: Sad to say, this is not enough information for me unless the program is
                   3637: short and simple.  If you send me a large program, I don't have time to
                   3638: figure out how it would work if compiled correctly, much less which line
                   3639: of it was compiled wrong.  So you will have to do that.  Tell me which
                   3640: source line it is, and what incorrect result happens when that line is
                   3641: executed.  A person who understands the test program can find this as
                   3642: easily as a bug in the program itself.
1.1       root     3643: 
                   3644: @item
                   3645: If you send me examples of output from GNU CC, please use @samp{-g}
                   3646: when you make them.  The debugging information includes source line
                   3647: numbers which are essential for correlating the output with the input.
                   3648: 
                   3649: @item
                   3650: If you wish to suggest changes to the GNU CC source, send me context
                   3651: diffs.  If you even discuss something in the GNU CC source, refer to
                   3652: it by context, not by line number.
                   3653: 
                   3654: The line numbers in my development sources don't match those in your
                   3655: sources.  Your line numbers would convey no useful information to me.
                   3656: 
                   3657: @item
                   3658: Additional information from a debugger might enable me to find
                   3659: a problem on a machine which I do not have available myself.
                   3660: However, you need to think when you collect this information if
                   3661: you want it to have any chance of being useful.
                   3662: 
                   3663: For example, many people send just a backtrace, but that is never
                   3664: useful by itself.  A simple backtrace with arguments conveys little
                   3665: about GNU CC because the compiler is largely data-driven; the same
                   3666: functions are called over and over for different RTL insns, doing
                   3667: different things depending on the details of the insn.
                   3668: 
                   3669: Most of the arguments listed in the backtrace are useless because they
                   3670: are pointers to RTL list structure.  The numeric values of the
                   3671: pointers, which the debugger prints in the backtrace, have no
                   3672: significance whatever; all that matters is the contents of the objects
                   3673: they point to (and most of the contents are other such pointers).
                   3674: 
                   3675: In addition, most compiler passes consist of one or more loops that
                   3676: scan the RTL insn sequence.  The most vital piece of information about
1.1.1.8   root     3677: such a loop---which insn it has reached---is usually in a local variable,
1.1       root     3678: not in an argument.
                   3679: 
                   3680: What you need to provide in addition to a backtrace are the values of
                   3681: the local variables for several stack frames up.  When a local
                   3682: variable or an argument is an RTX, first print its value and then use
                   3683: the GDB command @code{pr} to print the RTL expression that it points
                   3684: to.  (If GDB doesn't run on your machine, use your debugger to call
                   3685: the function @code{debug_rtx} with the RTX as an argument.)  In
                   3686: general, whenever a variable is a pointer, its value is no use
                   3687: without the data it points to.
                   3688: 
                   3689: In addition, include a debugging dump from just before the pass
                   3690: in which the crash happens.  Most bugs involve a series of insns,
                   3691: not just one.
                   3692: @end itemize
                   3693: 
                   3694: Here are some things that are not necessary:
                   3695: 
                   3696: @itemize @bullet
                   3697: @item
                   3698: A description of the envelope of the bug.
                   3699: 
                   3700: Often people who encounter a bug spend a lot of time investigating
                   3701: which changes to the input file will make the bug go away and which
                   3702: changes will not affect it.
                   3703: 
                   3704: This is often time consuming and not very useful, because the way I
                   3705: will find the bug is by running a single example under the debugger
                   3706: with breakpoints, not by pure deduction from a series of examples.
1.1.1.8   root     3707: I recommend that you save your time for something else.
1.1       root     3708: 
                   3709: Of course, if you can find a simpler example to report @emph{instead}
                   3710: of the original one, that is a convenience for me.  Errors in the
                   3711: output will be easier to spot, running under the debugger will take
                   3712: less time, etc.  Most GNU CC bugs involve just one function, so the
                   3713: most straightforward way to simplify an example is to delete all the
                   3714: function definitions except the one where the bug occurs.  Those
                   3715: earlier in the file may be replaced by external declarations if the
1.1.1.8   root     3716: crucial function depends on them.  (Exception: inline functions may
                   3717: affect compilation of functions defined later in the file.)
1.1       root     3718: 
                   3719: However, simplification is not vital; if you don't want to do this,
1.1.1.8   root     3720: report the bug anyway and send me the entire test case you used.
1.1       root     3721: 
                   3722: @item
                   3723: A patch for the bug.
                   3724: 
                   3725: A patch for the bug does help me if it is a good one.  But don't omit
1.1.1.8   root     3726: the necessary information, such as the test case, on the assumption that
                   3727: a patch is all I need.  I might see problems with your patch and decide
                   3728: to fix the problem another way, or I might not understand it at all.
1.1       root     3729: 
                   3730: Sometimes with a program as complicated as GNU CC it is very hard to
                   3731: construct an example that will make the program follow a certain path
                   3732: through the code.  If you don't send me the example, I won't be able
                   3733: to construct one, so I won't be able to verify that the bug is fixed.
                   3734: 
1.1.1.8   root     3735: And if I can't understand what bug you are trying to fix, or why your
                   3736: patch should be an improvement, I won't install it.  A test case will
                   3737: help me to understand.
                   3738: 
1.1       root     3739: @item
                   3740: A guess about what the bug is or what it depends on.
                   3741: 
                   3742: Such guesses are usually wrong.  Even I can't guess right about such
1.1.1.8   root     3743: things without first using the debugger to find the facts.
1.1       root     3744: @end itemize
                   3745: 
                   3746: @node Portability, Interface, Bugs, Top
                   3747: @chapter GNU CC and Portability
                   3748: 
                   3749: The main goal of GNU CC was to make a good, fast compiler for machines in
                   3750: the class that the GNU system aims to run on: 32-bit machines that address
                   3751: 8-bit bytes and have several general registers.  Elegance, theoretical
                   3752: power and simplicity are only secondary.
                   3753: 
                   3754: GNU CC gets most of the information about the target machine from a machine
                   3755: description which gives an algebraic formula for each of the machine's
                   3756: instructions.  This is a very clean way to describe the target.  But when
                   3757: the compiler needs information that is difficult to express in this
                   3758: fashion, I have not hesitated to define an ad-hoc parameter to the machine
                   3759: description.  The purpose of portability is to reduce the total work needed
                   3760: on the compiler; it was not of interest for its own sake.
                   3761: 
                   3762: GNU CC does not contain machine dependent code, but it does contain code
                   3763: that depends on machine parameters such as endianness (whether the most
                   3764: significant byte has the highest or lowest address of the bytes in a word)
                   3765: and the availability of autoincrement addressing.  In the RTL-generation
                   3766: pass, it is often necessary to have multiple strategies for generating code
                   3767: for a particular kind of syntax tree, strategies that are usable for different
                   3768: combinations of parameters.  Often I have not tried to address all possible
                   3769: cases, but only the common ones or only the ones that I have encountered.
                   3770: As a result, a new target may require additional strategies.  You will know
                   3771: if this happens because the compiler will call @code{abort}.  Fortunately,
                   3772: the new strategies can be added in a machine-independent fashion, and will
                   3773: affect only the target machines that need them.
                   3774: 
                   3775: @node Interface, Passes, Portability, Top
                   3776: @chapter Interfacing to GNU CC Output
                   3777: 
                   3778: GNU CC is normally configured to use the same function calling convention
                   3779: normally in use on the target system.  This is done with the
                   3780: machine-description macros described (@pxref{Machine Macros}).
                   3781: 
                   3782: However, returning of structure and union values is done differently on
                   3783: some target machines.  As a result, functions compiled with PCC
                   3784: returning such types cannot be called from code compiled with GNU CC,
                   3785: and vice versa.  This does not cause trouble often because few Unix
                   3786: library routines return structures or unions.
                   3787: 
                   3788: GNU CC code returns structures and unions that are 1, 2, 4 or 8 bytes
                   3789: long in the same registers used for @code{int} or @code{double} return
                   3790: values.  (GNU CC typically allocates variables of such types in
                   3791: registers also.)  Structures and unions of other sizes are returned by
                   3792: storing them into an address passed by the caller (usually in a
                   3793: register).  The machine-description macros @code{STRUCT_VALUE} and
                   3794: @code{STRUCT_INCOMING_VALUE} tell GNU CC where to pass this address.
                   3795: 
                   3796: By contrast, PCC on most target machines returns structures and unions
                   3797: of any size by copying the data into an area of static storage, and then
                   3798: returning the address of that storage as if it were a pointer value.
                   3799: The caller must copy the data from that memory area to the place where
                   3800: the value is wanted.  This is slower than the method used by GNU CC, and
                   3801: fails to be reentrant.
                   3802: 
                   3803: On some target machines, such as RISC machines and the 80386, the
                   3804: standard system convention is to pass to the subroutine the address of
                   3805: where to return the value.  On these machines, GNU CC has been
                   3806: configured to be compatible with the standard compiler, when this method
                   3807: is used.  It may not be compatible for structures of 1, 2, 4 or 8 bytes.
                   3808: 
                   3809: GNU CC uses the system's standard convention for passing arguments.  On
                   3810: some machines, the first few arguments are passed in registers; in
                   3811: others, all are passed on the stack.  It would be possible to use
                   3812: registers for argument passing on any machine, and this would probably
                   3813: result in a significant speedup.  But the result would be complete
                   3814: incompatibility with code that follows the standard convention.  So this
                   3815: change is practical only if you are switching to GNU CC as the sole C
                   3816: compiler for the system.  We may implement register argument passing on
                   3817: certain machines once we have a complete GNU system so that we can
                   3818: compile the libraries with GNU CC.
                   3819: 
                   3820: If you use @code{longjmp}, beware of automatic variables.  ANSI C says that
                   3821: automatic variables that are not declared @code{volatile} have undefined
                   3822: values after a @code{longjmp}.  And this is all GNU CC promises to do,
                   3823: because it is very difficult to restore register variables correctly, and
                   3824: one of GNU CC's features is that it can put variables in registers without
                   3825: your asking it to.
                   3826: 
                   3827: If you want a variable to be unaltered by @code{longjmp}, and you don't
                   3828: want to write @code{volatile} because old C compilers don't accept it,
                   3829: just take the address of the variable.  If a variable's address is ever
                   3830: taken, even if just to compute it and ignore it, then the variable cannot
                   3831: go in a register:
                   3832: 
                   3833: @example
                   3834: @{
                   3835:   int careful;
                   3836:   &careful;
                   3837:   @dots{}
                   3838: @}
                   3839: @end example
                   3840: 
                   3841: Code compiled with GNU CC may call certain library routines.  Most of
                   3842: them handle arithmetic for which there are no instructions.  This
                   3843: includes multiply and divide on some machines, and floating point
                   3844: operations on any machine for which floating point support is disabled
                   3845: with @samp{-msoft-float}.  Some standard parts of the C library, such as
                   3846: @code{bcopy} or @code{memcpy}, are also called automatically.  The usual
                   3847: function call interface is used for calling the library routines.
                   3848: 
                   3849: These library routines should be defined in the library @file{gnulib},
                   3850: which GNU CC automatically searches whenever it links a program.  On
                   3851: machines that have multiply and divide instructions, if hardware
                   3852: floating point is in use, normally @file{gnulib} is not needed, but it
                   3853: is searched just in case.
                   3854: 
                   3855: Each arithmetic function is defined in @file{gnulib.c} to use the
                   3856: corresponding C arithmetic operator.  As long as the file is compiled
                   3857: with another C compiler, which supports all the C arithmetic operators,
                   3858: this file will work portably.  However, @file{gnulib.c} does not work if
                   3859: compiled with GNU CC, because each arithmetic function would compile
                   3860: into a call to itself!
                   3861: 
                   3862: @node Passes, RTL, Interface, Top
                   3863: @chapter Passes and Files of the Compiler
                   3864: 
                   3865: The overall control structure of the compiler is in @file{toplev.c}.  This
                   3866: file is responsible for initialization, decoding arguments, opening and
                   3867: closing files, and sequencing the passes.
                   3868: 
                   3869: The parsing pass is invoked only once, to parse the entire input.  The RTL
                   3870: intermediate code for a function is generated as the function is parsed, a
                   3871: statement at a time.  Each statement is read in as a syntax tree and then
                   3872: converted to RTL; then the storage for the tree for the statement is
                   3873: reclaimed.  Storage for types (and the expressions for their sizes),
                   3874: declarations, and a representation of the binding contours and how they nest,
                   3875: remains until the function is finished being compiled; these are all needed
                   3876: to output the debugging information.
                   3877: 
                   3878: Each time the parsing pass reads a complete function definition or
                   3879: top-level declaration, it calls the function
                   3880: @code{rest_of_compilation} or @code{rest_of_decl_compilation} in
                   3881: @file{toplev.c}, which are responsible for all further processing
                   3882: necessary, ending with output of the assembler language.  All other
                   3883: compiler passes run, in sequence, within @code{rest_of_compilation}.
                   3884: When that function returns from compiling a function definition, the
                   3885: storage used for that function definition's compilation is entirely
                   3886: freed, unless it is an inline function (@pxref{Inline}).
                   3887: 
                   3888: Here is a list of all the passes of the compiler and their source files.
                   3889: Also included is a description of where debugging dumps can be requested
                   3890: with @samp{-d} options.
                   3891: 
                   3892: @itemize @bullet
                   3893: @item
                   3894: Parsing.  This pass reads the entire text of a function definition,
                   3895: constructing partial syntax trees.  This and RTL generation are no longer
                   3896: truly separate passes (formerly they were), but it is easier to think
                   3897: of them as separate.
                   3898: 
                   3899: The tree representation does not entirely follow C syntax, because it is
                   3900: intended to support other languages as well.
                   3901: 
                   3902: C data type analysis is also done in this pass, and every tree node
                   3903: that represents an expression has a data type attached.  Variables are
                   3904: represented as declaration nodes.
                   3905: 
                   3906: Constant folding and associative-law simplifications are also done
                   3907: during this pass.
                   3908: 
                   3909: The source files for parsing are @file{c-parse.y}, @file{c-decl.c},
                   3910: @file{c-typeck.c}, @file{c-convert.c}, @file{stor-layout.c},
                   3911: @file{fold-const.c}, and @file{tree.c}.  The last three files are
                   3912: intended to be language-independent.  There are also header files
                   3913: @file{c-parse.h}, @file{c-tree.h}, @file{tree.h} and @file{tree.def}.
                   3914: The last two define the format of the tree representation.@refill
                   3915: 
                   3916: @item
                   3917: RTL generation.  This is the conversion of syntax tree into RTL code.
                   3918: It is actually done statement-by-statement during parsing, but for
                   3919: most purposes it can be thought of as a separate pass.
                   3920: 
                   3921: This is where the bulk of target-parameter-dependent code is found,
                   3922: since often it is necessary for strategies to apply only when certain
                   3923: standard kinds of instructions are available.  The purpose of named
                   3924: instruction patterns is to provide this information to the RTL
                   3925: generation pass.
                   3926: 
                   3927: Optimization is done in this pass for @code{if}-conditions that are
                   3928: comparisons, boolean operations or conditional expressions.  Tail
                   3929: recursion is detected at this time also.  Decisions are made about how
                   3930: best to arrange loops and how to output @code{switch} statements.
                   3931: 
                   3932: The source files for RTL generation are @file{stmt.c}, @file{expr.c},
                   3933: @file{explow.c}, @file{expmed.c}, @file{optabs.c} and @file{emit-rtl.c}.
                   3934: Also, the file @file{insn-emit.c}, generated from the machine description
                   3935: by the program @code{genemit}, is used in this pass.  The header files
                   3936: @file{expr.h} is used for communication within this pass.@refill
                   3937: 
                   3938: The header files @file{insn-flags.h} and @file{insn-codes.h},
                   3939: generated from the machine description by the programs @code{genflags}
                   3940: and @code{gencodes}, tell this pass which standard names are available
                   3941: for use and which patterns correspond to them.@refill
                   3942: 
                   3943: Aside from debugging information output, none of the following passes
                   3944: refers to the tree structure representation of the function (only
                   3945: part of which is saved).
                   3946: 
                   3947: The decision of whether the function can and should be expanded inline
                   3948: in its subsequent callers is made at the end of rtl generation.  The
                   3949: function must meet certain criteria, currently related to the size of
                   3950: the function and the types and number of parameters it has.  Note that
                   3951: this function may contain loops, recursive calls to itself
                   3952: (tail-recursive functions can be inlined!), gotos, in short, all
                   3953: constructs supported by GNU CC.
                   3954: 
                   3955: The option @samp{-dr} causes a debugging dump of the RTL code after
                   3956: this pass.  This dump file's name is made by appending @samp{.rtl} to
                   3957: the input file name.
                   3958: 
                   3959: @item
                   3960: Jump optimization.  This pass simplifies jumps to the following
                   3961: instruction, jumps across jumps, and jumps to jumps.  It deletes
                   3962: unreferenced labels and unreachable code, except that unreachable code
                   3963: that contains a loop is not recognized as unreachable in this pass.
                   3964: (Such loops are deleted later in the basic block analysis.)
                   3965: 
                   3966: Jump optimization is performed two or three times.  The first time is
                   3967: immediately following RTL generation.  The second time is after CSE,
                   3968: but only if CSE says repeated jump optimization is needed.  The
                   3969: last time is right before the final pass.  That time, cross-jumping
                   3970: and deletion of no-op move instructions are done together with the
                   3971: optimizations described above.
                   3972: 
                   3973: The source file of this pass is @file{jump.c}.
                   3974: 
                   3975: The option @samp{-dj} causes a debugging dump of the RTL code after
                   3976: this pass is run for the first time.  This dump file's name is made by
                   3977: appending @samp{.jump} to the input file name.
                   3978: 
                   3979: @item
                   3980: Register scan.  This pass finds the first and last use of each
                   3981: register, as a guide for common subexpression elimination.  Its source
                   3982: is in @file{regclass.c}.
                   3983: 
                   3984: @item
                   3985: Common subexpression elimination.  This pass also does constant
                   3986: propagation.  Its source file is @file{cse.c}.  If constant
                   3987: propagation causes conditional jumps to become unconditional or to
                   3988: become no-ops, jump optimization is run again when CSE is finished.
                   3989: 
                   3990: The option @samp{-ds} causes a debugging dump of the RTL code after
                   3991: this pass.  This dump file's name is made by appending @samp{.cse} to
                   3992: the input file name.
                   3993: 
                   3994: @item
1.1.1.8   root     3995: Loop optimization.  This pass moves constant expressions out of loops,
                   3996: and optionally does strength-reduction as well.  Its source file is
                   3997: @file{loop.c}.
1.1       root     3998: 
                   3999: The option @samp{-dL} causes a debugging dump of the RTL code after
                   4000: this pass.  This dump file's name is made by appending @samp{.loop} to
                   4001: the input file name.
                   4002: 
                   4003: @item
                   4004: Stupid register allocation is performed at this point in a
                   4005: nonoptimizing compilation.  It does a little data flow analysis as
                   4006: well.  When stupid register allocation is in use, the next pass
                   4007: executed is the reloading pass; the others in between are skipped.
                   4008: The source file is @file{stupid.c}.
                   4009: 
                   4010: @item
                   4011: Data flow analysis (@file{flow.c}).  This pass divides the program
                   4012: into basic blocks (and in the process deletes unreachable loops); then
                   4013: it computes which pseudo-registers are live at each point in the
                   4014: program, and makes the first instruction that uses a value point at
                   4015: the instruction that computed the value.
                   4016: 
                   4017: This pass also deletes computations whose results are never used, and
                   4018: combines memory references with add or subtract instructions to make
                   4019: autoincrement or autodecrement addressing.
                   4020: 
                   4021: The option @samp{-df} causes a debugging dump of the RTL code after
                   4022: this pass.  This dump file's name is made by appending @samp{.flow} to
                   4023: the input file name.  If stupid register allocation is in use, this
                   4024: dump file reflects the full results of such allocation.
                   4025: 
                   4026: @item
                   4027: Instruction combination (@file{combine.c}).  This pass attempts to
                   4028: combine groups of two or three instructions that are related by data
                   4029: flow into single instructions.  It combines the RTL expressions for
                   4030: the instructions by substitution, simplifies the result using algebra,
                   4031: and then attempts to match the result against the machine description.
                   4032: 
                   4033: The option @samp{-dc} causes a debugging dump of the RTL code after
                   4034: this pass.  This dump file's name is made by appending @samp{.combine}
                   4035: to the input file name.
                   4036: 
                   4037: @item
                   4038: Register class preferencing.  The RTL code is scanned to find out
                   4039: which register class is best for each pseudo register.  The source
                   4040: file is @file{regclass.c}.
                   4041: 
                   4042: @item
                   4043: Local register allocation (@file{local-alloc.c}).  This pass allocates
                   4044: hard registers to pseudo registers that are used only within one basic
                   4045: block.  Because the basic block is linear, it can use fast and
                   4046: powerful techniques to do a very good job.
                   4047: 
                   4048: The option @samp{-dl} causes a debugging dump of the RTL code after
                   4049: this pass.  This dump file's name is made by appending @samp{.lreg} to
                   4050: the input file name.
                   4051: 
                   4052: @item
                   4053: Global register allocation (@file{global-alloc.c}).  This pass
                   4054: allocates hard registers for the remaining pseudo registers (those
                   4055: whose life spans are not contained in one basic block).
                   4056: 
                   4057: @item
                   4058: Reloading.  This pass renumbers pseudo registers with the hardware
                   4059: registers numbers they were allocated.  Pseudo registers that did not
                   4060: get hard registers are replaced with stack slots.  Then it finds
                   4061: instructions that are invalid because a value has failed to end up in
                   4062: a register, or has ended up in a register of the wrong kind.  It fixes
                   4063: up these instructions by reloading the problematical values
                   4064: temporarily into registers.  Additional instructions are generated to
                   4065: do the copying.
                   4066: 
                   4067: Source files are @file{reload.c} and @file{reload1.c}, plus the header
                   4068: @file{reload.h} used for communication between them.
                   4069: 
                   4070: The option @samp{-dg} causes a debugging dump of the RTL code after
                   4071: this pass.  This dump file's name is made by appending @samp{.greg} to
                   4072: the input file name.
                   4073: 
                   4074: @item
                   4075: Jump optimization is repeated, this time including cross-jumping
1.1.1.5   root     4076: and deletion of no-op move instructions.
1.1       root     4077: 
                   4078: The option @samp{-dJ} causes a debugging dump of the RTL code after
                   4079: this pass.  This dump file's name is made by appending @samp{.jump2}
                   4080: to the input file name.
                   4081: 
                   4082: @item
1.1.1.8   root     4083: Delayed branch scheduling may be done at this point.  The source file
                   4084: name is @file{dbranch.c}.
                   4085: 
                   4086: The option @samp{-dd} causes a debugging dump of the RTL code after
                   4087: this pass.  This dump file's name is made by appending @samp{.dbr}
                   4088: to the input file name.
                   4089: 
                   4090: @item
1.1       root     4091: Final.  This pass outputs the assembler code for the function.  It is
                   4092: also responsible for identifying spurious test and compare
1.1.1.5   root     4093: instructions.  Machine-specific peephole optimizations are performed
                   4094: at the same time.  The function entry and exit sequences are generated
1.1       root     4095: directly as assembler code in this pass; they never exist as RTL.
                   4096: 
                   4097: The source files are @file{final.c} plus @file{insn-output.c}; the
                   4098: latter is generated automatically from the machine description by the
                   4099: tool @file{genoutput}.  The header file @file{conditions.h} is used
                   4100: for communication between these files.
                   4101: 
                   4102: @item
                   4103: Debugging information output.  This is run after final because it must
                   4104: output the stack slot offsets for pseudo registers that did not get
                   4105: hard registers.  Source files are @file{dbxout.c} for DBX symbol table
                   4106: format and @file{symout.c} for GDB's own symbol table format.
                   4107: @end itemize
                   4108: 
                   4109: Some additional files are used by all or many passes:
                   4110: 
                   4111: @itemize @bullet
                   4112: @item
                   4113: Every pass uses @file{machmode.def}, which defines the machine modes.
                   4114: 
                   4115: @item
                   4116: All the passes that work with RTL use the header files @file{rtl.h}
                   4117: and @file{rtl.def}, and subroutines in file @file{rtl.c}.  The tools
                   4118: @code{gen*} also use these files to read and work with the machine
                   4119: description RTL.
                   4120: 
                   4121: @item
                   4122: Several passes refer to the header file @file{insn-config.h} which
                   4123: contains a few parameters (C macro definitions) generated
                   4124: automatically from the machine description RTL by the tool
                   4125: @code{genconfig}.
                   4126: 
                   4127: @item
                   4128: Several passes use the instruction recognizer, which consists of
                   4129: @file{recog.c} and @file{recog.h}, plus the files @file{insn-recog.c}
                   4130: and @file{insn-extract.c} that are generated automatically from the
                   4131: machine description by the tools @file{genrecog} and
                   4132: @file{genextract}.@refill
                   4133: 
                   4134: @item
                   4135: Several passes use the header files @file{regs.h} which defines the
                   4136: information recorded about pseudo register usage, and @file{basic-block.h}
                   4137: which defines the information recorded about basic blocks.
                   4138: 
                   4139: @item
                   4140: @file{hard-reg-set.h} defines the type @code{HARD_REG_SET}, a bit-vector
                   4141: with a bit for each hard register, and some macros to manipulate it.
                   4142: This type is just @code{int} if the machine has few enough hard registers;
                   4143: otherwise it is an array of @code{int} and some of the macros expand
                   4144: into loops.
                   4145: @end itemize
                   4146: 
                   4147: @node RTL, Machine Desc, Passes, Top
                   4148: @chapter RTL Representation
                   4149: 
                   4150: Most of the work of the compiler is done on an intermediate representation
                   4151: called register transfer language.  In this language, the instructions to be
                   4152: output are described, pretty much one by one, in an algebraic form that
                   4153: describes what the instruction does.
                   4154: 
                   4155: RTL is inspired by Lisp lists.  It has both an internal form, made up of
                   4156: structures that point at other structures, and a textual form that is used
                   4157: in the machine description and in printed debugging dumps.  The textual
                   4158: form uses nested parentheses to indicate the pointers in the internal form.
                   4159: 
                   4160: @menu
                   4161: * RTL Objects::       Expressions vs vectors vs strings vs integers.
                   4162: * Accessors::         Macros to access expression operands or vector elts.
                   4163: * Flags::             Other flags in an RTL expression.
                   4164: * Machine Modes::     Describing the size and format of a datum.
                   4165: * Constants::         Expressions with constant values.
                   4166: * Regs and Memory::   Expressions representing register contents or memory.
                   4167: * Arithmetic::        Expressions representing arithmetic on other expressions.
                   4168: * Comparisons::       Expressions representing comparison of expressions.
                   4169: * Bit Fields::        Expressions representing bit-fields in memory or reg.
                   4170: * Conversions::       Extending, truncating, floating or fixing.
                   4171: * RTL Declarations::  Declaring volatility, constancy, etc.
                   4172: * Side Effects::      Expressions for storing in registers, etc.
                   4173: * Incdec::            Embedded side-effects for autoincrement addressing.
1.1.1.9 ! root     4174: * Assembler::         Representing @code{asm} with operands.
1.1       root     4175: * Insns::             Expression types for entire insns.
1.1.1.9 ! root     4176: * Calls::             RTL representation of function call insns.
1.1       root     4177: * Sharing::           Some expressions are unique; others *must* be copied.
                   4178: @end menu
                   4179: 
                   4180: @node RTL Objects, Accessors, RTL, RTL
                   4181: @section RTL Object Types
                   4182: 
                   4183: RTL uses four kinds of objects: expressions, integers, strings and vectors.
                   4184: Expressions are the most important ones.  An RTL expression (``RTX'', for
                   4185: short) is a C structure, but it is usually referred to with a pointer; a
                   4186: type that is given the typedef name @code{rtx}.
                   4187: 
                   4188: An integer is simply an @code{int}, and a string is a @code{char *}.
1.1.1.8   root     4189: Within RTL code, strings appear only inside @code{symbol_ref} expressions,
1.1       root     4190: but they appear in other contexts in the RTL expressions that make up
                   4191: machine descriptions.  Their written form uses decimal digits.
                   4192: 
                   4193: A string is a sequence of characters.  In core it is represented as a
                   4194: @code{char *} in usual C fashion, and it is written in C syntax as well.
                   4195: However, strings in RTL may never be null.  If you write an empty string in
                   4196: a machine description, it is represented in core as a null pointer rather
                   4197: than as a pointer to a null character.  In certain contexts, these null
                   4198: pointers instead of strings are valid.
                   4199: 
                   4200: A vector contains an arbitrary, specified number of pointers to
                   4201: expressions.  The number of elements in the vector is explicitly present in
                   4202: the vector.  The written form of a vector consists of square brackets
                   4203: (@samp{[@dots{}]}) surrounding the elements, in sequence and with
                   4204: whitespace separating them.  Vectors of length zero are not created; null
                   4205: pointers are used instead.
                   4206: 
                   4207: Expressions are classified by @dfn{expression codes} (also called RTX
                   4208: codes).  The expression code is a name defined in @file{rtl.def}, which is
                   4209: also (in upper case) a C enumeration constant.  The possible expression
                   4210: codes and their meanings are machine-independent.  The code of an RTX can
                   4211: be extracted with the macro @code{GET_CODE (@var{x})} and altered with
                   4212: @code{PUT_CODE (@var{x}, @var{newcode})}.
                   4213: 
                   4214: The expression code determines how many operands the expression contains,
                   4215: and what kinds of objects they are.  In RTL, unlike Lisp, you cannot tell
                   4216: by looking at an operand what kind of object it is.  Instead, you must know
                   4217: from its context---from the expression code of the containing expression.
1.1.1.8   root     4218: For example, in an expression of code @code{subreg}, the first operand is
1.1       root     4219: to be regarded as an expression and the second operand as an integer.  In
1.1.1.8   root     4220: an expression of code @code{plus}, there are two operands, both of which
                   4221: are to be regarded as expressions.  In a @code{symbol_ref} expression,
1.1       root     4222: there is one operand, which is to be regarded as a string.
                   4223: 
                   4224: Expressions are written as parentheses containing the name of the
                   4225: expression type, its flags and machine mode if any, and then the operands
                   4226: of the expression (separated by spaces).
                   4227: 
                   4228: Expression code names in the @samp{md} file are written in lower case,
                   4229: but when they appear in C code they are written in upper case.  In this
1.1.1.8   root     4230: manual, they are shown as follows: @code{const_int}.
1.1       root     4231: 
                   4232: In a few contexts a null pointer is valid where an expression is normally
1.1.1.4   root     4233: wanted.  The written form of this is @code{(nil)}.
1.1       root     4234: 
                   4235: @node Accessors, Flags, RTL Objects, RTL
                   4236: @section Access to Operands
                   4237: 
                   4238: For each expression type @file{rtl.def} specifies the number of contained
                   4239: objects and their kinds, with four possibilities: @samp{e} for expression
                   4240: (actually a pointer to an expression), @samp{i} for integer, @samp{s} for
                   4241: string, and @samp{E} for vector of expressions.  The sequence of letters
                   4242: for an expression code is called its @dfn{format}.  Thus, the format of
1.1.1.8   root     4243: @code{subreg} is @samp{ei}.@refill
1.1       root     4244: 
                   4245: Two other format characters are used occasionally: @samp{u} and @samp{0}.
                   4246: @samp{u} is equivalent to @samp{e} except that it is printed differently in
                   4247: debugging dumps, and @samp{0} means a slot whose contents do not fit any
                   4248: normal category.  @samp{0} slots are not printed at all in dumps, and are
                   4249: often used in special ways by small parts of the compiler.@refill
                   4250: 
                   4251: There are macros to get the number of operands and the format of an
                   4252: expression code:
                   4253: 
                   4254: @table @code
                   4255: @item GET_RTX_LENGTH (@var{code})
                   4256: Number of operands of an RTX of code @var{code}.
                   4257: 
                   4258: @item GET_RTX_FORMAT (@var{code})
                   4259: The format of an RTX of code @var{code}, as a C string.
                   4260: @end table
                   4261: 
                   4262: Operands of expressions are accessed using the macros @code{XEXP},
                   4263: @code{XINT} and @code{XSTR}.  Each of these macros takes two arguments: an
                   4264: expression-pointer (RTX) and an operand number (counting from zero).
                   4265: Thus,@refill
                   4266: 
                   4267: @example
                   4268: XEXP (@var{x}, 2)
                   4269: @end example
                   4270: 
                   4271: @noindent
                   4272: accesses operand 2 of expression @var{x}, as an expression.
                   4273: 
                   4274: @example
                   4275: XINT (@var{x}, 2)
                   4276: @end example
                   4277: 
                   4278: @noindent
                   4279: accesses the same operand as an integer.  @code{XSTR}, used in the same
                   4280: fashion, would access it as a string.
                   4281: 
                   4282: Any operand can be accessed as an integer, as an expression or as a string.
                   4283: You must choose the correct method of access for the kind of value actually
                   4284: stored in the operand.  You would do this based on the expression code of
                   4285: the containing expression.  That is also how you would know how many
                   4286: operands there are.
                   4287: 
1.1.1.8   root     4288: For example, if @var{x} is a @code{subreg} expression, you know that it has
1.1       root     4289: two operands which can be correctly accessed as @code{XEXP (@var{x}, 0)}
                   4290: and @code{XINT (@var{x}, 1)}.  If you did @code{XINT (@var{x}, 0)}, you
                   4291: would get the address of the expression operand but cast as an integer;
                   4292: that might occasionally be useful, but it would be cleaner to write
                   4293: @code{(int) XEXP (@var{x}, 0)}.  @code{XEXP (@var{x}, 1)} would also
                   4294: compile without error, and would return the second, integer operand cast as
                   4295: an expression pointer, which would probably result in a crash when
                   4296: accessed.  Nothing stops you from writing @code{XEXP (@var{x}, 28)} either,
                   4297: but this will access memory past the end of the expression with
                   4298: unpredictable results.@refill
                   4299: 
                   4300: Access to operands which are vectors is more complicated.  You can use the
                   4301: macro @code{XVEC} to get the vector-pointer itself, or the macros
                   4302: @code{XVECEXP} and @code{XVECLEN} to access the elements and length of a
                   4303: vector.
                   4304: 
                   4305: @table @code
                   4306: @item XVEC (@var{exp}, @var{idx})
                   4307: Access the vector-pointer which is operand number @var{idx} in @var{exp}.
                   4308: 
                   4309: @item XVECLEN (@var{exp}, @var{idx})
                   4310: Access the length (number of elements) in the vector which is
                   4311: in operand number @var{idx} in @var{exp}.  This value is an @code{int}.
                   4312: 
                   4313: @item XVECEXP (@var{exp}, @var{idx}, @var{eltnum})
                   4314: Access element number @var{eltnum} in the vector which is
                   4315: in operand number @var{idx} in @var{exp}.  This value is an RTX.
                   4316: 
                   4317: It is up to you to make sure that @var{eltnum} is not negative
                   4318: and is less than @code{XVECLEN (@var{exp}, @var{idx})}.
                   4319: @end table
                   4320: 
                   4321: All the macros defined in this section expand into lvalues and therefore
                   4322: can be used to assign the operands, lengths and vector elements as well as
                   4323: to access them.
                   4324: 
                   4325: @node Flags, Machine Modes, Accessors, RTL
                   4326: @section Flags in an RTL Expression
                   4327: 
                   4328: RTL expressions contain several flags (one-bit bit-fields) that are used
                   4329: in certain types of expression.  Most often they are accessed with the
                   4330: following macros:
                   4331: 
                   4332: @table @code
                   4333: @item MEM_VOLATILE_P (@var{x})
1.1.1.8   root     4334: In @code{mem} expressions, nonzero for volatile memory references.
1.1       root     4335: Stored in the @code{volatil} field and printed as @samp{/v}.
                   4336: 
                   4337: @item MEM_IN_STRUCT_P (@var{x})
1.1.1.8   root     4338: In @code{mem} expressions, nonzero for reference to an entire
1.1       root     4339: structure, union or array, or to a component of one.  Zero for
                   4340: references to a scalar variable or through a pointer to a scalar.
                   4341: Stored in the @code{in_struct} field and printed as @samp{/s}.
                   4342: 
                   4343: @item REG_USER_VAR_P (@var{x})
1.1.1.8   root     4344: In a @code{reg}, nonzero if it corresponds to a variable present in
1.1       root     4345: the user's source code.  Zero for temporaries generated internally by
                   4346: the compiler.  Stored in the @code{volatil} field and printed as
                   4347: @samp{/v}.
                   4348: 
                   4349: @item REG_FUNCTION_VALUE_P (@var{x})
1.1.1.8   root     4350: Nonzero in a @code{reg} if it is the place in which this function's
1.1       root     4351: value is going to be returned.  (This happens only in a hard
                   4352: register.)  Stored in the @code{integrated} field and printed as
                   4353: @samp{/i}.
                   4354: 
                   4355: The same hard register may be used also for collecting the values of
                   4356: functions called by this one, but @code{REG_FUNCTION_VALUE_P} is zero
                   4357: in this kind of use.
                   4358: 
                   4359: @item RTX_UNCHANGING_P (@var{x})
1.1.1.8   root     4360: Nonzero in a @code{reg} or @code{mem} if the value is not changed
1.1       root     4361: explicitly by the current function.  (If it is a memory reference then
                   4362: it may be changed by other functions or by aliasing.)  Stored in the
                   4363: @code{unchanging} field and printed as @samp{/u}.
                   4364: 
                   4365: @item RTX_INTEGRATED_P (@var{insn})
                   4366: Nonzero in an insn if it resulted from an in-line function call.
                   4367: Stored in the @code{integrated} field and printed as @samp{/i}.  This
                   4368: may be deleted; nothing currently depends on it.
                   4369: 
                   4370: @item INSN_DELETED_P (@var{insn})
                   4371: In an insn, nonzero if the insn has been deleted.  Stored in the
                   4372: @code{volatil} field and printed as @samp{/v}.
                   4373: 
                   4374: @item CONSTANT_POOL_ADDRESS_P (@var{x})
1.1.1.8   root     4375: Nonzero in a @code{symbol_ref} if it refers to part of the current
1.1       root     4376: function's ``constants pool''.  These are addresses close to the
                   4377: beginning of the function, and GNU CC assumes they can be addressed
                   4378: directly (perhaps with the help of base registers).  Stored in the
                   4379: @code{unchanging} field and printed as @samp{/u}.
                   4380: @end table
                   4381: 
                   4382: These are the fields which the above macros refer to:
                   4383: 
                   4384: @table @code
                   4385: @item used
                   4386: This flag is used only momentarily, at the end of RTL generation for a
                   4387: function, to count the number of times an expression appears in insns.
                   4388: Expressions that appear more than once are copied, according to the
                   4389: rules for shared structure (@pxref{Sharing}).
                   4390: 
                   4391: @item volatil
1.1.1.8   root     4392: This flag is used in @code{mem} and @code{reg} expressions and in insns.
1.1       root     4393: In RTL dump files, it is printed as @samp{/v}.
                   4394: 
1.1.1.8   root     4395: In a @code{mem} expression, it is 1 if the memory reference is volatile.
1.1       root     4396: Volatile memory references may not be deleted, reordered or combined.
                   4397: 
1.1.1.8   root     4398: In a @code{reg} expression, it is 1 if the value is a user-level variable.
1.1       root     4399: 0 indicates an internal compiler temporary.
                   4400: 
                   4401: In an insn, 1 means the insn has been deleted.
                   4402: 
                   4403: @item in_struct
1.1.1.8   root     4404: This flag is used in @code{mem} expressions.  It is 1 if the memory
1.1       root     4405: datum referred to is all or part of a structure or array; 0 if it is (or
                   4406: might be) a scalar variable.  A reference through a C pointer has 0
                   4407: because the pointer might point to a scalar variable.
                   4408: 
                   4409: This information allows the compiler to determine something about possible
                   4410: cases of aliasing.
                   4411: 
                   4412: In an RTL dump, this flag is represented as @samp{/s}.
                   4413: 
                   4414: @item unchanging
1.1.1.8   root     4415: This flag is used in @code{reg} and @code{mem} expressions.  1 means
1.1       root     4416: that the value of the expression never changes (at least within the
                   4417: current function).
                   4418: 
                   4419: In an RTL dump, this flag is represented as @samp{/u}.
                   4420: 
                   4421: @item integrated
                   4422: In some kinds of expressions, including insns, this flag means the
                   4423: rtl was produced by procedure integration.
                   4424: 
1.1.1.8   root     4425: In a @code{reg} expression, this flag indicates the register
1.1       root     4426: containing the value to be returned by the current function.  On
                   4427: machines that pass parameters in registers, the same register number
                   4428: may be used for parameters as well, but this flag is not set on such
                   4429: uses.
                   4430: @end table
                   4431: 
                   4432: @node Machine Modes, Constants, Flags, RTL
                   4433: @section Machine Modes
                   4434: 
                   4435: A machine mode describes a size of data object and the representation used
                   4436: for it.  In the C code, machine modes are represented by an enumeration
                   4437: type, @code{enum machine_mode}, defined in @file{machmode.def}.  Each RTL
                   4438: expression has room for a machine mode and so do certain kinds of tree
                   4439: expressions (declarations and types, to be precise).
                   4440: 
                   4441: In debugging dumps and machine descriptions, the machine mode of an RTL
                   4442: expression is written after the expression code with a colon to separate
                   4443: them.  The letters @samp{mode} which appear at the end of each machine mode
1.1.1.8   root     4444: name are omitted.  For example, @code{(reg:SI 38)} is a @code{reg}
1.1       root     4445: expression with machine mode @code{SImode}.  If the mode is
                   4446: @code{VOIDmode}, it is not written at all.
                   4447: 
                   4448: Here is a table of machine modes.
                   4449: 
                   4450: @table @code
                   4451: @item QImode
                   4452: ``Quarter-Integer'' mode represents a single byte treated as an integer.
                   4453: 
                   4454: @item HImode
                   4455: ``Half-Integer'' mode represents a two-byte integer.
                   4456: 
1.1.1.7   root     4457: @item PSImode
                   4458: ``Partial Single Integer'' mode represents an integer which occupies
                   4459: four bytes but which doesn't really use all four.  On some machines,
                   4460: this is the right mode to use for pointers.
                   4461: 
1.1       root     4462: @item SImode
                   4463: ``Single Integer'' mode represents a four-byte integer.
                   4464: 
1.1.1.7   root     4465: @item PDImode
                   4466: ``Partial Double Integer'' mode represents an integer which occupies
                   4467: eight bytes but which doesn't really use all eight.  On some machines,
                   4468: this is the right mode to use for certain pointers.
                   4469: 
1.1       root     4470: @item DImode
                   4471: ``Double Integer'' mode represents an eight-byte integer.
                   4472: 
                   4473: @item TImode
                   4474: ``Tetra Integer'' (?) mode represents a sixteen-byte integer.
                   4475: 
                   4476: @item SFmode
                   4477: ``Single Floating'' mode represents a single-precision (four byte) floating
                   4478: point number.
                   4479: 
                   4480: @item DFmode
                   4481: ``Double Floating'' mode represents a double-precision (eight byte) floating
                   4482: point number.
                   4483: 
1.1.1.7   root     4484: @item XFmode
                   4485: ``Extended Floating'' mode represents a triple-precision (twelve byte)
                   4486: floating point number.  This mode is used for IEEE extended floating
                   4487: point.
                   4488: 
1.1       root     4489: @item TFmode
                   4490: ``Tetra Floating'' mode represents a quadruple-precision (sixteen byte)
                   4491: floating point number.
                   4492: 
                   4493: @item BLKmode
                   4494: ``Block'' mode represents values that are aggregates to which none of
                   4495: the other modes apply.  In RTL, only memory references can have this mode,
                   4496: and only if they appear in string-move or vector instructions.  On machines
                   4497: which have no such instructions, @code{BLKmode} will not appear in RTL.
                   4498: 
                   4499: @item VOIDmode
                   4500: Void mode means the absence of a mode or an unspecified mode.
1.1.1.8   root     4501: For example, RTL expressions of code @code{const_int} have mode
1.1       root     4502: @code{VOIDmode} because they can be taken to have whatever mode the context
                   4503: requires.  In debugging dumps of RTL, @code{VOIDmode} is expressed by
                   4504: the absence of any mode.
                   4505: 
                   4506: @item EPmode
                   4507: ``Entry Pointer'' mode is intended to be used for function variables in
                   4508: Pascal and other block structured languages.  Such values contain
                   4509: both a function address and a static chain pointer for access to
                   4510: automatic variables of outer levels.  This mode is only partially
                   4511: implemented since C does not use it.
                   4512: 
                   4513: @item CSImode@r{, @dots{}}
                   4514: ``Complex Single Integer'' mode stands for a complex number represented
                   4515: as a pair of @code{SImode} integers.  Any of the integer and floating modes
                   4516: may have @samp{C} prefixed to its name to obtain a complex number mode.
                   4517: For example, there are @code{CQImode}, @code{CSFmode}, and @code{CDFmode}.
                   4518: Since C does not support complex numbers, these machine modes are only
                   4519: partially implemented.
                   4520: 
                   4521: @item BImode
                   4522: This is the machine mode of a bit-field in a structure.  It is used
                   4523: only in the syntax tree, never in RTL, and in the syntax tree it appears
                   4524: only in declaration nodes.  In C, it appears only in @code{FIELD_DECL}
                   4525: nodes for structure fields defined with a bit size.
                   4526: @end table
                   4527: 
                   4528: The machine description defines @code{Pmode} as a C macro which expands
                   4529: into the machine mode used for addresses.  Normally this is @code{SImode}.
                   4530: 
                   4531: The only modes which a machine description @i{must} support are
                   4532: @code{QImode}, @code{SImode}, @code{SFmode} and @code{DFmode}.  The
                   4533: compiler will attempt to use @code{DImode} for two-word structures and
1.1.1.7   root     4534: unions, but this can be prevented by overriding the definition of
                   4535: @code{MAX_FIXED_MODE_SIZE}.  Likewise, you can arrange for the C type
                   4536: @code{short int} to avoid using @code{HImode}.  In the long term it
                   4537: might be desirable to make the set of available machine modes
                   4538: machine-dependent and eliminate all assumptions about specific machine
                   4539: modes or their uses from the machine-independent code of the compiler.
1.1       root     4540: 
1.1.1.4   root     4541: To help begin this process, the machine modes are divided into mode
                   4542: classes.  These are represented by the enumeration type @code{enum
                   4543: mode_class} defined in @file{rtl.h}.  The possible mode classes are:
                   4544: 
                   4545: @table @code
                   4546: @item MODE_INT
                   4547: Integer modes.  By default these are @code{QImode}, @code{HImode},
                   4548: @code{SImode}, @code{DImode}, @code{TImode}, and also @code{BImode}.
                   4549: 
                   4550: @item MODE_FLOAT
                   4551: Floating-point modes.  By default these are @code{QFmode},
                   4552: @code{HFmode}, @code{SFmode}, @code{DFmode} and @code{TFmode}, but the
                   4553: MC68881 also defines @code{XFmode} to be an 80-bit extended-precision
                   4554: floating-point mode.
                   4555: 
                   4556: @item MODE_COMPLEX_INT
                   4557: Complex integer modes.  By default these are @code{CQImode},
                   4558: @code{CHImode}, @code{CSImode}, @code{CDImode} and @code{CTImode}.
                   4559: 
                   4560: @item MODE_COMPLEX_FLOAT
                   4561: Complex floating-point modes.  By default these are @code{CQFmode},
                   4562: @code{CHFmode}, @code{CSFmode}, @code{CDFmode} and @code{CTFmode},
                   4563: 
                   4564: @item MODE_FUNCTION
                   4565: Algol or Pascal function variables including a static chain.
                   4566: (These are not currently implemented).
                   4567: 
                   4568: @item MODE_RANDOM
                   4569: This is a catchall mode class for modes which don't fit into the above
                   4570: classes.  Currently @code{VOIDmode}, @code{BLKmode} and @code{EPmode}
                   4571: are in @code{MODE_RANDOM}.
                   4572: @end table
                   4573: 
1.1       root     4574: Here are some C macros that relate to machine modes:
                   4575: 
                   4576: @table @code
                   4577: @item GET_MODE (@var{x})
                   4578: Returns the machine mode of the RTX @var{x}.
                   4579: 
                   4580: @item PUT_MODE (@var{x}, @var{newmode})
                   4581: Alters the machine mode of the RTX @var{x} to be @var{newmode}.
                   4582: 
1.1.1.4   root     4583: @item NUM_MACHINE_MODES
                   4584: Stands for the number of machine modes available on the target
                   4585: machine.  This is one greater than the largest numeric value of any
                   4586: machine mode.
                   4587: 
                   4588: @item GET_MODE_NAME (@var{m})
                   4589: Returns the name of mode @var{m} as a string.
                   4590: 
                   4591: @item GET_MODE_CLASS (@var{m})
                   4592: Returns the mode class of mode @var{m}.
                   4593: 
1.1       root     4594: @item GET_MODE_SIZE (@var{m})
                   4595: Returns the size in bytes of a datum of mode @var{m}.
                   4596: 
                   4597: @item GET_MODE_BITSIZE (@var{m})
                   4598: Returns the size in bits of a datum of mode @var{m}.
                   4599: 
                   4600: @item GET_MODE_UNIT_SIZE (@var{m})
                   4601: Returns the size in bits of the subunits of a datum of mode @var{m}.
                   4602: This is the same as @code{GET_MODE_SIZE} except in the case of
                   4603: complex modes and @code{EPmode}.  For them, the unit size is the
                   4604: size of the real or imaginary part, or the size of the function
                   4605: pointer or the context pointer.
                   4606: @end table
                   4607: 
                   4608: @node Constants, Regs and Memory, Machine Modes, RTL
                   4609: @section Constant Expression Types
                   4610: 
                   4611: The simplest RTL expressions are those that represent constant values.
                   4612: 
                   4613: @table @code
                   4614: @item (const_int @var{i})
                   4615: This type of expression represents the integer value @var{i}.  @var{i}
                   4616: is customarily accessed with the macro @code{INTVAL} as in
                   4617: @code{INTVAL (@var{exp})}, which is equivalent to @code{XINT (@var{exp}, 0)}.
                   4618: 
                   4619: There is only one expression object for the integer value zero;
                   4620: it is the value of the variable @code{const0_rtx}.  Likewise, the
                   4621: only expression for integer value one is found in @code{const1_rtx}.
1.1.1.8   root     4622: Any attempt to create an expression of code @code{const_int} and
1.1       root     4623: value zero or one will return @code{const0_rtx} or @code{const1_rtx}
                   4624: as appropriate.
                   4625: 
                   4626: @item (const_double:@var{m} @var{i0} @var{i1})
1.1.1.6   root     4627: Represents a 64-bit constant of mode @var{m}.  All floating point
1.1       root     4628: constants are represented in this way, and so are 64-bit @code{DImode}
                   4629: integer constants.
                   4630: 
                   4631: The two integers @var{i0} and @var{i1} together contain the bits of
                   4632: the value.  If the constant is floating point (either single or double
                   4633: precision), then they represent a @code{double}.  To convert them to a
                   4634: @code{double}, do
                   4635: 
                   4636: @example
                   4637: union @{ double d; int i[2];@} u;
1.1.1.8   root     4638: u.i[0] = CONST_DOUBLE_LOW(x);
                   4639: u.i[1] = CONST_DOUBLE_HIGH(x);
1.1       root     4640: @end example
                   4641: 
                   4642: @noindent
                   4643: and then refer to @code{u.d}.
                   4644: 
                   4645: The global variables @code{dconst0_rtx} and @code{fconst0_rtx} hold
1.1.1.8   root     4646: @code{const_double} expressions with value 0, in modes @code{DFmode}
1.1.1.7   root     4647: and @code{SFmode}, respectively.  The macro @code{CONST0_RTX
1.1.1.8   root     4648: (@var{mode})} refers to a @code{const_double} expression with value 0
1.1.1.7   root     4649: in mode @var{mode}.  The mode @var{mode} must be of mode class
                   4650: @code{MODE_FLOAT}.
1.1       root     4651: 
                   4652: @item (symbol_ref @var{symbol})
                   4653: Represents the value of an assembler label for data.  @var{symbol} is
                   4654: a string that describes the name of the assembler label.  If it starts
                   4655: with a @samp{*}, the label is the rest of @var{symbol} not including
                   4656: the @samp{*}.  Otherwise, the label is @var{symbol}, prefixed with
                   4657: @samp{_}.
                   4658: 
                   4659: @item (label_ref @var{label})
                   4660: Represents the value of an assembler label for code.  It contains one
1.1.1.8   root     4661: operand, an expression, which must be a @code{code_label} that appears
1.1       root     4662: in the instruction sequence to identify the place where the label
                   4663: should go.
                   4664: 
                   4665: The reason for using a distinct expression type for code label
                   4666: references is so that jump optimization can distinguish them.
                   4667: 
                   4668: @item (const @var{exp})
                   4669: Represents a constant that is the result of an assembly-time
                   4670: arithmetic computation.  The operand, @var{exp}, is an expression that
1.1.1.8   root     4671: contains only constants (@code{const_int}, @code{symbol_ref} and
                   4672: @code{label_ref} expressions) combined with @code{plus} and
                   4673: @code{minus}.  However, not all combinations are valid, since the
1.1       root     4674: assembler cannot do arbitrary arithmetic on relocatable symbols.
                   4675: @end table
                   4676: 
                   4677: @node Regs and Memory, Arithmetic, Constants, RTL
                   4678: @section Registers and Memory
                   4679: 
                   4680: Here are the RTL expression types for describing access to machine
                   4681: registers and to main memory.
                   4682: 
                   4683: @table @code
                   4684: @item (reg:@var{m} @var{n})
                   4685: For small values of the integer @var{n} (less than
                   4686: @code{FIRST_PSEUDO_REGISTER}), this stands for a reference to machine
                   4687: register number @var{n}: a @dfn{hard register}.  For larger values of
                   4688: @var{n}, it stands for a temporary value or @dfn{pseudo register}.
                   4689: The compiler's strategy is to generate code assuming an unlimited
                   4690: number of such pseudo registers, and later convert them into hard
                   4691: registers or into memory references.
                   4692: 
                   4693: The symbol @code{FIRST_PSEUDO_REGISTER} is defined by the machine
                   4694: description, since the number of hard registers on the machine is an
                   4695: invariant characteristic of the machine.  Note, however, that not
                   4696: all of the machine registers must be general registers.  All the
                   4697: machine registers that can be used for storage of data are given
                   4698: hard register numbers, even those that can be used only in certain
                   4699: instructions or can hold only certain types of data.
                   4700: 
                   4701: Each pseudo register number used in a function's RTL code is
1.1.1.8   root     4702: represented by a unique @code{reg} expression.
1.1       root     4703: 
                   4704: @var{m} is the machine mode of the reference.  It is necessary because
                   4705: machines can generally refer to each register in more than one mode.
                   4706: For example, a register may contain a full word but there may be
                   4707: instructions to refer to it as a half word or as a single byte, as
                   4708: well as instructions to refer to it as a floating point number of
                   4709: various precisions.
                   4710: 
                   4711: Even for a register that the machine can access in only one mode,
                   4712: the mode must always be specified.
                   4713: 
                   4714: A hard register may be accessed in various modes throughout one
                   4715: function, but each pseudo register is given a natural mode
                   4716: and is accessed only in that mode.  When it is necessary to describe
1.1.1.8   root     4717: an access to a pseudo register using a nonnatural mode, a @code{subreg}
1.1       root     4718: expression is used.
                   4719: 
1.1.1.8   root     4720: A @code{reg} expression with a machine mode that specifies more than
1.1       root     4721: one word of data may actually stand for several consecutive registers.
                   4722: If in addition the register number specifies a hardware register, then
                   4723: it actually represents several consecutive hardware registers starting
                   4724: with the specified one.
                   4725: 
1.1.1.8   root     4726: Such multi-word hardware register @code{reg} expressions must not be live
1.1       root     4727: across the boundary of a basic block.  The lifetime analysis pass does not
                   4728: know how to record properly that several consecutive registers are
                   4729: actually live there, and therefore register allocation would be confused.
                   4730: The CSE pass must go out of its way to make sure the situation does
                   4731: not arise.
                   4732: 
                   4733: @item (subreg:@var{m} @var{reg} @var{wordnum})
1.1.1.8   root     4734: @code{subreg} expressions are used to refer to a register in a machine
1.1       root     4735: mode other than its natural one, or to refer to one register of
1.1.1.8   root     4736: a multi-word @code{reg} that actually refers to several registers.
1.1       root     4737: 
                   4738: Each pseudo-register has a natural mode.  If it is necessary to
                   4739: operate on it in a different mode---for example, to perform a fullword
1.1.1.8   root     4740: move instruction on a pseudo-register that contains a single
                   4741: byte---the pseudo-register must be enclosed in a @code{subreg}.  In
                   4742: such a case, @var{wordnum} is zero.
1.1       root     4743: 
1.1.1.8   root     4744: The other use of @code{subreg} is to extract the individual registers
1.1       root     4745: of a multi-register value.  Machine modes such as @code{DImode} and
                   4746: @code{EPmode} indicate values longer than a word, values which usually
                   4747: require two consecutive registers.  To access one of the registers,
1.1.1.8   root     4748: use a @code{subreg} with mode @code{SImode} and a @var{wordnum} that
1.1       root     4749: says which register.
                   4750: 
                   4751: The compilation parameter @code{WORDS_BIG_ENDIAN}, if defined, says
                   4752: that word number zero is the most significant part; otherwise, it is
                   4753: the least significant part.
                   4754: 
                   4755: Between the combiner pass and the reload pass, it is possible to have
1.1.1.8   root     4756: a @code{subreg} which contains a @code{mem} instead of a @code{reg} as
1.1       root     4757: its first operand.  The reload pass eliminates these cases by
1.1.1.8   root     4758: reloading the @code{mem} into a suitable register.
1.1       root     4759: 
                   4760: Note that it is not valid to access a @code{DFmode} value in @code{SFmode}
1.1.1.8   root     4761: using a @code{subreg}.  On some machines the most significant part of a
1.1       root     4762: @code{DFmode} value does not have the same format as a single-precision
                   4763: floating value.
                   4764: 
                   4765: @item (cc0)
                   4766: This refers to the machine's condition code register.  It has no
                   4767: operands and may not have a machine mode.  It may be validly used in
                   4768: only two contexts: as the destination of an assignment (in test and
                   4769: compare instructions) and in comparison operators comparing against
1.1.1.8   root     4770: zero (@code{const_int} with value zero; that is to say,
1.1       root     4771: @code{const0_rtx}).
                   4772: 
1.1.1.8   root     4773: There is only one expression object of code @code{cc0}; it is the
1.1       root     4774: value of the variable @code{cc0_rtx}.  Any attempt to create an
1.1.1.8   root     4775: expression of code @code{cc0} will return @code{cc0_rtx}.
1.1       root     4776: 
                   4777: One special thing about the condition code register is that
                   4778: instructions can set it implicitly.  On many machines, nearly all
                   4779: instructions set the condition code based on the value that they
                   4780: compute or store.  It is not necessary to record these actions
                   4781: explicitly in the RTL because the machine description includes a
                   4782: prescription for recognizing the instructions that do so (by means of
                   4783: the macro @code{NOTICE_UPDATE_CC}).  Only instructions whose sole
                   4784: purpose is to set the condition code, and instructions that use the
                   4785: condition code, need mention @code{(cc0)}.
                   4786: 
                   4787: @item (pc)
                   4788: This represents the machine's program counter.  It has no operands and
                   4789: may not have a machine mode.  @code{(pc)} may be validly used only in
                   4790: certain specific contexts in jump instructions.
                   4791: 
1.1.1.8   root     4792: There is only one expression object of code @code{pc}; it is the value
1.1       root     4793: of the variable @code{pc_rtx}.  Any attempt to create an expression of
1.1.1.8   root     4794: code @code{pc} will return @code{pc_rtx}.
1.1       root     4795: 
                   4796: All instructions that do not jump alter the program counter implicitly
                   4797: by incrementing it, but there is no need to mention this in the RTL.
                   4798: 
                   4799: @item (mem:@var{m} @var{addr})
                   4800: This RTX represents a reference to main memory at an address
                   4801: represented by the expression @var{addr}.  @var{m} specifies how large
                   4802: a unit of memory is accessed.
                   4803: @end table
                   4804: 
                   4805: @node Arithmetic, Comparisons, Regs and Memory, RTL
                   4806: @section RTL Expressions for Arithmetic
                   4807: 
                   4808: @table @code
                   4809: @item (plus:@var{m} @var{x} @var{y})
                   4810: Represents the sum of the values represented by @var{x} and @var{y}
                   4811: carried out in machine mode @var{m}.  This is valid only if
                   4812: @var{x} and @var{y} both are valid for mode @var{m}.
                   4813: 
                   4814: @item (minus:@var{m} @var{x} @var{y})
1.1.1.8   root     4815: Like @code{plus} but represents subtraction.
1.1       root     4816: 
1.1.1.6   root     4817: @item (compare @var{x} @var{y})
1.1       root     4818: Represents the result of subtracting @var{y} from @var{x}
                   4819: for purposes of comparison.  The absence of a machine mode
1.1.1.8   root     4820: in the @code{compare} expression indicates that the result is
1.1       root     4821: computed without overflow, as if with infinite precision.
                   4822: 
                   4823: Of course, machines can't really subtract with infinite precision.
                   4824: However, they can pretend to do so when only the sign of the
                   4825: result will be used, which is the case when the result is stored
                   4826: in @code{(cc0)}.  And that is the only way this kind of expression
                   4827: may validly be used: as a value to be stored in the condition codes.
                   4828: 
                   4829: @item (neg:@var{m} @var{x})
                   4830: Represents the negation (subtraction from zero) of the value
                   4831: represented by @var{x}, carried out in mode @var{m}.  @var{x} must be
                   4832: valid for mode @var{m}.
                   4833: 
                   4834: @item (mult:@var{m} @var{x} @var{y})
                   4835: Represents the signed product of the values represented by @var{x} and
                   4836: @var{y} carried out in machine mode @var{m}.  If
                   4837: @var{x} and @var{y} are both valid for mode @var{m}, this is ordinary
                   4838: size-preserving multiplication.  Alternatively, both @var{x} and @var{y}
                   4839: may be valid for a different, narrower mode.  This represents the
                   4840: kind of multiplication that generates a product wider than the operands.
                   4841: Widening multiplication and same-size multiplication are completely
                   4842: distinct and supported by different machine instructions; machines may
                   4843: support one but not the other.@refill
                   4844: 
1.1.1.8   root     4845: @code{mult} may be used for floating point multiplication as well.
1.1       root     4846: Then @var{m} is a floating point machine mode.
                   4847: 
                   4848: @item (umult:@var{m} @var{x} @var{y})
1.1.1.8   root     4849: Like @code{mult} but represents unsigned multiplication.  It may be
                   4850: used in both same-size and widening forms, like @code{mult}.
                   4851: @code{umult} is used only for fixed-point multiplication.
1.1       root     4852: 
                   4853: @item (div:@var{m} @var{x} @var{y})
                   4854: Represents the quotient in signed division of @var{x} by @var{y},
                   4855: carried out in machine mode @var{m}.  If @var{m} is a floating-point
                   4856: mode, it represents the exact quotient; otherwise, the integerized
                   4857: quotient.  If @var{x} and @var{y} are both valid for mode @var{m},
                   4858: this is ordinary size-preserving division.  Some machines have
                   4859: division instructions in which the operands and quotient widths are
1.1.1.8   root     4860: not all the same; such instructions are represented by @code{div}
1.1       root     4861: expressions in which the machine modes are not all the same.
                   4862: 
                   4863: @item (udiv:@var{m} @var{x} @var{y})
1.1.1.8   root     4864: Like @code{div} but represents unsigned division.
1.1       root     4865: 
                   4866: @item (mod:@var{m} @var{x} @var{y})
                   4867: @itemx (umod:@var{m} @var{x} @var{y})
1.1.1.8   root     4868: Like @code{div} and @code{udiv} but represent the remainder instead of
1.1       root     4869: the quotient.
                   4870: 
                   4871: @item (not:@var{m} @var{x})
                   4872: Represents the bitwise complement of the value represented by @var{x},
                   4873: carried out in mode @var{m}, which must be a fixed-point machine mode.
                   4874: @var{x} must be valid for mode @var{m}, which must be a fixed-point mode.
                   4875: 
                   4876: @item (and:@var{m} @var{x} @var{y})
                   4877: Represents the bitwise logical-and of the values represented by
                   4878: @var{x} and @var{y}, carried out in machine mode @var{m}.  This is
                   4879: valid only if @var{x} and @var{y} both are valid for mode @var{m},
                   4880: which must be a fixed-point mode.
                   4881: 
                   4882: @item (ior:@var{m} @var{x} @var{y})
                   4883: Represents the bitwise inclusive-or of the values represented by
                   4884: @var{x} and @var{y}, carried out in machine mode @var{m}.  This is
                   4885: valid only if @var{x} and @var{y} both are valid for mode @var{m},
                   4886: which must be a fixed-point mode.
                   4887: 
                   4888: @item (xor:@var{m} @var{x} @var{y})
                   4889: Represents the bitwise exclusive-or of the values represented by
                   4890: @var{x} and @var{y}, carried out in machine mode @var{m}.  This is
                   4891: valid only if @var{x} and @var{y} both are valid for mode @var{m},
                   4892: which must be a fixed-point mode.
                   4893: 
                   4894: @item (lshift:@var{m} @var{x} @var{c})
                   4895: Represents the result of logically shifting @var{x} left by @var{c}
                   4896: places.  @var{x} must be valid for the mode @var{m}, a fixed-point
                   4897: machine mode.  @var{c} must be valid for a fixed-point mode;
                   4898: which mode is determined by the mode called for in the machine
                   4899: description entry for the left-shift instruction.  For example,
                   4900: on the Vax, the mode of @var{c} is @code{QImode} regardless of @var{m}.
                   4901: 
                   4902: On some machines, negative values of @var{c} may be meaningful; this
                   4903: is why logical left shift and arithmetic left shift are distinguished.
                   4904: For example, Vaxes have no right-shift instructions, and right shifts
                   4905: are represented as left-shift instructions whose counts happen
                   4906: to be negative constants or else computed (in a previous instruction)
                   4907: by negation.
                   4908: 
                   4909: @item (ashift:@var{m} @var{x} @var{c})
1.1.1.8   root     4910: Like @code{lshift} but for arithmetic left shift.
1.1       root     4911: 
                   4912: @item (lshiftrt:@var{m} @var{x} @var{c})
                   4913: @itemx (ashiftrt:@var{m} @var{x} @var{c})
1.1.1.8   root     4914: Like @code{lshift} and @code{ashift} but for right shift.
1.1       root     4915: 
                   4916: @item (rotate:@var{m} @var{x} @var{c})
                   4917: @itemx (rotatert:@var{m} @var{x} @var{c})
                   4918: Similar but represent left and right rotate.
                   4919: 
                   4920: @item (abs:@var{m} @var{x})
                   4921: Represents the absolute value of @var{x}, computed in mode @var{m}.
                   4922: @var{x} must be valid for @var{m}.
                   4923: 
                   4924: @item (sqrt:@var{m} @var{x})
                   4925: Represents the square root of @var{x}, computed in mode @var{m}.
                   4926: @var{x} must be valid for @var{m}.  Most often @var{m} will be
                   4927: a floating point mode.
                   4928: 
                   4929: @item (ffs:@var{m} @var{x})
                   4930: Represents the one plus the index of the least significant 1-bit in
                   4931: @var{x}, represented as an integer of mode @var{m}.  (The value is
                   4932: zero if @var{x} is zero.)  The mode of @var{x} need not be @var{m};
                   4933: depending on the target machine, various mode combinations may be
                   4934: valid.
                   4935: @end table
                   4936: 
                   4937: @node Comparisons, Bit Fields, Arithmetic, RTL
                   4938: @section Comparison Operations
                   4939: 
                   4940: Comparison operators test a relation on two operands and are considered to
                   4941: represent the value 1 if the relation holds, or zero if it does not.  The
                   4942: mode of the comparison is determined by the operands; they must both be
                   4943: valid for a common machine mode.  A comparison with both operands constant
                   4944: would be invalid as the machine mode could not be deduced from it, but such
                   4945: a comparison should never exist in RTL due to constant folding.
                   4946: 
                   4947: Inequality comparisons come in two flavors, signed and unsigned.  Thus,
1.1.1.8   root     4948: there are distinct expression codes @code{gt} and @code{gtu} for signed and
1.1       root     4949: unsigned greater-than.  These can produce different results for the same
                   4950: pair of integer values: for example, 1 is signed greater-than -1 but not
                   4951: unsigned greater-than, because -1 when regarded as unsigned is actually
                   4952: @code{0xffffffff} which is greater than 1.
                   4953: 
                   4954: The signed comparisons are also used for floating point values.  Floating
                   4955: point comparisons are distinguished by the machine modes of the operands.
                   4956: 
                   4957: The comparison operators may be used to compare the condition codes
                   4958: @code{(cc0)} against zero, as in @code{(eq (cc0) (const_int 0))}.  Such a
                   4959: construct actually refers to the result of the preceding instruction in
                   4960: which the condition codes were set.  The above example stands for 1 if the
                   4961: condition codes were set to say ``zero'' or ``equal'', 0 otherwise.
                   4962: Although the same comparison operators are used for this as may be used in
                   4963: other contexts on actual data, no confusion can result since the machine
                   4964: description would never allow both kinds of uses in the same context.
                   4965: 
                   4966: @table @code
                   4967: @item (eq @var{x} @var{y})
                   4968: 1 if the values represented by @var{x} and @var{y} are equal,
                   4969: otherwise 0.
                   4970: 
                   4971: @item (ne @var{x} @var{y})
                   4972: 1 if the values represented by @var{x} and @var{y} are not equal,
                   4973: otherwise 0.
                   4974: 
                   4975: @item (gt @var{x} @var{y})
                   4976: 1 if the @var{x} is greater than @var{y}.  If they are fixed-point,
                   4977: the comparison is done in a signed sense.
                   4978: 
                   4979: @item (gtu @var{x} @var{y})
1.1.1.8   root     4980: Like @code{gt} but does unsigned comparison, on fixed-point numbers only.
1.1       root     4981: 
                   4982: @item (lt @var{x} @var{y})
                   4983: @item (ltu @var{x} @var{y})
1.1.1.8   root     4984: Like @code{gt} and @code{gtu} but test for ``less than''.
1.1       root     4985: 
                   4986: @item (ge @var{x} @var{y})
                   4987: @item (geu @var{x} @var{y})
1.1.1.8   root     4988: Like @code{gt} and @code{gtu} but test for ``greater than or equal''.
1.1       root     4989: 
                   4990: @item (le @var{x} @var{y})
                   4991: @item (leu @var{x} @var{y})
1.1.1.8   root     4992: Like @code{gt} and @code{gtu} but test for ``less than or equal''.
1.1       root     4993: 
                   4994: @item (if_then_else @var{cond} @var{then} @var{else})
                   4995: This is not a comparison operation but is listed here because it is
                   4996: always used in conjunction with a comparison operation.  To be
                   4997: precise, @var{cond} is a comparison expression.  This expression
                   4998: represents a choice, according to @var{cond}, between the value
                   4999: represented by @var{then} and the one represented by @var{else}.
                   5000: 
1.1.1.8   root     5001: On most machines, @code{if_then_else} expressions are valid only
1.1       root     5002: to express conditional jumps.
                   5003: @end table
                   5004: 
                   5005: @node Bit Fields, Conversions, Comparisons, RTL
                   5006: @section Bit-fields
                   5007: 
                   5008: Special expression codes exist to represent bit-field instructions.
                   5009: These types of expressions are lvalues in RTL; they may appear
                   5010: on the left side of a assignment, indicating insertion of a value
                   5011: into the specified bit field.
                   5012: 
                   5013: @table @code
                   5014: @item (sign_extract:SI @var{loc} @var{size} @var{pos})
                   5015: This represents a reference to a sign-extended bit-field contained or
                   5016: starting in @var{loc} (a memory or register reference).  The bit field
                   5017: is @var{size} bits wide and starts at bit @var{pos}.  The compilation
                   5018: option @code{BITS_BIG_ENDIAN} says which end of the memory unit
                   5019: @var{pos} counts from.
                   5020: 
                   5021: Which machine modes are valid for @var{loc} depends on the machine,
                   5022: but typically @var{loc} should be a single byte when in memory
                   5023: or a full word in a register.
                   5024: 
                   5025: @item (zero_extract:SI @var{loc} @var{size} @var{pos})
1.1.1.8   root     5026: Like @code{sign_extract} but refers to an unsigned or zero-extended
1.1       root     5027: bit field.  The same sequence of bits are extracted, but they
                   5028: are filled to an entire word with zeros instead of by sign-extension.
                   5029: @end table
                   5030: 
                   5031: @node Conversions, RTL Declarations, Bit Fields, RTL
                   5032: @section Conversions
                   5033: 
                   5034: All conversions between machine modes must be represented by
                   5035: explicit conversion operations.  For example, an expression
                   5036: which is the sum of a byte and a full word cannot be written as
1.1.1.8   root     5037: @code{(plus:SI (reg:QI 34) (reg:SI 80))} because the @code{plus}
1.1       root     5038: operation requires two operands of the same machine mode.
                   5039: Therefore, the byte-sized operand is enclosed in a conversion
                   5040: operation, as in
                   5041: 
                   5042: @example
                   5043: (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
                   5044: @end example
                   5045: 
                   5046: The conversion operation is not a mere placeholder, because there
                   5047: may be more than one way of converting from a given starting mode
                   5048: to the desired final mode.  The conversion operation code says how
                   5049: to do it.
                   5050: 
                   5051: @table @code
                   5052: @item (sign_extend:@var{m} @var{x})
                   5053: Represents the result of sign-extending the value @var{x}
                   5054: to machine mode @var{m}.  @var{m} must be a fixed-point mode
                   5055: and @var{x} a fixed-point value of a mode narrower than @var{m}.
                   5056: 
                   5057: @item (zero_extend:@var{m} @var{x})
                   5058: Represents the result of zero-extending the value @var{x}
                   5059: to machine mode @var{m}.  @var{m} must be a fixed-point mode
                   5060: and @var{x} a fixed-point value of a mode narrower than @var{m}.
                   5061: 
                   5062: @item (float_extend:@var{m} @var{x})
                   5063: Represents the result of extending the value @var{x}
                   5064: to machine mode @var{m}.  @var{m} must be a floating point mode
                   5065: and @var{x} a floating point value of a mode narrower than @var{m}.
                   5066: 
                   5067: @item (truncate:@var{m} @var{x})
                   5068: Represents the result of truncating the value @var{x}
                   5069: to machine mode @var{m}.  @var{m} must be a fixed-point mode
                   5070: and @var{x} a fixed-point value of a mode wider than @var{m}.
                   5071: 
                   5072: @item (float_truncate:@var{m} @var{x})
                   5073: Represents the result of truncating the value @var{x}
                   5074: to machine mode @var{m}.  @var{m} must be a floating point mode
                   5075: and @var{x} a floating point value of a mode wider than @var{m}.
                   5076: 
                   5077: @item (float:@var{m} @var{x})
                   5078: Represents the result of converting fixed point value @var{x},
                   5079: regarded as signed, to floating point mode @var{m}.
                   5080: 
                   5081: @item (unsigned_float:@var{m} @var{x})
                   5082: Represents the result of converting fixed point value @var{x},
                   5083: regarded as unsigned, to floating point mode @var{m}.
                   5084: 
                   5085: @item (fix:@var{m} @var{x})
                   5086: When @var{m} is a fixed point mode, represents the result of
                   5087: converting floating point value @var{x} to mode @var{m}, regarded as
                   5088: signed.  How rounding is done is not specified, so this operation may
                   5089: be used validly in compiling C code only for integer-valued operands.
                   5090: 
                   5091: @item (unsigned_fix:@var{m} @var{x})
                   5092: Represents the result of converting floating point value @var{x} to
                   5093: fixed point mode @var{m}, regarded as unsigned.  How rounding is done
                   5094: is not specified.
                   5095: 
                   5096: @item (fix:@var{m} @var{x})
                   5097: When @var{m} is a floating point mode, represents the result of
                   5098: converting floating point value @var{x} (valid for mode @var{m}) to an
                   5099: integer, still represented in floating point mode @var{m}, by rounding
                   5100: towards zero.
                   5101: @end table
                   5102: 
                   5103: @node RTL Declarations, Side Effects, Conversions, RTL
                   5104: @section Declarations
                   5105: 
                   5106: Declaration expression codes do not represent arithmetic operations
                   5107: but rather state assertions about their operands.
                   5108: 
                   5109: @table @code
                   5110: @item (strict_low_part (subreg:@var{m} (reg:@var{n} @var{r}) 0))
                   5111: This expression code is used in only one context: operand 0 of a
1.1.1.8   root     5112: @code{set} expression.  In addition, the operand of this expression
                   5113: must be a @code{subreg} expression.
1.1       root     5114: 
1.1.1.8   root     5115: The presence of @code{strict_low_part} says that the part of the
1.1       root     5116: register which is meaningful in mode @var{n}, but is not part of
                   5117: mode @var{m}, is not to be altered.  Normally, an assignment to such
                   5118: a subreg is allowed to have undefined effects on the rest of the
                   5119: register when @var{m} is less than a word.
                   5120: @end table
                   5121: 
                   5122: @node Side Effects, Incdec, RTL Declarations, RTL
                   5123: @section Side Effect Expressions
                   5124: 
                   5125: The expression codes described so far represent values, not actions.
                   5126: But machine instructions never produce values; they are meaningful
                   5127: only for their side effects on the state of the machine.  Special
                   5128: expression codes are used to represent side effects.
                   5129: 
                   5130: The body of an instruction is always one of these side effect codes;
                   5131: the codes described above, which represent values, appear only as
                   5132: the operands of these.
                   5133: 
                   5134: @table @code
                   5135: @item (set @var{lval} @var{x})
                   5136: Represents the action of storing the value of @var{x} into the place
                   5137: represented by @var{lval}.  @var{lval} must be an expression
1.1.1.8   root     5138: representing a place that can be stored in: @code{reg} (or
                   5139: @code{subreg} or @code{strict_low_part}), @code{mem}, @code{pc} or
                   5140: @code{cc0}.@refill
1.1       root     5141: 
1.1.1.8   root     5142: If @var{lval} is a @code{reg}, @code{subreg} or @code{mem}, it has a
1.1       root     5143: machine mode; then @var{x} must be valid for that mode.@refill
                   5144: 
1.1.1.8   root     5145: If @var{lval} is a @code{reg} whose machine mode is less than the full
1.1       root     5146: width of the register, then it means that the part of the register
                   5147: specified by the machine mode is given the specified value and the
                   5148: rest of the register receives an undefined value.  Likewise, if
1.1.1.8   root     5149: @var{lval} is a @code{subreg} whose machine mode is narrower than
1.1       root     5150: @code{SImode}, the rest of the register can be changed in an undefined way.
                   5151: 
1.1.1.8   root     5152: If @var{lval} is a @code{strict_low_part} of a @code{subreg}, then the
1.1       root     5153: part of the register specified by the machine mode of the
1.1.1.8   root     5154: @code{subreg} is given the value @var{x} and the rest of the register
1.1       root     5155: is not changed.@refill
                   5156: 
                   5157: If @var{lval} is @code{(cc0)}, it has no machine mode, and @var{x} may
                   5158: have any mode.  This represents a ``test'' or ``compare'' instruction.@refill
                   5159: 
                   5160: If @var{lval} is @code{(pc)}, we have a jump instruction, and the
                   5161: possibilities for @var{x} are very limited.  It may be a
1.1.1.8   root     5162: @code{label_ref} expression (unconditional jump).  It may be an
                   5163: @code{if_then_else} (conditional jump), in which case either the
1.1       root     5164: second or the third operand must be @code{(pc)} (for the case which
1.1.1.8   root     5165: does not jump) and the other of the two must be a @code{label_ref}
                   5166: (for the case which does jump).  @var{x} may also be a @code{mem} or
                   5167: @code{(plus:SI (pc) @var{y})}, where @var{y} may be a @code{reg} or a
                   5168: @code{mem}; these unusual patterns are used to represent jumps through
1.1       root     5169: branch tables.@refill
                   5170: 
                   5171: @item (return)
                   5172: Represents a return from the current function, on machines where this
                   5173: can be done with one instruction, such as Vaxes.  On machines where a
                   5174: multi-instruction ``epilogue'' must be executed in order to return
                   5175: from the function, returning is done by jumping to a label which
1.1.1.8   root     5176: precedes the epilogue, and the @code{return} expression code is never
1.1       root     5177: used.
                   5178: 
                   5179: @item (call @var{function} @var{nargs})
1.1.1.8   root     5180: Represents a function call.  @var{function} is a @code{mem} expression
1.1       root     5181: whose address is the address of the function to be called.
                   5182: @var{nargs} is an expression which can be used for two purposes: on
                   5183: some machines it represents the number of bytes of stack argument; on
                   5184: others, it represents the number of argument registers.
                   5185: 
                   5186: Each machine has a standard machine mode which @var{function} must
                   5187: have.  The machine description defines macro @code{FUNCTION_MODE} to
                   5188: expand into the requisite mode name.  The purpose of this mode is to
                   5189: specify what kind of addressing is allowed, on machines where the
                   5190: allowed kinds of addressing depend on the machine mode being
                   5191: addressed.
                   5192: 
                   5193: @item (clobber @var{x})
                   5194: Represents the storing or possible storing of an unpredictable,
1.1.1.8   root     5195: undescribed value into @var{x}, which must be a @code{reg} or
                   5196: @code{mem} expression.
1.1       root     5197: 
                   5198: One place this is used is in string instructions that store standard
                   5199: values into particular hard registers.  It may not be worth the
                   5200: trouble to describe the values that are stored, but it is essential to
                   5201: inform the compiler that the registers will be altered, lest it
                   5202: attempt to keep data in them across the string instruction.
                   5203: 
                   5204: @var{x} may also be null---a null C pointer, no expression at all.
                   5205: Such a @code{(clobber (null))} expression means that all memory
                   5206: locations must be presumed clobbered.
                   5207: 
                   5208: Note that the machine description classifies certain hard registers as
                   5209: ``call-clobbered''.  All function call instructions are assumed by
                   5210: default to clobber these registers, so there is no need to use
1.1.1.8   root     5211: @code{clobber} expressions to indicate this fact.  Also, each function
1.1.1.6   root     5212: call is assumed to have the potential to alter any memory location,
                   5213: unless the function is declared @code{const}.
1.1       root     5214: 
1.1.1.8   root     5215: When a @code{clobber} expression for a register appears inside a
                   5216: @code{parallel} with other side effects, GNU CC guarantees that the
1.1.1.4   root     5217: register is unoccupied both before and after that insn.  Therefore, it
                   5218: is safe for the assembler code produced by the insn to use the
                   5219: register as a temporary.  You can clobber either a specific hard
                   5220: register or a pseudo register; in the latter case, GNU CC will
                   5221: allocate a hard register that is available there for use as a
                   5222: temporary.
                   5223: 
1.1.1.8   root     5224: If you clobber a pseudo register in this way, use a pseudo register
                   5225: which appears nowhere else---generate a new one each time.  Otherwise,
                   5226: you may confuse CSE.
                   5227: 
                   5228: There is one other known use for clobbering a pseudo register in a
                   5229: @code{parallel}: when one of the input operands of the insn is also
                   5230: clobbered by the insn.  In this case, using the same pseudo register in
                   5231: the clobber and elsewhere in the insn produces the expected results.
                   5232: 
1.1       root     5233: @item (use @var{x})
                   5234: Represents the use of the value of @var{x}.  It indicates that the
                   5235: value in @var{x} at this point in the program is needed, even though
                   5236: it may not be apparent why this is so.  Therefore, the compiler will
1.1.1.4   root     5237: not attempt to delete previous instructions whose only effect is to
1.1.1.8   root     5238: store a value in @var{x}.  @var{x} must be a @code{reg} expression.
1.1       root     5239: 
                   5240: @item (parallel [@var{x0} @var{x1} @dots{}])
                   5241: Represents several side effects performed in parallel.  The square
1.1.1.8   root     5242: brackets stand for a vector; the operand of @code{parallel} is a
1.1       root     5243: vector of expressions.  @var{x0}, @var{x1} and so on are individual
1.1.1.8   root     5244: side effect expressions---expressions of code @code{set}, @code{call},
                   5245: @code{return}, @code{clobber} or @code{use}.@refill
1.1       root     5246: 
                   5247: ``In parallel'' means that first all the values used in the individual
                   5248: side-effects are computed, and second all the actual side-effects are
                   5249: performed.  For example,
                   5250: 
                   5251: @example
                   5252: (parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
                   5253:            (set (mem:SI (reg:SI 1)) (reg:SI 1))])
                   5254: @end example
                   5255: 
                   5256: @noindent
                   5257: says unambiguously that the values of hard register 1 and the memory
                   5258: location addressed by it are interchanged.  In both places where
                   5259: @code{(reg:SI 1)} appears as a memory address it refers to the value
1.1.1.4   root     5260: in register 1 @emph{before} the execution of the insn.
                   5261: 
1.1.1.8   root     5262: It follows that it is @emph{incorrect} to use @code{parallel} and
                   5263: expect the result of one @code{set} to be available for the next one.
1.1.1.4   root     5264: For example, people sometimes attempt to represent a jump-if-zero
                   5265: instruction this way:
                   5266: 
                   5267: @example
                   5268: (parallel [(set (cc0) (reg:SI 34))
1.1.1.9 ! root     5269:            (set (pc) (if_then_else
        !          5270:                         (eq (cc0) (const_int 0))
        !          5271:                         (label_ref @dots{})
        !          5272:                         (pc)))])
1.1.1.4   root     5273: @end example
                   5274: 
                   5275: @noindent
                   5276: But this is incorrect, because it says that the jump condition depends
                   5277: on the condition code value @emph{before} this instruction, not on the
                   5278: new value that is set by this instruction.
1.1       root     5279: 
1.1.1.5   root     5280: Peephole optimization, which takes place in together with final assembly
1.1.1.8   root     5281: code output, can produce insns whose patterns consist of a @code{parallel}
1.1       root     5282: whose elements are the operands needed to output the resulting
1.1.1.8   root     5283: assembler code---often @code{reg}, @code{mem} or constant expressions.
1.1       root     5284: This would not be well-formed RTL at any other stage in compilation,
                   5285: but it is ok then because no further optimization remains to be done.
1.1.1.4   root     5286: However, the definition of the macro @code{NOTICE_UPDATE_CC} must
                   5287: deal with such insns if you define any peephole optimizations.
1.1       root     5288: 
                   5289: @item (sequence [@var{insns} @dots{}])
                   5290: Represents a sequence of insns.  Each of the @var{insns} that appears
                   5291: in the vector is suitable for appearing in the chain of insns, so it
1.1.1.8   root     5292: must be an @code{insn}, @code{jump_insn}, @code{call_insn},
                   5293: @code{code_label}, @code{barrier} or @code{note}.
1.1       root     5294: 
1.1.1.8   root     5295: A @code{sequence} RTX never appears in an actual insn.  It represents
                   5296: the sequence of insns that result from a @code{define_expand}
1.1       root     5297: @emph{before} those insns are passed to @code{emit_insn} to insert
                   5298: them in the chain of insns.  When actually inserted, the individual
1.1.1.8   root     5299: sub-insns are separated out and the @code{sequence} is forgotten.
1.1       root     5300: @end table
                   5301: 
                   5302: Three expression codes appear in place of a side effect, as the body of an
                   5303: insn, though strictly speaking they do not describe side effects as such:
                   5304: 
                   5305: @table @code
                   5306: @item (asm_input @var{s})
                   5307: Represents literal assembler code as described by the string @var{s}.
                   5308: 
                   5309: @item (addr_vec:@var{m} [@var{lr0} @var{lr1} @dots{}])
                   5310: Represents a table of jump addresses.  The vector elements @var{lr0},
1.1.1.8   root     5311: etc., are @code{label_ref} expressions.  The mode @var{m} specifies
1.1       root     5312: how much space is given to each address; normally @var{m} would be
                   5313: @code{Pmode}.
                   5314: 
                   5315: @item (addr_diff_vec:@var{m} @var{base} [@var{lr0} @var{lr1} @dots{}])
                   5316: Represents a table of jump addresses expressed as offsets from
1.1.1.8   root     5317: @var{base}.  The vector elements @var{lr0}, etc., are @code{label_ref}
1.1       root     5318: expressions and so is @var{base}.  The mode @var{m} specifies how much
                   5319: space is given to each address-difference.@refill
                   5320: @end table
                   5321: 
                   5322: @node Incdec, Assembler, Side Effects, RTL
                   5323: @section Embedded Side-Effects on Addresses
                   5324: 
                   5325: Four special side-effect expression codes appear as memory addresses.
                   5326: 
                   5327: @table @code
                   5328: @item (pre_dec:@var{m} @var{x})
                   5329: Represents the side effect of decrementing @var{x} by a standard
                   5330: amount and represents also the value that @var{x} has after being
1.1.1.8   root     5331: decremented.  @var{x} must be a @code{reg} or @code{mem}, but most
                   5332: machines allow only a @code{reg}.  @var{m} must be the machine mode
1.1       root     5333: for pointers on the machine in use.  The amount @var{x} is decremented
                   5334: by is the length in bytes of the machine mode of the containing memory
                   5335: reference of which this expression serves as the address.  Here is an
                   5336: example of its use:@refill
                   5337: 
                   5338: @example
                   5339: (mem:DF (pre_dec:SI (reg:SI 39)))
                   5340: @end example
                   5341: 
                   5342: @noindent
                   5343: This says to decrement pseudo register 39 by the length of a @code{DFmode}
                   5344: value and use the result to address a @code{DFmode} value.
                   5345: 
                   5346: @item (pre_inc:@var{m} @var{x})
                   5347: Similar, but specifies incrementing @var{x} instead of decrementing it.
                   5348: 
                   5349: @item (post_dec:@var{m} @var{x})
1.1.1.8   root     5350: Represents the same side effect as @code{pre_dec} but a different
1.1       root     5351: value.  The value represented here is the value @var{x} has @i{before}
                   5352: being decremented.
                   5353: 
                   5354: @item (post_inc:@var{m} @var{x})
                   5355: Similar, but specifies incrementing @var{x} instead of decrementing it.
                   5356: @end table
                   5357: 
                   5358: These embedded side effect expressions must be used with care.  Instruction
                   5359: patterns may not use them.  Until the @samp{flow} pass of the compiler,
                   5360: they may occur only to represent pushes onto the stack.  The @samp{flow}
                   5361: pass finds cases where registers are incremented or decremented in one
                   5362: instruction and used as an address shortly before or after; these cases are
                   5363: then transformed to use pre- or post-increment or -decrement.
                   5364: 
                   5365: Explicit popping of the stack could be represented with these embedded
                   5366: side effect operators, but that would not be safe; the instruction
                   5367: combination pass could move the popping past pushes, thus changing
                   5368: the meaning of the code.
                   5369: 
                   5370: An instruction that can be represented with an embedded side effect
1.1.1.8   root     5371: could also be represented using @code{parallel} containing an additional
                   5372: @code{set} to describe how the address register is altered.  This is not
1.1       root     5373: done because machines that allow these operations at all typically
                   5374: allow them wherever a memory address is called for.  Describing them as
                   5375: additional parallel stores would require doubling the number of entries
                   5376: in the machine description.
                   5377: 
                   5378: @node Assembler, Insns, IncDec, RTL
                   5379: @section Assembler Instructions as Expressions
                   5380: 
1.1.1.8   root     5381: The RTX code @code{asm_operands} represents a value produced by a
1.1       root     5382: user-specified assembler instruction.  It is used to represent
                   5383: an @code{asm} statement with arguments.  An @code{asm} statement with
                   5384: a single output operand, like this:
                   5385: 
                   5386: @example
1.1.1.6   root     5387: asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
1.1       root     5388: @end example
                   5389: 
                   5390: @noindent
1.1.1.8   root     5391: is represented using a single @code{asm_operands} RTX which represents
1.1       root     5392: the value that is stored in @code{outputvar}:
                   5393: 
                   5394: @example
                   5395: (set @var{rtx-for-outputvar}
                   5396:      (asm_operands "foo %1,%2,%0" "a" 0
                   5397:                    [@var{rtx-for-addition-result} @var{rtx-for-*z}]
                   5398:                    [(asm_input:@var{m1} "g")
                   5399:                     (asm_input:@var{m2} "di")]))
                   5400: @end example
                   5401: 
                   5402: @noindent
1.1.1.8   root     5403: Here the operands of the @code{asm_operands} RTX are the assembler
1.1       root     5404: template string, the output-operand's constraint, the index-number of the
                   5405: output operand among the output operands specified, a vector of input
                   5406: operand RTX's, and a vector of input-operand modes and constraints.  The
                   5407: mode @var{m1} is the mode of the sum @code{x+y}; @var{m2} is that of
                   5408: @code{*z}.
                   5409: 
                   5410: When an @code{asm} statement has multiple output values, its insn has
1.1.1.8   root     5411: several such @code{set} RTX's inside of a @code{parallel}.  Each @code{set}
                   5412: contains a @code{asm_operands}; all of these share the same assembler
1.1       root     5413: template and vectors, but each contains the constraint for the respective
                   5414: output operand.  They are also distinguished by the output-operand index
                   5415: number, which is 0, 1, @dots{} for successive output operands.
                   5416: 
                   5417: @node Insns, Calls, Assembler, RTL
                   5418: @section Insns
                   5419: 
                   5420: The RTL representation of the code for a function is a doubly-linked
                   5421: chain of objects called @dfn{insns}.  Insns are expressions with
                   5422: special codes that are used for no other purpose.  Some insns are
                   5423: actual instructions; others represent dispatch tables for @code{switch}
                   5424: statements; others represent labels to jump to or various sorts of
                   5425: declarative information.
                   5426: 
                   5427: In addition to its own specific data, each insn must have a unique id-number
                   5428: that distinguishes it from all other insns in the current function, and
                   5429: chain pointers to the preceding and following insns.  These three fields
                   5430: occupy the same position in every insn, independent of the expression code
                   5431: of the insn.  They could be accessed with @code{XEXP} and @code{XINT},
                   5432: but instead three special macros are always used:
                   5433: 
                   5434: @table @code
                   5435: @item INSN_UID (@var{i})
                   5436: Accesses the unique id of insn @var{i}.
                   5437: 
                   5438: @item PREV_INSN (@var{i})
                   5439: Accesses the chain pointer to the insn preceding @var{i}.
                   5440: If @var{i} is the first insn, this is a null pointer.
                   5441: 
                   5442: @item NEXT_INSN (@var{i})
                   5443: Accesses the chain pointer to the insn following @var{i}.
                   5444: If @var{i} is the last insn, this is a null pointer.
                   5445: @end table
                   5446: 
                   5447: The @code{NEXT_INSN} and @code{PREV_INSN} pointers must always
1.1.1.6   root     5448: correspond: if @var{insn} is not the first insn,
1.1       root     5449: 
                   5450: @example
                   5451: NEXT_INSN (PREV_INSN (@var{insn})) == @var{insn}
                   5452: @end example
                   5453: 
                   5454: @noindent
                   5455: is always true.
                   5456: 
                   5457: Every insn has one of the following six expression codes:
                   5458: 
1.1.1.8   root     5459: @table @code
1.1       root     5460: @item insn
1.1.1.8   root     5461: The expression code @code{insn} is used for instructions that do not jump
                   5462: and do not do function calls.  Insns with code @code{insn} have four
1.1       root     5463: additional fields beyond the three mandatory ones listed above.
                   5464: These four are described in a table below.
                   5465: 
                   5466: @item jump_insn
1.1.1.8   root     5467: The expression code @code{jump_insn} is used for instructions that may jump
                   5468: (or, more generally, may contain @code{label_ref} expressions).
                   5469: @code{jump_insn} insns have the same extra fields as @code{insn} insns,
1.1       root     5470: accessed in the same way.
                   5471: 
                   5472: @item call_insn
1.1.1.8   root     5473: The expression code @code{call_insn} is used for instructions that may do
1.1       root     5474: function calls.  It is important to distinguish these instructions because
                   5475: they imply that certain registers and memory locations may be altered
                   5476: unpredictably.
                   5477: 
1.1.1.8   root     5478: @code{call_insn} insns have the same extra fields as @code{insn} insns,
1.1       root     5479: accessed in the same way.
                   5480: 
                   5481: @item code_label
1.1.1.8   root     5482: A @code{code_label} insn represents a label that a jump insn can jump to.
1.1       root     5483: It contains one special field of data in addition to the three standard ones.
                   5484: It is used to hold the @dfn{label number}, a number that identifies this
                   5485: label uniquely among all the labels in the compilation (not just in the
                   5486: current function).  Ultimately, the label is represented in the assembler
                   5487: output as an assembler label @samp{L@var{n}} where @var{n} is the label number.
                   5488: 
                   5489: @item barrier
                   5490: Barriers are placed in the instruction stream after unconditional
                   5491: jump instructions to indicate that the jumps are unconditional.
                   5492: They contain no information beyond the three standard fields.
                   5493: 
                   5494: @item note
1.1.1.8   root     5495: @code{note} insns are used to represent additional debugging and
1.1       root     5496: declarative information.  They contain two nonstandard fields, an
                   5497: integer which is accessed with the macro @code{NOTE_LINE_NUMBER} and a
                   5498: string accessed with @code{NOTE_SOURCE_FILE}.
                   5499: 
                   5500: If @code{NOTE_LINE_NUMBER} is positive, the note represents the
                   5501: position of a source line and @code{NOTE_SOURCE_FILE} is the source file name
                   5502: that the line came from.  These notes control generation of line
                   5503: number data in the assembler output.
                   5504: 
                   5505: Otherwise, @code{NOTE_LINE_NUMBER} is not really a line number but a
                   5506: code with one of the following values (and @code{NOTE_SOURCE_FILE}
                   5507: must contain a null pointer):
                   5508: 
                   5509: @table @code
                   5510: @item NOTE_INSN_DELETED
                   5511: Such a note is completely ignorable.  Some passes of the compiler
                   5512: delete insns by altering them into notes of this kind.
                   5513: 
                   5514: @item NOTE_INSN_BLOCK_BEG
                   5515: @itemx NOTE_INSN_BLOCK_END
                   5516: These types of notes indicate the position of the beginning and end
                   5517: of a level of scoping of variable names.  They control the output
                   5518: of debugging information.
                   5519: 
                   5520: @item NOTE_INSN_LOOP_BEG
                   5521: @itemx NOTE_INSN_LOOP_END
                   5522: These types of notes indicate the position of the beginning and end
                   5523: of a @code{while} or @code{for} loop.  They enable the loop optimizer
                   5524: to find loops quickly.
1.1.1.6   root     5525: @item NOTE_INSN_FUNCTION_END
                   5526: Appears near the end of the function body, just before the label that
                   5527: @code{return} statements jump to (on machine where a single instruction
                   5528: does not suffice for returning).  This note may be deleted by jump
                   5529: optimization.
                   5530: @item NOTE_INSN_SETJMP
                   5531: Appears following each call to @code{setjmp} or a related function.
1.1.1.7   root     5532: 
                   5533: @item NOTE_INSN_LOOP_BEG
                   5534: Appears at the place in a loop that @code{continue} statements jump to.
1.1       root     5535: @end table
1.1.1.7   root     5536: 
                   5537: These codes are printed symbolically when they appear in debugging dumps.
1.1       root     5538: @end table
                   5539: 
1.1.1.6   root     5540: The machine mode of an insn is normally zero (@code{VOIDmode}), but the
                   5541: reload pass sets it to @code{QImode} if the insn needs reloading.
                   5542: 
1.1.1.8   root     5543: Here is a table of the extra fields of @code{insn}, @code{jump_insn}
                   5544: and @code{call_insn} insns:
1.1       root     5545: 
                   5546: @table @code
                   5547: @item PATTERN (@var{i})
                   5548: An expression for the side effect performed by this insn.
                   5549: 
1.1.1.6   root     5550: @item INSN_CODE (@var{i})
                   5551: An integer that says which pattern in the machine description matches
                   5552: this insn, or -1 if the matching has not yet been attempted.
                   5553: 
                   5554: Such matching is never attempted and this field is not used on an insn
1.1.1.8   root     5555: whose pattern consists of a single @code{use}, @code{clobber},
                   5556: @code{asm}, @code{addr_vec} or @code{addr_diff_vec} expression.
1.1       root     5557: 
                   5558: @item LOG_LINKS (@var{i})
1.1.1.8   root     5559: A list (chain of @code{insn_list} expressions) of previous ``related''
1.1       root     5560: insns: insns which store into registers values that are used for the
                   5561: first time in this insn.  (An additional constraint is that neither a
                   5562: jump nor a label may come between the related insns).  This list is
                   5563: set up by the flow analysis pass; it is a null pointer until then.
                   5564: 
1.1.1.6   root     5565: @item REG_NOTES (@var{i})
1.1.1.8   root     5566: A list (chain of @code{expr_list} expressions) giving information
1.1.1.6   root     5567: about the usage of registers in this insn.  This list is set up by the
                   5568: flow analysis pass; it is a null pointer until then.
1.1       root     5569: @end table
                   5570: 
1.1.1.8   root     5571: The @code{LOG_LINKS} field of an insn is a chain of @code{insn_list}
1.1       root     5572: expressions.  Each of these has two operands: the first is an insn,
1.1.1.8   root     5573: and the second is another @code{insn_list} expression (the next one in
                   5574: the chain).  The last @code{insn_list} in the chain has a null pointer
1.1       root     5575: as second operand.  The significant thing about the chain is which
1.1.1.8   root     5576: insns appear in it (as first operands of @code{insn_list}
1.1       root     5577: expressions).  Their order is not significant.
                   5578: 
                   5579: The @code{REG_NOTES} field of an insn is a similar chain but of
1.1.1.8   root     5580: @code{expr_list} expressions instead of @code{insn_list}.  There are
1.1.1.5   root     5581: several kinds of register notes, which are distinguished by the machine
1.1.1.8   root     5582: mode of the @code{expr_list}, which in a register note is really
1.1.1.5   root     5583: understood as being an @code{enum reg_note}.  The first operand @var{op}
1.1.1.8   root     5584: of the @code{expr_list} is data whose meaning depends on the kind of
1.1.1.5   root     5585: note.  Here are the kinds of register note:
1.1       root     5586: 
                   5587: @table @code
                   5588: @item REG_DEAD
                   5589: The register @var{op} dies in this insn; that is to say, altering the
                   5590: value immediately after this insn would not affect the future behavior
                   5591: of the program.
                   5592: 
                   5593: @item REG_INC
                   5594: The register @var{op} is incremented (or decremented; at this level
                   5595: there is no distinction) by an embedded side effect inside this insn.
1.1.1.8   root     5596: This means it appears in a @code{post_inc}, @code{pre_inc},
                   5597: @code{post_dec} or @code{pre_dec} RTX.
1.1       root     5598: 
                   5599: @item REG_EQUIV
                   5600: The register that is set by this insn will be equal to @var{op} at run
                   5601: time, and could validly be replaced in all its occurrences by
                   5602: @var{op}.  (``Validly'' here refers to the data flow of the program;
                   5603: simple replacement may make some insns invalid.)
                   5604: 
                   5605: The value which the insn explicitly copies into the register may look
                   5606: different from @var{op}, but they will be equal at run time.
                   5607: 
                   5608: For example, when a constant is loaded into a register that is never
                   5609: assigned any other value, this kind of note is used.
                   5610: 
                   5611: When a parameter is copied into a pseudo-register at entry to a function,
                   5612: a note of this kind records that the register is equivalent to the stack
                   5613: slot where the parameter was passed.  Although in this case the register
                   5614: may be set by other insns, it is still valid to replace the register
                   5615: by the stack slot throughout the function.
                   5616: 
                   5617: @item REG_EQUAL
                   5618: The register that is set by this insn will be equal to @var{op} at run
                   5619: time at the end of this insn (but not necessarily elsewhere in the
                   5620: function).
                   5621: 
                   5622: The RTX @var{op} is typically an arithmetic expression.  For example,
                   5623: when a sequence of insns such as a library call is used to perform an
                   5624: arithmetic operation, this kind of note is attached to the insn that
                   5625: produces or copies the final value.  It tells the CSE pass how to
                   5626: think of that value.
                   5627: 
                   5628: @item REG_RETVAL
                   5629: This insn copies the value of a library call, and @var{op} is the
                   5630: first insn that was generated to set up the arguments for the library
                   5631: call.
                   5632: 
                   5633: Flow analysis uses this note to delete all of a library call whose
                   5634: result is dead.
                   5635: 
                   5636: @item REG_WAS_0
                   5637: The register @var{op} contained zero before this insn.  You can rely
                   5638: on this note if it is present; its absence implies nothing.
                   5639: 
                   5640: @item REG_LIBCALL
                   5641: This is the inverse of @code{REG_RETVAL}: it is placed on the first
                   5642: insn of a library call, and it points to the last one.
                   5643: 
                   5644: Loop optimization uses this note to move an entire library call out
                   5645: of a loop when its value is constant.
                   5646: 
                   5647: @item REG_NONNEG
                   5648: The register @var{op} is known to have nonnegative value when this
                   5649: insn is reached.
                   5650: @end table
                   5651: 
1.1.1.8   root     5652: For convenience, the machine mode in an @code{insn_list} or
                   5653: @code{expr_list} is printed using these symbolic codes in debugging dumps.
1.1.1.7   root     5654: 
1.1.1.8   root     5655: The only difference between the expression codes @code{insn_list} and
                   5656: @code{expr_list} is that the first operand of an @code{insn_list} is
1.1       root     5657: assumed to be an insn and is printed in debugging dumps as the insn's
1.1.1.8   root     5658: unique id; the first operand of an @code{expr_list} is printed in the
1.1.1.7   root     5659: ordinary way as an expression.
1.1       root     5660: 
                   5661: @node Calls, Sharing, Insns, RTL
                   5662: @section RTL Representation of Function-Call Insns
                   5663: 
1.1.1.8   root     5664: Insns that call subroutines have the RTL expression code @code{call_insn}.
1.1       root     5665: These insns must satisfy special rules, and their bodies must use a special
1.1.1.8   root     5666: RTL expression code, @code{call}.
1.1       root     5667: 
1.1.1.8   root     5668: A @code{call} expression has two operands, as follows:
1.1       root     5669: 
                   5670: @example
1.1.1.6   root     5671: (call (mem:@var{fm} @var{addr}) @var{nbytes})
1.1       root     5672: @end example
                   5673: 
                   5674: @noindent
                   5675: Here @var{nbytes} is an operand that represents the number of bytes of
                   5676: argument data being passed to the subroutine, @var{fm} is a machine mode
                   5677: (which must equal as the definition of the @code{FUNCTION_MODE} macro in
                   5678: the machine description) and @var{addr} represents the address of the
                   5679: subroutine.
                   5680: 
1.1.1.8   root     5681: For a subroutine that returns no value, the @code{call} RTX as shown above
1.1       root     5682: is the entire body of the insn.
                   5683: 
                   5684: For a subroutine that returns a value whose mode is not @code{BLKmode},
                   5685: the value is returned in a hard register.  If this register's number is
                   5686: @var{r}, then the body of the call insn looks like this:
                   5687: 
                   5688: @example
                   5689: (set (reg:@var{m} @var{r})
1.1.1.9 ! root     5690:      (call (mem:@var{fm} @var{addr}) @var{nbytes}))
1.1       root     5691: @end example
                   5692: 
                   5693: @noindent
                   5694: This RTL expression makes it clear (to the optimizer passes) that the
                   5695: appropriate register receives a useful value in this insn.
                   5696: 
                   5697: Immediately after RTL generation, if the value of the subroutine is
                   5698: actually used, this call insn is always followed closely by an insn which
                   5699: refers to the register @var{r}.  This remains true through all the
                   5700: optimizer passes until cross jumping occurs.
                   5701: 
                   5702: The following insn has one of two forms.  Either it copies the value into a
                   5703: pseudo-register, like this:
                   5704: 
                   5705: @example
                   5706: (set (reg:@var{m} @var{p}) (reg:@var{m} @var{r}))
                   5707: @end example
                   5708: 
                   5709: @noindent
                   5710: or (in the case where the calling function will simply return whatever
                   5711: value the call produced, and no operation is needed to do this):
                   5712: 
                   5713: @example
                   5714: (use (reg:@var{m} @var{r}))
                   5715: @end example
                   5716: 
                   5717: @noindent
                   5718: Between the call insn and this following insn there may intervene only a
1.1.1.8   root     5719: stack-adjustment insn (and perhaps some @code{note} insns).
1.1       root     5720: 
                   5721: When a subroutine returns a @code{BLKmode} value, it is handled by
                   5722: passing to the subroutine the address of a place to store the value.
                   5723: So the call insn itself does not ``return'' any value, and it has the
                   5724: same RTL form as a call that returns nothing.
                   5725: 
                   5726: @node Sharing,, Calls, RTL
                   5727: @section Structure Sharing Assumptions
                   5728: 
                   5729: The compiler assumes that certain kinds of RTL expressions are unique;
                   5730: there do not exist two distinct objects representing the same value.
                   5731: In other cases, it makes an opposite assumption: that no RTL expression
                   5732: object of a certain kind appears in more than one place in the
                   5733: containing structure.
                   5734: 
                   5735: These assumptions refer to a single function; except for the RTL
                   5736: objects that describe global variables and external functions,
                   5737: no RTL objects are common to two functions.
                   5738: 
                   5739: @itemize @bullet
                   5740: @item
1.1.1.8   root     5741: Each pseudo-register has only a single @code{reg} object to represent it,
1.1       root     5742: and therefore only a single machine mode.
                   5743: 
                   5744: @item
1.1.1.8   root     5745: For any symbolic label, there is only one @code{symbol_ref} object
1.1       root     5746: referring to it.
                   5747: 
                   5748: @item
1.1.1.8   root     5749: There is only one @code{const_int} expression with value zero,
1.1       root     5750: and only one with value one.
                   5751: 
                   5752: @item
1.1.1.8   root     5753: There is only one @code{pc} expression.
1.1       root     5754: 
                   5755: @item
1.1.1.8   root     5756: There is only one @code{cc0} expression.
1.1       root     5757: 
                   5758: @item
1.1.1.8   root     5759: There is only one @code{const_double} expression with mode
1.1       root     5760: @code{SFmode} and value zero, and only one with mode @code{DFmode} and
                   5761: value zero.
                   5762: 
                   5763: @item
1.1.1.8   root     5764: No @code{label_ref} appears in more than one place in the RTL
1.1       root     5765: structure; in other words, it is safe to do a tree-walk of all the
1.1.1.8   root     5766: insns in the function and assume that each time a @code{label_ref} is
1.1       root     5767: seen it is distinct from all others that are seen.
                   5768: 
                   5769: @item
1.1.1.8   root     5770: Only one @code{mem} object is normally created for each static
1.1       root     5771: variable or stack slot, so these objects are frequently shared in all
                   5772: the places they appear.  However, separate but equal objects for these
                   5773: variables are occasionally made.
                   5774: 
                   5775: @item
1.1.1.5   root     5776: When a single @code{asm} statement has multiple output operands,
                   5777: a distinct @code{asm_operands} RTX is made for each output operand.
                   5778: However, these all share the vector which contains the sequence of
                   5779: input operands.  Because this sharing is used later on to test whether
                   5780: two @code{asm_operands} RTX's come from the same statement, the sharing
                   5781: must be guaranteed to be preserved.
                   5782: 
                   5783: @item
1.1       root     5784: No RTL object appears in more than one place in the RTL structure
                   5785: except as described above.  Many passes of the compiler rely on this
                   5786: by assuming that they can modify RTL objects in place without unwanted
                   5787: side-effects on other insns.
                   5788: 
                   5789: @item
                   5790: During initial RTL generation, shared structure is freely introduced.
                   5791: After all the RTL for a function has been generated, all shared
                   5792: structure is copied by @code{unshare_all_rtl} in @file{emit-rtl.c},
                   5793: after which the above rules are guaranteed to be followed.
                   5794: 
                   5795: @item
                   5796: During the combiner pass, shared structure with an insn can exist
                   5797: temporarily.  However, the shared structure is copied before the
                   5798: combiner is finished with the insn.  This is done by
1.1.1.8   root     5799: @code{copy_substitutions} in @file{combine.c}.
1.1       root     5800: @end itemize
                   5801: 
                   5802: @node Machine Desc, Machine Macros, RTL, Top
                   5803: @chapter Machine Descriptions
                   5804: 
                   5805: A machine description has two parts: a file of instruction patterns
                   5806: (@file{.md} file) and a C header file of macro definitions.
                   5807: 
                   5808: The @file{.md} file for a target machine contains a pattern for each
                   5809: instruction that the target machine supports (or at least each instruction
                   5810: that is worth telling the compiler about).  It may also contain comments.
                   5811: A semicolon causes the rest of the line to be a comment, unless the semicolon
                   5812: is inside a quoted string.
                   5813: 
                   5814: See the next chapter for information on the C header file.
                   5815: 
                   5816: @menu
                   5817: * Patterns::            How to write instruction patterns.
1.1.1.8   root     5818: * Example::             An explained example of a @code{define_insn} pattern.
1.1       root     5819: * RTL Template::        The RTL template defines what insns match a pattern.
                   5820: * Output Template::     The output template says how to make assembler code
                   5821:                           from such an insn.
                   5822: * Output Statement::    For more generality, write C code to output 
                   5823:                           the assembler code.
                   5824: * Constraints::         When not all operands are general operands.
                   5825: * Standard Names::      Names mark patterns to use for code generation.
                   5826: * Pattern Ordering::    When the order of patterns makes a difference.
                   5827: * Dependent Patterns::  Having one pattern may make you need another.
                   5828: * Jump Patterns::       Special considerations for patterns for jump insns.
                   5829: * Peephole Definitions::Defining machine-specific peephole optimizations.
                   5830: * Expander Definitions::Generating a sequence of several RTL insns
                   5831:                          for a standard operation.
                   5832: @end menu
                   5833: 
                   5834: @node Patterns, Example, Machine Desc, Machine Desc
                   5835: @section Everything about Instruction Patterns
                   5836: 
                   5837: Each instruction pattern contains an incomplete RTL expression, with pieces
                   5838: to be filled in later, operand constraints that restrict how the pieces can
                   5839: be filled in, and an output pattern or C code to generate the assembler
1.1.1.8   root     5840: output, all wrapped up in a @code{define_insn} expression.
1.1       root     5841: 
1.1.1.8   root     5842: A @code{define_insn} is an RTL expression containing four or five operands:
1.1       root     5843: 
                   5844: @enumerate
                   5845: @item
                   5846: An optional name.  The presence of a name indicate that this instruction
                   5847: pattern can perform a certain standard job for the RTL-generation
                   5848: pass of the compiler.  This pass knows certain names and will use
                   5849: the instruction patterns with those names, if the names are defined
                   5850: in the machine description.
                   5851: 
                   5852: The absence of a name is indicated by writing an empty string
                   5853: where the name should go.  Nameless instruction patterns are never
                   5854: used for generating RTL code, but they may permit several simpler insns
                   5855: to be combined later on.
                   5856: 
                   5857: Names that are not thus known and used in RTL-generation have no
                   5858: effect; they are equivalent to no name at all.
                   5859: 
                   5860: @item
                   5861: The @dfn{RTL template} (@pxref{RTL Template}) is a vector of
                   5862: incomplete RTL expressions which show what the instruction should look
1.1.1.8   root     5863: like.  It is incomplete because it may contain @code{match_operand}
                   5864: and @code{match_dup} expressions that stand for operands of the
1.1       root     5865: instruction.
                   5866: 
                   5867: If the vector has only one element, that element is what the
                   5868: instruction should look like.  If the vector has multiple elements,
1.1.1.8   root     5869: then the instruction looks like a @code{parallel} expression
1.1       root     5870: containing that many elements as described.
                   5871: 
                   5872: @item
                   5873: A condition.  This is a string which contains a C expression that is
                   5874: the final test to decide whether an insn body matches this pattern.
                   5875: 
                   5876: For a named pattern, the condition (if present) may not depend on
                   5877: the data in the insn being matched, but only the target-machine-type
                   5878: flags.  The compiler needs to test these conditions during
                   5879: initialization in order to learn exactly which named instructions are
                   5880: available in a particular run.
                   5881: 
                   5882: For nameless patterns, the condition is applied only when matching an
                   5883: individual insn, and only after the insn has matched the pattern's
                   5884: recognition template.  The insn's operands may be found in the vector
                   5885: @code{operands}.
                   5886: 
                   5887: @item
                   5888: The @dfn{output template}: a string that says how to output matching
                   5889: insns as assembler code.  @samp{%} in this string specifies where
                   5890: to substitute the value of an operand.  @xref{Output Template}.
                   5891: 
                   5892: When simple substitution isn't general enough, you can specify a piece
                   5893: of C code to compute the output.  @xref{Output Statement}.
                   5894: 
                   5895: @item
                   5896: Optionally, some @dfn{machine-specific information}.  The meaning
                   5897: of this information is defined only by an individual machine description;
                   5898: typically it might say whether this insn alters the condition codes,
                   5899: or how many bytes of output it generates.
                   5900: 
                   5901: This operand is written as a string containing a C initializer
                   5902: (complete with braces) for the structure type @code{INSN_MACHINE_INFO},
                   5903: whose definition is up to you (@pxref{Misc}).
                   5904: @end enumerate
                   5905: 
                   5906: @node Example, RTL Template, Patterns, Machine Desc
1.1.1.8   root     5907: @section Example of @code{define_insn}
1.1       root     5908: 
                   5909: Here is an actual example of an instruction pattern, for the 68000/68020.
                   5910: 
                   5911: @example
                   5912: (define_insn "tstsi"
                   5913:   [(set (cc0)
                   5914:         (match_operand:SI 0 "general_operand" "rm"))]
                   5915:   ""
                   5916:   "*
                   5917: @{ if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
                   5918:     return \"tstl %0\";
                   5919:   return \"cmpl #0,%0\"; @}")
                   5920: @end example
                   5921: 
                   5922: This is an instruction that sets the condition codes based on the value of
                   5923: a general operand.  It has no condition, so any insn whose RTL description
                   5924: has the form shown may be handled according to this pattern.  The name
                   5925: @samp{tstsi} means ``test a @code{SImode} value'' and tells the RTL generation
                   5926: pass that, when it is necessary to test such a value, an insn to do so
                   5927: can be constructed using this pattern.
                   5928: 
                   5929: The output control string is a piece of C code which chooses which
                   5930: output template to return based on the kind of operand and the specific
                   5931: type of CPU for which code is being generated.
                   5932: 
                   5933: @samp{"rm"} is an operand constraint.  Its meaning is explained below.
                   5934: 
                   5935: @node RTL Template, Output Template, Example, Machine Desc
                   5936: @section RTL Template for Generating and Recognizing Insns
                   5937: 
                   5938: The RTL template is used to define which insns match the particular pattern
                   5939: and how to find their operands.  For named patterns, the RTL template also
                   5940: says how to construct an insn from specified operands.
                   5941: 
                   5942: Construction involves substituting specified operands into a copy of the
                   5943: template.  Matching involves determining the values that serve as the
                   5944: operands in the insn being matched.  Both of these activities are
                   5945: controlled by special expression types that direct matching and
                   5946: substitution of the operands.
                   5947: 
                   5948: @table @code
1.1.1.8   root     5949: @item (match_operand:@var{m} @var{n} @var{pred} @var{constraint})
1.1       root     5950: This expression is a placeholder for operand number @var{n} of
                   5951: the insn.  When constructing an insn, operand number @var{n}
                   5952: will be substituted at this point.  When matching an insn, whatever
                   5953: appears at this position in the insn will be taken as operand
1.1.1.8   root     5954: number @var{n}; but it must satisfy @var{pred} or this instruction
1.1       root     5955: pattern will not match at all.
                   5956: 
                   5957: Operand numbers must be chosen consecutively counting from zero in
1.1.1.8   root     5958: each instruction pattern.  There may be only one @code{match_operand}
1.1       root     5959: expression in the pattern for each operand number.  Usually operands
1.1.1.8   root     5960: are numbered in the order of appearance in @code{match_operand}
1.1       root     5961: expressions.
                   5962: 
1.1.1.8   root     5963: @var{pred} is a string that is the name of a C function that accepts
                   5964: two arguments, an expression and a machine mode.  During matching, the
                   5965: function will be called with the putative operand as the expression
                   5966: and @var{m} as the mode argument.  If it returns zero, this
                   5967: instruction pattern fails to match.  @var{pred} may be an empty
                   5968: string; then it means no test is to be done on the operand,
                   5969: so anything which occurs in this position is valid.
                   5970: 
                   5971: @var{constraint} controls reloading and the choice of the best register
                   5972: class to use for a value, as explained later (@pxref{Constraints}).
                   5973: 
                   5974: People are often unclear on the difference between the constraint and the
                   5975: predicate.  The predicate helps decide whether a given insn matches the
                   5976: pattern.  The constraint plays no role in this decision; instead, it
                   5977: controls various decisions in the case of an insn which does match.
                   5978: 
                   5979: Most often, @var{pred} is @code{"general_operand"}.  This function checks
                   5980: that the putative operand is either a constant, a register or a memory
                   5981: reference, and that it is valid for mode @var{m}.
1.1       root     5982: 
1.1.1.8   root     5983: For an operand that must be a register, @var{pred} should be
1.1       root     5984: @code{"register_operand"}.  It would be valid to use
                   5985: @code{"general_operand"}, since the reload pass would copy any
                   5986: non-register operands through registers, but this would make GNU CC do
                   5987: extra work, and it would prevent the register allocator from doing the
                   5988: best possible job.
                   5989: 
1.1.1.8   root     5990: For an operand that must be a constant, either @var{pred} should be
1.1       root     5991: @code{"immediate_operand"}, or the instruction pattern's extra
                   5992: condition should check for constants, or both.  You cannot expect the
                   5993: constraints to do this work!  If the constraints allow only constants,
                   5994: but the predicate allows something else, the compiler will crash when
                   5995: that case arises.
                   5996: 
                   5997: @item (match_dup @var{n})
                   5998: This expression is also a placeholder for operand number @var{n}.
                   5999: It is used when the operand needs to appear more than once in the
                   6000: insn.
                   6001: 
1.1.1.8   root     6002: In construction, @code{match_dup} behaves exactly like
                   6003: @code{match_operand}: the operand is substituted into the insn being
                   6004: constructed.  But in matching, @code{match_dup} behaves differently.
1.1       root     6005: It assumes that operand number @var{n} has already been determined by
1.1.1.8   root     6006: a @code{match_operand} appearing earlier in the recognition template,
1.1       root     6007: and it matches only an identical-looking expression.
                   6008: 
1.1.1.4   root     6009: @item (match_operator:@var{m} @var{n} "@var{predicate}" [@var{operands}@dots{}])
                   6010: This pattern is a kind of placeholder for a variable RTL expression
                   6011: code.
                   6012: 
                   6013: When constructing an insn, it stands for an RTL expression whose
                   6014: expression code is taken from that of operand @var{n}, and whose
                   6015: operands are constructed from the patterns @var{operands}.
                   6016: 
                   6017: When matching an expression, it matches an expression if the function
                   6018: @var{predicate} returns nonzero on that expression @emph{and} the
                   6019: patterns @var{operands} match the operands of the expression.
                   6020: 
                   6021: Suppose that the function @code{commutative_operator} is defined as
                   6022: follows, to match any expression whose operator is one of the six
                   6023: commutative arithmetic operators of RTL and whose mode is @var{mode}:
                   6024: 
                   6025: @example
                   6026: int
                   6027: commutative_operator (x, mode)
                   6028:      rtx x;
                   6029:      enum machine_mode mode;
                   6030: @{
                   6031:   enum rtx_code code = GET_CODE (x);
                   6032:   if (GET_MODE (x) != mode)
                   6033:     return 0;
                   6034:   return (code == PLUS || code == MULT || code == UMULT
                   6035:           || code == AND || code == IOR || code == XOR);
                   6036: @}
                   6037: @end example
                   6038: 
                   6039: Then the following pattern will match any RTL expression consisting
                   6040: of a commutative operator applied to two general operands:
                   6041: 
                   6042: @example
                   6043: (match_operator:SI 2 "commutative_operator"
                   6044:   [(match_operand:SI 3 "general_operand" "g")
                   6045:    (match_operand:SI 4 "general_operand" "g")])
                   6046: @end example
                   6047: 
                   6048: Here the vector @code{[@var{operands}@dots{}]} contains two patterns
                   6049: because the expressions to be matched all contain two operands.
                   6050: 
                   6051: When this pattern does match, the two operands of the commutative
                   6052: operator are recorded as operands 3 and 4 of the insn.  (This is done
1.1.1.8   root     6053: by the two instances of @code{match_operand}.)  Operand 2 of the insn
1.1.1.4   root     6054: will be the entire commutative expression: use @code{GET_CODE
                   6055: (operands[2])} to see which commutative operator was used.
                   6056: 
1.1.1.8   root     6057: The machine mode @var{m} of @code{match_operator} works like that of
                   6058: @code{match_operand}: it is passed as the second argument to the
1.1.1.4   root     6059: predicate function, and that function is solely responsible for
                   6060: deciding whether the expression to be matched ``has'' that mode.
                   6061: 
                   6062: When constructing an insn, argument 2 of the gen-function will specify
                   6063: the operation (i.e. the expression code) for the expression to be
                   6064: made.  It should be an RTL expression, whose expression code is copied
                   6065: into a new expression whose operands are arguments 3 and 4 of the
                   6066: gen-function.  The subexpressions of argument 2 are not used;
                   6067: only its expression code matters.
                   6068: 
1.1.1.8   root     6069: There is no way to specify constraints in @code{match_operator}.  The
                   6070: operand of the insn which corresponds to the @code{match_operator}
1.1.1.4   root     6071: never has any constraints because it is never reloaded as a whole.
                   6072: However, if parts of its @var{operands} are matched by
1.1.1.8   root     6073: @code{match_operand} patterns, those parts may have constraints of
1.1.1.4   root     6074: their own.
                   6075: 
1.1       root     6076: @item (address (match_operand:@var{m} @var{n} "address_operand" ""))
                   6077: This complex of expressions is a placeholder for an operand number
                   6078: @var{n} in a ``load address'' instruction: an operand which specifies
                   6079: a memory location in the usual way, but for which the actual operand
                   6080: value used is the address of the location, not the contents of the
                   6081: location.
                   6082: 
1.1.1.8   root     6083: @code{address} expressions never appear in RTL code, only in machine
1.1       root     6084: descriptions.  And they are used only in machine descriptions that do
                   6085: not use the operand constraint feature.  When operand constraints are
                   6086: in use, the letter @samp{p} in the constraint serves this purpose.
                   6087: 
                   6088: @var{m} is the machine mode of the @emph{memory location being
                   6089: addressed}, not the machine mode of the address itself.  That mode is
                   6090: always the same on a given target machine (it is @code{Pmode}, which
                   6091: normally is @code{SImode}), so there is no point in mentioning it;
1.1.1.8   root     6092: thus, no machine mode is written in the @code{address} expression.  If
1.1       root     6093: some day support is added for machines in which addresses of different
                   6094: kinds of objects appear differently or are used differently (such as
                   6095: the PDP-10), different formats would perhaps need different machine
1.1.1.8   root     6096: modes and these modes might be written in the @code{address}
1.1       root     6097: expression.
                   6098: @end table
                   6099: 
                   6100: @node Output Template, Output Statement, RTL Template, Machine Desc
                   6101: @section Output Templates and Operand Substitution
                   6102: 
1.1.1.6   root     6103: The @dfn{output template} is a string which specifies how to output the
                   6104: assembler code for an instruction pattern.  Most of the template is a
                   6105: fixed string which is output literally.  The character @samp{%} is used
                   6106: to specify where to substitute an operand; it can also be used to
                   6107: identify places where different variants of the assembler require
1.1       root     6108: different syntax.
                   6109: 
                   6110: In the simplest case, a @samp{%} followed by a digit @var{n} says to output
                   6111: operand @var{n} at that point in the string.
                   6112: 
                   6113: @samp{%} followed by a letter and a digit says to output an operand in an
                   6114: alternate fashion.  Four letters have standard, built-in meanings described
                   6115: below.  The machine description macro @code{PRINT_OPERAND} can define
                   6116: additional letters with nonstandard meanings.
                   6117: 
                   6118: @samp{%c@var{digit}} can be used to substitute an operand that is a
                   6119: constant value without the syntax that normally indicates an immediate
                   6120: operand.
                   6121: 
                   6122: @samp{%n@var{digit}} is like @samp{%c@var{digit}} except that the value of
                   6123: the constant is negated before printing.
                   6124: 
                   6125: @samp{%a@var{digit}} can be used to substitute an operand as if it were a
                   6126: memory reference, with the actual operand treated as the address.  This may
                   6127: be useful when outputting a ``load address'' instruction, because often the
                   6128: assembler syntax for such an instruction requires you to write the operand
                   6129: as if it were a memory reference.
                   6130: 
                   6131: @samp{%l@var{digit}} is used to substitute a @code{label_ref} into a jump
                   6132: instruction.
                   6133: 
                   6134: @samp{%} followed by a punctuation character specifies a substitution that
                   6135: does not use an operand.  Only one case is standard: @samp{%%} outputs a
                   6136: @samp{%} into the assembler code.  Other nonstandard cases can be
1.1.1.8   root     6137: defined in the @code{PRINT_OPERAND} macro.  You must also define
                   6138: which punctuation characters are valid with the
                   6139: @code{PRINT_OPERAND_PUNCT_VALID_P} macro.
1.1       root     6140: 
                   6141: The template may generate multiple assembler instructions.  Write the text
                   6142: for the instructions, with @samp{\;} between them.
                   6143: 
1.1.1.6   root     6144: When the RTL contains two operands which are required by constraint to match
1.1       root     6145: each other, the output template must refer only to the lower-numbered operand.
                   6146: Matching operands are not always identical, and the rest of the compiler
                   6147: arranges to put the proper RTL expression for printing into the lower-numbered
                   6148: operand.
                   6149: 
                   6150: One use of nonstandard letters or punctuation following @samp{%} is to
                   6151: distinguish between different assembler languages for the same machine; for
                   6152: example, Motorola syntax versus MIT syntax for the 68000.  Motorola syntax
                   6153: requires periods in most opcode names, while MIT syntax does not.  For
                   6154: example, the opcode @samp{movel} in MIT syntax is @samp{move.l} in Motorola
                   6155: syntax.  The same file of patterns is used for both kinds of output syntax,
                   6156: but the character sequence @samp{%.} is used in each place where Motorola
                   6157: syntax wants a period.  The @code{PRINT_OPERAND} macro for Motorola syntax
                   6158: defines the sequence to output a period; the macro for MIT syntax defines
                   6159: it to do nothing.
                   6160: 
                   6161: @node Output Statement, Constraints, Output Template, Machine Desc
                   6162: @section C Statements for Generating Assembler Output
                   6163: 
                   6164: Often a single fixed template string cannot produce correct and efficient
                   6165: assembler code for all the cases that are recognized by a single
                   6166: instruction pattern.  For example, the opcodes may depend on the kinds of
                   6167: operands; or some unfortunate combinations of operands may require extra
                   6168: machine instructions.
                   6169: 
                   6170: If the output control string starts with a @samp{*}, then it is not an
                   6171: output template but rather a piece of C program that should compute a
                   6172: template.  It should execute a @code{return} statement to return the
                   6173: template-string you want.  Most such templates use C string literals, which
                   6174: require doublequote characters to delimit them.  To include these
                   6175: doublequote characters in the string, prefix each one with @samp{\}.
                   6176: 
                   6177: The operands may be found in the array @code{operands}, whose C data type
                   6178: is @code{rtx []}.
                   6179: 
                   6180: It is possible to output an assembler instruction and then go on to output
                   6181: or compute more of them, using the subroutine @code{output_asm_insn}.  This
                   6182: receives two arguments: a template-string and a vector of operands.  The
                   6183: vector may be @code{operands}, or it may be another array of @code{rtx}
                   6184: that you declare locally and initialize yourself.
                   6185: 
                   6186: When an insn pattern has multiple alternatives in its constraints, often
1.1.1.5   root     6187: the appearance of the assembler code is determined mostly by which alternative
1.1       root     6188: was matched.  When this is so, the C code can test the variable
                   6189: @code{which_alternative}, which is the ordinal number of the alternative
                   6190: that was actually satisfied (0 for the first, 1 for the second alternative,
                   6191: etc.).
                   6192: 
                   6193: For example, suppose there are two opcodes for storing zero, @samp{clrreg}
                   6194: for registers and @samp{clrmem} for memory locations.  Here is how
                   6195: a pattern could use @code{which_alternative} to choose between them:
                   6196: 
                   6197: @example
                   6198: (define_insn ""
                   6199:   [(set (match_operand:SI 0 "general_operand" "r,m")
                   6200:         (const_int 0))]
                   6201:   ""
                   6202:   "*
                   6203:   return (which_alternative == 0
                   6204:           ? \"clrreg %0\" : \"clrmem %0\");
                   6205:   ")
                   6206: @end example
                   6207: 
                   6208: @node Constraints, Standard Names, Output Statement, Machine Desc
                   6209: @section Operand Constraints
                   6210: 
1.1.1.8   root     6211: Each @code{match_operand} in an instruction pattern can specify a
1.1       root     6212: constraint for the type of operands allowed.  Constraints can say whether
                   6213: an operand may be in a register, and which kinds of register; whether the
                   6214: operand can be a memory reference, and which kinds of address; whether the
                   6215: operand may be an immediate constant, and which possible values it may
                   6216: have.  Constraints can also require two operands to match.
                   6217: 
                   6218: @menu
                   6219: * Simple Constraints::  Basic use of constraints.
                   6220: * Multi-Alternative::   When an insn has two alternative constraint-patterns.
                   6221: * Class Preferences::   Constraints guide which hard register to put things in.
                   6222: * Modifiers::           More precise control over effects of constraints.
                   6223: * No Constraints::      Describing a clean machine without constraints.
                   6224: @end menu
                   6225: 
                   6226: @node Simple Constraints, Multi-Alternative, Constraints, Constraints
                   6227: @subsection Simple Constraints
                   6228: 
                   6229: The simplest kind of constraint is a string full of letters, each of
                   6230: which describes one kind of operand that is permitted.  Here are
                   6231: the letters that are allowed:
                   6232: 
                   6233: @table @asis
                   6234: @item @samp{m}
                   6235: A memory operand is allowed, with any kind of address that the machine
                   6236: supports in general.
                   6237: 
                   6238: @item @samp{o}
                   6239: A memory operand is allowed, but only if the address is
1.1.1.8   root     6240: @dfn{offsettable}.  This means that adding a small integer (actually,
1.1       root     6241: the width in bytes of the operand, as determined by its machine mode)
                   6242: may be added to the address and the result is also a valid memory
                   6243: address.
                   6244: 
1.1.1.8   root     6245: For example, an address which is constant is offsettable; so is an
1.1       root     6246: address that is the sum of a register and a constant (as long as a
                   6247: slightly larger constant is also within the range of address-offsets
                   6248: supported by the machine); but an autoincrement or autodecrement
1.1.1.8   root     6249: address is not offsettable.  More complicated indirect/indexed
                   6250: addresses may or may not be offsettable depending on the other
1.1       root     6251: addressing modes that the machine supports.
                   6252: 
                   6253: Note that in an output operand which can be matched by another
                   6254: operand, the constraint letter @samp{o} is valid only when accompanied
                   6255: by both @samp{<} (if the target machine has predecrement addressing)
                   6256: and @samp{>} (if the target machine has preincrement addressing).
                   6257: 
                   6258: When the constraint letter @samp{o} is used, the reload pass may
1.1.1.8   root     6259: generate instructions which copy a nonoffsettable address into an index
1.1       root     6260: register.  The idea is that the register can be used as a replacement
1.1.1.8   root     6261: offsettable address.  But this method requires that there be patterns
1.1       root     6262: to copy any kind of address into a register.  Auto-increment
                   6263: and auto-decrement addresses are an exception; there need not be an
                   6264: instruction that can copy such an address into a register, because
                   6265: reload handles these cases specially.
                   6266: 
                   6267: Most older machine designs have ``load address'' instructions which do
                   6268: just what is needed here.  Some RISC machines do not advertise such
                   6269: instructions, but the possible addresses on these machines are very
                   6270: limited, so it is easy to fake them.
                   6271: 
                   6272: @item @samp{<}
                   6273: A memory operand with autodecrement addressing (either predecrement or
                   6274: postdecrement) is allowed.
                   6275: 
                   6276: @item @samp{>}
                   6277: A memory operand with autoincrement addressing (either preincrement or
                   6278: postincrement) is allowed.
                   6279: 
                   6280: @item @samp{r}
                   6281: A register operand is allowed provided that it is in a general
                   6282: register.
                   6283: 
                   6284: @item @samp{d}, @samp{a}, @samp{f}, @dots{}
                   6285: Other letters can be defined in machine-dependent fashion to stand for
                   6286: particular classes of registers.  @samp{d}, @samp{a} and @samp{f} are
                   6287: defined on the 68000/68020 to stand for data, address and floating
                   6288: point registers.
                   6289: 
                   6290: @item @samp{i}
                   6291: An immediate integer operand (one with constant value) is allowed.
                   6292: This includes symbolic constants whose values will be known only at
                   6293: assembly time.
                   6294: 
                   6295: @item @samp{n}
                   6296: An immediate integer operand with a known numeric value is allowed.
                   6297: Many systems cannot support assembly-time constants for operands less
                   6298: than a word wide.  Constraints for these operands should use @samp{n}
                   6299: rather than @samp{i}.
                   6300: 
                   6301: @item @samp{I}, @samp{J}, @samp{K}, @dots{}
                   6302: Other letters in the range @samp{I} through @samp{M} may be defined in
                   6303: a machine-dependent fashion to permit immediate integer operands with
                   6304: explicit integer values in specified ranges.  For example, on the
                   6305: 68000, @samp{I} is defined to stand for the range of values 1 to 8.
                   6306: This is the range permitted as a shift count in the shift
                   6307: instructions.
                   6308: 
                   6309: @item @samp{F}
1.1.1.8   root     6310: An immediate floating operand (expression code @code{const_double}) is
1.1       root     6311: allowed.
                   6312: 
                   6313: @item @samp{G}, @samp{H}
                   6314: @samp{G} and @samp{H} may be defined in a machine-dependent fashion to
                   6315: permit immediate floating operands in particular ranges of values.
                   6316: 
                   6317: @item @samp{s}
                   6318: An immediate integer operand whose value is not an explicit integer is
                   6319: allowed.
                   6320: 
                   6321: This might appear strange; if an insn allows a constant operand with a
                   6322: value not known at compile time, it certainly must allow any known
                   6323: value.  So why use @samp{s} instead of @samp{i}?  Sometimes it allows
                   6324: better code to be generated.
                   6325: 
                   6326: For example, on the 68000 in a fullword instruction it is possible to
1.1.1.9 ! root     6327: use an immediate operand; but if the immediate value is between -128
        !          6328: and 127, better code results from loading the value into a register and
1.1       root     6329: using the register.  This is because the load into the register can be
                   6330: done with a @samp{moveq} instruction.  We arrange for this to happen
                   6331: by defining the letter @samp{K} to mean ``any integer outside the
1.1.1.9 ! root     6332: range -128 to 127'', and then specifying @samp{Ks} in the operand
1.1       root     6333: constraints.
                   6334: 
                   6335: @item @samp{g}
                   6336: Any register, memory or immediate integer operand is allowed, except for
                   6337: registers that are not general registers.
                   6338: 
                   6339: @item @samp{@var{n}} (a digit)
                   6340: An operand that matches operand number @var{n} is allowed.
                   6341: If a digit is used together with letters, the digit should come last.
                   6342: 
                   6343: This is called a @dfn{matching constraint} and what it really means is
                   6344: that the assembler has only a single operand that fills two roles
                   6345: considered separate in the RTL insn.  For example, an add insn has two
                   6346: input operands and one output operand in the RTL, but on most machines
                   6347: an add instruction really has only two operands, one of them an
                   6348: input-output operand.
                   6349: 
                   6350: Matching constraints work only in circumstances like that add insn.
                   6351: More precisely, the matching constraint must appear in an input-only
                   6352: operand and the operand that it matches must be an output-only operand
1.1.1.5   root     6353: with a lower number.  Thus, operand @var{n} must have @samp{=} in its
                   6354: constraint.
1.1       root     6355: 
                   6356: For operands to match in a particular case usually means that they
                   6357: are identical-looking RTL expressions.  But in a few special cases
                   6358: specific kinds of dissimilarity are allowed.  For example, @code{*x}
                   6359: as an input operand will match @code{*x++} as an output operand.
                   6360: For proper results in such cases, the output template should always
                   6361: use the output-operand's number when printing the operand.
                   6362: 
                   6363: @item @samp{p}
                   6364: An operand that is a valid memory address is allowed.  This is
                   6365: for ``load address'' and ``push address'' instructions.
                   6366: 
1.1.1.8   root     6367: @samp{p} in the constraint must be accompanies by @code{address_operand}
                   6368: as the predicate in the @code{match_operand}.
1.1       root     6369: @end table
                   6370: 
                   6371: In order to have valid assembler code, each operand must satisfy
                   6372: its constraint.  But a failure to do so does not prevent the pattern
                   6373: from applying to an insn.  Instead, it directs the compiler to modify
                   6374: the code so that the constraint will be satisfied.  Usually this is
                   6375: done by copying an operand into a register.
                   6376: 
                   6377: Contrast, therefore, the two instruction patterns that follow:
                   6378: 
                   6379: @example
                   6380: (define_insn ""
                   6381:   [(set (match_operand:SI 0 "general_operand" "r")
                   6382:         (plus:SI (match_dup 0)
                   6383:                  (match_operand:SI 1 "general_operand" "r")))]
                   6384:   ""
                   6385:   "@dots{}")
                   6386: @end example
                   6387: 
                   6388: @noindent
                   6389: which has two operands, one of which must appear in two places, and
                   6390: 
                   6391: @example
                   6392: (define_insn ""
                   6393:   [(set (match_operand:SI 0 "general_operand" "r")
                   6394:         (plus:SI (match_operand:SI 1 "general_operand" "0")
                   6395:                  (match_operand:SI 2 "general_operand" "r")))]
                   6396:   ""
                   6397:   "@dots{}")
                   6398: @end example
                   6399: 
                   6400: @noindent
                   6401: which has three operands, two of which are required by a constraint to be
                   6402: identical.  If we are considering an insn of the form
                   6403: 
                   6404: @example
                   6405: (insn @var{n} @var{prev} @var{next}
                   6406:   (set (reg:SI 3)
                   6407:        (plus:SI (reg:SI 6) (reg:SI 109)))
                   6408:   @dots{})
                   6409: @end example
                   6410: 
                   6411: @noindent
                   6412: the first pattern would not apply at all, because this insn does not
                   6413: contain two identical subexpressions in the right place.  The pattern would
                   6414: say, ``That does not look like an add instruction; try other patterns.''
                   6415: The second pattern would say, ``Yes, that's an add instruction, but there
                   6416: is something wrong with it.''  It would direct the reload pass of the
                   6417: compiler to generate additional insns to make the constraint true.  The
                   6418: results might look like this:
                   6419: 
                   6420: @example
                   6421: (insn @var{n2} @var{prev} @var{n}
                   6422:   (set (reg:SI 3) (reg:SI 6))
                   6423:   @dots{})
                   6424: 
                   6425: (insn @var{n} @var{n2} @var{next}
                   6426:   (set (reg:SI 3)
                   6427:        (plus:SI (reg:SI 3) (reg:SI 109)))
                   6428:   @dots{})
                   6429: @end example
                   6430: 
                   6431: It is up to you to make sure that each operand, in each pattern, has
                   6432: constraints that can handle any RTL expression that could be present for
                   6433: that operand.  (When multiple alternatives are in use, each pattern must,
                   6434: for each possible combination of operand expressions, have at least one
                   6435: alternative which can handle that combination of operands.)  The
                   6436: constraints don't need to @emph{allow} any possible operand---when this is
                   6437: the case, they do not constrain---but they must at least point the way to
                   6438: reloading any possible operand so that it will fit.
                   6439: 
                   6440: @itemize @bullet
                   6441: @item
                   6442: If the constraint accepts whatever operands the predicate permits,
                   6443: there is no problem: reloading is never necessary for this operand.
                   6444: 
                   6445: For example, an operand whose constraints permit everything except
                   6446: registers is safe provided its predicate rejects registers.
                   6447: 
                   6448: An operand whose predicate accepts only constant values is safe
                   6449: provided its constraints include the letter @samp{i}.  If any possible
                   6450: constant value is accepted, then nothing less than @samp{i} will do;
1.1.1.5   root     6451: if the predicate is more selective, then the constraints may also be
1.1       root     6452: more selective.
                   6453: 
                   6454: @item
                   6455: Any operand expression can be reloaded by copying it into a register.
                   6456: So if an operand's constraints allow some kind of register, it is
                   6457: certain to be safe.  It need not permit all classes of registers; the
                   6458: compiler knows how to copy a register into another register of the
                   6459: proper class in order to make an instruction valid.
                   6460: 
                   6461: @item
1.1.1.8   root     6462: A nonoffsettable memory reference can be reloaded by copying the
1.1       root     6463: address into a register.  So if the constraint uses the letter
                   6464: @samp{o}, all memory references are taken care of.
                   6465: 
                   6466: @item
1.1.1.8   root     6467: A constant operand can be reloaded by allocating space in memory to
                   6468: hold it as preinitialized data.  Then the memory reference can be used
                   6469: in place of the constant.  So if the constraint uses the letters
                   6470: @samp{o} or @samp{m}, constant operands are not a problem.
1.1       root     6471: @end itemize
                   6472: 
                   6473: If the operand's predicate can recognize registers, but the constraint does
                   6474: not permit them, it can make the compiler crash.  When this operand happens
                   6475: to be a register, the reload pass will be stymied, because it does not know
                   6476: how to copy a register temporarily into memory.
                   6477: 
                   6478: @node Multi-Alternative, Class Preferences, Simple Constraints, Constraints
                   6479: @subsection Multiple Alternative Constraints
                   6480: 
                   6481: Sometimes a single instruction has multiple alternative sets of possible
                   6482: operands.  For example, on the 68000, a logical-or instruction can combine
                   6483: register or an immediate value into memory, or it can combine any kind of
                   6484: operand into a register; but it cannot combine one memory location into
                   6485: another.
                   6486: 
                   6487: These constraints are represented as multiple alternatives.  An alternative
                   6488: can be described by a series of letters for each operand.  The overall
                   6489: constraint for an operand is made from the letters for this operand
                   6490: from the first alternative, a comma, the letters for this operand from
                   6491: the second alternative, a comma, and so on until the last alternative.
                   6492: Here is how it is done for fullword logical-or on the 68000:
                   6493: 
                   6494: @example
                   6495: (define_insn "iorsi3"
1.1.1.9 ! root     6496:   [(set (match_operand:SI 0 "general_operand" "=m,d")
        !          6497:         (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
1.1       root     6498:                 (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
                   6499:   @dots{})
                   6500: @end example
                   6501: 
                   6502: The first alternative has @samp{m} (memory) for operand 0, @samp{0} for
1.1.1.9 ! root     6503: operand 1 (meaning it must match operand 0), and @samp{dKs} for operand
        !          6504: 2.  The second alternative has @samp{d} (data register) for operand 0,
        !          6505: @samp{0} for operand 1, and @samp{dmKs} for operand 2.  The @samp{=} and
        !          6506: @samp{%} in the constraints apply to all the alternatives; their meaning
1.1       root     6507: is explained in the next section.
                   6508: 
                   6509: If all the operands fit any one alternative, the instruction is valid.
                   6510: Otherwise, for each alternative, the compiler counts how many instructions
                   6511: must be added to copy the operands so that that alternative applies.
                   6512: The alternative requiring the least copying is chosen.  If two alternatives
                   6513: need the same amount of copying, the one that comes first is chosen.
                   6514: These choices can be altered with the @samp{?} and @samp{!} characters:
                   6515: 
                   6516: @table @samp
                   6517: @item ?
                   6518: Disparage slightly the alternative that the @samp{?} appears in,
                   6519: as a choice when no alternative applies exactly.  The compiler regards
                   6520: this alternative as one unit more costly for each @samp{?} that appears
                   6521: in it.
                   6522: 
                   6523: @item !
                   6524: Disparage severely the alternative that the @samp{!} appears in.
                   6525: When operands must be copied into registers, the compiler will
                   6526: never choose this alternative as the one to strive for.
                   6527: @end table
                   6528: 
1.1.1.5   root     6529: When an insn pattern has multiple alternatives in its constraints, often
                   6530: the appearance of the assembler code is determined mostly by which
1.1       root     6531: alternative was matched.  When this is so, the C code for writing the
                   6532: assembler code can use the variable @code{which_alternative}, which is
1.1.1.5   root     6533: the ordinal number of the alternative that was actually satisfied (0 for
                   6534: the first, 1 for the second alternative, etc.).  For example:
1.1       root     6535: 
                   6536: @example
                   6537: (define_insn ""
                   6538:   [(set (match_operand:SI 0 "general_operand" "r,m")
                   6539:         (const_int 0))]
                   6540:   ""
                   6541:   "*
                   6542:   return (which_alternative == 0
                   6543:           ? \"clrreg %0\" : \"clrmem %0\");
                   6544:   ")
                   6545: @end example
                   6546: 
                   6547: @node Class Preferences, Modifiers, Multi-Alternative, Constraints
                   6548: @subsection Register Class Preferences
                   6549: 
                   6550: The operand constraints have another function: they enable the compiler
                   6551: to decide which kind of hardware register a pseudo register is best
                   6552: allocated to.  The compiler examines the constraints that apply to the
                   6553: insns that use the pseudo register, looking for the machine-dependent
                   6554: letters such as @samp{d} and @samp{a} that specify classes of registers.
                   6555: The pseudo register is put in whichever class gets the most ``votes''.
                   6556: The constraint letters @samp{g} and @samp{r} also vote: they vote in
                   6557: favor of a general register.  The machine description says which registers
                   6558: are considered general.
                   6559: 
                   6560: Of course, on some machines all registers are equivalent, and no register
                   6561: classes are defined.  Then none of this complexity is relevant.
                   6562: 
                   6563: @node Modifiers, No Constraints, Class Preferences, Constraints
                   6564: @subsection Constraint Modifier Characters
                   6565: 
                   6566: @table @samp
                   6567: @item =
                   6568: Means that this operand is write-only for this instruction: the previous
                   6569: value is discarded and replaced by output data.
                   6570: 
                   6571: @item +
                   6572: Means that this operand is both read and written by the instruction.
                   6573: 
                   6574: When the compiler fixes up the operands to satisfy the constraints,
                   6575: it needs to know which operands are inputs to the instruction and
                   6576: which are outputs from it.  @samp{=} identifies an output; @samp{+}
                   6577: identifies an operand that is both input and output; all other operands
                   6578: are assumed to be input only.
                   6579: 
                   6580: @item &
                   6581: Means (in a particular alternative) that this operand is written
                   6582: before the instruction is finished using the input operands.
                   6583: Therefore, this operand may not lie in a register that is used as an
                   6584: input operand or as part of any memory address.
                   6585: 
                   6586: @samp{&} applies only to the alternative in which it is written.  In
                   6587: constraints with multiple alternatives, sometimes one alternative
                   6588: requires @samp{&} while others do not.  See, for example, the
                   6589: @samp{movdf} insn of the 68000.
                   6590: 
                   6591: @samp{&} does not obviate the need to write @samp{=}.
                   6592: 
                   6593: @item %
                   6594: Declares the instruction to be commutative for this operand and the
                   6595: following operand.  This means that the compiler may interchange the
                   6596: two operands if that is the cheapest way to make all operands fit the
                   6597: constraints.  This is often used in patterns for addition instructions
                   6598: that really have only two operands: the result must go in one of the
                   6599: arguments.  Here for example, is how the 68000 halfword-add
                   6600: instruction is defined:
                   6601: 
                   6602: @example
                   6603: (define_insn "addhi3"
                   6604:   [(set (match_operand:HI 0 "general_operand" "=m,r")
                   6605:      (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
                   6606:               (match_operand:HI 2 "general_operand" "di,g")))]
                   6607:   @dots{})
                   6608: @end example
                   6609: 
                   6610: Note that in previous versions of GNU CC the @samp{%} constraint
                   6611: modifier always applied to operands 1 and 2 regardless of which
                   6612: operand it was written in.  The usual custom was to write it in
                   6613: operand 0.  Now it must be in operand 1 if the operands to be
                   6614: exchanged are 1 and 2.
                   6615: 
                   6616: @item #
                   6617: Says that all following characters, up to the next comma, are to be
                   6618: ignored as a constraint.  They are significant only for choosing
                   6619: register preferences.
                   6620: 
                   6621: @item *
                   6622: Says that the following character should be ignored when choosing
                   6623: register preferences.  @samp{*} has no effect on the meaning of the
                   6624: constraint as a constraint.
                   6625: 
                   6626: Here is an example: the 68000 has an instruction to sign-extend a
                   6627: halfword in a data register, and can also sign-extend a value by
                   6628: copying it into an address register.  While either kind of register is
                   6629: acceptable, the constraints on an address-register destination are
                   6630: less strict, so it is best if register allocation makes an address
                   6631: register its goal.  Therefore, @samp{*} is used so that the @samp{d}
                   6632: constraint letter (for data register) is ignored when computing
                   6633: register preferences.
                   6634: 
                   6635: @example
                   6636: (define_insn "extendhisi2"
                   6637:   [(set (match_operand:SI 0 "general_operand" "=*d,a")
                   6638:         (sign_extend:SI
                   6639:          (match_operand:HI 1 "general_operand" "0,g")))]
                   6640:   @dots{})
                   6641: @end example
                   6642: @end table
                   6643: 
                   6644: @node No Constraints,, Modifiers, Constraints
                   6645: @subsection Not Using Constraints
                   6646: 
                   6647: Some machines are so clean that operand constraints are not required.  For
                   6648: example, on the Vax, an operand valid in one context is valid in any other
                   6649: context.  On such a machine, every operand constraint would be @samp{g},
                   6650: excepting only operands of ``load address'' instructions which are
                   6651: written as if they referred to a memory location's contents but actual
                   6652: refer to its address.  They would have constraint @samp{p}.
                   6653: 
                   6654: For such machines, instead of writing @samp{g} and @samp{p} for all
                   6655: the constraints, you can choose to write a description with empty constraints.
1.1.1.8   root     6656: Then you write @samp{""} for the constraint in every @code{match_operand}.
                   6657: Address operands are identified by writing an @code{address} expression
                   6658: around the @code{match_operand}, not by their constraints.
1.1       root     6659: 
                   6660: When the machine description has just empty constraints, certain parts
1.1.1.6   root     6661: of compilation are skipped, making the compiler faster.  However,
                   6662: few machines actually do not need constraints; all machine descriptions
                   6663: now in existence use constraints.
1.1       root     6664: 
                   6665: @node Standard Names, Pattern Ordering, Constraints, Machine Desc
                   6666: @section Standard Names for Patterns Used in Generation
                   6667: 
                   6668: Here is a table of the instruction names that are meaningful in the RTL
                   6669: generation pass of the compiler.  Giving one of these names to an
                   6670: instruction pattern tells the RTL generation pass that it can use the
                   6671: pattern in to accomplish a certain task.
                   6672: 
                   6673: @table @asis
                   6674: @item @samp{mov@var{m}}
1.1.1.8   root     6675: Here @var{m} stands for a two-letter machine mode name, in lower case.
                   6676: This instruction pattern moves data with that machine mode from operand
                   6677: 1 to operand 0.  For example, @samp{movsi} moves full-word data.
1.1       root     6678: 
1.1.1.8   root     6679: If operand 0 is a @code{subreg} with mode @var{m} of a register whose
                   6680: own mode is wider than @var{m}, the effect of this instruction is
1.1       root     6681: to store the specified value in the part of the register that corresponds
                   6682: to mode @var{m}.  The effect on the rest of the register is undefined.
                   6683: 
                   6684: This class of patterns is special in several ways.  First of all, each
                   6685: of these names @emph{must} be defined, because there is no other way
                   6686: to copy a datum from one place to another.
                   6687: 
                   6688: Second, these patterns are not used solely in the RTL generation pass.
                   6689: Even the reload pass can generate move insns to copy values from stack
1.1.1.8   root     6690: slots into temporary registers.  When it does so, one of the operands is
                   6691: a hard register and the other is an operand that can need to be reloaded
                   6692: into a register.
                   6693: 
                   6694: Therefore, when given such a pair of operands, the pattern must generate
                   6695: RTL which needs no reloading and needs no temporary registers---no
                   6696: registers other than the operands.  For example, if you support the
                   6697: pattern with a @code{define_expand}, then in such a case the
                   6698: @code{define_expand} mustn't call @code{force_reg} or any other such
                   6699: function which might generate new pseudo registers.
1.1       root     6700: 
                   6701: This requirement exists even for subword modes on a RISC machine where
                   6702: fetching those modes from memory normally requires several insns and
                   6703: some temporary registers.  Look in @file{spur.md} to see how the
1.1.1.8   root     6704: requirement can be satisfied.
1.1       root     6705: 
                   6706: The variety of operands that have reloads depends on the rest of the
                   6707: machine description, but typically on a RISC machine these can only be
                   6708: pseudo registers that did not get hard registers, while on other
                   6709: machines explicit memory references will get optional reloads.
                   6710: 
1.1.1.9 ! root     6711: The constraints on a @samp{move@var{m}} must allow any hard register to
        !          6712: be moved to any other hard register (provided that
        !          6713: @code{HARD_REGNO_MODE_OK} permits mode @var{m} in both registers).
        !          6714: 
        !          6715: It is obligatory to support floating point @samp{move@var{m}}
        !          6716: instructions into and out of any registers that can hold fixed point
        !          6717: values, because unions and structures (which have modes @code{SImode} or
        !          6718: @code{DImode}) can be in those registers and they may have floating
        !          6719: point members.
        !          6720: 
        !          6721: There may also be a need to support fixed point @samp{move@var{m}}
        !          6722: instructions in and out of floating point registers.  Unfortunately, I
        !          6723: have forgotten why this was so, and I don't know whether it is still
        !          6724: true.  If @code{HARD_REGNO_MODE_OK} rejects fixed point values in
        !          6725: floating point registers, then the constraints of the fixed point
        !          6726: @samp{move@var{m}} instructions must be designed to avoid ever trying to
        !          6727: reload into a floating point register.
1.1       root     6728: 
                   6729: @item @samp{movstrict@var{m}}
1.1.1.8   root     6730: Like @samp{mov@var{m}} except that if operand 0 is a @code{subreg}
1.1       root     6731: with mode @var{m} of a register whose natural mode is wider,
                   6732: the @samp{movstrict@var{m}} instruction is guaranteed not to alter
                   6733: any of the register except the part which belongs to mode @var{m}.
                   6734: 
                   6735: @item @samp{add@var{m}3}
                   6736: Add operand 2 and operand 1, storing the result in operand 0.  All operands
                   6737: must have mode @var{m}.  This can be used even on two-address machines, by
                   6738: means of constraints requiring operands 1 and 0 to be the same location.
                   6739: 
                   6740: @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}
                   6741: Similar, for other arithmetic operations.
                   6742: 
                   6743: There are special considerations for register classes for logical-and
                   6744: instructions, affecting also the macro @code{PREFERRED_RELOAD_CLASS}.
                   6745: They apply not only to the patterns with these standard names, but to
                   6746: any patterns that will match such an instruction.  @xref{Register
                   6747: Classes}.
                   6748: 
                   6749: @item @samp{mulhisi3}
                   6750: Multiply operands 1 and 2, which have mode @code{HImode}, and store
                   6751: a @code{SImode} product in operand 0.
                   6752: 
                   6753: @item @samp{mulqihi3}, @samp{mulsidi3}
                   6754: Similar widening-multiplication instructions of other widths.
                   6755: 
                   6756: @item @samp{umulqihi3}, @samp{umulhisi3}, @samp{umulsidi3}
                   6757: Similar widening-multiplication instructions that do unsigned
                   6758: multiplication.
                   6759: 
                   6760: @item @samp{divmod@var{m}4}
                   6761: Signed division that produces both a quotient and a remainder.
                   6762: Operand 1 is divided by operand 2 to produce a quotient stored
                   6763: in operand 0 and a remainder stored in operand 3.
                   6764: 
                   6765: @item @samp{udivmod@var{m}4}
                   6766: Similar, but does unsigned division.
                   6767: 
                   6768: @item @samp{ashl@var{m}3}
                   6769: Arithmetic-shift operand 1 left by a number of bits specified by
                   6770: operand 2, and store the result in operand 0.  Operand 2 has
                   6771: mode @code{SImode}, not mode @var{m}.
                   6772: 
                   6773: @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}
                   6774: Other shift and rotate instructions.
                   6775: 
                   6776: Logical and arithmetic left shift are the same.  Machines that do not
                   6777: allow negative shift counts often have only one instruction for
                   6778: shifting left.  On such machines, you should define a pattern named
                   6779: @samp{ashl@var{m}3} and leave @samp{lshl@var{m}3} undefined.
                   6780: 
                   6781: There are special considerations for register classes for shift
                   6782: instructions, affecting also the macro @code{PREFERRED_RELOAD_CLASS}.
                   6783: They apply not only to the patterns with these standard names, but to
                   6784: any patterns that will match such an instruction.  @xref{Register
                   6785: Classes}.
                   6786: 
                   6787: @item @samp{neg@var{m}2}
                   6788: Negate operand 1 and store the result in operand 0.
                   6789: 
                   6790: @item @samp{abs@var{m}2}
                   6791: Store the absolute value of operand 1 into operand 0.
                   6792: 
                   6793: @item @samp{sqrt@var{m}2}
                   6794: Store the square root of operand 1 into operand 0.
                   6795: 
                   6796: @item @samp{ffs@var{m}2}
                   6797: Store into operand 0 one plus the index of the least significant 1-bit
                   6798: of operand 1.  If operand 1 is zero, store zero.  @var{m} is the mode
                   6799: of operand 0; operand 1's mode is specified by the instruction
                   6800: pattern, and the compiler will convert the operand to that mode before
                   6801: generating the instruction.
                   6802: 
                   6803: @item @samp{one_cmpl@var{m}2}
                   6804: Store the bitwise-complement of operand 1 into operand 0.
                   6805: 
                   6806: @item @samp{cmp@var{m}}
                   6807: Compare operand 0 and operand 1, and set the condition codes.
                   6808: The RTL pattern should look like this:
                   6809: 
                   6810: @example
1.1.1.6   root     6811: (set (cc0) (compare (match_operand:@var{m} 0 @dots{})
                   6812:                     (match_operand:@var{m} 1 @dots{})))
1.1       root     6813: @end example
                   6814: 
                   6815: Each such definition in the machine description, for integer mode
                   6816: @var{m}, must have a corresponding @samp{tst@var{m}} pattern, because
                   6817: optimization can simplify the compare into a test when operand 1 is
                   6818: zero.
                   6819: 
                   6820: @item @samp{tst@var{m}}
                   6821: Compare operand 0 against zero, and set the condition codes.
                   6822: The RTL pattern should look like this:
                   6823: 
                   6824: @example
                   6825: (set (cc0) (match_operand:@var{m} 0 @dots{}))
                   6826: @end example
                   6827: 
                   6828: @item @samp{movstr@var{m}}
                   6829: Block move instruction.  The addresses of the destination and source
                   6830: strings are the first two operands, and both are in mode @code{Pmode}.
                   6831: The number of bytes to move is the third operand, in mode @var{m}.
1.1.1.5   root     6832: The fourth operand is the known shared alignment of the source and
                   6833: destination, in the form of a @code{const_int} rtx.
1.1       root     6834: 
                   6835: @item @samp{cmpstr@var{m}}
                   6836: Block compare instruction, with operands like @samp{movstr@var{m}}
                   6837: except that the two memory blocks are compared byte by byte
                   6838: in lexicographic order.  The effect of the instruction is to set
                   6839: the condition codes.
                   6840: 
                   6841: @item @samp{float@var{m}@var{n}2}
1.1.1.9 ! root     6842: Convert signed integer operand 1 (valid for fixed point mode @var{m}) to
        !          6843: floating point mode @var{n} and store in operand 0 (which has mode
        !          6844: @var{n}).
        !          6845: 
        !          6846: @item @samp{floatuns@var{m}@var{n}2}
        !          6847: Convert unsigned integer operand 1 (valid for fixed point mode @var{m})
        !          6848: to floating point mode @var{n} and store in operand 0 (which has mode
        !          6849: @var{n}).
1.1       root     6850: 
                   6851: @item @samp{fix@var{m}@var{n}2}
                   6852: Convert operand 1 (valid for floating point mode @var{m}) to fixed
                   6853: point mode @var{n} as a signed number and store in operand 0 (which
                   6854: has mode @var{n}).  This instruction's result is defined only when
                   6855: the value of operand 1 is an integer.
                   6856: 
                   6857: @item @samp{fixuns@var{m}@var{n}2}
                   6858: Convert operand 1 (valid for floating point mode @var{m}) to fixed
                   6859: point mode @var{n} as an unsigned number and store in operand 0 (which
                   6860: has mode @var{n}).  This instruction's result is defined only when the
                   6861: value of operand 1 is an integer.
                   6862: 
                   6863: @item @samp{ftrunc@var{m}2}
                   6864: Convert operand 1 (valid for floating point mode @var{m}) to an
                   6865: integer value, still represented in floating point mode @var{m}, and
                   6866: store it in operand 0 (valid for floating point mode @var{m}).
                   6867: 
                   6868: @item @samp{fix_trunc@var{m}@var{n}2}
                   6869: Like @samp{fix@var{m}@var{n}2} but works for any floating point value
                   6870: of mode @var{m} by converting the value to an integer.
                   6871: 
                   6872: @item @samp{fixuns_trunc@var{m}@var{n}2}
                   6873: Like @samp{fixuns@var{m}@var{n}2} but works for any floating point
                   6874: value of mode @var{m} by converting the value to an integer.
                   6875: 
                   6876: @item @samp{trunc@var{m}@var{n}}
                   6877: Truncate operand 1 (valid for mode @var{m}) to mode @var{n} and
                   6878: store in operand 0 (which has mode @var{n}).  Both modes must be fixed
                   6879: point or both floating point.
                   6880: 
                   6881: @item @samp{extend@var{m}@var{n}}
                   6882: Sign-extend operand 1 (valid for mode @var{m}) to mode @var{n} and
                   6883: store in operand 0 (which has mode @var{n}).  Both modes must be fixed
                   6884: point or both floating point.
                   6885: 
                   6886: @item @samp{zero_extend@var{m}@var{n}}
                   6887: Zero-extend operand 1 (valid for mode @var{m}) to mode @var{n} and
                   6888: store in operand 0 (which has mode @var{n}).  Both modes must be fixed
                   6889: point.
                   6890: 
                   6891: @item @samp{extv}
                   6892: Extract a bit-field from operand 1 (a register or memory operand),
                   6893: where operand 2 specifies the width in bits and operand 3 the starting
                   6894: bit, and store it in operand 0.  Operand 0 must have @code{Simode}.
                   6895: Operand 1 may have mode @code{QImode} or @code{SImode}; often
                   6896: @code{SImode} is allowed only for registers.  Operands 2 and 3 must be
                   6897: valid for @code{SImode}.
                   6898: 
                   6899: The RTL generation pass generates this instruction only with constants
                   6900: for operands 2 and 3.
                   6901: 
                   6902: The bit-field value is sign-extended to a full word integer
                   6903: before it is stored in operand 0.
                   6904: 
                   6905: @item @samp{extzv}
                   6906: Like @samp{extv} except that the bit-field value is zero-extended.
                   6907: 
                   6908: @item @samp{insv}
                   6909: Store operand 3 (which must be valid for @code{SImode}) into a
                   6910: bit-field in operand 0, where operand 1 specifies the width in bits
                   6911: and operand 2 the starting bit.  Operand 0 may have mode @code{QImode}
                   6912: or @code{SImode}; often @code{SImode} is allowed only for registers.
                   6913: Operands 1 and 2 must be valid for @code{SImode}.
                   6914: 
                   6915: The RTL generation pass generates this instruction only with constants
                   6916: for operands 1 and 2.
                   6917: 
                   6918: @item @samp{s@var{cond}}
                   6919: Store zero or nonzero in the operand according to the condition codes.
                   6920: Value stored is nonzero iff the condition @var{cond} is true.
                   6921: @var{cond} is the name of a comparison operation expression code, such
1.1.1.8   root     6922: as @code{eq}, @code{lt} or @code{leu}.
1.1       root     6923: 
                   6924: You specify the mode that the operand must have when you write the
                   6925: @code{match_operand} expression.  The compiler automatically sees
                   6926: which mode you have used and supplies an operand of that mode.
                   6927: 
1.1.1.8   root     6928: The value stored for a true condition must have 1 as its low bit, or
                   6929: else must be negative.  Otherwise the instruction is not suitable and
                   6930: must be omitted from the machine description.  You must tell the
                   6931: compiler exactly which value is stored by defining the macro
                   6932: @code{STORE_FLAG_VALUE}.
1.1       root     6933: 
                   6934: @item @samp{b@var{cond}}
1.1.1.8   root     6935: Conditional branch instruction.  Operand 0 is a @code{label_ref}
1.1       root     6936: that refers to the label to jump to.  Jump if the condition codes
                   6937: meet condition @var{cond}.
                   6938: 
                   6939: @item @samp{call}
                   6940: Subroutine call instruction returning no value.  Operand 0 is the
                   6941: function to call; operand 1 is the number of bytes of arguments pushed
1.1.1.8   root     6942: (in mode @code{SImode}, except it is normally a @code{const_int});
1.1       root     6943: operand 2 is the number of registers used as operands.
                   6944: 
                   6945: On most machines, operand 2 is not actually stored into the RTL
                   6946: pattern.  It is supplied for the sake of some RISC machines which need
                   6947: to put this information into the assembler code; they can put it in
                   6948: the RTL instead of operand 1.
                   6949: 
1.1.1.8   root     6950: Operand 0 should be a @code{mem} RTX whose address is the address of
1.1       root     6951: the function.
                   6952: 
                   6953: @item @samp{call_value}
                   6954: Subroutine call instruction returning a value.  Operand 0 is the hard
                   6955: register in which the value is returned.  There are three more
                   6956: operands, the same as the three operands of the @samp{call}
                   6957: instruction (but with numbers increased by one).
                   6958: 
                   6959: Subroutines that return @code{BLKmode} objects use the @samp{call}
                   6960: insn.
                   6961: 
                   6962: @item @samp{return}
                   6963: Subroutine return instruction.  This instruction pattern name should be
                   6964: defined only if a single instruction can do all the work of returning
                   6965: from a function.
                   6966: 
1.1.1.8   root     6967: @item @samp{nop}
                   6968: No-op instruction.  This instruction pattern name should always be defined
                   6969: to output a no-op in assembler code.  @code{(const_int 0)} will do as an
                   6970: RTL pattern.
                   6971: 
1.1       root     6972: @item @samp{casesi}
                   6973: Instruction to jump through a dispatch table, including bounds checking.
                   6974: This instruction takes five operands:
                   6975: 
                   6976: @enumerate
                   6977: @item
                   6978: The index to dispatch on, which has mode @code{SImode}.
                   6979: 
                   6980: @item
                   6981: The lower bound for indices in the table, an integer constant.
                   6982: 
                   6983: @item
1.1.1.6   root     6984: The total range of indices in the table---the largest index
                   6985: minus the smallest one (both inclusive).
1.1       root     6986: 
                   6987: @item
                   6988: A label to jump to if the index has a value outside the bounds.
                   6989: (If the machine-description macro @code{CASE_DROPS_THROUGH} is defined,
                   6990: then an out-of-bounds index drops through to the code following
                   6991: the jump table instead of jumping to this label.  In that case,
                   6992: this label is not actually used by the @samp{casesi} instruction,
                   6993: but it is always provided as an operand.)
                   6994: 
                   6995: @item
                   6996: A label that precedes the table itself.
                   6997: @end enumerate
                   6998: 
1.1.1.8   root     6999: The table is a @code{addr_vec} or @code{addr_diff_vec} inside of a
                   7000: @code{jump_insn}.  The number of elements in the table is one plus the
1.1       root     7001: difference between the upper bound and the lower bound.
                   7002: 
                   7003: @item @samp{tablejump}
                   7004: Instruction to jump to a variable address.  This is a low-level
                   7005: capability which can be used to implement a dispatch table when there
                   7006: is no @samp{casesi} pattern.
                   7007: 
                   7008: This pattern requires two operands: the address or offset, and a label
                   7009: which should immediately precede the jump table.  If the macro
                   7010: @code{CASE_VECTOR_PC_RELATIVE} is defined then the first operand is an
                   7011: absolute address to jump to; otherwise, it is an offset which counts
                   7012: from the address of the table.
                   7013: 
                   7014: The @samp{tablejump} insn is always the last insn before the jump
                   7015: table it uses.  Its assembler code normally has no need to use the
                   7016: second operand, but you should incorporate it in the RTL pattern so
                   7017: that the jump optimizer will not delete the table as unreachable code.
                   7018: @end table
                   7019: 
                   7020: @node Pattern Ordering, Dependent Patterns, Standard Names, Machine Desc
                   7021: @section When the Order of Patterns Matters
                   7022: 
                   7023: Sometimes an insn can match more than one instruction pattern.  Then the
                   7024: pattern that appears first in the machine description is the one used.
                   7025: Therefore, more specific patterns (patterns that will match fewer things)
                   7026: and faster instructions (those that will produce better code when they
                   7027: do match) should usually go first in the description.
                   7028: 
                   7029: In some cases the effect of ordering the patterns can be used to hide
                   7030: a pattern when it is not valid.  For example, the 68000 has an
                   7031: instruction for converting a fullword to floating point and another
                   7032: for converting a byte to floating point.  An instruction converting
                   7033: an integer to floating point could match either one.  We put the
                   7034: pattern to convert the fullword first to make sure that one will
                   7035: be used rather than the other.  (Otherwise a large integer might
                   7036: be generated as a single-byte immediate quantity, which would not work.)
                   7037: Instead of using this pattern ordering it would be possible to make the
                   7038: pattern for convert-a-byte smart enough to deal properly with any
                   7039: constant value.
                   7040: 
                   7041: @node Dependent Patterns, Jump Patterns, Pattern Ordering, Machine Desc
                   7042: @section Interdependence of Patterns
                   7043: 
                   7044: Every machine description must have a named pattern for each of the
                   7045: conditional branch names @samp{b@var{cond}}.  The recognition template
                   7046: must always have the form
                   7047: 
                   7048: @example
                   7049: (set (pc)
                   7050:      (if_then_else (@var{cond} (cc0) (const_int 0))
                   7051:                    (label_ref (match_operand 0 "" ""))
                   7052:                    (pc)))
                   7053: @end example
                   7054: 
                   7055: @noindent
                   7056: In addition, every machine description must have an anonymous pattern
                   7057: for each of the possible reverse-conditional branches.  These patterns
                   7058: look like
                   7059: 
                   7060: @example
                   7061: (set (pc)
                   7062:      (if_then_else (@var{cond} (cc0) (const_int 0))
                   7063:                    (pc)
                   7064:                    (label_ref (match_operand 0 "" ""))))
                   7065: @end example
                   7066: 
                   7067: @noindent
                   7068: They are necessary because jump optimization can turn direct-conditional
                   7069: branches into reverse-conditional branches.
                   7070: 
                   7071: The compiler does more with RTL than just create it from patterns
                   7072: and recognize the patterns: it can perform arithmetic expression codes
                   7073: when constant values for their operands can be determined.  As a result,
                   7074: sometimes having one pattern can require other patterns.  For example, the
                   7075: Vax has no `and' instruction, but it has `and not' instructions.  Here
                   7076: is the definition of one of them:
                   7077: 
                   7078: @example
                   7079: (define_insn "andcbsi2"
                   7080:   [(set (match_operand:SI 0 "general_operand" "")
                   7081:         (and:SI (match_dup 0)
                   7082:                 (not:SI (match_operand:SI
                   7083:                           1 "general_operand" ""))))]
                   7084:   ""
                   7085:   "bicl2 %1,%0")
                   7086: @end example
                   7087: 
                   7088: @noindent
                   7089: If operand 1 is an explicit integer constant, an instruction constructed
                   7090: using that pattern can be simplified into an `and' like this:
                   7091: 
                   7092: @example
                   7093: (set (reg:SI 41)
                   7094:      (and:SI (reg:SI 41)
                   7095:              (const_int 0xffff7fff)))
                   7096: @end example
                   7097: 
                   7098: @noindent
                   7099: (where the integer constant is the one's complement of what
                   7100: appeared in the original instruction).
                   7101: 
                   7102: To avoid a fatal error, the compiler must have a pattern that recognizes
                   7103: such an instruction.  Here is what is used:
                   7104: 
                   7105: @example
                   7106: (define_insn ""
                   7107:   [(set (match_operand:SI 0 "general_operand" "")
                   7108:         (and:SI (match_dup 0)
                   7109:                 (match_operand:SI 1 "general_operand" "")))]
                   7110:   "GET_CODE (operands[1]) == CONST_INT"
                   7111:   "*
                   7112: @{ operands[1]
                   7113:     = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[1]));
                   7114:   return \"bicl2 %1,%0\";
                   7115: @}")
                   7116: @end example
                   7117: 
                   7118: @noindent
                   7119: Whereas a pattern to match a general `and' instruction is impossible to
                   7120: support on the Vax, this pattern is possible because it matches only a
                   7121: constant second argument: a special case that can be output as an `and not'
                   7122: instruction.
                   7123: 
                   7124: A ``compare'' instruction whose RTL looks like this:
                   7125: 
                   7126: @example
1.1.1.6   root     7127: (set (cc0) (compare @var{operand} (const_int 0)))
1.1       root     7128: @end example
                   7129: 
                   7130: @noindent
                   7131: may be simplified by optimization into a ``test'' like this:
                   7132: 
                   7133: @example
                   7134: (set (cc0) @var{operand})
                   7135: @end example
                   7136: 
                   7137: @noindent
                   7138: So in the machine description, each ``compare'' pattern for an integer
                   7139: mode must have a corresponding ``test'' pattern that will match the
                   7140: result of such simplification.
                   7141: 
                   7142: In some cases machines support instructions identical except for the
                   7143: machine mode of one or more operands.  For example, there may be
                   7144: ``sign-extend halfword'' and ``sign-extend byte'' instructions whose
                   7145: patterns are
                   7146: 
                   7147: @example
                   7148: (set (match_operand:SI 0 @dots{})
                   7149:      (extend:SI (match_operand:HI 1 @dots{})))
                   7150: 
                   7151: (set (match_operand:SI 0 @dots{})
                   7152:      (extend:SI (match_operand:QI 1 @dots{})))
                   7153: @end example
                   7154: 
                   7155: @noindent
                   7156: Constant integers do not specify a machine mode, so an instruction to
                   7157: extend a constant value could match either pattern.  The pattern it
                   7158: actually will match is the one that appears first in the file.  For correct
                   7159: results, this must be the one for the widest possible mode (@code{HImode},
                   7160: here).  If the pattern matches the @code{QImode} instruction, the results
                   7161: will be incorrect if the constant value does not actually fit that mode.
                   7162: 
                   7163: Such instructions to extend constants are rarely generated because they are
                   7164: optimized away, but they do occasionally happen in nonoptimized
                   7165: compilations.
                   7166: 
                   7167: When an instruction has the constraint letter @samp{o}, the reload
1.1.1.8   root     7168: pass may generate instructions which copy a nonoffsettable address into
1.1       root     7169: an index register.  The idea is that the register can be used as a
1.1.1.8   root     7170: replacement offsettable address.  In order for these generated
1.1       root     7171: instructions to work, there must be patterns to copy any kind of valid
                   7172: address into a register.
                   7173: 
                   7174: Most older machine designs have ``load address'' instructions which do
                   7175: just what is needed here.  Some RISC machines do not advertise such
                   7176: instructions, but the possible addresses on these machines are very
                   7177: limited, so it is easy to fake them.
                   7178: 
                   7179: Auto-increment and auto-decrement addresses are an exception; there
                   7180: need not be an instruction that can copy such an address into a
                   7181: register, because reload handles these cases in a different manner.
                   7182: 
                   7183: @node Jump Patterns, Peephole Definitions, Dependent Patterns, Machine Desc
                   7184: @section Defining Jump Instruction Patterns
                   7185: 
                   7186: GNU CC assumes that the machine has a condition code.  A comparison insn
                   7187: sets the condition code, recording the results of both signed and unsigned
                   7188: comparison of the given operands.  A separate branch insn tests the
                   7189: condition code and branches or not according its value.  The branch insns
                   7190: come in distinct signed and unsigned flavors.  Many common machines, such
                   7191: as the Vax, the 68000 and the 32000, work this way.
                   7192: 
                   7193: Some machines have distinct signed and unsigned compare instructions, and
                   7194: only one set of conditional branch instructions.  The easiest way to handle
                   7195: these machines is to treat them just like the others until the final stage
                   7196: where assembly code is written.  At this time, when outputting code for the
                   7197: compare instruction, peek ahead at the following branch using
                   7198: @code{NEXT_INSN (insn)}.  (The variable @code{insn} refers to the insn
                   7199: being output, in the output-writing code in an instruction pattern.)  If
                   7200: the RTL says that is an unsigned branch, output an unsigned compare;
                   7201: otherwise output a signed compare.  When the branch itself is output, you
                   7202: can treat signed and unsigned branches identically.
                   7203: 
                   7204: The reason you can do this is that GNU CC always generates a pair of
                   7205: consecutive RTL insns, one to set the condition code and one to test it,
                   7206: and keeps the pair inviolate until the end.
                   7207: 
                   7208: To go with this technique, you must define the machine-description macro
                   7209: @code{NOTICE_UPDATE_CC} to do @code{CC_STATUS_INIT}; in other words, no
                   7210: compare instruction is superfluous.
                   7211: 
                   7212: Some machines have compare-and-branch instructions and no condition code.
                   7213: A similar technique works for them.  When it is time to ``output'' a
                   7214: compare instruction, record its operands in two static variables.  When
                   7215: outputting the branch-on-condition-code instruction that follows, actually
                   7216: output a compare-and-branch instruction that uses the remembered operands.
                   7217: 
                   7218: It also works to define patterns for compare-and-branch instructions.
                   7219: In optimizing compilation, the pair of compare and branch instructions
1.1.1.5   root     7220: will be combined according to these patterns.  But this does not happen
1.1       root     7221: if optimization is not requested.  So you must use one of the solutions
                   7222: above in addition to any special patterns you define.
                   7223: 
                   7224: @node Peephole Definitions, Expander Definitions, Jump Patterns, Machine Desc
                   7225: @section Defining Machine-Specific Peephole Optimizers
                   7226: 
                   7227: In addition to instruction patterns the @file{md} file may contain
                   7228: definitions of machine-specific peephole optimizations.
                   7229: 
                   7230: The combiner does not notice certain peephole optimizations when the data
                   7231: flow in the program does not suggest that it should try them.  For example,
                   7232: sometimes two consecutive insns related in purpose can be combined even
                   7233: though the second one does not appear to use a register computed in the
                   7234: first one.  A machine-specific peephole optimizer can detect such
                   7235: opportunities.
                   7236: 
                   7237: A definition looks like this:
                   7238: 
                   7239: @example
                   7240: (define_peephole
                   7241:   [@var{insn-pattern-1}
                   7242:    @var{insn-pattern-2}
                   7243:    @dots{}]
                   7244:   "@var{condition}"
                   7245:   "@var{template}"
                   7246:   "@var{machine-specific info}")
                   7247: @end example
                   7248: 
                   7249: @noindent
                   7250: The last string operand may be omitted if you are not using any
                   7251: machine-specific information in this machine description.  If present,
1.1.1.8   root     7252: it must obey the same rules as in a @code{define_insn}.
1.1       root     7253: 
                   7254: In this skeleton, @var{insn-pattern-1} and so on are patterns to match
1.1.1.5   root     7255: consecutive insns.  The optimization applies to a sequence of insns when
                   7256: @var{insn-pattern-1} matches the first one, @var{insn-pattern-2} matches
                   7257: the next, and so on.@refill
1.1       root     7258: 
1.1.1.8   root     7259: Each of the insns matched by a peephole must also match a
                   7260: @code{define_insn}.  Peepholes are checked only at the last stage just
                   7261: before code generation, and only optionally.  Therefore, any insn which
                   7262: would match a peephole but no @code{define_insn} will cause a crash in code
                   7263: generation in an unoptimized compilation, or at various optimization
                   7264: stages.
1.1       root     7265: 
1.1.1.5   root     7266: The operands of the insns are matched with @code{match_operands} and
                   7267: @code{match_dup}, as usual.  What is not usual is that the operand numbers
                   7268: apply to all the insn patterns in the definition.  So, you can check for
                   7269: identical operands in two insns by using @code{match_operand} in one insn
                   7270: and @code{match_dup} in the other.
1.1       root     7271: 
                   7272: The operand constraints used in @code{match_operand} patterns do not have
1.1.1.8   root     7273: any direct effect on the applicability of the peephole, but they will
                   7274: be validated afterward, so make sure your constraints are general enough
                   7275: to apply whenever the peephole matches.  If the peephole matches
                   7276: but the constraints are not satisfied, the compiler will crash.
                   7277: 
                   7278: It is safe to omit constraints in all the operands of the peephole; or
                   7279: you can write constraints which serve as a double-check on the criteria
                   7280: previously tested.
1.1       root     7281: 
1.1.1.5   root     7282: Once a sequence of insns matches the patterns, the @var{condition} is
                   7283: checked.  This is a C expression which makes the final decision whether to
                   7284: perform the optimization (we do so if the expression is nonzero).  If
1.1       root     7285: @var{condition} is omitted (in other words, the string is empty) then the
1.1.1.5   root     7286: optimization is applied to every sequence of insns that matches the
1.1       root     7287: patterns.
                   7288: 
1.1.1.5   root     7289: The defined peephole optimizations are applied after register allocation
                   7290: is complete.  Therefore, the peephole definition can check which
                   7291: operands have ended up in which kinds of registers, just by looking at
                   7292: the operands.
1.1       root     7293: 
                   7294: The way to refer to the operands in @var{condition} is to write
                   7295: @code{operands[@var{i}]} for operand number @var{i} (as matched by
                   7296: @code{(match_operand @var{i} @dots{})}).  Use the variable @code{insn} to
                   7297: refer to the last of the insns being matched; use @code{PREV_INSN} to find
1.1.1.8   root     7298: the preceding insns (but be careful to skip over any @code{note} insns that
1.1       root     7299: intervene).@refill
                   7300: 
                   7301: When optimizing computations with intermediate results, you can use
                   7302: @var{condition} to match only when the intermediate results are not used
                   7303: elsewhere.  Use the C expression @code{dead_or_set_p (@var{insn},
                   7304: @var{op})}, where @var{insn} is the insn in which you expect the value to
                   7305: be used for the last time (from the value of @code{insn}, together with use
                   7306: of @code{PREV_INSN}), and @var{op} is the intermediate value (from
                   7307: @code{operands[@var{i}]}).@refill
                   7308: 
1.1.1.5   root     7309: Applying the optimization means replacing the sequence of insns with one
                   7310: new insn.  The @var{template} controls ultimate output of assembler code
                   7311: for this combined insn.  It works exactly like the template of a
                   7312: @code{define_insn}.  Operand numbers in this template are the same ones
                   7313: used in matching the original sequence of insns.
1.1       root     7314: 
                   7315: The result of a defined peephole optimizer does not need to match any of
1.1.1.5   root     7316: the insn patterns in the machine description; it does not even have an
                   7317: opportunity to match them.  The peephole optimizer definition itself serves
                   7318: as the insn pattern to control how the insn is output.
                   7319: 
                   7320: Defined peephole optimizers are run as assembler code is being output,
                   7321: so the insns they produce are never combined or rearranged in any way.
1.1       root     7322: 
                   7323: Here is an example, taken from the 68000 machine description:
                   7324: 
                   7325: @example
                   7326: (define_peephole
                   7327:   [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
                   7328:    (set (match_operand:DF 0 "register_operand" "f")
                   7329:         (match_operand:DF 1 "register_operand" "ad"))]
                   7330:   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
                   7331:   "*
                   7332: @{
                   7333:   rtx xoperands[2];
                   7334:   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
                   7335: #ifdef MOTOROLA
                   7336:   output_asm_insn (\"move.l %1,(sp)\", xoperands);
                   7337:   output_asm_insn (\"move.l %1,-(sp)\", operands);
                   7338:   return \"fmove.d (sp)+,%0\";
                   7339: #else
                   7340:   output_asm_insn (\"movel %1,sp@@\", xoperands);
                   7341:   output_asm_insn (\"movel %1,sp@@-\", operands);
                   7342:   return \"fmoved sp@@+,%0\";
                   7343: #endif
                   7344: @}
                   7345: ")
                   7346: @end example
                   7347: 
                   7348: The effect of this optimization is to change
                   7349: 
                   7350: @example
                   7351: jbsr _foobar
                   7352: addql #4,sp
                   7353: movel d1,sp@@-
                   7354: movel d0,sp@@-
                   7355: fmoved sp@@+,fp0
                   7356: @end example
                   7357: 
                   7358: @noindent
                   7359: into
                   7360: 
                   7361: @example
                   7362: jbsr _foobar
                   7363: movel d1,sp@@
                   7364: movel d0,sp@@-
                   7365: fmoved sp@@+,fp0
                   7366: @end example
                   7367: 
1.1.1.5   root     7368: @ignore
                   7369: If a peephole matches a sequence including one or more jump insns, you must
                   7370: take account of the flags such as @code{CC_REVERSED} which specify that the
                   7371: condition codes are represented in an unusual manner.  The compiler
                   7372: automatically alters any ordinary conditional jumps which occur in such
                   7373: situations, but the compiler cannot alter jumps which have been replaced by
                   7374: peephole optimizations.  So it is up to you to alter the assembler code
                   7375: that the peephole produces.  Supply C code to write the assembler output,
                   7376: and in this C code check the condition code status flags and change the
                   7377: assembler code as appropriate.
                   7378: @end ignore
                   7379: 
1.1.1.8   root     7380: @var{insn-pattern-1} and so on look @emph{almost} like the second
                   7381: operand of @code{define_insn}.  There is one important difference: the
                   7382: second operand of @code{define_insn} consists of one or more RTX's
                   7383: enclosed in square brackets.  Usually, there is only one: then the same
                   7384: action can be written as an element of a @code{define_peephole}.  But
                   7385: when there are multiple actions in a @code{define_insn}, they are
                   7386: implicitly enclosed in a @code{parallel}.  Then you must explicitly
                   7387: write the @code{parallel}, and the square brackets within it, in the
                   7388: @code{define_peephole}.  Thus, if an insn pattern looks like this,
                   7389: 
                   7390: @example
                   7391: (define_insn "divmodsi4"
                   7392:   [(set (match_operand:SI 0 "general_operand" "=d")
                   7393:         (div:SI (match_operand:SI 1 "general_operand" "0")
                   7394:                 (match_operand:SI 2 "general_operand" "dmsK")))
                   7395:    (set (match_operand:SI 3 "general_operand" "=d")
                   7396:         (mod:SI (match_dup 1) (match_dup 2)))]
                   7397:   "TARGET_68020"
                   7398:   "divsl%.l %2,%3:%0")
                   7399: @end example
                   7400: 
                   7401: @noindent
                   7402: then the way to mention this insn in a peephole is as follows:
                   7403: 
                   7404: @example
                   7405: (define_peephole
                   7406:   [@dots{}
                   7407:    (parallel
                   7408:     [(set (match_operand:SI 0 "general_operand" "=d")
                   7409:           (div:SI (match_operand:SI 1 "general_operand" "0")
                   7410:                   (match_operand:SI 2 "general_operand" "dmsK")))
                   7411:      (set (match_operand:SI 3 "general_operand" "=d")
                   7412:           (mod:SI (match_dup 1) (match_dup 2)))])
                   7413:    @dots{}]
                   7414:   @dots{})
                   7415: @end example
                   7416: 
1.1       root     7417: @node Expander Definitions,, Peephole Definitions, Machine Desc
                   7418: @section Defining RTL Sequences for Code Generation
                   7419: 
                   7420: On some target machines, some standard pattern names for RTL generation
                   7421: cannot be handled with single insn, but a sequence of RTL insns can
                   7422: represent them.  For these target machines, you can write a
1.1.1.8   root     7423: @code{define_expand} to specify how to generate the sequence of RTL.
1.1       root     7424: 
1.1.1.8   root     7425: A @code{define_expand} is an RTL expression that looks almost like a
                   7426: @code{define_insn}; but, unlike the latter, a @code{define_expand} is used
1.1       root     7427: only for RTL generation and it can produce more than one RTL insn.
                   7428: 
1.1.1.8   root     7429: A @code{define_expand} RTX has four operands:
1.1       root     7430: 
                   7431: @itemize @bullet
                   7432: @item
1.1.1.8   root     7433: The name.  Each @code{define_expand} must have a name, since the only
1.1       root     7434: use for it is to refer to it by name.
                   7435: 
                   7436: @item
                   7437: The RTL template.  This is just like the RTL template for a
1.1.1.8   root     7438: @code{define_peephole} in that it is a vector of RTL expressions
1.1       root     7439: each being one insn.
                   7440: 
                   7441: @item
                   7442: The condition, a string containing a C expression.  This expression is
                   7443: used to express how the availability of this pattern depends on
                   7444: subclasses of target machine, selected by command-line options when
                   7445: GNU CC is run.  This is just like the condition of a
1.1.1.8   root     7446: @code{define_insn} that has a standard name.
1.1       root     7447: 
                   7448: @item
                   7449: The preparation statements, a string containing zero or more C
                   7450: statements which are to be executed before RTL code is generated from
                   7451: the RTL template.
                   7452: 
                   7453: Usually these statements prepare temporary registers for use as
                   7454: internal operands in the RTL template, but they can also generate RTL
1.1.1.8   root     7455: insns directly by calling routines such as @code{emit_insn}, etc.
1.1       root     7456: Any such insns precede the ones that come from the RTL template.
                   7457: @end itemize
                   7458: 
1.1.1.8   root     7459: Every RTL insn emitted by a @code{define_expand} must match some
                   7460: @code{define_insn} in the machine description.  Otherwise, the compiler
                   7461: will crash when trying to generate code for the insn or trying to optimize
                   7462: it.
                   7463: 
1.1       root     7464: The RTL template, in addition to controlling generation of RTL insns,
                   7465: also describes the operands that need to be specified when this pattern
                   7466: is used.  In particular, it gives a predicate for each operand.
                   7467: 
                   7468: A true operand, which need to be specified in order to generate RTL from
1.1.1.8   root     7469: the pattern, should be described with a @code{match_operand} in its first
1.1       root     7470: occurrence in the RTL template.  This enters information on the operand's
                   7471: predicate into the tables that record such things.  GNU CC uses the
                   7472: information to preload the operand into a register if that is required for
                   7473: valid RTL code.  If the operand is referred to more than once, subsequent
1.1.1.8   root     7474: references should use @code{match_dup}.
1.1       root     7475: 
                   7476: The RTL template may also refer to internal ``operands'' which are
                   7477: temporary registers or labels used only within the sequence made by the
1.1.1.8   root     7478: @code{define_expand}.  Internal operands are substituted into the RTL
                   7479: template with @code{match_dup}, never with @code{match_operand}.  The
1.1       root     7480: values of the internal operands are not passed in as arguments by the
                   7481: compiler when it requests use of this pattern.  Instead, they are computed
                   7482: within the pattern, in the preparation statements.  These statements
                   7483: compute the values and store them into the appropriate elements of
1.1.1.8   root     7484: @code{operands} so that @code{match_dup} can find them.
1.1       root     7485: 
                   7486: There are two special macros defined for use in the preparation statements:
                   7487: @code{DONE} and @code{FAIL}.  Use them with a following semicolon,
                   7488: as a statement.
                   7489: 
                   7490: @table @code
                   7491: @item DONE
                   7492: Use the @code{DONE} macro to end RTL generation for the pattern.  The
                   7493: only RTL insns resulting from the pattern on this occasion will be
                   7494: those already emitted by explicit calls to @code{emit_insn} within the
                   7495: preparation statements; the RTL template will not be generated.
                   7496: 
                   7497: @item FAIL
                   7498: Make the pattern fail on this occasion.  When a pattern fails, it means
                   7499: that the pattern was not truly available.  The calling routines in the
                   7500: compiler will try other strategies for code generation using other patterns.
                   7501: 
                   7502: Failure is currently supported only for binary operations (addition,
                   7503: multiplication, shifting, etc.).
                   7504: 
                   7505: Do not emit any insns explicitly with @code{emit_insn} before failing.
                   7506: @end table
                   7507: 
                   7508: Here is an example, the definition of left-shift for the SPUR chip:
                   7509: 
                   7510: @example
                   7511: (define_expand "ashlsi3"
                   7512:   [(set (match_operand:SI 0 "register_operand" "")
                   7513:         (ashift:SI
                   7514:           (match_operand:SI 1 "register_operand" "")
                   7515:           (match_operand:SI 2 "nonmemory_operand" "")))]
                   7516:   ""
                   7517:   "
                   7518: @{
                   7519:   if (GET_CODE (operands[2]) != CONST_INT
                   7520:       || (unsigned) INTVAL (operands[2]) > 3)
                   7521:     FAIL;
                   7522: @}")
                   7523: @end example
                   7524: 
                   7525: @noindent
1.1.1.8   root     7526: This example uses @code{define_expand} so that it can generate an RTL insn
1.1       root     7527: for shifting when the shift-count is in the supported range of 0 to 3 but
                   7528: fail in other cases where machine insns aren't available.  When it fails,
                   7529: the compiler tries another strategy using different patterns (such as, a
                   7530: library call).
                   7531: 
                   7532: If the compiler were able to handle nontrivial condition-strings in
1.1.1.8   root     7533: patterns with names, then it would be possible to use a
                   7534: @code{define_insn} in that case.  Here is another case (zero-extension
                   7535: on the 68000) which makes more use of the power of @code{define_expand}:
1.1       root     7536: 
                   7537: @example
                   7538: (define_expand "zero_extendhisi2"
                   7539:   [(set (match_operand:SI 0 "general_operand" "")
                   7540:         (const_int 0))
                   7541:    (set (strict_low_part 
                   7542:           (subreg:HI
1.1.1.8   root     7543:             (match_dup 0)
1.1       root     7544:             0))
                   7545:         (match_operand:HI 1 "general_operand" ""))]
                   7546:   ""
                   7547:   "operands[1] = make_safe_from (operands[1], operands[0]);")
                   7548: @end example
                   7549: 
                   7550: @noindent
                   7551: Here two RTL insns are generated, one to clear the entire output operand
                   7552: and the other to copy the input operand into its low half.  This sequence
                   7553: is incorrect if the input operand refers to [the old value of] the output
                   7554: operand, so the preparation statement makes sure this isn't so.  The
                   7555: function @code{make_safe_from} copies the @code{operands[1]} into a
                   7556: temporary register if it refers to @code{operands[0]}.  It does this
                   7557: by emitting another RTL insn.
                   7558: 
                   7559: Finally, a third example shows the use of an internal operand.
1.1.1.8   root     7560: Zero-extension on the SPUR chip is done by @code{and}-ing the result
1.1       root     7561: against a halfword mask.  But this mask cannot be represented by a
1.1.1.8   root     7562: @code{const_int} because the constant value is too large to be legitimate
1.1       root     7563: on this machine.  So it must be copied into a register with
1.1.1.8   root     7564: @code{force_reg} and then the register used in the @code{and}.
1.1       root     7565: 
                   7566: @example
                   7567: (define_expand "zero_extendhisi2"
                   7568:   [(set (match_operand:SI 0 "register_operand" "")
                   7569:         (and:SI (subreg:SI
                   7570:                   (match_operand:HI 1 "register_operand" "")
                   7571:                   0)
                   7572:                 (match_dup 2)))]
                   7573:   ""
                   7574:   "operands[2]
                   7575:      = force_reg (SImode, gen_rtx (CONST_INT,
                   7576:                                    VOIDmode, 65535)); ")
                   7577: @end example
                   7578: 
1.1.1.8   root     7579: @strong{Note:} If the @code{define_expand} is used to serve a standard
                   7580: binary or unary arithmetic operation, then the last insn it generates
                   7581: must not be a @code{code_label}, @code{barrier} or @code{note}.  It must
                   7582: be an @code{insn}, @code{jump_insn} or @code{call_insn}.
                   7583: 
1.1       root     7584: @node Machine Macros, Config, Machine Desc, Top
                   7585: @chapter Machine Description Macros
                   7586: 
                   7587: The other half of the machine description is a C header file conventionally
                   7588: given the name @file{tm-@var{machine}.h}.  The file @file{tm.h} should be a
                   7589: link to it.  The header file @file{config.h} includes @file{tm.h} and most
                   7590: compiler source files include @file{config.h}.
                   7591: 
                   7592: @menu
1.1.1.9 ! root     7593: * Run-time Target::     Defining @samp{-m} options like @samp{-m68000} and @samp{-m68020}.
1.1       root     7594: * Storage Layout::      Defining sizes and alignments of data types.
                   7595: * Registers::           Naming and describing the hardware registers.
                   7596: * Register Classes::    Defining the classes of hardware registers.
                   7597: * Stack Layout::        Defining which way the stack grows and by how much.
                   7598: * Library Names::       Specifying names of subroutines to call automatically.
                   7599: * Addressing Modes::    Defining addressing modes valid for memory operands.
1.1.1.8   root     7600: * Delayed Branch::      Do branches execute the following instruction?
1.1       root     7601: * Condition Code::      Defining how insns update the condition code.
                   7602: * Assembler Format::    Defining how to write insns and pseudo-ops to output.
1.1.1.5   root     7603: * Cross-compilation::   Handling floating point for cross-compilers.
1.1       root     7604: * Misc::                Everything else.
                   7605: @end menu
                   7606: 
                   7607: @node Run-time Target, Storage Layout, Machine Macros, Machine Macros
                   7608: @section Run-time Target Specification
                   7609: 
                   7610: @table @code
                   7611: @item CPP_PREDEFINES
                   7612: Define this to be a string constant containing @samp{-D} options to
                   7613: define the predefined macros that identify this machine and system.
                   7614: These macros will be predefined unless the @samp{-ansi} option is
                   7615: specified.
                   7616: 
1.1.1.4   root     7617: In addition, a parallel set of macros are predefined, whose names are
                   7618: made by appending @samp{__} at the beginning and at the end.  These
                   7619: @samp{__} macros are permitted by the ANSI standard, so they are
                   7620: predefined regardless of whether @samp{-ansi} is specified.
                   7621: 
                   7622: For example, on the Sun, one can use the following value:
1.1       root     7623: 
                   7624: @example
                   7625: "-Dmc68000 -Dsun -Dunix"
                   7626: @end example
                   7627: 
1.1.1.8   root     7628: The result is to define the macros @code{__mc68000__}, @code{__sun__}
                   7629: and @code{__unix__} unconditionally, and the macros @code{mc68000},
                   7630: @code{sun} and @code{unix} provided @samp{-ansi} is not specified.
1.1.1.4   root     7631: 
1.1       root     7632: @item CPP_SPEC
                   7633: A C string constant that tells the GNU CC driver program options to
                   7634: pass to CPP.  It can also specify how to translate options you
                   7635: give to GNU CC into options for GNU CC to pass to the CPP.
                   7636: 
                   7637: Do not define this macro if it does not need to do anything.
                   7638: 
                   7639: @item CC1_SPEC
                   7640: A C string constant that tells the GNU CC driver program options to
                   7641: pass to CC1.  It can also specify how to translate options you
                   7642: give to GNU CC into options for GNU CC to pass to the CC1.
                   7643: 
                   7644: Do not define this macro if it does not need to do anything.
                   7645: 
                   7646: @item extern int target_flags;
                   7647: This declaration should be present.
                   7648: 
                   7649: @item TARGET_@dots{}
                   7650: This series of macros is to allow compiler command arguments to
                   7651: enable or disable the use of optional features of the target machine.
                   7652: For example, one machine description serves both the 68000 and
                   7653: the 68020; a command argument tells the compiler whether it should
                   7654: use 68020-only instructions or not.  This command argument works
                   7655: by means of a macro @code{TARGET_68020} that tests a bit in
                   7656: @code{target_flags}.
                   7657: 
                   7658: Define a macro @code{TARGET_@var{featurename}} for each such option.
                   7659: Its definition should test a bit in @code{target_flags}; for example:
                   7660: 
                   7661: @example
                   7662: #define TARGET_68020 (target_flags & 1)
                   7663: @end example
                   7664: 
                   7665: One place where these macros are used is in the condition-expressions
                   7666: of instruction patterns.  Note how @code{TARGET_68020} appears
                   7667: frequently in the 68000 machine description file, @file{m68k.md}.
                   7668: Another place they are used is in the definitions of the other
                   7669: macros in the @file{tm-@var{machine}.h} file.
                   7670: 
                   7671: @item TARGET_SWITCHES
                   7672: This macro defines names of command options to set and clear
                   7673: bits in @code{target_flags}.  Its definition is an initializer
                   7674: with a subgrouping for each command option.
                   7675: 
                   7676: Each subgrouping contains a string constant, that defines the option
                   7677: name, and a number, which contains the bits to set in
                   7678: @code{target_flags}.  A negative number says to clear bits instead;
                   7679: the negative of the number is which bits to clear.  The actual option
                   7680: name is made by appending @samp{-m} to the specified name.
                   7681: 
                   7682: One of the subgroupings should have a null string.  The number in
                   7683: this grouping is the default value for @code{target_flags}.  Any
                   7684: target options act starting with that value.
                   7685: 
                   7686: Here is an example which defines @samp{-m68000} and @samp{-m68020}
                   7687: with opposite meanings, and picks the latter as the default:
                   7688: 
                   7689: @example
                   7690: #define TARGET_SWITCHES \
                   7691:   @{ @{ "68020", 1@},      \
                   7692:     @{ "68000", -1@},     \
                   7693:     @{ "", 1@}@}
                   7694: @end example
                   7695: 
                   7696: @item OVERRIDE_OPTIONS
                   7697: Sometimes certain combinations of command options do not make sense on
                   7698: a particular target machine.  You can define a macro
                   7699: @code{OVERRIDE_OPTIONS} to take account of this.  This macro, if
                   7700: defined, is executed once just after all the command options have been
                   7701: parsed.
                   7702: @end table
                   7703: 
                   7704: @node Storage Layout, Registers, Run-time Target, Machine Macros
                   7705: @section Storage Layout
                   7706: 
                   7707: Note that the definitions of the macros in this table which are sizes or
                   7708: alignments measured in bits do not need to be constant.  They can be C
                   7709: expressions that refer to static variables, such as the @code{target_flags}.
                   7710: @xref{Run-time Target}.
                   7711: 
                   7712: @table @code
                   7713: @item BITS_BIG_ENDIAN
                   7714: Define this macro if the most significant bit in a byte has the lowest
                   7715: number.  This means that bit-field instructions count from the most
                   7716: significant bit.  If the machine has no bit-field instructions, this
                   7717: macro is irrelevant.
                   7718: 
1.1.1.8   root     7719: This macro does not affect the way structure fields are packed into
                   7720: bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
                   7721: 
1.1       root     7722: @item BYTES_BIG_ENDIAN
                   7723: Define this macro if the most significant byte in a word has the
                   7724: lowest number.
                   7725: 
                   7726: @item WORDS_BIG_ENDIAN
                   7727: Define this macro if, in a multiword object, the most significant
                   7728: word has the lowest number.
                   7729: 
                   7730: @item BITS_PER_UNIT
                   7731: Number of bits in an addressable storage unit (byte); normally 8.
                   7732: 
                   7733: @item BITS_PER_WORD
                   7734: Number of bits in a word; normally 32.
                   7735: 
                   7736: @item UNITS_PER_WORD
                   7737: Number of storage units in a word; normally 4.
                   7738: 
                   7739: @item POINTER_SIZE
                   7740: Width of a pointer, in bits.
                   7741: 
                   7742: @item POINTER_BOUNDARY
                   7743: Alignment required for pointers stored in memory, in bits.
                   7744: 
                   7745: @item PARM_BOUNDARY
1.1.1.7   root     7746: Normal alignment required for function parameters on the stack, in
                   7747: bits.  All stack parameters receive least this much alignment
                   7748: regardless of data type.  On most machines, this is the same as the
                   7749: size of an integer.
                   7750: 
                   7751: @item MAX_PARM_BOUNDARY
                   7752: Largest alignment required for any stack parameters, in bits.  If the
                   7753: data type of the parameter calls for more alignment than
                   7754: @code{PARM_BOUNDARY}, then it is given extra padding up to this limit.
                   7755: 
                   7756: Don't define this macro if it would be equal to @code{PARM_BOUNDARY};
                   7757: in other words, if the alignment of a stack parameter should not
                   7758: depend on its data type (as is the case on most machines).
1.1       root     7759: 
                   7760: @item STACK_BOUNDARY
                   7761: Define this macro if you wish to preserve a certain alignment for
                   7762: the stack pointer at all times.  The definition is a C expression
                   7763: for the desired alignment (measured in bits).
                   7764: 
                   7765: @item FUNCTION_BOUNDARY
                   7766: Alignment required for a function entry point, in bits.
                   7767: 
                   7768: @item BIGGEST_ALIGNMENT
                   7769: Biggest alignment that any data type can require on this machine, in bits.
                   7770: 
1.1.1.8   root     7771: @item CONSTANT_ALIGNMENT (@var{code}, @var{typealign})
                   7772: A C expression to compute the alignment for a constant.  The argument
                   7773: @var{typealign} is the alignment required for the constant's data type.
                   7774: @var{code} is the tree code of the constant itself.
                   7775: 
                   7776: If this macro is not defined, the default is to use @var{typealign}.  If
                   7777: you do define this macro, the value must be a multiple of
                   7778: @var{typealign}.
                   7779: 
                   7780: The purpose of defining this macro is usually to cause string constants
                   7781: to be word aligned so that @file{dhrystone} can be made to run faster.
                   7782: 
1.1       root     7783: @item EMPTY_FIELD_BOUNDARY
                   7784: Alignment in bits to be given to a structure bit field that follows an
                   7785: empty field such as @code{int : 0;}.
                   7786: 
                   7787: @item STRUCTURE_SIZE_BOUNDARY
                   7788: Number of bits which any structure or union's size must be a multiple of.
                   7789: Each structure or union's size is rounded up to a multiple of this.
                   7790: 
                   7791: If you do not define this macro, the default is the same as
                   7792: @code{BITS_PER_UNIT}.
                   7793: 
                   7794: @item STRICT_ALIGNMENT
                   7795: Define this if instructions will fail to work if given data not
                   7796: on the nominal alignment.  If instructions will merely go slower
                   7797: in that case, do not define this macro.
                   7798: 
                   7799: @item PCC_BITFIELD_TYPE_MATTERS
                   7800: Define this if you wish to imitate a certain bizarre behavior pattern
                   7801: of some instances of PCC: a bit field whose declared type is
                   7802: @code{int} has the same effect on the size and alignment of a
                   7803: structure as an actual @code{int} would have.
                   7804: 
                   7805: Just what effect that is in GNU CC depends on other parameters, but on
                   7806: most machines it would force the structure's alignment and size to a
                   7807: multiple of 32 or @code{BIGGEST_ALIGNMENT} bits.
                   7808: 
1.1.1.7   root     7809: @item MAX_FIXED_MODE_SIZE
                   7810: An integer expression for the largest integer machine mode that should
                   7811: actually be used.  All integer machine modes of this size or smaller
                   7812: can be used for structures and unions with the appropriate sizes.
                   7813: 
1.1       root     7814: @item CHECK_FLOAT_VALUE (@var{mode}, @var{value})
                   7815: A C statement to validate the value @var{value} (or type
                   7816: @code{double}) for mode @var{mode}.  This means that you check whether
                   7817: @var{value} fits within the possible range of values for mode
                   7818: @var{mode} on this target machine.  The mode @var{mode} is always
                   7819: @code{SFmode} or @code{DFmode}.
                   7820: 
                   7821: If @var{value} is not valid, you should call @code{error} to print an
                   7822: error message and then assign some valid value to @var{value}.
                   7823: Allowing an invalid value to go through the compiler can produce
                   7824: incorrect assembler code which may even cause Unix assemblers to
                   7825: crash.
                   7826: 
                   7827: This macro need not be defined if there is no work for it to do.
                   7828: @end table
                   7829: 
                   7830: @node Registers, Register Classes, Storage Layout, Machine Macros
                   7831: @section Register Usage
                   7832: 
                   7833: @table @code
                   7834: @item FIRST_PSEUDO_REGISTER
                   7835: Number of hardware registers known to the compiler.  They receive
                   7836: numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
                   7837: pseudo register's number really is assigned the number
                   7838: @code{FIRST_PSEUDO_REGISTER}.
                   7839: 
                   7840: @item FIXED_REGISTERS
                   7841: An initializer that says which registers are used for fixed purposes
                   7842: all throughout the compiled code and are therefore not available for
                   7843: general allocation.  These would include the stack pointer, the frame
                   7844: pointer (except on machines where that can be used as a general
                   7845: register when no frame pointer is needed), the program counter on
                   7846: machines where that is considered one of the addressable registers,
                   7847: and any other numbered register with a standard use.
                   7848: 
                   7849: This information is expressed as a sequence of numbers, separated by
                   7850: commas and surrounded by braces.  The @var{n}th number is 1 if
                   7851: register @var{n} is fixed, 0 otherwise.
                   7852: 
                   7853: The table initialized from this macro, and the table initialized by
                   7854: the following one, may be overridden at run time either automatically,
                   7855: by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
                   7856: the user with the command options @samp{-ffixed-@var{reg}},
                   7857: @samp{-fcall-used-@var{reg}} and @samp{-fcall-saved-@var{reg}}.
                   7858: 
                   7859: @item CALL_USED_REGISTERS
                   7860: Like @code{FIXED_REGISTERS} but has 1 for each register that is
                   7861: clobbered (in general) by function calls as well as for fixed
                   7862: registers.  This macro therefore identifies the registers that are not
                   7863: available for general allocation of values that must live across
                   7864: function calls.
                   7865: 
                   7866: If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
                   7867: automatically saves it on function entry and restores it on function
                   7868: exit, if the register is used within the function.
                   7869: 
1.1.1.6   root     7870: @item DEFAULT_CALLER_SAVES
1.1.1.8   root     7871: Define this macro if function calls on the target machine do not preserve
1.1.1.6   root     7872: any registers; in other words, if @code{CALL_USED_REGISTERS} has 1
                   7873: for all registers.  This macro enables @samp{-fcaller-saves} by default.
                   7874: Eventually that option will be enabled by default on all machines and both
                   7875: the option and this macro will be eliminated.
                   7876: 
1.1       root     7877: @item CONDITIONAL_REGISTER_USAGE
                   7878: Zero or more C statements that may conditionally modify two variables
                   7879: @code{fixed_regs} and @code{call_used_regs} (both of type @code{char
                   7880: []}) after they have been initialized from the two preceding macros.
                   7881: 
                   7882: This is necessary in case the fixed or call-clobbered registers depend
                   7883: on target flags.
                   7884: 
                   7885: You need not define this macro if it has no work to do.
                   7886: 
                   7887: If the usage of an entire class of registers depends on the target
1.1.1.5   root     7888: flags, you may indicate this to GCC by using this macro to modify
1.1       root     7889: @code{fixed_regs} and @code{call_used_regs} to 1 for each of the
1.1.1.5   root     7890: registers in the classes which should not be used by GCC.  Also define
1.1       root     7891: the macro @code{REG_CLASS_FROM_LETTER} to return @code{NO_REGS} if it
                   7892: is called with a letter for a class that shouldn't be used.
                   7893: 
                   7894: (However, if this class is not included in @code{GENERAL_REGS} and all
                   7895: of the insn patterns whose constraints permit this class are
                   7896: controlled by target switches, then GCC will automatically avoid using
                   7897: these registers when the target switches are opposed to them.)
                   7898: 
                   7899: @item OVERLAPPING_REGNO_P (@var{regno})
1.1.1.5   root     7900: If defined, this is a C expression whose value is nonzero if hard
                   7901: register number @var{regno} is an overlapping register.  This means a
                   7902: hard register which overlaps a hard register with a different number.
                   7903: (Such overlap is undesirable, but occasionally it allows a machine to
                   7904: be supported which otherwise could not be.)  This macro must return
                   7905: nonzero for @emph{all} the registers which overlap each other.  GNU CC
                   7906: can use an overlapping register only in certain limited ways.  It can
                   7907: be used for allocation within a basic block, and may be spilled for
                   7908: reloading; that is all.
1.1       root     7909: 
                   7910: If this macro is not defined, it means that none of the hard registers
                   7911: overlap each other.  This is the usual situation.
                   7912: 
                   7913: @item INSN_CLOBBERS_REGNO_P (@var{insn}, @var{regno})
                   7914: If defined, this is a C expression whose value should be nonzero if
                   7915: the insn @var{insn} has the effect of mysteriously clobbering the
                   7916: contents of hard register number @var{regno}.  By ``mysterious'' we
                   7917: mean that the insn's RTL expression doesn't describe such an effect.
                   7918: 
                   7919: If this macro is not defined, it means that no insn clobbers registers
                   7920: mysteriously.  This is the usual situation; all else being equal,
                   7921: it is best for the RTL expression to show all the activity.
                   7922: 
                   7923: @item PRESERVE_DEATH_INFO_REGNO_P (@var{regno})
                   7924: If defined, this is a C expression whose value is nonzero if accurate
                   7925: @code{REG_DEAD} notes are needed for hard register number @var{regno}
                   7926: at the time of outputting the assembler code.  When this is so, a few
                   7927: optimizations that take place after register allocation and could
                   7928: invalidate the death notes are not done when this register is
                   7929: involved.
                   7930: 
1.1.1.8   root     7931: You would arrange to preserve death info for a register when some of the
                   7932: code in the machine description which is executed to write the assembler
                   7933: code looks at the death notes.  This is necessary only when the actual
                   7934: hardware feature which GNU CC thinks of as a register is not actually a
                   7935: register of the usual sort.  (It might, for example, be a hardware
                   7936: stack.)
1.1       root     7937: 
                   7938: If this macro is not defined, it means that no death notes need to be
                   7939: preserved.  This is the usual situation.
                   7940: 
                   7941: @item HARD_REGNO_REGS (@var{regno}, @var{mode})
                   7942: A C expression for the number of consecutive hard registers, starting
                   7943: at register number @var{regno}, required to hold a value of mode
                   7944: @var{mode}.
                   7945: 
                   7946: On a machine where all registers are exactly one word, a suitable
                   7947: definition of this macro is
                   7948: 
                   7949: @example
                   7950: #define HARD_REGNO_NREGS(REGNO, MODE)            \
                   7951:    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1)  \
                   7952:     / UNITS_PER_WORD))
                   7953: @end example
                   7954: 
                   7955: @item HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
                   7956: A C expression that is nonzero if it is permissible to store a value
                   7957: of mode @var{mode} in hard register number @var{regno} (or in several
                   7958: registers starting with that one).  For a machine where all registers
                   7959: are equivalent, a suitable definition is
                   7960: 
                   7961: @example
                   7962: #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
                   7963: @end example
                   7964: 
1.1.1.8   root     7965: It is not necessary for this macro to check for the numbers of fixed
                   7966: registers, because the allocation mechanism considers them to be always
                   7967: occupied.
                   7968: 
                   7969: On some machines, double-precision values must be kept in even/odd
                   7970: register pairs.  The way to implement that is to define this macro
                   7971: to reject odd register numbers for such modes.
                   7972: 
                   7973: GNU CC assumes that it can always move values between registers and
                   7974: (suitably addressed) memory locations.  If it is impossible to move a
                   7975: value of a certain mode between memory and certain registers, then
                   7976: @code{HARD_REGNO_MODE_OK} must not allow this mode in those registers.
1.1       root     7977: 
                   7978: Many machines have special registers for floating point arithmetic.
                   7979: Often people assume that floating point machine modes are allowed only
                   7980: in floating point registers.  This is not true.  Any registers that
                   7981: can hold integers can safely @emph{hold} a floating point machine
                   7982: mode, whether or not floating arithmetic can be done on it in those
                   7983: registers.
                   7984: 
1.1.1.9 ! root     7985: On some machines, though, the converse is true: fixed-point machine
        !          7986: modes may not go in floating registers.  This is true if the floating
        !          7987: registers normalize any value stored in them, because storing a
        !          7988: non-floating value there would garble it.  In this case,
        !          7989: @code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
        !          7990: floating registers.  But if the floating registers do not automatically
        !          7991: normalize, if you can store any bit pattern in one and retrieve it
        !          7992: unchanged without a trap, then any machine mode may go in a floating
        !          7993: register and this macro should say so.
        !          7994: 
        !          7995: The primary significance of special floating registers is rather that
        !          7996: they are the registers acceptable in floating point arithmetic
        !          7997: instructions.  However, this is of no concern to
        !          7998: @code{HARD_REGNO_MODE_OK}.  You handle it by writing the proper
        !          7999: constraints for those instructions.
        !          8000: 
        !          8001: On some machines, the floating registers are especially slow to access,
        !          8002: so that it is better to store a value in a stack frame than in such a
        !          8003: register if floating point arithmetic is not being done.  As long as the
        !          8004: floating registers are not in class @code{GENERAL_REGS}, they will not
        !          8005: be used unless some insn's constraint asks for one.
1.1       root     8006: 
                   8007: @item MODES_TIEABLE_P (@var{mode1}, @var{mode2})
                   8008: A C expression that is nonzero if it is desirable to choose register
                   8009: allocation so as to avoid move instructions between a value of mode
                   8010: @var{mode1} and a value of mode @var{mode2}.
                   8011: 
                   8012: If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
                   8013: @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are ever different
                   8014: for any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1},
                   8015: @var{mode2})} must be zero.
                   8016: 
                   8017: @item PC_REGNUM
                   8018: If the program counter has a register number, define this as that
                   8019: register number.  Otherwise, do not define it.
                   8020: 
                   8021: @item STACK_POINTER_REGNUM
                   8022: The register number of the stack pointer register, which must also be
                   8023: a fixed register according to @code{FIXED_REGISTERS}.  On many
                   8024: machines, the hardware determines which register this is.
                   8025: 
                   8026: @item FRAME_POINTER_REGNUM
                   8027: The register number of the frame pointer register, which is used to
                   8028: access automatic variables in the stack frame.  On some machines, the
                   8029: hardware determines which register this is.  On other machines, you
                   8030: can choose any register you wish for this purpose.
                   8031: 
                   8032: @item FRAME_POINTER_REQUIRED
1.1.1.9 ! root     8033: A C expression which is nonzero if a function must have and use a frame
        !          8034: pointer.  This expression is evaluated twice: at the beginning of
        !          8035: generating RTL, and in the reload pass.  If its value is nonzero at
        !          8036: either time, then the function will have a frame pointer.
        !          8037: 
        !          8038: The expression can in principle examine the current function and decide
        !          8039: according to the facts, but on most machines the constant 0 or the
        !          8040: constant 1 suffices.  Use 0 when the machine allows code to be generated
        !          8041: with no frame pointer, and doing so saves some time or space.  Use 1
        !          8042: when there is no possible advantage to avoiding a frame pointer.
1.1       root     8043: 
1.1.1.5   root     8044: In certain cases, the compiler does not know how to produce valid code
                   8045: without a frame pointer.  The compiler recognizes those cases and
                   8046: automatically gives the function a frame pointer regardless of what
1.1       root     8047: @code{FRAME_POINTER_REQUIRED} says.  You don't need to worry about
                   8048: them.@refill
                   8049: 
                   8050: In a function that does not require a frame pointer, the frame pointer
                   8051: register can be allocated for ordinary usage, unless you mark it as a
                   8052: fixed register.  See @code{FIXED_REGISTERS} for more information.
                   8053: 
                   8054: @item ARG_POINTER_REGNUM
                   8055: The register number of the arg pointer register, which is used to
                   8056: access the function's argument list.  On some machines, this is the
                   8057: same as the frame pointer register.  On some machines, the hardware
                   8058: determines which register this is.  On other machines, you can choose
                   8059: any register you wish for this purpose.  If this is not the same
                   8060: register as the frame pointer register, then you must mark it as a
                   8061: fixed register according to @code{FIXED_REGISTERS}.
                   8062: 
                   8063: @item STATIC_CHAIN_REGNUM
                   8064: The register number used for passing a function's static chain
                   8065: pointer.  This is needed for languages such as Pascal and Algol where
                   8066: functions defined within other functions can access the local
                   8067: variables of the outer functions; it is not currently used because C
                   8068: does not provide this feature, but you must define the macro.
                   8069: 
                   8070: The static chain register need not be a fixed register.
                   8071: 
                   8072: @item STRUCT_VALUE_REGNUM
                   8073: When a function's value's mode is @code{BLKmode}, the value is not
                   8074: returned according to @code{FUNCTION_VALUE}.  Instead, the caller
                   8075: passes the address of a block of memory in which the value should be
                   8076: stored.
                   8077: 
                   8078: If this value is passed in a register, then @code{STRUCT_VALUE_REGNUM}
                   8079: should be the number of that register.
                   8080: 
                   8081: @item STRUCT_VALUE
                   8082: If the structure value address is not passed in a register, define
                   8083: @code{STRUCT_VALUE} as an expression returning an RTX for the place
1.1.1.8   root     8084: where the address is passed.  If it returns a @code{mem} RTX, the
1.1       root     8085: address is passed as an ``invisible'' first argument.
                   8086: 
                   8087: @item STRUCT_VALUE_INCOMING_REGNUM
                   8088: On some architectures the place where the structure value address
                   8089: is found by the called function is not the same place that the
                   8090: caller put it.  This can be due to register windows, or it could
                   8091: be because the function prologue moves it to a different place.
                   8092: 
                   8093: If the incoming location of the structure value address is in a
                   8094: register, define this macro as the register number.
                   8095: 
                   8096: @item STRUCT_VALUE_INCOMING
                   8097: If the incoming location is not a register, define
                   8098: @code{STRUCT_VALUE_INCOMING} as an expression for an RTX for where the
                   8099: called function should find the value.  If it should find the value on
1.1.1.8   root     8100: the stack, define this to create a @code{mem} which refers to the
                   8101: frame pointer.  If the value is a @code{mem}, the compiler assumes it
1.1       root     8102: is for an invisible first argument, and leaves space for it when
                   8103: finding the first real argument.
                   8104: 
                   8105: @item REG_ALLOC_ORDER
                   8106: If defined, an initializer for a vector of integers, containing the
                   8107: numbers of hard registers in the order in which the GNU CC should
                   8108: prefer to use them (from most preferred to least).
                   8109: 
                   8110: If this macro is not defined, registers are used lowest numbered first
                   8111: (all else being equal).
                   8112: 
                   8113: One use of this macro is on the 360, where the highest numbered
                   8114: registers must always be saved and the save-multiple-registers
                   8115: instruction supports only sequences of consecutive registers.  This
                   8116: macro is defined to cause the highest numbered allocatable registers
                   8117: to be used first.
                   8118: @end table
                   8119: 
                   8120: @node Register Classes, Stack Layout, Registers, Machine Macros
                   8121: @section Register Classes
                   8122: 
                   8123: On many machines, the numbered registers are not all equivalent.
                   8124: For example, certain registers may not be allowed for indexed addressing;
                   8125: certain registers may not be allowed in some instructions.  These machine
                   8126: restrictions are described to the compiler using @dfn{register classes}.
                   8127: 
                   8128: You define a number of register classes, giving each one a name and saying
                   8129: which of the registers belong to it.  Then you can specify register classes
                   8130: that are allowed as operands to particular instruction patterns.
                   8131: 
                   8132: In general, each register will belong to several classes.  In fact, one
                   8133: class must be named @code{ALL_REGS} and contain all the registers.  Another
                   8134: class must be named @code{NO_REGS} and contain no registers.  Often the
                   8135: union of two classes will be another class; however, this is not required.
                   8136: 
                   8137: One of the classes must be named @code{GENERAL_REGS}.  There is nothing
                   8138: terribly special about the name, but the operand constraint letters
                   8139: @samp{r} and @samp{g} specify this class.  If @code{GENERAL_REGS} is
                   8140: the same as @code{ALL_REGS}, just define it as a macro which expands
                   8141: to @code{ALL_REGS}.
                   8142: 
                   8143: The way classes other than @code{GENERAL_REGS} are specified in operand
                   8144: constraints is through machine-dependent operand constraint letters.
                   8145: You can define such letters to correspond to various classes, then use
                   8146: them in operand constraints.
                   8147: 
                   8148: You should define a class for the union of two classes whenever some
                   8149: instruction allows both classes.  For example, if an instruction allows
                   8150: either a floating-point (coprocessor) register or a general register for a
                   8151: certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
                   8152: which includes both of them.  Otherwise you will get suboptimal code.
                   8153: 
                   8154: You must also specify certain redundant information about the register
                   8155: classes: for each class, which classes contain it and which ones are
                   8156: contained in it; for each pair of classes, the largest class contained
                   8157: in their union.
                   8158: 
1.1.1.8   root     8159: When a value occupying several consecutive registers is expected in a
                   8160: certain class, all the registers used must belong to that class.
                   8161: Therefore, register classes cannot be used to enforce a requirement for
                   8162: a register pair to start with an even-numbered register.  The way to
                   8163: specify this requirement is with @code{HARD_REGNO_MODE_OK}.
                   8164: 
1.1       root     8165: Register classes used for input-operands of bitwise-and or shift
                   8166: instructions have a special requirement: each such class must have, for
                   8167: each fixed-point machine mode, a subclass whose registers can transfer that
                   8168: mode to or from memory.  For example, on some machines, the operations for
                   8169: single-byte values (@code{QImode}) are limited to certain registers.  When
                   8170: this is so, each register class that is used in a bitwise-and or shift
                   8171: instruction must have a subclass consisting of registers from which
                   8172: single-byte values can be loaded or stored.  This is so that
                   8173: @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
                   8174: 
                   8175: @table @code
                   8176: @item enum reg_class
                   8177: An enumeral type that must be defined with all the register class names
                   8178: as enumeral values.  @code{NO_REGS} must be first.  @code{ALL_REGS}
                   8179: must be the last register class, followed by one more enumeral value,
                   8180: @code{LIM_REG_CLASSES}, which is not a register class but rather
                   8181: tells how many classes there are.
                   8182: 
                   8183: Each register class has a number, which is the value of casting
                   8184: the class name to type @code{int}.  The number serves as an index
                   8185: in many of the tables described below.
                   8186: 
                   8187: @item N_REG_CLASSES
                   8188: The number of distinct register classes, defined as follows:
                   8189: 
                   8190: @example
                   8191: #define N_REG_CLASSES (int) LIM_REG_CLASSES
                   8192: @end example
                   8193: 
                   8194: @item REG_CLASS_NAMES
                   8195: An initializer containing the names of the register classes as C string
                   8196: constants.  These names are used in writing some of the debugging dumps.
                   8197: 
                   8198: @item REG_CLASS_CONTENTS
                   8199: An initializer containing the contents of the register classes, as integers
                   8200: which are bit masks.  The @var{n}th integer specifies the contents of class
                   8201: @var{n}.  The way the integer @var{mask} is interpreted is that
                   8202: register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
                   8203: 
                   8204: When the machine has more than 32 registers, an integer does not suffice.
                   8205: Then the integers are replaced by sub-initializers, braced groupings containing
                   8206: several integers.  Each sub-initializer must be suitable as an initializer
                   8207: for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
                   8208: 
                   8209: @item REGNO_REG_CLASS (@var{regno})
                   8210: A C expression whose value is a register class containing hard register
                   8211: @var{regno}.  In general there is more that one such class; choose a class
                   8212: which is @dfn{minimal}, meaning that no smaller class also contains the
                   8213: register.
                   8214: 
                   8215: @item BASE_REG_CLASS
                   8216: A macro whose definition is the name of the class to which a valid
                   8217: base register must belong.  A base register is one used in an address
                   8218: which is the register value plus a displacement.
                   8219: 
                   8220: @item INDEX_REG_CLASS
                   8221: A macro whose definition is the name of the class to which a valid
                   8222: index register must belong.  An index register is one used in an
                   8223: address where its value is either multiplied by a scale factor or
                   8224: added to another register (as well as added to a displacement).
                   8225: 
                   8226: @item REG_CLASS_FROM_LETTER (@var{char})
                   8227: A C expression which defines the machine-dependent operand constraint
                   8228: letters for register classes.  If @var{char} is such a letter, the
                   8229: value should be the register class corresponding to it.  Otherwise,
                   8230: the value should be @code{NO_REGS}.
                   8231: 
                   8232: @item REGNO_OK_FOR_BASE_P (@var{num})
                   8233: A C expression which is nonzero if register number @var{num} is
                   8234: suitable for use as a base register in operand addresses.  It may be
                   8235: either a suitable hard register or a pseudo register that has been
                   8236: allocated such a hard register.
                   8237: 
                   8238: @item REGNO_OK_FOR_INDEX_P (@var{num})
                   8239: A C expression which is nonzero if register number @var{num} is
                   8240: suitable for use as an index register in operand addresses.  It may be
                   8241: either a suitable hard register or a pseudo register that has been
                   8242: allocated such a hard register.
                   8243: 
                   8244: The difference between an index register and a base register is that
                   8245: the index register may be scaled.  If an address involves the sum of
                   8246: two registers, neither one of them scaled, then either one may be
                   8247: labeled the ``base'' and the other the ``index''; but whichever
                   8248: labeling is used must fit the machine's constraints of which registers
                   8249: may serve in each capacity.  The compiler will try both labelings,
                   8250: looking for one that is valid, and will reload one or both registers
                   8251: only if neither labeling works.
                   8252: 
                   8253: @item PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
                   8254: A C expression that places additional restrictions on the register class
                   8255: to use when it is necessary to copy value @var{x} into a register in class
                   8256: @var{class}.  The value is a register class; perhaps @var{class}, or perhaps
                   8257: another, smaller class.  On many machines, the definition
                   8258: 
                   8259: @example
                   8260: #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
                   8261: @end example
                   8262: 
                   8263: @noindent
                   8264: is safe.
                   8265: 
                   8266: Sometimes returning a more restrictive class makes better code.  For
                   8267: example, on the 68000, when @var{x} is an integer constant that is in range
                   8268: for a @samp{moveq} instruction, the value of this macro is always
                   8269: @code{DATA_REGS} as long as @var{class} includes the data registers.
                   8270: Requiring a data register guarantees that a @samp{moveq} will be used.
                   8271: 
1.1.1.8   root     8272: If @var{x} is a @code{const_double}, by returning @code{NO_REGS}
1.1       root     8273: you can force @var{x} into a memory constant.  This is useful on
                   8274: certain machines where immediate floating values cannot be loaded into
                   8275: certain kinds of registers.
                   8276: 
                   8277: In a shift instruction or a bitwise-and instruction, the mode of @var{x},
                   8278: the value being reloaded, may not be the same as the mode of the
                   8279: instruction's operand.  (They will both be fixed-point modes, however.)  In
                   8280: such a case, @var{class} may not be a safe value to return.  @var{class} is
                   8281: certainly valid for the instruction, but it may not be valid for reloading
                   8282: @var{x}.  This problem can occur on machines such as the 68000 and 80386
                   8283: where some registers can handle full-word values but cannot handle
                   8284: single-byte values.
                   8285: 
                   8286: On such machines, this macro must examine the mode of @var{x} and return a
                   8287: subclass of @var{class} which can handle loads and stores of that mode.  On
                   8288: the 68000, where address registers cannot handle @code{QImode}, if @var{x}
                   8289: has @code{QImode} then you must return @code{DATA_REGS}.  If @var{class} is
                   8290: @code{ADDR_REGS}, then there is no correct value to return; but the shift
                   8291: and bitwise-and instructions don't use @code{ADDR_REGS}, so this fatal case
                   8292: never arises.
                   8293: 
                   8294: @item CLASS_MAX_NREGS (@var{class}, @var{mode})
                   8295: A C expression for the maximum number of consecutive registers
                   8296: of class @var{class} needed to hold a value of mode @var{mode}.
                   8297: 
                   8298: This is closely related to the macro @code{HARD_REGNO_NREGS}.
                   8299: In fact, the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
                   8300: should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno}, @var{mode})}
                   8301: for all @var{regno} values in the class @var{class}.
                   8302: 
                   8303: This macro helps control the handling of multiple-word values
                   8304: in the reload pass.
                   8305: @end table
                   8306: 
                   8307: Two other special macros describe which constants fit which constraint
                   8308: letters.
                   8309: 
                   8310: @table @code
                   8311: @item CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
                   8312: A C expression that defines the machine-dependent operand constraint letters
                   8313: that specify particular ranges of integer values.  If @var{c} is one
                   8314: of those letters, the expression should check that @var{value}, an integer,
                   8315: is in the appropriate range and return 1 if so, 0 otherwise.  If @var{c} is
                   8316: not one of those letters, the value should be 0 regardless of @var{value}.
                   8317: 
                   8318: @item CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
                   8319: A C expression that defines the machine-dependent operand constraint
                   8320: letters that specify particular ranges of floating values.  If @var{c} is
                   8321: one of those letters, the expression should check that @var{value}, an RTX
1.1.1.8   root     8322: of code @code{const_double}, is in the appropriate range and return 1 if
1.1       root     8323: so, 0 otherwise.  If @var{c} is not one of those letters, the value should
                   8324: be 0 regardless of @var{value}.
                   8325: @end table
                   8326: 
                   8327: @node Stack Layout, Library Names, Register Classes, Machine Macros
                   8328: @section Describing Stack Layout
                   8329: 
                   8330: @table @code
                   8331: @item STACK_GROWS_DOWNWARD
                   8332: Define this macro if pushing a word onto the stack moves the stack
                   8333: pointer to a smaller address.
                   8334: 
                   8335: When we say, ``define this macro if @dots{},'' it means that the
                   8336: compiler checks this macro only with @code{#ifdef} so the precise
                   8337: definition used does not matter.
                   8338: 
                   8339: @item FRAME_GROWS_DOWNWARD
                   8340: Define this macro if the addresses of local variable slots are at negative
                   8341: offsets from the frame pointer.
                   8342: 
                   8343: @item STARTING_FRAME_OFFSET
                   8344: Offset from the frame pointer to the first local variable slot to be allocated.
                   8345: 
                   8346: If @code{FRAME_GROWS_DOWNWARD}, the next slot's offset is found by
                   8347: subtracting the length of the first slot from @code{STARTING_FRAME_OFFSET}.
                   8348: Otherwise, it is found by adding the length of the first slot to
                   8349: the value @code{STARTING_FRAME_OFFSET}.
                   8350: 
                   8351: @item PUSH_ROUNDING (@var{npushed})
                   8352: A C expression that is the number of bytes actually pushed onto the
                   8353: stack when an instruction attempts to push @var{npushed} bytes.
                   8354: 
                   8355: If the target machine does not have a push instruction, do not define
                   8356: this macro.  That directs GNU CC to use an alternate strategy: to
                   8357: allocate the entire argument block and then store the arguments into
                   8358: it.
                   8359: 
                   8360: On some machines, the definition
                   8361: 
                   8362: @example
                   8363: #define PUSH_ROUNDING(BYTES) (BYTES)
                   8364: @end example
                   8365: 
                   8366: @noindent
                   8367: will suffice.  But on other machines, instructions that appear
                   8368: to push one byte actually push two bytes in an attempt to maintain
                   8369: alignment.  Then the definition should be
                   8370: 
                   8371: @example
                   8372: #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
                   8373: @end example
                   8374: 
                   8375: @item FIRST_PARM_OFFSET (@var{fundecl})
                   8376: Offset from the argument pointer register to the first argument's
                   8377: address.  On some machines it may depend on the data type of the
                   8378: function.  (In the next version of GNU CC, the argument will be
                   8379: changed to the function data type rather than its declaration.)
                   8380: 
                   8381: @item FIRST_PARM_CALLER_OFFSET (@var{fundecl})
                   8382: Define this macro on machines where register parameters have shadow
                   8383: locations on the stack, at addresses below the nominal parameter.
                   8384: This matters because certain arguments cannot be passed on the stack.
                   8385: On these machines, such arguments must be stored into the shadow
                   8386: locations.
                   8387: 
                   8388: This macro should expand into a C expression whose value is the offset
                   8389: of the first parameter's shadow location from the nominal stack
                   8390: pointer value.  (That value is itself computed by adding the value of
                   8391: @code{STACK_POINTER_OFFSET} to the stack pointer register.)
                   8392: 
1.1.1.9 ! root     8393: @item REG_PARM_STACK_SPACE
        !          8394: Define this macro if functions should assume that stack space has been
        !          8395: allocated for arguments even when their values are passed in
        !          8396: registers.
        !          8397: 
        !          8398: The actual allocation of such space would be done either by
        !          8399: the call instruction or by the function prologue, or by
        !          8400: defining FIRST_PARM_CALLER_OFFSET.
        !          8401: 
1.1.1.6   root     8402: @item STACK_ARGS_ADJUST (@var{size})
                   8403: Define this macro if the machine requires padding on the stack for
                   8404: certain function calls.  This is padding on a per-function-call basis,
                   8405: not padding for individual arguments.
                   8406: 
1.1.1.7   root     8407: The argument @var{size} will be a C variable of type @code{struct
                   8408: arg_data} which contains two fields, an integer named @code{constant}
                   8409: and an RTX named @code{var}.  These together represent a size measured
                   8410: in bytes which is the sum of the integer and the RTX.  Most of the
                   8411: time @code{var} is 0, which means that the size is simply the integer.
                   8412: 
                   8413: The definition should be a C statement or compound statement
                   8414: which alters the variable supplied in whatever way you wish.
                   8415: 
                   8416: Note that the value you leave in the variable @code{size} will
                   8417: ultimately be rounded up to a multiple of @code{STACK_BOUNDARY} bits.
                   8418: 
                   8419: This macro is not fully implemented for machines which have push
                   8420: instructions (i.e., on which @code{PUSH_ROUNDING} is defined).
1.1.1.6   root     8421: 
1.1       root     8422: @item RETURN_POPS_ARGS (@var{funtype})
                   8423: A C expression that should be 1 if a function pops its own arguments
                   8424: on returning, or 0 if the function pops no arguments and the caller
                   8425: must therefore pop them all after the function returns.
                   8426: 
                   8427: @var{funtype} is a C variable whose value is a tree node that
                   8428: describes the function in question.  Normally it is a node of type
                   8429: @code{FUNCTION_TYPE} that describes the data type of the function.
                   8430: From this it is possible to obtain the data types of the value and
                   8431: arguments (if known).
                   8432: 
                   8433: When a call to a library function is being considered, @var{funtype}
                   8434: will contain an identifier node for the library function.  Thus, if
                   8435: you need to distinguish among various library functions, you can do so
                   8436: by their names.  Note that ``library function'' in this context means
                   8437: a function used to perform arithmetic, whose name is known specially
                   8438: in the compiler and was not mentioned in the C code being compiled.
                   8439: 
                   8440: On the Vax, all functions always pop their arguments, so the
                   8441: definition of this macro is 1.  On the 68000, using the standard
                   8442: calling convention, no functions pop their arguments, so the value of
                   8443: the macro is always 0 in this case.  But an alternative calling
                   8444: convention is available in which functions that take a fixed number of
                   8445: arguments pop them but other functions (such as @code{printf}) pop
                   8446: nothing (the caller pops all).  When this convention is in use,
                   8447: @var{funtype} is examined to determine whether a function takes a
                   8448: fixed number of arguments.
                   8449: 
                   8450: @item FUNCTION_VALUE (@var{valtype}, @var{func})
                   8451: A C expression to create an RTX representing the place where a
                   8452: function returns a value of data type @var{valtype}.  @var{valtype} is
                   8453: a tree node representing a data type.  Write @code{TYPE_MODE
                   8454: (@var{valtype})} to get the machine mode used to represent that type.
                   8455: On many machines, only the mode is relevant.  (Actually, on most
                   8456: machines, scalar values are returned in the same place regardless of
                   8457: mode).@refill
                   8458: 
                   8459: If the precise function being called is known, @var{func} is a tree
                   8460: node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
                   8461: pointer.  This makes it possible to use a different value-returning
                   8462: convention for specific functions when all their calls are
                   8463: known.@refill
                   8464: 
                   8465: @item FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
                   8466: Define this macro if the target machine has ``register windows''
                   8467: so that the register in which a function returns its value is not
                   8468: the same as the one in which the caller sees the value.
                   8469: 
                   8470: For such machines, @code{FUNCTION_VALUE} computes the register in
                   8471: which the caller will see the value, and
                   8472: @code{FUNCTION_OUTGOING_VALUE} should be defined in a similar fashion
                   8473: to tell the function where to put the value.@refill
                   8474: 
                   8475: If @code{FUNCTION_OUTGOING_VALUE} is not defined,
                   8476: @code{FUNCTION_VALUE} serves both purposes.@refill
                   8477: 
1.1.1.7   root     8478: @item RETURN_IN_MEMORY (@var{type})
                   8479: A C expression which can inhibit the returning of certain function
                   8480: values in registers, based on the type of value.  A nonzero value says
                   8481: to return the function value in memory, just as large structures are
                   8482: always returned.  Here @var{type} will be a C expression of type
                   8483: @code{tree}, representing the data type of the value.
                   8484: 
                   8485: Note that values of mode @code{BLKmode} are returned in memory
                   8486: regardless of this macro.  Also, the option @samp{-fpcc-struct-return}
                   8487: takes effect regardless of this macro.  On most systems, it is
                   8488: possible to leave the macro undefined; this causes a default
                   8489: definition to be used, whose value is the constant 0.
                   8490: 
1.1       root     8491: @item LIBCALL_VALUE (@var{mode})
                   8492: A C expression to create an RTX representing the place where a library
                   8493: function returns a value of mode @var{mode}.  If the precise function
                   8494: being called is known, @var{func} is a tree node
                   8495: (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
                   8496: pointer.  This makes it possible to use a different value-returning
                   8497: convention for specific functions when all their calls are
                   8498: known.@refill
                   8499: 
                   8500: Note that ``library function'' in this context means a compiler
                   8501: support routine, used to perform arithmetic, whose name is known
                   8502: specially by the compiler and was not mentioned in the C code being
                   8503: compiled.
                   8504: 
                   8505: @item FUNCTION_VALUE_REGNO_P (@var{regno})
                   8506: A C expression that is nonzero if @var{regno} is the number of a hard
                   8507: register in which the values of called function may come back.
                   8508: 
                   8509: A register whose use for returning values is limited to serving as the
                   8510: second of a pair (for a value of type @code{double}, say) need not be
                   8511: recognized by this macro.  So for most machines, this definition
                   8512: suffices:
                   8513: 
                   8514: @example
                   8515: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
                   8516: @end example
                   8517: 
                   8518: If the machine has register windows, so that the caller and the called
                   8519: function use different registers for the return value, this macro
                   8520: should recognize only the caller's register numbers.
                   8521: 
                   8522: @item FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
                   8523: A C expression that controls whether a function argument is passed
                   8524: in a register, and which register.
                   8525: 
                   8526: The arguments are @var{cum}, which summarizes all the previous
                   8527: arguments; @var{mode}, the machine mode of the argument; @var{type},
                   8528: the data type of the argument as a tree node or 0 if that is not known
                   8529: (which happens for C support library functions); and @var{named},
                   8530: which is 1 for an ordinary argument and 0 for nameless arguments that
1.1.1.8   root     8531: correspond to @samp{@dots{}} in the called function's prototype.
1.1       root     8532: 
1.1.1.8   root     8533: The value of the expression should either be a @code{reg} RTX for the
1.1       root     8534: hard register in which to pass the argument, or zero to pass the
                   8535: argument on the stack.
                   8536: 
                   8537: For the Vax and 68000, where normally all arguments are pushed, zero
                   8538: suffices as a definition.
                   8539: 
1.1.1.8   root     8540: The usual way to make the ANSI library @file{stdarg.h} work on a machine
                   8541: where some arguments are usually passed in registers, is to cause
                   8542: nameless arguments to be passed on the stack instead.  This is done
                   8543: by making @code{FUNCTION_ARG} return 0 whenever @var{named} is 0.
                   8544: 
1.1       root     8545: @item FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
                   8546: Define this macro if the target machine has ``register windows'', so
                   8547: that the register in which a function sees an arguments is not
                   8548: necessarily the same as the one in which the caller passed the
                   8549: argument.
                   8550: 
                   8551: For such machines, @code{FUNCTION_ARG} computes the register in which
                   8552: the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
                   8553: be defined in a similar fashion to tell the function being called
                   8554: where the arguments will arrive.
                   8555: 
                   8556: If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
                   8557: serves both purposes.@refill
                   8558: 
                   8559: @item FUNCTION_ARG_PARTIAL_NREGS (@var{cum}, @var{mode}, @var{type}, @var{named})
                   8560: A C expression for the number of words, at the beginning of an
                   8561: argument, must be put in registers.  The value must be zero for
                   8562: arguments that are passed entirely in registers or that are entirely
                   8563: pushed on the stack.
                   8564: 
                   8565: On some machines, certain arguments must be passed partially in
                   8566: registers and partially in memory.  On these machines, typically the
                   8567: first @var{n} words of arguments are passed in registers, and the rest
                   8568: on the stack.  If a multi-word argument (a @code{double} or a
                   8569: structure) crosses that boundary, its first few words must be passed
                   8570: in registers and the rest must be pushed.  This macro tells the
                   8571: compiler when this occurs, and how many of the words should go in
                   8572: registers.
                   8573: 
                   8574: @code{FUNCTION_ARG} for these arguments should return the first
                   8575: register to be used by the caller for this argument; likewise
                   8576: @code{FUNCTION_INCOMING_ARG}, for the called function.
                   8577: 
                   8578: @item CUMULATIVE_ARGS
                   8579: A C type for declaring a variable that is used as the first argument
                   8580: of @code{FUNCTION_ARG} and other related values.  For some target
                   8581: machines, the type @code{int} suffices and can hold the number of
                   8582: bytes of argument so far.
                   8583: 
                   8584: @item INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype})
                   8585: A C statement (sans semicolon) for initializing the variable @var{cum}
                   8586: for the state at the beginning of the argument list.  The variable has
                   8587: type @code{CUMULATIVE_ARGS}.  The value of @var{fntype} is the tree node
                   8588: for the data type of the function which will receive the args, or 0
                   8589: if the args are to a compiler support library function.
                   8590: 
                   8591: @item FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
1.1.1.7   root     8592: A C statement (sans semicolon) to update the summarizer variable
                   8593: @var{cum} to advance past an argument in the argument list.  The
                   8594: values @var{mode}, @var{type} and @var{named} describe that argument.
                   8595: Once this is done, the variable @var{cum} is suitable for analyzing
                   8596: the @emph{following} argument with @code{FUNCTION_ARG}, etc.@refill
1.1       root     8597: 
                   8598: @item FUNCTION_ARG_REGNO_P (@var{regno})
                   8599: A C expression that is nonzero if @var{regno} is the number of a hard
                   8600: register in which function arguments are sometimes passed.  This does
                   8601: @emph{not} include implicit arguments such as the static chain and
                   8602: the structure-value address.  On many machines, no registers can be
                   8603: used for this purpose since all function arguments are pushed on the
                   8604: stack.
                   8605: 
                   8606: @item FUNCTION_ARG_PADDING (@var{mode}, @var{size})
                   8607: If defined, a C expression which determines whether, and in which direction,
                   8608: to pad out an argument with extra space.  The value should be of type
                   8609: @code{enum direction}: either @code{upward} to pad above the argument,
                   8610: @code{downward} to pad below, or @code{none} to inhibit padding.
                   8611: 
                   8612: The argument @var{size} is an RTX which describes the size of the
                   8613: argument, in bytes.  It should be used only if @var{mode} is
                   8614: @code{BLKmode}.  Otherwise, @var{size} is 0.
                   8615: 
                   8616: This macro does not control the @emph{amount} of padding; that is
                   8617: always just enough to reach the next multiple of @code{PARM_BOUNDARY}.
                   8618: 
                   8619: This macro has a default definition which is right for most systems.
                   8620: For little-endian machines, the default is to pad upward.  For
                   8621: big-endian machines, the default is to pad downward for an argument of
                   8622: constant size shorter than an @code{int}, and upward otherwise.
                   8623: 
                   8624: @item FUNCTION_PROLOGUE (@var{file}, @var{size})
                   8625: A C compound statement that outputs the assembler code for entry to a
                   8626: function.  The prologue is responsible for setting up the stack frame,
                   8627: initializing the frame pointer register, saving registers that must be
                   8628: saved, and allocating @var{size} additional bytes of storage for the
                   8629: local variables.  @var{size} is an integer.  @var{file} is a stdio
                   8630: stream to which the assembler code should be output.
                   8631: 
                   8632: The label for the beginning of the function need not be output by this
                   8633: macro.  That has already been done when the macro is run.
                   8634: 
                   8635: To determine which registers to save, the macro can refer to the array
                   8636: @code{regs_ever_live}: element @var{r} is nonzero if hard register
                   8637: @var{r} is used anywhere within the function.  This implies the
                   8638: function prologue should save register @var{r}, but not if it is one
                   8639: of the call-used registers.
                   8640: 
                   8641: On machines where functions may or may not have frame-pointers, the
                   8642: function entry code must vary accordingly; it must set up the frame
                   8643: pointer if one is wanted, and not otherwise.  To determine whether a
                   8644: frame pointer is in wanted, the macro can refer to the variable
                   8645: @code{frame_pointer_needed}.  The variable's value will be 1 at run
                   8646: time in a function that needs a frame pointer.
                   8647: 
1.1.1.8   root     8648: On machines where arguments may be passed in registers, and not have
                   8649: stack space allocated, this macro must examine the variable
                   8650: @code{current_function_pretend_args_size}, and allocate that many bytes
                   8651: of uninitialized space on the stack just underneath the first argument
                   8652: arriving on the stack.  (This may not be at the very end of the stack,
                   8653: if the calling sequence has pushed anything else since pushing the stack
                   8654: arguments.  But usually, on such machines, nothing else has been pushed
                   8655: yet, because the function prologue itself does all the pushing.)
                   8656: 
                   8657: This ``pretend argument'' space is allocated in functions that use the
                   8658: ANSI library @file{stdarg.h} to accept anonymous arguments of
                   8659: unspecified types; the last named argument is copied into the space, so
                   8660: that the anonymous arguments follow it consecutively.
                   8661: 
1.1       root     8662: @item FUNCTION_PROFILER (@var{file}, @var{labelno})
                   8663: A C statement or compound statement to output to @var{file} some
                   8664: assembler code to call the profiling subroutine @code{mcount}.
                   8665: Before calling, the assembler code must load the address of a
                   8666: counter variable into a register where @code{mcount} expects to
                   8667: find the address.  The name of this variable is @samp{LP} followed
                   8668: by the number @var{labelno}, so you would generate the name using
                   8669: @samp{LP%d} in a @code{fprintf}.
                   8670: 
                   8671: The details of how the address should be passed to @code{mcount} are
                   8672: determined by your operating system environment, not by GNU CC.  To
                   8673: figure them out, compile a small program for profiling using the
                   8674: system's installed C compiler and look at the assembler code that
                   8675: results.
                   8676: 
1.1.1.6   root     8677: @item FUNCTION_BLOCK_PROFILER (@var{file}, @var{labelno})
                   8678: A C statement or compound statement to output to @var{file} some
                   8679: assembler code to initialize basic-block profiling for the current
                   8680: object module.  This code should call the subroutine
                   8681: @code{__bb_init_func} once per object module, passing it as its sole
                   8682: argument the address of a block allocated in the object module.
                   8683: 
                   8684: The name of the block is a local symbol made with this statement:
                   8685: 
                   8686: @example
                   8687: ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
                   8688: @end example
                   8689: 
                   8690: Of course, since you are writing the definition of
                   8691: @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
                   8692: can take a short cut in the definition of this macro and use the name
                   8693: that you know will result.
                   8694: 
                   8695: The first word of this block is a flag which will be nonzero if the
                   8696: object module has already been initialized.  So test this word first,
                   8697: and do not call @code{__bb_init_func} if the flag is nonzero.
                   8698: 
                   8699: @item BLOCK_PROFILER (@var{file}, @var{blockno})
                   8700: A C statement or compound statement to increment the count associated
                   8701: with the basic block number @var{blockno}.  Basic blocks are numbered
                   8702: separately from zero within each compilation.  The count associated
                   8703: with block number @var{blockno} is at index @var{blockno} in a vector
                   8704: of words; the name of this array is a local symbol made with this
                   8705: statement:
                   8706: 
                   8707: @example
                   8708: ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 2);
                   8709: @end example
                   8710: 
                   8711: Of course, since you are writing the definition of
                   8712: @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
                   8713: can take a short cut in the definition of this macro and use the name
                   8714: that you know will result.
                   8715: 
1.1       root     8716: @item EXIT_IGNORES_STACK
                   8717: Define this macro as a C expression that is nonzero if the return
                   8718: instruction or the function epilogue ignores the value of the stack
                   8719: pointer; in other words, if it is safe to delete an instruction to
                   8720: adjust the stack pointer before a return from the function.
                   8721: 
1.1.1.8   root     8722: Note that this macro's value is relevant only for functions for which
                   8723: frame pointers are maintained.  It is never safe to delete a final
                   8724: stack adjustment in a function that has no frame pointer, and the
                   8725: compiler knows this regardless of @code{EXIT_IGNORES_STACK}.
1.1       root     8726: 
                   8727: @item FUNCTION_EPILOGUE (@var{file}, @var{size})
                   8728: A C compound statement that outputs the assembler code for exit from a
                   8729: function.  The epilogue is responsible for restoring the saved
                   8730: registers and stack pointer to their values when the function was
                   8731: called, and returning control to the caller.  This macro takes the
                   8732: same arguments as the macro @code{FUNCTION_PROLOGUE}, and the
                   8733: registers to restore are determined from @code{regs_ever_live} and
                   8734: @code{CALL_USED_REGISTERS} in the same way.
                   8735: 
                   8736: On some machines, there is a single instruction that does all the work
                   8737: of returning from the function.  On these machines, give that
                   8738: instruction the name @samp{return} and do not define the macro
                   8739: @code{FUNCTION_EPILOGUE} at all.
                   8740: 
                   8741: Do not define a pattern named @samp{return} if you want the
                   8742: @code{FUNCTION_EPILOGUE} to be used.  If you want the target switches
                   8743: to control whether return instructions or epilogues are used, define a
                   8744: @samp{return} pattern with a validity condition that tests the target
                   8745: switches appropriately.  If the @samp{return} pattern's validity
                   8746: condition is false, epilogues will be used.
                   8747: 
                   8748: On machines where functions may or may not have frame-pointers, the
                   8749: function exit code must vary accordingly.  Sometimes the code for
                   8750: these two cases is completely different.  To determine whether a frame
                   8751: pointer is in wanted, the macro can refer to the variable
                   8752: @code{frame_pointer_needed}.  The variable's value will be 1 at run
                   8753: time in a function that needs a frame pointer.
                   8754: 
                   8755: On some machines, some functions pop their arguments on exit while
                   8756: others leave that for the caller to do.  For example, the 68020 when
                   8757: given @samp{-mrtd} pops arguments in functions that take a fixed
                   8758: number of arguments.
                   8759: 
                   8760: Your definition of the macro @code{RETURN_POPS_ARGS} decides which
                   8761: functions pop their own arguments.  @code{FUNCTION_EPILOGUE} needs to
                   8762: know what was decided.  The variable @code{current_function_pops_args}
                   8763: is nonzero if the function should pop its own arguments.  If so, use
                   8764: the variable @code{current_function_args_size} as the number of bytes
                   8765: to pop.
                   8766: 
                   8767: @item FIX_FRAME_POINTER_ADDRESS (@var{addr}, @var{depth})
                   8768: A C compound statement to alter a memory address that uses the frame
                   8769: pointer register so that it uses the stack pointer register instead.
                   8770: This must be done in the instructions that load parameter values into
                   8771: registers, when the reload pass determines that a frame pointer is not
                   8772: necessary for the function.  @var{addr} will be a C variable name, and
                   8773: the updated address should be stored in that variable.  @var{depth}
                   8774: will be the current depth of stack temporaries (number of bytes of
                   8775: arguments currently pushed).  The change in offset between a
                   8776: frame-pointer-relative address and a stack-pointer-relative address
                   8777: must include @var{depth}.
                   8778: 
                   8779: Even if your machine description specifies there will always be a
                   8780: frame pointer in the frame pointer register, you must still define
                   8781: @code{FIX_FRAME_POINTER_ADDRESS}, but the definition will never be
                   8782: executed at run time, so it may be empty.
1.1.1.8   root     8783: 
                   8784: @item LONGJMP_RESTORE_FROM_STACK
                   8785: Define this macro if the @code{longjmp} function restores registers
                   8786: from the stack frames, rather than from those saved specifically by
                   8787: @code{setjmp}.  Certain quantities must not be kept in registers
                   8788: across a call to @code{setjmp} on such machines.
1.1       root     8789: @end table
                   8790: 
                   8791: @node Library Names, Addressing Modes, Stack Layout, Machine Macros
                   8792: @section Library Subroutine Names
                   8793: 
                   8794: @table @code
1.1.1.5   root     8795: @item MULSI3_LIBCALL
                   8796: A C string constant giving the name of the function to call for
                   8797: multiplication of one signed full-word by another.  If you do not
                   8798: define this macro, the default name is used, which is @code{__mulsi3},
                   8799: a function defined in @file{gnulib}.
                   8800: 
                   8801: @item UMULSI3_LIBCALL
                   8802: A C string constant giving the name of the function to call for
                   8803: multiplication of one unsigned full-word by another.  If you do not
                   8804: define this macro, the default name is used, which is
                   8805: @code{__umulsi3}, a function defined in @file{gnulib}.
                   8806: 
                   8807: @item DIVSI3_LIBCALL
                   8808: A C string constant giving the name of the function to call for
                   8809: division of one signed full-word by another.  If you do not define
                   8810: this macro, the default name is used, which is @code{__divsi3}, a
                   8811: function defined in @file{gnulib}.
                   8812: 
1.1       root     8813: @item UDIVSI3_LIBCALL
                   8814: A C string constant giving the name of the function to call for
1.1.1.5   root     8815: division of one unsigned full-word by another.  If you do not define
                   8816: this macro, the default name is used, which is @code{__udivsi3}, a
                   8817: function defined in @file{gnulib}.
                   8818: 
                   8819: @item MODSI3_LIBCALL
                   8820: A C string constant giving the name of the function to call for the
                   8821: remainder in division of one signed full-word by another.  If you do
                   8822: not define this macro, the default name is used, which is
                   8823: @code{__modsi3}, a function defined in @file{gnulib}.
1.1       root     8824: 
                   8825: @item UMODSI3_LIBCALL
                   8826: A C string constant giving the name of the function to call for the
1.1.1.5   root     8827: remainder in division of one unsigned full-word by another.  If you do
                   8828: not define this macro, the default name is used, which is
                   8829: @code{__umodsi3}, a function defined in @file{gnulib}.
1.1       root     8830: 
                   8831: @item TARGET_MEM_FUNCTIONS
                   8832: Define this macro if GNU CC should generate calls to the System V
                   8833: (and ANSI C) library functions @code{memcpy} and @code{memset}
                   8834: rather than the BSD functions @code{bcopy} and @code{bzero}.
                   8835: @end table
                   8836: 
1.1.1.8   root     8837: @node Addressing Modes, Delayed Branch, Library Names, Machine Macros
1.1       root     8838: @section Addressing Modes
                   8839: 
                   8840: @table @code
                   8841: @item HAVE_POST_INCREMENT
                   8842: Define this macro if the machine supports post-increment addressing.
                   8843: 
                   8844: @item HAVE_PRE_INCREMENT
                   8845: @itemx HAVE_POST_DECREMENT
                   8846: @itemx HAVE_PRE_DECREMENT
                   8847: Similar for other kinds of addressing.
                   8848: 
                   8849: @item CONSTANT_ADDRESS_P (@var{x})
                   8850: A C expression that is 1 if the RTX @var{x} is a constant whose value
                   8851: is an integer.  This includes integers whose values are not explicitly
1.1.1.8   root     8852: known, such as @code{symbol_ref} and @code{label_ref} expressions and
                   8853: @code{const} arithmetic expressions.
1.1       root     8854: 
                   8855: On most machines, this can be defined as @code{CONSTANT_P (@var{x})},
                   8856: but a few machines are more restrictive in which constant addresses
                   8857: are supported.
                   8858: 
                   8859: @item MAX_REGS_PER_ADDRESS
                   8860: A number, the maximum number of registers that can appear in a valid
                   8861: memory address.
                   8862: 
                   8863: @item GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
                   8864: A C compound statement with a conditional @code{goto @var{label};}
                   8865: executed if @var{x} (an RTX) is a legitimate memory address on the
                   8866: target machine for a memory operand of mode @var{mode}.
                   8867: 
                   8868: It usually pays to define several simpler macros to serve as
                   8869: subroutines for this one.  Otherwise it may be too complicated to
                   8870: understand.
                   8871: 
                   8872: This macro must exist in two variants: a strict variant and a
                   8873: non-strict one.  The strict variant is used in the reload pass.  It
                   8874: must be defined so that any pseudo-register that has not been
                   8875: allocated a hard register is considered a memory reference.  In
                   8876: contexts where some kind of register is required, a pseudo-register
                   8877: with no hard register must be rejected.
                   8878: 
                   8879: The non-strict variant is used in other passes.  It must be defined to
                   8880: accept all pseudo-registers in every context where some kind of
                   8881: register is required.
                   8882: 
                   8883: Compiler source files that want to use the strict variant of this
                   8884: macro define the macro @code{REG_OK_STRICT}.  You should use an
                   8885: @code{#ifdef REG_OK_STRICT} conditional to define the strict variant
                   8886: in that case and the non-strict variant otherwise.
                   8887: 
                   8888: Typically among the subroutines used to define
                   8889: @code{GO_IF_LEGITIMATE_ADDRESS} are subroutines to check for
                   8890: acceptable registers for various purposes (one for base registers, one
                   8891: for index registers, and so on).  Then only these subroutine macros
                   8892: need have two variants; the higher levels of macros may be the same
                   8893: whether strict or not.@refill
                   8894: 
1.1.1.8   root     8895: Normally, constant addresses which are the sum of a @code{symbol_ref}
                   8896: and an integer are stored inside a @code{const} RTX to mark them as
                   8897: constant.  Therefore, there is no need to recognize such sums as
                   8898: legitimate addresses.
                   8899: 
                   8900: Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant
                   8901: sums that are not marked with  @code{const}.  It assumes that a naked
                   8902: @code{plus} indicates indexing.  If so, then you @emph{must} reject such
                   8903: naked constant sums as illegitimate addresses, so that none of them will
                   8904: be given to @code{PRINT_OPERAND_ADDRESS}.@refill
                   8905: 
1.1       root     8906: @item REG_OK_FOR_BASE_P (@var{x})
1.1.1.5   root     8907: A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
1.1       root     8908: RTX) is valid for use as a base register.  For hard registers, it
                   8909: should always accept those which the hardware permits and reject the
                   8910: others.  Whether the macro accepts or rejects pseudo registers must be
                   8911: controlled by @code{REG_OK_STRICT} as described above.  This usually
                   8912: requires two variant definitions, of which @code{REG_OK_STRICT}
                   8913: controls the one actually used.
                   8914: 
                   8915: @item REG_OK_FOR_INDEX_P (@var{x})
1.1.1.5   root     8916: A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
1.1       root     8917: RTX) is valid for use as an index register.
                   8918: 
                   8919: The difference between an index register and a base register is that
                   8920: the index register may be scaled.  If an address involves the sum of
                   8921: two registers, neither one of them scaled, then either one may be
                   8922: labeled the ``base'' and the other the ``index''; but whichever
                   8923: labeling is used must fit the machine's constraints of which registers
                   8924: may serve in each capacity.  The compiler will try both labelings,
                   8925: looking for one that is valid, and will reload one or both registers
                   8926: only if neither labeling works.
                   8927: 
                   8928: @item LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
                   8929: A C compound statement that attempts to replace @var{x} with a valid
                   8930: memory address for an operand of mode @var{mode}.  @var{win} will be a
                   8931: C statement label elsewhere in the code; the macro definition may use
                   8932: 
                   8933: @example
                   8934: GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
                   8935: @end example
                   8936: 
                   8937: @noindent
                   8938: to avoid further processing if the address has become legitimate.
                   8939: 
                   8940: @var{x} will always be the result of a call to @code{break_out_memory_refs},
                   8941: and @var{oldx} will be the operand that was given to that function to produce
                   8942: @var{x}.
                   8943: 
                   8944: The code generated by this macro should not alter the substructure of
                   8945: @var{x}.  If it transforms @var{x} into a more legitimate form, it
                   8946: should assign @var{x} (which will always be a C variable) a new value.
                   8947: 
                   8948: It is not necessary for this macro to come up with a legitimate
                   8949: address.  The compiler has standard ways of doing so in all cases.  In
                   8950: fact, it is safe for this macro to do nothing.  But often a
                   8951: machine-dependent strategy can generate better code.
                   8952: 
                   8953: @item GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
                   8954: A C statement or compound statement with a conditional @code{goto
                   8955: @var{label};} executed if memory address @var{x} (an RTX) can have
                   8956: different meanings depending on the machine mode of the memory
                   8957: reference it is used for.
                   8958: 
                   8959: Autoincrement and autodecrement addresses typically have mode-dependent
                   8960: effects because the amount of the increment or decrement is the size
                   8961: of the operand being addressed.  Some machines have other mode-dependent
                   8962: addresses.  Many RISC machines have no mode-dependent addresses.
                   8963: 
                   8964: You may assume that @var{addr} is a valid address for the machine.
                   8965: 
                   8966: @item LEGITIMATE_CONSTANT_P (@var{x})
                   8967: A C expression that is nonzero if @var{x} is a legitimate constant for
                   8968: an immediate operand on the target machine.  You can assume that
1.1.1.8   root     8969: either @var{x} is a @code{const_double} or it satisfies
1.1       root     8970: @code{CONSTANT_P}, so you need not check these things.  In fact,
                   8971: @samp{1} is a suitable definition for this macro on machines where any
1.1.1.8   root     8972: @code{const_double} is valid and anything @code{CONSTANT_P} is valid.@refill
                   8973: @end table
                   8974: 
                   8975: @node Delayed Branch, Condition Code, Addressing Modes, Machine Macros
                   8976: @section Parameters for Delayed Branch Optimization
                   8977: 
                   8978: @table @code
                   8979: @item HAVE_DELAYED_BRANCH
                   8980: Define this macro if the target machine has delayed branches, that is,
                   8981: a branch does not take effect immediately, and the actual branch
                   8982: instruction may be followed by one or more instructions that will be
                   8983: issued before the PC is actually changed.
                   8984: 
                   8985: If defined, this allows a special scheduling pass to be run after the
                   8986: second jump optimization to attempt to reorder instructions to exploit
                   8987: this.  Defining this macro also requires the definition of certain
                   8988: other macros described below.
                   8989: 
                   8990: @item DBR_SLOTS_AFTER (@var{insn})
                   8991: This macro must be defined if @code{HAVE_DELAYED_BRANCH} is defined.
                   8992: Its definition should be a C expression returning the number of
                   8993: available delay slots following the instruction(s) output by the
                   8994: pattern for @var{insn}.  The definition of ``slot'' is
                   8995: machine-dependent, and may denote instructions, bytes, or whatever.
                   8996: 
                   8997: @item DBR_INSN_SLOTS (@var{insn})
                   8998: This macro must be defined if @code{HAVE_DELAYED_BRANCH} is defined.
                   8999: It should be a C expression returning the number of slots (typically
                   9000: the number of machine instructions) consumed by @var{insn}.
                   9001: 
                   9002: You may assume that @var{insn} is truly an insn, not a note, label,
                   9003: barrier, dispatch table, @code{use}, or @code{clobber}.
                   9004: 
                   9005: @item DBR_INSN_ELIGIBLE_P (@var{insn}, @var{dinsn})
                   9006: A C expression whose value is non-zero if it is legitimate to put
                   9007: @var{insn} in the delay slot following @var{dinsn}.
                   9008: 
                   9009: You do not need to take account of data flow considerations in the
                   9010: definition of this macro, because the delayed branch optimizer always
                   9011: does that.  This macro is needed only when certain insns may not be
                   9012: placed in certain delay slots for reasons not evident from the RTL
                   9013: expressions themselves.  If there are no such problems, you don't need
                   9014: to define this macro.
                   9015: 
                   9016: You may assume that @var{insn} is truly an insn, not a note, label,
                   9017: barrier, dispatch table, @code{use}, or @code{clobber}.  You may
                   9018: assume that @var{dinsn} is a jump insn with a delay slot.
                   9019: 
                   9020: @item DBR_OUTPUT_SEQEND(@var{file})
                   9021: A C statement, to be executed after all slot-filler instructions have
                   9022: been output.  If necessary, call @code{dbr_sequence_length} to
                   9023: determine the number of slots filled in a sequence (zero if not
                   9024: currently outputting a sequence), to decide how many no-ops to output,
                   9025: or whatever.
                   9026: 
                   9027: Don't define this macro if it has nothing to do, but it is helpful in
                   9028: reading assembly output if the extent of the delay sequence is made
                   9029: explicit (e.g. with white space).
                   9030: 
                   9031: Note that output routines for instructions with delay slots must be
                   9032: prepared to deal with not being output as part of a sequence (i.e.
                   9033: when the scheduling pass is not run, or when no slot fillers could be
                   9034: found.)  The variable @code{final_sequence} is null when not
                   9035: processing a sequence, otherwise it contains the @code{sequence} rtx
                   9036: being output.
1.1       root     9037: @end table
                   9038: 
1.1.1.9 ! root     9039: @node Condition Code, Cross-compilation, Delayed Branch, Machine Macros
1.1.1.8   root     9040: @section Condition Code Information
                   9041: 
                   9042: The file @file{conditions.h} defines a variable @code{cc_status} to
                   9043: describe how the condition code was computed (in case the interpretation of
                   9044: the condition code depends on the instruction that it was set by).  This
                   9045: variable contains the RTL expressions on which the condition code is
                   9046: currently based, and several standard flags.
                   9047: 
                   9048: Sometimes additional machine-specific flags must be defined in the machine
                   9049: description header file.  It can also add additional machine-specific
                   9050: information by defining @code{CC_STATUS_MDEP}.
                   9051: 
                   9052: @table @code
                   9053: @item CC_STATUS_MDEP
                   9054: C code for a data type which is used for declaring the @code{mdep}
                   9055: component of @code{cc_status}.  It defaults to @code{int}.
                   9056: 
                   9057: @item CC_STATUS_MDEP_INIT
1.1.1.9 ! root     9058: A C expression to initialize the @code{mdep} field to ``empty''.
        !          9059: The default definition does nothing, since most machines don't use
        !          9060: the field anyway.  If you want to use the field, you should probably
        !          9061: define this macro to initialize it.
1.1.1.8   root     9062: 
                   9063: @item NOTICE_UPDATE_CC (@var{exp}, @var{insn})
                   9064: A C compound statement to set the components of @code{cc_status}
                   9065: appropriately for an insn @var{insn} whose body is @var{exp}.  It is
                   9066: this macro's responsibility to recognize insns that set the condition
                   9067: code as a byproduct of other activity as well as those that explicitly
                   9068: set @code{(cc0)}.
                   9069: 
                   9070: If there are insn that do not set the condition code but do alter
                   9071: other machine registers, this macro must check to see whether they
                   9072: invalidate the expressions that the condition code is recorded as
                   9073: reflecting.  For example, on the 68000, insns that store in address
                   9074: registers do not set the condition code, which means that usually
                   9075: @code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
                   9076: insns.  But suppose that the previous insn set the condition code
                   9077: based on location @samp{a4@@(102)} and the current insn stores a new
                   9078: value in @samp{a4}.  Although the condition code is not changed by
                   9079: this, it will no longer be true that it reflects the contents of
                   9080: @samp{a4@@(102)}.  Therefore, @code{NOTICE_UPDATE_CC} must alter
                   9081: @code{cc_status} in this case to say that nothing is known about the
                   9082: condition code value.
                   9083: 
                   9084: The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
                   9085: with the results of peephole optimization: insns whose patterns are
                   9086: @code{parallel} RTXs containing various @code{reg}, @code{mem} or
                   9087: constants which are just the operands.  The RTL structure of these
                   9088: insns is not sufficient to indicate what the insns actually do.  What
                   9089: @code{NOTICE_UPDATE_CC} should do when it sees one is just to run
                   9090: @code{CC_STATUS_INIT}.
                   9091: @end table
                   9092: 
                   9093: @node Cross-compilation, Misc, Condition Code, Machine Macros
1.1.1.5   root     9094: @section Cross Compilation and Floating-Point Format
                   9095: 
1.1.1.9 ! root     9096: While all modern machines use 2's complement representation for integers,
1.1.1.5   root     9097: there are a variety of representations for floating point numbers.  This
                   9098: means that in a cross-compiler the representation of floating point numbers
                   9099: in the compiled program may be different from that used in the machine
                   9100: doing the compilation.
                   9101: 
                   9102: Because different representation systems may offer different amounts of
                   9103: range and precision, the cross compiler cannot safely use the host
                   9104: machine's floating point arithmetic.  Therefore, floating point constants
                   9105: must be represented in the target machine's format.  This means that the
                   9106: cross compiler cannot use @code{atof} to parse a floating point constant;
                   9107: it must have its own special routine to use instead.  Also, constant
                   9108: folding must emulate the target machine's arithmetic (or must not be done
                   9109: at all).
                   9110: 
                   9111: The macros in the following table should be defined only if you are cross
                   9112: compiling between different floating point formats.
                   9113: 
                   9114: Otherwise, don't define them. Then default definitions will be set up which
                   9115: use @code{double} as the data type, @code{==} to test for equality, etc.
                   9116: 
                   9117: You don't need to worry about how many times you use an operand of any
                   9118: of these macros.  The compiler never uses operands which have side effects.
                   9119: 
                   9120: @table @code
                   9121: @item REAL_VALUE_TYPE
                   9122: A macro for the C data type to be used to hold a floating point value
                   9123: in the target machine's format.  Typically this would be a
                   9124: @code{struct} containing an array of @code{int}.
                   9125: 
                   9126: @item REAL_VALUES_EQUAL (@var{x}, @var{y})
                   9127: A macro for a C expression which compares for equality the two values,
                   9128: @var{x} and @var{y}, both of type @code{REAL_VALUE_TYPE}.
                   9129: 
                   9130: @item REAL_VALUES_LESS (@var{x}, @var{y})
                   9131: A macro for a C expression which tests whether @var{x} is less than
                   9132: @var{y}, both values being of type @code{REAL_VALUE_TYPE} and
                   9133: interpreted as floating point numbers in the target machine's
                   9134: representation.
                   9135: 
                   9136: @item REAL_VALUE_LDEXP (@var{x}, @var{scale})
                   9137: A macro for a C expression which performs the standard library
                   9138: function @code{ldexp}, but using the target machine's floating point
                   9139: representation.  Both @var{x} and the value of the expression have
                   9140: type @code{REAL_VALUE_TYPE}.  The second argument, @var{scale}, is an
                   9141: integer.
                   9142: 
                   9143: @item REAL_VALUE_ATOF (@var{string})
                   9144: A macro for a C expression which converts @var{string}, an expression
                   9145: of type @code{char *}, into a floating point number in the target
                   9146: machine's representation.  The value has type @code{REAL_VALUE_TYPE}.
                   9147: @end table
                   9148: 
                   9149: Define the following additional macros if you want to make floating
                   9150: point constant folding work while cross compiling.  If you don't
                   9151: define them, cross compilation is still possible, but constant folding
                   9152: will not happen for floating point values.
                   9153: 
                   9154: @table @code
                   9155: @item REAL_ARITHMETIC (@var{output}, @var{code}, @var{x}, @var{y})
                   9156: A macro for a C statement which calculates an arithmetic operation of
                   9157: the two floating point values @var{x} and @var{y}, both of type
                   9158: @code{REAL_VALUE_TYPE} in the target machine's representation, to
                   9159: produce a result of the same type and representation which is stored
                   9160: in @var{output} (which will be a variable).
                   9161: 
                   9162: The operation to be performed is specified by @var{code}, a tree code
                   9163: which will always be one of the following: @code{PLUS_EXPR},
                   9164: @code{MINUS_EXPR}, @code{MULT_EXPR}, @code{RDIV_EXPR},
                   9165: @code{MAX_EXPR}, @code{MIN_EXPR}.@refill
                   9166: 
                   9167: The expansion of this macro is responsible for checking for overflow.
                   9168: If overflow happens, the macro expansion should execute the statement
                   9169: @code{return 0;}, which indicates the inability to perform the
                   9170: arithmetic operation requested.
                   9171: 
                   9172: @item REAL_VALUE_NEGATE (@var{x})
                   9173: A macro for a C expression which returns the negative of the floating
                   9174: point value @var{x}.  Both @var{x} and the value of the expression
                   9175: have type @code{REAL_VALUE_TYPE} and are in the target machine's
                   9176: floating point representation.
                   9177: 
                   9178: There is no way for this macro to report overflow, since overflow
                   9179: can't happen in the negation operation.
                   9180: 
                   9181: @item REAL_VALUE_TO_INT (@var{low}, @var{high}, @var{x})
                   9182: A macro for a C expression which converts a floating point value
                   9183: @var{x} into a double-precision integer which is then stored into
                   9184: @var{low} and @var{high}, two variables of type @var{int}.
                   9185: 
                   9186: @item REAL_VALUE_FROM_INT (@var{x}, @var{low}, @var{high})
                   9187: A macro for a C expression which converts a double-precision integer
                   9188: found in @var{low} and @var{high}, two variables of type @var{int},
                   9189: into a floating point value which is then stored into @var{x}.
                   9190: @end table
                   9191: 
1.1.1.8   root     9192: @node Misc, Assembler Format, Cross-compilation, Machine Macros
1.1       root     9193: @section Miscellaneous Parameters
                   9194: 
                   9195: @table @code
                   9196: @item CASE_VECTOR_MODE
                   9197: An alias for a machine mode name.  This is the machine mode that
                   9198: elements of a jump-table should have.
                   9199: 
                   9200: @item CASE_VECTOR_PC_RELATIVE
                   9201: Define this macro if jump-tables should contain relative addresses.
                   9202: 
                   9203: @item CASE_DROPS_THROUGH
                   9204: Define this if control falls through a @code{case} insn when the index
                   9205: value is out of range.  This means the specified default-label is
                   9206: actually ignored by the @code{case} insn proper.
                   9207: 
                   9208: @item IMPLICIT_FIX_EXPR
                   9209: An alias for a tree code that should be used by default for conversion
                   9210: of floating point values to fixed point.  Normally,
                   9211: @code{FIX_ROUND_EXPR} is used.@refill
                   9212: 
                   9213: @item FIXUNS_TRUNC_LIKE_FIX_TRUNC
                   9214: Define this macro if the same instructions that convert a floating
                   9215: point number to a signed fixed point number also convert validly to an
                   9216: unsigned one.
                   9217: 
                   9218: @item EASY_DIV_EXPR
                   9219: An alias for a tree code that is the easiest kind of division to
                   9220: compile code for in the general case.  It may be
                   9221: @code{TRUNC_DIV_EXPR}, @code{FLOOR_DIV_EXPR}, @code{CEIL_DIV_EXPR} or
                   9222: @code{ROUND_DIV_EXPR}.  These four division operators differ in how
                   9223: they round the result to an integer.  @code{EASY_DIV_EXPR} is used
                   9224: when it is permissible to use any of those kinds of division and the
                   9225: choice should be made on the basis of efficiency.@refill
                   9226: 
                   9227: @item DEFAULT_SIGNED_CHAR
                   9228: An expression whose value is 1 or 0, according to whether the type
                   9229: @code{char} should be signed or unsigned by default.  The user can
                   9230: always override this default with the options @samp{-fsigned-char}
                   9231: and @samp{-funsigned-char}.
                   9232: 
                   9233: @item SCCS_DIRECTIVE
                   9234: Define this if the preprocessor should ignore @code{#sccs} directives
                   9235: and print no error message.
                   9236: 
1.1.1.7   root     9237: @item HAVE_VPRINTF
                   9238: Define this if the library function @code{vprintf} is available on your
                   9239: system.
1.1       root     9240: 
                   9241: @item MOVE_MAX
                   9242: The maximum number of bytes that a single instruction can move quickly
                   9243: from memory to memory.
                   9244: 
                   9245: @item INT_TYPE_SIZE
                   9246: A C expression for the size in bits of the type @code{int} on the
1.1.1.8   root     9247: target machine.  If you don't define this, the default is one word.
                   9248: 
                   9249: @item SHORT_TYPE_SIZE
                   9250: A C expression for the size in bits of the type @code{short} on the
                   9251: target machine.  If you don't define this, the default is half a word.
                   9252: (If this would be less than one storage unit, it is rounded up to one
                   9253: unit.)
                   9254: 
                   9255: @item LONG_TYPE_SIZE
                   9256: A C expression for the size in bits of the type @code{long} on the
                   9257: target machine.  If you don't define this, the default is one word.
                   9258: 
                   9259: @item LONG_LONG_TYPE_SIZE
                   9260: A C expression for the size in bits of the type @code{long long} on the
                   9261: target machine.  If you don't define this, the default is two
                   9262: words.
                   9263: 
                   9264: @item CHAR_TYPE_SIZE
                   9265: A C expression for the size in bits of the type @code{char} on the
                   9266: target machine.  If you don't define this, the default is one quarter
                   9267: of a word.  (If this would be less than one storage unit, it is rounded up
                   9268: to one unit.)
                   9269: 
                   9270: @item FLOAT_TYPE_SIZE
                   9271: A C expression for the size in bits of the type @code{float} on the
                   9272: target machine.  If you don't define this, the default is one word.
                   9273: 
                   9274: @item DOUBLE_TYPE_SIZE
                   9275: A C expression for the size in bits of the type @code{double} on the
                   9276: target machine.  If you don't define this, the default is two
                   9277: words.
                   9278: 
                   9279: @item LONG_DOUBLE_TYPE_SIZE
                   9280: A C expression for the size in bits of the type @code{long double} on
                   9281: the target machine.  If you don't define this, the default is two
                   9282: words.
1.1       root     9283: 
                   9284: @item SLOW_BYTE_ACCESS
                   9285: Define this macro as a C expression which is nonzero if accessing less
                   9286: than a word of memory (i.e. a @code{char} or a @code{short}) is slow
                   9287: (requires more than one instruction).
                   9288: 
                   9289: @item SLOW_ZERO_EXTEND
                   9290: Define this macro if zero-extension (of a @code{char} or @code{short}
                   9291: to an @code{int}) can be done faster if the destination is a register
                   9292: that is known to be zero.
                   9293: 
                   9294: If you define this macro, you must have instruction patterns that
                   9295: recognize RTL structures like this:
                   9296: 
                   9297: @example
                   9298: (set (strict-low-part (subreg:QI (reg:SI @dots{}) 0)) @dots{})
                   9299: @end example
                   9300: 
                   9301: @noindent
                   9302: and likewise for @code{HImode}.
                   9303: 
                   9304: @item SHIFT_COUNT_TRUNCATED
                   9305: Define this macro if shift instructions ignore all but the lowest few
                   9306: bits of the shift count.  It implies that a sign-extend or zero-extend
                   9307: instruction for the shift count can be omitted.
                   9308: 
                   9309: @item TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
                   9310: A C expression which is nonzero if on this machine it is safe to
                   9311: ``convert'' an integer of @var{inprec} bits to one of @var{outprec}
                   9312: bits (where @var{outprec} is smaller than @var{inprec}) by merely
                   9313: operating on it as if it had only @var{outprec} bits.
                   9314: 
                   9315: On many machines, this expression can be 1.
                   9316: 
                   9317: @item NO_FUNCTION_CSE
                   9318: Define this macro if it is as good or better to call a constant
                   9319: function address than to call an address kept in a register.
                   9320: 
                   9321: @item PROMOTE_PROTOTYPES
                   9322: Define this macro if an argument declared as @code{char} or
                   9323: @code{short} in a prototype should actually be passed as an
                   9324: @code{int}.  In addition to avoiding errors in certain cases of
                   9325: mismatch, it also makes for better code on certain machines.
                   9326: 
                   9327: @item STORE_FLAG_VALUE
                   9328: A C expression for the value stored by a store-flag instruction
                   9329: (@code{s@var{cond}}) when the condition is true.  This is usually 1 or
1.1.1.9 ! root     9330: -1; it is required to be an odd number or a negative number.
1.1       root     9331: 
                   9332: Do not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
                   9333: instructions.
                   9334: 
                   9335: @item Pmode
                   9336: An alias for the machine mode for pointers.  Normally the definition
                   9337: can be
                   9338: 
                   9339: @example
                   9340: #define Pmode SImode
                   9341: @end example
                   9342: 
                   9343: @item FUNCTION_MODE
                   9344: An alias for the machine mode used for memory references to functions
1.1.1.8   root     9345: being called, in @code{call} RTL expressions.  On most machines this
1.1       root     9346: should be @code{QImode}.
                   9347: 
                   9348: @item INSN_MACHINE_INFO
                   9349: This macro should expand into a C structure type to use for the
                   9350: machine-dependent info field specified with the optional last argument
1.1.1.8   root     9351: in @code{define_insn} and @code{define_peephole} patterns.  For example,
                   9352: it might expand into @code{struct machine_info}; then it would be up
1.1       root     9353: to you to define this structure in the @file{tm.h} file.
                   9354: 
                   9355: You do not need to define this macro if you do not write the optional
                   9356: last argument in any of the patterns in the machine description.
                   9357: 
1.1.1.8   root     9358: @item DEFAULT_MACHINE_INFO
                   9359: This macro should expand into a C initializer to use to initialize
                   9360: the machine-dependent info for one insn pattern.  It is used for patterns
                   9361: that do not specify the machine-dependent info.
                   9362: 
                   9363: If you do not define this macro, zero is used.
                   9364: 
1.1       root     9365: @item CONST_COSTS (@var{x}, @var{code})
                   9366: A part of a C @code{switch} statement that describes the relative
                   9367: costs of constant RTL expressions.  It must contain @code{case} labels
1.1.1.8   root     9368: for expression codes @code{const_int}, @code{const}, @code{symbol_ref}, @code{label_ref}
                   9369: and @code{const_double}.  Each case must ultimately reach a
1.1       root     9370: @code{return} statement to return the relative cost of the use of that
                   9371: kind of constant value in an expression.  The cost may depend on the
                   9372: precise value of the constant, which is available for examination in
                   9373: @var{x}.
                   9374: 
                   9375: @var{code} is the expression code---redundant, since it can be
                   9376: obtained with @code{GET_CODE (@var{x})}.
                   9377: 
                   9378: @item DOLLARS_IN_IDENTIFIERS
                   9379: Define this to be nonzero if the character @samp{$} should be allowed
                   9380: by default in identifier names.
1.1.1.7   root     9381: 
                   9382: @item USE_C_ALLOCA
                   9383: Define this macro to indicate that the compiler is running with the
                   9384: @code{alloca} implemented in C.  This version of @code{alloca} can be
1.1.1.9 ! root     9385: found in the file @file{alloca.c}; to use it, you must also alter the
        !          9386: @file{Makefile} variable @code{ALLOCA}.
1.1.1.7   root     9387: 
                   9388: This macro, unlike most, describes the machine that the compiler is
                   9389: running on, rather than the one the compiler is compiling for.
                   9390: Therefore, it should be set in the @file{xm-@var{machine}.h} file
1.1.1.8   root     9391: rather than in the @file{tm-@var{machine}.h} file.
1.1.1.7   root     9392: 
                   9393: If you do define this macro, you should probably do it as follows:
                   9394: 
                   9395: @example
                   9396: #ifndef __GNUC__
                   9397: #define USE_C_ALLOCA
                   9398: #else
1.1.1.8   root     9399: #define alloca __builtin_alloca
1.1.1.7   root     9400: #endif
                   9401: @end example
                   9402: 
                   9403: @noindent
                   9404: so that when the compiler is compiled with GNU CC it uses the more
                   9405: efficient built-in @code{alloca} function.
1.1       root     9406: @end table
                   9407: 
1.1.1.8   root     9408: @node Assembler Format,, Misc, Machine Macros
1.1       root     9409: @section Output of Assembler Code
                   9410: 
                   9411: @table @code
                   9412: @item ASM_SPEC
                   9413: A C string constant that tells the GNU CC driver program options to
                   9414: pass to the assembler.  It can also specify how to translate options
                   9415: you give to GNU CC into options for GNU CC to pass to the assembler.
                   9416: See the file @file{tm-sun3.h} for an example of this.
                   9417: 
                   9418: Do not define this macro if it does not need to do anything.
                   9419: 
                   9420: @item LINK_SPEC
                   9421: A C string constant that tells the GNU CC driver program options to
                   9422: pass to the linker.  It can also specify how to translate options you
                   9423: give to GNU CC into options for GNU CC to pass to the linker.
                   9424: 
                   9425: Do not define this macro if it does not need to do anything.
                   9426: 
                   9427: @item LIB_SPEC
                   9428: Another C string constant used much like @code{LINK_SPEC}.  The difference
                   9429: between the two is that @code{LIBS_SPEC} is used at the end of the
                   9430: command given to the linker.
                   9431: 
                   9432: If this macro is not defined, a default is provided that
                   9433: loads the standard C library from the usual place.  See @file{gcc.c}.
                   9434: 
                   9435: @item STARTFILE_SPEC
                   9436: Another C string constant used much like @code{LINK_SPEC}.  The
                   9437: difference between the two is that @code{STARTFILE_SPEC} is used at
                   9438: the very beginning of the command given to the linker.
                   9439: 
                   9440: If this macro is not defined, a default is provided that loads the
                   9441: standard C startup file from the usual place.  See @file{gcc.c}.
                   9442: 
1.1.1.7   root     9443: @item STANDARD_EXEC_PREFIX
                   9444: Define this macro as a C string constant if you wish to override the
                   9445: standard choice of @file{/usr/local/lib/gcc-} as the default prefix to
                   9446: try when searching for the executable files of the compiler.
                   9447: 
                   9448: The prefix specified by the @samp{-B} option, if any, is tried before
                   9449: the default prefix.  After the default prefix, if the executable is
                   9450: not found that way, @file{/usr/lib/gcc-} is tried next; then the
                   9451: directories in your search path for shell commands are searched.
                   9452: 
1.1.1.4   root     9453: @item STANDARD_STARTFILE_PREFIX
                   9454: Define this macro as a C string constant if you wish to override the
1.1.1.7   root     9455: standard choice of @file{/usr/local/lib/} as the default prefix to try
                   9456: when searching for startup files such as @file{crt0.o}.
                   9457: 
                   9458: In this search, all the prefixes tried for executable files are tried
                   9459: first.  Then comes the default startfile prefix specified by this
                   9460: macro, followed by the prefixes @file{/lib/} and @file{/usr/lib/} as
                   9461: last resorts.
1.1.1.4   root     9462: 
1.1       root     9463: @item ASM_FILE_START (@var{stream})
                   9464: A C expression which outputs to the stdio stream @var{stream}
                   9465: some appropriate text to go at the start of an assembler file.
                   9466: 
                   9467: Normally this macro is defined to output a line containing
                   9468: @samp{#NO_APP}, which is a comment that has no effect on most
                   9469: assemblers but tells the GNU assembler that it can save time by not
                   9470: checking for certain assembler constructs.
                   9471: 
                   9472: On systems that use SDB, it is necessary to output certain commands;
                   9473: see @file{tm-attasm.h}.
                   9474: 
1.1.1.8   root     9475: @item ASM_FILE_END (@var{stream})
                   9476: A C expression which outputs to the stdio stream @var{stream}
                   9477: some appropriate text to go at the end of an assembler file.
                   9478: 
                   9479: If this macro is not defined, the default is to output nothing
                   9480: special at the end of the file.  Most systems don't require any
                   9481: definition.
                   9482: 
                   9483: On systems that use SDB, it is necessary to output certain commands;
                   9484: see @file{tm-attasm.h}.
                   9485: 
                   9486: @item ASM_IDENTIFY_GCC (@var{file})
                   9487: A C statement to output assembler commands which will identify
                   9488: the object file as having been compiled with GNU CC (or another
                   9489: GNU compiler).
                   9490: 
                   9491: If you don't define this macro, the string @samp{gcc_compiled.:}
                   9492: is output.  This string is calculated to define a symbol which,
                   9493: on BSD systems, will never be defined for any other reason.
                   9494: GDB checks for the presence of this symbol when reading the
                   9495: symbol table of an executable.
                   9496: 
                   9497: On non-BSD systems, you must arrange communication with GDB in
                   9498: some other fashion.  If GDB is not used on your system, you can
                   9499: define this macro with an empty body.
                   9500: 
1.1       root     9501: @item ASM_APP_ON
                   9502: A C string constant for text to be output before each @code{asm}
                   9503: statement or group of consecutive ones.  Normally this is
                   9504: @code{"#APP"}, which is a comment that has no effect on most
                   9505: assemblers but tells the GNU assembler that it must check the lines
                   9506: that follow for all valid assembler constructs.
                   9507: 
                   9508: @item ASM_APP_OFF
                   9509: A C string constant for text to be output after each @code{asm}
                   9510: statement or group of consecutive ones.  Normally this is
                   9511: @code{"#NO_APP"}, which tells the GNU assembler to resume making the
                   9512: time-saving assumptions that are valid for ordinary compiler output.
                   9513: 
                   9514: @item TEXT_SECTION_ASM_OP
                   9515: A C string constant for the assembler operation that should precede
                   9516: instructions and read-only data.  Normally @code{".text"} is right.
                   9517: 
                   9518: @item DATA_SECTION_ASM_OP
                   9519: A C string constant for the assembler operation to identify the
                   9520: following data as writable initialized data.  Normally @code{".data"}
                   9521: is right.
                   9522: 
1.1.1.8   root     9523: @item EXTRA_SECTIONS
                   9524: A list of names for sections other than the standard two, which are
                   9525: @code{in_text} and @code{in_data}.  You need not define this macro
                   9526: on a system with no other sections (that GCC needs to use).
                   9527: 
                   9528: @item EXTRA_SECTION_FUNCTIONS
                   9529: One or more functions to be defined in @file{varasm.c}.  These
                   9530: functions should do jobs analogous to those of @code{text_section} and
                   9531: @code{data_section}, for your additional sections.  Do not define this
                   9532: macro if you do not define @code{EXTRA_SECTIONS}.
                   9533: 
                   9534: @item SELECT_SECTION (@var{exp})
                   9535: A C statement or statements to switch to the appropriate section for
                   9536: output of @var{exp}.  You can assume that @var{exp} is either a
                   9537: @code{VAR_DECL} node or a constant of some sort.  Select the section
                   9538: by calling @code{text_section} or one of the alternatives for other
                   9539: sections.
                   9540: 
                   9541: Do not define this macro if you use only the standard two sections
                   9542: and put all read-only variables and constants in the text section.
                   9543: 
                   9544: @item SELECT_RTX_SECTION (@var{mode}, @var{rtx})
                   9545: A C statement or statements to switch to the appropriate section for
                   9546: output of @var{rtx} in mode @var{mode}.  You can assume that @var{rtx}
                   9547: is some kind of constant in RTL.  The argument @var{mode} is redundant
                   9548: except in the case of a @code{const_int} rtx.  Select the section by
                   9549: calling @code{text_section} or one of the alternatives for other
                   9550: sections.  
                   9551: 
                   9552: Do not define this macro if you use only the standard two sections and
                   9553: put all constants in the text section.  
                   9554: 
1.1       root     9555: @item REGISTER_NAMES
                   9556: A C initializer containing the assembler's names for the machine
                   9557: registers, each one as a C string constant.  This is what translates
                   9558: register numbers in the compiler into assembler language.
                   9559: 
                   9560: @item DBX_REGISTER_NUMBER (@var{regno})
                   9561: A C expression that returns the DBX register number for the compiler
                   9562: register number @var{regno}.  In simple cases, the value of this
                   9563: expression may be @var{regno} itself.  But sometimes there are some
                   9564: registers that the compiler knows about and DBX does not, or vice
                   9565: versa.  In such cases, some register may need to have one number in
                   9566: the compiler and another for DBX.
                   9567: 
                   9568: @item DBX_DEBUGGING_INFO
                   9569: Define this macro if GNU CC should produce debugging output for DBX
                   9570: in response to the @samp{-g} option.
                   9571: 
                   9572: @item SDB_DEBUGGING_INFO
                   9573: Define this macro if GNU CC should produce debugging output for SDB
                   9574: in response to the @samp{-g} option.
                   9575: 
                   9576: @item PUT_SDB_@var{op}
                   9577: Define these macros to override the assembler syntax for the special
                   9578: SDB assembler directives.  See @file{sdbout.c} for a list of these
                   9579: macros and their arguments.  If the standard syntax is used, you need
                   9580: not define them yourself.
                   9581: 
                   9582: @item SDB_GENERATE_FAKE
                   9583: Define this macro to override the usual method of constructing a dummy
                   9584: name for anonymous structure and union types.  See @file{sdbout.c} for
1.1.1.9 ! root     9585: more information.
1.1       root     9586: 
                   9587: @item DBX_NO_XREFS
                   9588: Define this macro if DBX on your system does not support the construct
                   9589: @samp{xs@var{tagname}}.  On some systems, this construct is used to
                   9590: describe a forward reference to a structure named @var{tagname}.
                   9591: On other systems, this construct is not supported at all.
                   9592: 
                   9593: @item DBX_CONTIN_LENGTH
                   9594: A symbol name in DBX-format debugging information is normally
                   9595: continued (split into two separate @code{.stabs} directives) when it
                   9596: exceeds a certain length (by default, 80 characters).  On some
                   9597: operating systems, DBX requires this splitting; on others, splitting
                   9598: must not be done.  You can inhibit splitting by defining this macro
                   9599: with the value zero.  You can override the default splitting-length by
                   9600: defining this macro as an expression for the length you desire.
                   9601: 
                   9602: @item DBX_CONTIN_CHAR
                   9603: Normally continuation is indicated by adding a @samp{\} character to
                   9604: the end of a @code{.stabs} string when a continuation follows.  To use
                   9605: a different character instead, define this macro as a character
                   9606: constant for the character you want to use.  Do not define this macro
                   9607: if backslash is correct for your system.
                   9608: 
1.1.1.8   root     9609: @item DBX_STATIC_STAB_DATA_SECTION
                   9610: Define this macro if it is necessary to go to the data section before
                   9611: outputting the @samp{.stabs} pseudo-op for a non-global static
                   9612: variable.
                   9613: 
1.1       root     9614: @item ASM_OUTPUT_LABEL (@var{stream}, @var{name})
                   9615: A C statement (sans semicolon) to output to the stdio stream
1.1.1.8   root     9616: @var{stream} the assembler definition of a label named @var{name}.
                   9617: Use the expression @code{assemble_name (@var{stream}, @var{name})} to
                   9618: output the name itself; before and after that, output the additional
1.1       root     9619: assembler syntax for defining the name, and a newline.
                   9620: 
                   9621: @item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
                   9622: A C statement (sans semicolon) to output to the stdio stream
                   9623: @var{stream} any text necessary for declaring the name @var{name} of a
                   9624: function which is being defined.  This macro is responsible for
                   9625: outputting the label definition (perhaps using
                   9626: @code{ASM_OUTPUT_LABEL}).  The argument @var{decl} is the
                   9627: @code{FUNCTION_DECL} tree node representing the function.
                   9628: 
                   9629: If this macro is not defined, then the function name is defined in the
                   9630: usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
                   9631: 
                   9632: @item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name})
                   9633: A C statement (sans semicolon) to output to the stdio stream
                   9634: @var{stream} some commands that will make the label @var{name} global;
                   9635: that is, available for reference from other files.  Use the expression
                   9636: @code{assemble_name (@var{stream}, @var{name})} to output the name
                   9637: itself; before and after that, output the additional assembler syntax
                   9638: for making that name global, and a newline.
                   9639: 
1.1.1.8   root     9640: @item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
1.1       root     9641: A C statement (sans semicolon) to output to the stdio stream
                   9642: @var{stream} any text necessary for declaring the name of an external
                   9643: symbol named @var{name} which is referenced in this compilation but
                   9644: not defined.  The value of @var{decl} is the tree node for the
                   9645: declaration.
                   9646: 
                   9647: This macro need not be defined if it does not need to output anything.
                   9648: The GNU assembler and most Unix assemblers don't require anything.
                   9649: 
                   9650: @item ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
1.1.1.8   root     9651: A C statement to output to the stdio stream @var{stream} a reference
                   9652: in assembler syntax to a label named @var{name}.  The character
                   9653: @samp{_} should be added to the front of the name, if that is
                   9654: customary on your operating system, as it is in most Berkeley Unix
                   9655: systems.  This macro is used in @code{assemble_name}.
1.1       root     9656: 
                   9657: @item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
1.1.1.8   root     9658: A C statement to store into the string @var{string} a label whose name
                   9659: is made from the string @var{prefix} and the number @var{num}.
1.1       root     9660: 
                   9661: This string, when output subsequently by @code{ASM_OUTPUT_LABELREF},
                   9662: should produce the same output that @code{ASM_OUTPUT_INTERNAL_LABEL}
                   9663: would produce with the same @var{prefix} and @var{num}.
                   9664: 
                   9665: @item ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{prefix}, @var{num})
                   9666: A C statement to output to the stdio stream @var{stream} a label whose
                   9667: name is made from the string @var{prefix} and the number @var{num}.
                   9668: These labels are used for internal purposes, and there is no reason
                   9669: for them to appear in the symbol table of the object file.  On many
                   9670: systems, the letter @samp{L} at the beginning of a label has this
                   9671: effect.  The usual definition of this macro is as follows:
                   9672: 
                   9673: @example
                   9674: fprintf (@var{stream}, "L%s%d:\n", @var{prefix}, @var{num})
                   9675: @end example
                   9676: 
                   9677: @item ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
                   9678: Define this if the label before a jump-table needs to be output
                   9679: specially.  The first three arguments are the same as for
                   9680: @code{ASM_OUTPUT_INTERNAL_LABEL}; the fourth argument is the
1.1.1.8   root     9681: jump-table which follows (a @code{jump_insn} containing an
                   9682: @code{addr_vec} or @code{addr_diff_vec}).
1.1       root     9683: 
                   9684: This feature is used on system V to output a @code{swbeg} statement
                   9685: for the table.
                   9686: 
                   9687: If this macro is not defined, these labels are output with
                   9688: @code{ASM_OUTPUT_INTERNAL_LABEL}.
                   9689: 
                   9690: @item ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
1.1.1.8   root     9691: Define this if something special must be output at the end of a
                   9692: jump-table.  The definition should be a C statement to be executed
                   9693: after the assembler code for the table is written.  It should write
                   9694: the appropriate code to stdio stream @var{stream}.  The argument
                   9695: @var{table} is the jump-table insn, and @var{num} is the label-number
                   9696: of the preceding label.
1.1       root     9697: 
                   9698: If this macro is not defined, nothing special is output at the end of
                   9699: the jump-table.
                   9700: 
1.1.1.4   root     9701: @item ASM_OUTPUT_ALIGN_CODE (@var{file})
                   9702: A C expression to output text to align the location counter in the way
                   9703: that is desirable at a point in the code that is reached only by
                   9704: jumping.
                   9705: 
                   9706: This macro need not be defined if you don't want any special alignment
                   9707: to be done at such a time.  Most machine descriptions do not currently
                   9708: define the macro.
                   9709: 
1.1       root     9710: @item ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
                   9711: A C expression to assign to @var{outvar} (which is a variable of type
                   9712: @code{char *}) a newly allocated string made from the string
                   9713: @var{name} and the number @var{number}, with some suitable punctuation
                   9714: added.  Use @code{alloca} to get space for the string.
                   9715: 
                   9716: This string will be used as the argument to @code{ASM_OUTPUT_LABELREF}
                   9717: to produce an assembler label for an internal static variable whose
                   9718: name is @var{name}.  Therefore, the string must be such as to result
                   9719: in valid assembler code.  The argument @var{number} is different each
                   9720: time this macro is executed; it prevents conflicts between
                   9721: similarly-named internal static variables in different scopes.
                   9722: 
                   9723: Ideally this string should not be a valid C identifier, to prevent any
                   9724: conflict with the user's own symbols.  Most assemblers allow periods
                   9725: or percent signs in assembler symbols; putting at least one of these
                   9726: between the name and the number will suffice.
                   9727: 
                   9728: @item ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
                   9729: A C expression to output to @var{stream} some assembler code
                   9730: which will push hard register number @var{regno} onto the stack.
                   9731: The code need not be optimal, since this macro is used only when
                   9732: profiling.
                   9733: 
                   9734: @item ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
                   9735: A C expression to output to @var{stream} some assembler code
                   9736: which will pop hard register number @var{regno} off of the stack.
                   9737: The code need not be optimal, since this macro is used only when
                   9738: profiling.
                   9739: 
                   9740: @item ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{value}, @var{rel})
                   9741: This macro should be provided on machines where the addresses
                   9742: in a dispatch table are relative to the table's own address.
                   9743: 
                   9744: The definition should be a C statement to output to the stdio stream
                   9745: @var{stream} an assembler pseudo-instruction to generate a difference
                   9746: between two labels.  @var{value} and @var{rel} are the numbers of two
                   9747: internal labels.  The definitions of these labels are output using
                   9748: @code{ASM_OUTPUT_INTERNAL_LABEL}, and they must be printed in the same
                   9749: way here.  For example,
                   9750: 
                   9751: @example
                   9752: fprintf (@var{stream}, "\t.word L%d-L%d\n",
                   9753:          @var{value}, @var{rel})
                   9754: @end example
                   9755: 
                   9756: @item ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
                   9757: This macro should be provided on machines where the addresses
                   9758: in a dispatch table are absolute.
                   9759: 
                   9760: The definition should be a C statement to output to the stdio stream
                   9761: @var{stream} an assembler pseudo-instruction to generate a reference to
                   9762: a label.  @var{value} is the number of an internal label whose
                   9763: definition is output using @code{ASM_OUTPUT_INTERNAL_LABEL}.
                   9764: For example,
                   9765: 
                   9766: @example
                   9767: fprintf (@var{stream}, "\t.word L%d\n", @var{value})
                   9768: @end example
                   9769: 
                   9770: @item ASM_OUTPUT_DOUBLE (@var{stream}, @var{value})
                   9771: A C statement to output to the stdio stream @var{stream} an assembler
                   9772: instruction to assemble a @code{double} constant whose value is
                   9773: @var{value}.  @var{value} will be a C expression of type
                   9774: @code{double}.
                   9775: 
                   9776: @item ASM_OUTPUT_FLOAT (@var{stream}, @var{value})
                   9777: A C statement to output to the stdio stream @var{stream} an assembler
                   9778: instruction to assemble a @code{float} constant whose value is
                   9779: @var{value}.  @var{value} will be a C expression of type @code{float}.
                   9780: 
                   9781: @item ASM_OUTPUT_INT (@var{stream}, @var{exp})
                   9782: @itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp})
                   9783: @itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp})
                   9784: A C statement to output to the stdio stream @var{stream} an assembler
                   9785: instruction to assemble a @code{int}, @code{short} or @code{char}
                   9786: constant whose value is @var{value}.  The argument @var{exp} will be
                   9787: an RTL expression which represents a constant value.  Use
                   9788: @samp{output_addr_const (@var{exp})} to output this value as an
                   9789: assembler expression.@refill
                   9790: 
1.1.1.8   root     9791: @item ASM_OUTPUT_DOUBLE_INT (@var{stream}, @var{exp})
                   9792: A C statement to output to the stdio stream @var{stream} an assembler
                   9793: instruction to assemble a @code{long long} constant whose value is
                   9794: @var{exp}.  The argument @var{exp} will be an RTL expression which
                   9795: represents a constant value.  It may be a @code{const_double} RTX,
                   9796: or it may be an ordinary single-precision constant.  In the latter
                   9797: case, you should zero-extend it.
                   9798: 
1.1       root     9799: @item ASM_OUTPUT_BYTE (@var{stream}, @var{value})
                   9800: A C statement to output to the stdio stream @var{stream} an assembler
                   9801: instruction to assemble a single byte containing the number @var{value}.
                   9802: 
                   9803: @item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
                   9804: A C statement to output to the stdio stream @var{stream} an assembler
                   9805: instruction to assemble a string constant containing the @var{len}
                   9806: bytes at @var{ptr}.  @var{ptr} will be a C expression of type
                   9807: @code{char *} and @var{len} a C expression of type @code{int}.
                   9808: 
                   9809: If the assembler has a @code{.ascii} pseudo-op as found in the
                   9810: Berkeley Unix assembler, do not define the macro
                   9811: @code{ASM_OUTPUT_ASCII}.
                   9812: 
                   9813: @item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
                   9814: A C statement to output to the stdio stream @var{stream} an assembler
                   9815: instruction to advance the location counter by @var{nbytes} bytes.
                   9816: @var{nbytes} will be a C expression of type @code{int}.
                   9817: 
                   9818: @item ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
                   9819: A C statement to output to the stdio stream @var{stream} an assembler
                   9820: instruction to advance the location counter to a multiple of 2 to the
                   9821: @var{power} bytes.  @var{power} will be a C expression of type @code{int}.
                   9822: 
1.1.1.7   root     9823: @item ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
1.1       root     9824: A C statement (sans semicolon) to output to the stdio stream
1.1.1.7   root     9825: @var{stream} the assembler definition of a common-label named
                   9826: @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
                   9827: is the size rounded up to whatever alignment the caller wants.
                   9828: 
                   9829: Use the expression @code{assemble_name (@var{stream}, @var{name})} to
                   9830: output the name itself; before and after that, output the additional
                   9831: assembler syntax for defining the name, and a newline.
1.1       root     9832: 
                   9833: This macro controls how the assembler definitions of uninitialized
                   9834: global variables are output.
                   9835: 
1.1.1.7   root     9836: @item ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
1.1       root     9837: A C statement (sans semicolon) to output to the stdio stream
                   9838: @var{stream} the assembler definition of a local-common-label named
1.1.1.7   root     9839: @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
                   9840: is the size rounded up to whatever alignment the caller wants.
                   9841: 
                   9842: Use the expression @code{assemble_name (@var{stream}, @var{name})} to
                   9843: output the name itself; before and after that, output the additional
                   9844: assembler syntax for defining the name, and a newline.
1.1       root     9845: 
                   9846: This macro controls how the assembler definitions of uninitialized
                   9847: static variables are output.
                   9848: 
1.1.1.8   root     9849: @item ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
                   9850: A C statment to output DBX or SDB debugging information which indicates
                   9851: that filename @var{name} is the current source file to the stdio stream
                   9852: @var{stream}.
                   9853: 
                   9854: This macro need not be defined if the standard form of debugging
                   9855: information for the debugger in use is appropriate.
                   9856: 
1.1       root     9857: @item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
                   9858: A C statment to output DBX or SDB debugging information before code
                   9859: for line number @var{line} of the current source file to the
                   9860: stdio stream @var{stream}.
                   9861: 
                   9862: This macro need not be defined if the standard form of debugging
                   9863: information for the debugger in use is appropriate.
                   9864: 
                   9865: @item ASM_OUTPUT_IDENT (@var{stream}, @var{string})
                   9866: A C statement to output something to the assembler file to handle a
                   9867: @samp{#ident} directive containing the text @var{string}.  If this
1.1.1.7   root     9868: macro is not defined, nothing is output for a @samp{#ident} directive.
1.1       root     9869: 
                   9870: @item TARGET_BELL
                   9871: A C constant expression for the integer value for escape sequence
                   9872: @samp{\a}.
                   9873: 
                   9874: @item TARGET_BS
                   9875: @itemx TARGET_TAB
                   9876: @itemx TARGET_NEWLINE
                   9877: C constant expressions for the integer values for escape sequences
                   9878: @samp{\b}, @samp{\t} and @samp{\n}.
                   9879: 
                   9880: @item TARGET_VT
                   9881: @itemx TARGET_FF
                   9882: @itemx TARGET_CR
                   9883: C constant expressions for the integer values for escape sequences
                   9884: @samp{\v}, @samp{\f} and @samp{\r}.
                   9885: 
                   9886: @item ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
                   9887: Define this macro if you are using an unusual assembler that
                   9888: requires different names for the machine instructions.
                   9889: 
                   9890: The definition is a C statement or statements which output an
                   9891: assembler instruction opcode to the stdio stream @var{stream}.  The
                   9892: macro-operand @var{ptr} is a variable of type @code{char *} which
                   9893: points to the opcode name in its ``internal'' form---the form that is
                   9894: written in the machine description.  The definition should output the
                   9895: opcode name to @var{stream}, performing any translation you desire, and
                   9896: increment the variable @var{ptr} to point at the end of the opcode
                   9897: so that it will not be output twice.
                   9898: 
                   9899: In fact, your macro definition may process less than the entire opcode
                   9900: name, or more than the opcode name; but if you want to process text
                   9901: that includes @samp{%}-sequences to substitute operands, you must take
                   9902: care of the substitution yourself.  Just be sure to increment
                   9903: @var{ptr} over whatever text should not be output normally.
                   9904: 
1.1.1.8   root     9905: If you need to look at the operand values, they can be found as the
                   9906: elements of @code{recog_operand}.
                   9907: 
1.1       root     9908: If the macro definition does nothing, the instruction is output
                   9909: in the usual way.
                   9910: 
                   9911: @item FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
                   9912: If defined, a C statement to be executed just prior to the output of
                   9913: assembler code for @var{insn}, to modify the extracted operands so
                   9914: they will be output differently.
                   9915: 
                   9916: Here the argument @var{opvec} is the vector containing the operands
                   9917: extracted from @var{insn}, and @var{noperands} is the number of
                   9918: elements of the vector which contain meaningful data for this insn.
                   9919: The contents of this vector are what will be used to convert the insn
                   9920: template into assembler code, so you can change the assembler output
                   9921: by changing the contents of the vector.
                   9922: 
                   9923: This macro is useful when various assembler syntaxes share a single
                   9924: file of instruction patterns; by defining this macro differently, you
                   9925: can cause a large class of instructions to be output differently (such
                   9926: as with rearranged operands).  Naturally, variations in assembler
                   9927: syntax affecting individual insn patterns ought to be handled by
                   9928: writing conditional output routines in those patterns.
                   9929: 
                   9930: If this macro is not defined, it is equivalent to a null statement.
                   9931: 
                   9932: @item PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
                   9933: A C compound statement to output to stdio stream @var{stream} the
                   9934: assembler syntax for an instruction operand @var{x}.  @var{x} is an
                   9935: RTL expression.
                   9936: 
                   9937: @var{code} is a value that can be used to specify one of several ways
                   9938: of printing the operand.  It is used when identical operands must be
                   9939: printed differently depending on the context.  @var{code} comes from
                   9940: the @samp{%} specification that was used to request printing of the
                   9941: operand.  If the specification was just @samp{%@var{digit}} then
                   9942: @var{code} is 0; if the specification was @samp{%@var{ltr}
                   9943: @var{digit}} then @var{code} is the ASCII code for @var{ltr}.
                   9944: 
                   9945: If @var{x} is a register, this macro should print the register's name.
                   9946: The names can be found in an array @code{reg_names} whose type is
                   9947: @code{char *[]}.  @code{reg_names} is initialized from
                   9948: @code{REGISTER_NAMES}.
                   9949: 
                   9950: When the machine description has a specification @samp{%@var{punct}}
                   9951: (a @samp{%} followed by a punctuation character), this macro is called
                   9952: with a null pointer for @var{x} and the punctuation character for
                   9953: @var{code}.
                   9954: 
1.1.1.8   root     9955: @item PRINT_OPERAND_PUNCT_VALID_P (@var{code})
                   9956: A C expression which evaluates to true if @var{code} is a valid
                   9957: punctuation character for use in the @code{PRINT_OPERAND} macro.  If
                   9958: @code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
                   9959: punctuation characters (except for the standard one, @samp{%}) are used
                   9960: in this way.
                   9961: 
1.1       root     9962: @item PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
                   9963: A C compound statement to output to stdio stream @var{stream} the
                   9964: assembler syntax for an instruction operand that is a memory reference
                   9965: whose address is @var{x}.  @var{x} is an RTL expression.
                   9966: 
                   9967: @item ASM_OPEN_PAREN
                   9968: @itemx ASM_CLOSE_PAREN
                   9969: These macros are defined as C string constant, describing the syntax
                   9970: in the assembler for grouping arithmetic expressions.  The following
                   9971: definitions are correct for most assemblers:
                   9972: 
                   9973: @example
                   9974: #define ASM_OPEN_PAREN "("
                   9975: #define ASM_CLOSE_PAREN ")"
                   9976: @end example
                   9977: @end table
                   9978: 
                   9979: @node Config,, Machine Macros, Top
                   9980: @chapter The Configuration File
                   9981: 
1.1.1.3   root     9982: The configuration file @file{xm-@var{machine}.h} contains macro definitions
                   9983: that describe the machine and system on which the compiler is running.
                   9984: Most of the values in it are actually the same on all machines that GNU CC
                   9985: runs on, so large parts of all configuration files are identical.  But
1.1       root     9986: there are some macros that vary:
                   9987: 
                   9988: @table @code
                   9989: @item FAILURE_EXIT_CODE
                   9990: A C expression for the status code to be returned when the compiler
                   9991: exits after serious errors.
                   9992: 
                   9993: @item SUCCESS_EXIT_CODE
                   9994: A C expression for the status code to be returned when the compiler
                   9995: exits without serious errors.
                   9996: @end table
                   9997: 
1.1.1.3   root     9998: In addition, configuration files for system V define @code{bcopy},
                   9999: @code{bzero} and @code{bcmp} as aliases.  Some files define @code{alloca}
                   10000: as a macro when compiled with GNU CC, in order to take advantage of the
                   10001: benefit of GNU CC's built-in @code{alloca}.
                   10002: 
1.1       root     10003: @contents
                   10004: @bye

unix.superglobalmegacorp.com

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