Comment

Comment by riscy

LLVM supports passing/returning structs (I'm using 3.8.1): https://ghostbin.com/paste/ozsh3

Furthermore, the output does match the System V ABI: https://ghostbin.com/paste/4a5ms

Notice how the struct is placed on the stack and the pointer to it is placed in %rdi for call/return. If you reduce the number of i32's in the struct to 3, the struct's fields are passed via registers since the type fewer than four eightbytes.

My older clang does indeed produce wonky LLVM IR code that seems to try and do this classification in the frontend, so ABI compatibility may have been a problem in the past, but I'm not convinced it's a problem in current versions of LLVM.

parent riscy 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton