From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3573 invoked by alias); 22 Aug 2019 10:49:27 -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 3565 invoked by uid 89); 22 Aug 2019 10:49:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.3 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:ri6lfvl, H*i:sk:ri6lfvl X-HELO: mail-lf1-f49.google.com Received: from mail-lf1-f49.google.com (HELO mail-lf1-f49.google.com) (209.85.167.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Aug 2019 10:49:25 +0000 Received: by mail-lf1-f49.google.com with SMTP id x3so4181688lfn.6 for ; Thu, 22 Aug 2019 03:49:24 -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=E7ZICsNXtlzaCJMQfycrJa/Ox7hIY6YgS65H24VjI/w=; b=bGe5rPIavqMVrH6Zq5G/8VOu0MbIvTD7tS9ZKMdqvJzYq+atwzZT0TW9ylavCtD/ja A7WOfEEVutAjBLCRYpPNldkPDpPunPIUbACpkPTCaWa8h0UiLDeu7qwlTs+W/4cQ6J8K Rd/OGnThbxXi4NySWQhY7+YwNeS4cjNOz2Klv/LMKi5KVmN+OwI+oOUEzcYaIFGkzO+A RgqSj/lCfEBKBP2m5sJgbQYqZdmO2T4rIvfS9lkZNqLpMmqAREV5/vQxzW053u3+uSou OQQ54cJyWGCdywbVf3ExcOSGPqj5bsWDZC4g/CNj6kfoLuFVA/GKP8jaWVXhEhrj1L6N OTjA== MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Thu, 22 Aug 2019 10:49:00 -0000 Message-ID: Subject: Re: How does one traverse all the global decls To: Martin Jambor Cc: Gary Oblock , GCC Development Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00184.txt.bz2 On Thu, Aug 22, 2019 at 11:16 AM Martin Jambor wrote: > > Hi, > > On Wed, Aug 21 2019, Gary Oblock wrote: > > I'm trying to do some analysis code for an optimization > > that involves my code looking at all the declarations and > > types there of during the link time optimizations. > > > > Note, doing this for the local variables seems to be trivial > > because of FOR_EACH_LOCAL_DECL and there are also > > obvious ways of getting at the type information once I have > > a decl. However, I can't seem to find any similar way of > > getting at the global level decls. > > > > I'd appreciate your help on this. > > > > Look at FOR_EACH_VARIABLE defined in cgraph.h (because symtab.h does not > exist) and it's various uses throughout the compiler. There's also IPA-REFs so you can iterate over references of global variables (not sure if there's a nice FOR_EACH interface for that). Richard. > > Martin