[llvm-dev] LLVM and System V ABI Inconsistency Question

Sochat, Vanessa via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 15 10:49:30 PDT 2021


Hi Craig,

Thanks for your speedy response! What about line 3080 where we check if Lo == Memory, and then do the post-merge providing both?

https://github.com/llvm/llvm-project/blob/f68939d3d91c3e1b57fba5450fa9146c3dcf5fdc/clang/lib/CodeGen/TargetInfo.cpp#L3080

I’m new to this code base so I don’t have a case in mind that would lead to an error (and hopefully if there was an issue it would have been caught by now) but the fact that the spec (and the function docstring) make the statement and then it’s missing in the implementation makes me uneasy at best. I was hoping that whomever wrote this might add a comment to explain (without a doubt) why it was okay to not follow the spec, or if that’s not possible, to update the implementation to match the spec. What are your thoughts?

Best,

Vanessa

From: Craig Topper <craig.topper at gmail.com>
Date: Wednesday, September 15, 2021 at 11:30 AM
To: "Sochat, Vanessa" <sochat1 at llnl.gov>
Cc: "llvm-dev at lists.llvm.org" <llvm-dev at lists.llvm.org>
Subject: Re: [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<mailto: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<https://urldefense.us/v3/__https:/twitter.com/vsoch/status/1435687187979268099__;!!G2kpM7uM-TzIFchu!jX7Sxg4AdoIDrVhfucwFpzhEgRpuPH3JPVnrs2Gr38gB5DI8OLQWZtLR-kn9Pnh1$>

And the link to the code in question is here:

https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/TargetInfo.cpp#L2726<https://urldefense.us/v3/__https:/github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/TargetInfo.cpp*L2726__;Iw!!G2kpM7uM-TzIFchu!jX7Sxg4AdoIDrVhfucwFpzhEgRpuPH3JPVnrs2Gr38gB5DI8OLQWZtLR-ifhErHW$>
Thank you so much for your help! 😊

Best,

Vanessa

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<https://urldefense.us/v3/__https:/lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev__;!!G2kpM7uM-TzIFchu!jX7Sxg4AdoIDrVhfucwFpzhEgRpuPH3JPVnrs2Gr38gB5DI8OLQWZtLR-se8Ofdn$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210915/bd24054f/attachment-0001.html>


More information about the llvm-dev mailing list