From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by sourceware.org (Postfix) with ESMTP id 5472A385800B for ; Fri, 16 Feb 2024 17:01:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5472A385800B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5472A385800B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=78.133.224.34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708102908; cv=none; b=YaOzqd7ghYR32rQQ6qsGgo6YwFDCqFLTC1peJQHKueXqMp2+QL7t6VZe48jtn+VCk9HsBAvsW105qWa5FpR7u5bjpYPU4YfsV6OreVjGy/UcHOg6njiJ86ywODJRmCO/x8JUhlZ4WJF4ju/kARaiEo4UK9wcjId1nngruSFOxV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708102908; c=relaxed/simple; bh=3ZgVxGUGSsT4GHNRPeb8RnXuP79oTVaDfJFUkdqmTcQ=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=kf5AjlYvHshPPzLqxiK0TyjJAgKLzwGM+tqJ6bs9YHZ17wztBGV0LR/aoJmpw1+ZT5z+/7QKHxcQp1mkBpKS0de4XQZwi49hLBRJKjubAbYCigvxvnkzGukPMCSOuddk5ldWwnhSU+6GUTNxZq6sTr+QNqcqIdbdIqoFgLoDj40= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by angie.orcam.me.uk (Postfix, from userid 500) id 8CBB492009C; Fri, 16 Feb 2024 18:01:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 8708A92009B; Fri, 16 Feb 2024 17:01:45 +0000 (GMT) Date: Fri, 16 Feb 2024 17:01:45 +0000 (GMT) From: "Maciej W. Rozycki" To: Jakub Jelinek cc: Segher Boessenkool , Paul Koning , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Turn on LRA on all targets In-Reply-To: Message-ID: References: <283c45ca085ced958cbce6e64331252c83a5899f.1682268126.git.segher@kernel.crashing.org> <20230423203328.GL19790@gate.crashing.org> <2A759520-2D62-472E-A97F-35E09B6E50F5@comcast.net> <20240216134748.GF19790@gate.crashing.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1163.3 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_INFOUSMEBIZ,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 16 Feb 2024, Jakub Jelinek wrote: > > There is no function prologue to optimise in the VAX case, because all > > the frame setup has already been made by the CALLS instruction itself in > > the caller. The first machine instruction of the callee is technically > > already past the "prologue". And then RET serves as the whole function > > "epilogue". > > So, what is the problem with DWARF unwinding? Just make sure to emit > appropriate instructions describing the saving of the corresponding > registers at specific points based on CFA at the start of the function > (so that it appears in CIE instructions) and that should be all that is > needed, no? I may not remember all the issues correctly offhand as it's been a while since I looked into it, but as I recall DWARF handling code has not been prepared for all the frame to have been already allocated and initialised at a function's entry point, and also at least DWARF-4 is IIRC required to have statics at offsets positive from FP (for a stack growing downwards). There was an issue about restoring the caller's value of SP too, which is callee's AP+4*(*AP)+4 (AP being the argument pointer, which is a hardreg, pointing at #arguments), or alternatively it can be calculated as the sum of FP, the fixed frame size (20), the variable frame size (4*#statics, recorded as a register mask in a 12-bit field at *(FP+6)), the #arguments slot (4), and the argument space size (4*#arguments). Obviously the former calculation is easier to make (#arguments has to be zero-extended from bits 7:0). FAOD the #arguments slot is filled by the CALLS instruction at call time and can vary between callers obviously for varargs, but also cases such as open(2), so to reconstruct the caller's SP you always need to examine the actual stack frame, and it does not appear to be supported by libgcc DWARF EH code as it stands. I've left out stack realignment stuff or CALLG instruction support from the consideration above, as we don't handle these features in our psABI, all of which have provisions for from hardware in the stack frame. As I say I may have missed or confused something, and anyway I'll take another stab at it, hopefully soon. Maciej