diff --git a/gcc/passes.cc b/gcc/passes.cc index 057850f4decbc7d4a6f805b9efe49d4feb910d65..e2a07ebedf5d82191197ca9e3865edefe6a68208 100644 --- a/gcc/passes.cc +++ b/gcc/passes.cc @@ -660,6 +660,10 @@ make_pass_rest_of_compilation (gcc::context *ctxt) namespace { +/* A container pass (only) for '!targetm.no_register_allocation' targets, for + passes to run if reload completed (..., but not run them if it failed, for + example for an invalid 'asm'). See also 'pass_late_compilation'. */ + const pass_data pass_data_postreload = { RTL_PASS, /* type */ @@ -681,7 +685,12 @@ public: {} /* opt_pass methods: */ - bool gate (function *) final override { return reload_completed; } + bool gate (function *) final override + { + if (reload_completed) + gcc_checking_assert (!targetm.no_register_allocation); + return reload_completed; + } }; // class pass_postreload @@ -695,6 +704,9 @@ make_pass_postreload (gcc::context *ctxt) namespace { +/* A container pass like 'pass_postreload', but for passes to run also for + 'targetm.no_register_allocation' targets. */ + const pass_data pass_data_late_compilation = { RTL_PASS, /* type */ diff --git a/gcc/passes.def b/gcc/passes.def index b06d6d45f63187bd1b461ae2d9153a136b201677..6d98c3c9282a2518c7a30d695d5d64462d986190 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -509,6 +509,9 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_early_remat); NEXT_PASS (pass_ira); NEXT_PASS (pass_reload); + /* In the following, some passes are tied to 'pass_postreload' and others + to 'pass_late_compilation'. The difference is that the latter also + run for 'targetm.no_register_allocation' targets. */ NEXT_PASS (pass_postreload); PUSH_INSERT_PASSES_WITHIN (pass_postreload) NEXT_PASS (pass_postreload_cse);