--- gcc/internals.texinfo 2018/04/24 16:38:04 1.1.1.2 +++ gcc/internals.texinfo 2018/04/24 16:42:03 1.1.1.6 @@ -39,9 +39,9 @@ Free Software Foundation instead of in t @sp 2 @center Richard M. Stallman @sp 3 -@center last updated 24 April 1988 +@center last updated 26 June 1988 @sp 1 -@center for version 1.21 +@center for version 1.23 @page @vskip 0pt plus 1filll Copyright @copyright{} 1988 Free Software Foundation, Inc. @@ -78,6 +78,7 @@ well as its new features and incompatibi * Contributors:: People who have contributed to GNU CC. * Options:: Command options supported by @samp{gcc}. * Installation:: How to configure, compile and install GNU CC. +* Trouble:: If you have trouble installing GNU CC. * Incompatibilities:: Incompatibilities of GNU CC. * Extensions:: GNU extensions to the C language. * Bugs:: How to report bugs (if you want to get them fixed). @@ -277,17 +278,23 @@ Charles LaBrec contributed the support f Michael Tiemann of MCC wrote the description of the National Semiconductor 32000 series cpu, with some contributions from Jan Stein of the Chalmers Computer Club. Tiemann also wrote the code for inline -function integration. +function integration and for the SPARC cpu and Motorola 88000 cpu. @item -Michael Kashtan of SRI adapted GNU CC to the Vomit-Making System. +Robert Brown implemented the support for Encore 32000 systems. + +@item +David Kashtan of SRI adapted GNU CC to the Vomit-Making System. @item Alex Crain provided changes for the 3b1. @item -Chris Hanson and another person who should remind me of his name -assisted in making GNU CC work on HP-UX for the 9000 series 300. +Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX for +the 9000 series 300. + +@item +William Schelter did most of the work on the Intel 80386 support. @end itemize @node Options, Installation, Contributors, Top @@ -323,7 +330,7 @@ Place output in file @var{file}. This a sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code. -If @samp{-o} is not specified, the default is to put an excutable file +If @samp{-o} is not specified, the default is to put an executable file in @file{a.out}, the object file @file{@var{source}.c} in @file{@var{source}.o}, an assembler file in @file{@var{source}.s}, and preprocessed C on standard output.@refill @@ -413,6 +420,9 @@ Integer types @code{unsigned short} and to @code{unsigned int}. @item +Out-of-range floating point literals are not an error. + +@item In the preprocessor, comments convert to nothing at all, rather than to a space. This allows traditional token concatenation. @@ -445,7 +455,8 @@ Some of the @samp{-f} options described optimization on or off. @item -g -Produce debugging information in DBX format. +Produce debugging information in the operating system's native +format (for DBX or SDB). Unlike most other C compilers, GNU CC allows you to use @samp{-g} with @samp{-O}. The shortcuts taken by optimized code may occasionally @@ -520,7 +531,7 @@ another common case: @end example @noindent -This has no bug because @code{x} is used only if it is set. +This has no bug because @code{save_y} is used only if it is set. @item A nonvolatile automatic variable might be changed by a call to @@ -566,6 +577,9 @@ return-value in a function whose return- @item -Wcomment Warn whenever a comment-start sequence @samp{/*} appears in a comment. +@item -Wall +All of the above @samp{-W} options combined. + @item -p Generate extra code to write profile information suitable for the analysis program @code{prof}. @@ -574,10 +588,26 @@ analysis program @code{prof}. Generate extra code to write profile information suitable for the analysis program @code{gprof}. -@item -nostdinc -Don't search the standard directories for include files. Only the -directories you specify explicitly with the @samp{-I} option will be -searched. +@item -l@var{library} +Search a standard list of directories for a library named +@var{library}, which is actually a file named +@file{lib@var{library}.a}. The linker uses this file as if it +had been specified precisely by name. + +The directories searched include several standard system directories +plus any that you specify with @samp{-L}. + +Normally the files found this way are library files---archive files +whose members are object files. The linker handles an archive file by +scanning through it for members which define symbols that have so far +been referenced but not defined. But if the file that is found is an +ordinary object file, it is linked in the usual fashion. The only +difference between using an @samp{-l} option and specifying a file name +is that @samp{-l} searches several directories. + +@item -L@var{dir} +Add directory @var{dir} to the list of directories to be searched +for @samp{-l}. @item -nostdlib Don't use the standard system libraries and startup files when @@ -656,6 +686,9 @@ ranges. @item -mgnu Do output those jump instructions, on the assumption that you will assemble with the GNU assembler. + +@item -mg +Output code for g-format floating point numbers instead of d-format. @end table @item -f@var{flag} @@ -851,6 +884,32 @@ Tell the preprocessor not to discard com @item -I@var{dir} Search directory @var{dir} for include files. +@item -I- +Any directories specified with @samp{-I} options before the @samp{-I-} +option are searched only for the case of @samp{#include "@var{file}"}; +they are not searched for @samp{#include <@var{file}>}. + +If additional directories are specified with @samp{-I} options after +the @samp{-I-}, these directories are searched for all @samp{#include} +directives. (Ordinarily @emph{all} @samp{-I} directories are used +this way.) + +In addition, the @samp{-I-} option inhibits the use of the current +directory as the first search directory for @samp{#include +"@var{file}"}. Therefore, the current directory is searched only if +it is requested explicitly with @samp{-I.}. Specifying both +@samp{-I-} and @samp{-I.} allows you to control precisely which +directories are searched before the current one and which are searched +after. + +@item -nostdinc +Do not search the standard system directories for header files. Only +the directories you have specified with @samp{-I} options (and the +current directory, if appropriate) are searched. + +Between @samp{-nostdinc} and @samp{-I-}, you can eliminate all +directories from the search path except those you specify. + @item -M Tell the preprocessor to output a rule suitable for @code{make} describing the dependencies of each source file. For each source @@ -882,7 +941,7 @@ Support ANSI C trigraphs. You don't wan brain-damage. The @samp{-ansi} option also has this effect. @end table -@node Installation, Incompatibilities, Options, Top +@node Installation, Trouble, Options, Top @chapter Installing GNU CC Here is the procedure for installing GNU CC on a Unix system. @@ -895,8 +954,12 @@ Here is the procedure for installing GNU @enumerate @item -Edit @file{Makefile}. If you are using HPUX, you must make a few -changes described in comments at the beginning of the file. +Edit @file{Makefile}. If you are using HPUX, or any form of system V, +you must make a few changes described in comments at the beginning of +the file. + +@item +On a Sequent system, go to the Berkeley universe. @item Choose configuration files. @@ -908,10 +971,11 @@ config file for the machine you are usin file is responsible for defining information about the host machine. It includes @file{tm.h}. -The file's name should be @file{config-@var{machine}.h}. On VMS, -use @file{config-vms.h} rather than @file{config-vax.h}. On the -HP 9000 series 300, use @file{config-hp9k3.h} rather than -@file{config-m68k.h}.@refill +The file's name should be @file{config-@var{machine}.h}. On VMS, use +@file{config-vms.h} rather than @file{config-vax.h}. On the HP 9000 +series 300, use @file{config-hp9k3.h} rather than +@file{config-m68k.h}. On Suns (model 3 or 4) running system version +4, use @file{config-sun4.h}.@refill If your system does not support symbolic links, you might want to set up @file{config.h} to contain a @samp{#include} command which @@ -938,11 +1002,35 @@ with compilation. Not all of the pieces this mode of operation are as yet in distribution; full instructions will appear here in the future.@refill +For the vax, use @file{tm-vax.h} on BSD Unix, @file{tm-vaxv.h} on +system V, or @file{tm-vms.h} on VMS.@refill + +For the SPARC, use @file{tm-sparc.h}. + +For the Motorola 88000, use @file{tm-m88k.h}. The support for the +88000 has a few unfinished spots because there was no way to run the +output. Bugs are suspected in handling of branch-tables and in +the function prologue and epilogue. + +For the 80386, don't use @file{tm-i386.h} directly. Use @file{tm-i386v.h} +if the target machine is running system V, or @file{tm-compaq.h} for a +Compaq. + For the 32000, use @file{tm-sequent.h} if you are using a Sequent -machine; otherwise, use @file{tm-ns32k.h}. +machine, or @file{tm-encore.h} for an Encore machine; otherwise, +perhaps @file{tm-ns32k.h} will work for you. If you are trying to use +GNU CC on GENIX, you may need to get the version of @code{malloc} from +GNU Emacs instead of the system library version, and you probably need +to cause the following assembler code to be executed in @file{crt0.o} +in order to run the GNU CC output: -For the vax, use @file{tm-vax.h} on BSD Unix, @file{tm-ultrix.h} -on Ultrix, or @file{tm-vms.h} on VMS.@refill +@example +lprd sb,$0 +sprd mod,r0 +movqd $0,0(r0) +@end example + +Note that Encore systems are supported only under BSD. @item Make a symbolic link named @file{md} to the machine description @@ -956,8 +1044,9 @@ subroutine file for your machine (its na @item Make sure the Bison parser generator is installed. (This is -unnecessary if the Bison output file @file{parse.tab.c} is more recent -than @file{parse.y} and you do not plan to change @file{parse.y}.) +unnecessary if the Bison output files @file{parse.tab.c} and +@file{cexp.c} are more recent than @file{parse.y} and @file{cexp.y} +and you do not plan to change the @samp{.y} files.) Note that if you have an old version of Bison you may get an error from the line with the @samp{%expect} directive. If so, simply remove @@ -1006,7 +1095,7 @@ time, do this: @example make stage2 -make CC=stage2/gcc CFLAGS="-g -O -Bstage2/" +Make CC=stage2/gcc CFLAGS="-g -O -Bstage2/" foreach file (*.o) cmp $file stage2/$file end @@ -1018,6 +1107,9 @@ that the stage 2 compiler has compiled G therefore a potentially serious bug which you should investigate and report (@pxref{Bugs}). +Aside from the @samp{-B} option, the options should be the same as +when you made stage 2. + @item Install the compiler driver, the compiler's passes and run-time support. You can use the following command: @@ -1049,12 +1141,12 @@ the system's own C preprocessor. To do Alternatively, on Sun systems and 4.3BSD at least, you can correct the include files by running the shell script @file{fixincludes}. This -installs modified, corrected copies of the files @file{ioctl.h} and -@file{ttychars.h} in a special directory where only GNU CC will -normally look for them. +installs modified, corrected copies of the files @file{ioctl.h}, +@file{ttychars.h} and many others, in a special directory where only +GNU CC will normally look for them. -The file @file{/usr/include/vaxuba/qvioctl.h} used in the X window -system needs a similar correction. +See the file @file{fixincludes} for a list of all the files we know to +require correction. @end enumerate If you cannot install the compiler's passes and run-time support in @@ -1064,12 +1156,24 @@ the prefix with the names @file{cpp}, @ Thus, you can put the files in a directory @file{/usr/foo/gcc} and specify @samp{-B/usr/foo/gcc/} when you run GNU CC. +Also, you can specify an alternative default directory for these files +by setting the Make variable @code{libdir} when you make GNU CC. + @node VMS Install,, Installation, Installation @section Installing GNU CC on VMS -The VMS version of GNU CC is normally distributed as a Backup -saveset, so the only installation required is to copy the files. -But here is how to rebuild GNU CC if you change it: +The VMS version of GNU CC is distributed in an unusual tape format which +consists of several tape files. The first is a command file; the second is +an executable program which reads Unix tar format; the third is another +command file which uses this program to read the remainder of the tape. + +To load the tape, it suffices to mount it @samp{/foreign} and then do +@samp{@@mta0:} to execute the command file at the beginning of the tape. + +The tape contains executables and object files as well as sources, so no +compilation is necessary unless you change the sources. (This is a good +thing, since you probably don't have any other C compiler.) If you must +recompile, here is how: @enumerate @item @@ -1081,7 +1185,70 @@ to @file{aux-output.c}.@refill Type @samp{@@make} to do recompile everything. @end enumerate -@node Incompatibilities, Extensions, Installation, Top +To install the @samp{GCC} command so you can use the compiler easily, in +the same manner as you use the VMS C compiler, you must install the VMS CLD +file for GNU CC as follows: + +@enumerate +@item +Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE} +to point to the directories where the GNU CC executables +(@samp{gcc-cpp}, @samp{gcc-cc1}, etc.) and the C include files are +kept. This should be done with the commands:@refill + +@example +$ assign /super /system disk:[gcc] gnu_cc +$ assign /super /system disk:[gcc.include] gnu_cc_include +@end example + +@noindent +with the appropriate disk and directory names. These commands can be +placed in your system startup file so they will be executed whenever +the machine is rebooted. + +@item +Install the @samp{GCC} command with the command line: + +@example +$ set command /table=sys$library:dcltables gnu_cc:gcc +@end example + +@noindent +Now you can invoke the compiler with a command like @samp{gcc /verbose +file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in +Unix. +@end enumerate + +@node Trouble, Incompatibilities, Installation, Top +@chapter Trouble in Installation + +Here are some of the things that have caused trouble for people installing +GNU CC. + +@itemize @bullet +@item +On certain systems, defining certain environment variables such as +@samp{CC} can interfere with the functioning of @code{make}. + +@item +Cross compilation can run into trouble for certain machines because +some target machines' assemblers require floating point numbers to be +written as @emph{integer} constants in certain contexts. + +The compiler writes these integer constants by examining the floating +point value as an integer and printing that integer, because this is +simple to write and independent of the details of the floating point +representation. But this does not work if the compiler is running on +a different machine with an incompatible floating point format, or +even a different byte-ordering. + +It is possible to fix this by writing machine-independent code which +understands the floating point representation of the target machine. +I am not interested in doing that much work to compensate for bugs +in assemblers. +@end itemize + +@node Incompatibilities, Extensions, Trouble, Top @chapter Incompatibilities of GNU CC There are several noteworthy incompatibilities between GNU C and most @@ -1183,6 +1350,12 @@ by Bison grammar rules rather than C cod flag cannot alter it. @item +When compiling functions that return @code{float}, PCC converts it to +a double. GNU CC actually returns a @code{float}. If you are concerned +with PCC compatibility, you should declare your functions to return +@code{double}; you might as well say what you mean. + +@item When compiling functions that return structures or unions, GNU CC output code uses a method different from that used on most versions of Unix. As a result, code compiled with GNU CC cannot call a @@ -1215,8 +1388,9 @@ struct foo *nextfoo (); @end example @noindent -(Note that this assumes you are using the GNU preprocessor, so that -the ANSI antirecursion rules for macro expansions are effective.) +(Note that this assumes you are using the GNU preprocessor and not +@samp{-traditional}, so that the ANSI antirecursion rules for macro +expansions are effective.) @end itemize @node Extensions, Bugs, Incompatibilities, Top @@ -1516,7 +1690,7 @@ struct line @{ @{ struct line *thisline = (struct line *) malloc (sizeof (struct line) + this_length); - thisline->length = thislength; + thisline->length = this_length; @} @end example @@ -1791,20 +1965,23 @@ from the first input, if any. Commas se inputs. The number of operands is limited to the maximum number of operands in any instruction pattern in the machine description. -Output operand expressions must be lvalues, and there must be at least one -of them. The compiler can check this. The input operands need not be -lvalues, and there need not be any. The compiler cannot check whether the -operands have data types that are reasonable for the instruction being +Output operand expressions must be lvalues; the compiler can check this. +The input operands need not be lvalues. The compiler cannot check whether +the operands have data types that are reasonable for the instruction being executed. +If there are no output operands, and there are input operands, then you +should write two colons in a row where the output operands would go. + The output operands must be write-only; GNU CC will assume that the values in these operands before the instruction are dead and need not be -generated. For an operand that is read-write, you must logically split its -function into two separate operands, one input operand and one write-only -output operand. The connection between them is expressed by constraints -which say they need to be in the same location when the instruction -executes. You can use the same C expression for both operands, or -different expressions. For example, here we write the (fictitious) +generated. For an operand that is read-write, or in which not all bits are +written and the other bits contain useful information, you must logically +split its function into two separate operands, one input operand and one +write-only output operand. The connection between them is expressed by +constraints which say they need to be in the same location when the +instruction executes. You can use the same C expression for both operands, +or different expressions. For example, here we write the (fictitious) @samp{combine} instruction with @code{bar} as its read-only source operand and @code{foo} as its read-write destination: @@ -1814,8 +1991,14 @@ asm ("combine %2,%0" : "=r" (foo) : "0" @noindent The constraint @samp{"0"} for operand 1 says that it must occupy the same -location as operand 0. Therefore it is not necessary to substitute operand -1 into the assembler code output. +location as operand 0. + +Unless an output operand has the @samp{&} constraint modifier, GNU CC may +allocate it in the same register as an unrelated input operand, on the +assumption that the inputs are consumed before the outputs are produced. +This assumption may be false if the assembler code actually consists of +more than one instruction. In such a case, use @samp{&} for each output +operand that may not overlap an input. @xref{Modifiers}. Usually the most convenient way to use these @code{asm} instructions is to encapsulate them in macros that look like functions. For example, @@ -1950,8 +2133,7 @@ execute the input source code, that is a However, you must double-check to make sure, because you may have run into an incompatibility between GNU C and traditional C (@pxref{Incompatibilities}). These incompatibilities might be considered -bugs, but they are inescapable consequences of features valuable -features. +bugs, but they are inescapable consequences of valuable features. Or you may have a program whose behavior is undefined, which happened by chance to give the desired results with another C compiler. @@ -2112,6 +2294,14 @@ generated for that line. If you send me examples of output from GNU CC, please use @samp{-g} when you make them. The debugging information includes source line numbers which are essential for correlating the output with the input. + +@item +If you wish to suggest changes to the GNU CC source, send me context +diffs. If you even discuss something in the GNU CC source, refer to +it by context, not by line number. + +The line numbers in my development sources don't match those in your +sources. They won't tell me anything. @end itemize Here are some things that are not necessary: @@ -2207,7 +2397,7 @@ and unions of other sizes are returned b passed by the caller in a register. This method is faster than the one normally used by PCC and is also reentrant. The register used for passing the address is specified by the machine-description macro -@code{STRUCT_VALUE_REGNUM}. +@code{STRUCT_VALUE}. GNU CC always passes arguments on the stack. At some point it will be extended to pass arguments in registers, for machines which use that as @@ -2741,6 +2931,16 @@ that the value of the expression never c current function). In an RTL dump, this flag is represented as @samp{/u}. + +@item integrated +In some kinds of expressions, including insns, this flag means the +rtl was produced by procedure integration. + +In a @samp{reg} expression, this flag indicates the register +containing the value to be returned by the current function. On +machines that pass parameters in registers, the same register number +may be used for parameters as well, but this flag is not set on such +uses. @end table @node Machine Modes, Constants, Flags, RTL @@ -3863,8 +4063,11 @@ appropriate register receives a useful v Immediately after RTL generation, if the value of the subroutine is actually used, this call insn is always followed closely by an insn which -refers to the register @var{r}. The following insn has one of two forms. -Either it copies the value into a pseudo-register, like this: +refers to the register @var{r}. This remains true through all the +optimizer passes until cross jumping occurs. + +The following insn has one of two forms. Either it copies the value into a +pseudo-register, like this: @example (set (reg:@var{m} @var{p}) (reg:@var{m} @var{r})) @@ -3879,7 +4082,7 @@ value the call produced, and no operatio @end example @noindent -Between the call insn and this insn there may intervene only a +Between the call insn and this following insn there may intervene only a stack-adjustment insn (and perhaps some @samp{note} insns). When a subroutine returns a @code{BLKmode} value, it is handled by @@ -4692,6 +4895,32 @@ natural mode is wider than @var{m}, the to store the specified value in the part of the register that corresponds to mode @var{m}. The effect on the rest of the register is undefined. +This class of patterns is special in several ways. First of all, each +of these names @emph{must} be defined, because there is no other way +to copy a datum from one place to another. + +Second, these patterns are not used solely in the RTL generation pass. +Even the reload pass can generate move insns to copy values from stack +slots into temporary registers. When it does so, one of the operands +is a hard register and the other is an operand that can have a reload. + +Therefore, when given such a pair of operands, the pattern must +generate RTL which needs no temporary registers---no registers other +than the operands. For example, if you support the pattern with a +@code{define_expand}, then in such a case you mustn't call +@code{force_reg} or any other such function which might generate new +pseudo registers. + +This requirement exists even for subword modes on a RISC machine where +fetching those modes from memory normally requires several insns and +some temporary registers. Look in @file{spur.md} to see how the +requirement is satisfied. + +The variety of operands that have reloads depends on the rest of the +machine description, but typically on a RISC machine these can only be +pseudo registers that did not get hard registers, while on other +machines explicit memory references will get optional reloads. + @item @samp{movstrict@var{m}} Like @samp{mov@var{m}} except that if operand 0 is a @samp{subreg} with mode @var{m} of a register whose natural mode is wider, @@ -4905,8 +5134,51 @@ Subroutine return instruction. This ins defined only if a single instruction can do all the work of returning from a function. +@item @samp{casesi} +Instruction to jump through a dispatch table, including bounds checking. +This instruction takes five operands: + +@enumerate +@item +The index to dispatch on, which has mode @code{SImode}. + +@item +The lower bound for indices in the table, an integer constant. + +@item +The upper bound for indices in the table, an integer constant. + +@item +A label to jump to if the index has a value outside the bounds. +(If the machine-description macro @code{CASE_DROPS_THROUGH} is defined, +then an out-of-bounds index drops through to the code following +the jump table instead of jumping to this label. In that case, +this label is not actually used by the @samp{casesi} instruction, +but it is always provided as an operand.) + +@item +A label that precedes the table itself. +@end enumerate + +The table is a @samp{addr_vec} or @samp{addr_diff_vec} inside of a +@samp{jump_insn}. The number of elements in the table is one plus the +difference between the upper bound and the lower bound. + @item @samp{tablejump} -@item @samp{case@var{m}} +Instruction to jump to a variable address. This is a low-level +capability which can be used to implement a dispatch table when there +is no @samp{casesi} pattern. + +This pattern requires two operands: the address or offset, and a label +which should immediately precede the jump table. If the macro +@code{CASE_VECTOR_PC_RELATIVE} is defined then the first operand is an +absolute address to jump to; otherwise, it is an offset which counts +from the address of the table. + +The @samp{tablejump} insn is always the last insn before the jump +table it uses. Its assembler code normally has no need to use the +second operand, but you should incorporate it in the RTL pattern so +that the jump optimizer will not delete the table as unreachable code. @end table @node Pattern Ordering, Dependent Patterns, Standard Names, Machine Desc @@ -5544,6 +5816,31 @@ If you do not define this macro, the def Define this if instructions will fail to work if given data not on the nominal alignment. If instructions will merely go slower in that case, do not define this macro. + +@item PCC_BITFIELD_TYPE_MATTERS +Define this if you wish to imitate a certain bizarre behavior pattern +of some instances of PCC: a bit field whose declared type is +@code{int} has the same effect on the size and alignment of a +structure as an actual @code{int} would have. + +Just what effect that is in GNU CC depends on other parameters, but on +most machines it would force the structure's alignment and size to a +multiple of 32 or @code{BIGGEST_ALIGNMENT} bits. + +@item CHECK_FLOAT_VALUE (@var{mode}, @var{value}) +A C statement to validate the value @var{value} (or type +@code{double}) for mode @var{mode}. This means that you check whether +@var{value} fits within the possible range of values for mode +@var{mode} on this target machine. The mode @var{mode} is always +@code{SFmode} or @code{DFmode}. + +If @var{value} is not valid, you should call @code{error} to print an +error message and then assign some valid value to @var{value}. +Allowing an invalid value to go through the compiler can produce +incorrect assembler code which may even cause Unix assemblers to +crash. + +This macro need not be defined if there is no work for it to do. @end table @node Registers, Register Classes, Storage Layout, Machine Macros @@ -5595,6 +5892,48 @@ on target flags. You need not define this macro if it has no work to do. +@item OVERLAPPING_REGNO_P (@var{regno}) +If defined, this is a C expression whose value is @var{regno} is +nonzero if hard register number @var{regno} is an overlapping +register. This means a hard register which overlaps a hard register +with a different number. (Such overlap is undesirable, but +occasionally it allows a machine to be supported which otherwise could +not be.) This macro must return nonzero for @emph{all} the registers +which overlap each other. GNU CC can use an overlapping register only +in certain limited ways. It can be used for allocation within a basic +block, and may be spilled for reloading; that is all. + +If this macro is not defined, it means that none of the hard registers +overlap each other. This is the usual situation. + +@item INSN_CLOBBERS_REGNO_P (@var{insn}, @var{regno}) +If defined, this is a C expression whose value should be nonzero if +the insn @var{insn} has the effect of mysteriously clobbering the +contents of hard register number @var{regno}. By ``mysterious'' we +mean that the insn's RTL expression doesn't describe such an effect. + +If this macro is not defined, it means that no insn clobbers registers +mysteriously. This is the usual situation; all else being equal, +it is best for the RTL expression to show all the activity. + +@item PRESERVE_DEATH_INFO_REGNO_P (@var{regno}) +If defined, this is a C expression whose value is nonzero if accurate +@code{REG_DEAD} notes are needed for hard register number @var{regno} +at the time of outputting the assembler code. When this is so, a few +optimizations that take place after register allocation and could +invalidate the death notes are not done when this register is +involved. + +You would arrange to preserve death info for a register when some +of the code in the machine description which is executed to write +the assembler code looks at the the death notes. This is +necessary only when the actual hardware feature which GNU CC +thinks of as a register is not actually a register of the usual sort. +(It might, for example, be a hardware stack.) + +If this macro is not defined, it means that no death notes need to be +preserved. This is the usual situation. + @item HARD_REGNO_REGS (@var{regno}, @var{mode}) A C expression for the number of consecutive hard registers, starting at register number @var{regno}, required to hold a value of mode @@ -5691,16 +6030,16 @@ the function a frame pointer regardless them.@refill In a function that does not require a frame pointer, the frame pointer -register can be allocated for ordinary usage, provided it is not -marked as a fixed register. See @code{FIXED_REGISTERS} for more -information. +register can be allocated for ordinary usage, unless you mark it as a +fixed register. See @code{FIXED_REGISTERS} for more information. @item ARG_POINTER_REGNUM The register number of the arg pointer register, which is used to access the function's argument list. On some machines, this is the same as the frame pointer register. On some machines, the hardware determines which register this is. On other machines, you can choose -any register you wish for this purpose. It must in any case be a +any register you wish for this purpose. If this is not the same +register as the frame pointer register, then you must mark it as a fixed register according to @code{FIXED_REGISTERS}. @item STATIC_CHAIN_REGNUM @@ -5716,8 +6055,48 @@ The static chain register need not be a When a function's value's mode is @code{BLKmode}, the value is not returned according to @code{FUNCTION_VALUE}. Instead, the caller passes the address of a block of memory in which the value should be -stored. @code{STRUCT_VALUE_REGNUM} is the register in which this -address is passed. +stored. + +If this value is passed in a register, then @code{STRUCT_VALUE_REGNUM} +should be the number of that register. + +@item STRUCT_VALUE +If the structure value address is not passed in a register, define +@code{STRUCT_VALUE} as an expression returning an RTX for the place +where the address is passed. If it returns a @samp{mem} RTX, the +address is passed as an ``invisible'' first argument. + +@item STRUCT_VALUE_INCOMING_REGNUM +On some architectures the place where the structure value address +is found by the called function is not the same place that the +caller put it. This can be due to register windows, or it could +be because the function prologue moves it to a different place. + +If the incoming location of the structure value address is in a +register, define this macro as the register number. + +@item STRUCT_VALUE_INCOMING +If the incoming location is not a register, define +@code{STRUCT_VALUE_INCOMING} as an expression for an RTX for where the +called function should find the value. If it should find the value on +the stack, define this to create a @samp{mem} which refers to the +frame pointer. If the value is a @samp{mem}, the compiler assumes it +is for an invisible first argument, and leaves space for it when +finding the first real argument. + +@item REG_ALLOC_ORDER +If defined, an initializer for a vector of integers, containing the +numbers of hard registers in the order in which the GNU CC should +prefer to use them (from most preferred to least). + +If this macro is not defined, registers are used lowest numbered first +(all else being equal). + +One use of this macro is on the 360, where the highest numbered +registers must always be saved and the save-multiple-registers +instruction supports only sequences of consecutive registers. This +macro is defined to cause the highest numbered allocatable registers +to be used first. @end table @node Register Classes, Stack Layout, Registers, Machine Macros @@ -5842,6 +6221,11 @@ the value of this macro is always @code{ @var{class} includes the data registers. Requiring a data register guarantees that a @samp{moveq} will be used. +If @var{x} is a @samp{const_double}, by returning @code{NO_REGS} +you can force @var{x} into a memory constant. This is useful on +certain machines where immediate floating values cannot be loaded into +certain kinds of registers. + @item CLASS_MAX_NREGS (@var{class}, @var{mode}) A C expression for the maximum number of consecutive registers of class @var{class} needed to hold a value of mode @var{mode}. @@ -5998,7 +6382,7 @@ compiled. @item FUNCTION_VALUE_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard -register in which function values are sometimes returned. +register in which the values of called function may come back. A register whose use for returning values is limited to serving as the second of a pair (for a value of type @code{double}, say) need not be @@ -6009,6 +6393,10 @@ suffices: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) @end example +If the machine has register windows, so that the caller and the called +function use different registers for the return value, this macro +should recognize only the caller's register numbers. + @item FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named}) A C expression that controls whether a function argument is passed in a register, and which register. @@ -6086,6 +6474,24 @@ the structure-value address. On many ma used for this purpose since all function arguments are pushed on the stack. +@item FUNCTION_ARG_PADDING (@var{mode}, @var{size}) +If defined, a C expression which determines whether, and in which direction, +to pad out an argument with extra space. The value should be of type +@code{enum direction}: either @code{upward} to pad above the argument, +@code{downward} to pad below, or @code{none} to inhibit padding. + +The argument @var{size} is an RTX which describes the size of the +argument, in bytes. It should be used only if @var{mode} is +@code{BLKmode}. Otherwise, @var{size} is 0. + +This macro does not control the @emph{amount} of padding; that is +always just enough to reach the next multiple of @code{PARM_BOUNDARY}. + +This macro has a default definition which is right for most systems. +For little-endian machines, the default is to pad upward. For +big-endian machines, the default is to pad downward for an argument of +constant size shorter than an @code{int}, and upward otherwise. + @item FUNCTION_PROLOGUE (@var{file}, @var{size}) A C compound statement that outputs the assembler code for entry to a function. The prologue is responsible for setting up the stack frame, @@ -6357,7 +6763,11 @@ and @samp{-funsigned-char}. @item SCCS_DIRECTIVE Define this if the preprocessor should ignore @code{#sccs} directives -with no error message. +and print no error message. + +@item IDENT_DIRECTIVE +Define this if the preprocessor should ignore @code{#ident} directives +and print no error message. @item MOVE_MAX The maximum number of bytes that a single instruction can move quickly @@ -6404,6 +6814,12 @@ On many machines, this expression can be Define this macro if it is as good or better to call a constant function address than to call an address kept in a register. +@item PROMOTE_PROTOTYPES +Define this macro if an argument declared as @code{char} or +@code{short} in a prototype should actually be passed as an +@code{int}. In addition to avoiding errors in certain cases of +mismatch, it also makes for better code on certain machines. + @item STORE_FLAG_VALUE A C expression for the value stored by a store-flag instruction (@code{s@var{cond}}) when the condition is true. This is usually 1 or @@ -6439,8 +6855,8 @@ precise value of the constant, which is obtained with @code{GET_CODE (@var{x})}. @item DOLLARS_IN_IDENTIFIERS -Define this if the character @samp{$} should be allowed in identifier -names. +Define this to be nonzero if the character @samp{$} should be allowed +by default in identifier names. @end table @node Condition Code, Assembler Format, Misc, Machine Macros @@ -6506,12 +6922,17 @@ give to GNU CC into options for GNU CC t Do not define this macro if it does not need to do anything. -@item ASM_FILE_START -A C string constant for text to be output at the start of each -assembler output file. Normally this is @code{"#NO_APP"}, which is a -comment that has no effect on most assemblers but tells the GNU -assembler that it can save time by not checking for certain assembler -constructs. +@item ASM_FILE_START (@var{stream}) +A C expression which outputs to the stdio stream @var{stream} +some appropriate text to go at the start of an assembler file. + +Normally this macro is defined to output a line containing +@samp{#NO_APP}, which is a comment that has no effect on most +assemblers but tells the GNU assembler that it can save time by not +checking for certain assembler constructs. + +On systems that use SDB, it is necessary to output certain commands; +see @file{tm-attasm.h}. @item ASM_APP_ON A C string constant for text to be output before each @code{asm} @@ -6548,6 +6969,25 @@ registers that the compiler knows about versa. In such cases, some register may need to have one number in the compiler and another for DBX. +@item DBX_DEBUGGING_INFO +Define this macro if GNU CC should produce debugging output for DBX +in response to the @samp{-g} option. + +@item SDB_DEBUGGING_INFO +Define this macro if GNU CC should produce debugging output for SDB +in response to the @samp{-g} option. + +@item PUT_SDB_@var{op} +Define these macros to override the assembler syntax for the special +SDB assembler directives. See @file{sdbout.c} for a list of these +macros and their arguments. If the standard syntax is used, you need +not define them yourself. + +@item SDB_GENERATE_FAKE +Define this macro to override the usual method of constructing a dummy +name for anonymous structure and union types. See @file{sdbout.c} for +more infomation. + @item DBX_NO_XREFS Define this macro if DBX on your system does not support the construct @samp{xs@var{tagname}}. On some systems, this construct is used to @@ -6570,47 +7010,47 @@ a different character instead, define th constant for the character you want to use. Do not define this macro if backslash is correct for your system. -@item ASM_OUTPUT_LABEL (@var{file}, @var{name}) +@item ASM_OUTPUT_LABEL (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream -@var{file} the assembler definition of a label named @var{name}. Use -the expression @code{assemble_name (@var{file}, @var{name})} to output +@var{stream} the assembler definition of a label named @var{name}. Use +the expression @code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. -@item ASM_DECLARE_FUNCTION_NAME (@var{file}, @var{name}) +@item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream -@var{file} any text necessary for declaring the name of a function +@var{stream} any text necessary for declaring the name of a function which is being defined. This macro is responsible for outputting the label definition (perhaps using @code{ASM_OUTPUT_LABEL}). If this macro is not defined, then the function name is defined in the usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). -@item ASM_GLOBALIZE_LABEL (@var{file}, @var{name}) +@item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream -@var{file} some commands that will make the label @var{name} global; +@var{stream} some commands that will make the label @var{name} global; that is, available for reference from other files. Use the expression -@code{assemble_name (@var{file}, @var{name})} to output the name +@code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for making that name global, and a newline. -@item ASM_OUTPUT_EXTERNAL (@var{file}, @var{name}) +@item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{name}) A C statement (sans semicolon) to output to the stdio stream -@var{file} any text necessary for declaring the name of an external +@var{stream} any text necessary for declaring the name of an external symbol which is referenced in this compilation but not defined. This macro need not be defined if it does not need to output anything. The GNU assembler and most Unix assemblers don't require anything. -@item ASM_OUTPUT_LABELREF (@var{file}, @var{name}) -A C statement to output to the stdio stream @var{file} a reference in +@item ASM_OUTPUT_LABELREF (@var{stream}, @var{name}) +A C statement to output to the stdio stream @var{stream} a reference in assembler syntax to a label named @var{name}. The character @samp{_} should be added to the front of the name, if that is customary on your operating system, as it is in most Berkeley Unix systems. This macro is used in @code{assemble_name}. -@item ASM_OUTPUT_INTERNAL_LABEL (@var{file}, @var{prefix}, @var{num}) -A C statement to output to the stdio stream @var{file} a label whose +@item ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{prefix}, @var{num}) +A C statement to output to the stdio stream @var{stream} a label whose name is made from the string @var{prefix} and the number @var{num}. These labels are used for internal purposes, and there is no reason for them to appear in the symbol table of the object file. On many @@ -6618,10 +7058,10 @@ systems, the letter @samp{L} at the begi effect. The usual definition of this macro is as follows: @example -fprintf (@var{file}, "L%s%d:\n", @var{prefix}, @var{num}) +fprintf (@var{stream}, "L%s%d:\n", @var{prefix}, @var{num}) @end example -@item ASM_OUTPUT_CASE_LABEL (@var{file}, @var{prefix}, @var{num}, @var{table}) +@item ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table}) Define this if the label before a jump-table needs to be output specially. The first three arguments are the same as for @code{ASM_OUTPUT_INTERNAL_LABEL}; the fourth argument is the @@ -6634,6 +7074,16 @@ for the table. If this macro is not defined, these labels are output with @code{ASM_OUTPUT_INTERNAL_LABEL}. +@item ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table}) +Define this if something special must be output at the end of a jump-table. +The definition should be a C statement to be executed after the assembler +code for the table is written. It should write the appropriate code to +stdio stream @var{stream}. The argument @var{table} is the jump-table +insn, and @var{num} is the label-number of the preceding label. + +If this macro is not defined, nothing special is output at the end of +the jump-table. + @item ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number}) A C expression to assign to @var{outvar} (which is a variable of type @code{char *}) a newly allocated string made from the string @@ -6652,63 +7102,63 @@ conflict with the user's own symbols. M or percent signs in assembler symbols; putting at least one of these between the name and the number will suffice. -@item ASM_OUTPUT_ADDR_DIFF_ELT (@var{file}, @var{value}, @var{rel}) +@item ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{value}, @var{rel}) This macro should be provided on machines where the addresses in a dispatch table are relative to the table's own address. The definition should be a C statement to output to the stdio stream -@var{file} an assembler pseudo-instruction to generate a difference +@var{stream} an assembler pseudo-instruction to generate a difference between two labels. @var{value} and @var{rel} are the numbers of two internal labels. The definitions of these labels are output using @code{ASM_OUTPUT_INTERNAL_LABEL}, and they must be printed in the same way here. For example, @example -fprintf (@var{file}, "\t.word L%d-L%d\n", +fprintf (@var{stream}, "\t.word L%d-L%d\n", @var{value}, @var{rel}) @end example -@item ASM_OUTPUT_ADDR_VEC_ELT (@var{file}, @var{value}) +@item ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value}) This macro should be provided on machines where the addresses in a dispatch table are absolute. The definition should be a C statement to output to the stdio stream -@var{file} an assembler pseudo-instruction to generate a reference to +@var{stream} an assembler pseudo-instruction to generate a reference to a label. @var{value} is the number of an internal label whose definition is output using @code{ASM_OUTPUT_INTERNAL_LABEL}. For example, @example -fprintf (@var{file}, "\t.word L%d\n", @var{value}) +fprintf (@var{stream}, "\t.word L%d\n", @var{value}) @end example -@item ASM_OUTPUT_DOUBLE (@var{file}, @var{value}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_DOUBLE (@var{stream}, @var{value}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to assemble a @code{double} constant whose value is @var{value}. @var{value} will be a C expression of type @code{double}. -@item ASM_OUTPUT_FLOAT (@var{file}, @var{value}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_FLOAT (@var{stream}, @var{value}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to assemble a @code{float} constant whose value is @var{value}. @var{value} will be a C expression of type @code{float}. -@item ASM_OUTPUT_INT (@var{file}, @var{exp}) -@itemx ASM_OUTPUT_SHORT (@var{file}, @var{exp}) -@itemx ASM_OUTPUT_CHAR (@var{file}, @var{exp}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_INT (@var{stream}, @var{exp}) +@itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp}) +@itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to assemble a @code{int}, @code{short} or @code{char} constant whose value is @var{value}. The argument @var{exp} will be an RTL expression which represents a constant value. Use @samp{output_addr_const (@var{exp})} to output this value as an assembler expression.@refill -@item ASM_OUTPUT_BYTE (@var{file}, @var{value}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_BYTE (@var{stream}, @var{value}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to assemble a single byte containing the number @var{value}. -@item ASM_OUTPUT_ASCII (@var{file}, @var{ptr}, @var{len}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to assemble a string constant containing the @var{len} bytes at @var{ptr}. @var{ptr} will be a C expression of type @code{char *} and @var{len} a C expression of type @code{int}. @@ -6717,38 +7167,46 @@ If the assembler has a @code{.ascii} pse Berkeley Unix assembler, do not define the macro @code{ASM_OUTPUT_ASCII}. -@item ASM_OUTPUT_SKIP (@var{file}, @var{nbytes}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to advance the location counter by @var{nbytes} bytes. @var{nbytes} will be a C expression of type @code{int}. -@item ASM_OUTPUT_ALIGN (@var{file}, @var{power}) -A C statement to output to the stdio stream @var{file} an assembler +@item ASM_OUTPUT_ALIGN (@var{stream}, @var{power}) +A C statement to output to the stdio stream @var{stream} an assembler instruction to advance the location counter to a multiple of 2 to the @var{power} bytes. @var{power} will be a C expression of type @code{int}. -@item ASM_OUTPUT_COMMON (@var{file}, @var{name}, @var{size}) +@item ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}) A C statement (sans semicolon) to output to the stdio stream -@var{file} the assembler definition of a common-label named @var{name} +@var{stream} the assembler definition of a common-label named @var{name} whose size is @var{size} bytes. Use the expression -@code{assemble_name (@var{file}, @var{name})} to output the name +@code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. This macro controls how the assembler definitions of uninitialized global variables are output. -@item ASM_OUTPUT_LOCAL (@var{file}, @var{name}, @var{size}) +@item ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}) A C statement (sans semicolon) to output to the stdio stream -@var{file} the assembler definition of a local-common-label named +@var{stream} the assembler definition of a local-common-label named @var{name} whose size is @var{size} bytes. Use the expression -@code{assemble_name (@var{file}, @var{name})} to output the name +@code{assemble_name (@var{stream}, @var{name})} to output the name itself; before and after that, output the additional assembler syntax for defining the name, and a newline. This macro controls how the assembler definitions of uninitialized static variables are output. +@item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}) +A C statment to output DBX or SDB debugging information before code +for line number @var{line} of the current source file to the +stdio stream @var{stream}. + +This macro need not be defined if the standard form of debugging +information for the debugger in use is appropriate. + @item TARGET_BELL A C constant expression for the integer value for escape sequence @samp{\a}. @@ -6765,16 +7223,16 @@ C constant expressions for the integer v C constant expressions for the integer values for escape sequences @samp{\v}, @samp{\f} and @samp{\r}. -@item ASM_OUTPUT_OPCODE (@var{file}, @var{ptr}) +@item ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr}) Define this macro if you are using an unusual assembler that requires different names for the machine instructions. The definition is a C statement or statements which output an -assembler instruction opcode to the stdio stream @var{file}. The +assembler instruction opcode to the stdio stream @var{stream}. The macro-operand @var{ptr} is a variable of type @code{char *} which points to the opcode name in its ``internal'' form---the form that is written in the machine description. The definition should output the -opcode name to @var{file}, performing any translation you desire, and +opcode name to @var{stream}, performing any translation you desire, and increment the variable @var{ptr} to point at the end of the opcode so that it will not be output twice. @@ -6787,8 +7245,29 @@ care of the substitution yourself. Just If the macro definition does nothing, the instruction is output in the usual way. -@item PRINT_OPERAND (@var{file}, @var{x}, @var{code}) -A C compound statement to output to stdio stream @var{file} the +@item FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands}) +If defined, a C statement to be executed just prior to the output of +assembler code for @var{insn}, to modify the extracted operands so +they will be output differently. + +Here the argument @var{opvec} is the vector containing the operands +extracted from @var{insn}, and @var{noperands} is the number of +elements of the vector which contain meaningful data for this insn. +The contents of this vector are what will be used to convert the insn +template into assembler code, so you can change the assembler output +by changing the contents of the vector. + +This macro is useful when various assembler syntaxes share a single +file of instruction patterns; by defining this macro differently, you +can cause a large class of instructions to be output differently (such +as with rearranged operands). Naturally, variations in assembler +syntax affecting individual insn patterns ought to be handled by +writing conditional output routines in those patterns. + +If this macro is not defined, it is equivalent to a null statement. + +@item PRINT_OPERAND (@var{stream}, @var{x}, @var{code}) +A C compound statement to output to stdio stream @var{stream} the assembler syntax for an instruction operand @var{x}. @var{x} is an RTL expression. @@ -6810,8 +7289,8 @@ When the machine description has a speci with a null pointer for @var{x} and the punctuation character for @var{code}. -@item PRINT_OPERAND_ADDRESS (@var{file}, @var{x}) -A C compound statement to output to stdio stream @var{file} the +@item PRINT_OPERAND_ADDRESS (@var{stream}, @var{x}) +A C compound statement to output to stdio stream @var{stream} the assembler syntax for an instruction operand that is a memory reference whose address is @var{x}. @var{x} is an RTL expression.