aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-27 19:40:43 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-27 19:40:43 +0000
commitf11723d8cbd8e3f97eb49197aba9a9f5be3a221a (patch)
tree4a4d947a3d59c6c66600b895ba10fbb726e347b1
parentbd59c195f646d74e7a8cffb0cdc5aa31c720eb61 (diff)
downloadgcc-f11723d8cbd8e3f97eb49197aba9a9f5be3a221a.zip
gcc-f11723d8cbd8e3f97eb49197aba9a9f5be3a221a.tar.gz
gcc-f11723d8cbd8e3f97eb49197aba9a9f5be3a221a.tar.bz2
Convert various INSN accessors in rtl.h to inline functions
gcc/ 2014-08-27 David Malcolm <dmalcolm@redhat.com> * rtl.h (INSN_UID): Convert from a macro to a pair of inline functions. Require merely an rtx for now, not an rtx_insn *. (BLOCK_FOR_INSN): Likewise. (INSN_LOCATION): Likewise. (INSN_HAS_LOCATION): Convert from a macro to an inline function. From-SVN: r214586
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/rtl.h38
2 files changed, 40 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 74767ab..eaab05e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2014-08-27 David Malcolm <dmalcolm@redhat.com>
+ * rtl.h (INSN_UID): Convert from a macro to a pair of inline
+ functions. Require merely an rtx for now, not an rtx_insn *.
+ (BLOCK_FOR_INSN): Likewise.
+ (INSN_LOCATION): Likewise.
+ (INSN_HAS_LOCATION): Convert from a macro to an inline function.
+
+2014-08-27 David Malcolm <dmalcolm@redhat.com>
+
* rtl.h (PATTERN): Convert this macro into a pair of inline
functions, for now, requiring const_rtx and rtx.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index fdf1841..cd77d87 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1172,8 +1172,16 @@ extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
/* Holds a unique number for each insn.
These are not necessarily sequentially increasing. */
-#define INSN_UID(INSN) \
- (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
+inline int INSN_UID (const_rtx insn)
+{
+ return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
+ (insn))->u2.insn_uid;
+}
+inline int& INSN_UID (rtx insn)
+{
+ return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
+ (insn))->u2.insn_uid;
+}
/* Chain insns together in sequence. */
@@ -1204,7 +1212,15 @@ inline rtx& SET_NEXT_INSN (rtx insn)
return XEXP (insn, 1);
}
-#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
+inline basic_block BLOCK_FOR_INSN (const_rtx insn)
+{
+ return XBBDEF (insn, 2);
+}
+
+inline basic_block& BLOCK_FOR_INSN (rtx insn)
+{
+ return XBBDEF (insn, 2);
+}
/* The body of an insn. */
inline rtx PATTERN (const_rtx insn)
@@ -1217,10 +1233,20 @@ inline rtx& PATTERN (rtx insn)
return XEXP (insn, 3);
}
-#define INSN_LOCATION(INSN) XUINT (INSN, 4)
+inline unsigned int INSN_LOCATION (const_rtx insn)
+{
+ return XUINT (insn, 4);
+}
+
+inline unsigned int& INSN_LOCATION (rtx insn)
+{
+ return XUINT (insn, 4);
+}
-#define INSN_HAS_LOCATION(INSN) ((LOCATION_LOCUS (INSN_LOCATION (INSN)))\
- != UNKNOWN_LOCATION)
+inline bool INSN_HAS_LOCATION (const_rtx insn)
+{
+ return LOCATION_LOCUS (INSN_LOCATION (insn)) != UNKNOWN_LOCATION;
+}
/* LOCATION of an RTX if relevant. */
#define RTL_LOCATION(X) (INSN_P (X) ? \