VCB is the backend for Vayu.
.vyuis Vayu source.
.vcbiris VCB's internal IR.
VCB transforms the compiler representation produced by Vayu into native machine code.
Vayu Source (.vyu)
│
▼
Vayu Compiler / Frontend
│
▼
VCBIR (.vcbir)
│
▼
VCB
│
▼
Native Machine Code
VCB does not parse .vyu directly. The Vayu frontend produces .vcbir, which VCB consumes.
VCBIR is VCB's typed, SSA-based internal intermediate representation.
It provides the boundary between the Vayu compiler and backend and represents:
- SSA values and basic blocks
- Phi nodes
- Calls and branches
- Loads and stores
- Integer and floating-point operations
- Explicit conversions
VCBIR is an internal compiler representation, not another programming language.
VCB is written in C++20 and contains the backend pipeline for:
- Analysis
- Optimization
- Lowering
- Register allocation
- Instruction selection
- Peephole optimization
- Native code generation
VCB takes inspiration from compact backend architectures such as QBE, while Vayu remains its language target.
VCB exists to give Vayu its own compact native backend instead of depending on a large external compiler framework.
| Goal | Reason |
|---|---|
| Vayu-first | Built around Vayu's own compiler requirements |
| Fast | Keep the compilation path short and lightweight |
| Compact | Make the backend understandable and maintainable |
| Native | Generate machine code directly from VCBIR |
| Independent | Avoid making Vayu depend on another backend |
| Experimental | Keep backend development easy to change and test |
export function i32 main() {
entry:
%1 = add i32 5, 3
%2 = mul i32 %1, 2
ret i32 %2
}
Tests are kept under tests/ and cover the current backend source:
tests/
├── arith.vcb
├── bitwise.vcb
├── branch.vcb
├── call.vcb
├── coalesce.vcb
├── compare.vcb
├── conv.vcb
├── dense.vcb
├── loop.vcb
├── peephole.vcb
├── smoke.vcb
└── symbolic.vcb
The test suite covers arithmetic, bitwise operations, branches, calls, comparisons, conversions, loops, register coalescing, dense control flow, peephole optimization, symbolic handling, and smoke tests.
Build, CMake, compiler, Visual Studio, testing, and troubleshooting instructions are maintained in:
- Not a frontend — Vayu handles
.vyuparsing. - Not a generic backend — VCB is built for Vayu.
- Not LLVM/GCC — it intentionally has a much smaller scope.
- Not another language — VCBIR is an internal compiler representation.
Contributions are welcome in:
- VCBIR
- Backend optimization
- Analysis and SSA
- Register allocation
- Instruction selection
- x86-64 code generation
- Tests
- Vayu integration
VCB is released under the Apache License 2.0.