LLVM  14.0.0git
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:
[legend]
Collaboration diagram for llvm::OptBisect:
[legend]

## Public Member Functions

OptBisect ()=default
Default constructor. More...

virtual ~OptBisect ()=default

bool shouldRunPass (const Pass *P, StringRef IRDescription) override
Checks the bisect limit to determine if the specified pass should run. More...

bool isEnabled () const override
isEnabled() should return true before calling shouldRunPass(). More...

void setLimit (int Limit)
Set the new optimization limit and reset the counter. More...

bool checkPass (const StringRef PassName, const StringRef TargetDesc)
Checks the bisect limit to determine if the specified pass should run. More...

Public Member Functions inherited from llvm::OptPassGate
virtual ~OptPassGate ()=default

## 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 45 of file OptBisect.h.

## ◆ 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

## ◆ checkPass()

 bool OptBisect::checkPass ( const StringRef PassName, const StringRef TargetDesc )

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

If the bisect limit is set to -1, the function prints a message describing the pass and the bisect number assigned to it and return true. Otherwise, the function prints a message with the bisect number assigned to the pass and indicating whether or not the pass will be run and return true if the bisect limit has not yet been exceeded or false if it has.

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

Definition at line 44 of file OptBisect.cpp.

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

Referenced by shouldRunPass().

## ◆ isEnabled()

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

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

Reimplemented from llvm::OptPassGate.

Definition at line 62 of file OptBisect.h.

References Disabled.

Referenced by checkPass(), and 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 66 of file OptBisect.h.

## ◆ shouldRunPass()

 bool OptBisect::shouldRunPass ( const Pass * P, StringRef IRDescription )
overridevirtual

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

This forwards to checkPass().

Reimplemented from llvm::OptPassGate.

Definition at line 38 of file OptBisect.cpp.

References assert(), checkPass(), isEnabled(), and P.

## ◆ Disabled

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

Definition at line 84 of file OptBisect.h.

Referenced by isEnabled().

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