From patchwork Fri Aug 11 03:04:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 800392 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-460215-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="d26YQprc"; 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 3xT8xL5Q9Xz9t3R for ; Fri, 11 Aug 2017 13:04:36 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=rFgnwzYXKkGoIde0E5uAba/EzSuq/d5tiegPAj1vSOsXW7FIl6 lGbGuS7dMvmr4Ct4SqQ3Xl3zJZHyk6Hr4dRd2F3/lELEhN0pyQxIQWNNH0nqmHVJ WuBOXwzLuGn8Y8zNPd53bGh/+CH/ydyFLh9QbCBzlSNJqY4hySzQ5sFNo= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=Yn4I+9SDH2HFAdT3SFD73O3rFVo=; b=d26YQprcbncNmF2Rt4a+ D3KKkMA9Mp82tr5PMSuiRJZ8z9wNLYQwlbGA87pQIWgXnTFtR6g1vDdGf7gh9EEA AMzZZH+wSgI2KFy1ZKMBIn0sYsV2CSgMUKOTRiKHME6YFme8uWBo2Vk7Mm2J+uI7 5sB5RAEJZzt0nDINejwysiM= Received: (qmail 110268 invoked by alias); 11 Aug 2017 03:04:24 -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 110247 invoked by uid 89); 11 Aug 2017 03:04:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-pg0-f49.google.com Received: from mail-pg0-f49.google.com (HELO mail-pg0-f49.google.com) (74.125.83.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Aug 2017 03:04:19 +0000 Received: by mail-pg0-f49.google.com with SMTP id u5so10419177pgn.0 for ; Thu, 10 Aug 2017 20:04:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ZhSxEHbE0d6JEhwj7BgZX9ycThXxON7mDyJC+LBtGKU=; b=Wjxo3B/1ZbrbGJsuY9HsEFzQGuOz4NmKPA89vc/KBjd0DOf1YE2FABs7lgX59cbOsb oR6vhmHdZ4JPg5ttIQBJlVCRVGx8LZXgQM6YrE4X9JTq6/35Vy48HW7QopNCvJhe8c+4 y94AjcNjKIGsuxxTIn+7f6PLvc1WVKe1tO7hJYAXYHYnDTNNWlfbxYgxvkEi0zKfVlUX +lgo0R7LhGIDwg0ez0eH8IaVKQS+nwMeLnRBpRvCOVFmBpsdAK3Vh7fEj25wIEHsdQLi 7kH0B4ytYLUqRF4u0s7VHd4sZ5tHyIGV4p0MGK2tjkIHHlIOf9NajO9ZFFt0W6FLgOC4 gHaw== X-Gm-Message-State: AHYfb5ht6Bz60bKq56sDa7D31LsUVyfj7Wexuj7/uMmVan5LRNhDeSSm /U0N6XWGYNYpnJdf X-Received: by 10.84.133.15 with SMTP id 15mr15797401plf.31.1502420657827; Thu, 10 Aug 2017 20:04:17 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id l5sm14739337pfg.50.2017.08.10.20.04.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Aug 2017 20:04:17 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id AF154C04D2; Fri, 11 Aug 2017 12:34:13 +0930 (ACST) Date: Fri, 11 Aug 2017 12:34:13 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [RS6000] Merge rs6000_reg_live_or_pic_offset_p into save_reg_p Message-ID: <20170811030413.GN16312@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes rs6000_reg_live_or_pic_offset_p is just save_reg_p with special handling for the pic register and eh_return. This merge also simplifies the eh_return handling. The intent of https://gcc.gnu.org/ml/gcc-patches/2010-09/msg01838.html was to say the PIC reg needed to be saved for eh_return, not all gprs. And that is already done without the crtl->calls_eh_return test on the return statement. Of course, it doesn't hurt to say all gprs need to be saved for eh_return (the target-independent code does that by setting DF live), but it's unnecessary in the backend. Bootstrapped and regression tested powerpc64-linux (-m32 too) and powerpc64le-linux. OK? * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Merge.. (save_reg_p): ..into this. Update all callers. (first_reg_to_save): Simplify. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b628808..2070648 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -24055,22 +24055,19 @@ rs6000_split_multireg_move (rtx dst, rtx src) /* This page contains routines that are used to determine what the function prologue and epilogue code will do and write them out. */ -static inline bool -save_reg_p (int r) -{ - return !call_used_regs[r] && df_regs_ever_live_p (r); -} - -/* Determine whether the gp REG is really used. */ +/* Determine whether the REG is really used. */ static bool -rs6000_reg_live_or_pic_offset_p (int reg) +save_reg_p (int reg) { /* We need to mark the PIC offset register live for the same conditions as it is set up, or otherwise it won't be saved before we clobber it. */ if (reg == RS6000_PIC_OFFSET_TABLE_REGNUM && !TARGET_SINGLE_PIC_BASE) { + /* When calling eh_return, we must return true for all the cases + where conditional_register_usage marks the PIC offset reg + call used. */ if (TARGET_TOC && TARGET_MINIMAL_TOC && (crtl->calls_eh_return || df_regs_ever_live_p (reg) @@ -24082,11 +24079,7 @@ rs6000_reg_live_or_pic_offset_p (int reg) return true; } - /* If the function calls eh_return, claim used all the registers that would - be checked for liveness otherwise. */ - - return ((crtl->calls_eh_return || df_regs_ever_live_p (reg)) - && !call_used_regs[reg]); + return !call_used_regs[reg] && df_regs_ever_live_p (reg); } /* Return the first fixed-point register that is required to be @@ -24102,13 +24095,6 @@ first_reg_to_save (void) if (save_reg_p (first_reg)) break; - if (first_reg > RS6000_PIC_OFFSET_TABLE_REGNUM - && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0) - || (DEFAULT_ABI == ABI_DARWIN && flag_pic) - || (TARGET_TOC && TARGET_MINIMAL_TOC)) - && rs6000_reg_live_or_pic_offset_p (RS6000_PIC_OFFSET_TABLE_REGNUM)) - first_reg = RS6000_PIC_OFFSET_TABLE_REGNUM; - #if TARGET_MACHO if (flag_pic && crtl->uses_pic_offset_table @@ -26290,7 +26276,7 @@ rs6000_get_separate_components (void) for (unsigned regno = info->first_gp_reg_save; regno < 32; regno++) { if (IN_RANGE (offset, -0x8000, 0x7fff) - && rs6000_reg_live_or_pic_offset_p (regno)) + && save_reg_p (regno)) bitmap_set_bit (components, regno); offset += reg_size; @@ -27031,7 +27017,7 @@ rs6000_emit_prologue (void) int offset = info->gp_save_offset + frame_off; for (int i = info->first_gp_reg_save; i < 32; i++) { - if (rs6000_reg_live_or_pic_offset_p (i) + if (save_reg_p (i) && !cfun->machine->gpr_is_wrapped_separately[i]) emit_frame_save (frame_reg_rtx, reg_mode, i, offset, sp_off - frame_off); @@ -28481,7 +28467,7 @@ rs6000_emit_epilogue (int sibcall) int offset = info->gp_save_offset + frame_off; for (i = info->first_gp_reg_save; i < 32; i++) { - if (rs6000_reg_live_or_pic_offset_p (i) + if (save_reg_p (i) && !cfun->machine->gpr_is_wrapped_separately[i]) { rtx reg = gen_rtx_REG (reg_mode, i); @@ -28524,13 +28510,9 @@ rs6000_emit_epilogue (int sibcall) cfa_restores = add_crlr_cfa_restore (info, cfa_restores); for (i = info->first_gp_reg_save; i < 32; i++) - if (!restoring_GPRs_inline - || using_load_multiple - || rs6000_reg_live_or_pic_offset_p (i)) + if (save_reg_p (i) + && !cfun->machine->gpr_is_wrapped_separately[i]) { - if (cfun->machine->gpr_is_wrapped_separately[i]) - continue; - rtx reg = gen_rtx_REG (reg_mode, i); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); }