Inspecting the pass pipeline
As you grow your expertise in building passes and pass pipelines, you will inevitably run into issues – for instance, around compile time. In this section, you will learn how to inspect the pass pipeline and draw conclusions from that.
Available developer tools
The LLVM infrastructure provides several tools and utilities to interact with the passes and the pass pipelines. The main ones are opt
and llc
, which are a driver for LLVM passes and a compiler from LLVM IR to assembly code (in textual or object form), respectively.
If you look at Clang’s implementation of the codegen pipeline, you will find that it resembles opt
's pipeline for the middle-end and llc
's pipeline for the backend. In other words, you can reproduce Clang’s behavior with a call to opt
with the right options followed by a call to llc
.
Before we present how to debug your pass pipeline irrespective of whether you followed Clang’s way...