All Projects → sheredom → yair

sheredom / yair

Licence: CC0-1.0 license
🦜 yair - a high-level compiler IR entirely written in Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to yair

carbon-ir
The carbon intermediate representation language
Stars: ✭ 24 (-29.41%)
Mutual labels:  intermediate-representation
Miasm
Reverse engineering framework in Python
Stars: ✭ 2,649 (+7691.18%)
Mutual labels:  intermediate-representation
Llvm
Project moved to: https://github.com/llvm/llvm-project
Stars: ✭ 4,461 (+13020.59%)
Mutual labels:  intermediate-representation
Write You A Haskell
Building a modern functional compiler from first principles. (http://dev.stephendiehl.com/fun/)
Stars: ✭ 3,064 (+8911.76%)
Mutual labels:  intermediate-representation
metadsl
Domain Specific Languages in Python
Stars: ✭ 86 (+152.94%)
Mutual labels:  intermediate-representation
finn-base
Open Source Compiler Framework using ONNX as Frontend and IR
Stars: ✭ 21 (-38.24%)
Mutual labels:  intermediate-representation
YaoBlocks.jl
Standard basic quantum circuit simulator building blocks. (archived, for it is moved to Yao.jl)
Stars: ✭ 26 (-23.53%)
Mutual labels:  intermediate-representation
rstatic
An R package for static analysis of R code.
Stars: ✭ 32 (-5.88%)
Mutual labels:  intermediate-representation
Infrared4Arduino
An object oriented infrared library for the Arduino
Stars: ✭ 51 (+50%)
Mutual labels:  ir
curso-IRI
Introdução à Recuperação de Informações
Stars: ✭ 14 (-58.82%)
Mutual labels:  ir
CompilersCourse
Theory of compilation course, MIPT
Stars: ✭ 32 (-5.88%)
Mutual labels:  ir
pypcode
Python bindings to Ghidra's SLEIGH library for disassembly and lifting to p-code IR
Stars: ✭ 111 (+226.47%)
Mutual labels:  ir
JavaScript-compiler
编程语言的本质:语言只是一串字符,我们认为它是什么,它就可以是什么
Stars: ✭ 51 (+50%)
Mutual labels:  ir
ATtiny13-TinyRemoteXL
12-Button IR Remote Control
Stars: ✭ 33 (-2.94%)
Mutual labels:  ir
ir datasets
Provides a common interface to many IR ranking datasets.
Stars: ✭ 190 (+458.82%)
Mutual labels:  ir
allsummarizer
Multilingual automatic text summarizer using statistical approach and extraction
Stars: ✭ 28 (-17.65%)
Mutual labels:  ir
Azure-Sentinel-4-SecOps
Microsoft Sentinel SOC Operations
Stars: ✭ 140 (+311.76%)
Mutual labels:  ir
ps-srum-hunting
PowerShell Script to facilitate the processing of SRUM data for on-the-fly forensics and if needed threat hunting
Stars: ✭ 16 (-52.94%)
Mutual labels:  ir

🦜 yair

Actions Status Crates.io API Docs

Yet Another Intermediate Representation (pronounced Yarrrr! (like a pirate!)) is a compiler intermediate representation written entirely in Rust. Key design decisions make the representation unique:

  • Single Static Assignment representation [1].
  • No Φ (phi) nodes, basic blocks take arguments instead [2].
  • Target agnostic representation for de-coupling of components.
  • Strong seperation between library components (you don't need to build, link, or use components you don't need).

TODOs

  • Core:
    • Add per-domain functions and function multi-versioning.
  • Verifier:
    • When we have per-domain functions (CPU-only for instance) check for:
      • Recursion.
      • Calling a function in a conflicting domain (call GPU from CPU).
    • Maybe restrict variables to non-any non-gpu?
      • At the least we should have some form of thread_local (shared) variables, and cpu globals too. But any else doesn't really make sense I think?
    • Check for casts to the same type as the value.
    • Check for pointers in invalid domains being inside pointers of other domains (like stack pointer being stored into CPU memory).
    • Check that blocks have correct terminating instructions (ret/br/etc).
  • Add a cranelift code generation library.
  • Add an optimizer!
  • Explain the syntax of the IR:
    • Globals and structs both use %name to differentiate them from other symbols.
  • Verify that all statements in a block are reachable from the tree of blocks above.
  • Verify that a block doesn't have any instructions after a terminator.
  • Verify that names are all valid.

Features

The following features are present in the yair crate.

io

The 'io' feature is a default feature of the yair crate. It lets you consume and produce binary or textual intermediate representation files from yair. This allows for inspection, testing, and serialization to the intermediate representation.

When this feature is enabled, two additional binaries are produced alongside the library crate - yair-as and yair-dis, allowing for assembling and disassembling of the intermediate representation between the human readable textual form, and the binary form.

Additionally, there is a yair::io module that lets users read/write the textual or binary representation into a yair Library that they can work with.

.yail Files

The human readable representation of yair are .yail files. An example file is:

mod "😀" {
  fn foo(a : i64, b : i64) : i64 {
    bar(a : i64, b : i64):
      r = or a, b
      ret r
  }
}

Constants in .yail files are slightly strange - constants as used in the Library object are unique per the value and type combination for that given constant. But in the intermediate representation, constants are treated like any other value within the body of a basic block:

mod "😀" {
  fn foo(a : i64) : i64 {
    bar(a : i64):
      b = const i64 4
      r = or a, b
      ret r
  }
}

This means that constants behave like regular SSA notes for the purposes of the intermediate representation.

References

References 1

Static single assignment form.

References 2

This approach is similar in some ways to the Swift Intermediate Language approach - Swift's High-Level IR: A Case Study of Complementing LLVM IR with Language-Specific Optimization.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].