[cfe-dev] The x64 ABI lowering, direct pass of upper 8-bytes, can it happen?

Christoffer Lernö via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 12 13:06:26 PST 2020


I apologize for spamming with so many questions, but this really confusing me.

In X86_64ABIInfo::classifyArgumentType we have this code:

>   case Integer:
>     ++neededInt;
>     // Pick an 8-byte type based on the preferred type.
>     HighPart = GetINTEGERTypeAtOffset(CGT.ConvertType(Ty), 8, Ty, 8);
> 
>     if (Lo == NoClass)  // Pass HighPart at offset 8 in memory.
>       return ABIArgInfo::getDirect(HighPart, 8);
>     break;

Zooming in on the ”Lo == NoClass”. As far as I can tell this can only happen in the case where a struct has padding in front, and the first real integer parameter is actually 64 bits in.

I admit I have no idea how to construct such a type in C to trigger this. Since Clang has a non-trivial amount of code to handle this I am wondering what I’m missing. (I’ve looked through the x86 test cases as well but was unable to find a test case for this particular situation. I might have overlooked something though)


/Christoffer


More information about the cfe-dev mailing list