This is the mail archive of the gcc@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: reload_combine vs. exceptions


Eric Botcazou <ebotcazou@adacore.com> writes:

>> JUMP_INSNs already invalidate the register use information.  The problem
>> is that CALL_INSNs that can throw don't.
>
> Sure, that's precisely what I was suggesting to change, like in rev 162301.

Ahh, you mean something like this?  (Fixes the testcase, but not
properly tested yet.)

Andreas.

2010-11-15  Andreas Schwab  <schwab@redhat.com>

	* postreload.c (reload_combine): Invalidate register use
	information on all control flow insns.

diff --git a/gcc/postreload.c b/gcc/postreload.c
index 1fc9bfc..3b20d6e 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1320,7 +1320,24 @@ reload_combine (void)
 
       note_stores (PATTERN (insn), reload_combine_note_store, NULL);
 
-      if (CALL_P (insn))
+      if (control_flow_insn_p (insn)
+	  && GET_CODE (PATTERN (insn)) != RETURN)
+	{
+	  /* Non-spill registers might be used at the call destination in
+	     some unknown fashion, so we have to mark the unknown use.  */
+	  HARD_REG_SET *live;
+
+	  if ((condjump_p (insn) || condjump_in_parallel_p (insn))
+	      && JUMP_LABEL (insn))
+	    live = &LABEL_LIVE (JUMP_LABEL (insn));
+	  else
+	    live = &ever_live_at_start;
+
+	  for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; --i)
+	    if (TEST_HARD_REG_BIT (*live, i))
+	      reg_state[i].use_index = -1;
+	}
+      else if (CALL_P (insn))
 	{
 	  rtx link;
 
@@ -1354,23 +1371,6 @@ reload_combine (void)
 	     }
 
 	}
-      else if (JUMP_P (insn)
-	       && GET_CODE (PATTERN (insn)) != RETURN)
-	{
-	  /* Non-spill registers might be used at the call destination in
-	     some unknown fashion, so we have to mark the unknown use.  */
-	  HARD_REG_SET *live;
-
-	  if ((condjump_p (insn) || condjump_in_parallel_p (insn))
-	      && JUMP_LABEL (insn))
-	    live = &LABEL_LIVE (JUMP_LABEL (insn));
-	  else
-	    live = &ever_live_at_start;
-
-	  for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; --i)
-	    if (TEST_HARD_REG_BIT (*live, i))
-	      reg_state[i].use_index = -1;
-	}
 
       reload_combine_note_use (&PATTERN (insn), insn,
 			       reload_combine_ruid, NULL_RTX);

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


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