[LLVMdev] Argument Lowering Redux

Alex L arphaman at gmail.com
Tue Aug 5 17:46:56 PDT 2014


2014-08-05 17:22 GMT-07:00 Vadim Chugunov <vadimcn at gmail.com>:

> On Tue, Aug 5, 2014 at 11:47 AM, Jonas Maebe <jonas.maebe at elis.ugent.be>
> wrote:
>
>> On 04/08/14 21:27, Vadim Chugunov wrote:
>>
>>> I am not pretending to understand all corner cases in this, but as I was
>>> reading that old thread, a question popped up in my mind:
>>> Couldn't LLVM provide an early IR transform pass that lowers
>>> "high-level" argument definitions into the current target-dependent
>>> form, converting by-value structs into sret arguments as needed?   It
>>> seems to me that, at least for structs, all information that such a pass
>>> would require, is representable in the current LLVM IR.
>>>
>>
>> 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.
>>
>
> Huh, I didn't know that.  So who treats "complex" differently than struct
> { float re, im; }?  Fortran?
>

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.


>
> Would any of the following be feasible then?:
> - if this special case is widespread, add a special attribute for
> "complex" to LLVM IR,
> - ignore this issue, and have Fortran compilers do manual lowering of
> "complex" arguments, but at least all "sane" languages could enjoy
> automatic lowering.
>
> Vadim
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140805/fe3a98e3/attachment.html>


More information about the llvm-dev mailing list