From patchwork Mon Jul 1 16:27:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1125480 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-504099-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="m5ealOLN"; 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 45ct803tYBz9s4V for ; Tue, 2 Jul 2019 02:27:44 +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:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=vIL5kP9xgwwjb38M 5DNyOBv6b8ymRnGi3UHD3a2U4y1sez31vv2WULRMuJFz7PXUMEVqjJlq3t4KE1J5 OxdybF5e+Zw36V1nL8VzV0E7Pw0c7UZg9ajr+6aR/aHJWQtuXyZPMFGNIvDdQrxR DkQD8ntEkppxHiwnOmN1D6gmdfM= 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:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=Bu0YaAriCFqRMG1CAGQ4CP c7BPQ=; b=m5ealOLNYl2Ba5LZutrXS34gJuItExEugUAr0hDhmnC4z9o3KJ5RmK Y1eFAJ1KZeRvfqyMiqQmDoz4opTC4wS4wUz4+viCUPsn9BBJe00LfntWUgCmT10P nUVtZbhJAvPQNqwAYJVG9janYiyZ0H4I94qxY2odYSaWkyRvQePCY= Received: (qmail 118315 invoked by alias); 1 Jul 2019 16:27:36 -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 118247 invoked by uid 89); 1 Jul 2019 16:27:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= 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; Mon, 01 Jul 2019 16:27:34 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 005EF81A10 for ; Mon, 1 Jul 2019 18:27:32 +0200 (CEST) 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 sdo1a5YHFbJt for ; Mon, 1 Jul 2019 18:27:31 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id D5904814FA for ; Mon, 1 Jul 2019 18:27:31 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Fix PR middle-end/64242 Date: Mon, 01 Jul 2019 18:27:31 +0200 Message-ID: <6914481.u3u9Is5nMZ@polaris> MIME-Version: 1.0 SPARC defines a nonlocal_goto pattern to which the same adjustment needs to be applied as in the middle-end. Tested on SPARC/Solaris, applied on mainline and 9 branch. 2019-07-01 Eric Botcazou PR middle-end/64242 * config/sparc/sparc.md (nonlocal_goto): Restore frame pointer last. Add frame clobber and schedule blockage. Index: config/sparc/sparc.md =================================================================== --- config/sparc/sparc.md (revision 272633) +++ config/sparc/sparc.md (working copy) @@ -7381,7 +7381,7 @@ (define_expand "nonlocal_goto" "" { rtx i7 = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM); - rtx r_label = copy_to_reg (operands[1]); + rtx r_label = operands[1]; rtx r_sp = adjust_address (operands[2], Pmode, 0); rtx r_fp = operands[3]; rtx r_i7 = adjust_address (operands[2], Pmode, GET_MODE_SIZE (Pmode)); @@ -7394,9 +7394,18 @@ (define_expand "nonlocal_goto" emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); - /* Restore frame pointer for containing function. */ - emit_move_insn (hard_frame_pointer_rtx, r_fp); + r_label = copy_to_reg (r_label); + + /* Restore the frame pointer and stack pointer. We must use a + temporary since the setjmp buffer may be a local. */ + r_fp = copy_to_reg (r_fp); emit_stack_restore (SAVE_NONLOCAL, r_sp); + r_i7 = copy_to_reg (r_i7); + + /* Ensure the frame pointer move is not optimized. */ + emit_insn (gen_blockage ()); + emit_clobber (hard_frame_pointer_rtx); + emit_move_insn (hard_frame_pointer_rtx, r_fp); emit_move_insn (i7, r_i7); /* USE of hard_frame_pointer_rtx added for consistency; @@ -7405,8 +7414,7 @@ (define_expand "nonlocal_goto" emit_use (stack_pointer_rtx); emit_use (i7); - emit_jump_insn (gen_indirect_jump (r_label)); - emit_barrier (); + emit_indirect_jump (r_label); DONE; })