Pass

Passes are a structural part of the llvm library. They allow to run a specific set of transformations / analysis over a given object, be it a Function, Module, or even a Loop.

They are used similarly to how AST visitors are used in the rest of the compiler.

In TC, we use a custom Function Pass to rewrite parts of the body of every function, and add gc-specific annotations.

struct GcRewritePass : public PassInfoMixin<GcRewritePass>
{
public:
  PreservedAnalyses run(Function& F, FunctionAnalysisManager& AM);
};

For more information about the Pass Class, you can read the LLVM documentation for Pass.