https://gcc.gnu.org/g:438381ef759ee8b5b04c5723a8334354ba2a30e5

commit r15-3447-g438381ef759ee8b5b04c5723a8334354ba2a30e5
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Fri Jun 28 16:04:18 2024 +0200

    Document 'pass_postreload' vs. 'pass_late_compilation'
    
    See Subversion r217124 (Git commit 433e4164339f18d0b8798968444a56b681b5232c)
    "Reorganize post-ra pipeline for targets without register allocation".
    
            gcc/
            * passes.cc: Document 'pass_postreload' vs. 'pass_late_compilation'.
            * passes.def: Likewise.

Diff:
---
 gcc/passes.cc  | 14 +++++++++++++-
 gcc/passes.def |  3 +++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/passes.cc b/gcc/passes.cc
index 057850f4dec..e2a07ebedf5 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 b06d6d45f63..6d98c3c9282 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);

Reply via email to