From patchwork Thu Sep 30 18:01:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 66208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 98DCEB70A5 for ; Fri, 1 Oct 2010 04:04:50 +1000 (EST) Received: (qmail 10055 invoked by alias); 30 Sep 2010 18:03:04 -0000 Received: (qmail 9831 invoked by uid 22791); 30 Sep 2010 18:03:02 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_SV, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Sep 2010 18:02:53 +0000 Received: by gxk10 with SMTP id 10so993056gxk.20 for ; Thu, 30 Sep 2010 11:02:52 -0700 (PDT) Received: by 10.101.59.14 with SMTP id m14mr4672917ank.127.1285869772006; Thu, 30 Sep 2010 11:02:52 -0700 (PDT) Received: from napoca ([163.181.251.115]) by mx.google.com with ESMTPS id t24sm159499ano.12.2010.09.30.11.02.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 30 Sep 2010 11:02:51 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Thu, 30 Sep 2010 13:02:49 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com Subject: [PATCH 21/44] Also handle ARRAY_REFs in instantiate_scev_r. Date: Thu, 30 Sep 2010 13:01:13 -0500 Message-Id: <1285869696-10915-22-git-send-email-sebpop@gmail.com> In-Reply-To: <1285869696-10915-1-git-send-email-sebpop@gmail.com> References: <1285869696-10915-1-git-send-email-sebpop@gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org From: spop 2010-08-20 Sebastian Pop * tree-scalar-evolution.c (instantiate_array_ref): New. (instantiate_scev_r): Also handle ARRAY_REFs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@163431 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/ChangeLog.graphite | 5 +++++ gcc/tree-scalar-evolution.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 0 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91a74e6..2a40d9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2010-09-30 Sebastian Pop + * tree-scalar-evolution.c (instantiate_array_ref): New. + (instantiate_scev_r): Also handle ARRAY_REFs. + +2010-09-30 Sebastian Pop + * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and FIELD_DECL. Return false for an diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index ea6bb12..0cc7fa0 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,10 @@ 2010-08-20 Sebastian Pop + * tree-scalar-evolution.c (instantiate_array_ref): New. + (instantiate_scev_r): Also handle ARRAY_REFs. + +2010-08-20 Sebastian Pop + * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Do not check for VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and FIELD_DECL. Return false for an diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index a7e165a..8a5797e 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -2337,6 +2337,41 @@ instantiate_scev_binary (basic_block instantiate_below, /* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW and EVOLUTION_LOOP, that were left under a symbolic form. + "CHREC" is an array reference to be instantiated. + + CACHE is the cache of already instantiated values. + + FOLD_CONVERSIONS should be set to true when the conversions that + may wrap in signed/pointer type are folded, as long as the value of + the chrec is preserved. + + SIZE_EXPR is used for computing the size of the expression to be + instantiated, and to stop if it exceeds some limit. */ + +static tree +instantiate_array_ref (basic_block instantiate_below, + struct loop *evolution_loop, tree chrec, + bool fold_conversions, htab_t cache, int size_expr) +{ + tree res; + tree index = TREE_OPERAND (chrec, 1); + tree op1 = instantiate_scev_r (instantiate_below, evolution_loop, index, + fold_conversions, cache, size_expr); + + if (op1 == chrec_dont_know) + return chrec_dont_know; + + if (chrec && op1 == index) + return chrec; + + res = unshare_expr (chrec); + TREE_OPERAND (res, 1) = op1; + return res; +} + +/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW + and EVOLUTION_LOOP, that were left under a symbolic form. + "CHREC" that stands for a convert expression "(TYPE) OP" is to be instantiated. @@ -2613,6 +2648,10 @@ instantiate_scev_r (basic_block instantiate_below, case SCEV_KNOWN: return chrec_known; + case ARRAY_REF: + return instantiate_array_ref (instantiate_below, evolution_loop, chrec, + fold_conversions, cache, size_expr); + default: break; }