Stream: t-compiler/help

Topic: Need implementing ABI code for m68k


John Paul Adrian Glaubitz (Jun 25 2020 at 10:14, on Zulip):

Hi!

I'm working on porting Rust to m68k using a work-in-progress version of LLVM for m68k.

I have most basic pieces on the Rust side done, but I need help with the ABI code, see: https://github.com/rust-lang/rust/issues/73685

Would one the compiler experts be willing to help me write the ABI part, i.e. the function "compute_abi_info"?

Thanks!

bjorn3 (Jun 25 2020 at 10:23, on Zulip):

I tried looking at https://github.com/M680x0/M680x0-mono-repo, but I can't find the clang equivalent of compute_abi_info for M680x0. I can find it for other target isa's though.

John Paul Adrian Glaubitz (Jun 25 2020 at 10:40, on Zulip):

Right, I guess we're still missing that part. Even though it already compiles usable C code.

bjorn3 (Jun 25 2020 at 10:41, on Zulip):

Do you know where gcc defines it? I could take a look at that version.

Jonas Schievink (Jun 25 2020 at 10:41, on Zulip):

Have you looked at what AVR does? IIRC it also uses some default implementation here

John Paul Adrian Glaubitz (Jun 25 2020 at 10:41, on Zulip):

I'll ask one of the GCC guys at my company (SUSE). Just a second.

John Paul Adrian Glaubitz (Jun 25 2020 at 10:44, on Zulip):

@Jonas Schievink I think m68k would need special code as it makes a difference between address and data registers.

John Paul Adrian Glaubitz (Jun 25 2020 at 10:56, on Zulip):

@bjorn3 https://github.com/gcc-mirror/gcc/blob/master/gcc/config/m68k/m68k.c#L1443

bjorn3 (Jun 25 2020 at 11:07, on Zulip):

/* On the m68k all args are always pushed. */

@John Paul Adrian Glaubitz I am not completely sure but I think all aggregate args should be marked byval using arg.make_indirect_byval() instead of using arg.cast_to(Uniform { ... }).

John Paul Adrian Glaubitz (Jun 25 2020 at 11:11, on Zulip):

ok

bjorn3 (Jun 25 2020 at 11:12, on Zulip):

I do advice you to add some codegen tests to test for compatibility with gcc.

John Paul Adrian Glaubitz (Jun 25 2020 at 11:13, on Zulip):

Will do.

bjorn3 (Jun 25 2020 at 11:16, on Zulip):

https://github.com/rust-lang/rust/tree/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/test/run-make-fulldeps/extern-fn-struct-passing-abi seems to be pretty much the kind of test you need.

John Paul Adrian Glaubitz (Jun 25 2020 at 11:19, on Zulip):

OK, thanks!

John Paul Adrian Glaubitz (Jun 25 2020 at 11:20, on Zulip):

Guess we also need to something similar when returning a struct.

Last update: Sep 27 2020 at 13:30UTC