From patchwork Tue Sep 10 16:27:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1160449 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-508772-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wyr9aKcE"; dkim-atps=neutral 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 46SVmw2W1yz9s4Y for ; Wed, 11 Sep 2019 02:27:28 +1000 (AEST) 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; q=dns; s=default; b=GkMU6KtvDShsAqJgTmxyDy+edaVUM /giVn+IWcy2/rVr6MIIUKPZAF6H1EILZGQifKbVsVy0lK2ZEeuVeM3jZtb2VlNf6 Hh/kY4vqfm9zPzg4gZjqgbz12YiicB65iThhQnnKlXIu05QQuOi8MawwVRQ9aQdp XtfDZF7iiyrq70= 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; s=default; bh=g/5o7EbC4CyxGZP9okKPsPDhtKQ=; b=wyr 9aKcEcueICm2A79djQhpvCtLOrFuj4ZmM3FhCyKE2E3bashahkw6vVwCRaZkiDfY 04GZBjQ5+LtLMg49SthzFNGtgjELDkcreGiyhqL60Av8SjSKh6in/q2/Z9aPHhwG +anrjy/PPwlOZkx3JqkYQBayeq04I93tz94phVfY= Received: (qmail 82893 invoked by alias); 10 Sep 2019 16:27:21 -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 82884 invoked by uid 89); 10 Sep 2019 16:27:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=c6xc, H*i:sk:mptef0o, c6x, UD:c6x.c X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 16:27:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A13051000 for ; Tue, 10 Sep 2019 09:27:18 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 490303F71F for ; Tue, 10 Sep 2019 09:27:18 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [1/9] Move c6x REGNO_REG_CLASS out of line References: Date: Tue, 10 Sep 2019 17:27:17 +0100 In-Reply-To: (Richard Sandiford's message of "Tue, 10 Sep 2019 17:26:13 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes I have a series of patches that hides call_used_regs from target- independent code, a knock-on effect of which is that (public) target macros can't use call_used_regs either. This patch fixes the only case in which that was a problem. 2019-09-10 Richard Sandiford gcc/ * config/c6x/c6x-protos.h (c6x_set_return_address): Declare. * config/c6x/c6x.h (REGNO_REG_CLASS): Move implementation to * config/c6x/c6x.c (c6x_regno_reg_class): ...this new function. Index: gcc/config/c6x/c6x-protos.h =================================================================== --- gcc/config/c6x/c6x-protos.h 2019-07-01 09:37:06.616529543 +0100 +++ gcc/config/c6x/c6x-protos.h 2019-09-10 17:22:34.514490030 +0100 @@ -53,6 +53,8 @@ extern void c6x_expand_epilogue (bool); extern rtx c6x_return_addr_rtx (int); extern void c6x_set_return_address (rtx, rtx); + +enum reg_class c6x_regno_reg_class (int); #endif extern void c6x_override_options (void); Index: gcc/config/c6x/c6x.h =================================================================== --- gcc/config/c6x/c6x.h 2019-03-08 18:15:37.924735697 +0000 +++ gcc/config/c6x/c6x.h 2019-09-10 17:22:34.518490002 +0100 @@ -259,12 +259,7 @@ #define A_REG_P(X) (REG_P (X) && A_REGNO #define CROSS_OPERANDS(X0,X1) \ (A_REG_P (X0) == A_REG_P (X1) ? CROSS_N : CROSS_Y) -#define REGNO_REG_CLASS(reg) \ - ((reg) >= REG_A1 && (reg) <= REG_A2 ? PREDICATE_A_REGS \ - : (reg) == REG_A0 && TARGET_INSNS_64 ? PREDICATE_A_REGS \ - : (reg) >= REG_B0 && (reg) <= REG_B2 ? PREDICATE_B_REGS \ - : A_REGNO_P (reg) ? NONPREDICATE_A_REGS \ - : call_used_regs[reg] ? CALL_USED_B_REGS : B_REGS) +#define REGNO_REG_CLASS(reg) c6x_regno_reg_class (reg) #define BASE_REG_CLASS ALL_REGS #define INDEX_REG_CLASS ALL_REGS Index: gcc/config/c6x/c6x.c =================================================================== --- gcc/config/c6x/c6x.c 2019-09-09 18:59:07.324158792 +0100 +++ gcc/config/c6x/c6x.c 2019-09-10 17:22:34.518490002 +0100 @@ -6677,6 +6677,28 @@ c6x_modes_tieable_p (machine_mode mode1, && GET_MODE_SIZE (mode2) <= UNITS_PER_WORD)); } +/* Implement REGNO_REG_CLASS. */ + +enum reg_class +c6x_regno_reg_class (int reg) +{ + if (reg >= REG_A1 && reg <= REG_A2) + return PREDICATE_A_REGS; + + if (reg == REG_A0 && TARGET_INSNS_64) + return PREDICATE_A_REGS; + + if (reg >= REG_B0 && reg <= REG_B2) + return PREDICATE_B_REGS; + + if (A_REGNO_P (reg)) + return NONPREDICATE_A_REGS; + + if (call_used_regs[reg]) + return CALL_USED_B_REGS; + + return B_REGS; +} /* Target Structure. */