This is a M680x0 codegen backend I've started/suspended a couple years back,
now I finally got some time and willing to continue working on it. To keep up
with LLVM changes I'd like to merge it upstream.
Though motorolla processors are mostly not used today there are relatively
small communities of enthusiasts that are interested in this llvm target,
namely m68k debian linux port team and demoscene artists; so, not just me;)
ATM this target is able to emit linkable/relocatable (no tls) object files that
can be linked with GNU ld against glibc or newlib. ISA is limited to M68000 but
is easily extensible. It can cross-compile GNU Hello executable that you can
run on Debian m68k port. As far as I can tell this project covers all c98
features, most of it of course is handled by clang itself, but llvm-wise it has
everything you need to compile a C program. For now it is compiler only, so you
still need GNU stuff, e.g. linker, debugger, binutils etc.
Cover almost every feature available atm, including code emission and object
- Added MIOperandInfo tablegen emission. This type provides a higher level view onto instruction operands aggregates, the actual instruction defined by tablegen. In M680x0 it is necessary to know the operands aggregates borders.
- "Code Beads" tablegen emission. M680x0 is a CISC and its binary emission is reminiscent of X86, but looking at ~40K lines of X86 code emission I've decided to push machine code generation to tablegen as much as possible. M680x0 "Code Beads" are binary strings defined for every instruction and provide machine binary pattern for an instruction. For the most part it is the actual machine command with replacement slots (e.g. registers placeholders), occasionally it contains weird transformation magic. Once emitted this binary string is processed by C++ "thin" code emitter that "unpacks" and fixes beads producing final instruction. M680x0InstrFormats.td contains beads format for this backend.
Further these beads may evolve into a state machine of sorts to accommodate more complex machine code emission patterns.
- utils/extract-section is a small bash script that extracts an object file's section, used to test code emission etc.
- Minor CMake tweaks.