return cst_sval;
}
+/* Return the svalue * for a constant_svalue for the INTEGER_CST
+ for VAL of type TYPE, creating it if necessary. */
+
+const svalue *
+region_model_manager::get_or_create_int_cst (tree type, poly_int64 val)
+{
+ gcc_assert (type);
+ tree tree_cst = build_int_cst (type, val);
+ return get_or_create_constant_svalue (tree_cst);
+}
+
/* Return the svalue * for a unknown_svalue for TYPE (which can be NULL),
creating it if necessary.
The unknown_svalue instances are reused, based on pointer equality
shift it by the correct number of bits. */
const svalue *lhs = get_or_create_cast (type, sval);
HOST_WIDE_INT bit_offset = bits.get_start_bit_offset ().to_shwi ();
- tree shift_amt = build_int_cst (type, bit_offset);
- const svalue *shift_sval = get_or_create_constant_svalue (shift_amt);
+ const svalue *shift_sval = get_or_create_int_cst (type, bit_offset);
const svalue *shifted_sval = get_or_create_binop (type, LSHIFT_EXPR,
lhs, shift_sval);
/* Reapply the mask (needed for negative
/* Direct calls to setjmp return 0. */
if (tree lhs = gimple_call_lhs (call))
{
- tree zero = build_int_cst (TREE_TYPE (lhs), 0);
- const svalue *new_sval = m_mgr->get_or_create_constant_svalue (zero);
+ const svalue *new_sval
+ = m_mgr->get_or_create_int_cst (TREE_TYPE (lhs), 0);
const region *lhs_reg = get_lvalue (lhs, ctxt);
set_value (lhs_reg, new_sval, ctxt);
}
if (tree lhs = gimple_call_lhs (setjmp_call))
{
/* Passing 0 as the val to longjmp leads to setjmp returning 1. */
- tree t_zero = build_int_cst (TREE_TYPE (fake_retval), 0);
- const svalue *zero_sval = m_mgr->get_or_create_constant_svalue (t_zero);
+ const svalue *zero_sval
+ = m_mgr->get_or_create_int_cst (TREE_TYPE (fake_retval), 0);
tristate eq_zero = eval_condition (fake_retval_sval, EQ_EXPR, zero_sval);
/* If we have 0, use 1. */
if (eq_zero.is_true ())
{
- tree t_one = build_int_cst (TREE_TYPE (fake_retval), 1);
const svalue *one_sval
- = m_mgr->get_or_create_constant_svalue (t_one);
+ = m_mgr->get_or_create_int_cst (TREE_TYPE (fake_retval), 1);
fake_retval_sval = one_sval;
}
else
/* svalue consolidation. */
const svalue *get_or_create_constant_svalue (tree cst_expr);
+ const svalue *get_or_create_int_cst (tree type, poly_int64);
const svalue *get_or_create_unknown_svalue (tree type);
const svalue *get_or_create_setjmp_svalue (const setjmp_record &r,
tree type);
/* Add a default binding to zero. */
region_model_manager *sval_mgr = mgr->get_svalue_manager ();
- tree cst_zero = build_int_cst (integer_type_node, 0);
- const svalue *cst_sval = sval_mgr->get_or_create_constant_svalue (cst_zero);
+ const svalue *cst_sval
+ = sval_mgr->get_or_create_int_cst (integer_type_node, 0);
const svalue *bound_sval = cst_sval;
if (reg->get_type ())
bound_sval = sval_mgr->get_or_create_unaryop (reg->get_type (), NOP_EXPR,