From patchwork Wed Aug 6 17:19:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 377283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C44F314009C for ; Thu, 7 Aug 2014 04:12:14 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=vwQeEHoRrWT5BbkzwQwANAy02qIXHusjj8aC7184/6Wr9yMxVBif3 +3buKqNdoEDqJfPKHEKB5Q6Hltd+Srd1xchjiBROVlsZHi6Fkfkc3MmmZbvKRf5R wND5KSg4W603nAVaNHQ+qstLzbvV0E00L3+yonDcDgimkBvb48tOSM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=dn8uUJgaCOsbDbNdzvxJJw+ytVI=; b=Fu3G5N6Lokit5e2OLMHV flJTKk+2MG2HJwaCLRSMqp3TwfHdw1covT2YlPdoLB6uX6vdC3UU89axH8CsT3Fa J5swD4pj8qskeffE/mN8RxfSKOgT+9yAISlohEiOiVEzaCq0CWq4DA0bAIr3O+C6 2R6yCTOtKvuihkfLlG2vpzM= Received: (qmail 31842 invoked by alias); 6 Aug 2014 17:44:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 31784 invoked by uid 89); 6 Aug 2014 17:44:28 -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:27 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF4rm-0000D7-Gp for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:19:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF4rm-0000Cv-8B for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:19:10 -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 s76HJ9RV028438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 13:19:09 -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 s76HJ2nl030913; Wed, 6 Aug 2014 13:19:09 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 011/236] Replace PREV_INSN et al macros with functions Date: Wed, 6 Aug 2014 13:19:50 -0400 Message-Id: <1407345815-14551-12-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 Yet more scaffolding: convert the NEXT_INSN/PREV_INSN macros and their SET_* variants into functions. Convert the rvalue-style functions into returning rtx_insn * rather than plain rtx. For now, this is done by adding a checked cast, but I hope this can eventually become a field lookup. The lvalue forms for now return an rtx& to allow in-place modification. gcc/ * 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 inilne function. This is intended for use as an lvalue, and so returns an rtx& to allow in-place modification. (SET_NEXT_INSN): Likewise. --- gcc/rtl.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/gcc/rtl.h b/gcc/rtl.h index e08f05b..5936829 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 as_a_nullable (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 as_a_nullable (next); +} + +inline rtx& SET_NEXT_INSN (rtx insn) +{ + return XEXP (insn, 1); +} #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)