From patchwork Wed Jul 11 19:39:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 170504 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 D9E0F2C0084 for ; Thu, 12 Jul 2012 05:40:39 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342640440; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:From:Date:Message-ID:Subject:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=Z33xRKK Dg5uBUuVCLEgsy+G5Oic=; b=vFStti560ZNw/ZkfzvDBQO3quAbB7klJog3MzCp Hw4UnxOnqjuv8cecu/1zxoJ1jMe3Vs2/83ZFRNgvMFqdhH68heQQCTOsoUS1stRX TvOk5N4dAV8TZ8WzAonA/d3yFd/UCU1Rj2chwcG2iTN4TSkLXkDDounsEnCAViN7 RoLQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:MIME-Version:Received:From:Date:Message-ID:Subject:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=oqwQ+cnrhQzRgimwe3oUCsENRvGgzofXx/VpOIlqh8g7DT007GO/S7shqL2fUx LJ9Wuap6HDwqQK5ttpvBRG34jK8xEuWXHglMP4eKrs5QmBMhjq/QE9yLooifjFC9 BO+kEK01L/V/RqyS1v2e1H8CR7DzJZ8NzNASCdKtfVy1I=; Received: (qmail 18443 invoked by alias); 11 Jul 2012 19:40:35 -0000 Received: (qmail 18404 invoked by uid 22791); 11 Jul 2012 19:40:34 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-lb0-f175.google.com (HELO mail-lb0-f175.google.com) (209.85.217.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jul 2012 19:40:16 +0000 Received: by lbol5 with SMTP id l5so2371796lbo.20 for ; Wed, 11 Jul 2012 12:40:14 -0700 (PDT) Received: by 10.152.144.234 with SMTP id sp10mr28696105lab.51.1342035614889; Wed, 11 Jul 2012 12:40:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.4.229 with HTTP; Wed, 11 Jul 2012 12:39:53 -0700 (PDT) From: Steven Bosscher Date: Wed, 11 Jul 2012 21:39:53 +0200 Message-ID: Subject: [patch] Call free_after_parsing earlier To: GCC Patches X-IsSubscribed: yes 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 Hello, GCC calls free_after_parsing in rest_of_clean_state. That's way too late, it can be done in free_lang_data_in_cgraph instead. While there, I noticed a silly loop in final.c, and cleaned that up too. Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk? Ciao! Steven * final.c (final): Don't loop to find max_uid. (rest_of_clean_state): Don't call free_after_parsing here. * tree.c (free_lang_data_in_cgraph): Call free_after_parsing here. Index: final.c =================================================================== --- final.c (revision 189423) +++ final.c (working copy) @@ -1826,7 +1826,6 @@ void final (rtx first, FILE *file, int optimize_p) { rtx insn, next; - int max_uid = 0; int seen = 0; /* Used for -dA dump. */ @@ -1837,11 +1836,9 @@ final (rtx first, FILE *file, int optimi last_ignored_compare = 0; +#ifdef HAVE_cc0 for (insn = first; insn; insn = NEXT_INSN (insn)) { - if (INSN_UID (insn) > max_uid) /* Find largest UID. */ - max_uid = INSN_UID (insn); -#ifdef HAVE_cc0 /* If CC tracking across branches is enabled, record the insn which jumps to each branch only reached from one place. */ if (optimize_p && JUMP_P (insn)) @@ -1852,8 +1849,8 @@ final (rtx first, FILE *file, int optimi LABEL_REFS (lab) = insn; } } -#endif } +#endif init_recog (); @@ -4500,7 +4497,6 @@ rest_of_clean_state (void) init_recog_no_volatile (); /* We're done with this function. Free up memory if we can. */ - free_after_parsing (cfun); free_after_compilation (cfun); return 0; } Index: tree.c =================================================================== --- tree.c (revision 189423) +++ tree.c (working copy) @@ -5167,16 +5167,19 @@ assign_assembler_name_if_neeeded (tree t /* Free language specific information for every operand and expression - in every node of the call graph. This process operates in three stages: + in every node of the call graph. This process operates in four stages: - 1- Every callgraph node and varpool node is traversed looking for + 1- Every function is traversed to free any front-end specific + data hung from the function's struct function->language. + + 2- Every callgraph node and varpool node is traversed looking for decls and types embedded in them. This is a more exhaustive search than that done by find_referenced_vars, because it will also collect individual fields, decls embedded in types, etc. - 2- All the decls found are sent to free_lang_data_in_decl. + 3- All the decls found are sent to free_lang_data_in_decl. - 3- All the types found are sent to free_lang_data_in_type. + 4- All the types found are sent to free_lang_data_in_type. The ordering between decls and types is important because free_lang_data_in_decl sets assembler names, which includes @@ -5193,6 +5196,10 @@ free_lang_data_in_cgraph (void) unsigned i; alias_pair *p; + /* Clear out function->language. */ + FOR_EACH_FUNCTION (n) + free_after_parsing (DECL_STRUCT_FUNCTION (n->symbol.decl)); + /* Initialize sets and arrays to store referenced decls and types. */ fld.pset = pointer_set_create (); fld.worklist = NULL;