[LLVMdev] Structs as first class values.

David Greene dag at cray.com
Wed Jul 23 09:05:31 PDT 2008


On Tuesday 22 July 2008 01:23, Chris Lattner wrote:

> David, I'm not sure I follow.  It is, of course, very important for us
> that llvm-gcc generate ABI compliant code on x86-64.  I'm just saying
> that if struct-return does not provide the ABI required for a specific
> source construct that another lowering would be needed.

Ah, ok.  I misunderstood your statement.

> In the case of X86-64, llvm-gcc does use aggregate return (for the
> interesting cases which return things in registers) and it does do the

I don't follow.  By "aggregate return" do you mean "structs as first class
values?"  That is, llvm-gcc generates a return of a struct by value?

> right thing.  However, returning a {i64, i64, i64, i64} by value and
> having it automatically be returned "by pointer" is less interesting,

What do you mean by "less interesting?"

> as we already have a direct way to handle that (and llvm-gcc already
> produces it).

So by, "direct way," you mean, "by using llvm-gcc?"  Unfortunately, that 
doesn't work for everyone.  It seems to me that target-specific issues
like ABI compatibility should be handled by llvm directly.

> AFAIK, llvm-gcc/g++ does an *extremely* good job of matching the
> X86-64 ABI on mainline.

But that's all implemented within llvm-gcc.  LLVM codegen right now
does not implement the ABI correctly.

Apologies if I've misunderstood things again.  I'm trying to get clarity on
this issue.

                                         -Dave



More information about the llvm-dev mailing list