Sochat, Vanessa via llvm-dev
2021-Sep-14 15:01 UTC
[llvm-dev] LLVM and System V ABI Inconsistency Question
Hi LLVM Community, I’m hoping for some insight to a question I stumbled on – I’ve been trying various social networks and contacts to no avail! I was recently looking at the System V ABI Document for X86 and comparing to the LLVM source code, and I had a few questions about register allocation. Basically, when we are doing the post merge step in classifying, say, a struct, the first rule says that we check for either lo or hi to be in memory, and then set the whole thing to memory. But in the implementation, it only checks hi (and then changes lo). I thought if it’s not an oversight, it might be the case that lo can never be set to memory, or something like that? I’m hoping that you have some insight because I’m not sure if this is an oversight on my part! I shared some screenshots here: https://twitter.com/vsoch/status/1435687187979268099 And the link to the code in question is here: https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/TargetInfo.cpp#L2726 Thank you so much for your help! 😊 Best, Vanessa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210914/6e1248f2/attachment.html>
Craig Topper via llvm-dev
2021-Sep-15 17:30 UTC
[llvm-dev] LLVM and System V ABI Inconsistency Question
Hi Vanessa, I think the two users of the final classification, X86_64ABIInfo::classifyReturnType and X86_64ABIInfo::classifyArgumentType, don't look at Hi if Lo == Memory. They both return from their respective "switch (Lo)". So I guess the code took a shortcut and didn't bother updating Hi. ~Craig On Tue, Sep 14, 2021 at 5:15 PM Sochat, Vanessa via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi LLVM Community, > > > > I’m hoping for some insight to a question I stumbled on – I’ve been trying > various social networks and contacts to no avail! I was recently looking at > the System V ABI Document for X86 and comparing to the LLVM source code, > and I had a few questions about register allocation. Basically, when we are > doing the post merge step in classifying, say, a struct, the first rule > says that we check for either lo *or* hi to be in memory, and then set > the whole thing to memory. But in the implementation, it only checks hi > (and then changes lo). I thought if it’s not an oversight, it might be the > case that lo can never be set to memory, or something like that? I’m hoping > that you have some insight because I’m not sure if this is an oversight on > my part! I shared some screenshots here: > > > > https://twitter.com/vsoch/status/1435687187979268099 > > > > And the link to the code in question is here: > > > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/TargetInfo.cpp#L2726 > > Thank you so much for your help! 😊 > > > > Best, > > > > Vanessa > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210915/d46b34ac/attachment.html>