X86 Calls marked to clobber RSP. Intended?

Frédéric Riss friss at apple.com
Wed Aug 13 05:59:10 PDT 2014


> On 13 Aug 2014, at 14:20, Tim Northover <t.p.northover at gmail.com> wrote:
> 
>> 
>> Any thoughts? Does the RSP clobber make sense?
> 
> I suspect it's mostly academic from a purely codegen perspective since
> %rsp is a reserved register and so only X86-specific code that knows
> about it will touch it.

If it were the x86 code declaring it clobbered, I could believe that. However, it's marked clobbered by some generic code which seems to be there for handling totally unrelated stuff (return values)[0]. The fact that FastISel and SelectionDAGISel handle it differently makes it look even more suspicious.

I’m not saying it’s wrong. You’re right that from a purely academic POV, the call will actually write to %rsp. And it seems it never caused any trouble. It makes however other things, like the liveness analysis I pointed out, more difficult with no other apparent gain.

Fred

[0] : For reference, the commit introducing the RegMask handling that clobbers %rsp is:
commit 77180e0b402fff318cffd89a2251e46b3dce4064
Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
Date:   Fri Feb 3 21:23:14 2012 +0000

    Handle register mask operands in setPhysRegsDeadExcept().
    
    Calls that use register mask operands don't have implicit defs for
    returned values.  The register mask operand handles the call clobber,
    but it always behaves like a set of dead defs.
    
    Add live implicit defs for any implicitly defined physregs that are
    actually used.
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149715 91177308-0d34-041

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140813/1d723a0b/attachment.html>


More information about the llvm-commits mailing list