From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18852 invoked by alias); 23 Dec 2009 16:13:25 -0000 Received: (qmail 18840 invoked by uid 22791); 23 Dec 2009 16:13:24 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f227.google.com (HELO mail-ew0-f227.google.com) (209.85.219.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Dec 2009 16:13:19 +0000 Received: by ewy27 with SMTP id 27so8983687ewy.16 for ; Wed, 23 Dec 2009 08:13:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.89.131 with SMTP id c3mr861388wef.197.1261584797241; Wed, 23 Dec 2009 08:13:17 -0800 (PST) In-Reply-To: References: <8f14e1ab0912221838t19438b3es6092755c3838d389@mail.gmail.com> <8f14e1ab0912221851s186a2aa4yf3fe63ccbba7be44@mail.gmail.com> From: Srinivas Pasupuleti Date: Wed, 23 Dec 2009 16:15:00 -0000 Message-ID: <8f14e1ab0912230812i1f5a09a5n412beacbf99fa0e8@mail.gmail.com> Subject: Re: Question on Gimple Tree To: Ian Lance Taylor Cc: gcc-help Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00327.txt.bz2 Thanks Ian for your prompt response. So, what is the alternate way to do memory read/write profiling....I'm aware of CIL source transformation package which allows to log memory reads and memory writes.. Is something similar possible to do in GCC... Do I have to work on AST level instead of GIMPLE and include statements to log all memory reads and writes? Please suggest. Thanks, Srinivas On Wed, Dec 23, 2009 at 10:16 AM, Ian Lance Taylor wrote: > 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. >> >> =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. =A0You will have to > create a real, albeit temporary, variable and assign the gimple > variable to it. =A0If you want your function to change the value of the > variable, you will have to copy the value back as well. > > Ian >