From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1800 invoked by alias); 19 Sep 2019 10:51:22 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 1790 invoked by uid 89); 19 Sep 2019 10:51:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:MWHPR18, H*i:sk:MWHPR18, HX-Languages-Length:1076, cloning X-HELO: mail-lj1-f178.google.com Received: from mail-lj1-f178.google.com (HELO mail-lj1-f178.google.com) (209.85.208.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2019 10:51:20 +0000 Received: by mail-lj1-f178.google.com with SMTP id j19so1613281lja.1 for ; Thu, 19 Sep 2019 03:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pBTR32/sisX2efuO4QRqxUm+/kyOXYXuwPrtpoKFc+M=; b=tM2uYXPXuSlVqyFSe41m9BYjdfsMeUHdTVpX19aFKQMCjtKslvDp0zrXVEbalIRtWH 1IQiEj+zaP1lwgfndlas6CgHE9EJXykq3odcRJbsdTIiZOTt0tQfSO0JSClwz6Y/++Un JubdBHtNRuJNNZW/1kvZsCWkeHRazpVeZfntcnfopPiUSmL6UDgE9/ssJaun6ApSPlSR 2SXicIq5pf1lM1F3A1PWbn9pgu1bN7rzuMi8M9G0bgyHQFNvkl4gC2wYFNp/soml8jRM wIpp1J32Oc+GxaMBIo5nxjQkI0W7eIJBhXkzYal5oRpQYH9pfe4NGQsv0C3MF1SU0w/2 1VZg== MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Thu, 19 Sep 2019 10:51:00 -0000 Message-ID: Subject: Re: How can I build new functions on the fly during optimization? To: Gary Oblock Cc: GCC Development Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00140.txt.bz2 On Thu, Sep 19, 2019 at 4:27 AM Gary Oblock wrote: > > I'm trying to build new functions on the fly during optimization. > For those of you that have not been following my previous questions, > this is structure reorganization optimization related. For example when > somebody frees an array of type fu, I'd like to build a new > function _reorg_free_fu which does the correct things for a > transformed array of type _reorg_fu. > > I've run across uses of these: > build_fn_decl > gimple_build_call > However, I don't see any code going any further than that. > > Anybody have any ideas about how I can accomplish the rest of > what I need to do? Note, I'll be doing this during LTRANS. One of the few examples is cgraph_node::expand_thunk where it builds a GIMPLE thunk. The other is in ipa.c, cgraph_build_static_cdtor_1 but using a GENERIC body. Most others do sth like cloning an existing function or moving part of the CFG to a new function. Richard. > Thanks, > > Gary Oblock