From patchwork Mon Oct 25 19:29:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 69170 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 66818B70A8 for ; Tue, 26 Oct 2010 15:32:22 +1100 (EST) Received: (qmail 5148 invoked by alias); 26 Oct 2010 04:32:19 -0000 Received: (qmail 5134 invoked by uid 22791); 26 Oct 2010 04:32:18 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (140.186.70.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Oct 2010 04:32:14 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PASjj-0005FU-N8 for gcc-patches@gcc.gnu.org; Mon, 25 Oct 2010 15:29:40 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:47334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PASjj-0005FB-Ec for gcc-patches@gcc.gnu.org; Mon, 25 Oct 2010 15:29:39 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id DAF46CB02D4 for ; Mon, 25 Oct 2010 21:29:30 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PgzVQnvIckeh for ; Mon, 25 Oct 2010 21:29:30 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id B56FDCB0253 for ; Mon, 25 Oct 2010 21:29:30 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fold result of invert_truthvalue Date: Mon, 25 Oct 2010 21:29:15 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201010252129.15993.ebotcazou@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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 invert_truthvalue doesn't fold the result of comparisons, it only inverts them so it is sometimes desirable to call fold afterward. Tested on i586-suse-linux, applied on the mainline. 2010-10-25 Eric Botcazou * gcc-interface/utils2.c: Include flags.h and remove prototypes. (build_unary_op) : When not optimizing, fold the result of the call to invert_truthvalue_loc. * gcc-interface/Make-lang.in (utils2.o): Add $(FLAGS_H). Index: gcc-interface/Make-lang.in =================================================================== --- gcc-interface/Make-lang.in (revision 165926) +++ gcc-interface/Make-lang.in (working copy) @@ -1264,7 +1264,7 @@ ada/utils.o : ada/gcc-interface/utils.c $(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@ ada/utils2.o : ada/gcc-interface/utils2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(TREE_H) output.h $(TREE_INLINE_H) \ + $(TM_H) $(TREE_H) $(FLAGS_H) output.h $(TREE_INLINE_H) \ ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/elists.h ada/namet.h \ ada/nlists.h ada/snames.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h \ ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h Index: gcc-interface/utils2.c =================================================================== --- gcc-interface/utils2.c (revision 165926) +++ gcc-interface/utils2.c (working copy) @@ -28,6 +28,7 @@ #include "coretypes.h" #include "tm.h" #include "tree.h" +#include "flags.h" #include "ggc.h" #include "output.h" #include "tree-inline.h" @@ -47,11 +48,6 @@ #include "ada-tree.h" #include "gigi.h" -static tree find_common_type (tree, tree); -static tree compare_arrays (tree, tree, tree); -static tree nonbinary_modular_operation (enum tree_code, tree, tree, tree); -static tree build_simple_component_ref (tree, tree, tree, bool); - /* Return the base type of TYPE. */ tree @@ -1024,6 +1020,11 @@ build_unary_op (enum tree_code op_code, gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); #endif result = invert_truthvalue_loc (EXPR_LOCATION (operand), operand); + /* When not optimizing, fold the result as invert_truthvalue_loc + doesn't fold the result of comparisons. This is intended to undo + the trick used for boolean rvalues in gnat_to_gnu. */ + if (!optimize) + result = fold (result); break; case ATTR_ADDR_EXPR: