]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dbr: Filter-out TARGET_FLAGS_REGNUM from end_of_function_needs.
authorHans-Peter Nilsson <hp@axis.com>
Mon, 10 Feb 2020 03:03:43 +0000 (04:03 +0100)
committerHans-Peter Nilsson <hp@axis.com>
Sat, 9 May 2020 00:51:48 +0000 (02:51 +0200)
Compared to the cc0 version, I noticed a regression in
delay-slot-filling for CRIS for several functions in libgcc with
a similar layout, one being lshrdi3, where with cc0 all
delay-slots were filled, as exposed by the test-case in
gcc.target/cris/pr93372-1.c.

There's one slot that fails to be filled for the decc0rated CRIS
port.  A gdb session shows it is because of the automatic
inclusion of TARGET_FLAGS_REGNUM in "registers needed at the end
of the function" because there are insns in the epilogue that
clobber the condition-code register.  I'm not trying to tell a
clobber from a set, as parallels with set instead of clobber
seems likely to happen too, for targets with TARGET_FLAGS_REGNUM
set.

Other targets with delay-slots and one dedicated often-clobbered
condition-code-register should consider defining
TARGET_FLAGS_REGNUM.  I noticed it improved delay-slot-filling
also in other situations than this.

(Previously approved by Jeff Law.)

gcc:
* resource.c (init_resource_info): Filter-out TARGET_FLAGS_REGNUM
from end_of_function_needs.

gcc/ChangeLog
gcc/resource.c

index 75cc642b5a04372feb9616db6c4450d692cf170c..39330ba0515b7e6ad65ba9848e4eac97cff9b42d 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-09  Hans-Peter Nilsson  <hp@axis.com>
+
+       * resource.c (init_resource_info): Filter-out TARGET_FLAGS_REGNUM
+       from end_of_function_needs.
+
 2020-05-08  Vladimir Makarov  <vmakarov@redhat.com>
 
        * ira-color.c (update_costs_from_allocno): Remove
index 32faa73fd5fa72cebfc7c3d3687164ca450a6a3a..0a9d5943abce3e549f388f7605403878a8af0da3 100644 (file)
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
+#include "target.h"
 #include "rtl.h"
 #include "df.h"
 #include "memmodel.h"
@@ -1215,6 +1216,11 @@ init_resource_info (rtx_insn *epilogue_insn)
        break;
     }
 
+  /* Filter-out the flags register from those additionally required
+     registers. */
+  if (targetm.flags_regnum != INVALID_REGNUM)
+    CLEAR_HARD_REG_BIT (end_of_function_needs.regs, targetm.flags_regnum);
+
   /* Allocate and initialize the tables used by mark_target_live_regs.  */
   target_hash_table = XCNEWVEC (struct target_info *, TARGET_HASH_PRIME);
   bb_ticks = XCNEWVEC (int, last_basic_block_for_fn (cfun));