From patchwork Thu Jul 21 18:31:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 106135 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 BA247B6F71 for ; Fri, 22 Jul 2011 04:32:20 +1000 (EST) Received: (qmail 21494 invoked by alias); 21 Jul 2011 18:32:03 -0000 Received: (qmail 21333 invoked by uid 22791); 21 Jul 2011 18:31:59 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 18:31:38 +0000 Received: by mail-yw0-f47.google.com with SMTP id 12so890164ywa.20 for ; Thu, 21 Jul 2011 11:31:38 -0700 (PDT) Received: by 10.151.148.2 with SMTP id a2mr986137ybo.392.1311273098262; Thu, 21 Jul 2011 11:31:38 -0700 (PDT) Received: from napoca (adsl-99-184-92-236.dsl.austtx.sbcglobal.net [99.184.92.236]) by mx.google.com with ESMTPS id o10sm1270633ybl.7.2011.07.21.11.31.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jul 2011 11:31:37 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Thu, 21 Jul 2011 13:31:35 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, tobias@grosser.es, Sebastian Pop Subject: [PATCH 07/10] Remove max_signed_precision_type. Date: Thu, 21 Jul 2011 13:31:07 -0500 Message-Id: <1311273070-12128-8-git-send-email-sebpop@gmail.com> In-Reply-To: <1311273070-12128-1-git-send-email-sebpop@gmail.com> References: <1311273070-12128-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 2011-07-21 Sebastian Pop * graphite-clast-to-gimple.c (max_signed_precision_type): Removed. (max_precision_type): Inline max_signed_precision_type. (type_for_clast_red): Use max_precision_type. (type_for_clast_bin): Same. (type_for_clast_for): Same. --- gcc/ChangeLog | 8 ++++++ gcc/graphite-clast-to-gimple.c | 51 +++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ae048f..03fe015 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2011-07-21 Sebastian Pop + * graphite-clast-to-gimple.c (max_signed_precision_type): Removed. + (max_precision_type): Inline max_signed_precision_type. + (type_for_clast_red): Use max_precision_type. + (type_for_clast_bin): Same. + (type_for_clast_for): Same. + +2011-07-21 Sebastian Pop + * graphite-clast-to-gimple.c (gcc_type_for_interval): Renamed type_for_interval. (gcc_type_for_value): Renamed type_for_value. diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index b1d682a..495b0b7 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -206,16 +206,27 @@ clast_name_to_gcc (clast_name_p name, ivs_params_p ip) return VEC_index (tree, *(ip->newivs), index); } -/* Returns the signed maximal precision type for expressions TYPE1 and TYPE2. */ +/* Returns the maximal precision type for expressions TYPE1 and TYPE2. */ static tree -max_signed_precision_type (tree type1, tree type2) +max_precision_type (tree type1, tree type2) { - int p1 = TYPE_PRECISION (type1); - int p2 = TYPE_PRECISION (type2); - int precision; - tree type; enum machine_mode mode; + int p1, p2, precision; + tree type; + + if (POINTER_TYPE_P (type1)) + return type1; + + if (POINTER_TYPE_P (type2)) + return type2; + + if (TYPE_UNSIGNED (type1) + && TYPE_UNSIGNED (type2)) + return TYPE_PRECISION (type1) > TYPE_PRECISION (type2) ? type1 : type2; + + p1 = TYPE_PRECISION (type1); + p2 = TYPE_PRECISION (type2); if (p1 > p2) precision = TYPE_UNSIGNED (type1) ? p1 * 2 : p1; @@ -241,24 +252,6 @@ max_signed_precision_type (tree type1, tree type2) return type; } -/* Returns the maximal precision type for expressions TYPE1 and TYPE2. */ - -static tree -max_precision_type (tree type1, tree type2) -{ - if (POINTER_TYPE_P (type1)) - return type1; - - if (POINTER_TYPE_P (type2)) - return type2; - - if (!TYPE_UNSIGNED (type1) - || !TYPE_UNSIGNED (type2)) - return max_signed_precision_type (type1, type2); - - return TYPE_PRECISION (type1) > TYPE_PRECISION (type2) ? type1 : type2; -} - static tree clast_to_gcc_expression (tree, struct clast_expr *, ivs_params_p); @@ -473,8 +466,8 @@ type_for_clast_red (struct clast_reduction *r, ivs_params_p ip) case clast_red_max: type = type_for_clast_expr (r->elts[0], ip); for (i = 1; i < r->n; i++) - type = max_precision_type (type, type_for_clast_expr - (r->elts[i], ip)); + type = max_precision_type + (type, type_for_clast_expr (r->elts[i], ip)); return type; @@ -493,7 +486,7 @@ type_for_clast_bin (struct clast_binary *b, ivs_params_p ip) { tree l = type_for_clast_expr ((struct clast_expr *) b->LHS, ip); tree r = type_for_value (b->RHS); - return max_signed_precision_type (l, r); + return max_precision_type (l, r); } /* Returns the type for the CLAST expression E when used in statement @@ -688,8 +681,8 @@ type_for_clast_for (struct clast_for *stmt_for, int level, tree lb_type = type_for_clast_expr (stmt_for->LB, ip); tree ub_type = type_for_clast_expr (stmt_for->UB, ip); - return max_signed_precision_type (lb_type, max_precision_type - (ub_type, type_for_level (pbb, level))); + return max_precision_type + (lb_type, max_precision_type (ub_type, type_for_level (pbb, level))); } /* Creates a new LOOP corresponding to Cloog's STMT. Inserts an