Intermediate Representation

From SlateWiki

The compiler is primarily centered around a tree-structured intermediate-level representation of code, as opposed to a traditional bytecode set. It's primary focus in design is to make code optimization very natural and extensible.

It supports some major features:

  • Message-sends.
  • Lexical closures.
  • Basic blocks.
  • Continuations.
  • Multiple-value returns.

The IR is suitable for many control- and data-flow optimizations at a high-level, which makes them portable. Also, although the IR is a much different design from bytecode, it is not a replacement for it, since a bytecode structure is very compact and quick to load; IR mostly exists temporarily during compilation.

The next phase of the compilation is the machine-representation, which is the last stage before code-generation.