From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35038 invoked by alias); 22 Aug 2019 09:16:49 -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 34720 invoked by uid 89); 22 Aug 2019 09:16:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:MWHPR18, H*i:sk:MWHPR18 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Aug 2019 09:16:41 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 28034AD0B; Thu, 22 Aug 2019 09:16:39 +0000 (UTC) From: Martin Jambor To: Gary Oblock , GCC Development Cc: Subject: Re: How does one traverse all the global decls In-Reply-To: References: User-Agent: Notmuch/0.29.1 (https://notmuchmail.org) Emacs/26.2 (x86_64-suse-linux-gnu) Date: Thu, 22 Aug 2019 09:16:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00182.txt.bz2 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. Martin