+2016-11-18 Richard Sandiford <richard.sandiford@arm.com>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
+ * combine.c (try_combine): Use rtx_mode_t instead of std::make_pair.
+ * dwarf2out.c (mem_loc_descriptor, loc_descriptor): Likewise.
+ (add_const_value_attribute): Likewise.
+ * explow.c (plus_constant): Likewise.
+ * expmed.c (expand_mult, make_tree): Likewise.
+ * expr.c (convert_modes): Likewise.
+ * loop-doloop.c (doloop_optimize): Likewise.
+ * postreload.c (reload_cse_simplify_set): Likewise.
+ * simplify-rtx.c (simplify_const_unary_operation): Likewise.
+ (simplify_binary_operation_1, simplify_const_binary_operation):
+ (simplify_const_relational_operation, simplify_immed_subreg): Likewise.
+ * wide-int.h: Update documentation to recommend rtx_mode_t
+ instead of std::make_pair.
+
2016-11-18 Richard Sandiford <richard.sandiford@arm.com>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
rtx outer = SET_SRC (temp_expr);
wide_int o
- = wi::insert (std::make_pair (outer, GET_MODE (SET_DEST (temp_expr))),
- std::make_pair (inner, GET_MODE (dest)),
+ = wi::insert (rtx_mode_t (outer, GET_MODE (SET_DEST (temp_expr))),
+ rtx_mode_t (inner, GET_MODE (dest)),
offset, width);
combine_merges++;
mem_loc_result->dw_loc_oprnd2.val_class
= dw_val_class_wide_int;
mem_loc_result->dw_loc_oprnd2.v.val_wide = ggc_alloc<wide_int> ();
- *mem_loc_result->dw_loc_oprnd2.v.val_wide = std::make_pair (rtl, mode);
+ *mem_loc_result->dw_loc_oprnd2.v.val_wide = rtx_mode_t (rtl, mode);
}
break;
GET_MODE_SIZE (mode), 0);
loc_result->dw_loc_oprnd2.val_class = dw_val_class_wide_int;
loc_result->dw_loc_oprnd2.v.val_wide = ggc_alloc<wide_int> ();
- *loc_result->dw_loc_oprnd2.v.val_wide = std::make_pair (rtl, mode);
+ *loc_result->dw_loc_oprnd2.v.val_wide = rtx_mode_t (rtl, mode);
}
break;
for (i = 0, p = array; i < length; i++, p += elt_size)
{
rtx elt = CONST_VECTOR_ELT (rtl, i);
- insert_wide_int (std::make_pair (elt, imode), p, elt_size);
+ insert_wide_int (rtx_mode_t (elt, imode), p, elt_size);
}
break;
case CONST_WIDE_INT:
{
- wide_int w1 = std::make_pair (rtl, MAX_MODE_INT);
+ wide_int w1 = rtx_mode_t (rtl, MAX_MODE_INT);
unsigned int prec = MIN (wi::min_precision (w1, UNSIGNED),
(unsigned int)CONST_WIDE_INT_NUNITS (rtl) * HOST_BITS_PER_WIDE_INT);
wide_int w = wi::zext (w1, prec);
for (i = 0, p = array; i < length; i++, p += elt_size)
{
rtx elt = CONST_VECTOR_ELT (rtl, i);
- insert_wide_int (std::make_pair (elt, imode), p, elt_size);
+ insert_wide_int (rtx_mode_t (elt, imode), p, elt_size);
}
break;
switch (code)
{
CASE_CONST_SCALAR_INT:
- return immed_wide_int_const (wi::add (std::make_pair (x, mode), c),
- mode);
+ return immed_wide_int_const (wi::add (rtx_mode_t (x, mode), c), mode);
case MEM:
/* If this is a reference to the constant pool, try replacing it with
a reference to a new constant. If the resulting address isn't
else if (CONST_DOUBLE_AS_INT_P (scalar_op1))
#endif
{
- int shift = wi::exact_log2 (std::make_pair (scalar_op1, mode));
+ int shift = wi::exact_log2 (rtx_mode_t (scalar_op1, mode));
/* Perfect power of 2 (other than 1, which is handled above). */
if (shift > 0)
return expand_shift (LSHIFT_EXPR, mode, op0,
{
case CONST_INT:
case CONST_WIDE_INT:
- t = wide_int_to_tree (type, std::make_pair (x, TYPE_MODE (type)));
+ t = wide_int_to_tree (type, rtx_mode_t (x, TYPE_MODE (type)));
return t;
case CONST_DOUBLE:
assume that all the bits are significant. */
if (GET_MODE_CLASS (oldmode) != MODE_INT)
oldmode = MAX_MODE_INT;
- wide_int w = wide_int::from (std::make_pair (x, oldmode),
+ wide_int w = wide_int::from (rtx_mode_t (x, oldmode),
GET_MODE_PRECISION (mode),
unsignedp ? UNSIGNED : SIGNED);
return immed_wide_int_const (w, mode);
}
if (desc->const_iter)
- iterations = widest_int::from (std::make_pair (desc->niter_expr, mode),
+ iterations = widest_int::from (rtx_mode_t (desc->niter_expr, mode),
UNSIGNED);
else
iterations = 0;
switch (extend_op)
{
case ZERO_EXTEND:
- result = wide_int::from (std::make_pair (this_rtx,
- GET_MODE (src)),
+ result = wide_int::from (rtx_mode_t (this_rtx,
+ GET_MODE (src)),
BITS_PER_WORD, UNSIGNED);
break;
case SIGN_EXTEND:
- result = wide_int::from (std::make_pair (this_rtx,
- GET_MODE (src)),
+ result = wide_int::from (rtx_mode_t (this_rtx,
+ GET_MODE (src)),
BITS_PER_WORD, SIGNED);
break;
default:
op_mode = MAX_MODE_INT;
}
- real_from_integer (&d, mode, std::make_pair (op, op_mode), SIGNED);
+ real_from_integer (&d, mode, rtx_mode_t (op, op_mode), SIGNED);
/* Avoid the folding if flag_signaling_nans is on and
operand is a signaling NaN. */
op_mode = MAX_MODE_INT;
}
- real_from_integer (&d, mode, std::make_pair (op, op_mode), UNSIGNED);
+ real_from_integer (&d, mode, rtx_mode_t (op, op_mode), UNSIGNED);
/* Avoid the folding if flag_signaling_nans is on and
operand is a signaling NaN. */
{
wide_int result;
machine_mode imode = op_mode == VOIDmode ? mode : op_mode;
- rtx_mode_t op0 = std::make_pair (op, imode);
+ rtx_mode_t op0 = rtx_mode_t (op, imode);
int int_value;
#if TARGET_SUPPORTS_WIDE_INT == 0
else if (GET_CODE (lhs) == MULT
&& CONST_SCALAR_INT_P (XEXP (lhs, 1)))
{
- coeff0 = std::make_pair (XEXP (lhs, 1), mode);
+ coeff0 = rtx_mode_t (XEXP (lhs, 1), mode);
lhs = XEXP (lhs, 0);
}
else if (GET_CODE (lhs) == ASHIFT
else if (GET_CODE (rhs) == MULT
&& CONST_INT_P (XEXP (rhs, 1)))
{
- coeff1 = std::make_pair (XEXP (rhs, 1), mode);
+ coeff1 = rtx_mode_t (XEXP (rhs, 1), mode);
rhs = XEXP (rhs, 0);
}
else if (GET_CODE (rhs) == ASHIFT
else if (GET_CODE (lhs) == MULT
&& CONST_SCALAR_INT_P (XEXP (lhs, 1)))
{
- coeff0 = std::make_pair (XEXP (lhs, 1), mode);
+ coeff0 = rtx_mode_t (XEXP (lhs, 1), mode);
lhs = XEXP (lhs, 0);
}
else if (GET_CODE (lhs) == ASHIFT
else if (GET_CODE (rhs) == MULT
&& CONST_INT_P (XEXP (rhs, 1)))
{
- negcoeff1 = wi::neg (std::make_pair (XEXP (rhs, 1), mode));
+ negcoeff1 = wi::neg (rtx_mode_t (XEXP (rhs, 1), mode));
rhs = XEXP (rhs, 0);
}
else if (GET_CODE (rhs) == ASHIFT
/* Convert multiply by constant power of two into shift. */
if (CONST_SCALAR_INT_P (trueop1))
{
- val = wi::exact_log2 (std::make_pair (trueop1, mode));
+ val = wi::exact_log2 (rtx_mode_t (trueop1, mode));
if (val >= 0)
return simplify_gen_binary (ASHIFT, mode, op0, GEN_INT (val));
}
{
wide_int result;
bool overflow;
- rtx_mode_t pop0 = std::make_pair (op0, mode);
- rtx_mode_t pop1 = std::make_pair (op1, mode);
+ rtx_mode_t pop0 = rtx_mode_t (op0, mode);
+ rtx_mode_t pop1 = rtx_mode_t (op1, mode);
#if TARGET_SUPPORTS_WIDE_INT == 0
/* This assert keeps the simplification from producing a result
largest int representable on the target is as good as
infinite. */
machine_mode cmode = (mode == VOIDmode) ? MAX_MODE_INT : mode;
- rtx_mode_t ptrueop0 = std::make_pair (trueop0, cmode);
- rtx_mode_t ptrueop1 = std::make_pair (trueop1, cmode);
+ rtx_mode_t ptrueop0 = rtx_mode_t (trueop0, cmode);
+ rtx_mode_t ptrueop1 = rtx_mode_t (trueop1, cmode);
if (wi::eq_p (ptrueop0, ptrueop1))
return comparison_result (code, CMP_EQ);
case CONST_WIDE_INT:
{
- rtx_mode_t val = std::make_pair (el, innermode);
+ rtx_mode_t val = rtx_mode_t (el, innermode);
unsigned char extend = wi::sign_mask (val);
for (i = 0; i < elem_bitsize; i += value_bit)
However, a little more syntax is required for rtl constants since
they do not have an explicit precision. To make an rtl into a
wide_int, you have to pair it with a mode. The canonical way to do
- this is with std::make_pair as in:
+ this is with rtx_mode_t as in:
rtx r = ...
- wide_int x = std::make_pair (r, mode);
+ wide_int x = rtx_mode_t (r, mode);
Similarly, a wide_int can only be constructed from a host value if
the target precision is given explicitly, such as in: