From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26502 invoked by alias); 16 Dec 2013 21:10:49 -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 26478 invoked by uid 89); 16 Dec 2013 21:10:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wg0-f46.google.com Received: from mail-wg0-f46.google.com (HELO mail-wg0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 16 Dec 2013 21:10:47 +0000 Received: by mail-wg0-f46.google.com with SMTP id m15so5116397wgh.13 for ; Mon, 16 Dec 2013 13:10:44 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.93.105 with SMTP id ct9mr15684299wjb.6.1387228243916; Mon, 16 Dec 2013 13:10:43 -0800 (PST) Received: by 10.216.82.68 with HTTP; Mon, 16 Dec 2013 13:10:43 -0800 (PST) Date: Mon, 16 Dec 2013 21:10:00 -0000 Message-ID: Subject: GIMPLE pass - Assignment evaluation From: Sandeep K Chaudhary To: "gcc-help@gcc.gnu.org" , gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2013-12/txt/msg00109.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.