From patchwork Thu Dec 19 17:38:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 1213599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516320-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Zw3kGTFS"; 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 47dzcj1Z5bz9sP6 for ; Fri, 20 Dec 2019 04:38:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; q=dns; s=default; b=to7nEAX9s9v3/6YLv sGyCPVsOePrO0EBsrNzAwuVapIMTnleltbRFbkoZl07IHMvsjWW4VH9VRoC0FOEk tkAEDUcqhrykzr8v2tbyRABGRq4uBxnDp4SokFpqE62vQ2FLSvtUSNCPK49QFHnr KohK6ZR8w/T6oGux3WY0Ql75Rg= 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 :content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; s=default; bh=eWORh7ggjwXokw6E+sKaenu 3x/Y=; b=Zw3kGTFSUyrCp//EWHwy8OmRRue2zJka0XX7CNzykR9mVBi6Qz6BYqR vp7wqJGDxhMY9Ig+RFPoKcs0FwW6t5s6wuPYZHr+NxgicbT95gFV95UjR2mmInj4 RWxYvYOA4E477FUqrfcu8syAI9ayDKAkzH4TzkFt/t1QkDwxA57A= Received: (qmail 97102 invoked by alias); 19 Dec 2019 17:38:18 -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 97094 invoked by uid 89); 19 Dec 2019 17:38:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=gcc9, gcc-9 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Dec 2019 17:38:16 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 689CC81EDB; Thu, 19 Dec 2019 18:38:13 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h8MXUKi1K8KM; Thu, 19 Dec 2019 18:38:13 +0100 (CET) Received: from [192.168.0.12] (bny92-4-82-228-126-192.fbx.proxad.net [82.228.126.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id A2EE48138A; Thu, 19 Dec 2019 18:38:12 +0100 (CET) Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: [patch] move and adjust PROBE_STACK_*_REG on aarch64 From: Olivier Hainque In-Reply-To: <5E21BDDF-EAC8-4EF2-8E9D-C2453B48E772@adacore.com> Date: Thu, 19 Dec 2019 18:38:11 +0100 Cc: "Richard Earnshaw (lists)" , =?utf-8?b?SsOp?= =?utf-8?q?r=C3=B4me_Lambourg?= , Joel Brobecker Message-Id: <27F1EC32-16A0-4F5C-BF49-6C48DB72881D@adacore.com> References: <3D751859-329A-48ED-B3D5-ECB41DFF5EE8@adacore.com> <5E21BDDF-EAC8-4EF2-8E9D-C2453B48E772@adacore.com> To: GCC Patches Hello, The attached patch is a standalone part of a slightly more general change last discussed here: https://gcc.gnu.org/ml/gcc-patches/2019-11/msg02626.html Which I re-tested successfully on aarch64-linux (bootstrap and regression test with --enable-languages=all + local tests with Ada stack-checking on a gcc-9 based toolchain in-house). The change moves the definitions of PROBE_STACK_FIRST_REG and PROBE_STACK_SECOND_REG to a more appropriate place for such items (here, in aarch64.md as suggested by Richard), and adjust their value from r9/r10 to r10/r11 to free r9 for a possibly more general purpose (e.g. as a static chain at least on targets which have a private use of r18, such as Windows or Vxworks). Is this ok to commit ? Thanks in advance! With Kind Regards, Olivier --- > 2019-11-07 Olivier Hainque > > * config/aarch64/aarch64.md: Define PROBE_STACK_FIRST_REGNUM > and PROBE_STACK_SECOND_REGNUM constants, designating r10/r11. > Replacements for the PROBE_STACK_FIRST/SECOND_REG constants in > aarch64.c. > * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG): Remove. > (PROBE_STACK_SECOND_REG): Remove. > (aarch64_emit_probe_stack_range): Adjust to the _REG -> _REGNUM > suffix update for PROBE_STACK register numbers. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 1dfff33..b5a2815 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5435,10 +5435,6 @@ aarch64_libgcc_cmp_return_mode (void) #error Cannot use simple address calculation for stack probing #endif -/* The pair of scratch registers used for stack probing. */ -#define PROBE_STACK_FIRST_REG R9_REGNUM -#define PROBE_STACK_SECOND_REG R10_REGNUM - /* Emit code to probe a range of stack addresses from FIRST to FIRST+POLY_SIZE, inclusive. These are offsets from the current stack pointer. */ @@ -5452,7 +5448,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, poly_int64 poly_size) return; } - rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REG); + rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REGNUM); /* See the same assertion on PROBE_INTERVAL above. */ gcc_assert ((first % ARITH_FACTOR) == 0); @@ -5510,7 +5506,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, poly_int64 poly_size) equality test for the loop condition. */ else { - rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REG); + rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REGNUM); /* Step 1: round SIZE to the previous multiple of the interval. */ diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index f19e227..2775d75e 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -111,6 +111,10 @@ ;; "FFR token": a fake register used for representing the scheduling ;; restrictions on FFR-related operations. (FFRT_REGNUM 85) + ;; The pair of scratch registers used for stack probing with -fstack-check. + ;; Leave R9 alone as a possible choice for more general purposes. + (PROBE_STACK_FIRST_REGNUM 10) + (PROBE_STACK_SECOND_REGNUM 11) ;; Scratch register used by stack clash protection to calculate ;; SVE CFA offsets during probing. (STACK_CLASH_SVE_CFA_REGNUM 11)