From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24764 invoked by alias); 16 Oct 2014 11:31:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 24753 invoked by uid 89); 16 Oct 2014 11:31:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f173.google.com Received: from mail-wi0-f173.google.com (HELO mail-wi0-f173.google.com) (209.85.212.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 16 Oct 2014 11:31:16 +0000 Received: by mail-wi0-f173.google.com with SMTP id fb4so1206948wid.12 for ; Thu, 16 Oct 2014 04:31:13 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.149.169 with SMTP id ub9mr5169099wib.73.1413459073672; Thu, 16 Oct 2014 04:31:13 -0700 (PDT) Received: by 10.194.20.74 with HTTP; Thu, 16 Oct 2014 04:31:13 -0700 (PDT) In-Reply-To: <543EA03A.7000000@suse.cz> References: <543EA03A.7000000@suse.cz> Date: Thu, 16 Oct 2014 11:38:00 -0000 Message-ID: Subject: Re: [RFC, PATCH]: Introduction of callgraph annotation class From: Richard Biener To: =?UTF-8?Q?Martin_Li=C5=A1ka?= Cc: GCC Patches , Martin Jambor , Jan Hubicka Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg01538.txt.bz2 On Wed, Oct 15, 2014 at 6:26 PM, Martin Li=C5=A1ka wrote: > Hello. > > Following patch introduces a new class called callgraph_annotation. Idea > behind the patch is to provide a generic interface one can use to register > custom info related to a cgraph_node. As you know, symbol_table provides > hooks for creation, deletion and duplication of a cgraph_node. If you hav= e a > pass, you need to handle all these hooks and store custom data in your da= ta > structure. > > As an example, after discussion with Martin, I chose usage in ipa-prop.h: > > data structure: > vec ipa_node_params_vector > > if the pass handles an event, following chunk is executed: > if (ipa_node_params_vector.length () <=3D (unsigned) symtab->cgraph_max_u= id) > ipa_node_params_vector.safe_grow_cleared (symtab->cgraph_max_uid + 1); > > The problem is that you can have sparse UIDs of cgraph_nodes and every ti= me > you have to allocate a vector of size equal to cgraph_max_uid. > > As a replacement, I implemented first version of cgraph_annotation that > internally uses hash_map. > Every time a node is deleted, we remove corresponding data associated to = the > node. > > What do you think about it? I don't like "generic annotation" facilities at all. Would it be possible to make cgraph UIDs not sparse? (keep a free-list of cgraph nodes with UID < cgraph_max_uid, only really free nodes at the end) Using a different data structure than a vector indexed by cgraph UID should also be easily possible (a map from UID to data, hash_map ). Richard. > Thank you, > Martin