From patchwork Tue Aug 15 16:24:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 801668 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-460391-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Mi3ghCpr"; 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 3xWybb5j5jz9sPm for ; Wed, 16 Aug 2017 02:28:59 +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:cc:subject:date:message-id:references:in-reply-to :content-type:content-transfer-encoding:mime-version; q=dns; s= default; b=f3+8re8Obp3t70HG4avoUy0nG8u4PvAamIjMh+1EFXZSAUrkUkV6V SoXY7xkzhQ42ad4G6bBbFXLJ0ur+z9hwPTMS4YnXDYMpnuxObn8BmVnc/48eIRGn OKCCorAoeYVmRW/yo3bvaOKS9UOJpN+4aLaubUauJ0p5AcXaL6FD5E= 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:references:in-reply-to :content-type:content-transfer-encoding:mime-version; s=default; bh=p1ZZ6Ms35NvZxhLW3eQbu4J6cVE=; b=Mi3ghCprRmLyf+ZWxNZEV6AiGEFD nmL+1q5MFHj2VSk8Wg46wTn/NlXopTPHoyo40Wey6mTG+LFg4C3ctVeoDEIe8PjV JHux5DWm3rpscEXhqOF+/zw0RcM3crjhqezuQ3KpwVSMseEaMwR0aFTTFbMVKbzK 0VyUpP3Bx+4iWcg= Received: (qmail 126871 invoked by alias); 15 Aug 2017 16:27:04 -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 124070 invoked by uid 89); 15 Aug 2017 16:25:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR03-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr30060.outbound.protection.outlook.com (HELO EUR03-AM5-obe.outbound.protection.outlook.com) (40.107.3.60) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Aug 2017 16:24:41 +0000 Received: from DB6PR0801MB2053.eurprd08.prod.outlook.com (10.168.86.22) by DB6PR08MB2664.eurprd08.prod.outlook.com (10.175.234.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.21; Tue, 15 Aug 2017 16:24:18 +0000 Received: from DB6PR0801MB2053.eurprd08.prod.outlook.com ([fe80::2d78:6ac0:142:cc9a]) by DB6PR0801MB2053.eurprd08.prod.outlook.com ([fe80::2d78:6ac0:142:cc9a%18]) with mapi id 15.01.1341.020; Tue, 15 Aug 2017 16:24:18 +0000 From: Wilco Dijkstra To: GCC Patches , James Greenhalgh CC: nd Subject: Re: [PATCH][AArch64] Remove aarch64_frame_pointer_required Date: Tue, 15 Aug 2017 16:24:18 +0000 Message-ID: References: In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR08MB2664; 6:Qjmpz2fNm3fWs3eBbcEZZ7m+dyoo99XteanubSwlwggvK2DEl3euObo9sslbk08Z1/jp877RW2/DwkhuHxegJZl6g0CWtZ+paswHATG3nC3NLx1czMUqV7z734S/Hx0jNG8pqvd8NGsOuvGJ3nRfNocY/HiIrVHDO9wRWkF82MXAtMTAV1uRt9tyQFQZtv4KDqff3VzFmKTaBrU29lRAFN6HCNhn/mr6cn4dIlknZWAjY0s+FGZ6hg22Ezd0XEsm8AaE/d9xJnab9lXdnyEd++GUDQplq0RwFakC4GPW1R08nZOLorJOl3gFigX6sxii/iIvGvUxDtZHCczncqiEHw==; 5:gWoJbQq2u3hRgwDVzS67UhmGr9N1iRkDnSugVjQbaafXJ8TpvHwrgEADqKqOjV7ik1gpDSKqrEN0S55g4YtjdGd0V0SicAbLmU20TnoCgZraZCvg23gaNUOD/LUFwRwPxandRml07l7UfcLclNnI+A==; 24:nve9IJmDQBGS93iAUNwJPTjYPezFQSxtDWFOVGnOwSLNZNrnNgNx5uhff3KmemlY7sD451Sgn7zoOEVyKBgFF+YVgPRv9VUnlEgfJH6Zw+o=; 7:l/+S23fIErnotwFigXSlcHIbC9VJwss9CINcqnny74MlKEOTS1LkIAgZkdHkkdzOv3NeQRmElyOf0Wmty6nAnmkAPs3JI3QNR621hqj6YA5xcd+6ViL+ocl7+Q4QkrGF9z6IlgA7HuX63Gps2rKaxsD0NSknrxzU2BCZIijIqGw+2lnHVYi9p2OkxnkBMVbUhMmNq2T95JEy5mpBe1zJdaRGBuSZN2FPOz62RMKUGvM= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: ffb1c815-cf02-4475-b2bd-08d4e3fa1458 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR08MB2664; x-ms-traffictypediagnostic: DB6PR08MB2664: nodisclaimer: True x-exchange-antispam-report-test: UriScan:(180628864354917); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR08MB2664; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR08MB2664; x-forefront-prvs: 04004D94E2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(377424004)(189002)(199003)(54534003)(189998001)(55016002)(86362001)(50986999)(2906002)(305945005)(5250100002)(72206003)(99286003)(76176999)(575784001)(102836003)(478600001)(3846002)(6506006)(6116002)(54356999)(3280700002)(229853002)(7736002)(2950100002)(97736004)(6246003)(8676002)(7696004)(8936002)(9686003)(68736007)(101416001)(106356001)(53936002)(33656002)(4326008)(3660700001)(66066001)(6636002)(74316002)(5660300001)(105586002)(81156014)(14454004)(81166006)(2900100001)(53546010)(6436002)(25786009)(15760500002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR08MB2664; H:DB6PR0801MB2053.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Aug 2017 16:24:18.6425 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2664 ping From: Wilco Dijkstra Sent: 04 August 2017 13:41 To: GCC Patches; James Greenhalgh Cc: nd Subject: [PATCH][AArch64] Remove aarch64_frame_pointer_required   To implement -fomit-leaf-frame-pointer, there are 2 places where we need to check whether we have to use a frame chain (since register allocation may allocate LR in a leaf function that omits the frame pointer, but if LR is spilled we must emit a frame chain).  To simplify this do not force frame_pointer_needed via aarch64_frame_pointer_required, but enable the frame chain in aarch64_layout_frame.  Now aarch64_frame_pointer_required can be removed and aarch64_can_eliminate is simplified. OK for commit? ChangeLog: 2017-08-03  Wilco Dijkstra      gcc/         * config/aarch64/aarch64.c (aarch64_frame_pointer_required)         Remove.         (aarch64_layout_frame): Initialise emit_frame_chain.         (aarch64_can_eliminate): Remove omit leaf frame pointer code.         (TARGET_FRAME_POINTER_REQUIRED): Remove define. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index aa71a410106164bb8da808a4b513771d713bb0f0..9bbc9864fd47a4404a80ea0cd5608202e8d0726a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2836,21 +2836,6 @@ aarch64_output_probe_stack_range (rtx reg1, rtx reg2)    return "";  }   -static bool -aarch64_frame_pointer_required (void) -{ -  /* Use the frame pointer if enabled and it is not a leaf function, unless -     leaf frame pointer omission is disabled.  If the frame pointer is enabled, -     force the frame pointer in leaf functions which use LR.  */ -  if (flag_omit_frame_pointer == 2 -      && !(flag_omit_leaf_frame_pointer -          && crtl->is_leaf -          && !df_regs_ever_live_p (LR_REGNUM))) -    return true; - -  return false; -} -  /* Mark the registers that need to be saved by the callee and calculate     the size of the callee-saved registers area and frame record (both FP     and LR may be omitted).  */ @@ -2867,6 +2852,14 @@ aarch64_layout_frame (void)    cfun->machine->frame.emit_frame_chain      = frame_pointer_needed || crtl->calls_eh_return;   +  /* Emit a frame chain if the frame pointer is enabled. +     If -momit-leaf-frame-pointer is used, do not use a frame chain +     in leaf functions which do not use LR.  */ +  if (flag_omit_frame_pointer == 2 +      && !(flag_omit_leaf_frame_pointer && crtl->is_leaf +          && !df_regs_ever_live_p (LR_REGNUM))) +    cfun->machine->frame.emit_frame_chain = true; +  #define SLOT_NOT_REQUIRED (-2)  #define SLOT_REQUIRED     (-1)   @@ -5884,17 +5877,6 @@ aarch64_can_eliminate (const int from, const int to)          return false;      } -  else -    { -      /* If we decided that we didn't need a leaf frame pointer but then used -        LR in the function, then we'll want a frame pointer after all, so -        prevent this elimination to ensure a frame pointer is used.  */ -      if (to == STACK_POINTER_REGNUM -         && flag_omit_frame_pointer == 2 -         && flag_omit_leaf_frame_pointer -         && df_regs_ever_live_p (LR_REGNUM)) -       return false; -    }      return true;  } @@ -15385,9 +15367,6 @@ aarch64_run_selftests (void)  #undef TARGET_FUNCTION_VALUE_REGNO_P  #define TARGET_FUNCTION_VALUE_REGNO_P aarch64_function_value_regno_p   -#undef TARGET_FRAME_POINTER_REQUIRED -#define TARGET_FRAME_POINTER_REQUIRED aarch64_frame_pointer_required -  #undef TARGET_GIMPLE_FOLD_BUILTIN  #define TARGET_GIMPLE_FOLD_BUILTIN aarch64_gimple_fold_builtin