aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-11-18 10:04:53 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2016-11-18 10:04:53 +0000
commitf079167a3064f11a7d8c17ef78389559435bad9d (patch)
tree088a5faa65bea2b992c890d73bbec5c40806cb74 /gcc/simplify-rtx.c
parent899ca90e6defb9d63e03764ceb9afe0fc94fbdb1 (diff)
downloadgcc-f079167a3064f11a7d8c17ef78389559435bad9d.zip
gcc-f079167a3064f11a7d8c17ef78389559435bad9d.tar.gz
gcc-f079167a3064f11a7d8c17ef78389559435bad9d.tar.bz2
Use rtx_mode_t instead of std::make_pair
This change makes the code less sensitive to the exact type of the mode, i.e. it forces a conversion where necessary. This becomes important when wrappers like scalar_int_mode and scalar_mode can also be used instead of machine_mode. Using rtx_mode_t also abstracts away the representation. The fact that it's a std::pair rather than a custom class isn't important to users of the interface. gcc/ 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. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r242586
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 11a2e02..fde2443 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1716,7 +1716,7 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode,
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. */
@@ -1740,7 +1740,7 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode,
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. */
@@ -1755,7 +1755,7 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode,
{
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
@@ -2150,7 +2150,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
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
@@ -2171,7 +2171,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
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
@@ -2327,7 +2327,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
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
@@ -2348,7 +2348,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
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
@@ -2523,7 +2523,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
/* 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));
}
@@ -4046,8 +4046,8 @@ simplify_const_binary_operation (enum rtx_code code, machine_mode mode,
{
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
@@ -5081,8 +5081,8 @@ simplify_const_relational_operation (enum rtx_code code,
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);
@@ -5738,7 +5738,7 @@ simplify_immed_subreg (machine_mode outermode, rtx op,
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)