aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-19 14:47:55 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-19 14:47:55 +0000
commit6306c300db20a6857e509a440321ec6a33230314 (patch)
tree589ac48e7d95e2fa8ff1134994862a12df1b34c4
parentc77935ee29336399ab6318e912baa174e243654a (diff)
downloadgcc-6306c300db20a6857e509a440321ec6a33230314.zip
gcc-6306c300db20a6857e509a440321ec6a33230314.tar.gz
gcc-6306c300db20a6857e509a440321ec6a33230314.tar.bz2
Replace PREV_INSN et al macros with functions
gcc/ 2014-08-19 David Malcolm <dmalcolm@redhat.com> * rtl.h (PREV_INSN): Convert to an inline function. Strengthen the return type from rtx to rtx_insn *, which will enable various conversions in followup patches. For now this is is done by a checked cast. (NEXT_INSN): Likewise. (SET_PREV_INSN): Convert to an inline function. This is intended for use as an lvalue, and so returns an rtx& to allow in-place modification. (SET_NEXT_INSN): Likewise. From-SVN: r214152
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/rtl.h26
2 files changed, 34 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index baaf05c..d2db5c9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2014-08-19 David Malcolm <dmalcolm@redhat.com>
+
+ * rtl.h (PREV_INSN): Convert to an inline function. Strengthen
+ the return type from rtx to rtx_insn *, which will enable various
+ conversions in followup patches. For now this is is done by a
+ checked cast.
+ (NEXT_INSN): Likewise.
+ (SET_PREV_INSN): Convert to an inline function. This is intended
+ for use as an lvalue, and so returns an rtx& to allow in-place
+ modification.
+ (SET_NEXT_INSN): Likewise.
+
2014-07-08 Mark Wielaard <mjw@redhat.com>
PR debug/59051
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 93bce91..c9a3cb3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -972,15 +972,33 @@ extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
(RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
/* Chain insns together in sequence. */
+
/* For now these are split in two: an rvalue form:
PREV_INSN/NEXT_INSN
and an lvalue form:
SET_NEXT_INSN/SET_PREV_INSN. */
-#define PREV_INSN(INSN) XEXP ((const_rtx)(INSN), 0)
-#define SET_PREV_INSN(INSN) XEXP (INSN, 0)
-#define NEXT_INSN(INSN) XEXP ((const_rtx)(INSN), 1)
-#define SET_NEXT_INSN(INSN) XEXP (INSN, 1)
+inline rtx_insn *PREV_INSN (const_rtx insn)
+{
+ rtx prev = XEXP (insn, 0);
+ return safe_as_a <rtx_insn *> (prev);
+}
+
+inline rtx& SET_PREV_INSN (rtx insn)
+{
+ return XEXP (insn, 0);
+}
+
+inline rtx_insn *NEXT_INSN (const_rtx insn)
+{
+ rtx next = XEXP (insn, 1);
+ return safe_as_a <rtx_insn *> (next);
+}
+
+inline rtx& SET_NEXT_INSN (rtx insn)
+{
+ return XEXP (insn, 1);
+}
#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)