From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51510 invoked by alias); 30 Sep 2015 00:24:18 -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 51496 invoked by uid 89); 30 Sep 2015 00:24:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: resqmta-po-07v.sys.comcast.net Received: from resqmta-po-07v.sys.comcast.net (HELO resqmta-po-07v.sys.comcast.net) (96.114.154.166) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 30 Sep 2015 00:24:17 +0000 Received: from resomta-po-06v.sys.comcast.net ([96.114.154.230]) by resqmta-po-07v.sys.comcast.net with comcast id PCQF1r00B4yXVJQ01CQFWw; Wed, 30 Sep 2015 00:24:15 +0000 Received: from [IPv6:2001:558:6045:a4:40c6:7199:cd03:b02d] ([IPv6:2001:558:6045:a4:40c6:7199:cd03:b02d]) by resomta-po-06v.sys.comcast.net with comcast id PCQD1r00P2ztT3H01CQEx5; Wed, 30 Sep 2015 00:24:14 +0000 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [PATCH] x86 interrupt attribute From: Mike Stump In-Reply-To: Date: Wed, 30 Sep 2015 02:45:00 -0000 Cc: Yulia Koval , GCC Patches , Uros Bizjak Content-Transfer-Encoding: quoted-printable Message-Id: <80A4A50F-5BF9-46E9-8C47-C4354A56544C@comcast.net> References: <2AB9494F-91EC-4CF6-945B-0CB03A583513@comcast.net> <1A59492D-2B14-44C0-97BA-08D8A5406672@comcast.net> To: "H.J. Lu" X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg02288.txt.bz2 On Sep 29, 2015, at 3:40 PM, H.J. Lu wrote: > How about adding a "no_caller_saved_registers" attribute? You can save all call clobbered registers with 3 instructions? Really? I= =92m skeptical. Anyway, if you do this by turning off great swaths of regi= sters, then, I guess that doesn=92t surprise me. I try and not turn any of= f in mine. Now, if you turn off great swaths of registers, then you can=92t actually m= ake any calls to an abi that supports those registers as call clobbered: > + if (cfun->machine->is_interrupt) > + return ((df_regs_ever_live_p (regno) > + || (call_used_regs[regno] && cfun->machine->make_calls)) > + && !fixed_regs[regno] > + && !STACK_REGNO_P (regno) > + && !MMX_REGNO_P (regno) > + && regno !=3D BP_REG > + && regno !=3D SP_REG > + && (regno <=3D ST7_REG || regno >=3D XMM0_REG)); So, any calls to a function that uses any excluded register won=92t work, i= f that register is not fixed and is call clobbered. If you call such a fun= ction, you _must_ save and restore all those registers. Code like: > + if (cfun->machine->is_interrupt && VALID_MMX_REG_MODE (mode)) > + { > + error ("MMX/3Dnow instructions aren't allowed in %s service routin= e", > + (cfun->machine->is_exception ? "exception" : "interrupt")); > + return; > + } Does not save your from the obligation of saving such registers, if you sup= port function calls inside an interrupt routine. Once you add that support= to make function calls work, then, you might as well lift this restriction= , cause it would already just work? If you really can save everything in 3 instructions, then there is no point= to trying to enhance it more on your port. 3 instructions execute so fast= as to not matter. Now, if you ask me how I know all this, I had to debug a failure to save 1 = register class in the prologue from large multi core instruction trace, and= that class was the second most important class for general code gen right = after the gprs. Turns out that I killed a live variable in that class from= a packet handler interrupt routine cause it failed to save/restore. After= that, I tested every register class and fixed all the issues.