Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Intermediate Representations

Laurence Tratt edited this page Mar 18, 2021 · 2 revisions

Yorick uses two additional intermediate representations (IRs) on top of those already found in rustc:

  • Serialised IR (SIR)
  • Tracing IR (TIR)

Serialised IR (SIR)

During compilation the MIR is traversed and serialised into a simpler representation called SIR. SIR is a flowgraph IR very similar to MIR. It mostly exists so that high-level program information can be reconstructed at runtime without a need for an instance of the compiler (and its tcx struct).

The resulting SIR is serialised using serde and linked into the .yk_sir ELF section of binaries compiled with ykrustc. At runtime, the tracer will collect SIR traces, which can then be mapped back to the serialised SIR information.

The SIR data structures are in an externally maintained crate so they can be shared by the compiler and the JIT runtime.

SIR lowering is performed here.

Tracing IR (TIR)

TIR is basically SIR with guards instead of branches. TIR is the basis for a compiled trace.

TIR lives in yktrace.

Clone this wiki locally