--- gcc/internals.texinfo 2018/04/24 16:40:12 1.1.1.4 +++ gcc/internals.texinfo 2018/04/24 16:43:51 1.1.1.8 @@ -39,9 +39,9 @@ Free Software Foundation instead of in t @sp 2 @center Richard M. Stallman @sp 3 -@center last updated 26 June 1988 +@center last updated 6 September 1988 @sp 1 -@center for version 1.23 +@center for version 1.27 @page @vskip 0pt plus 1filll Copyright @copyright{} 1988 Free Software Foundation, Inc. @@ -275,10 +275,17 @@ Charles LaBrec contributed the support f 68020 system. @item -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 and for the SPARC cpu. +Michael Tiemann of MCC wrote most of the description of the National +Semiconductor 32000 series cpu. He also wrote the code for inline +function integration and for the SPARC cpu and Motorola 88000 cpu +and part of the Sun FPA support. + +@item +Jan Stein of the Chalmers Computer Society provided support for +Genix, as well as part of the 32000 machine description. + +@item +Randy Smith finished the Sun FPA support. @item Robert Brown implemented the support for Encore 32000 systems. @@ -292,6 +299,9 @@ Alex Crain provided changes for the 3b1. @item 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 @@ -417,14 +427,18 @@ Integer types @code{unsigned short} and to @code{unsigned int}. @item -In the preprocessor, comments convert to nothing at all, rather than to -a space. This allows traditional token concatenation. +Out-of-range floating point literals are not an error. @item -In the preprocessor, single and double quote characters are ignored -when scanning macro definitions, so that macro arguments can be replaced -even within a string or character constant. Quote characters are also -ignored when skipping text inside a failing conditional directive. +In the preprocessor, comments convert to nothing at all, rather than +to a space. This allows traditional token concatenation. + +@item +In the preprocessor, macro arguments are recognized within string +constants in a macro definition (and their values are stringified, +though without additional quote marks, when they appear in such a +context). The preprocessor always considers a string constant to end +at a newline. @end itemize @item -O @@ -574,6 +588,15 @@ Warn whenever a comment-start sequence @ @item -Wall All of the above @samp{-W} options combined. +@item -Wwrite-strings +Give string constants the type @code{const char[@var{length}]} so that +copying the address of one into a non-@code{const} @code{char *} +pointer will get a warning. These warnings will help you find at +compile time code that can try to write into a string constant, but +only if you have been very careful about using @code{const} in +declarations and prototypes. Otherwise, it will just be a nuisance; +this is why we did not make @samp{-Wall} request these warnings. + @item -p Generate extra code to write profile information suitable for the analysis program @code{prof}. @@ -620,16 +643,21 @@ description: @table @samp @item -m68020 +@itemx -mc68020 Generate output for a 68020 (rather than a 68000). This is the default if you use the unmodified sources. @item -m68000 +@item -mc68000 Generate output for a 68000 (rather than a 68020). @item -m68881 Generate output containing 68881 instructions for floating point. This is the default if you use the unmodified sources. +@item -mfpa +Generate output containing Sun FPA instructions for floating point. + @item -msoft-float Generate output containing library calls for floating point. @@ -965,10 +993,23 @@ 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}. +The file's name should be @file{config-@var{machine}.h}, with these +exceptions: + +@table @file +@item config-vms.h +for vaxen running VMS. +@item config-vaxv.h +for vaxen running system V. +@item config-i386v.h +for Intel 80386's running system V. +@item config-sun4.h +for Suns (model 3 or 4) running @emph{operating system} version 4. +@item config-hp9k3.h +for the HP 9000 series 300. +@item config-gnx.h +for the ns32000 running Genix +@end table If your system does not support symbolic links, you might want to set up @file{config.h} to contain a @samp{#include} command which @@ -979,40 +1020,53 @@ Make a symbolic link named @file{tm.h} t macro file for your machine (its name should be @file{tm-@var{machine}.h}). -For the 68000/68020, do not use @file{tm-m68k.h} directly; -instead use one of the files @file{tm-sun3.h}, @file{tm-sun2.h}, -@file{tm-isi68.h}, @file{tm-news800.h} or @file{tm-3b1.h}. Each -of those files includes @file{tm-m68k.h} but sets up a few things -differently as appropriate to the specific model of -machine.@refill - -There are two files you can use for a 680x0 running HPUX: -@file{tm-hp9k320.h} and @file{tm-hp9k320g.h}. Use the former if -you are installing GNU CC alone. The latter is for another option -where GNU CC together with the GNU assembler, linker, debugger -and other utilities are used to replace all of HPUX that deals -with compilation. Not all of the pieces of GNU software needed for -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 Unix, or @file{tm-vms.h} on -VMS.@refill +If your system is a 68000, don't use the file @file{tm-m68k.h} +directly. Instead, use one of these files: -For the sparc, use @file{tm-sparc.h}. +@table @file +@item tm-sun3.h +for Sun 3 machines. +@item tm-sun2.h +for Sun 2 machines. +@item tm-3b1.h +for AT&T 3b1 (aka 7300 Unix PC). +@item tm-isi68.h +for Integrated Solutions systems. +@item tm-news800.h +for SONY News systems. +@item tm-hp9k320.h +for HPUX systems, if you are using GNU CC with the system's +assembler and linker. +@item tm-hp9k320g.h +for HPUX systems, if you are using the GNU assembler, linker and +other utilities. Not all of the pieces of GNU software needed +for this mode of operation are as yet in distribution; full +instructions will appear here in the future.@refill +@end table + +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 (Sun 4), 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, +@file{tm-seq386.h} for a Sequent 386 system, or @file{tm-compaq.h} for +a Compaq. For the 32000, use @file{tm-sequent.h} if you are using a Sequent -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: - -@example -lprd sb,$0 -sprd mod,r0 -movqd $0,0(r0) -@end example +machine, or @file{tm-encore.h} for an Encore machine, or +@file{tm-gnx.h} if you are using Genix version 3; otherwise, perhaps +@file{tm-ns32k.h} will work for you. + +Note that Genix has bugs in @code{alloca} and @code{malloc}; you must +get the compiled versions of these from GNU Emacs and edit GNU CC's +@file{Makefile} to use them. Note that Encore systems are supported only under BSD. @@ -1028,13 +1082,13 @@ subroutine file for your machine (its na @item Make sure the Bison parser generator is installed. (This is -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} +unnecessary if the Bison output files @file{c-parse.tab.c} and +@file{cexp.c} are more recent than @file{c-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 -that line from @file{parse.y} and proceed. +that line from @file{c-parse.y} and proceed. @item If you are using a Sun, make sure the environment variable @@ -1079,7 +1133,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 @@ -1091,6 +1145,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: @@ -1107,6 +1164,11 @@ program looks for them. It also copies into the directory @file{/usr/local}, so that it appears in typical execution search paths.@refill +@strong{Warning: there is a bug in @code{alloca} in the Sun library. +To avoid this bug, install the binaries of GNU CC that were compiled +by GNU CC. They use @code{alloca} as a built-in function and never +the one in the library.} + @strong{Warning: the GNU CPP may not work for @file{ioctl.h}, @file{ttychars.h} and other system header files unless the @samp{-traditional} option is used.} The bug is in the header files: @@ -1122,12 +1184,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 @@ -1331,6 +1393,22 @@ by Bison grammar rules rather than C cod flag cannot alter it. @item +PCC allows typedef names to be used as function parameters. The +difficulty described immediately above applies here too. + +@item +PCC allows whitespace in the middle of compound assignment operators +such as @samp{+=}. GNU CC, following the ANSI standard, does not +allow this. The difficulty described immediately above applies here +too. + +@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 @@ -1665,7 +1743,7 @@ struct line @{ @{ struct line *thisline = (struct line *) malloc (sizeof (struct line) + this_length); - thisline->length = thislength; + thisline->length = this_length; @} @end example @@ -1940,20 +2018,26 @@ 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 -executed. +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. It does not parse the assembler instruction template and does +not know what it means, or whether it is valid assembler input. The +extended @code{asm} feature is most often used for machine instructions +that the compiler itself does not know exist. + +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: @@ -1963,8 +2047,42 @@ 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. + +Only a digit in the constraint can guarantee that one operand will be in +the same place as another. The mere fact that @code{foo} is the value of +both operands is not enough to guarantee that they will be in the same +place in the generated assembler code. The following would not work: + +@example +asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar)); +@end example + +Various optimizations or reloading could cause operands 0 and 1 to be in +different registers; GNU CC knows no reason not to do so. For example, the +compiler might find a copy of the value of @code{foo} in one register and +use it for operand 1, but generate the output operand 0 in a different +register (copying it afterward to @code{foo}'s own address). Of course, +since the register for operand 1 is not even mentioned in the assembler +code, the result will not work, but GNU CC can't tell that. + +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}. + +Some instructions clobber specific hard registers. To describe this, +write a third colon after the input operands, followed by the names of +the clobbered hard registers (given as strings). For example, on the vax, + +@example +asm volatile ("movc3 %0,%1,%2" + : /* no outputs */ + : "g" (from), "g" (to), "g" (count) + : "r0", "r1", "r2", "r3", "r4", "r5"); +@end example Usually the most convenient way to use these @code{asm} instructions is to encapsulate them in macros that look like functions. For example, @@ -2363,7 +2481,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 @@ -2448,12 +2566,12 @@ represented as declaration nodes. Constant folding and associative-law simplifications are also done during this pass. -The source files for parsing are @file{parse.y}, @file{decl.c}, -@file{typecheck.c}, @file{stor-layout.c}, @file{fold-const.c}, and -@file{tree.c}. The last three are intended to be language-independent. -There are also header files @file{parse.h}, @file{c-tree.h}, -@file{tree.h} and @file{tree.def}. The last two define the format of -the tree representation.@refill +The source files for parsing are @file{c-parse.y}, @file{c-decl.c}, +@file{c-typeck.c}, @file{c-convert.c}, @file{stor-layout.c}, +@file{fold-const.c}, and @file{tree.c}. The last three files are +intended to be language-independent. There are also header files +@file{c-parse.h}, @file{c-tree.h}, @file{tree.h} and @file{tree.def}. +The last two define the format of the tree representation.@refill @item RTL generation. This is the conversion of syntax tree into RTL code. @@ -2897,6 +3015,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 @@ -3157,6 +3285,11 @@ The compilation parameter @code{WORDS_BI that word number zero is the most significant part; otherwise, it is the least significant part. +Between the combiner pass and the reload pass, it is possible to have +a @samp{subreg} which contains a @samp{mem} instead of a @samp{reg} as +its first operand. The reload pass eliminates these cases by +reloading the @samp{mem} into a suitable register. + Note that it is not valid to access a @code{DFmode} value in @code{SFmode} using a @samp{subreg}. On some machines the most significant part of a @code{DFmode} value does not have the same format as a single-precision @@ -3578,8 +3711,10 @@ used. @item (call @var{function} @var{nargs}) Represents a function call. @var{function} is a @samp{mem} expression -whose address is the address of the function to be called. @var{nargs} -is an expression representing the number of words of argument. +whose address is the address of the function to be called. +@var{nargs} is an expression which can be used for two purposes: on +some machines it represents the number of bytes of stack argument; on +others, it represents the number of argument registers. Each machine has a standard machine mode which @var{function} must have. The machine description defines macro @code{FUNCTION_MODE} to @@ -3638,6 +3773,15 @@ location addressed by it are interchange @code{(reg:SI 1)} appears as a memory address it refers to the value in register 1 @emph{before} the execution of the instruction. +Peephole optimization, which takes place in the last jump-optimization +pass, can produce insns whose patterns consist of a @samp{parallel} +whose elements are the operands needed to output the resulting +assembler code--often @samp{reg}, @samp{mem} or constant expressions. +This would not be well-formed RTL at any other stage in compilation, +but it is ok then because no further optimization remains to be done. +However, the definition of the macro @code{NOTICE_UPDATE_CC} may need +to deal with such insns. + @item (sequence [@var{insns} @dots{}]) Represents a sequence of insns. Each of the @var{insns} that appears in the vector is suitable for appearing in the chain of insns, so it @@ -4261,8 +4405,9 @@ pattern will not match at all. Operand numbers must be chosen consecutively counting from zero in each instruction pattern. There may be only one @samp{match_operand} -expression in the pattern for each expression number, and they must -appear in order of increasing expression number. +expression in the pattern for each operand number. Usually operands +are numbered in the order of appearance in @samp{match_operand} +expressions. @var{testfn} is a string that is the name of a C function that accepts two arguments, a machine mode and an expression. During matching, @@ -4877,6 +5022,10 @@ machine description, but typically on a pseudo registers that did not get hard registers, while on other machines explicit memory references will get optional reloads. +In addition, the constraints must allow any hard register to be moved +to any other hard register (provided that @code{HARD_REGNO_MODE_OK} +permits mode @var{m} in each of the registers). + @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, @@ -4891,6 +5040,12 @@ means of constraints requiring operands @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} Similar, for other arithmetic operations. +There are special considerations for register classes for logical-and +instructions, affecting also the macro @code{PREFERRED_RELOAD_CLASS}. +They apply not only to the patterns with these standard names, but to +any patterns that will match such an instruction. @xref{Register +Classes}. + @item @samp{andcb@var{m}3} Bitwise logical-and operand 1 with the complement of operand 2 and store the result in operand 0. @@ -4936,6 +5091,12 @@ allow negative shift counts often have o shifting left. On such machines, you should define a pattern named @samp{ashl@var{m}3} and leave @samp{lshl@var{m}3} undefined. +There are special considerations for register classes for shift +instructions, affecting also the macro @code{PREFERRED_RELOAD_CLASS}. +They apply not only to the patterns with these standard names, but to +any patterns that will match such an instruction. @xref{Register +Classes}. + @item @samp{neg@var{m}2} Negate operand 1 and store the result in operand 0. @@ -5080,10 +5241,27 @@ that refers to the label to jump to. Ju meet condition @var{cond}. @item @samp{call} -Subroutine call instruction. Operand 1 is the number of bytes of -arguments pushed (in mode @code{SImode}), and operand 0 is the -function to call. Operand 0 should be a @samp{mem} RTX whose address -is the address of the function. +Subroutine call instruction returning no value. Operand 0 is the +function to call; operand 1 is the number of bytes of arguments pushed +(in mode @code{SImode}, except it is normally a @samp{const_int}); +operand 2 is the number of registers used as operands. + +On most machines, operand 2 is not actually stored into the RTL +pattern. It is supplied for the sake of some RISC machines which need +to put this information into the assembler code; they can put it in +the RTL instead of operand 1. + +Operand 0 should be a @samp{mem} RTX whose address is the address of +the function. + +@item @samp{call_value} +Subroutine call instruction returning a value. Operand 0 is the hard +register in which the value is returned. There are three more +operands, the same as the three operands of the @samp{call} +instruction (but with numbers increased by one). + +Subroutines that return @code{BLKmode} objects use the @samp{call} +insn. @item @samp{return} Subroutine return instruction. This instruction pattern name should be @@ -5643,8 +5821,10 @@ compiler source files include @file{conf @table @code @item CPP_PREDEFINES -Define this to be a string constant containing @samp{-D} options -to define the predefined macros that identify this machine and system. +Define this to be a string constant containing @samp{-D} options to +define the predefined macros that identify this machine and system. +These macros will be predefined unless the @samp{-ansi} option is +specified. For example, on the Sun, one can use the value @@ -5652,6 +5832,20 @@ For example, on the Sun, one can use the "-Dmc68000 -Dsun -Dunix" @end example +@item CPP_SPEC +A C string constant that tells the GNU CC driver program options to +pass to CPP. It can also specify how to translate options you +give to GNU CC into options for GNU CC to pass to the CPP. + +Do not define this macro if it does not need to do anything. + +@item CC1_SPEC +A C string constant that tells the GNU CC driver program options to +pass to CC1. It can also specify how to translate options you +give to GNU CC into options for GNU CC to pass to the CC1. + +Do not define this macro if it does not need to do anything. + @item extern int target_flags; This declaration should be present. @@ -5701,12 +5895,14 @@ with opposite meanings, and picks the la @{ "68000", -1@}, \ @{ "", 1@}@} @end example -@end table -Sometimes certain combinations of command options do not make sense on a -particular target machine. You can define a macro @code{OVERRIDE_OPTIONS} -to take account of this. This macro, if defined, is executed once -just after all the command options have been parsed. +@item OVERRIDE_OPTIONS +Sometimes certain combinations of command options do not make sense on +a particular target machine. You can define a macro +@code{OVERRIDE_OPTIONS} to take account of this. This macro, if +defined, is executed once just after all the command options have been +parsed. +@end table @node Storage Layout, Registers, Run-time Target, Machine Macros @section Storage Layout @@ -5743,6 +5939,9 @@ Number of storage units in a word; norma @item POINTER_SIZE Width of a pointer, in bits. +@item POINTER_BOUNDARY +Alignment required for pointers stored in memory, in bits. + @item PARM_BOUNDARY Alignment required for function parameters on the stack, in bits. @@ -5757,7 +5956,7 @@ Alignment required for a function entry @item BIGGEST_ALIGNMENT Biggest alignment that any data type can require on this machine, in bits. -@item EMPTY_FIELD_ALIGNMENT +@item EMPTY_FIELD_BOUNDARY Alignment in bits to be given to a structure bit field that follows an empty field such as @code{int : 0;}. @@ -5773,6 +5972,16 @@ Define this if instructions will fail to 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 @@ -5803,9 +6012,10 @@ pseudo register's number really is assig An initializer that says which registers are used for fixed purposes all throughout the compiled code and are therefore not available for general allocation. These would include the stack pointer, the frame -pointer, the program counter on machines where that is considered one -of the addressable registers, and any other numbered register with a -standard use. +pointer (except on machines where that can be used as a general +register when no frame pointer is needed), the program counter on +machines where that is considered one of the addressable registers, +and any other numbered register with a standard use. This information is expressed as a sequence of numbers, separated by commas and surrounded by braces. The @var{n}th number is 1 if @@ -5838,6 +6048,18 @@ on target flags. You need not define this macro if it has no work to do. +If the usage of an entire class of registers depends on the target +flags, you may indicate this to gcc by using this macro to modify +@code{fixed_regs} and @code{call_used_regs} to 1 for each of the +registers in the classes which should not be used by gcc. Also define +the macro @code{REG_CLASS_FROM_LETTER} to return @code{NO_REGS} if it +is called with a letter for a class that shouldn't be used. + +(However, if this class is not included in @code{GENERAL_REGS} and all +of the insn patterns whose constraints permit this class are +controlled by target switches, then GCC will automatically avoid using +these registers when the target switches are opposed to them.) + @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 @@ -5993,7 +6215,7 @@ The register number used for passing a f pointer. This is needed for languages such as Pascal and Algol where functions defined within other functions can access the local variables of the outer functions; it is not currently used because C -does not provide this feature. +does not provide this feature, but you must define the macro. The static chain register need not be a fixed register. @@ -6001,8 +6223,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 @@ -6044,6 +6306,16 @@ classes: for each class, which classes c contained in it; for each pair of classes, the largest class contained in their union. +Register classes used for input-operands of bitwise-and or shift +instructions have a special requirement: each such class must have, for +each fixed-point machine mode, a subclass whose registers can transfer that +mode to or from memory. For example, on some machines, the operations for +single-byte values (@code{QImode}) are limited to certain registers. When +this is so, each register class that is used in a bitwise-and or shift +instruction must have a subclass consisting of registers from which +single-byte values can be loaded or stored. This is so that +@code{PREFERRED_RELOAD_CLASS} can always have a possible value to return. + @table @code @item enum reg_class An enumeral type that must be defined with all the register class names @@ -6056,6 +6328,13 @@ Each register class has a number, which the class name to type @code{int}. The number serves as an index in many of the tables described below. +@item N_REG_CLASSES +The number of distinct register classes, defined as follows: + +@example +#define N_REG_CLASSES (int) LIM_REG_CLASSES +@end example + @item REG_CLASS_NAMES An initializer containing the names of the register classes as C string constants. These names are used in writing some of the debugging dumps. @@ -6077,15 +6356,22 @@ A C expression whose value is a register which is @dfn{minimal}, meaning that no smaller class also contains the register. +@item BASE_REG_CLASS +A macro whose definition is the name of the class to which a valid +base register must belong. A base register is one used in an address +which is the register value plus a displacement. + @item INDEX_REG_CLASS -A macro whose definition is the name of the class to which a valid index -register must belong. +A macro whose definition is the name of the class to which a valid +index register must belong. An index register is one used in an +address where its value is either multiplied by a scale factor or +added to another register (as well as added to a displacement). @item REG_CLASS_FROM_LETTER (@var{char}) A C expression which defines the machine-dependent operand constraint -letters for register classes. If @var{char} is such a letter, the value -should be the register class corresponding to it. Otherwise, the value -should be @code{NO_REGS}. +letters for register classes. If @var{char} is such a letter, the +value should be the register class corresponding to it. Otherwise, +the value should be @code{NO_REGS}. @item REGNO_OK_FOR_BASE_P (@var{num}) A C expression which is nonzero if register number @var{num} is @@ -6105,27 +6391,49 @@ two registers, neither one of them scale labeled the ``base'' and the other the ``index''; but whichever labeling is used must fit the machine's constraints of which registers may serve in each capacity. The compiler will try both labelings, -looking for one that is valid, and reload one or both registers only -if neither labeling works. +looking for one that is valid, and will reload one or both registers +only if neither labeling works. @item PREFERRED_RELOAD_CLASS (@var{x}, @var{class}) A C expression that places additional restrictions on the register class to use when it is necessary to copy value @var{x} into a register in class @var{class}. The value is a register class; perhaps @var{class}, or perhaps -another, smaller class. @var{class} is always safe as a value. In fact, -the definition +another, smaller class. On many machines, the definition @example #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS @end example @noindent -is always safe. However, sometimes returning a more restrictive class -makes better code. For example, on the 68000, when @var{x} is an -integer constant that is in range for a @samp{moveq} instruction, -the value of this macro is always @code{DATA_REGS} as long as -@var{class} includes the data registers. Requiring a data register -guarantees that a @samp{moveq} will be used. +is safe. + +Sometimes returning a more restrictive class makes better code. For +example, on the 68000, when @var{x} is an integer constant that is in range +for a @samp{moveq} instruction, the value of this macro is always +@code{DATA_REGS} as long as @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. + +In a shift instruction or a bitwise-and instruction, the mode of @var{x}, +the value being reloaded, may not be the same as the mode of the +instruction's operand. (They will both be fixed-point modes, however.) In +such a case, @var{class} may not be a safe value to return. @var{class} is +certainly valid for the instruction, but it may not be valid for reloading +@var{x}. This problem can occur on machines such as the 68000 and 80386 +where some registers can handle full-word values but cannot handle +single-byte values. + +On such machines, this macro must examine the mode of @var{x} and return a +subclass of @var{class} which can handle loads and stores of that mode. On +the 68000, where address registers cannot handle @code{QImode}, if @var{x} +has @code{QImode} then you must return @code{DATA_REGS}. If @var{class} is +@code{ADDR_REGS}, then there is no correct value to return; but the shift +and bitwise-and instructions don't use @code{ADDR_REGS}, so this fatal case +never arises. @item CLASS_MAX_NREGS (@var{class}, @var{mode}) A C expression for the maximum number of consecutive registers @@ -6208,8 +6516,11 @@ alignment. Then the definition should b #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) @end example -@item FIRST_PARM_OFFSET -Offset from the argument pointer register to the first argument's address. +@item FIRST_PARM_OFFSET (@var{fundecl}) +Offset from the argument pointer register to the first argument's +address. On some machines it may depend on the data type of the +function. (In the next version of GNU CC, the argument will be +changed to the function data type rather than its declaration.) @item RETURN_POPS_ARGS (@var{funtype}) A C expression that should be 1 if a function pops its own arguments @@ -6283,7 +6594,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 @@ -6294,6 +6605,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. @@ -6351,10 +6666,12 @@ of @code{FUNCTION_ARG} and other related machines, the type @code{int} suffices and can hold the number of bytes of argument so far. -@item INIT_CUMULATIVE_ARGS (@var{cum}) +@item INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}) A C statement (sans semicolon) for initializing the variable @var{cum} for the state at the beginning of the argument list. The variable has -type @code{CUMULATIVE_ARGS}. +type @code{CUMULATIVE_ARGS}. The value of @var{fntype} is the tree node +for the data type of the function which will receive the args, or 0 +if the args are to a compiler support library function. @item FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named}) Update the summarizer variable @var{cum} to advance past an argument @@ -6371,6 +6688,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, @@ -6435,6 +6770,13 @@ of returning from the function. On thes instruction the name @samp{return} and do not define the macro @code{FUNCTION_EPILOGUE} at all. +Do not define a pattern named @samp{return} if you want the +@code{FUNCTION_EPILOGUE} to be used. If you want the target switches +to control whether return instructions or epilogues are used, define a +@samp{return} pattern with a validity condition that tests the target +switches appropriately. If the @samp{return} pattern's validity +condition is false, epilogues will be used. + On machines where functions may or may not have frame-pointers, the function exit code must vary accordingly. Sometimes the code for these two cases is completely different. To determine whether a frame @@ -6552,6 +6894,28 @@ for index registers, and so on). Then o need have two variants; the higher levels of macros may be the same whether strict or not.@refill +@item REG_OK_FOR_BASE_P (@var{x}) +A C expression that is nonzero if @var{x} (asumed to be a @code{reg} +RTX) is valid for use as a base register. For hard registers, it +should always accept those which the hardware permits and reject the +others. Whether the macro accepts or rejects pseudo registers must be +controlled by @code{REG_OK_STRICT} as described above. This usually +requires two variant definitions, of which @code{REG_OK_STRICT} +controls the one actually used. + +@item REG_OK_FOR_INDEX_P (@var{x}) +A C expression that is nonzero if @var{x} (asumed to be a @code{reg} +RTX) is valid for use as an index register. + +The difference between an index register and a base register is that +the index register may be scaled. If an address involves the sum of +two registers, neither one of them scaled, then either one may be +labeled the ``base'' and the other the ``index''; but whichever +labeling is used must fit the machine's constraints of which registers +may serve in each capacity. The compiler will try both labelings, +looking for one that is valid, and will reload one or both registers +only if neither labeling works. + @item LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win}) A C compound statement that attempts to replace @var{x} with a valid memory address for an operand of mode @var{mode}. @var{win} will be a @@ -6693,6 +7057,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 @@ -6714,7 +7084,7 @@ An alias for the machine mode used for m being called, in @samp{call} RTL expressions. On most machines this should be @code{QImode}. -@item CONST_COST (@var{x}, @var{code}) +@item CONST_COSTS (@var{x}, @var{code}) A part of a C @code{switch} statement that describes the relative costs of constant RTL expressions. It must contain @code{case} labels for expression codes @samp{const_int}, @samp{const}, @samp{symbol_ref}, @samp{label_ref} @@ -6774,6 +7144,14 @@ this, it will no longer be true that it @samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter @code{cc_status} in this case to say that nothing is known about the condition code value. + +The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal +with the results of peephole optimization: insns whose patterns are +@samp{parallel} RTXs containing various @samp{reg}, @samp{mem} or +constants which are just the operands. The RTL structure of these +insns is not sufficient to indicate what the insns actually do. What +@code{NOTICE_UPDATE_CC} should do when it sees one is just to run +@code{CC_STATUS_INIT}. @end table @node Assembler Format,, Condition Code, Machine Macros @@ -6795,6 +7173,22 @@ give to GNU CC into options for GNU CC t Do not define this macro if it does not need to do anything. +@item LIB_SPEC +Another C string constant used much like @code{LINK_SPEC}. The difference +between the two is that @code{LIBS_SPEC} is used at the end of the +command given to the linker. + +If this macro is not defined, a default is provided that +loads the standard C library from the usual place. See @file{gcc.c}. + +@item STARTFILE_SPEC +Another C string constant used much like @code{LINK_SPEC}. The +difference between the two is that @code{STARTFILE_SPEC} is used at +the very beginning of the command given to the linker. + +If this macro is not defined, a default is provided that loads the +standard C startup file from the usual place. See @file{gcc.c}. + @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. @@ -6850,6 +7244,17 @@ in response to the @samp{-g} option. 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 @@ -6879,11 +7284,13 @@ the expression @code{assemble_name (@var 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{stream}, @var{name}) +@item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream -@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}). +@var{stream} any text necessary for declaring the name @var{name} of a +function which is being defined. This macro is responsible for +outputting the label definition (perhaps using +@code{ASM_OUTPUT_LABEL}). The argument @var{decl} is the +@code{FUNCTION_DECL} tree node representing the function. 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}). @@ -6896,10 +7303,12 @@ that is, available for reference from ot itself; before and after that, output the additional assembler syntax for making that name global, and a newline. -@item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{name}) +@item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name of an external -symbol which is referenced in this compilation but not defined. +symbol named @var{name} which is referenced in this compilation but +not defined. The value of @var{decl} is the tree node for the +declaration. 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. @@ -6911,6 +7320,14 @@ should be added to the front of the name operating system, as it is in most Berkeley Unix systems. This macro is used in @code{assemble_name}. +@item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num}) +A C statement to store into the string @var{string} a label whose +name is made from the string @var{prefix} and the number @var{num}. + +This string, when output subsequently by @code{ASM_OUTPUT_LABELREF}, +should produce the same output that @code{ASM_OUTPUT_INTERNAL_LABEL} +would produce with the same @var{prefix} and @var{num}. + @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}.