From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30648 invoked by alias); 23 Dec 2009 15:16:29 -0000 Received: (qmail 30639 invoked by uid 22791); 23 Dec 2009 15:16:28 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Dec 2009 15:16:24 +0000 Received: from wpaz1.hot.corp.google.com (wpaz1.hot.corp.google.com [172.24.198.65]) by smtp-out.google.com with ESMTP id nBNFGMeq000487 for ; Wed, 23 Dec 2009 07:16:22 -0800 Received: from yxe7 (yxe7.prod.google.com [10.190.2.7]) by wpaz1.hot.corp.google.com with ESMTP id nBNFGKHG004493 for ; Wed, 23 Dec 2009 07:16:21 -0800 Received: by yxe7 with SMTP id 7so6790568yxe.25 for ; Wed, 23 Dec 2009 07:16:20 -0800 (PST) Received: by 10.150.237.19 with SMTP id k19mr1068194ybh.320.1261581379796; Wed, 23 Dec 2009 07:16:19 -0800 (PST) Received: from coign.google.com ([67.218.110.145]) by mx.google.com with ESMTPS id 9sm2785164ywf.50.2009.12.23.07.16.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 23 Dec 2009 07:16:18 -0800 (PST) To: Srinivas Pasupuleti Cc: gcc-help Subject: Re: Question on Gimple Tree References: <8f14e1ab0912221838t19438b3es6092755c3838d389@mail.gmail.com> <8f14e1ab0912221851s186a2aa4yf3fe63ccbba7be44@mail.gmail.com> From: Ian Lance Taylor Date: Wed, 23 Dec 2009 16:13:00 -0000 In-Reply-To: <8f14e1ab0912221851s186a2aa4yf3fe63ccbba7be44@mail.gmail.com> (Srinivas Pasupuleti's message of "Tue\, 22 Dec 2009 21\:51\:48 -0500") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg00326.txt.bz2 Srinivas Pasupuleti writes: > I have written a pass to traverse gimple tree and include some print > function calls with arguments as the LHS(lval) variable of every > gimple modify statement. (this is part of my profiling work) > I would like to know if it is possible to access the address of the > gimple variables. > > =C2=A0for e.g., > > The following is a gimple statement (all are int variables): > D.2629_17 =3D D.2629_27 + D.2629_22 ; > > In my pass I have added a print function call as below > print(D.2629_17) > > The above works perfect > > I want to pass address of the gimple variable > print(&D.2629_17) > > Is the above possible to do. If so, how to do it?? > I need to do for memory profiling and dynamic dependency testing. You can't take the address of a gimple variable; think of a gimple variable as a register in an imaginary machine. You will have to create a real, albeit temporary, variable and assign the gimple variable to it. If you want your function to change the value of the variable, you will have to copy the value back as well. Ian