aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-optimize.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2006-01-11 17:40:46 +0000
committerBernd Schmidt <bernd.schmidt@analog.com>2006-01-11 17:40:46 +0000
commit337db89251de80f8ff7a00b2d71bc333c630b6e4 (patch)
treed3188ec1672ccdf9f1225cc766a1dc386c4f0d32 /gcc/tree-optimize.c
parentefb5461014d0abdd5751d82ad1b4d0c61685dbdd (diff)
Merged revisions 96681,96683-96686,96689-96692,96698-96701,96705,96708,96710,96712,96714-96715,96719-96720,96725,96730,96733,96735-96737,96739-96740,96743,96745,96748,96753,96755,96759-96762,96764-96765,96768,96770-96771,96774,96776-96778,96782,96784-96785,96788,96790,96795-96803,96808,96812-96814,96816-96832,96834,96836-96837,96844,96847,96849-96853,96855,96862,96867,96870,96872,96879-96881,96883-96884,96889,96891-96895,96899,96902-96905,96908,96911,96913,96915-96917,96919-96921,96923-96924,96926-96927,96931-96935,96937-96939,96941,96944,96947-96948,96951,96953-96954,96957-96958,96960,96963,96966-96968,96980-96985,96988-96990,96995-96996,96998,97000,97003-97005,97013-97016,97018-97019,97024,97026,97028-97029,97031-97034,97036,97038-97039,97041,97044,97046-97048,97050,97054,97057-97063,97065,97070,97074,97076-97077,97079,97081-97086,97089,97091,97109,97111-97116,97120,97122-97123,97125-97130,97132-97136,97139,97143,97146-97148,97150-97153,97156-97157,97160-97161,97164-97192,97194-97197,97199-97200,97202,97204,97207-97212,97217,97220-97223,97229,97233,97236-97243,97249-97253,97255,97258,97263-97264,97267,97270,97273,97276-97278,97281-97285,97287,97289-97290,97292,97295,97298-97299,97301,97303,97308,97312-97314,97317-97319,97321-97322,97325-97326,97330-97334,97336-97344,97347-97349,97351-97352,97358,97360-97364,97367,97369-97370,97372-97373,97376-97381,97383,97385-97397,97399-97400,97402-97403,97406,97409,97411-97412,97414,97416-97417,97422,97424,97428-97430,97434-97438,97440-97441,97444,97446,97449,97452-97453,97455-97458,97461,97470,97472-97473,97475-97476,97478-97479,97481,97484-97486,97489-97493,97495-97496,97498,97511,97522,97525-97527,97529,97532-97533,97536-97538,97540-97551,97554-97555,97557-97558,97560-97561,97565,97567,97569-97572,97574-97578,97580-97582,97587,97589,97593-97599,97601-97602,97604-97605,97607,97609,97611,97613,97617,97620,97622,97624,97627,97631,97633,97635-97636,97640-97641,97643-97646,97648,97650,97652-97656,97659-97663,97666,97668,97671,97673-97674,97676-97678,97681,97685-97686,97691,97694,97696,97699-97702,97705,97708-97713,97719,97722-97723,97726,97728,97730-97731,97733,97737-97740,97742,97746-97747,97749,97751,97756,97759-97760,97763,97765,97770,97772-97773,97775,97778-97779,97781-97782,97784,97787-97788,97790,97792-97793,97795-97797,97804-97805,97807-97810,97813,97815-97819,97822,97825-97828,97830,97832,97836-97842,97846,97849,97851,97854,97857,97860-97862,97866,97868-97873,97880,97884-97887,97890,97894-97895,97897,97902-97908,97910-97912,97916,97919-97924,97928-97932,97935,97937-97941,97943-97951,97955,97958,97961,97964-97966,97968,97971-97974,97976-97983,97986-97988,97991,97994,97999-98001,98003,98009-98010,98012,98017-98023,98026-98029,98031-98032,98034,98039-98040,98044,98047-98048,98051-98053,98058,98061-98068,98070-98073,98076-98080,98082-98095,98097,98099,98101-98107,98110-98111,98118,98121,98127-98128,98131-98137,98140-98144,98146,98148-98149,98152,98154-98156,98159,98161-98162,98165-98168,98173-98174,98179,98183-98184,98186-98187,98189-98193,98195-98196,98199-98200,98202-98203,98206,98208-98210,98213,98216,98218,98220-98223,98225,98227,98232-98234,98236-98239,98242,98244-98245,98247,98252,98257-98260,98262,98265-98266,98269,98271,98273,98278,98283,98285-98288,98295,98297,98303,98307,98309-98313,98315-98316,98318-98321,98323-98324,98326-98335,98338-98343,98345-98350,98352,98355,98357,98362,98365-98379,98381,98384-98400,98402-98403,98405-98408,98412-98414,98416-98421,98425,98428-98430,98432-98451,98453,98456-98458,98460-98462,98464,98466,98468-98469,98471-98473,98476,98478,98482,98486,98493-98504,98507-98508,98510-98511,98513-98519,98522-98523,98527-98528,98530,98534,98540,98542-98544,98548-98551,98555,98559-98562,98567,98569-98570,98573-98574,98578-98583,98585-98587,98589,98594,98596-98603,98605-98607,98610-98611,98613-98622,98624,98631-98637,98640,98643-98644,98649-98650,98654,98658-98660,98663-98665,98668-98669,98673-98674,98676,98678-98679,98681,98684-98686,98691,98693-98695,98699,98708,98711-98712,98714-98715,98717,98723-98724,98726,98728,98730-98735,98737-98738,98740,98744-98746,98749,98752-98753,98755-98756,98762-98771,98774-98776,98778-98780,98782-98783,98785-98786,98788-98789,98791-98793,98795-98798,98800,98805,98808,98813-98814,98816-98818,98828-98829,98831-98832,98835-98837,98840,98843-98845,98848,98850-98854,98861-98862,98866-98868,98871-98875,98877-98886,98890,98893,98896,98898,98900-98901,98906-98908,98910-98916,98919,98922,98924,98928-98929,98932,98934-98936,98938-98942,98944,98947,98949-98950,98952,98955,98958,98961-98962,98966,98968,98975-98981,98983-98989,98991-98994,98998-99000,99006,99008,99010-99013,99016,99018-99021,99028,99032-99033,99035,99037-99038,99041,99043,99046-99047,99052,99054,99059,99064,99067-99068,99071-99072,99076,99080,99082-99083,99085-99086,99089,99091,99093-99096,99099-99100,99103-99105,99109,99111,99113-99115,99118,99121-99123,99125-99126,99131,99133,99135,99144,99152,99155-99158,99160-99164,99167-99175,99177,99179-99180,99182-99183,99185-99188,99196-99197,99200,99203-99211,99216-99225,99227,99230,99232,99234-99236,99238,99244,99247,99250-99257,99261-99262,99264-99265,99268-99269,99272-99275,99277,99279,99281-99282,99284,99287-99291,99296,99300-99306,99309,99314-99317,99319,99322,99324-99326,99329-99332,99334,99336-99337,99341,99343-99352,99355-99360,99362-99363,99365-99366,99370,99373,99375-99384,99386,99388,99391,99393-99395,99398-99399,99405-99408,99410-99411,99413,99415,99419,99421-99422,99424-99425,99429,99431-99433,99435,99441-99444,99446-99464,99466-99467,99470-99478,99483,99485,99487,99492-99493,99495-99499,99503,99505-99506,99508-99510,99513-99514,99516-99521,99523-99529,99535-99541,99544-99548,99553,99556,99558-99560,99563,99566,99568-99570,99573-99574,99577-99586,99588,99591-99592,99596-99597,99602,99604-99610,99613,99615,99617,99619,99621,99623,99625-99627,99631-99633,99635-99637,99640,99642-99643,99646-99648,99650,99652,99654-99660,99662-99664,99666,99668-99670,99672-99676,99679-99680,99684,99687,99691-99705,99708,99710-99711,99714-99716,99719-99724,99726,99728-99729,99731-99733,99735-99742,99745-99750,99755,99757,99759-99760,99765,99767,99769,99773-99775,99777-99779,99782-99783,99785,99787,99789,99791-99792,99794,99796,99799-99801,99803,99806,99810-99817,99823-99835,99837-99840,99842-99844,99846-99862,99871,99877-99882,99884-99885,99889-99890,99892-99893,99896-99897,99899-99901,99903-99904,99906,99908,99910,99916,99919-99920,99922-99928,99930,99933,99935-99936,99939,99941-99946,99948-99953,99957,99960,99966-99967,99971-99972,99974,99976-99978,99981-99982,99984,99986,99988,99993,99996-99997,99999 via svnmerge from
svn+ssh://gcc.gnu.org/svn/gcc/trunk git-svn-id: https://gcc.gnu.org/svn/gcc/branches/reload-branch@109594 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r--gcc/tree-optimize.c273
1 files changed, 195 insertions, 78 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index bb31a0edc35..7c9beb812dc 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -48,34 +48,15 @@ Boston, MA 02111-1307, USA. */
#include "cgraph.h"
#include "graph.h"
#include "cfgloop.h"
+#include "except.h"
/* Global variables used to communicate with passes. */
int dump_flags;
-bitmap vars_to_rename;
bool in_gimple_form;
/* The root of the compilation pass tree, once constructed. */
-static struct tree_opt_pass *all_passes;
-
-/* Pass: dump the gimplified, inlined, functions. */
-
-static struct tree_opt_pass pass_gimple =
-{
- "gimple", /* name */
- NULL, /* gate */
- NULL, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- 0, /* tv_id */
- 0, /* properties_required */
- PROP_gimple_any, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func, /* todo_flags_finish */
- 0 /* letter */
-};
+static struct tree_opt_pass *all_passes, *all_ipa_passes, * all_lowering_passes;
/* Gate: execute, or not, all of the non-trivial optimizations. */
@@ -178,6 +159,51 @@ static struct tree_opt_pass pass_free_datastructures =
0 /* letter */
};
+/* Pass: fixup_cfg - IPA passes or compilation of earlier functions might've
+ changed some properties - such as marked functions nothrow. Remove now
+ redundant edges and basic blocks. */
+
+static void
+execute_fixup_cfg (void)
+{
+ basic_block bb;
+ block_stmt_iterator bsi;
+
+ if (cfun->eh)
+ FOR_EACH_BB (bb)
+ {
+ for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+ {
+ tree stmt = bsi_stmt (bsi);
+ tree call = get_call_expr_in (stmt);
+
+ if (call && call_expr_flags (call) & (ECF_CONST | ECF_PURE))
+ TREE_SIDE_EFFECTS (call) = 0;
+ if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
+ remove_stmt_from_eh_region (stmt);
+ }
+ tree_purge_dead_eh_edges (bb);
+ }
+
+ cleanup_tree_cfg ();
+}
+
+static struct tree_opt_pass pass_fixup_cfg =
+{
+ NULL, /* name */
+ NULL, /* gate */
+ execute_fixup_cfg, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ 0 /* letter */
+};
/* Do the actions required to initialize internal data structures used
in tree-ssa optimization passes. */
@@ -211,7 +237,7 @@ static struct tree_opt_pass pass_init_datastructures =
enabled or not. */
static void
-register_one_dump_file (struct tree_opt_pass *pass, int n)
+register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int n)
{
char *dot_name, *flag_name, *glob_name;
char num[10];
@@ -223,7 +249,15 @@ register_one_dump_file (struct tree_opt_pass *pass, int n)
? 1 : pass->static_pass_number));
dot_name = concat (".", pass->name, num, NULL);
- if (pass->properties_provided & PROP_trees)
+ if (ipa)
+ {
+ flag_name = concat ("ipa-", pass->name, num, NULL);
+ glob_name = concat ("ipa-", pass->name, NULL);
+ /* First IPA dump is cgraph that is dumped via separate channels. */
+ pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
+ TDF_IPA, n + 1, 0);
+ }
+ else if (pass->properties_provided & PROP_trees)
{
flag_name = concat ("tree-", pass->name, num, NULL);
glob_name = concat ("tree-", pass->name, NULL);
@@ -240,7 +274,7 @@ register_one_dump_file (struct tree_opt_pass *pass, int n)
}
static int
-register_dump_files (struct tree_opt_pass *pass, int properties)
+register_dump_files (struct tree_opt_pass *pass, bool ipa, int properties)
{
static int n = 0;
do
@@ -261,7 +295,7 @@ register_dump_files (struct tree_opt_pass *pass, int properties)
n++;
if (pass->sub)
- new_properties = register_dump_files (pass->sub, new_properties);
+ new_properties = register_dump_files (pass->sub, ipa, new_properties);
/* If we have a gate, combine the properties that we could have with
and without the pass being examined. */
@@ -272,7 +306,7 @@ register_dump_files (struct tree_opt_pass *pass, int properties)
pass->properties_provided = properties;
if (pass->name)
- register_one_dump_file (pass, pass_number);
+ register_one_dump_file (pass, ipa, pass_number);
pass = pass->next;
}
@@ -327,19 +361,30 @@ init_tree_optimization_passes (void)
struct tree_opt_pass **p;
#define NEXT_PASS(PASS) (p = next_pass_1 (p, &PASS))
+ /* Intraprocedural optimization passes. */
+ p = &all_ipa_passes;
+ NEXT_PASS (pass_ipa_inline);
+ *p = NULL;
- p = &all_passes;
- NEXT_PASS (pass_gimple);
+ /* All passes needed to lower the function into shape optimizers can operate
+ on. These passes are performed before interprocedural passes, unlike rest
+ of local passes (all_passes). */
+ p = &all_lowering_passes;
NEXT_PASS (pass_remove_useless_stmts);
NEXT_PASS (pass_mudflap_1);
- NEXT_PASS (pass_lower_cf);
- NEXT_PASS (pass_lower_eh);
- NEXT_PASS (pass_build_cfg);
+ NEXT_PASS (pass_lower_cf);
+ NEXT_PASS (pass_lower_eh);
+ NEXT_PASS (pass_build_cfg);
NEXT_PASS (pass_pre_expand);
+ NEXT_PASS (pass_warn_function_return);
+ *p = NULL;
+
+ p = &all_passes;
+ NEXT_PASS (pass_fixup_cfg);
NEXT_PASS (pass_tree_profile);
NEXT_PASS (pass_init_datastructures);
NEXT_PASS (pass_all_optimizations);
- NEXT_PASS (pass_warn_function_return);
+ NEXT_PASS (pass_warn_function_noreturn);
NEXT_PASS (pass_mudflap_2);
NEXT_PASS (pass_free_datastructures);
NEXT_PASS (pass_expand);
@@ -353,17 +398,24 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_early_warn_uninitialized);
+
+ /* Initial scalar cleanups. */
+ NEXT_PASS (pass_ccp);
+ NEXT_PASS (pass_fre);
NEXT_PASS (pass_dce);
- NEXT_PASS (pass_dominator);
- NEXT_PASS (pass_redundant_phi);
+ NEXT_PASS (pass_forwprop);
+ NEXT_PASS (pass_vrp);
+ NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_merge_phi);
- NEXT_PASS (pass_forwprop);
+ NEXT_PASS (pass_dominator);
+
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_tail_recursion);
- NEXT_PASS (pass_ch);
NEXT_PASS (pass_profile);
+ NEXT_PASS (pass_ch);
+ NEXT_PASS (pass_stdarg);
NEXT_PASS (pass_sra);
/* FIXME: SRA may generate arbitrary gimple code, exposing new
aliased and call-clobbered variables. As mentioned below,
@@ -371,25 +423,27 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_dominator);
- NEXT_PASS (pass_redundant_phi);
+ NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_dse);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt);
- NEXT_PASS (pass_ccp);
- NEXT_PASS (pass_redundant_phi);
+ NEXT_PASS (pass_store_ccp);
+ NEXT_PASS (pass_store_copy_prop);
NEXT_PASS (pass_fold_builtins);
/* FIXME: May alias should a TODO but for 4.0.0,
we add may_alias right after fold builtins
which can create arbitrary GIMPLE. */
NEXT_PASS (pass_may_alias);
+ NEXT_PASS (pass_cse_reciprocals);
NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_pre);
NEXT_PASS (pass_sink_code);
NEXT_PASS (pass_loop);
NEXT_PASS (pass_dominator);
- NEXT_PASS (pass_redundant_phi);
+ NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_cd_dce);
/* FIXME: If DCE is not run before checking for uninitialized uses,
we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c).
However, this also causes us to misdiagnose cases that should be
@@ -400,12 +454,12 @@ init_tree_optimization_passes (void)
variable. Using a representation like Gated Single Assignment
may help. */
NEXT_PASS (pass_late_warn_uninitialized);
- NEXT_PASS (pass_cd_dce);
NEXT_PASS (pass_dse);
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_tail_calls);
NEXT_PASS (pass_rename_ssa_copies);
+ NEXT_PASS (pass_uncprop);
NEXT_PASS (pass_del_ssa);
NEXT_PASS (pass_nrv);
NEXT_PASS (pass_remove_useless_vars);
@@ -415,13 +469,16 @@ init_tree_optimization_passes (void)
p = &pass_loop.sub;
NEXT_PASS (pass_loop_init);
+ NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_lim);
NEXT_PASS (pass_unswitch);
+ NEXT_PASS (pass_scev_cprop);
NEXT_PASS (pass_record_bounds);
NEXT_PASS (pass_linear_transform);
NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_if_conversion);
NEXT_PASS (pass_vectorize);
+ NEXT_PASS (pass_lower_vector_ssa);
NEXT_PASS (pass_complete_unroll);
NEXT_PASS (pass_iv_optimize);
NEXT_PASS (pass_loop_done);
@@ -429,26 +486,34 @@ init_tree_optimization_passes (void)
#undef NEXT_PASS
- /* Register the passes with the tree dump code. */
- register_dump_files (all_passes, 0);
+ register_dump_files (all_lowering_passes, false, PROP_gimple_any);
+ register_dump_files (all_passes, false, PROP_gimple_any
+ | PROP_gimple_lcf
+ | PROP_gimple_leh
+ | PROP_cfg);
+ register_dump_files (all_ipa_passes, true, PROP_gimple_any
+ | PROP_gimple_lcf
+ | PROP_gimple_leh
+ | PROP_cfg);
}
-static void execute_pass_list (struct tree_opt_pass *);
-
static unsigned int last_verified;
static void
-execute_todo (int properties, unsigned int flags)
+execute_todo (struct tree_opt_pass *pass, unsigned int flags, bool use_required)
{
- if (flags & TODO_rename_vars)
- {
- rewrite_into_ssa (false);
- bitmap_clear (vars_to_rename);
- }
- if (flags & TODO_fix_def_def_chains)
+ int properties
+ = use_required ? pass->properties_required : pass->properties_provided;
+
+#if defined ENABLE_CHECKING
+ if (need_ssa_update_p ())
+ gcc_assert (flags & TODO_update_ssa_any);
+#endif
+
+ if (flags & TODO_update_ssa_any)
{
- rewrite_def_def_chains ();
- bitmap_clear (vars_to_rename);
+ unsigned update_flags = flags & TODO_update_ssa_any;
+ update_ssa (update_flags);
}
if (flags & TODO_cleanup_cfg)
@@ -459,7 +524,8 @@ execute_todo (int properties, unsigned int flags)
cleanup_tree_cfg ();
}
- if ((flags & TODO_dump_func) && dump_file)
+ if ((flags & TODO_dump_func)
+ && dump_file && current_function_decl)
{
if (properties & PROP_trees)
dump_function_to_file (current_function_decl,
@@ -470,20 +536,33 @@ execute_todo (int properties, unsigned int flags)
print_rtl (dump_file, get_insns ());
/* Flush the file. If verification fails, we won't be able to
+ close the file before dieing. */
+ fflush (dump_file);
+ }
+ if ((flags & TODO_dump_cgraph)
+ && dump_file && !current_function_decl)
+ {
+ dump_cgraph (dump_file);
+ /* Flush the file. If verification fails, we won't be able to
close the file before aborting. */
fflush (dump_file);
}
if (flags & TODO_ggc_collect)
- ggc_collect ();
+ {
+ ggc_collect ();
+ }
-#ifdef ENABLE_CHECKING
- if (flags & TODO_verify_ssa)
- verify_ssa ();
+#if defined ENABLE_CHECKING
+ if ((pass->properties_required & PROP_ssa)
+ && !(pass->properties_destroyed & PROP_ssa))
+ verify_ssa (true);
if (flags & TODO_verify_flow)
verify_flow_info ();
if (flags & TODO_verify_stmts)
verify_stmts ();
+ if (flags & TODO_verify_loops)
+ verify_loop_closed_ssa ();
#endif
}
@@ -503,7 +582,7 @@ execute_one_pass (struct tree_opt_pass *pass)
/* Run pre-pass verification. */
todo = pass->todo_flags_start & ~last_verified;
if (todo)
- execute_todo (pass->properties_required, todo);
+ execute_todo (pass, todo, true);
/* If a dump file name is present, open it if enabled. */
if (pass->static_pass_number != -1)
@@ -511,18 +590,18 @@ execute_one_pass (struct tree_opt_pass *pass)
bool initializing_dump = !dump_initialized_p (pass->static_pass_number);
dump_file_name = get_dump_file_name (pass->static_pass_number);
dump_file = dump_begin (pass->static_pass_number, &dump_flags);
- if (dump_file)
+ if (dump_file && current_function_decl)
{
const char *dname, *aname;
dname = lang_hooks.decl_printable_name (current_function_decl, 2);
aname = (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (current_function_decl)));
- fprintf (dump_file, "\n;; Function %s (%s)%s\n\n", dname, aname,
- cfun->function_frequency == FUNCTION_FREQUENCY_HOT
- ? " (hot)"
- : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED
- ? " (unlikely executed)"
- : "");
+ fprintf (dump_file, "\n;; Function %s (%s)%s\n\n", dname, aname,
+ cfun->function_frequency == FUNCTION_FREQUENCY_HOT
+ ? " (hot)"
+ : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED
+ ? " (unlikely executed)"
+ : "");
}
if (initializing_dump
@@ -553,7 +632,7 @@ execute_one_pass (struct tree_opt_pass *pass)
todo = pass->todo_flags_finish;
last_verified = todo & TODO_verify_all;
if (todo)
- execute_todo (pass->properties_provided, todo);
+ execute_todo (pass, todo, false);
/* Flush and close dump file. */
if (dump_file_name)
@@ -581,6 +660,30 @@ execute_pass_list (struct tree_opt_pass *pass)
}
while (pass);
}
+
+void
+tree_lowering_passes (tree fn)
+{
+ tree saved_current_function_decl = current_function_decl;
+
+ current_function_decl = fn;
+ push_cfun (DECL_STRUCT_FUNCTION (fn));
+ tree_register_cfg_hooks ();
+ bitmap_obstack_initialize (NULL);
+ execute_pass_list (all_lowering_passes);
+ free_dominance_info (CDI_POST_DOMINATORS);
+ compact_blocks ();
+ current_function_decl = saved_current_function_decl;
+ bitmap_obstack_release (NULL);
+ pop_cfun ();
+}
+
+/* Execute all IPA passes. */
+void
+ipa_passes (void)
+{
+ execute_pass_list (all_ipa_passes);
+}
/* Update recursively all inlined_to pointers of functions
@@ -625,6 +728,7 @@ tree_rest_of_compilation (tree fndecl)
We haven't necessarily assigned RTL to all variables yet, so it's
not safe to try to expand expressions involving them. */
cfun->x_dont_save_pending_sizes_p = 1;
+ cfun->after_inlining = true;
node = cgraph_node (fndecl);
@@ -637,14 +741,13 @@ tree_rest_of_compilation (tree fndecl)
{
struct cgraph_edge *e;
- saved_node = cgraph_clone_node (node);
+ saved_node = cgraph_clone_node (node, node->count, 1);
for (e = saved_node->callees; e; e = e->next_callee)
if (!e->inline_failed)
cgraph_clone_inlined_nodes (e, true);
}
cfun->saved_static_chain_decl = cfun->static_chain_decl;
- cfun->saved_tree = save_body (fndecl, &cfun->saved_args,
- &cfun->saved_static_chain_decl);
+ save_body (fndecl, &cfun->saved_args, &cfun->saved_static_chain_decl);
}
if (flag_inline_trees)
@@ -660,6 +763,16 @@ tree_rest_of_compilation (tree fndecl)
timevar_pop (TV_INTEGRATION);
}
}
+ /* We are not going to maintain the cgraph edges up to date.
+ Kill it so it won't confuse us. */
+ while (node->callees)
+ {
+ /* In non-unit-at-a-time we must mark all referenced functions as needed.
+ */
+ if (node->callees->callee->analyzed && !flag_unit_at_a_time)
+ cgraph_mark_needed_node (node->callees->callee);
+ cgraph_remove_edge (node->callees);
+ }
/* We are not going to maintain the cgraph edges up to date.
Kill it so it won't confuse us. */
@@ -670,8 +783,7 @@ tree_rest_of_compilation (tree fndecl)
bitmap_obstack_initialize (NULL);
bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
- vars_to_rename = BITMAP_ALLOC (NULL);
-
+ tree_register_cfg_hooks ();
/* Perform all tree transforms and optimizations. */
execute_pass_list (all_passes);
@@ -681,12 +793,16 @@ tree_rest_of_compilation (tree fndecl)
bitmap_obstack_release (NULL);
/* Restore original body if still needed. */
- if (cfun->saved_tree)
+ if (cfun->saved_cfg)
{
- DECL_SAVED_TREE (fndecl) = cfun->saved_tree;
DECL_ARGUMENTS (fndecl) = cfun->saved_args;
+ cfun->cfg = cfun->saved_cfg;
+ cfun->eh = cfun->saved_eh;
+ cfun->saved_cfg = NULL;
+ cfun->saved_eh = NULL;
+ cfun->saved_args = NULL_TREE;
cfun->static_chain_decl = cfun->saved_static_chain_decl;
-
+ cfun->saved_static_chain_decl = NULL;
/* When not in unit-at-a-time mode, we must preserve out of line copy
representing node before inlining. Restore original outgoing edges
using clone we created earlier. */
@@ -694,6 +810,7 @@ tree_rest_of_compilation (tree fndecl)
{
struct cgraph_edge *e;
+ node = cgraph_node (current_function_decl);
cgraph_node_remove_callees (node);
node->callees = saved_node->callees;
saved_node->callees = NULL;
@@ -723,10 +840,10 @@ tree_rest_of_compilation (tree fndecl)
= TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));
if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
- warning ("%Jsize of return value of %qD is %u bytes",
+ warning (0, "%Jsize of return value of %qD is %u bytes",
fndecl, fndecl, size_as_int);
else
- warning ("%Jsize of return value of %qD is larger than %wd bytes",
+ warning (0, "%Jsize of return value of %qD is larger than %wd bytes",
fndecl, fndecl, larger_than_size);
}
}