summaryrefslogtreecommitdiff
path: root/gcc/passes.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/passes.c')
-rw-r--r--gcc/passes.c92
1 files changed, 50 insertions, 42 deletions
diff --git a/gcc/passes.c b/gcc/passes.c
index f3f85fd3b94..95fc6669440 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -72,6 +72,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pretty-print.h" /* for dump_function_header */
#include "context.h"
#include "pass_manager.h"
+#include "tree-ssa-live.h" /* For remove_unused_locals. */
+#include "tree-cfgcleanup.h"
using namespace gcc;
@@ -107,12 +109,12 @@ opt_pass::execute ()
return 0;
}
-opt_pass::opt_pass(const pass_data &data, context *ctxt)
- : pass_data(data),
- sub(NULL),
- next(NULL),
- static_pass_number(0),
- ctxt_(ctxt)
+opt_pass::opt_pass (const pass_data &data, context *ctxt)
+ : pass_data (data),
+ sub (NULL),
+ next (NULL),
+ static_pass_number (0),
+ m_ctxt (ctxt)
{
}
@@ -278,27 +280,28 @@ finish_optimization_passes (void)
int i;
struct dump_file_info *dfi;
char *name;
+ gcc::dump_manager *dumps = m_ctxt->get_dumps ();
timevar_push (TV_DUMP);
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
- dump_start (pass_profile_1->static_pass_number, NULL);
+ dumps->dump_start (pass_profile_1->static_pass_number, NULL);
end_branch_prob ();
- dump_finish (pass_profile_1->static_pass_number);
+ dumps->dump_finish (pass_profile_1->static_pass_number);
}
if (optimize > 0)
{
- dump_start (pass_profile_1->static_pass_number, NULL);
+ dumps->dump_start (pass_profile_1->static_pass_number, NULL);
print_combine_total_stats ();
- dump_finish (pass_profile_1->static_pass_number);
+ dumps->dump_finish (pass_profile_1->static_pass_number);
}
/* Do whatever is necessary to finish printing the graphs. */
- for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i)
- if (dump_initialized_p (i)
+ for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i)
+ if (dumps->dump_initialized_p (i)
&& (dfi->pflags & TDF_GRAPH) != 0
- && (name = get_dump_file_name (i)) != NULL)
+ && (name = dumps->get_dump_file_name (i)) != NULL)
{
finish_graph_dump_file (name);
free (name);
@@ -350,8 +353,8 @@ const pass_data pass_data_early_local_passes =
class pass_early_local_passes : public simple_ipa_opt_pass
{
public:
- pass_early_local_passes(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_early_local_passes, ctxt)
+ pass_early_local_passes (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_early_local_passes, ctxt)
{}
/* opt_pass methods: */
@@ -398,8 +401,8 @@ const pass_data pass_data_all_early_optimizations =
class pass_all_early_optimizations : public gimple_opt_pass
{
public:
- pass_all_early_optimizations(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_all_early_optimizations, ctxt)
+ pass_all_early_optimizations (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_all_early_optimizations, ctxt)
{}
/* opt_pass methods: */
@@ -443,8 +446,8 @@ const pass_data pass_data_all_optimizations =
class pass_all_optimizations : public gimple_opt_pass
{
public:
- pass_all_optimizations(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_all_optimizations, ctxt)
+ pass_all_optimizations (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_all_optimizations, ctxt)
{}
/* opt_pass methods: */
@@ -488,8 +491,8 @@ const pass_data pass_data_all_optimizations_g =
class pass_all_optimizations_g : public gimple_opt_pass
{
public:
- pass_all_optimizations_g(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_all_optimizations_g, ctxt)
+ pass_all_optimizations_g (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_all_optimizations_g, ctxt)
{}
/* opt_pass methods: */
@@ -533,8 +536,8 @@ const pass_data pass_data_rest_of_compilation =
class pass_rest_of_compilation : public rtl_opt_pass
{
public:
- pass_rest_of_compilation(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rest_of_compilation, ctxt)
+ pass_rest_of_compilation (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rest_of_compilation, ctxt)
{}
/* opt_pass methods: */
@@ -576,8 +579,8 @@ const pass_data pass_data_postreload =
class pass_postreload : public rtl_opt_pass
{
public:
- pass_postreload(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_postreload, ctxt)
+ pass_postreload (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_postreload, ctxt)
{}
/* opt_pass methods: */
@@ -641,6 +644,7 @@ pass_manager::register_one_dump_file (struct opt_pass *pass)
char num[10];
int flags, id;
int optgroup_flags = OPTGROUP_NONE;
+ gcc::dump_manager *dumps = m_ctxt->get_dumps ();
/* See below in next_pass_1. */
num[0] = '\0';
@@ -681,7 +685,8 @@ pass_manager::register_one_dump_file (struct opt_pass *pass)
any dump messages are emitted properly under -fopt-info(-optall). */
if (optgroup_flags == OPTGROUP_NONE)
optgroup_flags = OPTGROUP_OTHER;
- id = dump_register (dot_name, flag_name, glob_name, flags, optgroup_flags);
+ id = dumps->dump_register (dot_name, flag_name, glob_name, flags,
+ optgroup_flags);
set_pass_for_id (id, pass);
full_name = concat (prefix, pass->name, num, NULL);
register_pass_name (pass, full_name);
@@ -836,7 +841,7 @@ dump_one_pass (struct opt_pass *pass, int pass_indent)
const char *pn;
bool is_on, is_really_on;
- is_on = pass->has_gate ? pass->gate() : true;
+ is_on = pass->has_gate ? pass->gate () : true;
is_really_on = override_gate_status (pass, current_function_decl, is_on);
if (pass->static_pass_number <= 0)
@@ -879,7 +884,7 @@ pass_manager::dump_passes () const
{
struct cgraph_node *n, *node = NULL;
- create_pass_tab();
+ create_pass_tab ();
FOR_EACH_FUNCTION (n)
if (DECL_STRUCT_FUNCTION (n->symbol.decl))
@@ -1389,6 +1394,7 @@ void
pass_manager::register_pass (struct register_pass_info *pass_info)
{
bool all_instances, success;
+ gcc::dump_manager *dumps = m_ctxt->get_dumps ();
/* The checks below could fail in buggy plugins. Existing GCC
passes should never fail these checks, so we mention plugin in
@@ -1446,9 +1452,9 @@ pass_manager::register_pass (struct register_pass_info *pass_info)
else
tdi = TDI_rtl_all;
/* Check if dump-all flag is specified. */
- if (get_dump_file_info (tdi)->pstate)
- get_dump_file_info (added_pass_nodes->pass->static_pass_number)
- ->pstate = get_dump_file_info (tdi)->pstate;
+ if (dumps->get_dump_file_info (tdi)->pstate)
+ dumps->get_dump_file_info (added_pass_nodes->pass->static_pass_number)
+ ->pstate = dumps->get_dump_file_info (tdi)->pstate;
XDELETE (added_pass_nodes);
added_pass_nodes = next_node;
}
@@ -1485,10 +1491,10 @@ pass_manager::operator new (size_t sz)
}
pass_manager::pass_manager (context *ctxt)
-: all_passes(NULL), all_small_ipa_passes(NULL), all_lowering_passes(NULL),
- all_regular_ipa_passes(NULL), all_lto_gen_passes(NULL),
- all_late_ipa_passes(NULL), passes_by_id(NULL), passes_by_id_size(0),
- ctxt_(ctxt)
+: all_passes (NULL), all_small_ipa_passes (NULL), all_lowering_passes (NULL),
+ all_regular_ipa_passes (NULL), all_lto_gen_passes (NULL),
+ all_late_ipa_passes (NULL), passes_by_id (NULL), passes_by_id_size (0),
+ m_ctxt (ctxt)
{
struct opt_pass **p;
@@ -1513,7 +1519,7 @@ pass_manager::pass_manager (context *ctxt)
do { \
gcc_assert (NULL == PASS ## _ ## NUM); \
if ((NUM) == 1) \
- PASS ## _1 = make_##PASS (ctxt_); \
+ PASS ## _1 = make_##PASS (m_ctxt); \
else \
{ \
gcc_assert (PASS ## _1); \
@@ -1931,9 +1937,11 @@ pass_init_dump_file (struct opt_pass *pass)
if (pass->static_pass_number != -1)
{
timevar_push (TV_DUMP);
- bool initializing_dump = !dump_initialized_p (pass->static_pass_number);
- dump_file_name = get_dump_file_name (pass->static_pass_number);
- dump_start (pass->static_pass_number, &dump_flags);
+ gcc::dump_manager *dumps = g->get_dumps ();
+ bool initializing_dump =
+ !dumps->dump_initialized_p (pass->static_pass_number);
+ dump_file_name = dumps->get_dump_file_name (pass->static_pass_number);
+ dumps->dump_start (pass->static_pass_number, &dump_flags);
if (dump_file && current_function_decl)
dump_function_header (dump_file, current_function_decl, dump_flags);
if (initializing_dump
@@ -1962,7 +1970,7 @@ pass_fini_dump_file (struct opt_pass *pass)
dump_file_name = NULL;
}
- dump_finish (pass->static_pass_number);
+ g->get_dumps ()->dump_finish (pass->static_pass_number);
timevar_pop (TV_DUMP);
}
@@ -2090,7 +2098,7 @@ apply_ipa_transforms (void *data)
if (!node->global.inlined_to && node->ipa_transforms_to_apply.exists ())
{
*(bool *)data = true;
- execute_all_ipa_transforms();
+ execute_all_ipa_transforms ();
rebuild_cgraph_edges ();
}
}
@@ -2139,7 +2147,7 @@ execute_one_pass (struct opt_pass *pass)
/* Check whether gate check should be avoided.
User controls the value of the gate through the parameter "gate_status". */
- gate_status = pass->has_gate ? pass->gate() : true;
+ gate_status = pass->has_gate ? pass->gate () : true;
gate_status = override_gate_status (pass, current_function_decl, gate_status);
/* Override gate with plugin. */