public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [13/32] Remove global call sets: DF (EH edges)
Date: Wed, 11 Sep 2019 19:10:00 -0000	[thread overview]
Message-ID: <mpty2yuwsxj.fsf@arm.com> (raw)
In-Reply-To: <mptimpyzmf1.fsf@arm.com> (Richard Sandiford's message of "Wed,	11 Sep 2019 20:02:26 +0100")

The DF dense_invalidated_by_call and sparse_invalidated_by_call
sets are actually only used on EH edges, and so are more the set
of registers that are invalidated by a taken EH edge.  Under the
new order, that means that they describe eh_edge_abi.


2019-09-11  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* df-problems.c: Include regs.h and function-abi.h.
	(df_rd_problem_data): Rename sparse_invalidated_by_call to
	sparse_invalidated_by_eh and dense_invalidated_by_call to
	dense_invalidated_by_eh.
	(df_print_bb_index): Update accordingly.
	(df_rd_alloc, df_rd_start_dump, df_rd_confluence_n): Likewise.
	(df_lr_confluence_n): Use eh_edge_abi to get the set of registers
	that are clobbered by an EH edge.  Clobber partially-clobbered
	registers as well as fully-clobbered ones.
	(df_md_confluence_n): Likewise.
	(df_rd_local_compute): Likewise.  Update for changes to
	df_rd_problem_data.
	* df-scan.c (df_scan_start_dump): Use eh_edge_abi to get the set
	of registers that are clobbered by an EH edge.  Includde partially-
	clobbered registers as well as fully-clobbered ones.

Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c	2019-09-09 19:01:48.423021426 +0100
+++ gcc/df-problems.c	2019-09-11 19:48:07.405959747 +0100
@@ -36,6 +36,8 @@ Software Foundation; either version 3, o
 #include "valtrack.h"
 #include "dumpfile.h"
 #include "rtl-iter.h"
+#include "regs.h"
+#include "function-abi.h"
 
 /* Note that turning REG_DEAD_DEBUGGING on will cause
    gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints
@@ -139,18 +141,17 @@ df_print_bb_index (basic_block bb, FILE
    these along with the bitmap_clear_range call to remove ranges of
    bits without actually generating a knockout vector.
 
-   The kill and sparse_kill and the dense_invalidated_by_call and
-   sparse_invalidated_by_call both play this game.  */
+   The kill and sparse_kill and the dense_invalidated_by_eh and
+   sparse_invalidated_by_eh both play this game.  */
 
 /* Private data used to compute the solution for this problem.  These
    data structures are not accessible outside of this module.  */
 class df_rd_problem_data
 {
 public:
-  /* The set of defs to regs invalidated by call.  */
-  bitmap_head sparse_invalidated_by_call;
-  /* The set of defs to regs invalidate by call for rd.  */
-  bitmap_head dense_invalidated_by_call;
+  /* The set of defs to regs invalidated by EH edges.  */
+  bitmap_head sparse_invalidated_by_eh;
+  bitmap_head dense_invalidated_by_eh;
   /* An obstack for the bitmaps we need for this problem.  */
   bitmap_obstack rd_bitmaps;
 };
@@ -187,8 +188,8 @@ df_rd_alloc (bitmap all_blocks)
   if (df_rd->problem_data)
     {
       problem_data = (class df_rd_problem_data *) df_rd->problem_data;
-      bitmap_clear (&problem_data->sparse_invalidated_by_call);
-      bitmap_clear (&problem_data->dense_invalidated_by_call);
+      bitmap_clear (&problem_data->sparse_invalidated_by_eh);
+      bitmap_clear (&problem_data->dense_invalidated_by_eh);
     }
   else
     {
@@ -196,9 +197,9 @@ df_rd_alloc (bitmap all_blocks)
       df_rd->problem_data = problem_data;
 
       bitmap_obstack_initialize (&problem_data->rd_bitmaps);
-      bitmap_initialize (&problem_data->sparse_invalidated_by_call,
+      bitmap_initialize (&problem_data->sparse_invalidated_by_eh,
 			 &problem_data->rd_bitmaps);
-      bitmap_initialize (&problem_data->dense_invalidated_by_call,
+      bitmap_initialize (&problem_data->dense_invalidated_by_eh,
 			 &problem_data->rd_bitmaps);
     }
 
@@ -391,8 +392,8 @@ df_rd_local_compute (bitmap all_blocks)
   bitmap_iterator bi;
   class df_rd_problem_data *problem_data
     = (class df_rd_problem_data *) df_rd->problem_data;
-  bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call;
-  bitmap dense_invalidated = &problem_data->dense_invalidated_by_call;
+  bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_eh;
+  bitmap dense_invalidated = &problem_data->dense_invalidated_by_eh;
 
   bitmap_initialize (&seen_in_block, &df_bitmap_obstack);
   bitmap_initialize (&seen_in_insn, &df_bitmap_obstack);
@@ -404,10 +405,13 @@ df_rd_local_compute (bitmap all_blocks)
       df_rd_bb_local_compute (bb_index);
     }
 
-  /* Set up the knockout bit vectors to be applied across EH_EDGES.  */
+  /* Set up the knockout bit vectors to be applied across EH_EDGES.
+     Conservatively treat partially-clobbered registers as surviving
+     across the EH edge, i.e. assume that definitions before the edge
+     is taken *might* reach uses after it has been taken.  */
   if (!(df->changeable_flags & DF_NO_HARD_REGS))
     for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
-      if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
+      if (eh_edge_abi.clobbers_full_reg_p (regno))
 	{
 	  if (DF_DEFS_COUNT (regno) > DF_SPARSE_THRESHOLD)
 	    bitmap_set_bit (sparse_invalidated, regno);
@@ -455,8 +459,8 @@ df_rd_confluence_n (edge e)
     {
       class df_rd_problem_data *problem_data
 	= (class df_rd_problem_data *) df_rd->problem_data;
-      bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call;
-      bitmap dense_invalidated = &problem_data->dense_invalidated_by_call;
+      bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_eh;
+      bitmap dense_invalidated = &problem_data->dense_invalidated_by_eh;
       bitmap_iterator bi;
       unsigned int regno;
 
@@ -579,9 +583,9 @@ df_rd_start_dump (FILE *file)
   fprintf (file, ";; Reaching defs:\n");
 
   fprintf (file, ";;  sparse invalidated \t");
-  dump_bitmap (file, &problem_data->sparse_invalidated_by_call);
+  dump_bitmap (file, &problem_data->sparse_invalidated_by_eh);
   fprintf (file, ";;  dense invalidated \t");
-  dump_bitmap (file, &problem_data->dense_invalidated_by_call);
+  dump_bitmap (file, &problem_data->dense_invalidated_by_eh);
 
   fprintf (file, ";;  reg->defs[] map:\t");
   for (regno = 0; regno < m; regno++)
@@ -976,12 +980,15 @@ df_lr_confluence_n (edge e)
   bitmap op2 = &df_lr_get_bb_info (e->dest->index)->in;
   bool changed = false;
 
-  /* Call-clobbered registers die across exception and call edges.  */
+  /* Call-clobbered registers die across exception and call edges.
+     Conservatively treat partially-clobbered registers as surviving
+     across the edges; they might or might not, depending on what
+     mode they have.  */
   /* ??? Abnormal call edges ignored for the moment, as this gets
      confused by sibling call edges, which crashes reg-stack.  */
   if (e->flags & EDGE_EH)
     {
-      bitmap_view<HARD_REG_SET> eh_kills (regs_invalidated_by_call);
+      bitmap_view<HARD_REG_SET> eh_kills (eh_edge_abi.full_reg_clobbers ());
       changed = bitmap_ior_and_compl_into (op1, op2, eh_kills);
     }
   else
@@ -4636,7 +4643,10 @@ df_md_confluence_n (edge e)
 
   if (e->flags & EDGE_EH)
     {
-      bitmap_view<HARD_REG_SET> eh_kills (regs_invalidated_by_call);
+      /* Conservatively treat partially-clobbered registers as surviving
+	 across the edge; they might or might not, depending on what mode
+	 they have.  */
+      bitmap_view<HARD_REG_SET> eh_kills (eh_edge_abi.full_reg_clobbers ());
       return bitmap_ior_and_compl_into (op1, op2, eh_kills);
     }
   else
Index: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c	2019-09-11 19:47:24.410262730 +0100
+++ gcc/df-scan.c	2019-09-11 19:48:07.405959747 +0100
@@ -312,8 +312,9 @@ df_scan_start_dump (FILE *file ATTRIBUTE
   basic_block bb;
   rtx_insn *insn;
 
-  fprintf (file, ";;  invalidated by call \t");
-  df_print_regset (file, bitmap_view<HARD_REG_SET> (regs_invalidated_by_call));
+  fprintf (file, ";;  fully invalidated by EH \t");
+  df_print_regset
+    (file, bitmap_view<HARD_REG_SET> (eh_edge_abi.full_reg_clobbers ()));
   fprintf (file, ";;  hardware regs used \t");
   df_print_regset (file, &df->hardware_regs_used);
   fprintf (file, ";;  regular block artificial uses \t");

  parent reply	other threads:[~2019-09-11 19:10 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 19:02 [00/32] Support multiple ABIs in the same translation unit Richard Sandiford
2019-09-11 19:03 ` [02/32] Add a target hook for getting an ABI from a function type Richard Sandiford
2019-09-29 20:52   ` Jeff Law
2019-09-11 19:03 ` [01/32] Add function_abi.{h,cc} Richard Sandiford
2019-09-29 20:51   ` Jeff Law
2019-09-30  9:19     ` Richard Sandiford
2019-09-30 21:16       ` Jeff Law
2019-09-11 19:04 ` [03/32] Add a function for getting the ABI of a call insn target Richard Sandiford
2019-09-25 15:38   ` Richard Sandiford
2019-09-30 15:52     ` Jeff Law
2019-09-30 16:32       ` Richard Sandiford
2019-09-30 16:46         ` Jeff Law
2019-09-11 19:05 ` [04/32] [x86] Robustify vzeroupper handling across calls Richard Sandiford
2019-09-25 15:48   ` Richard Sandiford
2019-09-25 18:11     ` Uros Bizjak
2019-10-01 10:14     ` Uros Bizjak
2019-10-08 18:17       ` Uros Bizjak
2019-09-11 19:05 ` [05/32] Pass an ABI identifier to hard_regno_call_part_clobbered Richard Sandiford
2019-09-29 20:58   ` Jeff Law
2019-09-11 19:06 ` [06/32] Pass an ABI to choose_hard_reg_mode Richard Sandiford
2019-09-29 21:00   ` Jeff Law
2019-09-11 19:07 ` [08/32] Remove global call sets: cfgcleanup.c Richard Sandiford
2019-09-29 21:02   ` Jeff Law
2019-09-11 19:07 ` [07/32] Remove global call sets: caller-save.c Richard Sandiford
2019-09-29 21:01   ` Jeff Law
2019-09-11 19:08 ` [10/32] Remove global call sets: combine.c Richard Sandiford
2019-09-12  2:18   ` Segher Boessenkool
2019-09-12  7:52     ` Richard Sandiford
2019-09-20  0:43       ` Segher Boessenkool
2019-09-25 15:52         ` Richard Sandiford
2019-09-25 16:30           ` Segher Boessenkool
2019-09-29 22:32           ` Jeff Law
2019-09-29 22:43             ` Segher Boessenkool
2019-09-11 19:08 ` [09/32] Remove global call sets: cfgloopanal.c Richard Sandiford
2019-09-29 21:02   ` Jeff Law
2019-09-11 19:09 ` [11/32] Remove global call sets: cse.c Richard Sandiford
2019-09-25 15:57   ` Richard Sandiford
2019-09-29 21:04     ` Jeff Law
2019-09-30 16:23       ` Richard Sandiford
2019-09-11 19:09 ` [12/32] Remove global call sets: cselib.c Richard Sandiford
2019-09-29 21:05   ` Jeff Law
2019-10-29  9:20     ` Martin Liška
2019-09-11 19:10 ` Richard Sandiford [this message]
2019-09-29 21:07   ` [13/32] Remove global call sets: DF (EH edges) Jeff Law
2019-09-11 19:10 ` [14/32] Remove global call sets: DF (entry/exit defs) Richard Sandiford
2019-09-29 21:07   ` Jeff Law
2019-09-11 19:11 ` [17/32] Remove global call sets: gcse.c Richard Sandiford
2019-09-25 16:04   ` Richard Sandiford
2019-09-29 21:10   ` Jeff Law
2019-09-11 19:11 ` [15/32] Remove global call sets: early-remat.c Richard Sandiford
2019-09-29 21:09   ` Jeff Law
2019-09-11 19:11 ` [16/32] Remove global call sets: function.c Richard Sandiford
2019-09-29 21:10   ` Jeff Law
2019-09-11 19:12 ` [19/32] Remove global call sets: IRA Richard Sandiford
2019-09-30 15:16   ` Jeff Law
2019-09-11 19:12 ` [18/32] Remove global call sets: haifa-sched.c Richard Sandiford
2019-09-29 21:11   ` Jeff Law
2019-09-11 19:13 ` [20/32] Remove global call sets: loop-iv.c Richard Sandiford
2019-09-29 21:20   ` Jeff Law
2019-09-11 19:14 ` [21/32] Remove global call sets: LRA Richard Sandiford
2019-09-30 15:29   ` Jeff Law
2019-10-04 18:03   ` H.J. Lu
2019-10-04 21:52     ` H.J. Lu
2019-10-05 13:33       ` Richard Sandiford
2019-09-11 19:14 ` [23/32] Remove global call sets: postreload-gcse.c Richard Sandiford
2019-09-25 16:08   ` Richard Sandiford
2019-09-29 22:22     ` Jeff Law
2019-09-11 19:14 ` [22/32] Remove global call sets: postreload.c Richard Sandiford
2019-09-29 21:33   ` Jeff Law
2019-09-11 19:15 ` [25/32] Remove global call sets: regcprop.c Richard Sandiford
2019-09-29 21:34   ` Jeff Law
2019-09-11 19:15 ` [24/32] Remove global call sets: recog.c Richard Sandiford
2019-09-29 21:33   ` Jeff Law
2019-09-11 19:16 ` [27/32] Remove global call sets: reload.c Richard Sandiford
2019-09-29 22:26   ` Jeff Law
2019-09-11 19:16 ` [26/32] Remove global call sets: regrename.c Richard Sandiford
2019-09-29 22:25   ` Jeff Law
2019-09-11 19:17 ` [00/32] Remove global call sets: rtlanal.c Richard Sandiford
2019-09-29 22:21   ` Jeff Law
2019-09-11 19:17 ` [29/32] Remove global call sets: sched-deps.c Richard Sandiford
2019-09-29 22:20   ` Jeff Law
2019-10-04 14:32     ` Christophe Lyon
2019-10-04 14:35       ` Richard Sandiford
2019-10-04 14:37         ` Christophe Lyon
2019-10-07 13:29         ` Christophe Lyon
2019-09-11 19:18 ` [31/32] Remove global call sets: shrink-wrap.c Richard Sandiford
2019-09-29 22:21   ` Jeff Law
2019-09-11 19:18 ` [30/32] Remove global call sets: sel-sched.c Richard Sandiford
2019-09-30 15:08   ` Jeff Law
2019-09-11 19:19 ` [32/32] Hide regs_invalidated_by_call etc Richard Sandiford
2019-09-29 22:22   ` Jeff Law
2019-09-12 20:42 ` [00/32] Support multiple ABIs in the same translation unit Steven Bosscher
2019-09-26 19:24 ` Dimitar Dimitrov
2019-09-27  8:58   ` Richard Sandiford
2019-10-01  2:09 ` build-failure for cris-elf with "[00/32] Support multiple ABIs in the same translation unit" Hans-Peter Nilsson
2019-10-01  7:51   ` Richard Sandiford
2019-10-01 10:58     ` Hans-Peter Nilsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mpty2yuwsxj.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).