LLVM 18.0.0git
Public Member Functions | Static Public Attributes | List of all members
llvm::OptBisect Class Reference

This class implements a mechanism to disable passes and individual optimizations at compile time based on a command line option (-opt-bisect-limit) in order to perform a bisecting search for optimization-related problems. More...

#include "llvm/IR/OptBisect.h"

Inheritance diagram for llvm::OptBisect:
Inheritance graph
[legend]

Public Member Functions

 OptBisect ()=default
 Default constructor.
 
virtual ~OptBisect ()=default
 
bool shouldRunPass (const StringRef PassName, StringRef IRDescription) override
 Checks the bisect limit to determine if the specified pass should run.
 
bool isEnabled () const override
 isEnabled() should return true before calling shouldRunPass().
 
void setLimit (int Limit)
 Set the new optimization limit and reset the counter.
 
- Public Member Functions inherited from llvm::OptPassGate
virtual ~OptPassGate ()=default
 
virtual bool shouldRunPass (const StringRef PassName, StringRef IRDescription)
 IRDescription is a textual description of the IR unit the pass is running over.
 
virtual bool isEnabled () const
 isEnabled() should return true before calling shouldRunPass().
 

Static Public Attributes

static const int Disabled = std::numeric_limits<int>::max()
 

Detailed Description

This class implements a mechanism to disable passes and individual optimizations at compile time based on a command line option (-opt-bisect-limit) in order to perform a bisecting search for optimization-related problems.

Definition at line 43 of file OptBisect.h.

Constructor & Destructor Documentation

◆ OptBisect()

llvm::OptBisect::OptBisect ( )
default

Default constructor.

Initializes the state to "disabled". The bisection will be enabled by the cl::opt call-back when the command line option is processed. Clients should not instantiate this class directly. All access should go through LLVMContext.

◆ ~OptBisect()

virtual llvm::OptBisect::~OptBisect ( )
virtualdefault

Member Function Documentation

◆ isEnabled()

bool llvm::OptBisect::isEnabled ( ) const
inlineoverridevirtual

isEnabled() should return true before calling shouldRunPass().

Reimplemented from llvm::OptPassGate.

Definition at line 68 of file OptBisect.h.

References Disabled.

Referenced by shouldRunPass().

◆ setLimit()

void llvm::OptBisect::setLimit ( int  Limit)
inline

Set the new optimization limit and reset the counter.

Passing OptBisect::Disabled disables the limiting.

Definition at line 72 of file OptBisect.h.

◆ shouldRunPass()

bool OptBisect::shouldRunPass ( const StringRef  PassName,
StringRef  IRDescription 
)
overridevirtual

Checks the bisect limit to determine if the specified pass should run.

The method prints the name of the pass, its assigned bisect number, and whether or not the pass will be executed. It returns true if the pass should run, i.e. if the bisect limit is set to -1 or has not yet been exceeded.

Most passes should not call this routine directly. Instead, it is called through helper routines provided by the base classes of the pass. For instance, function passes should call FunctionPass::skipFunction().

Reimplemented from llvm::OptPassGate.

Definition at line 42 of file OptBisect.cpp.

References assert(), isEnabled(), PassName, and printPassMessage().

Member Data Documentation

◆ Disabled

const int OptBisect::Disabled = std::numeric_limits<int>::max()
static

Definition at line 77 of file OptBisect.h.

Referenced by isEnabled().


The documentation for this class was generated from the following files: