summaryrefslogtreecommitdiff
path: root/gcc/ipa-split.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r--gcc/ipa-split.c90
1 files changed, 35 insertions, 55 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 1997f62538b..be1d2cce230 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -85,11 +85,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree-flow.h"
#include "tree-pass.h"
#include "flags.h"
-#include "timevar.h"
#include "diagnostic.h"
#include "tree-dump.h"
#include "tree-inline.h"
-#include "fibheap.h"
#include "params.h"
#include "gimple-pretty-print.h"
#include "ipa-inline.h"
@@ -159,6 +157,7 @@ test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data)
to pretend that the value pointed to is actual result decl. */
if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t))
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
+ && SSA_NAME_VAR (TREE_OPERAND (t, 0))
&& TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL
&& DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
return
@@ -259,7 +258,7 @@ verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars,
gimple stmt = gsi_stmt (bsi);
tree op = gimple_phi_arg_def (stmt, e->dest_idx);
- if (!is_gimple_reg (gimple_phi_result (stmt)))
+ if (virtual_operand_p (gimple_phi_result (stmt)))
continue;
if (TREE_CODE (op) != SSA_NAME
&& test_nonssa_use (stmt, op, non_ssa_vars))
@@ -403,7 +402,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
gimple stmt = gsi_stmt (bsi);
tree val = NULL;
- if (!is_gimple_reg (gimple_phi_result (stmt)))
+ if (virtual_operand_p (gimple_phi_result (stmt)))
continue;
for (i = 0; i < gimple_phi_num_args (stmt); i++)
{
@@ -440,14 +439,17 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
return;
}
}
- else if (gimple_default_def (cfun, parm)
- && bitmap_bit_p (current->ssa_names_to_pass,
- SSA_NAME_VERSION (gimple_default_def
- (cfun, parm))))
+ else
{
- if (!VOID_TYPE_P (TREE_TYPE (parm)))
- call_overhead += estimate_move_cost (TREE_TYPE (parm));
- num_args++;
+ tree ddef = ssa_default_def (cfun, parm);
+ if (ddef
+ && bitmap_bit_p (current->ssa_names_to_pass,
+ SSA_NAME_VERSION (ddef)))
+ {
+ if (!VOID_TYPE_P (TREE_TYPE (parm)))
+ call_overhead += estimate_move_cost (TREE_TYPE (parm));
+ num_args++;
+ }
}
}
if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
@@ -524,6 +526,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
/* Special case is value returned by reference we record as if it was non-ssa
set to result_decl. */
else if (TREE_CODE (retval) == SSA_NAME
+ && SSA_NAME_VAR (retval)
&& TREE_CODE (SSA_NAME_VAR (retval)) == RESULT_DECL
&& DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
current->split_part_set_retval
@@ -550,7 +553,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
gimple_stmt_iterator psi;
for (psi = gsi_start_phis (return_bb); !gsi_end_p (psi); gsi_next (&psi))
- if (is_gimple_reg (gimple_phi_result (gsi_stmt (psi)))
+ if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi)))
&& !(retval
&& current->split_part_set_retval
&& TREE_CODE (retval) == SSA_NAME
@@ -697,6 +700,7 @@ mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data)
to pretend that the value pointed to is actual result decl. */
if ((TREE_CODE (t) == MEM_REF || INDIRECT_REF_P (t))
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
+ && SSA_NAME_VAR (TREE_OPERAND (t, 0))
&& TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (t, 0))) == RESULT_DECL
&& DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
return
@@ -800,9 +804,7 @@ visit_bb (basic_block bb, basic_block return_bb,
gimple stmt = gsi_stmt (bsi);
unsigned int i;
- if (is_gimple_debug (stmt))
- continue;
- if (!is_gimple_reg (gimple_phi_result (stmt)))
+ if (virtual_operand_p (gimple_phi_result (stmt)))
continue;
bitmap_set_bit (set_ssa_names,
SSA_NAME_VERSION (gimple_phi_result (stmt)));
@@ -826,9 +828,7 @@ visit_bb (basic_block bb, basic_block return_bb,
gimple stmt = gsi_stmt (bsi);
tree op = gimple_phi_arg_def (stmt, e->dest_idx);
- if (is_gimple_debug (stmt))
- continue;
- if (!is_gimple_reg (gimple_phi_result (stmt)))
+ if (virtual_operand_p (gimple_phi_result (stmt)))
continue;
if (TREE_CODE (op) == SSA_NAME)
bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op));
@@ -917,7 +917,7 @@ find_split_points (int overall_time, int overall_size)
while (!VEC_empty (stack_entry, stack))
{
- stack_entry *entry = VEC_last (stack_entry, stack);
+ stack_entry *entry = &VEC_last (stack_entry, stack);
/* We are walking an acyclic graph, so edge_num counts
succ and pred edges together. However when considering
@@ -984,9 +984,9 @@ find_split_points (int overall_time, int overall_size)
new_entry.bb = dest;
new_entry.edge_num = 0;
new_entry.overall_time
- = VEC_index (bb_info, bb_info_vec, dest->index)->time;
+ = VEC_index (bb_info, bb_info_vec, dest->index).time;
new_entry.overall_size
- = VEC_index (bb_info, bb_info_vec, dest->index)->size;
+ = VEC_index (bb_info, bb_info_vec, dest->index).size;
new_entry.earliest = INT_MAX;
new_entry.set_ssa_names = BITMAP_ALLOC (NULL);
new_entry.used_ssa_names = BITMAP_ALLOC (NULL);
@@ -1006,8 +1006,8 @@ find_split_points (int overall_time, int overall_size)
and merge stuff we accumulate during the walk. */
else if (entry->bb != ENTRY_BLOCK_PTR)
{
- stack_entry *prev = VEC_index (stack_entry, stack,
- VEC_length (stack_entry, stack) - 2);
+ stack_entry *prev = &VEC_index (stack_entry, stack,
+ VEC_length (stack_entry, stack) - 2);
entry->bb->aux = (void *)(intptr_t)-1;
prev->can_split &= entry->can_split;
@@ -1058,7 +1058,7 @@ split_function (struct split_point *split_point)
bool split_part_return_p = false;
gimple last_stmt = NULL;
unsigned int i;
- tree arg;
+ tree arg, ddef;
if (dump_file)
{
@@ -1076,25 +1076,16 @@ split_function (struct split_point *split_point)
parm; parm = DECL_CHAIN (parm), num++)
if (args_to_skip
&& (!is_gimple_reg (parm)
- || !gimple_default_def (cfun, parm)
+ || (ddef = ssa_default_def (cfun, parm)) == NULL_TREE
|| !bitmap_bit_p (split_point->ssa_names_to_pass,
- SSA_NAME_VERSION (gimple_default_def (cfun,
- parm)))))
+ SSA_NAME_VERSION (ddef))))
bitmap_set_bit (args_to_skip, num);
else
{
/* This parm might not have been used up to now, but is going to be
used, hence register it. */
- add_referenced_var (parm);
if (is_gimple_reg (parm))
- {
- arg = gimple_default_def (cfun, parm);
- if (!arg)
- {
- arg = make_ssa_name (parm, gimple_build_nop ());
- set_default_def (parm, arg);
- }
- }
+ arg = get_or_create_ssa_default_def (cfun, parm);
else
arg = parm;
@@ -1163,7 +1154,7 @@ split_function (struct split_point *split_point)
for (gsi = gsi_start_phis (return_bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
- if (is_gimple_reg (gimple_phi_result (stmt)))
+ if (!virtual_operand_p (gimple_phi_result (stmt)))
{
gsi_next (&gsi);
continue;
@@ -1239,6 +1230,7 @@ split_function (struct split_point *split_point)
}
call = gimple_build_call_vec (node->symbol.decl, args_to_pass);
gimple_set_block (call, DECL_INITIAL (current_function_decl));
+ VEC_free (tree, heap, args_to_pass);
/* We avoid address being taken on any variable used by split part,
so return slot optimization is always possible. Moreover this is
@@ -1275,12 +1267,12 @@ split_function (struct split_point *split_point)
if (TREE_CODE (retval) == SSA_NAME
&& !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
{
- retval = make_ssa_name (SSA_NAME_VAR (retval), call);
+ retval = copy_ssa_name (retval, call);
/* See if there is PHI defining return value. */
for (psi = gsi_start_phis (return_bb);
!gsi_end_p (psi); gsi_next (&psi))
- if (is_gimple_reg (gimple_phi_result (gsi_stmt (psi))))
+ if (!virtual_operand_p (gimple_phi_result (gsi_stmt (psi))))
break;
/* When there is PHI, just update its value. */
@@ -1359,19 +1351,7 @@ split_function (struct split_point *split_point)
assigned to RESULT_DECL (that is pointer to return value).
Look it up or create new one if it is missing. */
if (DECL_BY_REFERENCE (retval))
- {
- tree retval_name;
- if ((retval_name = gimple_default_def (cfun, retval))
- != NULL)
- retval = retval_name;
- else
- {
- retval_name = make_ssa_name (retval,
- gimple_build_nop ());
- set_default_def (retval, retval_name);
- retval = retval_name;
- }
- }
+ retval = get_or_create_ssa_default_def (cfun, retval);
/* Otherwise produce new SSA name for return value. */
else
retval = make_ssa_name (retval, call);
@@ -1417,7 +1397,7 @@ execute_split_functions (void)
}
/* This can be relaxed; function might become inlinable after splitting
away the uninlinable part. */
- if (!inline_summary (node)->inlinable)
+ if (inline_edge_summary_vec && !inline_summary (node)->inlinable)
{
if (dump_file)
fprintf (dump_file, "Not splitting: not inlinable.\n");
@@ -1510,8 +1490,8 @@ execute_split_functions (void)
}
overall_time += time;
overall_size += size;
- VEC_index (bb_info, bb_info_vec, bb->index)->time = time;
- VEC_index (bb_info, bb_info_vec, bb->index)->size = size;
+ VEC_index (bb_info, bb_info_vec, bb->index).time = time;
+ VEC_index (bb_info, bb_info_vec, bb->index).size = size;
}
find_split_points (overall_time, overall_size);
if (best_split_point.split_bbs)