From patchwork Thu Feb 26 10:27:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 443881 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 4A33014008F for ; Thu, 26 Feb 2015 21:27:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HQLVDRVE; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=OABIenRooRhUG/NP K99mj4qQVSRZLPjjPlWCaQyLGhJNt3fpJYrKo2SGqx3XhhVtCrwPvphzaCHRTL4G RfBtp90cqhjrl69dU1lRt88Sy0oyTOcR+Ogo45SPsYn87O6jYBUknSBxZiwKN4XW w3tJx5RGGKRYs1DRnDrLbm7B5WA= 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:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=s1PbZ6RfI5u+dzkMmSFtOH U1eI8=; b=HQLVDRVElW66VD+ZNW+t+QIDbI2Cwo+LcaQtSzAvXRq/N/WRVx+FnX 4nZNuO4Rh6gdW/fhZ59RYZnHcEck7cFGsoJijcwjY1L3/OIbH3YHaCDbCP+XcI38 EA7QDjC3ICWEZBKiMSLUADv3kvn+MCL2sySQPrb7V3e++dfto1GV8= Received: (qmail 34509 invoked by alias); 26 Feb 2015 10:27:32 -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 34255 invoked by uid 89); 26 Feb 2015 10:27:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Feb 2015 10:27:28 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-03.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YQvf9-0000so-Ee from Thomas_Schwinge@mentor.com ; Thu, 26 Feb 2015 02:27:24 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-03.mgc.mentorg.com (137.202.0.108) with Microsoft SMTP Server id 14.3.224.2; Thu, 26 Feb 2015 10:27:21 +0000 From: Thomas Schwinge To: Jakub Jelinek , Bernd Schmidt CC: GCC Patches Subject: var-tracking vs. pseudo registers (was: Option overriding in the offloading code path) In-Reply-To: <20150225170054.GV1746@tucnak.redhat.com> References: <5454CDF1.3070307@codesourcery.com> <87fvacld85.fsf@kepler.schwinge.homeip.net> <87a90klcyb.fsf@kepler.schwinge.homeip.net> <87mw429tfn.fsf@kepler.schwinge.homeip.net> <20150225170054.GV1746@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Thu, 26 Feb 2015 11:27:06 +0100 Message-ID: <87vbipge85.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Wed, 25 Feb 2015 18:00:54 +0100, Jakub Jelinek wrote: > On Wed, Feb 25, 2015 at 11:28:12AM +0100, Thomas Schwinge wrote: > > Am I on the right track with my assumption that it is correct that > > nvptx.c:nvptx_option_override is not invoked in the offloading code path, > > so we'd need a new target hook (?) to consolidate/override the options in > > this scenario? > > > > > > Using this to forcefully disable -fvar-tracking (as done in > > nvptx_option_override), should then allow me to drop the following > > beautiful specimen of a patch (which I didn't commit anywhere, so far): > > Supposedly you could just disable var-tracking for > targetm.no_register_allocation case, or change that assert to > allow pseudos for targetm.no_register_allocation? Just changing the assert, or handling this configuration differently: > Anyway, if var-tracking is never useful for NVPTX, if you want to override > it early, flag_var_tracking* options are Optimization options, thus you'd > need a target hook similar to the one I've added today, but instead of > TARGET_OPTION_NODE do something similar for OPTIMIZATION_NODE streaming. Grüße, Thomas diff --git gcc/var-tracking.c gcc/var-tracking.c index 9ec5d8b..e37dc19 100644 --- gcc/var-tracking.c +++ gcc/var-tracking.c @@ -1854,6 +1854,7 @@ var_reg_decl_set (dataflow_set *set, rtx loc, enum var_init_status initialized, if (decl_p) dv = dv_from_decl (var_debug_decl (dv_as_decl (dv))); + gcc_assert (REGNO (loc) < FIRST_PSEUDO_REGISTER); for (node = set->regs[REGNO (loc)]; node; node = node->next) if (dv_as_opaque (node->dv) == dv_as_opaque (dv) && node->offset == offset) @@ -1925,6 +1926,7 @@ var_reg_delete_and_set (dataflow_set *set, rtx loc, bool modify, if (initialized == VAR_INIT_STATUS_UNKNOWN) initialized = get_init_value (set, loc, dv_from_decl (decl)); + gcc_assert (REGNO (loc) < FIRST_PSEUDO_REGISTER); nextp = &set->regs[REGNO (loc)]; for (node = *nextp; node; node = next) { @@ -1954,6 +1956,7 @@ var_reg_delete_and_set (dataflow_set *set, rtx loc, bool modify, static void var_reg_delete (dataflow_set *set, rtx loc, bool clobber) { + gcc_assert (REGNO (loc) < FIRST_PSEUDO_REGISTER); attrs *nextp = &set->regs[REGNO (loc)]; attrs node, next; @@ -1986,6 +1989,7 @@ var_reg_delete (dataflow_set *set, rtx loc, bool clobber) static void var_regno_delete (dataflow_set *set, int regno) { + gcc_assert (regno < FIRST_PSEUDO_REGISTER); attrs *reg = &set->regs[regno]; attrs node, next; @@ -2630,6 +2634,7 @@ val_resolve (dataflow_set *set, rtx val, rtx loc, rtx_insn *insn) { attrs node, found = NULL; + gcc_assert (REGNO (loc) < FIRST_PSEUDO_REGISTER); for (node = set->regs[REGNO (loc)]; node; node = node->next) if (dv_is_value_p (node->dv) && GET_MODE (dv_as_value (node->dv)) == GET_MODE (loc)) @@ -3784,6 +3789,7 @@ canonicalize_values_star (variable_def **slot, dataflow_set *set) } else if (GET_CODE (node->loc) == REG) { + gcc_assert (REGNO (node->loc) < FIRST_PSEUDO_REGISTER); attrs list = set->regs[REGNO (node->loc)], *listp; /* Change an existing attribute referring to dv so that it @@ -4045,6 +4051,7 @@ variable_merge_over_cur (variable s1var, struct dfset_merge *dsm) { attrs list; + gcc_assert (REGNO (node->loc) < FIRST_PSEUDO_REGISTER); for (list = dst->regs[REGNO (node->loc)]; list; list = list->next) if (GET_MODE (node->loc) == GET_MODE (list->loc) && dv_is_value_p (list->dv)) @@ -4426,6 +4433,7 @@ variable_post_merge_new_vals (variable_def **slot, dfset_post_merge *dfpm) goto restart; } + gcc_assert (REGNO (node->loc) < FIRST_PSEUDO_REGISTER); for (attp = &set->regs[REGNO (node->loc)]; (att = *attp); attp = &att->next) if (att->offset == 0 @@ -4466,6 +4474,7 @@ variable_post_merge_new_vals (variable_def **slot, dfset_post_merge *dfpm) dataflow_set_init (*dfpm->permp); } + gcc_assert (REGNO (node->loc) < FIRST_PSEUDO_REGISTER); for (att = (*dfpm->permp)->regs[REGNO (node->loc)]; att; att = att->next) if (GET_MODE (att->loc) == GET_MODE (node->loc)) @@ -4561,6 +4570,7 @@ variable_post_merge_perm_vals (variable_def **pslot, dfset_post_merge *dfpm) val_reset (set, dv); } + gcc_assert (REGNO (pnode->loc) < FIRST_PSEUDO_REGISTER); for (att = set->regs[REGNO (pnode->loc)]; att; att = att->next) if (att->offset == 0 && GET_MODE (att->loc) == GET_MODE (pnode->loc) @@ -7837,6 +7853,7 @@ clobber_slot_part (dataflow_set *set, rtx loc, variable_def **slot, list, but preserve any other variable parts that might be regarded as live in that same register. */ + gcc_assert (REGNO (node->loc) < FIRST_PSEUDO_REGISTER); anextp = &set->regs[REGNO (node->loc)]; for (anode = *anextp; anode; anode = anext) {