From patchwork Thu Jun 5 12:22:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Shawcroft X-Patchwork-Id: 356337 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 66184140080 for ; Thu, 5 Jun 2014 22:22:22 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=IG7zoIB5B5DTwIL1IzuSKvGs0desgmaozLHInBsQeFKnft xqpw2t1+fpdZ6X2ER49/OexJM2RSreGPyGd1yChGzT4BukKAlpejxKCE+7FBbt3w OEmCIh2+bFmmBxP8B50jjlatBagH3kzOj9zxq6cXwiT3j8Y1zC+nHHkZZfL0k= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=+AiTJOKH/5UGopYte2q/71IExd4=; b=qI5DDfENX9PmBjMQxlI4 u2JxmfZqaWXSB6WXvXz8q2L/zstbA/L3iFYYjNfgStHdfuCidr/4Q56Xr7PQuItj g8+MOMu78MojpuvBeVwXjNB5/bad+feB44eQdIOR8H38iBeU9L4UeB1KAZsLwaQ+ BnZxtMtK4T0LTOFRtVLZxs8= Received: (qmail 32501 invoked by alias); 5 Jun 2014 12:22:16 -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 32491 invoked by uid 89); 5 Jun 2014 12:22:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, 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, 05 Jun 2014 12:22:14 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 05 Jun 2014 13:22:11 +0100 Received: from [10.1.207.52] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Jun 2014 13:22:06 +0100 Message-ID: <539060F0.2080001@arm.com> Date: Thu, 05 Jun 2014 13:22:08 +0100 From: Marcus Shawcroft User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [AArch64] [COMMITTED] Restructure callee save slot allocation logic. X-MC-Unique: 114060513221107301 Refactor the existing implementation to use symbol SLOT_REQUIRED / SLOT_NOT_REQUIRED. The magic numbers used for SLOT_REQUIRED is moved from 0 to -1 in order to distinquish between the cases of SLOT_REQUIRED and offset 0. This distinction is important for a subsequent patch to restrucutre the handling of X29/X30. Commmitted /Marcus 2014-06-05 Marcus Shawcroft * config/aarch64/aarch64.c (SLOT_NOT_REQUIRED, SLOT_REQUIRED): Define. (aarch64_layout_frame): Use SLOT_NOT_REQUIRED and SLOT_REQUIRED. (aarch64_register_saved_on_entry): Adjust test. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index c67bac4..15ac880 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1812,28 +1812,32 @@ aarch64_layout_frame (void) if (reload_completed && cfun->machine->frame.laid_out) return; +#define SLOT_NOT_REQUIRED (-2) +#define SLOT_REQUIRED (-1) + /* First mark all the registers that really need to be saved... */ for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) - cfun->machine->frame.reg_offset[regno] = -1; + cfun->machine->frame.reg_offset[regno] = SLOT_NOT_REQUIRED; for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) - cfun->machine->frame.reg_offset[regno] = -1; + cfun->machine->frame.reg_offset[regno] = SLOT_NOT_REQUIRED; /* ... that includes the eh data registers (if needed)... */ if (crtl->calls_eh_return) for (regno = 0; EH_RETURN_DATA_REGNO (regno) != INVALID_REGNUM; regno++) - cfun->machine->frame.reg_offset[EH_RETURN_DATA_REGNO (regno)] = 0; + cfun->machine->frame.reg_offset[EH_RETURN_DATA_REGNO (regno)] + = SLOT_REQUIRED; /* ... and any callee saved register that dataflow says is live. */ for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) - cfun->machine->frame.reg_offset[regno] = 0; + cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED; for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) if (df_regs_ever_live_p (regno) && !call_used_regs[regno]) - cfun->machine->frame.reg_offset[regno] = 0; + cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED; if (frame_pointer_needed) { @@ -1844,14 +1848,14 @@ aarch64_layout_frame (void) /* Now assign stack slots for them. */ for (regno = R0_REGNUM; regno <= R28_REGNUM; regno++) - if (cfun->machine->frame.reg_offset[regno] != -1) + if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED) { cfun->machine->frame.reg_offset[regno] = offset; offset += UNITS_PER_WORD; } for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) - if (cfun->machine->frame.reg_offset[regno] != -1) + if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED) { cfun->machine->frame.reg_offset[regno] = offset; offset += UNITS_PER_WORD; @@ -1863,7 +1867,7 @@ aarch64_layout_frame (void) offset += UNITS_PER_WORD; } - if (cfun->machine->frame.reg_offset[R30_REGNUM] != -1) + if (cfun->machine->frame.reg_offset[R30_REGNUM] == SLOT_REQUIRED) { cfun->machine->frame.reg_offset[R30_REGNUM] = offset; offset += UNITS_PER_WORD; @@ -1896,7 +1900,7 @@ aarch64_set_frame_expr (rtx frame_pattern) static bool aarch64_register_saved_on_entry (int regno) { - return cfun->machine->frame.reg_offset[regno] != -1; + return cfun->machine->frame.reg_offset[regno] >= 0; } -- 1.7.9.5