aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2024-06-13 13:07:10 -0700
committerAndrew Pinski <quic_apinski@quicinc.com>2024-06-13 20:10:53 -0700
commitd8a6de9e2b850b71712e89e8e6026e4ae6284766 (patch)
tree187772fe33cdb7733e35c52d99a1f107e7da29e8 /gcc/expr.cc
parent028cd77db322d21312680c9a0a7c30565854f577 (diff)
downloadgcc-d8a6de9e2b850b71712e89e8e6026e4ae6284766.zip
gcc-d8a6de9e2b850b71712e89e8e6026e4ae6284766.tar.gz
gcc-d8a6de9e2b850b71712e89e8e6026e4ae6284766.tar.bz2
expand: constify sepops operand to expand_expr_real_2 and expand_widen_pattern_expr [PR113212]
While working on an expand patch back in January I noticed that the first argument (of sepops type) of expand_expr_real_2 could be constified as it was not to be touched by the function (nor should it be). There is code in internal-fn.cc that depends on expand_expr_real_2 not touching the ops argument so constification makes this more obvious. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR middle-end/113212 * expr.h (const_seqpops): New typedef. (expand_expr_real_2): Constify the first argument. * optabs.cc (expand_widen_pattern_expr): Likewise. * optabs.h (expand_widen_pattern_expr): Likewise. * expr.cc (expand_expr_real_2): Likewise (do_store_flag): Likewise. Remove incorrect store to ops->code. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 04bad5e..9cecc17 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -94,7 +94,7 @@ static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (const_tree, const_
static bool is_aligning_offset (const_tree, const_tree);
static rtx reduce_to_bit_field_precision (rtx, rtx, tree);
-static rtx do_store_flag (sepops, rtx, machine_mode);
+static rtx do_store_flag (const_sepops, rtx, machine_mode);
#ifdef PUSH_ROUNDING
static void emit_single_push_insn (machine_mode, rtx, tree);
#endif
@@ -9643,7 +9643,7 @@ expand_expr_divmod (tree_code code, machine_mode mode, tree treeop0,
}
rtx
-expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
+expand_expr_real_2 (const_sepops ops, rtx target, machine_mode tmode,
enum expand_modifier modifier)
{
rtx op0, op1, op2, temp;
@@ -13504,7 +13504,7 @@ expand_single_bit_test (location_t loc, enum tree_code code,
set/jump/set sequence. */
static rtx
-do_store_flag (sepops ops, rtx target, machine_mode mode)
+do_store_flag (const_sepops ops, rtx target, machine_mode mode)
{
enum rtx_code code;
tree arg0, arg1, type;
@@ -13566,7 +13566,7 @@ do_store_flag (sepops ops, rtx target, machine_mode mode)
if (new_code != ops->code)
{
struct separate_ops nops = *ops;
- nops.code = ops->code = new_code;
+ nops.code = new_code;
nops.op0 = arg0;
nops.op1 = arg1;
nops.type = TREE_TYPE (arg0);