LLVM backend for z80?

Door PingPong

Prophet (3698)

afbeelding van 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;

Aangemeld of registreer om reacties te plaatsen

Van Grauw

Ascended (9820)

afbeelding van Grauw

05-08-2018, 21:57

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

Van PingPong

Prophet (3698)

afbeelding van PingPong

05-08-2018, 22:18

However i do not know the state of the project

Van PingPong

Prophet (3698)

afbeelding van PingPong

05-08-2018, 22:26

Van Giangiacomo Zaffini 2

Master (250)

afbeelding van 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-)

Van Giangiacomo Zaffini 2

Master (250)

afbeelding van 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!

Van Louthrax

Prophet (2400)

afbeelding van 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.

Van salutte

Master (134)

afbeelding van 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.