<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 28, 2016 at 5:14 PM, Michael Nicolella via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Thanks for the explanation. It's good to hear the situation isn't felt to be ideal.</div><div><br></div><div>The details here are going to be sensitive to the OS + target that I'm compiling for, right? So the effort here will be to understand and get right the calling convention details for each supported target, yes?</div></div></blockquote><div><br></div>Yes, it is target specific. You should check clang/lib/CodeGen/TargetInfo.cpp for details of how calls are lowered from C for various targets. For some targets (e.g. x86-64), it's decidedly non-trivial. You can also run clang -emit-llvm to see what actually gets emitted for particular functions. If you stay away from passing structs/unions by value, it becomes a *lot* simpler, though...<div><br></div><div><div>Some people have tried to make libraries for doing the ABI lowering available in a way that's not tied to clang. Here's one: <<a href="https://github.com/scross99/llvm-abi">https://github.com/scross99/llvm-abi</a>> (I have no idea how well, or if, it works).</div><div><br></div><div>I think I've also seen mention of someone constructing the proper classes to pass to clang to have it emit the C ABI calls from their non-C language, although I'm not sure where I saw that.</div><div><br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Is there any current plan to change the way this works, or is it more of a dreamy cleanup item that maybe will get addressed some day?</div></div></blockquote><div><br></div><div>I don't know of anybody working on changing the way this works. I'd personally love to work on cleaning it up, someday...but that's a wish, not a plan.</div><div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"></div></blockquote></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div><div>Appreciate the tip.</div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 28, 2016 at 9:28 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On 27 March 2016 at 21:48, Michael Nicolella via llvm-dev<br>
<span><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Can someone help me understand why this detail needs to be understood by the frontend,<br>
<br>
</span>Many of the backends can do automatic demotion to sret, but the<br>
front-end still needs to be aware of the issues (particularly around<br>
unions, since whether demotion is necessary can depend on more than<br>
just the size of the type).<br>
<br>
I'd also expect marginally better code in some cases by using sret<br>
explicitly: the demotion occurs pretty late on and a "%type *sret"<br>
parameter better represents what will actually be happening later on.<br>
<br>
Cheers.<br>
<span><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>