LLVM backend for z80?

بواسطة PingPong

Prophet (3981)

صورة PingPong

05-08-2018, 21:09

I've seen some projects about this.
this will enable c++ programming on msx!
i would be curious about the huge machine code size generated for a simple thing like this.

typedef long long INT64;

INT64 add(INT64 a, INT64 b)
return b+a;

Login أوregister لوضع تعليقاتك

بواسطة Grauw

Ascended (10633)

صورة Grauw

05-08-2018, 21:57

That would be nice... Got any links to those projects?

بواسطة PingPong

Prophet (3981)

صورة PingPong

05-08-2018, 22:18

However i do not know the state of the project

بواسطة PingPong

Prophet (3981)

صورة PingPong

05-08-2018, 22:26

بواسطة Giangiacomo Zaffini 2

Champion (274)

صورة Giangiacomo Zaffini 2

06-08-2018, 12:46

If You want to stay on the edge please try and keep in touch with this community (and jacobly aka jacobly0, his port repository is this one)

TI-Planet compilateur C via LLVM

It is a long way, I guess. B-)

بواسطة Giangiacomo Zaffini 2

Champion (274)

صورة Giangiacomo Zaffini 2

17-01-2021, 11:35

Closing 2020, there was an update on (e)Z80 C/C++ compiler for TI calculators :
CE C Toolchain (LLVM-based)

I think having more toolchain options is a good thing.
Happy 2021 MSXing!

بواسطة Louthrax

Prophet (2435)

صورة Louthrax

17-01-2021, 12:45

That is very interesting. Nice thing on the TI-Planet link you gave is that you can download pre-built binaries with some working examples.

بواسطة salutte

Master (162)

صورة salutte

17-01-2021, 13:07

I've been trying to follow some of these initiatives to build z80 backends for llvm, but I didn't find much success.
On the other hand, I managed to compile a very simple C++ and run it in MSX, by using the resurrected C backend, the process is as follows:

C++ to intermediate LLVM format (.ll):
$ clang -S -emit-llvm -g main.c

from LLVM intermediate format to C (.cbe.c):
$ llvm-cbe main.ll

from C to msx format then using SDCC.

info on the C backend in:

However, the full process was very brittle. And one of the problems is that the C++ to C uses native libraries, so, when compiled on my PC, ints were 32 bits in size, and size_t was 64 bits, hence the STL code was mostly unusable on MSX.
I also tried unsuccessfully to compile a D program, but the C backend failed to process the intermediate .ll file.