diff mbox

[042/236] try_split returns an rtx_insn

Message ID 1407345815-14551-43-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Aug. 6, 2014, 5:20 p.m. UTC
gcc/
	* rtl.h (try_split): Strengthen return type from rtx to rtx_insn *.

	* emit-rtl.c (try_split): Likewise, also for locals "before" and
	"after".  For now, don't strengthen param "trial", which requires
	adding checked casts when returning it.
---
 gcc/emit-rtl.c | 12 ++++++------
 gcc/rtl.h      |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Jeff Law Aug. 13, 2014, 6:06 p.m. UTC | #1
On 08/06/14 11:20, David Malcolm wrote:
> gcc/
> 	* rtl.h (try_split): Strengthen return type from rtx to rtx_insn *.
>
> 	* emit-rtl.c (try_split): Likewise, also for locals "before" and
> 	"after".  For now, don't strengthen param "trial", which requires
> 	adding checked casts when returning it.
OK.
Jeff
David Malcolm Aug. 21, 2014, 8:51 a.m. UTC | #2
On Wed, 2014-08-13 at 12:06 -0600, Jeff Law wrote:
> On 08/06/14 11:20, David Malcolm wrote:
> > gcc/
> > 	* rtl.h (try_split): Strengthen return type from rtx to rtx_insn *.
> >
> > 	* emit-rtl.c (try_split): Likewise, also for locals "before" and
> > 	"after".  For now, don't strengthen param "trial", which requires
> > 	adding checked casts when returning it.
> OK.

Thanks; committed to trunk as r214260.
diff mbox

Patch

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index b64b276..05b787b 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3538,11 +3538,11 @@  mark_label_nuses (rtx x)
    replacement insn depending on the value of LAST.  Otherwise, it
    returns TRIAL.  If the insn to be returned can be split, it will be.  */
 
-rtx
+rtx_insn *
 try_split (rtx pat, rtx trial, int last)
 {
-  rtx before = PREV_INSN (trial);
-  rtx after = NEXT_INSN (trial);
+  rtx_insn *before = PREV_INSN (trial);
+  rtx_insn *after = NEXT_INSN (trial);
   int has_barrier = 0;
   rtx note, seq, tem;
   int probability;
@@ -3552,7 +3552,7 @@  try_split (rtx pat, rtx trial, int last)
 
   /* We're not good at redistributing frame information.  */
   if (RTX_FRAME_RELATED_P (trial))
-    return trial;
+    return as_a <rtx_insn *> (trial);
 
   if (any_condjump_p (trial)
       && (note = find_reg_note (trial, REG_BR_PROB, 0)))
@@ -3572,7 +3572,7 @@  try_split (rtx pat, rtx trial, int last)
     }
 
   if (!seq)
-    return trial;
+    return as_a <rtx_insn *> (trial);
 
   /* Avoid infinite loop if any insn of the result matches
      the original pattern.  */
@@ -3581,7 +3581,7 @@  try_split (rtx pat, rtx trial, int last)
     {
       if (INSN_P (insn_last)
 	  && rtx_equal_p (PATTERN (insn_last), pat))
-	return trial;
+	return as_a <rtx_insn *> (trial);
       if (!NEXT_INSN (insn_last))
 	break;
       insn_last = NEXT_INSN (insn_last);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index a97a81e..f28a62a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2442,7 +2442,7 @@  extern rtx delete_related_insns (rtx);
 extern rtx *find_constant_term_loc (rtx *);
 
 /* In emit-rtl.c  */
-extern rtx try_split (rtx, rtx, int);
+extern rtx_insn *try_split (rtx, rtx, int);
 extern int split_branch_probability;
 
 /* In unknown file  */