patch to fix constant math - builtins.c - the first of the tree level patches for wide-int

Kenneth Zadeck zadeck@naturalbridge.com
Wed Apr 17 07:34:00 GMT 2013


Richard, this is the first of the tree level patches so that you can see 
how the wide-int changes will effect the tree level.   This patch 
converts builtins.c so that it does not in any way assume that tree-cst 
holds two HWIs.   The patch divides all math into two categories:   
Things that are always so small that we can easily assume that the math 
can be done using a single HWI and everything else.   The things that it 
assumes can easily be done with a HWI are guarded with assertions.   The 
everything else is done with wide-int.  Everything else in this patch is 
additional abi to support this.

The idea is that each pass will be converted, 1 pass per patch in this 
way.    Once everything does not depend on the internals of tree-cst as 
they do now, then tree-cst will be converted to have an array inside of 
it rather than just two hwis.

Kenny
-------------- next part --------------
2012-04-16  Kenneth Zadeck <zadeck@naturalbridge.com>

	* builtins.c (get_object_alignment_2, get_pointer_alignment_1,
	c_strlen, c_getstr, target_char_cast,
	expand_builtin_mempcpy_args, expand_builtin_strncpy,
	expand_builtin_memset_args, expand_builtin_strncpy,
	expand_builtin_memset_args, expand_builtin_frame_address,
	expand_builtin_alloca, expand_builtin_atomic_compare_exchange,
	fold_builtin_powi, fold_builtin_memset,
	fold_builtin_memory_op, fold_builtin_memchr,
	fold_builtin_memcmp, fold_builtin_strncmp,
	fold_builtin_load_exponent, fold_builtin_snprintf,
	expand_builtin_object_size, expand_builtin_memory_chk,
	maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning,
	fold_builtin_object_size, fold_builtin_memory_chk,
	fold_builtin_stxcpy_chk, fold_builtin_strcat_chk,
	fold_builtin_sprintf_chk_1, fold_builtin_snprintf_chk_1,
	do_mpfr_bessel_n): Convert to api that does not assume that
	tree_cst is two HWIs.
	(fold_builtin_int_roundingfn, fold_builtin_bitop,
	fold_builtin_bswap, fold_builtin_memory_op,
	expand_builtin_object_size): Use wide-int rather than double-int api.
	
	* dfp.c (decimal_real_to_integer): Add wide-int version. 
	* real.c (real_to_integer): Ditto.
	* tree.h (tree_fits_uhwi_p, tree_fits_shwi_p, tree_fits_hwi_p, 
	tree_to_shwi, tree_to_hwi, tree_to_uhwi): New functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t1-1.diff
Type: text/x-patch
Size: 39534 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130417/15c8a591/attachment.bin>


More information about the Gcc-patches mailing list