llir
v0.0.1-beta.1
Published
LLIR: Graph Optimizing LLVM-targetted backend.
Downloads
7
Readme
LLIR
LLIR is an optimizing backend which analytically generates probability graphs to maximize fallthrough contrast between branches. LLIR outputs LLVM and has a flexible input format so it can be used as a backend for many languages.
Documentation
API documentation can be generated through npm run docs
and is also available
online.
LLIR 101
The LLIR compiler is described in a paper (todo add link). It works around generating symmetric constraint graphs, all 'functions' having explicit Domain and Codomain nodes which can be simultaneously constrained.
When generating code with LLIR you will generally need to do the following.
- Choose a model for how your program will be stored in memory. By default
this is
MemoryStore
. - Create an
ExecutionGraph
with your memory store. - Create a
Subgraph
which contains your side-effect entry & exit points. LLIR offers LLVM intrinsics so this is not necessary. - Populate your
ExecutionGraph
- Create a generator (typically
Generator.LL
but you can use a different type of generator) - Create a
Churn
object which will essentially take say how you want to generate the code. E.g. to a stream, or JIT-friendly formats. Generally you'd wantAutoChurn
orStreamChurn