This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove build_int_cst_wide_type function.


Hi.

----- Original Message ----- From: "Richard Guenther" <richard.guenther@gmail.com>
To: "Anatoly Sokolov" <aesok@post.ru>
Cc: <gcc-patches@gcc.gnu.org>; <java-patches@gcc.gnu.org>
Sent: Saturday, May 08, 2010 12:31 AM
Subject: Re: Remove build_int_cst_wide_type function.



Use build_int_cstu instead and retain using HOST_WIDE_INTs.  Btw,
both build_int_cst and build_int_cstu should do proper sign/zero
extension as the types precision may be lower than that of
HOST_WIDE_INT.

The build_int_cst and build_int_cstu function don't clear extra bits outside
of the type precision. The build_int_ct_type function truncate signed
HOST_WIDE_INT constant to the type precision. Comment before build_int_cst_type
say:
/* ... Constants
with these extra bits may confuse the fold so that it detects overflows
even in cases when they do not occur, and in general should be avoided.
We cannot however make this a default behavior of build_int_cst without
more intrusive changes, since there are parts of gcc that rely on the extra
precision of the integer constants. */


 Consequently, need both build_int_cst and build_int_cstu functions which
don't truncate constant and new build_int_cstu_type function which truncate
unsigned HOST_WIDE_INT constants.

 How about rename build_int_cst_type/build_int_cstu_type function to
hwi_to_tree/uhwi_to_tree by analogy with the double_int_to_tree function?

Anatoly.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]