From patchwork Mon May 30 18:14:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 97946 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 3D2C7B6F6C for ; Tue, 31 May 2011 04:15:02 +1000 (EST) Received: (qmail 25473 invoked by alias); 30 May 2011 18:15:00 -0000 Received: (qmail 25461 invoked by uid 22791); 30 May 2011 18:14:59 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 May 2011 18:14:44 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id DD9A786391; Mon, 30 May 2011 20:14:42 +0200 (CEST) Date: Mon, 30 May 2011 20:14:42 +0200 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH] Make ipa_reduced_postorder number SCCs Message-ID: <20110530181442.GB8867@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, for an IPA-CP rewrite that I now work on, it is often useful to look at a call graph edge and see whether both ends are in the same strongly connected component. At the moment ipa_reduced_postorder does not offer such capabilities but it is easy to add. It is enough to save the lowest DFS number of the component when constructing the linked list of nodes in it. And this is exactly what the patch below does. Bootstrapped and tested on x86_64-linux. OK for trunk? Thanks, Martin 2011-05-19 Martin Jambor * ipa-utils.c (ipa_dfs_info): New field scc_no; * ipa-utils.c (searchc): Set scc_no; Index: src/gcc/ipa-utils.c =================================================================== --- src.orig/gcc/ipa-utils.c +++ src/gcc/ipa-utils.c @@ -138,6 +138,7 @@ searchc (struct searchc_env* env, struct x = env->stack[--(env->stack_size)]; x_info = (struct ipa_dfs_info *) x->aux; x_info->on_stack = false; + x_info->scc_no = v_info->dfn_number; if (env->reduce) { Index: src/gcc/ipa-utils.h =================================================================== --- src.orig/gcc/ipa-utils.h +++ src/gcc/ipa-utils.h @@ -26,6 +26,9 @@ along with GCC; see the file COPYING3. struct ipa_dfs_info { int dfn_number; int low_link; + /* This field will have the samy value for any two nodes in the same strongly + connected component. */ + int scc_no; bool new_node; bool on_stack; struct cgraph_node* next_cycle;