Chapter 5. The LLVM Intermediate Representation

The LLVM Intermediate Representation (IR) is the backbone that connects frontends and backends, allowing LLVM to parse multiple source languages and generate code to multiple targets. Frontends produce the IR, while backends consume it. The IR is also the point where the majority of LLVM target-independent optimizations takes place. In this chapter, we will cover the following topics:

  • The characteristics of the LLVM IR
  • The LLVM IR language syntax
  • How to write a tool that generates the LLVM IR
  • The LLVM IR pass structure
  • How to write your own IR pass

Overview

The choice of the compiler IR is a very important decision. It determines how much information the optimizations will have to make the code run faster. ...

Get Getting Started with LLVM Core Libraries now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.