From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4874 invoked by alias); 6 Jan 2014 12:20:28 -0000 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 Received: (qmail 4851 invoked by uid 89); 6 Jan 2014 12:20:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-ee0-f43.google.com Received: from mail-ee0-f43.google.com (HELO mail-ee0-f43.google.com) (74.125.83.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 06 Jan 2014 12:20:26 +0000 Received: by mail-ee0-f43.google.com with SMTP id c13so7789373eek.16 for ; Mon, 06 Jan 2014 04:20:23 -0800 (PST) X-Received: by 10.14.194.131 with SMTP id m3mr88757109een.2.1389010823522; Mon, 06 Jan 2014 04:20:23 -0800 (PST) Received: from [192.168.178.20] (p54958665.dip0.t-ipconnect.de. [84.149.134.101]) by mx.google.com with ESMTPSA id 4sm170475243eed.14.2014.01.06.04.20.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 Jan 2014 04:20:23 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: Finding a relevant place for a custom GCC pass From: Richard Biener Date: Mon, 06 Jan 2014 12:20:00 -0000 To: Sandeep K Chaudhary ,"gcc-help@gcc.gnu.org" CC: gcc@gcc.gnu.org Message-ID: X-SW-Source: 2014-01/txt/msg00012.txt.bz2 Sandeep K Chaudhary wrote: >Thanks for the reply Marc ! > >If I place my pass before ccp then I guess I have to implement the >means to perform calculations on my own so that it can duplicate the >functionality of ccp, right? I will also look at the source code to >see if I can modify the source code directly. Is pass_ccp in >tree-ssa-ccp.c the correct one to look at? Please let me know. Yes. You want to look at the il before substitute_and_fold together with the ccp lattice. Richard. >Yes, I have tried the second option you suggested. It's not convenient >for my purpose. > >Thanks and regards, >Sandeep. > >On Sun, Jan 5, 2014 at 10:24 PM, Marc Glisse >wrote: >> On Sun, 5 Jan 2014, Sandeep K Chaudhary wrote: >> >>> Hi guys, >>> >>> I want to write a pass which can find the calculations performed on >>> the right hand side of each statement. In the below example - >>> >>> VAR1 = 1; >>> VAR1++; >>> VAR1 = VAR1 + 5; >>> >>> I want to be able to capture the equivalent statements i.e. >>> >>> VAR1 = 1; >>> VAR1 = 2; >>> VAR1 = 7; >>> >>> To achieve this, I dumped various intermediate files using >>> "-fdump-tree-all'. I looked at all of them manually and found that >>> either the statements are non-evaluated (during initial stages) or >>> they are completely optimized, hence losing the intermediate >>> assignment calculations (during later stages). There is no pass >which >>> generates dumps related to the intermediate assignment calculations. >>> >>> I am not able to understand where I should aim to place my pass in >>> order to achieve the above mentioned functionality. Initially, I had >>> thought of writing IPA pass but I looked at 'copyprop' and >'forwprop' >>> dumps and saw that everything is optimized to the last statement. I >am >>> not able to understand how a pass should be placed between GIMPLE >>> stage and later stages so that intermediate calculations such as the >>> ones mentioned above in the example, can be captured. Please provide >>> suggestions and help regarding this. >> >> >> Short answer: you can't. >> >> You can either have your passe before ccp, and duplicate the >functionality >> of ccp, or you can hack the ccp pass to insert your code in it, but I >doubt >> there is a suitable plugin hook for that, so you may have to edit >gcc's >> source code directly. >> >> If you compile with -g and look at debug statements, the information >is not >> completely lost after the pass that optimizes this to just VAR1 = 7, >but it >> still wouldn't be convenient to use that for your purpose. >> >> -- >> Marc Glisse