[llvm-dev] how to determine abi alignment of function based on its type?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 16 10:35:52 PDT 2018


Hi Andrew,

On Sun, 16 Sep 2018 at 16:17, Andrew Kelley via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> (gdb) p Ty->dump()
> void ()
>
> Shouldn't this type be sized? Is this a bug?

That's a function taking no parameters and returning void. Notably
*not* a pointer to such a function. So it could have pretty much any
size depending on the function body (well, if we actually modelled the
size, which we don't).

> As a workaround, I have to assume that all functions are only 1-byte aligned, but that doesn't seem sound.

Minimum function alignment is specified in C++ via TargetLoweringBase
(and hence TargetLowering).

Cheers.

Tim.


More information about the llvm-dev mailing list