<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-05 17:22 GMT-07:00 Vadim Chugunov <span dir="ltr"><<a href="mailto:vadimcn@gmail.com" target="_blank">vadimcn@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 5, 2014 at 11:47 AM, Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be" target="_blank">jonas.maebe@elis.ugent.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<div>On 04/08/14 21:27, Vadim Chugunov wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I am not pretending to understand all corner cases in this, but as I was<br>
reading that old thread, a question popped up in my mind:<br>
Couldn't LLVM provide an early IR transform pass that lowers<br>
"high-level" argument definitions into the current target-dependent<br>
form, converting by-value structs into sret arguments as needed? It<br>
seems to me that, at least for structs, all information that such a pass<br>
would require, is representable in the current LLVM IR.<br>
</blockquote>
<br></div></div>
That's not the case. For example, many ABIs specify a specific way to pass and return values of the "complex" type, which at the LLVM level just looks like a struct with two float or double fields.<span><font color="#888888"><br>
</font></span></blockquote><div><div><div><br>Huh, I didn't know that. So who treats "complex" differently than struct { float re, im; }? Fortran?</div></div></div></div></div></div></blockquote><div><br>
</div><div>Not just Fortran. For example, for X86_64 clang returns complex<float> as a vector, but complex<double> as a structure. For X86 I think it returns them using an extra pointer argument.<br></div><div>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><br>Would any of the following be feasible then?:<br>
</div><div>- if this special case is widespread, add a special attribute for "complex" to LLVM IR,<br>
</div><div>- ignore this issue, and have Fortran compilers do
manual lowering of "complex" arguments, but at least all "sane"
languages could enjoy automatic lowering.<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>Vadim<br><br></div>
</font></span></div></div></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div>