Replies: 2 comments 6 replies
|
IR doesn't implement any support for
I adopted MIR c-tests suite for IR and see few tests failures, because of this problem. |
|
Ah OK, thanks for confirming. I wrote a (very inefficient) C JIT a while back and even just for dealing with the differences on x64 between Win and SysV it got fairly intricate https://github.com/sgraham/dyibicc/blob/main/src/codegen.in.c#L676 . I will need to think a little more on the best approach then, as I'd like to allow my language to interop with C transparently. |
Uh oh!
There was an error while loading. Please reload this page.
I have a runtime struct as below that is best passed by value. Because of its size, it's passed by pointer in the Windows x64 calling convention, but the two fields are passed as regular integer register arguments on aarch64 and SysV x64.
Are there any helpers in IR to help me avoid the knowledge of the specifics of the target's calling convention in my front end? (as in
gen_call_to_print_strbelow)I saw
ir_proto_Nwhich seem like they might be related, but I couldn't figure out a way to e.g. define a new struct ir_type representing RuntimeStr.I also tried using https://github.com/dstogov/ir?tab=readme-ov-file#llvm-interoperability to check clang->IR but clang generates a "fully expanded" proto, i.e. it's already baked the calling convention knowledge into the IR that it generates.
Not a huge problem, but I feel it will get a bit messy when considering the various cases of both passing and returning structs by value, varargs, multiplied by all the targets. (Also, I don't really know all the finer details of all the platforms! 😅)
All reactions