LLVM z80 backend and llvm-dis missing?

Inspired by Jason Turner’s talk at CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”

I got interested in writing a Zilog Z80 backend for LLVM. Jason actually did no such thing, but instead wrote a x86-to-6502 translator (reassembler he calls it) https://github.com/lefticus/x86-to-6502

So I’m now trying to bootstrap this project.

Goal:

  • be able to use C++17 (or whatever is supported of that in clang-master) on my Z80 based MSX2 computer.

why? you might ask, well, just because I’m a software engineer and I like doing something I have not tried before.
In the past I have created a PC-to-MSX USB-interface called the ‘nowind’ interface (http://nowind.nl/)
It is actually a MSX2-compatible cartridge that from the MSX2 perspective appears to be a diskdrive, but actually the ‘disk’ is a disk-image file on the PC.

The host-software is written in c++98 and the z80-software (residing in flashrom) is written in z80-assembly, which I mastered quite well back then.

So why am I telling you this?
I would like to get some pointers on how to get started.
My development environment is currently windows, but if there is any advantage in switching to linux, that is also fine.

I have gcc/gdb experience but its a little rusty.

so I started reading http://llvm.org/docs/GettingStarted.html, and downloaded http://llvm.org/releases/3.9.0/LLVM-3.9.0-win64.exe precompiled binaries to get the hang of the toolchain.

Couple of questions:

  • First thing I noticed is that clang-dis is not part of the pre-compiled package?
  • What is a wise approach, should I compile clang from scratch to get clang-dis?
  • are LLVM backends for clang also in the trunk http://llvm.org/git/llvm.git ?
  • should I start by examining and existing backend, if so, where do I find one?

I hope anyone can give me some guidance to bootstrap this…

Greetings,

Jan

The easiest to get C++17 on the Z80 is probably using the experimental
LLVM+SDCC toolchain:
https://sourceforge.net/p/sdcc/mailman/message/35382805/
Though there is still some work to be done it should be much easier to
make useable for you than to get full Z80 support in LLVM itself.

Philipp

I've put up a page with a bit more information for those wanting to try
the experimental LLVM+SDCC toolchain (based on a fork of clang 3.8,
optionally opt 3.8, a version of the resurrected LLVM C backend and
current SDCC):

Philipp