From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30780 invoked by alias); 6 Aug 2014 17:44:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 30730 invoked by uid 89); 6 Aug 2014 17:44:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 06 Aug 2014 17:44:16 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF4uG-0001il-SI for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:21:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11330) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF4uG-0001iY-KY for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:21:44 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76HKg2Q024668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 13:20:43 -0400 Received: from c64.redhat.com (vpn-239-139.phx2.redhat.com [10.3.239.139]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76HJ2qS030913; Wed, 6 Aug 2014 13:20:42 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 172/236] sel-sched-ir.h: Make ilist_t work on insn_t rather than rtx Date: Wed, 06 Aug 2014 17:44:00 -0000 Message-Id: <1407345815-14551-173-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> References: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00689.txt.bz2 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. --- gcc/sel-sched-ir.h | 56 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file 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. */ -- 1.8.5.3