From patchwork Wed Sep 11 19:12:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1161254 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-508907-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wOu9YxY7"; 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 46TBNq1hJdz9sDB for ; Thu, 12 Sep 2019 05:12:27 +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:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=UCKa8XEH1FM6qqIOdGBUCDZts/JJc FAGEgLPfYWonESE0ZHQ2YPopGYhv2ZJO64ADXl+8awphv5qXrjRjfyI3J0ScScOD vrosYUwPaouqBcRKnzJsrzmZHDrlzS20qWR1UddQTDZT5R2rrZM9i+hcHFqXtn4L zZPAfPR9tA07Vc= 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:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=CMXa0y0tsA9PMipyd09GEjyY79g=; b=wOu 9YxY7W4ucI3Tbbehf75j41E3QhEZCHYPIK1TLApQoq0rPbjDsdhR3W4SYU2lzCT0 dPYSC7sBeO/xSu/Jxe9JH5GncdooPUaA4tcp+K2ZBKl9xFLfJSa5eb/vIod/mjm0 7iShF87sJbdCXOJFSN/pKIrkCB8Ea5DIpkljOAH8= Received: (qmail 2331 invoked by alias); 11 Sep 2019 19:12:20 -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 2319 invoked by uid 89); 11 Sep 2019 19:12:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=Effective X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2019 19:12:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 99A8C28 for ; Wed, 11 Sep 2019 12:12:17 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 421A33F59C for ; Wed, 11 Sep 2019 12:12:17 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [18/32] Remove global call sets: haifa-sched.c References: Date: Wed, 11 Sep 2019 20:12:16 +0100 In-Reply-To: (Richard Sandiford's message of "Wed, 11 Sep 2019 20:02:26 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes The code patched here is counting how many registers the current function would need to save in the prologue before it uses them. The code is called per function, so using crtl is OK. 2019-09-11 Richard Sandiford gcc/ * haifa-sched.c: Include function-abi.h. (alloc_global_sched_pressure_data): Use crtl->abi to check whether the function would need to save a register before using it. Index: gcc/haifa-sched.c =================================================================== --- gcc/haifa-sched.c 2019-09-10 19:56:45.353177919 +0100 +++ gcc/haifa-sched.c 2019-09-11 19:48:27.281819692 +0100 @@ -146,6 +146,7 @@ Software Foundation; either version 3, o #include "cfgloop.h" #include "dumpfile.h" #include "print-rtl.h" +#include "function-abi.h" #ifdef INSN_SCHEDULING @@ -939,7 +940,8 @@ enum reg_class *sched_regno_pressure_cla /* Effective number of available registers of a given class (see comment in sched_pressure_start_bb). */ static int sched_class_regs_num[N_REG_CLASSES]; -/* Number of call_saved_regs and fixed_regs. Helpers for calculating of +/* The number of registers that the function would need to save before it + uses them, and the number of fixed_regs. Helpers for calculating of sched_class_regs_num. */ static int call_saved_regs_num[N_REG_CLASSES]; static int fixed_regs_num[N_REG_CLASSES]; @@ -7207,10 +7209,13 @@ alloc_global_sched_pressure_data (void) fixed_regs_num[cl] = 0; for (int i = 0; i < ira_class_hard_regs_num[cl]; ++i) - if (!call_used_or_fixed_reg_p (ira_class_hard_regs[cl][i])) - ++call_saved_regs_num[cl]; - else if (fixed_regs[ira_class_hard_regs[cl][i]]) - ++fixed_regs_num[cl]; + { + unsigned int regno = ira_class_hard_regs[cl][i]; + if (fixed_regs[regno]) + ++fixed_regs_num[cl]; + else if (!crtl->abi->clobbers_full_reg_p (regno)) + ++call_saved_regs_num[cl]; + } } } }