From patchwork Sun Aug 3 14:03:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376028 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 654B914009B for ; Mon, 4 Aug 2014 00:04:04 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=YTyohpjBzJYeoGB6gDyUiFo5q4MYE 3w9X9VXdZpu4pIVMHzpzXGogqPcisE9HgFOl7hJTFp4WSYwotNDUhpobyiPjJOM6 Q1TiITw/F9v8Bn6JLPyXndPUbAUZWoRu3lIBXLkQoraJzK+iiZxjGroXFjd8j+fv zdFkrn/dS+aXdc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=XRR8NgmH6t6MxE9BowU15PEuYhE=; b=Juy HsTJ55YVxiE291oLhybtDu5qciuvooU4b8DbqL9bEgkaguAd34tXDFz9tyfZZNyK rPkJSVF2xqqhLeKerE5dw3ZrjzF7X+8cLR8gOzzxHloKciaB4XJjxZYOHNG/eEhk 5+QoRonK3llo3I6LmMrXnur9eM0vClO8I2FQ7sSg= Received: (qmail 32409 invoked by alias); 3 Aug 2014 14:03:58 -0000 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 Received: (qmail 32396 invoked by uid 89); 3 Aug 2014 14:03:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wg0-f48.google.com Received: from mail-wg0-f48.google.com (HELO mail-wg0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 14:03:56 +0000 Received: by mail-wg0-f48.google.com with SMTP id x13so6448745wgg.7 for ; Sun, 03 Aug 2014 07:03:53 -0700 (PDT) X-Received: by 10.194.63.37 with SMTP id d5mr24205552wjs.92.1407074633863; Sun, 03 Aug 2014 07:03:53 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id r20sm30259819wik.0.2014.08.03.07.03.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 07:03:53 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 19/50] dwarf2out.c:const_ok_for_output References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 15:03:52 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <87oaw1acvr.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * dwarf2out.c: Include rtl-iter.h. (const_ok_for_output_1): Take the rtx instead of a pointer to it. Remove unused data parameter. Return a bool, inverting the result so that 0/false means "not ok". (const_ok_for_output): Update accordingly. Use FOR_EACH_SUBRTX_VAR instead of for_each_rtx. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c 2014-08-03 11:25:10.105956090 +0100 +++ gcc/dwarf2out.c 2014-08-03 11:25:25.454107831 +0100 @@ -98,6 +98,7 @@ Software Foundation; either version 3, o #include "opts.h" #include "tree-dfa.h" #include "gdb/gdb-index.h" +#include "rtl-iter.h" static void dwarf2out_source_line (unsigned int, const char *, int, bool); static rtx last_var_location_insn; @@ -11433,14 +11434,11 @@ expansion_failed (tree expr, rtx rtl, ch } } -/* Helper function for const_ok_for_output, called either directly - or via for_each_rtx. */ +/* Helper function for const_ok_for_output. */ -static int -const_ok_for_output_1 (rtx *rtlp, void *data ATTRIBUTE_UNUSED) +static bool +const_ok_for_output_1 (rtx rtl) { - rtx rtl = *rtlp; - if (GET_CODE (rtl) == UNSPEC) { /* If delegitimize_address couldn't do anything with the UNSPEC, assume @@ -11468,14 +11466,14 @@ const_ok_for_output_1 (rtx *rtlp, void * #endif expansion_failed (NULL_TREE, rtl, "UNSPEC hasn't been delegitimized.\n"); - return 1; + return false; } if (targetm.const_not_ok_for_debug_p (rtl)) { expansion_failed (NULL_TREE, rtl, "Expression rejected for debug by the backend.\n"); - return 1; + return false; } /* FIXME: Refer to PR60655. It is possible for simplification @@ -11486,9 +11484,8 @@ const_ok_for_output_1 (rtx *rtlp, void * if (GET_CODE (rtl) != SYMBOL_REF) { if (GET_CODE (rtl) == NOT) - return 1; - - return 0; + return false; + return true; } if (CONSTANT_POOL_ADDRESS_P (rtl)) @@ -11501,12 +11498,12 @@ const_ok_for_output_1 (rtx *rtlp, void * { expansion_failed (NULL_TREE, rtl, "Constant was removed from constant pool.\n"); - return 1; + return false; } } if (SYMBOL_REF_TLS_MODEL (rtl) != TLS_MODEL_NONE) - return 1; + return false; /* Avoid references to external symbols in debug info, on several targets the linker might even refuse to link when linking a shared library, @@ -11521,11 +11518,11 @@ const_ok_for_output_1 (rtx *rtlp, void * { expansion_failed (NULL_TREE, rtl, "Symbol not defined in current TU.\n"); - return 1; + return false; } } - return 0; + return true; } /* Return true if constant RTL can be emitted in DW_OP_addr or @@ -11536,10 +11533,16 @@ const_ok_for_output_1 (rtx *rtlp, void * const_ok_for_output (rtx rtl) { if (GET_CODE (rtl) == SYMBOL_REF) - return const_ok_for_output_1 (&rtl, NULL) == 0; + return const_ok_for_output_1 (rtl); if (GET_CODE (rtl) == CONST) - return for_each_rtx (&XEXP (rtl, 0), const_ok_for_output_1, NULL) == 0; + { + subrtx_var_iterator::array_type array; + FOR_EACH_SUBRTX_VAR (iter, array, XEXP (rtl, 0), ALL) + if (!const_ok_for_output_1 (*iter)) + return false; + return true; + } return true; }