diff mbox

[024/236] last_call_insn returns an rtx_call_insn *

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

Commit Message

David Malcolm Aug. 6, 2014, 5:20 p.m. UTC
gcc/
	* emit-rtl.c (last_call_insn): Strengthen return type from rtx to
	rtx_call_insn *.
	* rtl.h (is_a_helper <rtx_call_insn *>::test): New overload, accepting
	an rtx_insn *.
	(last_call_insn): Strengthen return type from rtx to
	rtx_call_insn *.
---
 gcc/emit-rtl.c |  6 +++---
 gcc/rtl.h      | 10 +++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

Comments

Jeff Law Aug. 13, 2014, 3:52 a.m. UTC | #1
On 08/06/14 11:20, David Malcolm wrote:
> gcc/
> 	* emit-rtl.c (last_call_insn): Strengthen return type from rtx to
> 	rtx_call_insn *.
> 	* rtl.h (is_a_helper <rtx_call_insn *>::test): New overload, accepting
> 	an rtx_insn *.
> 	(last_call_insn): Strengthen return type from rtx to
> 	rtx_call_insn *.
OK.
Jeff
David Malcolm Aug. 19, 2014, 7:31 p.m. UTC | #2
On Tue, 2014-08-12 at 21:52 -0600, Jeff Law wrote:
> On 08/06/14 11:20, David Malcolm wrote:
> > gcc/
> > 	* emit-rtl.c (last_call_insn): Strengthen return type from rtx to
> > 	rtx_call_insn *.
> > 	* rtl.h (is_a_helper <rtx_call_insn *>::test): New overload, accepting
> > 	an rtx_insn *.
> > 	(last_call_insn): Strengthen return type from rtx to
> > 	rtx_call_insn *.
> OK.

Thanks; committed to trunk as r214186 (fixing up as_a_nullable to
safe_as_a).
diff mbox

Patch

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 5175284..39e73a2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3369,17 +3369,17 @@  prev_real_insn (rtx insn)
 /* Return the last CALL_INSN in the current list, or 0 if there is none.
    This routine does not look inside SEQUENCEs.  */
 
-rtx
+rtx_call_insn *
 last_call_insn (void)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   for (insn = get_last_insn ();
        insn && !CALL_P (insn);
        insn = PREV_INSN (insn))
     ;
 
-  return insn;
+  return as_a_nullable <rtx_call_insn *> (insn);
 }
 
 /* Find the next insn after INSN that really does something.  This routine
diff --git a/gcc/rtl.h b/gcc/rtl.h
index e29cda3..85b725a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -753,6 +753,14 @@  is_a_helper <rtx_call_insn *>::test (rtx rt)
 template <>
 template <>
 inline bool
+is_a_helper <rtx_call_insn *>::test (rtx_insn *insn)
+{
+  return CALL_P (insn);
+}
+
+template <>
+template <>
+inline bool
 is_a_helper <rtx_jump_table_data *>::test (rtx rt)
 {
   return JUMP_TABLE_DATA_P (rt);
@@ -2394,7 +2402,7 @@  extern rtx gen_use (rtx);
 extern rtx emit_use (rtx);
 extern rtx make_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
-extern rtx last_call_insn (void);
+extern rtx_call_insn *last_call_insn (void);
 extern rtx_insn *previous_insn (rtx);
 extern rtx_insn *next_insn (rtx);
 extern rtx_insn *prev_nonnote_insn (rtx);