@@ -1,5 +1,24 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_call_return_slot_opt_p require a gimple_call.
+
+ * gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call
+ rather than a plain gimple.
+
+ * gimple-walk.c (walk_stmt_load_store_addr_ops): Convert usage of
+ is_gimple_call to dyn_cast<gimple_call>, introducing a new local
+ "call_stmt".
+
+ * trans-mem.c (expand_call_tm): Split local "stmt", strengthening
+ from plain gimple to a gimple_call, and introducing new local
+ gimple_assign "assign_stmt".
+
+ * tree-inline.c (expand_call_inline): Convert check of code against
+ GIMPLE_CALL to dyn_cast<gimple_call>, introducing a new local
+ "call_stmt".
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
More gimple_phi
* gimple.h (gimple_phi_set_result): Require a gimple_phi rather
@@ -758,11 +758,11 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
}
- else if (is_gimple_call (stmt))
+ else if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
{
if (visit_store)
{
- tree arg = gimple_call_lhs (stmt);
+ tree arg = gimple_call_lhs (call_stmt);
if (arg)
{
tree lhs = get_base_loadstore (arg);
@@ -771,9 +771,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
if (visit_load || visit_addr)
- for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ for (i = 0; i < gimple_call_num_args (call_stmt); ++i)
{
- tree arg = gimple_call_arg (stmt, i);
+ tree arg = gimple_call_arg (call_stmt, i);
if (visit_addr
&& TREE_CODE (arg) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (arg, 0), arg, data);
@@ -785,16 +785,16 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
}
}
if (visit_addr
- && gimple_call_chain (stmt)
- && TREE_CODE (gimple_call_chain (stmt)) == ADDR_EXPR)
- ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (stmt), 0),
- gimple_call_chain (stmt), data);
+ && gimple_call_chain (call_stmt)
+ && TREE_CODE (gimple_call_chain (call_stmt)) == ADDR_EXPR)
+ ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (call_stmt), 0),
+ gimple_call_chain (call_stmt), data);
if (visit_addr
- && gimple_call_return_slot_opt_p (stmt)
- && gimple_call_lhs (stmt) != NULL_TREE
- && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
- ret |= visit_addr (stmt, gimple_call_lhs (stmt),
- gimple_call_lhs (stmt), data);
+ && gimple_call_return_slot_opt_p (call_stmt)
+ && gimple_call_lhs (call_stmt) != NULL_TREE
+ && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call_stmt))))
+ ret |= visit_addr (stmt, gimple_call_lhs (call_stmt),
+ gimple_call_lhs (call_stmt), data);
}
else if (gimple_asm asm_stmt = dyn_cast <gimple_asm> (stmt))
{
@@ -2847,9 +2847,8 @@ gimple_call_set_return_slot_opt (gimple_call s, bool return_slot_opt_p)
/* Return true if S is marked for return slot optimization. */
static inline bool
-gimple_call_return_slot_opt_p (gimple s)
+gimple_call_return_slot_opt_p (gimple_call s)
{
- GIMPLE_CHECK (s, GIMPLE_CALL);
return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
}
@@ -2350,7 +2350,7 @@ static bool
expand_call_tm (struct tm_region *region,
gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
tree lhs = gimple_call_lhs (stmt);
tree fn_decl;
struct cgraph_node *node;
@@ -2437,6 +2437,7 @@ expand_call_tm (struct tm_region *region,
tree tmp = create_tmp_reg (TREE_TYPE (lhs), NULL);
location_t loc = gimple_location (stmt);
edge fallthru_edge = NULL;
+ gimple_assign assign_stmt;
/* Remember if the call was going to throw. */
if (stmt_can_throw_internal (stmt))
@@ -2455,15 +2456,15 @@ expand_call_tm (struct tm_region *region,
gimple_call_set_lhs (stmt, tmp);
update_stmt (stmt);
- stmt = gimple_build_assign (lhs, tmp);
- gimple_set_location (stmt, loc);
+ assign_stmt = gimple_build_assign (lhs, tmp);
+ gimple_set_location (assign_stmt, loc);
/* We cannot throw in the middle of a BB. If the call was going
to throw, place the instrumentation on the fallthru edge, so
the call remains the last statement in the block. */
if (fallthru_edge)
{
- gimple_seq fallthru_seq = gimple_seq_alloc_with_stmt (stmt);
+ gimple_seq fallthru_seq = gimple_seq_alloc_with_stmt (assign_stmt);
gimple_stmt_iterator fallthru_gsi = gsi_start (fallthru_seq);
expand_assign_tm (region, &fallthru_gsi);
gsi_insert_seq_on_edge (fallthru_edge, fallthru_seq);
@@ -2471,7 +2472,7 @@ expand_call_tm (struct tm_region *region,
}
else
{
- gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING);
+ gsi_insert_after (gsi, assign_stmt, GSI_CONTINUE_LINKING);
expand_assign_tm (region, gsi);
}
@@ -4172,6 +4172,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
gimple_stmt_iterator gsi, stmt_gsi;
bool successfully_inlined = FALSE;
bool purge_dead_abnormal_edges;
+ gimple_call call_stmt;
/* Set input_location here so we get the right instantiation context
if we call instantiate_decl from inlinable_function_p. */
@@ -4180,7 +4181,8 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
input_location = gimple_location (stmt);
/* From here on, we're only interested in CALL_EXPRs. */
- if (gimple_code (stmt) != GIMPLE_CALL)
+ call_stmt = dyn_cast <gimple_call> (stmt);
+ if (!call_stmt)
goto egress;
cg_edge = id->dst_node->get_edge (stmt);
@@ -4390,7 +4392,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
if (DECL_P (modify_dest))
TREE_NO_WARNING (modify_dest) = 1;
- if (gimple_call_return_slot_opt_p (stmt))
+ if (gimple_call_return_slot_opt_p (call_stmt))
{
return_slot = modify_dest;
modify_dest = NULL;
This corresponds to: [PATCH 54/89] Make gimple_call_return_slot_opt_p require a gimple_call. https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01230.html from the original 89-patch kit That earlier patch was approved by Jeff: > OK once prerequisites have gone in. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00829.html gcc/ * gimple.h (gimple_call_return_slot_opt_p): Require a gimple_call rather than a plain gimple. * gimple-walk.c (walk_stmt_load_store_addr_ops): Convert usage of is_gimple_call to dyn_cast<gimple_call>, introducing a new local "call_stmt". * trans-mem.c (expand_call_tm): Split local "stmt", strengthening from plain gimple to a gimple_call, and introducing new local gimple_assign "assign_stmt". * tree-inline.c (expand_call_inline): Convert check of code against GIMPLE_CALL to dyn_cast<gimple_call>, introducing a new local "call_stmt". --- gcc/ChangeLog.gimple-classes | 19 +++++++++++++++++++ gcc/gimple-walk.c | 26 +++++++++++++------------- gcc/gimple.h | 3 +-- gcc/trans-mem.c | 11 ++++++----- gcc/tree-inline.c | 6 ++++-- 5 files changed, 43 insertions(+), 22 deletions(-)