Pass and Pass Manager

LLVM's Pass infrastructure is one of the many important features of the LLVM system. There are a number of analysis and optimization passes that can be run using this infrastructure. The starting point for LLVM passes is the Pass class, which is a superclass of all the passes. We need to inherit from some predefined subclasses taking into account what our pass is going to implement.

  • ModulePass: This is the most general superclass. By inheriting this class we allow the entire module to be analyzed at once. The functions within the module may not be referred to in a particular order. To use it, write a subclass that inherits from the ModulePass subclass and overloads the runOnModule function.

    Note

    Before going ahead with the discussion ...

Get LLVM Essentials 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.