From de8ea9631cf1709077dab89c903d713a1d5c9bd7 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 26 Aug 2014 17:38:23 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 26 +++++++++++++++++++++ gcc/sel-sched-ir.h | 56 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93d29a22837..4e0162038d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2014-08-26 David Malcolm + + * 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. + 2014-08-26 Joseph Myers PR target/60606 diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h index 2af7f03b961..abff203e2d5 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. */ -- 2.30.2