From patchwork Wed Sep 21 11:46:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Renlin Li X-Patchwork-Id: 672834 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 3sfHt335bdz9ssP for ; Wed, 21 Sep 2016 21:47:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=svzp5M42; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=fbUez1PYpjoto2U/a2iQ8zPfVdg66qkIrZG+dy9opQxUS0BWdz 3ElbZaEF3iWGChuEyBjmBgZsJjm66nElSPpfaDiGyoJoWO4vWGqkncNN9WEu93AF +ZfiDAwJwF1ZG6Tb2AQiNtoM57Cui2KLyjSP/fGQavxDQz8w1CYpR33s4= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=T1mCPMDVbWuzVYOGol4exHNEeRk=; b=svzp5M42wFR46i5lrElt V4GsL2m7oKhoY01w0NcTApRio75dIqcFp7f1weVKpEIThkG+qEHbEbAiBlGrFx3x XmW/bEr6AiYUm3wgH9gCAiNLcm8XzoRhtaaAQ8WytfYDJjhhs91EPPfLjlDaE5/f AQ4a2Sxsy4j1a6bOkwaj//Y= Received: (qmail 96238 invoked by alias); 21 Sep 2016 11:47:14 -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 96188 invoked by uid 89); 21 Sep 2016 11:47:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=10k, 10K X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Sep 2016 11:47:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C40DFF0; Wed, 21 Sep 2016 04:47:01 -0700 (PDT) Received: from [10.2.207.43] (e104453-lin.cambridge.arm.com [10.2.207.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 31EFB3F21A; Wed, 21 Sep 2016 04:47:01 -0700 (PDT) To: "gcc-patches@gcc.gnu.org" Cc: "law@redhat.com" , "Vladimir N. Makarov" From: Renlin Li Subject: [RFC][IRA]Initialize ira_use_lra_p early by moving the initialization into ira_init_once (). Message-ID: <57E27333.5000808@foss.arm.com> Date: Wed, 21 Sep 2016 12:46:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, ira_use_lra_p is a global variable use in ira as well as backend_init_target (). It's fine to be used in IRA as it's will be initialized at the beginning of ira pass. However, early in backend_init_target (), this variable may not be initialized yet. There is a check in backend_init_target (): ''' if (!ira_use_lra_p) init_reload (); ''' In this case, init_reload () will always be called if ira_use_lra_p is not initialized. ira_init_once () is a better place for the initialization. It's called early in initialize_rtl (), just before backend_init_target (). And as the name suggests, it's called once to initialize function independent data structure. aarch64-none-elf regression test Okay, x86-64-linux bootstrap Okay. Regards, Renlin gcc/ChangeLog: 2016-09-21 Renlin Li * ira.c (ira): Move ira_use_lra_p initialization code to ... (ira_init_once): Here. diff --git a/gcc/ira.c b/gcc/ira.c index f8a59e3..9e7ba52 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -1665,6 +1665,8 @@ ira_init_once (void) { ira_init_costs_once (); lra_init_once (); + + ira_use_lra_p = targetm.lra_p (); } /* Free ira_max_register_move_cost, ira_may_move_in_cost and @@ -5082,7 +5084,6 @@ ira (FILE *f) ira_conflicts_p = optimize > 0; - ira_use_lra_p = targetm.lra_p (); /* If there are too many pseudos and/or basic blocks (e.g. 10K pseudos and 10K blocks or 100K pseudos and 1K blocks), we will use simplified and faster algorithms in LRA. */