From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104054 invoked by alias); 14 Nov 2018 12:00:54 -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 104007 invoked by uid 89); 14 Nov 2018 12:00:52 -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=39am, 39AM 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 12:00:50 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEF4E5F724; Wed, 14 Nov 2018 12:00:46 +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 8E8E75D75C; Wed, 14 Nov 2018 12:00:46 +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 wAEC0iTQ024643; Wed, 14 Nov 2018 13:00:44 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wAEC0hfA024642; Wed, 14 Nov 2018 13:00:43 +0100 Date: Wed, 14 Nov 2018 12:00: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: <20181114120043.GR11625@tucnak> Reply-To: Jakub Jelinek References: <20181114094757.GO11625@tucnak> <20181114113505.GW23873@gate.crashing.org> <20181114114001.GQ11625@tucnak> <20181114115038.GX23873@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181114115038.GX23873@gate.crashing.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg01226.txt.bz2 On Wed, Nov 14, 2018 at 05:50:39AM -0600, Segher Boessenkool wrote: > > 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. > > I was thinking put them in pseudos always, just copy them to the hard reg > right before the asm statements that use them (and the other way around, > for outputs). Wouldn't that break all the code that does: void * retsp (void) { register void *sp __asm ("sp"); return sp; } (or any other (usually fixed) reg, where the user code expects to just read the value of that register)? Storing uninitialized value into it would break the program miserably. Jakub