[llvm-dev] Passing arguments and returning value of struct or class

Anton Korobeynikov via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 5 01:30:15 PST 2018


Hello

These rules are called "platform ABI". So, clang is emitting the IR to
match the requirements the ABI of a particular platform.

See e.g. 3.2.3 of
https://software.intel.com/sites/default/files/article/402129/mpx-linux64-abi.pdf
for an example of such rules on x86-64 platform (they are different on
other platforms).
On Wed, Dec 5, 2018 at 3:59 AM Chanhyun Park via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> Hi all.
>
> I'm new to LLVM and I'm having fun with LLVM.
> Recently, I fount that function calls are changed based on the types of return value and arguments.
>
> For example, as following codes, the generated LLVM IRs are efferent from what I expected them would be.
> -------------------
> // simple C code
> struct Float2
> {
>     float x; float y;
> }
> Float2 foo(Float2 a)
> -------------------
> // simple LLVM IR
> i64 foo(i64 a)
> ------------------------
>
> Even, if the size of structure is bigger than 64bit, the LLVM IRs are as follow.
> ------------------------
> void  foo( struct. Float2* ,  struct.Float2 * )
> ------------------------
>
> So. I wonder where can I find these rules? I googled but I could not found official documents or something likes that.
>
> Please help me.
>
> Thanks.
> Chanhyun.
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



-- 
With best regards, Anton Korobeynikov
Department of Statistical Modelling, Saint Petersburg State University


More information about the llvm-dev mailing list