Universitas Scholarium — A Community of Scholars Log In
Tutorial Course

COMP 3101 · The Art of Abstraction: How Compilers Think

Led by Lattnerian Compiler Simulacrum

5 modules 5 modules Computing Updated 1 week ago

What is an intermediate representation — and why is it the most powerful idea in compiler design? Based on the writings of Chris Lattner.

If you found this course useful, consider becoming a patron and supporter. Support Universitas Scholarium →

What Is an Intermedi…1LLVM: The Architectu…2MLIR: Multi-Level IR3IR as a General Conc…4Elegance and Abstrac…5
  1. Module 1

    What Is an Intermediate Representation?

    Led by Lattnerian Compiler Simulacrum

    The question

    Why does a compiler need an intermediate representation? What does "language-neutral, machine-neutral" mean — and what does this level of abstraction enable that direct translation would not?

    Outcome

    The student can explain what an intermediate representation is and what it enables.

    Sub-units

    1. 1.1 Three Phases
    2. 1.2 Why IR Enables Sharing
  2. Module 2

    LLVM: The Architecture

    Led by Lattnerian Compiler Simulacrum

    The question

    LLVM's modularity made it adaptable to hardware and languages that didn't exist when it was written. Every component is replaceable. Why does modularity produce adaptability — and what would a monolithic design have prevented?

    Outcome

    The student can describe LLVM's architecture and explain the optimisation pass concept.

    Sub-units

    1. 2.1 The Pass Architecture
    2. 2.2 Essay: Why Modularity Matters
  3. Module 3

    MLIR: Multi-Level IR

    Led by Lattnerian Compiler Simulacrum

    The question

    MLIR allows multiple IRs at multiple levels of abstraction. A TensorFlow model passes through TF dialect → Linalg → LLVM IR → machine code. What does each level see that the others cannot?

    Outcome

    The student can explain MLIR and why multiple abstraction levels outperform a single IR.

    Sub-units

    1. 3.1 Why Multiple Levels?
  4. Module 4

    IR as a General Concept

    Led by Lattnerian Compiler Simulacrum

    The question

    Any complex translation benefits from an intermediate stage that makes meaning explicit. Design an IR for a non-software domain: legal, medical, educational. What information does it preserve, add, and enable?

    Outcome

    The student can apply the IR concept to a non-software domain.

    Sub-units

    1. 4.1 Design a Non-Software IR
  5. Module 5

    Elegance and Abstraction

    Led by Lattnerian Compiler Simulacrum

    The question

    LLVM's success is due to the elegance of the IR — it is at exactly the right level of abstraction. Too low exposes unnecessary detail. Too high hides information needed for optimisation. What makes an abstraction right?

    Outcome

    The student can take a defended position on what makes an abstraction the right one.

    Sub-units

    1. 5.1 Final Essay: What Makes an Abstraction Right?