diff mbox

[020/236] Return rtx_insn from get_insns/get_last_insn

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

Commit Message

David Malcolm Aug. 6, 2014, 5:19 p.m. UTC
Ultimately, the underlying fields should become rtx_insn *, but for now we
can do this with a checked cast.

Note to self:
  config/m32c/m32c.c: m32c_leaf_function_p directly manipulates
  x_first_insn and x_last_insn, using sequence_stack.

gcc/
	* emit-rtl.h (get_insns): Strengthen return type from rtx to
	rtx_insn *, adding a checked cast for now.
	(get_last_insn): Likewise.
---
 gcc/emit-rtl.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Jeff Law Aug. 12, 2014, 10:01 p.m. UTC | #1
On 08/06/14 11:19, David Malcolm wrote:
> Ultimately, the underlying fields should become rtx_insn *, but for now we
> can do this with a checked cast.
>
> Note to self:
>    config/m32c/m32c.c: m32c_leaf_function_p directly manipulates
>    x_first_insn and x_last_insn, using sequence_stack.
>
> gcc/
> 	* emit-rtl.h (get_insns): Strengthen return type from rtx to
> 	rtx_insn *, adding a checked cast for now.
> 	(get_last_insn): Likewise.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index c72c24f..f97ac49 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -74,10 +74,11 @@  extern bool need_atomic_barrier_p (enum memmodel, bool);
 
 /* Return the first insn of the current sequence or current function.  */
 
-static inline rtx
+static inline rtx_insn *
 get_insns (void)
 {
-  return crtl->emit.x_first_insn;
+  rtx insn = crtl->emit.x_first_insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Specify a new insn as the first in the chain.  */
@@ -91,10 +92,11 @@  set_first_insn (rtx insn)
 
 /* Return the last insn emitted in current sequence or current function.  */
 
-static inline rtx
+static inline rtx_insn *
 get_last_insn (void)
 {
-  return crtl->emit.x_last_insn;
+  rtx insn = crtl->emit.x_last_insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Specify a new insn as the last in the chain.  */