~pixelherodev/c3_meta

Metarepository for Project Tricarbon
67595cf5 — Noam Preil 3 months ago
Update docs; Thor uses RISC-V now insead of improvised ISA
8a9ab0bf — Noam Preil 3 months ago
Update name info
3294aa3f — Noam Preil 4 months ago
Add JIT mention

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~pixelherodev/c3_meta
read/write
git@git.sr.ht:~pixelherodev/c3_meta

You can also use your local clone with git send-email.

#Project Tricarbon

Project Tricarbon is my attempt at making a cleaner compiler ecosystem. It is meant to be useful for any compiler projects, in any language, and features components such as: an in-memory assembler; low-level code generation; IR parsers for LLVM, QBE, and more; an IR generalizer providing a common structure

Despite the name (compiler components), it's also useful for emulation via dynamic code generation using the same tools as the standard compilation pipeline.

#The name

Project Tricarbon is a fun way of referring to Cimple Compiler Components, or C3 (I couldn't think of a good name for Sulphur Dicarbon). I was going to call it Project Cyclopropatriene (a hypothetical tri-carbon element), but that is... not an easy name to remember.

In some places, the project is referred to as Operation Tricabon, or O3. Both of those are incorrect, and are from before I had settled on the current name. Cyclopropatriene is still used for the mailing lists, and that will only be changed if there is a real demand to do so.

#What's here now

Currently, there's a few projects which are complete or partly finished:

  • Lightzing

    • Lightzing is a set of in-memory assemblers. This was originally going to be what is now Thor, so it was named after GNU Lightning (the Z is because the implementation is currently in Zig).
    • Currently, the AMD64 in-memory assembler is partly complete, though not nearly enough to be production ready. Please wait at least until the end of June before looking at it :)
    • The ARM assembler is currently in the "R&D" stage, as I'm reading the ARM manuals.
  • Thor

    • Thor translates from a RISC-V ISA into the native hardware's ISA. Currently, the translator supports AMD64. Thor uses Lightzing for code generation, but it's planned to improve the interfaces so that it can be connected to other existing projects, such as the Zig stage2 compiler's code generation.
    • Currently, Thor only supports AMD64. ARM support is in the works.
    • Thor currently exposes the 32 registers mentioned in RV32I, but floating point support is planned. Thor uses a linear scan register allocator (as described by Poletto et al), customized per-target.
      • The register allocator will likely be shifted out into lightzing later on, as I do some refactoring to make it easier to replace it with a custom project-specific allocator for anyone else.
  • ZiggIRat

    • ZiggIRat parses LLVM 9 IR (LLVM 10 support is pending) into an in-memory structure. QBE support is pending, as is the generalized form. From there, Thor needs to be generalized to work properly with non-JITs before hooking up the generalized IR to Thor, and allowing for cross-compilation to any supported target.

#Language support

Currently, all of Project Tricarbon is implemented in Zig. As such, working with Project Tricarbon pieces is easiest using Zig. However, the goal of this project is to create a useful ecosystem for any language. C bindings for Zig components is a long-term goal, and I explicitly support implementing other components in C.

Most other languages, such as Rust or C++, can only be used for implementations if a C binding is exposed from the start with all critical functionality usable.

Components are allowed to provide extra features to programs in their native language, so long as core features are usable from any language over the C layer.