aboutsummaryrefslogtreecommitdiff
path: root/gcc/sel-sched-ir.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-26 17:38:23 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-26 17:38:23 +0000
commitde8ea9631cf1709077dab89c903d713a1d5c9bd7 (patch)
tree3cd2355108309f8f4132894e442ce97c8f9c6aa4 /gcc/sel-sched-ir.h
parentc218f6e89d7bee930ad705642cf069262432990a (diff)
downloadgcc-de8ea9631cf1709077dab89c903d713a1d5c9bd7.zip
gcc-de8ea9631cf1709077dab89c903d713a1d5c9bd7.tar.gz
gcc-de8ea9631cf1709077dab89c903d713a1d5c9bd7.tar.bz2
sel-sched-ir.h: Make ilist_t work on insn_t rather than rtx
gcc/ * sel-sched-ir.h (ilist_t): Redefine this typedef in terms of ilist_t, not _xlist_t; (ILIST_INSN): Define in terms of new union field "insn". (ILIST_NEXT): Define in terms of _LIST_NEXT rather than _XLIST_NEXT. (struct _list_node): Add new field "insn" to the union, of type insn_t. (ilist_add): Replace macro with an inline function, requiring an insn_t. (ilist_remove): Define this macro directly in terms of _list_remove, rather than indirectly via _xlist_remove. (ilist_clear): Likewise, in terms of _list_clear rather than _xlist_clear. (ilist_is_in_p): Replace macro with an inline function, requiring an insn_t. (_list_iter_cond_insn): New function. (ilist_iter_remove): Define this macro directly in terms of _list_iter_remove, rather than indirectly via _xlist_iter_remove. (ilist_iterator): Define directly in terms of _list_iterator rather than indirectly through _xlist_iterator. (FOR_EACH_INSN): Define in terms of _list_iter_cond_insn rather than in terms of _FOR_EACH_X. (FOR_EACH_INSN_1): Likewise. From-SVN: r214527
Diffstat (limited to 'gcc/sel-sched-ir.h')
-rw-r--r--gcc/sel-sched-ir.h56
1 files changed, 44 insertions, 12 deletions
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 2af7f03..abff203 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -63,9 +63,9 @@ typedef _list_t _xlist_t;
typedef rtx insn_t;
/* List of insns. */
-typedef _xlist_t ilist_t;
-#define ILIST_INSN(L) (_XLIST_X (L))
-#define ILIST_NEXT(L) (_XLIST_NEXT (L))
+typedef _list_t ilist_t;
+#define ILIST_INSN(L) ((L)->u.insn)
+#define ILIST_NEXT(L) (_LIST_NEXT (L))
/* This lists possible transformations that done locally, i.e. in
moveup_expr. */
@@ -353,6 +353,7 @@ struct _list_node
union
{
rtx x;
+ insn_t insn;
struct _bnd bnd;
expr_def expr;
struct _fence fence;
@@ -511,17 +512,48 @@ typedef _list_iterator _xlist_iterator;
#define _FOR_EACH_X_1(X, I, LP) _FOR_EACH_1 (x, (X), (I), (LP))
-/* ilist_t functions. Instruction lists are simply RTX lists. */
+/* ilist_t functions. */
-#define ilist_add(LP, INSN) (_xlist_add ((LP), (INSN)))
-#define ilist_remove(LP) (_xlist_remove (LP))
-#define ilist_clear(LP) (_xlist_clear (LP))
-#define ilist_is_in_p(L, INSN) (_xlist_is_in_p ((L), (INSN)))
-#define ilist_iter_remove(IP) (_xlist_iter_remove (IP))
+static inline void
+ilist_add (ilist_t *lp, insn_t insn)
+{
+ _list_add (lp);
+ ILIST_INSN (*lp) = insn;
+}
+#define ilist_remove(LP) (_list_remove (LP))
+#define ilist_clear(LP) (_list_clear (LP))
+
+static inline bool
+ilist_is_in_p (ilist_t l, insn_t insn)
+{
+ while (l)
+ {
+ if (ILIST_INSN (l) == insn)
+ return true;
+ l = ILIST_NEXT (l);
+ }
+
+ return false;
+}
+
+/* Used through _FOR_EACH. */
+static inline bool
+_list_iter_cond_insn (ilist_t l, insn_t *ip)
+{
+ if (l)
+ {
+ *ip = ILIST_INSN (l);
+ return true;
+ }
+
+ return false;
+}
+
+#define ilist_iter_remove(IP) (_list_iter_remove (IP))
-typedef _xlist_iterator ilist_iterator;
-#define FOR_EACH_INSN(INSN, I, L) _FOR_EACH_X (INSN, I, L)
-#define FOR_EACH_INSN_1(INSN, I, LP) _FOR_EACH_X_1 (INSN, I, LP)
+typedef _list_iterator ilist_iterator;
+#define FOR_EACH_INSN(INSN, I, L) _FOR_EACH (insn, (INSN), (I), (L))
+#define FOR_EACH_INSN_1(INSN, I, LP) _FOR_EACH_1 (insn, (INSN), (I), (LP))
/* Av set iterators. */