This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: regrename speedup


[Sorry for the delay]

> Ah.  That looks a little buggy actually in the old version.  Nevermind,
> here's a new set of patches.

rr-full2.diff is OK for mainline modulo the following nits:

+  int i;
+  du_head_p ptr;
+  for (i = 0; VEC_iterate(du_head_p, id_to_chain, i, ptr); i++)
+    {
+      bitmap_clear (&ptr->conflicts);
+    }

Superfluous parentheses.


 /* For a def-use chain HEAD in basic block B, find which registers overlap
    its lifetime and set the corresponding bits in *PSET.  */
 
 static void
-merge_overlapping_regs (basic_block b, HARD_REG_SET *pset,
-			struct du_head *head)
+merge_overlapping_regs (HARD_REG_SET *pset, struct du_head *head)

"in basic block B" needs to be removed from the comment as well.


+/* Walk all chains starting with CHAINS and record that they conflict with
+   another chains whose id is ID.  */
+static void
+mark_conflict (struct du_head *chains, unsigned id)
+{
+  while (chains)
+    {
+      bitmap_set_bit (&chains->conflicts, id);
+      chains = chains->next_chain;
+    }
 }

Missing blank line after comment.  "Another chain whose".


+/* True if we found a register with a size mismatch that means we can't
+   track its lifetime accurately.  If so, we abort the current block
+   without renaming.  */
+static bool fail_current_block;

"size mismatch, which means that we can't"


+/* Conflict bitmaps, tracking the live chains and the live hard registers.  
*/
+static bitmap_head live_chains;
+static HARD_REG_SET live_hard_regs;

Rename "live_chains" into "open_chains_id" and make it clear in the comment 
that it's equivalent to open_chains.


+/* Called through note_stores.  DATA points to a rtx_code, either SET or
+   CLOBBER, which tells us which kind of rtx to look at.  If we have a
+   match, record the set register in live_hard_regs.  */

"... and in the hard_conflicts bitmap of the open chains".


+  enum rtx_code *pcode = (enum rtx_code *)data;
+  struct du_head *chain;
+
+  if (GET_CODE (x) == SUBREG)
+    x = SUBREG_REG (x);
+  if (!REG_P (x) || GET_CODE (set) != *pcode)
+    return;

   enum rtx_code pcode = *(enum rtx_code *)data;
   struct du_head *chain;

   if (GET_CODE (x) == SUBREG)
     x = SUBREG_REG (x);
   if (!REG_P (x) || GET_CODE (set) != pcode)
     return;

saves one '*'. :-)


+	  if (cl == NO_REGS || (!exact_match && !DEBUG_INSN_P (insn)))
 	    {
-	      p = &head->next_chain;
-	      continue;
+	      if (dump_file)
+		fprintf (dump_file,
+			 "Marking chain %s (%d) at insn %d (%s) as non-renamable\n",
+			 reg_names[head->regno], head->id, INSN_UID (insn),
+			 scan_actions_name[(int) action]);
+	      head->cannot_rename = 1;
 	    }

"non-renamable" doesn't sound too English.  What about

	  if (cl == NO_REGS || (!exact_match && !DEBUG_INSN_P (insn)))
	    {
	      if (dump_file)
		fprintf (dump_file,
			 "Cannot rename chain %s (%d) at insn %d (%s)\n",
			 reg_names[head->regno], head->id, INSN_UID (insn),
			 scan_actions_name[(int) action]);
	      head->cannot_rename = 1;
	    }

?  This would fix the long line in the process.

Same for

+      else
+	{
+	  head->cannot_rename = 1;
+	  if (dump_file)
+	    fprintf (dump_file,
+		     "Marking chain %s (%d) at insn %d (%s) as non-renamable\n",
+		     reg_names[head->regno], head->id, INSN_UID (insn),
+		     scan_actions_name[(int) action]);
+	  p = &head->next_chain;
 	}


+	  /* Step 2: Mark chains for which we have reads outside operands
+	     as non-renamable.

All the other comments use "unrenamable" so I'd use it there too for the sake 
of consistency.  And ChangeLog has "unrenameable".


 	  /* Step 5: Close open chains that overlap writes.  Similar to
 	     step 2, we hide in-out operands, since we do not want to
-	     close these chains.  */
+	     close these chains.  We also hide earlyclobber operands,
+	     since we've opened chains for them earlier and they couldn't
+	     possibly overlap any input operands anyway.  */

"We also hide earlyclobber operands, since we've opened chains for them in 
step 1 and earlier chains they would overlap with must have been closed at 
the previous insn at the latest, as such operands cannot possibly overlap
with any input operands".


Please commit the 2 patches separately under PR rtl-opt/38582.  TIA.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]