From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3268 invoked by alias); 14 Nov 2018 11:40:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3248 invoked by uid 89); 14 Nov 2018 11:40:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ssa, SSA X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Nov 2018 11:40:07 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 979FE30024E1; Wed, 14 Nov 2018 11:40:05 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-75.ams2.redhat.com [10.36.116.75]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2466A100190B; Wed, 14 Nov 2018 11:40:04 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id wAEBe37Z024524; Wed, 14 Nov 2018 12:40:03 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wAEBe2HU024523; Wed, 14 Nov 2018 12:40:02 +0100 Date: Wed, 14 Nov 2018 11:40:00 -0000 From: Jakub Jelinek To: Segher Boessenkool Cc: Martin Sebor , Gcc Patch List Subject: Re: [PATCH] diagnose unsupported uses of hardware register variables (PR 88000) Message-ID: <20181114114001.GQ11625@tucnak> Reply-To: Jakub Jelinek References: <20181114094757.GO11625@tucnak> <20181114113505.GW23873@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181114113505.GW23873@gate.crashing.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg01196.txt.bz2 On Wed, Nov 14, 2018 at 05:35:06AM -0600, Segher Boessenkool wrote: > On Wed, Nov 14, 2018 at 10:47:57AM +0100, Jakub Jelinek wrote: > > This makes no sense to me. There is nothing unsupported in passing > > a local hard register variable to a function, that is well defined, > > and as your testcase changes show, you broke quite some completely valid > > testcases with that. > > What could perhaps be useful is a warning for a local register var that > is not used in any asm? > > > What doesn't work as the reporter expect is assumption that local hard > > register variables that live across function calls must have their values > > preserved; they can be modified by the callees. > > It would be really nice if we could fix that :-) You mean for all local hard register variables living across function calls save them into temporary and restore them around the calls? One issue is that those variables aren't in SSA form, so liveness analysis is harder. And, would we want to have an exception for the stack pointer? I mean there is no need for register void *sp __asm ("rsp"); to be saved/restored that way, it shouldn't change value across function calls. Plus, as has been mentioned, function calls aren't the only issue here, e.g. division/modulo etc. that require specific hard registers might clobber them too. Jakub