From patchwork Thu Sep 9 19:30:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 64323 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 BF170B70EF for ; Fri, 10 Sep 2010 05:31:10 +1000 (EST) Received: (qmail 5973 invoked by alias); 9 Sep 2010 19:30:47 -0000 Received: (qmail 5900 invoked by uid 22791); 9 Sep 2010 19:30:46 -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, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Sep 2010 19:30:40 +0000 Received: by yxg6 with SMTP id 6so312746yxg.20 for ; Thu, 09 Sep 2010 12:30:38 -0700 (PDT) Received: by 10.151.17.4 with SMTP id u4mr708766ybi.346.1284060638609; Thu, 09 Sep 2010 12:30:38 -0700 (PDT) Received: from napoca ([163.181.251.115]) by mx.google.com with ESMTPS id t16sm1689433ybm.10.2010.09.09.12.30.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Sep 2010 12:30:38 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Thu, 09 Sep 2010 14:30:35 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, Sebastian Pop Subject: [PATCH 4/8] Outline lst_niter_for_loop. Date: Thu, 9 Sep 2010 14:30:02 -0500 Message-Id: <1284060606-26216-4-git-send-email-sebpop@gmail.com> In-Reply-To: <1284060606-26216-1-git-send-email-sebpop@gmail.com> References: <1284060606-26216-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 2010-09-09 Sebastian Pop * graphite-blocking.c (pbb_strip_mine_profitable_p): Renamed lst_strip_mine_profitable_p. Call lst_niter_for_loop. * graphite-poly.h (lst_niter_for_loop): New. --- gcc/ChangeLog.graphite | 6 ++++++ gcc/graphite-blocking.c | 17 ++++++++--------- gcc/graphite-poly.h | 13 +++++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 46dd03b..831c2fe 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,11 @@ 2010-09-09 Sebastian Pop + * graphite-blocking.c (pbb_strip_mine_profitable_p): Renamed + lst_strip_mine_profitable_p. Call lst_niter_for_loop. + * graphite-poly.h (lst_niter_for_loop): New. + +2010-09-09 Sebastian Pop + * graphite-poly.c (apply_poly_transforms): Do not abort when the transform read from disk is not legal. Call fatal_error instead. diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c index 6e4334a..3951b60 100644 --- a/gcc/graphite-blocking.c +++ b/gcc/graphite-blocking.c @@ -172,25 +172,25 @@ pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride) return true; } -/* Returns true when strip mining with STRIDE of the loop around PBB - at DEPTH is profitable. */ +/* Returns true when strip mining with STRIDE of the loop LST is + profitable. */ static bool -pbb_strip_mine_profitable_p (poly_bb_p pbb, - graphite_dim_t depth, - int stride) +lst_strip_mine_profitable_p (lst_p lst, int stride) { mpz_t niter, strip_stride; bool res; + gcc_assert (LST_LOOP_P (lst)); mpz_init (strip_stride); mpz_init (niter); + mpz_set_si (strip_stride, stride); - pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter); + lst_niter_for_loop (lst, niter); res = (mpz_cmp (niter, strip_stride) > 0); + mpz_clear (strip_stride); mpz_clear (niter); - return res; } @@ -244,8 +244,7 @@ lst_do_strip_mine (lst_p lst) depth = lst_depth (lst); if (depth >= 0 - && pbb_strip_mine_profitable_p (LST_PBB (lst_find_first_pbb (lst)), - depth, stride)) + && lst_strip_mine_profitable_p (lst, stride)) { res |= lst_do_strip_mine_loop (lst, lst_depth (lst)); lst_add_loop_under_loop (lst); diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 5ed1b04..5f536a8 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -1062,6 +1062,19 @@ lst_remove_from_sequence (lst_p lst) LST_LOOP_FATHER (lst) = NULL; } +/* Sets NITER to the upper bound approximation of the number of + iterations of loop LST. */ + +static inline void +lst_niter_for_loop (lst_p lst, mpz_t niter) +{ + int depth = lst_depth (lst); + poly_bb_p pbb = LST_PBB (lst_find_first_pbb (lst)); + + gcc_assert (LST_LOOP_P (lst)); + pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter); +} + /* Updates the scattering of PBB to be at the DEWEY number in the loop at depth LEVEL. */