From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25119 invoked by alias); 16 Nov 2012 13:13:47 -0000 Received: (qmail 24892 invoked by uid 22791); 16 Nov 2012 13:13:46 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-ee0-f47.google.com (HELO mail-ee0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Nov 2012 13:13:41 +0000 Received: by mail-ee0-f47.google.com with SMTP id l10so1684233eei.20 for ; Fri, 16 Nov 2012 05:13:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=SdCVufngcXLDT/MGiIf5hDKupfIaMGCNKNQMI5ithuU=; b=Ulf0mVIOXX426/VpHE45iX0cFfmE7Rys57CixRUYWu7Mqxh41UPxmdgc8/rMGwZ8Mj 4suUFqLTZk8bvU7z0TOajmh28IkYHQ5ibFPp7zG+QEzvsRj6wfpZf7jCjnCP2ax0hKDU GSqgsi6L7T0AdOkMFlJUCVk/2m+HoMcH9uCMNdUuz3AFtkgm7UQ2+4E9gpRMO5tYHAke Cz7Gw0LPbw0Q9RMy/kwbdBY6O+XIoCe37ciT7zs52ztDYPHSi2mlNsi6ItOStfHPHvUh 8XhYZnsIEbo8TKtZhtUemYksl4iHOa3mw+aIo4KyUVSUNN2Vs6QdHD42a4GT0GArrssV M6iQ== MIME-Version: 1.0 Received: by 10.14.194.71 with SMTP id l47mr13503133een.6.1353071619937; Fri, 16 Nov 2012 05:13:39 -0800 (PST) Received: by 10.223.161.9 with HTTP; Fri, 16 Nov 2012 05:13:39 -0800 (PST) In-Reply-To: References: Date: Fri, 16 Nov 2012 13:13:00 -0000 Message-ID: Subject: Re: Simplifying Gimple Generation From: Diego Novillo To: Xinliang David Li Cc: Lawrence Crowl , "gcc@gcc.gnu.org" Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnY8uw1FIJkf1nGrJRnuhPK0fgrVDr3iYsatkKIh7BQbjjI2jZcfIyyEmstniM0PKpYD9Al+cWtqlNEBNiwTcgCpEiOu2D2BP4LR3NQfwtDVL/CR7nfQ6X6PJf09wvbJcnQ7g+pxgPsEKh+F6gT6rtvxS9l0D36YsrCQ9fwxC28ZYAhceM1I5mqAM6KDRfecLVgvX6V X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00250.txt.bz2 On Thu, Nov 15, 2012 at 2:31 AM, Xinliang David Li wrote: >> ssa_stmt t = q.stmt (NE_EXPR, shadow, 0); >> ssa_stmt a = q.stmt (BIT_AND_EXPR, base_addr, 7); >> ssa_stmt b = q.stmt (shadow_type, a); >> ssa_stmt c = q.stmt (PLUS_EXPR, b, offset); >> ssa_stmt d = q.stmt (GE_EXPR, c, shadow); >> ssa_stmt e = q.stmt (BIT_AND_EXPR, t, d); > > > seq_seq::stmt(...) sounds like a getter interface, not a creator. Sure. They could be named new_stmt() or build_stmt() or something similar. > x = q.new_assignment (...); > x = q.new_call (..); > x.add_arg(..); > x = q.new_icall (..); > > l1 = q.new_label ("xx"); > l2 = q.new_label ("xxx"); > join_l = q.new_label ("..."); > > x = new_if_then_else (cond, l1, l2, join_l); > q.insert_label (l1); > q.new_assignment (...); > q.insert_label(l2); > ... > q.insert_label(join_l); > q.close_if_then_else(x); What I was thinking for if_then_else constructs was something along the lines of: stmt_seq then_body(s1); then_body.add_stmt(s2); stmt_seq else_body(r1); else_body.add_stmt(r2); stmt if_then_else(cond, then_body, else_body); You can then take 'if_then_else' and insert it inside a basic block or an edge. When that happens, the builder takes care of the block/edge splitting for you. >> .. The statement result type is that of the arguments. >> >> .. The type of integral constant arguments is that of the other >> argument. (Which implies that only one argument can be constant.) >> >> .. The 'stmt' method handles linking the statement into the sequence. >> >> .. The 'set_location' method iterates over all statements. >> >> There will be another class of builders for generating GIMPLE >> in normal form (gimple_stmt). We expect that this will mostly >> affect all transformations that need to generate new expressions >> and statements, like instrumentation passes. > > What are the uses of the raw forms? Sorry, what are these "raw forms" that you refer to? >> tree inttype = build_nonstandard_integer_type (POINTER_SIZE, 1); >> record_builder rec ("__asan_global"); >> rec.field ("__beg", const_ptr_type_node); >> rec.field ("__size", inttype); >> rec.field ("__size_with_redzone", inttype); >> rec.field ("__name", const_ptr_type_node); >> rec.field ("__has_dynamic_init", inttype); >> rec.finish (); >> tree ret = rec.as_tree (); > > Again, something like new_field or add_field is more intuitive. Sure. Diego.