]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
IRA+LRA: Let the backend request to split basic blocks
authorMaciej W. Rozycki <macro@orcam.me.uk>
Sun, 30 Mar 2025 14:24:50 +0000 (15:24 +0100)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Sun, 30 Mar 2025 14:24:50 +0000 (15:24 +0100)
The next change for Alpha will produce extra labels and branches in
reload, which in turn requires basic blocks to be split at completion.
We do this already for functions that can trap, so just extend the
arrangement with a flag for the backend to use whenever it finds it
necessary.

gcc/
* function.h (struct function): Add
`split_basic_blocks_after_reload' member.
* lra.cc (lra): Handle it.
* reload1.cc (reload): Likewise.

gcc/function.h
gcc/lra.cc
gcc/reload1.cc

index e8aa52fc780a65b844bf9f50e4ca94ced13133a6..2260d6704ecc4aa5ac9ccac299d91ba716420a07 100644 (file)
@@ -449,6 +449,9 @@ struct GTY(()) function {
   /* Set for artificial function created for [[assume (cond)]].
      These should be GIMPLE optimized, but not expanded to RTL.  */
   unsigned int assume_function : 1;
+
+  /* Nonzero if reload will have to split basic blocks.  */
+  unsigned int split_basic_blocks_after_reload : 1;
 };
 
 /* Add the decl D to the local_decls list of FUN.  */
index 8c6991751e5cc73df706129560d14343fad5b453..2b3014f160cf251309bbd0c1fbdfe42c26649971 100644 (file)
@@ -2615,8 +2615,10 @@ lra (FILE *f, int verbose)
 
   inserted_p = fixup_abnormal_edges ();
 
-  /* We've possibly turned single trapping insn into multiple ones.  */
-  if (cfun->can_throw_non_call_exceptions)
+  /* Split basic blocks if we've possibly turned single trapping insn
+     into multiple ones or otherwise the backend requested to do so.  */
+  if (cfun->can_throw_non_call_exceptions
+      || cfun->split_basic_blocks_after_reload)
     {
       auto_sbitmap blocks (last_basic_block_for_fn (cfun));
       bitmap_ones (blocks);
index fe4fe58981c9a17cc935f520585f9f599666c892..64ec74e2bf5f24635e48541e38668d3c2b230555 100644 (file)
@@ -1272,8 +1272,10 @@ reload (rtx_insn *first, int global)
 
   inserted = fixup_abnormal_edges ();
 
-  /* We've possibly turned single trapping insn into multiple ones.  */
-  if (cfun->can_throw_non_call_exceptions)
+  /* Split basic blocks if we've possibly turned single trapping insn
+     into multiple ones or otherwise the backend requested to do so.  */
+  if (cfun->can_throw_non_call_exceptions
+      || cfun->split_basic_blocks_after_reload)
     {
       auto_sbitmap blocks (last_basic_block_for_fn (cfun));
       bitmap_ones (blocks);