]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr.c (expand_expr_real_1): Do not expand operand #1 and #2 of BIT_FIELD_REF for...
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 25 Jul 2012 19:43:15 +0000 (19:43 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 25 Jul 2012 19:43:15 +0000 (19:43 +0000)
* expr.c (expand_expr_real_1): Do not expand operand #1 and #2
of BIT_FIELD_REF for ignored results.
* fold-const.c (fold_ternary_loc) <BIT_FIELD_REF>: Check that the
CONSTRUCTOR has vector type before using vector accessors on it.
* gimplify.c (gimplify_compound_lval): Do not gimplify operand #1 and
#2 of BIT_FIELD_REF.
(gimplify_expr) <BIT_FIELD_REF>: Likewise.
* tree-nested.c (convert_nonlocal_reference_op) <BIT_FIELD_REF>: Do
not process operand #1 and #2.
(convert_local_reference_op): Likewise.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Remove superfluous
breaks throughout.
<BIT_FIELD_REF>: Reuse operand #1 and #2 directly.
* tree.c (stabilize_reference) <BIT_FIELD_REF>: Do not stabilize
operand #1 and #2.
(UPDATE_FLAGS): Do not consider operand #2 of BIT_FIELD_REF.
(build6_stat): Delete.
* tree.h (build6_stat, build6, build6_stat_loc, build6_loc): Likewise.
ada/
* gcc-interface/utils2.c (gnat_stabilize_reference) <BIT_FIELD_REF>: Do
not stabilize operand #1 and #2.

From-SVN: r189864

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils2.c
gcc/expr.c
gcc/fold-const.c
gcc/gimplify.c
gcc/tree-nested.c
gcc/tree-ssa-pre.c
gcc/tree.c
gcc/tree.h

index 1e12fb689ecdc37b9763ca400b4acb10dd1da1b1..d8f220782c0384b9ff18bed570f1b7412a252af6 100644 (file)
@@ -1,3 +1,24 @@
+2012-07-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * expr.c (expand_expr_real_1): Do not expand operand #1 and #2
+       of BIT_FIELD_REF for ignored results.
+       * fold-const.c (fold_ternary_loc) <BIT_FIELD_REF>: Check that the
+       CONSTRUCTOR has vector type before using vector accessors on it.
+       * gimplify.c (gimplify_compound_lval): Do not gimplify operand #1 and
+       #2 of BIT_FIELD_REF.
+       (gimplify_expr) <BIT_FIELD_REF>: Likewise.
+       * tree-nested.c (convert_nonlocal_reference_op) <BIT_FIELD_REF>: Do
+       not process operand #1 and #2.
+       (convert_local_reference_op): Likewise.
+       * tree-ssa-pre.c (create_component_ref_by_pieces_1): Remove superfluous
+       breaks throughout.
+       <BIT_FIELD_REF>: Reuse operand #1 and #2 directly.
+       * tree.c (stabilize_reference) <BIT_FIELD_REF>: Do not stabilize
+       operand #1 and #2.
+       (UPDATE_FLAGS): Do not consider operand #2 of BIT_FIELD_REF.
+       (build6_stat): Delete.
+       * tree.h (build6_stat, build6, build6_stat_loc, build6_loc): Likewise.
+
 2012-07-25 Marc Glisse <marc.glisse@inria.fr>
 
        PR tree-optimization/30318
index c22cc7a605826c2f6dd50bbf0517af0f5544625b..d7662e73091a0b49f48c6cdfb39d30f7c323a527 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/utils2.c (gnat_stabilize_reference) <BIT_FIELD_REF>: Do
+       not stabilize operand #1 and #2.
+
 2012-07-23  Tristan Gingold  <gingold@adacore.com>
 
        * gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): Use
index b72ebedcea335ed6559fff8c680fe360630486da..a8a21a6f869d077f943e79aba248a97e73c0db1f 100644 (file)
@@ -2644,10 +2644,7 @@ gnat_stabilize_reference (tree ref, bool force, bool *success)
       result = build3 (BIT_FIELD_REF, type,
                       gnat_stabilize_reference (TREE_OPERAND (ref, 0), force,
                                                 success),
-                      gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1),
-                                                  force),
-                      gnat_stabilize_reference_1 (TREE_OPERAND (ref, 2),
-                                                  force));
+                      TREE_OPERAND (ref, 1), TREE_OPERAND (ref, 2));
       break;
 
     case ARRAY_REF:
