From patchwork Thu Sep 18 10:10:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 390736 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 8DC751401E7 for ; Thu, 18 Sep 2014 20:11:01 +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:subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=E56 gVKgV0EmAhrnAD9POzO7f0dRq9AjKef5Zywy3e2mL7cD8RAacD0WHeBO3Q5778U2 10nZ0V0Yu0P6ZdxwO/Qvui9DboMD7NiuY/VG7wJVuRVN16mrjkMtsOnC1Z6IUtru z40nXvyrjAGH4FoHIwI9e4zXZbOqoO5qyBv28Idg= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=7dKBc7ZEx i5NqyRz8cA52tMc1tU=; b=CEZpmD/S1JMUFtU4HkjHOtUekrXOQJUXV1TMD5Qop R3gWkoo39l/lcFzVmdY8pNA5BiQ3sUd5QuRwNUkLV9dyMgEXKaHrMQoKh4RtPsjZ 9Vm0HnpEoTRfnU4SCRm2s2k2UqPlxeaKCeiMtgAKit66AFqse1/VQMoHAVFD92Qg ag= Received: (qmail 12999 invoked by alias); 18 Sep 2014 10:10:54 -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 12985 invoked by uid 89); 18 Sep 2014 10:10:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Sep 2014 10:10:51 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 18 Sep 2014 11:10:48 +0100 Received: from localhost ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Sep 2014 11:10:46 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 2/5] Tweak subreg_get_info documentation References: <87ppetnsxd.fsf@e105548-lin.cambridge.arm.com> Date: Thu, 18 Sep 2014 11:10:46 +0100 In-Reply-To: <87ppetnsxd.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Thu, 18 Sep 2014 11:07:10 +0100") Message-ID: <87ha05nsrd.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 114091811104813601 Try to clarify what subreg_get_info does and doesn't check. gcc/ * rtl.h (subreg_info): Expand commentary * rtlanal.c (subreg_get_info): Likewise. Index: gcc/rtl.h =================================================================== --- gcc/rtl.h 2014-09-15 10:00:14.693366097 +0100 +++ gcc/rtl.h 2014-09-15 10:00:14.689366147 +0100 @@ -2866,10 +2866,13 @@ struct subreg_info { /* Offset of first hard register involved in the subreg. */ int offset; - /* Number of hard registers involved in the subreg. */ + /* Number of hard registers involved in the subreg. In the case of + a paradoxical subreg, this is the number of registers that would + be modified by writing to the subreg; some of them may be don't-care + when reading from the subreg. */ int nregs; /* Whether this subreg can be represented as a hard reg with the new - mode. */ + mode (by adding OFFSET to the original hard register). */ bool representable_p; }; Index: gcc/rtlanal.c =================================================================== --- gcc/rtlanal.c 2014-09-15 10:00:14.693366097 +0100 +++ gcc/rtlanal.c 2014-09-15 10:00:14.689366147 +0100 @@ -3411,7 +3411,20 @@ subreg_lsb (const_rtx x) xmode - The mode of xregno. offset - The byte offset. ymode - The mode of a top level SUBREG (or what may become one). - info - Pointer to structure to fill in. */ + info - Pointer to structure to fill in. + + Rather than considering one particular inner register (and thus one + particular "outer" register) in isolation, this function really uses + XREGNO as a model for a sequence of isomorphic hard registers. Thus the + function does not check whether adding INFO->offset to XREGNO gives + a valid hard register; even if INFO->offset + XREGNO is out of range, + there might be another register of the same type that is in range. + Likewise it doesn't check whether HARD_REGNO_MODE_OK accepts the new + register, since that can depend on things like whether the final + register number is even or odd. Callers that want to check whether + this particular subreg can be replaced by a simple (reg ...) should + use simplify_subreg_regno. */ + void subreg_get_info (unsigned int xregno, enum machine_mode xmode, unsigned int offset, enum machine_mode ymode,