[LLVMdev] Problem returning aggregate struct (complex number) by value
Andrew Friedley
afriedle at indiana.edu
Fri Apr 2 13:12:11 PDT 2010
Duncan Sands wrote:
> Hi Andrew,
>
>> %0 = type { float, float }
>>
>> define %0 @test600() {
>> entry:
>> ret %0 { float 4.200000e+01, float 3.500000e+01 }
>> }
>>
>>
>> Running that through llc, the x86-64 assembly looks like this (abbreviated):
>
> unfortunately the x86-64 ABI says that complex numbers are *not* passed the
> same as a struct containing two floats. Your LLVM IR is not ABI conformant
> and thus will not interact properly with ABI conformant code, like that produced
> by llvm-gcc.
Thanks for the response. I'm aware of that, but dont think I quite
understand why that affects me here -- I'm using structs in all cases
(although as an abstraction for a complex number), not actual C99
complex. Does LLVM just assume that I really mean C99 complex when I'm
working with a struct of two floats?
Even so this doesn't answer my question, of what can I do to make this
work? :)
Andrew
More information about the llvm-dev
mailing list