index 965086328546cc540c6d564256931fa1863f968c..e2dd4d2597a73f4a01c0562fef9613afe666e84b 100644 (file)
@@ -9111,7 +9111,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
        }
 
       if (TREE_CODE_CLASS (code) == tcc_unary
-         || code == COMPONENT_REF || code == INDIRECT_REF)
+         || code == BIT_FIELD_REF
+         || code == COMPONENT_REF
+         || code == INDIRECT_REF)
        return expand_expr (treeop0, const0_rtx, VOIDmode,
                            modifier);
 
@@ -9123,13 +9125,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
          expand_expr (treeop1, const0_rtx, VOIDmode, modifier);
          return const0_rtx;
        }
-      else if (code == BIT_FIELD_REF)
-       {
-         expand_expr (treeop0, const0_rtx, VOIDmode, modifier);
-         expand_expr (treeop1, const0_rtx, VOIDmode, modifier);
-         expand_expr (treeop2, const0_rtx, VOIDmode, modifier);
-         return const0_rtx;
-       }
 
       target = 0;
     }
index a491499b98f19ef7969a13be5e0c5ac7dbf08bfd..c1369601fff4be783c8bb5602d618b1d713e2e02 100644 (file)
@@ -14043,7 +14043,8 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
 
     case BIT_FIELD_REF:
       if ((TREE_CODE (arg0) == VECTOR_CST
-          || TREE_CODE (arg0) == CONSTRUCTOR)
+          || (TREE_CODE (arg0) == CONSTRUCTOR
+              && TREE_CODE (TREE_TYPE (arg0)) == VECTOR_TYPE))
          && (type == TREE_TYPE (TREE_TYPE (arg0))
              || (TREE_CODE (type) == VECTOR_TYPE
                  && TREE_TYPE (type) == TREE_TYPE (TREE_TYPE (arg0)))))
index e14f7279d98ebb664dce740a772c982f530f3229..f48b81f4b5377e1b50a3c6259e4e93ee5250dbda 100644 (file)
@@ -2257,7 +2257,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
                        fallback | fb_lvalue);
   ret = MIN (ret, tret);
 
-  /* And finally, the indices and operands to BIT_FIELD_REF.  During this
+  /* And finally, the indices and operands of ARRAY_REF.  During this
      loop we also remove any useless conversions.  */
   for (; VEC_length (tree, stack) > 0; )
     {
@@ -2273,15 +2273,6 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
              ret = MIN (ret, tret);
            }
        }
-      else if (TREE_CODE (t) == BIT_FIELD_REF)
-       {
-         tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p,
-                               is_gimple_val, fb_rvalue);
-         ret = MIN (ret, tret);
-         tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
-                               is_gimple_val, fb_rvalue);
-         ret = MIN (ret, tret);
-       }
 
       STRIP_USELESS_TYPE_CONVERSION (TREE_OPERAND (t, 0));
 
@@ -7406,19 +7397,9 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
          break;
 
        case BIT_FIELD_REF:
-         {
-           enum gimplify_status r0, r1, r2;
-
-           r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
-                               post_p, is_gimple_lvalue, fb_either);
-           r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
-                               post_p, is_gimple_val, fb_rvalue);
-           r2 = gimplify_expr (&TREE_OPERAND (*expr_p, 2), pre_p,
-                               post_p, is_gimple_val, fb_rvalue);
-           recalculate_side_effects (*expr_p);
-
-           ret = MIN (r0, MIN (r1, r2));
-         }
+         ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+                              post_p, is_gimple_lvalue, fb_either);
+         recalculate_side_effects (*expr_p);
          break;
 
        case TARGET_MEM_REF:
index b5d37e98e35366e1050cd39d579fc23d21d4c999..c0a6250fe587ba13dfb9bb9436e816768b7393ce 100644 (file)
@@ -1013,13 +1013,6 @@ convert_nonlocal_reference_op (tree *tp, int *walk_subtrees, void *data)
              walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference_op,
                         wi, NULL);
            }
-         else if (TREE_CODE (t) == BIT_FIELD_REF)
-           {
-             walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference_op,
-                        wi, NULL);
-             walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference_op,
-                        wi, NULL);
-           }
        }
       wi->val_only = false;
       walk_tree (tp, convert_nonlocal_reference_op, wi, NULL);
@@ -1491,13 +1484,6 @@ convert_local_reference_op (tree *tp, int *walk_subtrees, void *data)
              walk_tree (&TREE_OPERAND (t, 3), convert_local_reference_op, wi,
                         NULL);
            }
-         else if (TREE_CODE (t) == BIT_FIELD_REF)
-           {
-             walk_tree (&TREE_OPERAND (t, 1), convert_local_reference_op, wi,
-                        NULL);
-             walk_tree (&TREE_OPERAND (t, 2), convert_local_reference_op, wi,
-                        NULL);
-           }
        }
       wi->val_only = false;
       walk_tree (tp, convert_local_reference_op, wi, NULL);
index 499cbcb30d6abdb3d3423557d3e75f1515ff39a8..8c34c9ba9a698efadc5d7c4a88a2104676e6f219 100644 (file)
@@ -2667,7 +2667,7 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
          CALL_EXPR_STATIC_CHAIN (folded) = sc;
        return folded;
       }
-      break;
+
     case MEM_REF:
       {
        tree baseop = create_component_ref_by_pieces_1 (block, ref, operand,
@@ -2690,7 +2690,7 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
          }
        return fold_build2 (MEM_REF, currop->type, baseop, offset);
       }
-      break;
+
     case TARGET_MEM_REF:
       {
        pre_expr op0expr, op1expr;
@@ -2720,7 +2720,7 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
        return build5 (TARGET_MEM_REF, currop->type,
                       baseop, currop->op2, genop0, currop->op1, genop1);
       }
-      break;
+
     case ADDR_EXPR:
       if (currop->op0)
        {
@@ -2732,17 +2732,15 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
     case IMAGPART_EXPR:
     case VIEW_CONVERT_EXPR:
       {
-       tree folded;
        tree genop0 = create_component_ref_by_pieces_1 (block, ref,
                                                        operand,
                                                        stmts, domstmt);
        if (!genop0)
          return NULL_TREE;
-       folded = fold_build1 (currop->opcode, currop->type,
-                             genop0);
-       return folded;
+
+       return fold_build1 (currop->opcode, currop->type, genop0);
       }
-      break;
+
     case WITH_SIZE_EXPR:
       {
        tree genop0 = create_component_ref_by_pieces_1 (block, ref, operand,
@@ -2759,28 +2757,18 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
 
        return fold_build2 (currop->opcode, currop->type, genop0, genop1);
       }
-      break;
+
     case BIT_FIELD_REF:
       {
-       tree folded;
        tree genop0 = create_component_ref_by_pieces_1 (block, ref, operand,
                                                        stmts, domstmt);
-       pre_expr op1expr = get_or_alloc_expr_for (currop->op0);
-       pre_expr op2expr = get_or_alloc_expr_for (currop->op1);
-       tree genop1;
-       tree genop2;
+       tree op1 = currop->op0;
+       tree op2 = currop->op1;
 
        if (!genop0)
          return NULL_TREE;
-       genop1 = find_or_generate_expression (block, op1expr, stmts, domstmt);
-       if (!genop1)
-         return NULL_TREE;
-       genop2 = find_or_generate_expression (block, op2expr, stmts, domstmt);
-       if (!genop2)
-         return NULL_TREE;
-       folded = fold_build3 (BIT_FIELD_REF, currop->type, genop0, genop1,
-                             genop2);
-       return folded;
+
+       return fold_build3 (BIT_FIELD_REF, currop->type, genop0, op1, op2);
       }
 
       /* For array ref vn_reference_op's, operand 1 of the array ref
@@ -2866,10 +2854,9 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
              return NULL_TREE;
          }
 
-       return fold_build3 (COMPONENT_REF, TREE_TYPE (op1), op0, op1,
-                           genop2);
+       return fold_build3 (COMPONENT_REF, TREE_TYPE (op1), op0, op1, genop2);
       }
-      break;
+
     case SSA_NAME:
       {
        pre_expr op0expr = get_or_alloc_expr_for (currop->op0);
index 4fea005a5250c47a79c288727a2bfd0fd5e69c2b..6f9c91d109ecf3d5403be4a672b0813270d5bafb 100644 (file)
@@ -3525,8 +3525,7 @@ stabilize_reference (tree ref)
     case BIT_FIELD_REF:
       result = build_nt (BIT_FIELD_REF,
                         stabilize_reference (TREE_OPERAND (ref, 0)),
-                        stabilize_reference_1 (TREE_OPERAND (ref, 1)),
-                        stabilize_reference_1 (TREE_OPERAND (ref, 2)));
+                        TREE_OPERAND (ref, 1), TREE_OPERAND (ref, 2));
       break;
 
     case ARRAY_REF:
@@ -3696,8 +3695,6 @@ do { tree _node = (NODE); \
          if (TREE_OPERAND (node, 2))
            UPDATE_FLAGS (TREE_OPERAND (node, 2));
        }
-      else if (TREE_CODE (node) == BIT_FIELD_REF)
-       UPDATE_FLAGS (TREE_OPERAND (node, 2));
     }
 
   node = lang_hooks.expr_to_decl (node, &tc, &se);
@@ -3969,37 +3966,6 @@ build5_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
   return t;
 }
 
-tree
-build6_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
-            tree arg2, tree arg3, tree arg4, tree arg5 MEM_STAT_DECL)
-{
-  bool constant, read_only, side_effects;
-  tree t;
-
-  gcc_assert (code == TARGET_MEM_REF);
-
-  t = make_node_stat (code PASS_MEM_STAT);
-  TREE_TYPE (t) = tt;
-
-  side_effects = TREE_SIDE_EFFECTS (t);
-
-  PROCESS_ARG(0);
-  PROCESS_ARG(1);
-  PROCESS_ARG(2);
-  PROCESS_ARG(3);
-  PROCESS_ARG(4);
-  if (code == TARGET_MEM_REF)
-    side_effects = 0;
-  PROCESS_ARG(5);
-
-  TREE_SIDE_EFFECTS (t) = side_effects;
-  TREE_THIS_VOLATILE (t)
-    = (code == TARGET_MEM_REF
-       && arg5 && TREE_THIS_VOLATILE (arg5));
-
-  return t;
-}
-
 /* Build a simple MEM_REF tree with the sematics of a plain INDIRECT_REF
    on the pointer PTR.  */
 
index 62d66456e3255ffec409d0c75705cf931b921ebc..cf3b2cdbcd64e756bccdd1917dce688009e47f8f 100644 (file)
@@ -4245,12 +4245,8 @@ extern tree build4_stat (enum tree_code, tree, tree, tree, tree,
 extern tree build5_stat (enum tree_code, tree, tree, tree, tree, tree,
                         tree MEM_STAT_DECL);
 #define build5(c,t1,t2,t3,t4,t5,t6) build5_stat (c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
-extern tree build6_stat (enum tree_code, tree, tree, tree, tree, tree,
-                        tree, tree MEM_STAT_DECL);
-#define build6(c,t1,t2,t3,t4,t5,t6,t7) \
-  build6_stat (c,t1,t2,t3,t4,t5,t6,t7 MEM_STAT_INFO)
 
-/* _loc versions of build[1-6].  */
+/* _loc versions of build[1-5].  */
 
 static inline tree
 build1_stat_loc (location_t loc, enum tree_code code, tree type,
@@ -4311,20 +4307,6 @@ build5_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
 #define build5_loc(l,c,t1,t2,t3,t4,t5,t6) \
   build5_stat_loc (l,c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
 
-static inline tree
-build6_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
-                tree arg1, tree arg2, tree arg3, tree arg4,
-                tree arg5 MEM_STAT_DECL)
-{
-  tree t = build6_stat (code, type, arg0, arg1, arg2, arg3, arg4,
-                       arg5 PASS_MEM_STAT);
-  if (CAN_HAVE_LOCATION_P (t))
-    SET_EXPR_LOCATION (t, loc);
-  return t;
-}
-#define build6_loc(l,c,t1,t2,t3,t4,t5,t6,t7) \
-  build6_stat_loc (l,c,t1,t2,t3,t4,t5,t6,t7 MEM_STAT_INFO)
-
 extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL);
 #define build_var_debug_value(t1,t2) \
   build_var_debug_value_stat (t1,t2 MEM_STAT_INFO)