⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tm.texi

📁 GUN开源阻止下的编译器GCC
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
The minimum requirement for a mode to be OK in a register is that the@samp{mov@var{mode}} instruction pattern support moves between theregister and any other hard register for which the mode is OK; and thatmoving a value into the register and back out not alter it.Since the same instruction used to move @code{SImode} will work for allnarrower integer modes, it is not necessary on any machine for@code{HARD_REGNO_MODE_OK} to distinguish between these modes, providedyou define patterns @samp{movhi}, etc., to take advantage of this.  Thisis useful because of the interaction between @code{HARD_REGNO_MODE_OK}and @code{MODES_TIEABLE_P}; it is very desirable for all integer modesto be tieable.Many machines have special registers for floating point arithmetic.Often people assume that floating point machine modes are allowed onlyin floating point registers.  This is not true.  Any registers thatcan hold integers can safely @emph{hold} a floating point machinemode, whether or not floating arithmetic can be done on it in thoseregisters.  Integer move instructions can be used to move the values.On some machines, though, the converse is true: fixed-point machinemodes may not go in floating registers.  This is true if the floatingregisters normalize any value stored in them, because storing anon-floating value there would garble it.  In this case,@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes infloating registers.  But if the floating registers do not automaticallynormalize, if you can store any bit pattern in one and retrieve itunchanged without a trap, then any machine mode may go in a floatingregister, so you can define this macro to say so.The primary significance of special floating registers is rather thatthey are the registers acceptable in floating point arithmeticinstructions.  However, this is of no concern to@code{HARD_REGNO_MODE_OK}.  You handle it by writing the properconstraints for those instructions.On some machines, the floating registers are especially slow to access,so that it is better to store a value in a stack frame than in such aregister if floating point arithmetic is not being done.  As long as thefloating registers are not in class @code{GENERAL_REGS}, they will notbe used unless some pattern's constraint asks for one.@findex MODES_TIEABLE_P@item MODES_TIEABLE_P (@var{mode1}, @var{mode2})A C expression that is nonzero if it is desirable to choose registerallocation so as to avoid move instructions between a value of mode@var{mode1} and a value of mode @var{mode2}.If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are ever differentfor any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1},@var{mode2})} must be zero.@end table@node Leaf Functions@subsection Handling Leaf Functions@cindex leaf functions@cindex functions, leafOn some machines, a leaf function (i.e., one which makes no calls) can runmore efficiently if it does not make its own register window.  Often thismeans it is required to receive its arguments in the registers where theyare passed by the caller, instead of the registers where they wouldnormally arrive.The special treatment for leaf functions generally applies only whenother conditions are met; for example, often they may use only thoseregisters for its own variables and temporaries.  We use the term ``leaffunction'' to mean a function that is suitable for this specialhandling, so that functions with no calls are not necessarily ``leaffunctions''.GNU CC assigns register numbers before it knows whether the function issuitable for leaf function treatment.  So it needs to renumber theregisters in order to output a leaf function.  The following macrosaccomplish this.@table @code@findex LEAF_REGISTERS@item LEAF_REGISTERSA C initializer for a vector, indexed by hard register number, whichcontains 1 for a register that is allowable in a candidate for leaffunction treatment.If leaf function treatment involves renumbering the registers, then theregisters marked here should be the ones before renumbering---those thatGNU CC would ordinarily allocate.  The registers which will actually beused in the assembler code, after renumbering, should not be marked with 1in this vector.Define this macro only if the target machine offers a way to optimizethe treatment of leaf functions.@findex LEAF_REG_REMAP@item LEAF_REG_REMAP (@var{regno})A C expression whose value is the register number to which @var{regno}should be renumbered, when a function is treated as a leaf function.If @var{regno} is a register number which should not appear in a leaffunction before renumbering, then the expression should yield -1, whichwill cause the compiler to abort.Define this macro only if the target machine offers a way to optimize thetreatment of leaf functions, and registers need to be renumbered to dothis.@end table@findex leaf_functionNormally, @code{FUNCTION_PROLOGUE} and @code{FUNCTION_EPILOGUE} musttreat leaf functions specially.  It can test the C variable@code{leaf_function} which is nonzero for leaf functions.  (The variable@code{leaf_function} is defined only if @code{LEAF_REGISTERS} isdefined.)@c changed this to fix overfull.  ALSO:  why the "it" at the beginning@c of the next paragraph?!  --mew 2feb93 @node Stack Registers@subsection Registers That Form a StackThere are special features to handle computers where some of the``registers'' form a stack, as in the 80387 coprocessor for the 80386.Stack registers are normally written by pushing onto the stack, and arenumbered relative to the top of the stack.Currently, GNU CC can only handle one group of stack-like registers, andthey must be consecutively numbered.@table @code@findex STACK_REGS@item STACK_REGSDefine this if the machine has any stack-like registers.@findex FIRST_STACK_REG@item FIRST_STACK_REGThe number of the first stack-like register.  This one is the topof the stack.@findex LAST_STACK_REG@item LAST_STACK_REGThe number of the last stack-like register.  This one is the bottom ofthe stack.@end table@node Obsolete Register Macros@subsection Obsolete Macros for Controlling Register UsageThese features do not work very well.  They exist because they used tobe required to generate correct code for the 80387 coprocessor of the80386.  They are no longer used by that machine description and may beremoved in a later version of the compiler.  Don't use them!@table @code@findex OVERLAPPING_REGNO_P @item OVERLAPPING_REGNO_P (@var{regno})If defined, this is a C expression whose value is nonzero if hardregister number @var{regno} is an overlapping register.  This means ahard register which overlaps a hard register with a different number.(Such overlap is undesirable, but occasionally it allows a machine tobe supported which otherwise could not be.)  This macro must returnnonzero for @emph{all} the registers which overlap each other.  GNU CCcan use an overlapping register only in certain limited ways.  It canbe used for allocation within a basic block, and may be spilled forreloading; that is all.If this macro is not defined, it means that none of the hard registersoverlap each other.  This is the usual situation.@findex INSN_CLOBBERS_REGNO_P@item INSN_CLOBBERS_REGNO_P (@var{insn}, @var{regno})If defined, this is a C expression whose value should be nonzero ifthe insn @var{insn} has the effect of mysteriously clobbering thecontents of hard register number @var{regno}.  By ``mysterious'' wemean that the insn's RTL expression doesn't describe such an effect.If this macro is not defined, it means that no insn clobbers registersmysteriously.  This is the usual situation; all else being equal,it is best for the RTL expression to show all the activity.@cindex death notes@findex PRESERVE_DEATH_INFO_REGNO_P@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 fewoptimizations that take place after register allocation and couldinvalidate the death notes are not done when this register isinvolved.You would arrange to preserve death info for a register when some of thecode in the machine description which is executed to write the assemblercode looks at the death notes.  This is necessary only when the actualhardware feature which GNU CC thinks of as a register is not actually aregister of the usual sort.  (It might, for example, be a hardwarestack.)If this macro is not defined, it means that no death notes need to bepreserved.  This is the usual situation.@end table@node Register Classes@section Register Classes@cindex register class definitions@cindex class definitions, registerOn many machines, the numbered registers are not all equivalent.For example, certain registers may not be allowed for indexed addressing;certain registers may not be allowed in some instructions.  These machinerestrictions are described to the compiler using @dfn{register classes}.You define a number of register classes, giving each one a name and sayingwhich of the registers belong to it.  Then you can specify register classesthat are allowed as operands to particular instruction patterns.@findex ALL_REGS@findex NO_REGSIn general, each register will belong to several classes.  In fact, oneclass must be named @code{ALL_REGS} and contain all the registers.  Anotherclass must be named @code{NO_REGS} and contain no registers.  Often theunion of two classes will be another class; however, this is not required.@findex GENERAL_REGSOne of the classes must be named @code{GENERAL_REGS}.  There is nothingterribly special about the name, but the operand constraint letters@samp{r} and @samp{g} specify this class.  If @code{GENERAL_REGS} isthe same as @code{ALL_REGS}, just define it as a macro which expandsto @code{ALL_REGS}.Order the classes so that if class @var{x} is contained in class @var{y}then @var{x} has a lower class number than @var{y}.The way classes other than @code{GENERAL_REGS} are specified in operandconstraints is through machine-dependent operand constraint letters.You can define such letters to correspond to various classes, then usethem in operand constraints.You should define a class for the union of two classes whenever someinstruction allows both classes.  For example, if an instruction allowseither a floating point (coprocessor) register or a general register for acertain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}which includes both of them.  Otherwise you will get suboptimal code.You must also specify certain redundant information about the registerclasses: for each class, which classes contain it and which ones arecontained in it; for each pair of classes, the largest class containedin their union.When a value occupying several consecutive registers is expected in acertain class, all the registers used must belong to that class.Therefore, register classes cannot be used to enforce a requirement fora register pair to start with an even-numbered register.  The way tospecify this requirement is with @code{HARD_REGNO_MODE_OK}.Register classes used for input-operands of bitwise-and or shiftinstructions have a special requirement: each such class must have, foreach fixed-point machine mode, a subclass whose registers can transfer thatmode to or from memory.  For example, on some machines, the operations forsingle-byte values (@code{QImode}) are limited to certain registers.  Whenthis is so, each register class that is used in a bitwise-and or shiftinstruction must have a subclass consisting of registers from whichsingle-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@findex enum reg_class@item enum reg_classAn enumeral type that must be defined with all the register class namesas enumeral values.  @code{NO_REGS} must be first.  @code{ALL_REGS}must be the last register class, followed by one more enumeral value,@code{LIM_REG_CLASSES}, which is not a register class but rathertells how many classes there are.Each register class has a number, which is the value of castingthe class name to type @code{int}.  The number serves as an indexin many of the tables described below.@findex N_REG_CLASSES@item N_REG_CLASSESThe number of distinct register classes, defined as follows:@example#define N_REG_CLASSES (int) LIM_REG_CLASSES@end example@findex REG_CLASS_NAMES@item REG_CLASS_NAMESAn initializer containing the names of the register classes as C stringconstants.  These names are used in writing some of the debugging dumps.@findex REG_CLASS_CONTENTS@item REG_CLASS_CONTENTSAn initializer containing the contents of the register classes, as integerswhich are bit masks.  The @var{n}th integer specifies the contents of class@var{n}.  The way the integer @var{mask} is interpreted is thatregister @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.When the machine has more than 32 registers, an integer does not suffice.Then the integers are replaced by sub-initializers, braced groupings containingseveral integers.  Each sub-initializer must be suitable as an initializerfor the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.@findex REGNO_REG_CLASS @item REGNO_REG_CLASS (@var{regno})A C expression whose value is a register class containing hard register@var{regno}.  In general there is more than one such class; choose a classwhich is @dfn{minimal}, meaning that no smaller class also contains theregister.@findex BASE_REG_CLASS@item BASE_REG_CLASSA macro whose definition is the name of the class to which a validbase register must belong.  A base register is one used in an addresswhich is the register value plus a displacement.@findex INDEX_REG_CLASS@item INDEX_REG_CLASSA macro whose definition is the name of the class to which a validindex register must belong.  An index register is one used in anaddress where its value is either multiplied by a scale factor oradded to another register (as well as added to a displacement).@findex REG_CLASS_FROM_LETTER@item REG_CLASS_FROM_LETTER (@var{char})A C expression which defines the machine-dependent operand constraintletters for register classes.  If @var{char} is such a letter, thevalue should be the register class corresponding to it.  Otherwise,the value should be @code{NO_REGS}.  The register letter @samp{r},correspondi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -