]> gcc.gnu.org Git - gcc.git/commitdiff
expand: constify sepops operand to expand_expr_real_2 and expand_widen_pattern_expr...
authorAndrew Pinski <quic_apinski@quicinc.com>
Thu, 13 Jun 2024 20:07:10 +0000 (13:07 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Fri, 14 Jun 2024 03:10:53 +0000 (20:10 -0700)
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>
gcc/expr.cc
gcc/expr.h
gcc/optabs.cc
gcc/optabs.h

index 04bad5e1425d8c20e80ac4be42685a9e2fbb9934..9cecc1758f5c95fc6051c67d3e846ff3cc3e0b9e 100644 (file)
@@ -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);
index 751815841083bcd7d22b4dff630b3764df066a4f..533ae0af3871ae39b0bb61d00bc872304684addb 100644 (file)
@@ -53,6 +53,8 @@ typedef struct separate_ops
   tree type;
   tree op0, op1, op2;
 } *sepops;
+
+typedef const struct separate_ops *const_sepops;
 \f
 /* This is run during target initialization to set up which modes can be
    used directly in memory and to initialize the block move optab.  */
@@ -305,7 +307,7 @@ extern rtx expand_expr_real (tree, rtx, machine_mode,
                             enum expand_modifier, rtx *, bool);
 extern rtx expand_expr_real_1 (tree, rtx, machine_mode,
                               enum expand_modifier, rtx *, bool);
-extern rtx expand_expr_real_2 (sepops, rtx, machine_mode,
+extern rtx expand_expr_real_2 (const_sepops, rtx, machine_mode,
                               enum expand_modifier);
 extern rtx expand_expr_real_gassign (gassign *, rtx, machine_mode,
                                     enum expand_modifier modifier,
index 78cd9ef34488ee97cd59656fda1b616a874f671c..c54d275b8b7a5098605c124d53bd707d56cd85a8 100644 (file)
@@ -253,7 +253,7 @@ widen_operand (rtx op, machine_mode mode, machine_mode oldmode,
    type-promotion (vec-unpack)  1       oprnd0  -       -  */
 
 rtx
-expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op,
+expand_widen_pattern_expr (const_sepops ops, rtx op0, rtx op1, rtx wide_op,
                           rtx target, int unsignedp)
 {
   class expand_operand eops[4];
index c0b8df5268f6ec9b5c6ca593d0e31dbad3c5f748..301847e2186d7157509cacceba496d89425d5c2e 100644 (file)
@@ -182,7 +182,7 @@ enum optab_methods
   OPTAB_MUST_WIDEN
 };
 
-extern rtx expand_widen_pattern_expr (struct separate_ops *, rtx , rtx , rtx,
+extern rtx expand_widen_pattern_expr (const struct separate_ops *, rtx , rtx , rtx,
                                       rtx, int);
 extern rtx expand_ternary_op (machine_mode mode, optab ternary_optab,
                              rtx op0, rtx op1, rtx op2, rtx target,
This page took 0.082366 seconds and 5 git commands to generate.