19 releases (7 breaking)

Uses new Rust 2024

new 0.8.0 May 4, 2025
0.6.2 Feb 25, 2025
0.5.0 Sep 8, 2024
0.3.2 Jul 8, 2024
0.1.1 Sep 5, 2022

#108 in Programming languages

Download history 132/week @ 2025-02-05 1/week @ 2025-02-12 215/week @ 2025-02-19 81/week @ 2025-02-26 2/week @ 2025-03-05 134/week @ 2025-04-02 7/week @ 2025-04-09 7/week @ 2025-04-16 118/week @ 2025-04-30

141 downloads per month
Used in pliron-llvm

Apache-2.0

350KB
8K SLoC

Programming Languages Intermediate Representation

Status

pliron is an extensible compiler IR framework, inspired by MLIR and written in safe Rust.

Build and Test

  • Install the rust toolchain.

  • cargo build and cargo test should build the compiler and run the testsuite.

  • To see a simple IR constructed (by the print_simple test), use the following command:

    cargo test print_simple -- --show-output
    

    It should print something like:

    builtin.module @bar 
    {
      ^block_1v1():
        builtin.func @foo: builtin.function <()->(builtin.integer si64)> 
        {
          ^entry_block_2v1():
            c0_op_3v1_res0 = test.constant builtin.integer <0: si64>;
            test.return c0_op_3v1_res0
        }
    }
    
  • pliron provides an LLVM Dialect and consequently an llvm-opt tool that can parse LLVM-IR bitcode into the LLVM dialect and output LLVM-IR bitcode.

Using the Library

pliron is currently in a nascent stage and not yet useful for real-world use. In the future it can be used by just adding a dependence to the crate in your Rust project.

Documentation

  • Introduction and motivation are covered in the introductory wiki article.
  • The wiki also has a comparison of pliron with other compiler projects, touching upon some design decisions.
  • Code documentation can be found on docs.rs.

Some talks on pliron

pliron-logo

Dependencies

~5–6.5MB
~116K SLoC