Open Quuxplusone opened 10 years ago
Attached sret.cpp
(160 bytes, text/plain): sret.cpp
Attached sret-amd64.ll
(1414 bytes, application/octet-stream): sret-amd64.ll
Attached sret-le32.ll
(1533 bytes, application/octet-stream): sret-le32.ll
Changing how clang lowers this would break the NaCl ABI, and I don't know what we can do there. It should be pretty easy to fix in the emscripten back end though.
Ok, then I guess we should fix this in the new emscripten backend (which will then hopefully get upstreamed eventually when the backend is ready together with everything else).
I think we can close this and focus on
I think this is part of the le32-*-* behavior, and talking to jvoung/dschuff it
sounds like we initially wanted to allow struct returns in PNaCl but then
removed struct types to simplify things, so in PNaCl structs with a single
integer get transformed to a single integers in a later pass. In NaCl there is
no ABI issue (the IRT is the only external consumer of the ABI adn we build it
ourselves). Same stands for Emscripten.
It therefore seems like changing Clang to emit int returns when returning a
struct with a single integer in le32-*-* mode is acceptable.
As a reference, Dan's asmjs-unknown-emscripten patch:
https://github.com/kripken/emscripten-fastcomp-clang/commit/f6e2fddff6294c1c2ec2f9602c30ff680359ed19
sret.cpp
(160 bytes, text/plain)sret-amd64.ll
(1414 bytes, application/octet-stream)sret-le32.ll
(1533 bytes, application/octet-stream)