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

📄 rtl.texi

📁 早期freebsd实现
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@findex XCmode@findex TCmode@item SCmode, DCmode, XCmode, TCmodeThese modes stand for a complex number represented as a pair offloating point values.  The values are in @code{SFmode}, @code{DFmode},@code{XFmode}, and @code{TFmode}, respectively.  Since C does notsupport complex numbers, these machine modes are only partiallyimplemented.@end tableThe machine description defines @code{Pmode} as a C macro which expandsinto the machine mode used for addresses.  Normally this is the modewhose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines.The only modes which a machine description @i{must} support are@code{QImode}, and the modes corresponding to @code{BITS_PER_WORD},@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}.The compiler will attempt to use @code{DImode} for 8-byte structures andunions, but this can be prevented by overriding the definition of@code{MAX_FIXED_MODE_SIZE}.  Alternatively, you can have the compileruse @code{TImode} for 16-byte structures and unions.  Likewise, you canarrange for the C type @code{short int} to avoid using @code{HImode}.@cindex mode classesVery few explicit references to machine modes remain in the compiler andthese few references will soon be removed.  Instead, the machine modesare divided into mode classes.  These are represented by the enumerationtype @code{enum mode_class} defined in @file{machmode.h}.  The possiblemode classes are:@table @code@findex MODE_INT@item MODE_INTInteger modes.  By default these are @code{QImode}, @code{HImode},@code{SImode}, @code{DImode}, and @code{TImode}.@findex MODE_PARTIAL_INT@item MODE_PARTIAL_INTThe ``partial integer'' modes, @code{PSImode} and @code{PDImode}.@findex MODE_FLOAT@item MODE_FLOATfloating point modes.  By default these are @code{SFmode}, @code{DFmode},@code{XFmode} and @code{TFmode}.@findex MODE_COMPLEX_INT@item MODE_COMPLEX_INTComplex integer modes.  (These are not currently implemented).@findex MODE_COMPLEX_FLOAT@item MODE_COMPLEX_FLOATComplex floating point modes.  By default these are @code{SCmode},@code{DCmode}, @code{XCmode}, and @code{TCmode}.@findex MODE_FUNCTION@item MODE_FUNCTIONAlgol or Pascal function variables including a static chain.(These are not currently implemented).@findex MODE_CC@item MODE_CCModes representing condition code values.  These are @code{CCmode} plusany modes listed in the @code{EXTRA_CC_MODES} macro.  @xref{Jump Patterns},also see @ref{Condition Code}.@findex MODE_RANDOM@item MODE_RANDOMThis is a catchall mode class for modes which don't fit into the aboveclasses.  Currently @code{VOIDmode} and @code{BLKmode} are in@code{MODE_RANDOM}.@end tableHere are some C macros that relate to machine modes:@table @code@findex GET_MODE@item GET_MODE (@var{x})Returns the machine mode of the RTX @var{x}.@findex PUT_MODE@item PUT_MODE (@var{x}, @var{newmode})Alters the machine mode of the RTX @var{x} to be @var{newmode}.@findex NUM_MACHINE_MODES@item NUM_MACHINE_MODESStands for the number of machine modes available on the targetmachine.  This is one greater than the largest numeric value of anymachine mode.@findex GET_MODE_NAME@item GET_MODE_NAME (@var{m})Returns the name of mode @var{m} as a string.@findex GET_MODE_CLASS@item GET_MODE_CLASS (@var{m})Returns the mode class of mode @var{m}.@findex GET_MODE_WIDER_MODE@item GET_MODE_WIDER_MODE (@var{m})Returns the next wider natural mode.  E.g.,@code{GET_WIDER_MODE(QImode)} returns @code{HImode}.@findex GET_MODE_SIZE@item GET_MODE_SIZE (@var{m})Returns the size in bytes of a datum of mode @var{m}.@findex GET_MODE_BITSIZE@item GET_MODE_BITSIZE (@var{m})Returns the size in bits of a datum of mode @var{m}.@findex GET_MODE_MASK@item GET_MODE_MASK (@var{m})Returns a bitmask containing 1 for all bits in a word that fit withinmode @var{m}.  This macro can only be used for modes whose bitsize isless than or equal to @code{HOST_BITS_PER_INT}.@findex GET_MODE_ALIGNMENT@item GET_MODE_ALIGNMENT (@var{m)})Return the required alignment, in bits, for an object of mode @var{m}.@findex GET_MODE_UNIT_SIZE@item GET_MODE_UNIT_SIZE (@var{m})Returns the size in bytes of the subunits of a datum of mode @var{m}.This is the same as @code{GET_MODE_SIZE} except in the case of complexmodes.  For them, the unit size is the size of the real or imaginarypart.@findex GET_MODE_NUNITS@item GET_MODE_NUNITS (@var{m})Returns the number of units contained in a mode, i.e.,@code{GET_MODE_SIZE} divided by @code{GET_MODE_UNIT_SIZE}.@findex GET_CLASS_NARROWEST_MODE@item GET_CLASS_NARROWEST_MODE (@var{c})Returns the narrowest mode in mode class @var{c}.@end table@findex byte_mode@findex word_modeThe global variables @code{byte_mode} and @code{word_mode} containmodes whose classes are @code{MODE_INT} and whose bitsizes are@code{BITS_PER_UNIT} or @code{BITS_PER_WORD}, respectively.  On 32-bitmachines, these are @code{QImode} and @code{SImode}, respectively.@node Constants, Regs and Memory, Machine Modes, RTL@section Constant Expression Types@cindex RTL constants@cindex RTL constant expression typesThe simplest RTL expressions are those that represent constant values.@table @code@findex const_int@item (const_int @var{i})This type of expression represents the integer value @var{i}.  @var{i}is customarily accessed with the macro @code{INTVAL} as in@code{INTVAL (@var{exp})}, which is equivalent to @code{XWINT (@var{exp}, 0)}.@findex const0_rtx@findex const1_rtx@findex const2_rtx@findex constm1_rtxThere is only one expression object for the integer value zero; it isthe value of the variable @code{const0_rtx}.  Likewise, the onlyexpression for integer value one is found in @code{const1_rtx}, the onlyexpression for integer value two is found in @code{const2_rtx}, and theonly expression for integer value negative one is found in@code{constm1_rtx}.  Any attempt to create an expression of code@code{const_int} and value zero, one, two or negative one will return@code{const0_rtx}, @code{const1_rtx}, @code{const2_rtx} or@code{constm1_rtx} as appropriate.@refill@findex const_true_rtxSimilarly, there is only one object for the integer whose value is@code{STORE_FLAG_VALUE}.  It is found in @code{const_true_rtx}.  If@code{STORE_FLAG_VALUE} is one, @code{const_true_rtx} and@code{const1_rtx} will point to the same object.  If@code{STORE_FLAG_VALUE} is -1, @code{const_true_rtx} and@code{constm1_rtx} will point to the same object.@refill@findex const_double@item (const_double:@var{m} @var{addr} @var{i0} @var{i1} @dots{})Represents either a floating-point constant of mode @var{m} or aninteger constant that is too large to fit into @code{HOST_BITS_PER_WIDE_INT}bits but small enough to fit within twice that number of bits (GNU CCdoes not provide a mechanism to represent even larger constants).  Inthe latter case, @var{m} will be @code{VOIDmode}.@findex CONST_DOUBLE_MEM@findex CONST_DOUBLE_CHAIN@var{addr} is used to contain the @code{mem} expression that correspondsto the location in memory that at which the constant can be found.  Ifit has not been allocated a memory location, but is on the chain of all@code{const_double} expressions in this compilation (maintained using anundisplayed field), @var{addr} contains @code{const0_rtx}.  If it is noton the chain, @var{addr} contains @code{cc0_rtx}.  @var{addr} iscustomarily accessed with the macro @code{CONST_DOUBLE_MEM} and thechain field via @code{CONST_DOUBLE_CHAIN}.@refill@findex CONST_DOUBLE_LOWIf @var{m} is @code{VOIDmode}, the bits of the value are stored in@var{i0} and @var{i1}.  @var{i0} is customarily accessed with the macro@code{CONST_DOUBLE_LOW} and @var{i1} with @code{CONST_DOUBLE_HIGH}.If the constant is floating point (either single or double precision),then the number of integers used to store the value depends on the sizeof @code{REAL_VALUE_TYPE} (@pxref{Cross-compilation}).  The integersrepresent a @code{double}.  To convert them to a @code{double}, do@exampleunion real_extract u;bcopy (&CONST_DOUBLE_LOW (x), &u, sizeof u);@end example@noindentand then refer to @code{u.d}.@findex CONST0_RTX@findex CONST1_RTX@findex CONST2_RTXThe macro @code{CONST0_RTX (@var{mode})} refers to an expression withvalue 0 in mode @var{mode}. If mode @var{mode} is of mode class@code{MODE_INT}, it returns @code{const0_rtx}.  Otherwise, it returns a@code{CONST_DOUBLE} expression in mode @var{mode}.  Similarly, the macro@code{CONST1_RTX (@var{mode})} refers to an expression with value 1 inmode @var{mode} and similarly for @code{CONST2_RTX}.@findex const_string@item (const_string @var{str})Represents a constant string with value @var{str}.  Currently this isused only for insn attributes (@pxref{Insn Attributes}) since constantstrings in C are placed in memory.@findex symbol_ref@item (symbol_ref:@var{mode} @var{symbol})Represents the value of an assembler label for data.  @var{symbol} isa string that describes the name of the assembler label.  If it startswith a @samp{*}, the label is the rest of @var{symbol} not includingthe @samp{*}.  Otherwise, the label is @var{symbol}, usually prefixedwith @samp{_}.The @code{symbol_ref} contains a mode, which is usually @code{Pmode}.Usually that is the only mode for which a symbol is directly valid.@findex label_ref@item (label_ref @var{label})Represents the value of an assembler label for code.  It contains oneoperand, an expression, which must be a @code{code_label} that appearsin the instruction sequence to identify the place where the labelshould go.The reason for using a distinct expression type for code labelreferences is so that jump optimization can distinguish them.@item (const:@var{m} @var{exp})Represents a constant that is the result of an assembly-timearithmetic computation.  The operand, @var{exp}, is an expression thatcontains only constants (@code{const_int}, @code{symbol_ref} and@code{label_ref} expressions) combined with @code{plus} and@code{minus}.  However, not all combinations are valid, since theassembler cannot do arbitrary arithmetic on relocatable symbols.@var{m} should be @code{Pmode}.@findex high@item (high:@var{m} @var{exp})Represents the high-order bits of @var{exp}, usually a@code{symbol_ref}.  The number of bits is machine-dependent and isnormally the number of bits specified in an instruction that initializesthe high order bits of a register.  It is used with @code{lo_sum} torepresent the typical two-instruction sequence used in RISC machines toreference a global memory location.@var{m} should be @code{Pmode}.@end table@node Regs and Memory, Arithmetic, Constants, RTL@section Registers and Memory@cindex RTL register expressions@cindex RTL memory expressionsHere are the RTL expression types for describing access to machineregisters and to main memory.@table @code@findex reg@cindex hard registers@cindex pseudo registers@item (reg:@var{m} @var{n})For small values of the integer @var{n} (less than@code{FIRST_PSEUDO_REGISTER}), this stands for a reference to machineregister number @var{n}: a @dfn{hard register}.  For larger values of@var{n}, it stands for a temporary value or @dfn{pseudo register}.The compiler's strategy is to generate code assuming an unlimitednumber of such pseudo registers, and later convert them into hardregisters or into memory references.@var{m} is the machine mode of the reference.  It is necessary becausemachines can generally refer to each register in more than one mode.For example, a register may contain a full word but there may beinstructions to refer to it as a half word or as a single byte, aswell as instructions to refer to it as a floating point number ofvarious precisions.Even for a register that the machine can access in only one mode,the mode must always be specified.The symbol @code{FIRST_PSEUDO_REGISTER} is defined by the machinedescription, since the number of hard registers on the machine is aninvariant characteristic of the machine.  Note, however, that notall of the machine registers must be general registers.  All themachine registers that can be used for storage of data are givenhard register numbers, even those that can be used only in certaininstructions or can hold only certain types of data.A hard register may be accessed in various modes throughout onefunction, but each pseudo register is given a natural modeand is accessed only in that mode.  When it is necessary to describean access to a pseudo register using a nonnatural mode, a @code{subreg}expression is used.A @code{reg} expression with a machine mode that specifies more thanone word of data may actually stand for several consecutive registers.If in addition the register number specifies a hardware register, thenit actually represents several consecutive hardware registers startingwith the specified one.Each pseudo register number used in a function's RTL code isrepresented by a unique @code{reg} expression.@findex FIRST_VIRTUAL_REGISTER@findex LAST_VIRTUAL_REGISTER

⌨️ 快捷键说明

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