[wide-int] Documentation and comment tweaks
Kenneth Zadeck
zadeck@naturalbridge.com
Sat Nov 9 15:47:00 GMT 2013
On 11/09/2013 06:09 AM, Richard Sandiford wrote:
> Some minor tweaks to the documentation and commentary. The hyphenation
> and "non zero"->"nonzero" changes are supposed to be per guidelines:
>
> http://gcc.gnu.org/codingconventions.html#Spelling
>
> Hope I got them right.
>
> OK to install?
>
> This is the last of the patches I had lined up. These patches are also
> awaiting review:
>
> http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00663.html
both are fine given that we have decided to de-emphasize
SHIFT_COUNT_TRUNCATED.
> http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00666.html
>
> Thanks,
> Richard
>
>
> Index: gcc/dfp.c
> ===================================================================
> --- gcc/dfp.c 2013-11-09 09:50:47.392396760 +0000
> +++ gcc/dfp.c 2013-11-09 11:07:22.754160541 +0000
> @@ -605,8 +605,8 @@ decimal_real_to_integer (const REAL_VALU
> return real_to_integer (&to);
> }
>
> -/* Likewise, but returns a wide_int with PRECISION. Fail
> - is set if the value does not fit. */
> +/* Likewise, but returns a wide_int with PRECISION. *FAIL is set if the
> + value does not fit. */
>
> wide_int
> decimal_real_to_integer (const REAL_VALUE_TYPE *r, bool *fail, int precision)
> Index: gcc/doc/rtl.texi
> ===================================================================
> --- gcc/doc/rtl.texi 2013-11-09 09:50:47.392396760 +0000
> +++ gcc/doc/rtl.texi 2013-11-09 11:07:22.755160549 +0000
> @@ -1542,11 +1542,10 @@ Similarly, there is only one object for
> @findex const_double
> @item (const_double:@var{m} @var{i0} @var{i1} @dots{})
> This represents either a floating-point constant of mode @var{m} or
> -(on ports older ports that do not define
> +(on older ports that do not define
> @code{TARGET_SUPPORTS_WIDE_INT}) an integer constant too large to fit
> into @code{HOST_BITS_PER_WIDE_INT} bits but small enough to fit within
> -twice that number of bits (GCC does not provide a mechanism to
> -represent even larger constants). In the latter case, @var{m} will be
> +twice that number of bits. In the latter case, @var{m} will be
> @code{VOIDmode}. For integral values constants for modes with more
> bits than twice the number in @code{HOST_WIDE_INT} the implied high
> order bits of that constant are copies of the top bit of
> @@ -1576,25 +1575,25 @@ the precise bit pattern used by the targ
> This contains an array of @code{HOST_WIDE_INTS} that is large enough
> to hold any constant that can be represented on the target. This form
> of rtl is only used on targets that define
> -@code{TARGET_SUPPORTS_WIDE_INT} to be non zero and then
> -@code{CONST_DOUBLES} are only used to hold floating point values. If
> +@code{TARGET_SUPPORTS_WIDE_INT} to be nonzero and then
> +@code{CONST_DOUBLE}s are only used to hold floating-point values. If
> the target leaves @code{TARGET_SUPPORTS_WIDE_INT} defined as 0,
> @code{CONST_WIDE_INT}s are not used and @code{CONST_DOUBLE}s are as
> they were before.
>
> -The values are stored in a compressed format. The higher order
> +The values are stored in a compressed format. The higher-order
> 0s or -1s are not represented if they are just the logical sign
> extension of the number that is represented.
>
> @findex CONST_WIDE_INT_VEC
> @item CONST_WIDE_INT_VEC (@var{code})
> Returns the entire array of @code{HOST_WIDE_INT}s that are used to
> -store the value. This macro should be rarely used.
> +store the value. This macro should be rarely used.
>
> @findex CONST_WIDE_INT_NUNITS
> @item CONST_WIDE_INT_NUNITS (@var{code})
> The number of @code{HOST_WIDE_INT}s used to represent the number.
> -Note that this generally be smaller than the number of
> +Note that this generally is smaller than the number of
> @code{HOST_WIDE_INT}s implied by the mode size.
>
> @findex CONST_WIDE_INT_ELT
> Index: gcc/doc/tm.texi
> ===================================================================
> --- gcc/doc/tm.texi 2013-11-09 09:50:47.392396760 +0000
> +++ gcc/doc/tm.texi 2013-11-09 11:07:22.757160564 +0000
> @@ -9683,10 +9683,9 @@ Returns the negative of the floating poi
> Returns the absolute value of @var{x}.
> @end deftypefn
>
> -@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{val}, enum machine_mode @var{mode})
> -Converts a double-precision integer found in @var{val},
> -into a floating point value which is then stored into @var{x}. The
> -value is truncated to fit in mode @var{mode}.
> +@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode})
> +Converts integer @var{val} into a floating-point value which is then
> +stored into @var{x}. The value is truncated to fit in mode @var{mode}.
> @end deftypefn
>
> @node Mode Switching
> @@ -11497,15 +11496,15 @@ The default value of this hook is based
> @defmac TARGET_SUPPORTS_WIDE_INT
>
> On older ports, large integers are stored in @code{CONST_DOUBLE} rtl
> -objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be non
> -zero to indicate that large integers are stored in
> +objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero
> +to indicate that large integers are stored in
> @code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows
> very large integer constants to be represented. @code{CONST_DOUBLE}
> -are limited to twice the size of host's @code{HOST_WIDE_INT}
> +is limited to twice the size of the host's @code{HOST_WIDE_INT}
> representation.
>
> Converting a port mostly requires looking for the places where
> -@code{CONST_DOUBLES} are used with @code{VOIDmode} and replacing that
> +@code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that
> code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i
> const_double"} at the port level gets you to 95% of the changes that
> need to be made. There are a few places that require a deeper look.
> @@ -11535,7 +11534,7 @@ The rtx costs may have to be adjusted to
> constants that are represented as @code{CONST_WIDE_INT}.
> @end itemize
>
> -All and all it does not takes long to convert ports that the
> +All and all it does not take long to convert ports that the
> maintainer is familiar with.
>
> @end defmac
> Index: gcc/doc/tm.texi.in
> ===================================================================
> --- gcc/doc/tm.texi.in 2013-11-09 09:50:47.392396760 +0000
> +++ gcc/doc/tm.texi.in 2013-11-09 11:07:22.758160572 +0000
> @@ -7345,10 +7345,9 @@ Returns the negative of the floating poi
> Returns the absolute value of @var{x}.
> @end deftypefn
>
> -@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{val}, enum machine_mode @var{mode})
> -Converts a double-precision integer found in @var{val},
> -into a floating point value which is then stored into @var{x}. The
> -value is truncated to fit in mode @var{mode}.
> +@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode})
> +Converts integer @var{val} into a floating-point value which is then
> +stored into @var{x}. The value is truncated to fit in mode @var{mode}.
> @end deftypefn
>
> @node Mode Switching
> @@ -8404,15 +8403,15 @@ and the associated definitions of those
> @defmac TARGET_SUPPORTS_WIDE_INT
>
> On older ports, large integers are stored in @code{CONST_DOUBLE} rtl
> -objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be non
> -zero to indicate that large integers are stored in
> +objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero
> +to indicate that large integers are stored in
> @code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows
> very large integer constants to be represented. @code{CONST_DOUBLE}
> -are limited to twice the size of host's @code{HOST_WIDE_INT}
> +is limited to twice the size of the host's @code{HOST_WIDE_INT}
> representation.
>
> Converting a port mostly requires looking for the places where
> -@code{CONST_DOUBLES} are used with @code{VOIDmode} and replacing that
> +@code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that
> code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i
> const_double"} at the port level gets you to 95% of the changes that
> need to be made. There are a few places that require a deeper look.
> @@ -8442,7 +8441,7 @@ The rtx costs may have to be adjusted to
> constants that are represented as @code{CONST_WIDE_INT}.
> @end itemize
>
> -All and all it does not takes long to convert ports that the
> +All and all it does not take long to convert ports that the
> maintainer is familiar with.
>
> @end defmac
> Index: gcc/dwarf2out.c
> ===================================================================
> --- gcc/dwarf2out.c 2013-11-09 10:32:42.708323557 +0000
> +++ gcc/dwarf2out.c 2013-11-09 11:07:22.762160602 +0000
> @@ -348,7 +348,7 @@ #define DUMP_GSTRUCT(type, usage, criter
>
> #endif
>
> -/* Get the number of host wide ints needed to represent the precision
> +/* Get the number of HOST_WIDE_INTs needed to represent the precision
> of the number. */
>
> static unsigned int
> Index: gcc/emit-rtl.c
> ===================================================================
> --- gcc/emit-rtl.c 2013-11-09 09:50:47.392396760 +0000
> +++ gcc/emit-rtl.c 2013-11-09 11:07:22.763160609 +0000
> @@ -547,8 +547,8 @@ rtx_to_double_int (const_rtx cst)
> #endif
>
> #if TARGET_SUPPORTS_WIDE_INT
> -/* Determine whether WIDE_INT, already exists in the hash table. If
> - so, return its counterpart; otherwise add it to the hash table and
> +/* Determine whether CONST_WIDE_INT WINT already exists in the hash table.
> + If so, return its counterpart; otherwise add it to the hash table and
> return it. */
>
> static rtx
> @@ -562,11 +562,11 @@ lookup_const_wide_int (rtx wint)
> }
> #endif
>
> -/* V contains a wide_int. A CONST_INT or CONST_WIDE_INT (if
> - TARGET_SUPPORTS_WIDE_INT is defined) or CONST_DOUBLE if
> - TARGET_SUPPORTS_WIDE_INT is not defined is produced based on the
> - number of HOST_WIDE_INTs that are necessary to represent the value
> - in compact form. */
> +/* Return an rtx constant for V, given that the constant has mode MODE.
> + The returned rtx will be a CONST_INT if V fits, otherwise it will be
> + a CONST_DOUBLE (if !TARGET_SUPPORTS_WIDE_INT) or a CONST_WIDE_INT
> + (if TARGET_SUPPORTS_WIDE_INT). */
> +
> rtx
> immed_wide_int_const (const wide_int &v, enum machine_mode mode)
> {
> Index: gcc/tree.c
> ===================================================================
> --- gcc/tree.c 2013-11-09 09:58:55.587688532 +0000
> +++ gcc/tree.c 2013-11-09 11:07:56.499414021 +0000
> @@ -1252,7 +1252,7 @@ int_cst_hash_eq (const void *x, const vo
> /* Create an INT_CST node of TYPE and value CST.
> The returned node is always shared. For small integers we use a
> per-type vector cache, for larger ones we use a single hash table.
> - The value is extended from it's precision according to the sign of
> + The value is extended from its precision according to the sign of
> the type to be a multiple of HOST_BITS_PER_WIDE_INT. This defines
> the upper bits and ensures that hashing and value equality based
> upon the underlying HOST_WIDE_INTs works without masking. */
> @@ -2018,7 +2018,9 @@ build_case_label (tree low_value, tree h
> return t;
> }
>
> -/* Build a newly constructed INETEGER_CST node of length LEN. */
> +/* Build a newly constructed INTEGER_CST node. LEN and EXT_LEN are the
> + values of TREE_INT_CST_NUNITS and TREE_INT_CST_EXT_NUNITS respectively.
> + The latter determines the length of the HOST_WIDE_INT vector. */
>
> tree
> make_int_cst_stat (int len, int ext_len MEM_STAT_DECL)
> Index: gcc/tree.h
> ===================================================================
> --- gcc/tree.h 2013-11-09 09:58:55.588688539 +0000
> +++ gcc/tree.h 2013-11-09 11:07:22.765160624 +0000
> @@ -3129,10 +3129,10 @@ omp_clause_elt_check (const_tree __t, in
>
> #endif
>
> -/* Checks that X is integer constant that can be expressed in signed
> - HOST_WIDE_INT without loss of precision. This function differs
> - from the tree_fits_* versions in that the signedness of the
> - type of X is not considered. */
> +/* Checks that X is an integer constant that can be expressed in a signed
> + HOST_WIDE_INT without loss of precision. This function differs from
> + the tree_fits_* versions in that the signedness of the type of X is
> + not considered. */
>
> static inline bool
> cst_fits_shwi_p (const_tree x)
> @@ -3143,10 +3143,10 @@ cst_fits_shwi_p (const_tree x)
> return TREE_INT_CST_NUNITS (x) == 1;
> }
>
> -/* Checks that X is integer constant that can be expressed in signed
> - HOST_WIDE_INT without loss of precision. This function differs
> - from the tree_fits_* versions in that the signedness of the
> - type of X is not considered. */
> +/* Checks that X is an integer constant that can be expressed in an unsigned
> + HOST_WIDE_INT without loss of precision. This function differs from
> + the tree_fits_* versions in that the signedness of the type of X is
> + not considered. */
>
> static inline bool
> cst_fits_uhwi_p (const_tree x)
More information about the Gcc-patches
mailing list