Re: [PATCH 020/236] Return rtx_insn from get_insns/get_last_insn

2014-08-19 Thread David Malcolm
On Tue, 2014-08-12 at 16:01 -0600, Jeff Law wrote:
 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.

Thanks; fixed up uses of as_a_nullable to safe_as_a, and committed to
trunk as r214180, having verified
bootstrapregrtest on x86_64-unknown-linux-gnu (Fedora 20) albeit in
combination with patches 9-29, and verified that it builds standalone
with 10 targets.

Am attaching what I committed.


Index: gcc/ChangeLog
===
--- gcc/ChangeLog	(revision 214179)
+++ gcc/ChangeLog	(revision 214180)
@@ -1,5 +1,11 @@
 2014-08-19  David Malcolm  dmalc...@redhat.com
 
+	* emit-rtl.h (get_insns): Strengthen return type from rtx to
+	rtx_insn *, adding a checked cast for now.
+	(get_last_insn): Likewise.
+
+2014-08-19  David Malcolm  dmalc...@redhat.com
+
 	* rtl.h (gen_label_rtx): Strengthen return type from rtx to
 	rtx_code_label *.
 
Index: gcc/emit-rtl.h
===
--- gcc/emit-rtl.h	(revision 214179)
+++ gcc/emit-rtl.h	(revision 214180)
@@ -77,10 +77,11 @@
 
 /* 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 safe_as_a rtx_insn * (insn);
 }
 
 /* Specify a new insn as the first in the chain.  */
@@ -94,10 +95,11 @@
 
 /* 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 safe_as_a rtx_insn * (insn);
 }
 
 /* Specify a new insn as the last in the chain.  */


Re: [PATCH 020/236] Return rtx_insn from get_insns/get_last_insn

2014-08-12 Thread Jeff Law

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



[PATCH 020/236] Return rtx_insn from get_insns/get_last_insn

2014-08-06 Thread David Malcolm
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(-)

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.  */
-- 
1.8.5.3