LLVM backend for z80?

Por PingPong

Prophet (3627)

imagem de 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;
}

Entrar ou registrar-se para comentar

Por Grauw

Ascended (9589)

imagem de Grauw

05-08-2018, 21:57

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

Por PingPong

Prophet (3627)

imagem de PingPong

05-08-2018, 22:18

https://github.com/earl1k/llvm-z80
However i do not know the state of the project

Por PingPong

Prophet (3627)

imagem de PingPong

05-08-2018, 22:26

Por Giangiacomo Zaffini 2

Master (246)

imagem de 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-)

Por Giangiacomo Zaffini 2

Master (246)

imagem de 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!

Por Louthrax

Prophet (2398)

imagem de 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.

Por salutte

Expert (124)

imagem de 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:
https://github.com/JuliaComputing/llvm-cbe

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.