From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14463 invoked by alias); 9 Dec 2013 23:05:38 -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 14399 invoked by uid 89); 9 Dec 2013 23:05:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f47.google.com Received: from Unknown (HELO mail-wg0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 09 Dec 2013 23:05:36 +0000 Received: by mail-wg0-f47.google.com with SMTP id n12so4187156wgh.14 for ; Mon, 09 Dec 2013 15:05:27 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.37.201 with SMTP id a9mr16553940wik.18.1386630327054; Mon, 09 Dec 2013 15:05:27 -0800 (PST) Received: by 10.216.82.68 with HTTP; Mon, 9 Dec 2013 15:05:27 -0800 (PST) Date: Mon, 09 Dec 2013 23:05:00 -0000 Message-ID: Subject: GIMPLE pass - Assignment evaluation From: Sandeep K Chaudhary To: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2013-12/txt/msg00064.txt.bz2 Hi Guys, I am writing a GIMPLE pass in which I need to inspect the assignments. For example, for the below statements, I need to find the value of the second and third assignments which are '2' and '7'. VAR1 = 1; VAR1++; VAR1 = VAR1 + 5; But the GIMPLE IR only has the following statements i.e. no optimization. VAR1_2 = 1; VAR1_3 = VAR1_2 + 1; VAR1_4 = VAR1_3 + 5; How can I make it perform calculations on RHS? Are there some flags that I can enable? I tried -O1 and higher optimization levels but I don't see any difference. This is how I am building and loading my plugin... g++ -I`g++ -print-file-name=plugin`/include -fPIC -shared -O1 gimple_pass.c -o plugin.so g++ -fplugin=/home/sandeep/myplugin/gimple/plugin.so -O1 -c test.c Also, I thought of going with RTL passes but RTL IR seems too complex for my use and also it's not suitable for high level optimizations. Please suggest. Thanks and regards, Sandeep.