Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VCB — Vayu Compiler Backend

VCB animated banner



Vayu Logo     VCB Logo Animated VCB presentation

Vayu Compiler Backend

A compact, fast, Vayu-first C++20 backend for native machine code generation.

Vayu VCB C++20 Apache 2.0


Identity

VCB is the backend for Vayu.
.vyu is Vayu source.
.vcbir is VCB's internal IR.

VCB transforms the compiler representation produced by Vayu into native machine code.

Vayu Logo   →   VCB Logo



Animated Vayu and VCB pipeline

Compiler Boundary

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

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.

Backend

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.


Why I Am Making VCB

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

VCBIR Example

export function i32 main() {
entry:
    %1 = add i32 5, 3
    %2 = mul i32 %1, 2
    ret i32 %2
}

Testing

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.


Building

Build, CMake, compiler, Visual Studio, testing, and troubleshooting instructions are maintained in:

→ build.md


Vayu + VCB

Vayu Logo   ×   VCB Logo



.vyu → Vayu Compiler → .vcbir → VCB → Native Machine Code

→ Vayu repository


What VCB Is Not

  • Not a frontend — Vayu handles .vyu parsing.
  • 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.

Contributing

Contributions are welcome in:

  • VCBIR
  • Backend optimization
  • Analysis and SSA
  • Register allocation
  • Instruction selection
  • x86-64 code generation
  • Tests
  • Vayu integration

License

VCB is released under the Apache License 2.0.

LICENSE


VCB

A compact native backend for Vayu.

About

Vayu Compiler Backend — a compact, C++20 compiler backend that optimizes Vayu IR and generates native x86-64 assembly.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages