Commit 3bb1161f by Aldy Hernandez Committed by Aldy Hernandez

wide-int.h (widest2_int): New.

	* wide-int.h (widest2_int): New.
	* gimple-fold.c (arith_overflowed_p): Use it.
	* tree.h (widest2_int_cst): New.
	* tree-vrp.c (wide_int_binop_overflow): Rename from
	vrp_int_const_binop.
	Rewrite to work on trees.
	(extract_range_from_multiplicative_op_1): Abstract code to...
	(wide_int_range_min_max): ...here.
	(wide_int_range_cross_product): ...and here.
	(extract_range_from_binary_expr_1): Abstract overflow code to...
	(wide_int_range_cross_product_wrapping): ...here.
	* tree-vrp.h (wide_int_range_cross_product): New.
	(wide_int_range_cross_product_wrapping): New.

From-SVN: r262874
parent 30ae6662
2018-07-19 Aldy Hernandez <aldyh@redhat.com>
* wide-int.h (widest2_int): New.
* gimple-fold.c (arith_overflowed_p): Use it.
* tree.h (widest2_int_cst): New.
* tree-vrp.c (wide_int_binop_overflow): Rename from
vrp_int_const_binop.
Rewrite to work on trees.
(extract_range_from_multiplicative_op_1): Abstract code to...
(wide_int_range_min_max): ...here.
(wide_int_range_cross_product): ...and here.
(extract_range_from_binary_expr_1): Abstract overflow code to...
(wide_int_range_mult_wrapping): ...here.
* tree-vrp.h (wide_int_range_cross_product): New.
(wide_int_range_mult_wrapping): New.
2018-07-19 Andrew Senkevich <andrew.senkevich@intel.com> 2018-07-19 Andrew Senkevich <andrew.senkevich@intel.com>
Julia Koval <julia.koval@intel.com> Julia Koval <julia.koval@intel.com>
......
...@@ -3986,9 +3986,6 @@ bool ...@@ -3986,9 +3986,6 @@ bool
arith_overflowed_p (enum tree_code code, const_tree type, arith_overflowed_p (enum tree_code code, const_tree type,
const_tree arg0, const_tree arg1) const_tree arg0, const_tree arg1)
{ {
typedef FIXED_WIDE_INT (WIDE_INT_MAX_PRECISION * 2) widest2_int;
typedef generic_wide_int <wi::extended_tree <WIDE_INT_MAX_PRECISION * 2> >
widest2_int_cst;
widest2_int warg0 = widest2_int_cst (arg0); widest2_int warg0 = widest2_int_cst (arg0);
widest2_int warg1 = widest2_int_cst (arg1); widest2_int warg1 = widest2_int_cst (arg1);
widest2_int wres; widest2_int wres;
......
...@@ -102,6 +102,19 @@ extern bool vrp_val_is_min (const_tree); ...@@ -102,6 +102,19 @@ extern bool vrp_val_is_min (const_tree);
extern bool vrp_val_is_max (const_tree); extern bool vrp_val_is_max (const_tree);
extern void copy_value_range (value_range *, value_range *); extern void copy_value_range (value_range *, value_range *);
extern void set_value_range_to_value (value_range *, tree, bitmap); extern void set_value_range_to_value (value_range *, tree, bitmap);
extern bool wide_int_range_cross_product (wide_int &res_lb, wide_int &res_ub,
enum tree_code code, signop sign,
const wide_int &, const wide_int &,
const wide_int &, const wide_int &,
bool overflow_undefined);
extern bool wide_int_range_mult_wrapping (wide_int &res_lb,
wide_int &res_ub,
signop sign,
unsigned prec,
const wide_int &min0_,
const wide_int &max0_,
const wide_int &min1_,
const wide_int &max1_);
extern void extract_range_from_binary_expr_1 (value_range *, enum tree_code, extern void extract_range_from_binary_expr_1 (value_range *, enum tree_code,
tree, value_range *, tree, value_range *,
value_range *); value_range *);
......
...@@ -5416,6 +5416,11 @@ namespace wi ...@@ -5416,6 +5416,11 @@ namespace wi
}; };
} }
/* Used to convert a tree to a widest2_int like this:
widest2_int foo = widest2_int_cst (some_tree). */
typedef generic_wide_int <wi::extended_tree <WIDE_INT_MAX_PRECISION * 2> >
widest2_int_cst;
/* Refer to INTEGER_CST T as though it were a widest_int. /* Refer to INTEGER_CST T as though it were a widest_int.
This function gives T's actual numerical value, influenced by the This function gives T's actual numerical value, influenced by the
......
...@@ -322,6 +322,9 @@ class wide_int_storage; ...@@ -322,6 +322,9 @@ class wide_int_storage;
typedef generic_wide_int <wide_int_storage> wide_int; typedef generic_wide_int <wide_int_storage> wide_int;
typedef FIXED_WIDE_INT (ADDR_MAX_PRECISION) offset_int; typedef FIXED_WIDE_INT (ADDR_MAX_PRECISION) offset_int;
typedef FIXED_WIDE_INT (WIDE_INT_MAX_PRECISION) widest_int; typedef FIXED_WIDE_INT (WIDE_INT_MAX_PRECISION) widest_int;
/* Spelled out explicitly (rather than through FIXED_WIDE_INT)
so as not to confuse gengtype. */
typedef generic_wide_int < fixed_wide_int_storage <WIDE_INT_MAX_PRECISION * 2> > widest2_int;
/* wi::storage_ref can be a reference to a primitive type, /* wi::storage_ref can be a reference to a primitive type,
so this is the conservatively-correct setting. */ so this is the conservatively-correct setting. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment