summaryrefslogtreecommitdiff
path: root/gcc/tree-object-size.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-01 11:46:08 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-01 11:46:08 +0000
commit8a2caf10dc2cc415e4b494611dad5c8bffb7c9df (patch)
treede79a98229582fd910a363d796804b194a844d10 /gcc/tree-object-size.c
parent7d3f6cd3a0a8307a775ca43d8d1054e0b23c5f59 (diff)
downloadgcc-8a2caf10dc2cc415e4b494611dad5c8bffb7c9df.tar.gz
2011-08-31 Richard Guenther <rguenther@suse.de>
* expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR handling here, from ... (expand_expr_real_1): ... here. * gimple-pretty-print.c (dump_ternary_rhs): Handle COND_EXPR and VEC_COND_EXPR. * gimple.c (gimple_rhs_class_table): Make COND_EXPR and VEC_COND_EXPR a GIMPLE_TERNARY_RHS. * tree-cfg.c (verify_gimple_assign_ternary): Handle COND_EXPR and VEC_COND_EXPR here ... (verify_gimple_assign_single): ... not here. * gimple-fold.c (fold_gimple_assign): Move COND_EXPR folding. * tree-object-size.c (cond_expr_object_size): Adjust. (collect_object_sizes_for): Likewise. * tree-scalar-evolution.c (interpret_expr): Don't handle ternary RHSs. * tree-ssa-forwprop.c (forward_propagate_into_cond): Fix and simplify. (ssa_forward_propagate_and_combine): Adjust. * tree-ssa-loop-im.c (move_computations_stmt): Build the COND_EXPR as ternary. * tree-ssa-threadedge.c (fold_assignment_stmt): Adjust. * tree-vect-loop.c (vect_is_simple_reduction_1): Likewise. * tree-vect-stmt.c (vectorizable_condition): Likewise. * tree-vrp.c (extract_range_from_cond_expr): Likewise. (extract_range_from_assignment): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178408 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-object-size.c')
-rw-r--r--gcc/tree-object-size.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index b85c9730f1d..b1767584da8 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -53,7 +53,7 @@ static void expr_object_size (struct object_size_info *, tree, tree);
static bool merge_object_sizes (struct object_size_info *, tree, tree,
unsigned HOST_WIDE_INT);
static bool plus_stmt_object_size (struct object_size_info *, tree, gimple);
-static bool cond_expr_object_size (struct object_size_info *, tree, tree);
+static bool cond_expr_object_size (struct object_size_info *, tree, gimple);
static unsigned int compute_object_sizes (void);
static void init_offset_limit (void);
static void check_for_plus_in_loops (struct object_size_info *, tree);
@@ -827,25 +827,25 @@ plus_stmt_object_size (struct object_size_info *osi, tree var, gimple stmt)
}
-/* Compute object_sizes for VAR, defined to VALUE, which is
+/* Compute object_sizes for VAR, defined at STMT, which is
a COND_EXPR. Return true if the object size might need reexamination
later. */
static bool
-cond_expr_object_size (struct object_size_info *osi, tree var, tree value)
+cond_expr_object_size (struct object_size_info *osi, tree var, gimple stmt)
{
tree then_, else_;
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (var);
bool reexamine = false;
- gcc_assert (TREE_CODE (value) == COND_EXPR);
+ gcc_assert (gimple_assign_rhs_code (stmt) == COND_EXPR);
if (object_sizes[object_size_type][varno] == unknown[object_size_type])
return false;
- then_ = COND_EXPR_THEN (value);
- else_ = COND_EXPR_ELSE (value);
+ then_ = gimple_assign_rhs2 (stmt);
+ else_ = gimple_assign_rhs3 (stmt);
if (TREE_CODE (then_) == SSA_NAME)
reexamine |= merge_object_sizes (osi, var, then_, 0);
@@ -932,14 +932,14 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
|| (gimple_assign_rhs_code (stmt) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == MEM_REF))
reexamine = plus_stmt_object_size (osi, var, stmt);
+ else if (gimple_assign_rhs_code (stmt) == COND_EXPR)
+ reexamine = cond_expr_object_size (osi, var, stmt);
else if (gimple_assign_single_p (stmt)
|| gimple_assign_unary_nop_p (stmt))
{
if (TREE_CODE (rhs) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (rhs)))
reexamine = merge_object_sizes (osi, var, rhs, 0);
- else if (TREE_CODE (rhs) == COND_EXPR)
- reexamine = cond_expr_object_size (osi, var, rhs);
else
expr_object_size (osi, var, rhs);
}
@@ -956,8 +956,6 @@ collect_object_sizes_for (struct object_size_info *osi, tree var)
if (TREE_CODE (arg) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (arg)))
reexamine = merge_object_sizes (osi, var, arg, 0);
- else if (TREE_CODE (arg) == COND_EXPR)
- reexamine = cond_expr_object_size (osi, var, arg);
else
expr_object_size (osi, var, arg);
}