From patchwork Fri Jul 30 23:07:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Thuresson X-Patchwork-Id: 60384 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]) by ozlabs.org (Postfix) with SMTP id 7ABADB70AA for ; Sat, 31 Jul 2010 09:08:09 +1000 (EST) Received: (qmail 9555 invoked by alias); 30 Jul 2010 23:08:07 -0000 Received: (qmail 9539 invoked by uid 22791); 30 Jul 2010 23:08:06 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SARE_BAYES_5x7, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Jul 2010 23:08:00 +0000 Received: from kpbe17.cbf.corp.google.com (kpbe17.cbf.corp.google.com [172.25.105.81]) by smtp-out.google.com with ESMTP id o6UN7vKN007962 for ; Fri, 30 Jul 2010 16:07:57 -0700 Received: from pwj6 (pwj6.prod.google.com [10.241.219.70]) by kpbe17.cbf.corp.google.com with ESMTP id o6UN6wgh021051 for ; Fri, 30 Jul 2010 16:07:56 -0700 Received: by pwj6 with SMTP id 6so837994pwj.16 for ; Fri, 30 Jul 2010 16:07:56 -0700 (PDT) Received: by 10.142.48.18 with SMTP id v18mr2325171wfv.102.1280531276140; Fri, 30 Jul 2010 16:07:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.201.20 with HTTP; Fri, 30 Jul 2010 16:07:36 -0700 (PDT) From: Martin Thuresson Date: Fri, 30 Jul 2010 16:07:36 -0700 Message-ID: Subject: Update postreload.c to avoid long compilation time To: gcc-patches X-System-Of-Record: true 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 This patch updates the handling of temporary registers in postreload.c to avoid very long build times in certain files. By creating new registers instead of updating one existing one using SET_REGNO it avoids going through the scan df structure. Im new to gcc RTL and appreciate any feedback. In the (inspired from real code) attached source, the time for "reload CSE regs" went down from 20 usr seconds to less than 1. 2010-07-30 Martin Thuresson * postreload.c (reload_cse_simplify, reload_cse_simplify_operands, reload_cse_regs_1): Define testreg in reload_cse_simplify_operands instead of passing it as function parameter. Thanks, Martin --- postreload.c.orig 2010-07-27 09:37:16.000000000 -0700 +++ postreload.c 2010-07-30 13:53:37.000000000 -0700 @@ -51,10 +51,10 @@ along with GCC; see the file COPYING3. #include "dbgcnt.h" static int reload_cse_noop_set_p (rtx); -static void reload_cse_simplify (rtx, rtx); +static void reload_cse_simplify (rtx); static void reload_cse_regs_1 (rtx); static int reload_cse_simplify_set (rtx, rtx); -static int reload_cse_simplify_operands (rtx, rtx); +static int reload_cse_simplify_operands (rtx); static void reload_combine (void); static void reload_combine_note_use (rtx *, rtx, int, rtx); @@ -92,7 +92,7 @@ reload_cse_noop_set_p (rtx set) /* Try to simplify INSN. */ static void -reload_cse_simplify (rtx insn, rtx testreg) +reload_cse_simplify (rtx insn) { rtx body = PATTERN (insn); @@ -120,7 +120,7 @@ reload_cse_simplify (rtx insn, rtx testr if (count > 0) apply_change_group (); else - reload_cse_simplify_operands (insn, testreg); + reload_cse_simplify_operands (insn); } else if (GET_CODE (body) == PARALLEL) { @@ -177,7 +177,7 @@ reload_cse_simplify (rtx insn, rtx testr if (count > 0) apply_change_group (); else - reload_cse_simplify_operands (insn, testreg); + reload_cse_simplify_operands (insn); } } @@ -202,7 +202,6 @@ static void reload_cse_regs_1 (rtx first) { rtx insn; - rtx testreg = gen_rtx_REG (VOIDmode, -1); cselib_init (CSELIB_RECORD_MEMORY); init_alias_analysis (); @@ -210,7 +209,7 @@ reload_cse_regs_1 (rtx first) for (insn = first; insn; insn = NEXT_INSN (insn)) { if (INSN_P (insn)) - reload_cse_simplify (insn, testreg); + reload_cse_simplify (insn); cselib_process_insn (insn); } @@ -371,7 +370,7 @@ reload_cse_simplify_set (rtx set, rtx in hard registers. */ static int -reload_cse_simplify_operands (rtx insn, rtx testreg) +reload_cse_simplify_operands (rtx insn) { int i, j; @@ -469,7 +468,7 @@ reload_cse_simplify_operands (rtx insn, 1); if (! apply_change_group ()) return 0; - return reload_cse_simplify_operands (insn, testreg); + return reload_cse_simplify_operands (insn); } else /* ??? There might be arithmetic operations with memory that are @@ -524,13 +523,11 @@ reload_cse_simplify_operands (rtx insn, for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { enum reg_class rclass = NO_REGS; + rtx testreg = gen_rtx_REG (mode, regno); if (! TEST_HARD_REG_BIT (equiv_regs[i], regno)) continue; - SET_REGNO (testreg, regno); - PUT_MODE (testreg, mode); - /* We found a register equal to this operand. Now look for all alternatives that can accept this register and have not been assigned a register they can use yet. */