Paweł Bylica via llvm-dev
2016-May-06 11:32 UTC
[llvm-dev] Passing structs in C calling convention
Hi, I want to declare a function that matches C ABI. Do I need to transform declarations like void @f(%struct.A %a) into void @f(%struct.A* byval %a) myself or LLVM can do it for me? Is this what "ccc" calling convention means? - Paweł -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160506/e8dbfa09/attachment.html>
Reid Kleckner via llvm-dev
2016-May-06 20:08 UTC
[llvm-dev] Passing structs in C calling convention
LLVM doesn't have enough information to do it for you. The LLVM type system just isn't as expressive as the C type system, so frontends end up bearing some of the lowering burden. You should consider using clang to do the lowering for you: http://llvm.org/devmtg/2014-10/Slides/Skip%20the%20FFI.pdf On Fri, May 6, 2016 at 4:32 AM, Paweł Bylica <llvm-dev at lists.llvm.org> wrote:> Hi, > > I want to declare a function that matches C ABI. Do I need to transform > declarations like void @f(%struct.A %a) into void @f(%struct.A* byval %a) > myself or LLVM can do it for me? Is this what "ccc" calling convention > means? > > - Paweł > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20160506/f86f0e4f/attachment.html>
Paweł Bylica via llvm-dev
2016-May-07 23:19 UTC
[llvm-dev] Passing structs in C calling convention
Thanks for explaining that to me. So the conclusion is to use IRGen from Clang to handle the lowering, right? I will take a look there and try to use it. But that adds additional dependency what's is not ideal. On Fri, May 6, 2016 at 10:08 PM Reid Kleckner <rnk at google.com> wrote:> LLVM doesn't have enough information to do it for you. The LLVM type > system just isn't as expressive as the C type system, so frontends end up > bearing some of the lowering burden. > > You should consider using clang to do the lowering for you: > http://llvm.org/devmtg/2014-10/Slides/Skip%20the%20FFI.pdf > > On Fri, May 6, 2016 at 4:32 AM, Paweł Bylica <llvm-dev at lists.llvm.org> > wrote: > >> Hi, >> >> I want to declare a function that matches C ABI. Do I need to transform >> declarations like void @f(%struct.A %a) into void @f(%struct.A* byval %a) >> myself or LLVM can do it for me? Is this what "ccc" calling convention >> means? >> >> - Paweł >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://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/20160507/2a5f498b/attachment.html>