class OptBisect
Declaration
class OptBisect : public OptPassGate { /* full declaration omitted */ };
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.
Declared at: llvm/include/llvm/IR/OptBisect.h:44
Inherits from: OptPassGate
Member Variables
- private int BisectLimit = Disabled
- private int LastBisectNum = 0
- public static const int Disabled = std::numeric_limits<int>::max()
Method Overview
- public OptBisect()
- public bool checkPass(const llvm::StringRef PassName, const llvm::StringRef TargetDesc)
- public bool isEnabled() const
- public void setLimit(int Limit)
- public bool shouldRunPass(const llvm::Pass * P, llvm::StringRef IRDescription)
- public virtual ~OptBisect()
Inherited from OptPassGate:
Methods
¶OptBisect()
OptBisect()
Description
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.
Declared at: llvm/include/llvm/IR/OptBisect.h:51
¶bool checkPass(const llvm::StringRef PassName,
const llvm::StringRef TargetDesc)
bool checkPass(const llvm::StringRef PassName,
const llvm::StringRef TargetDesc)
Description
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().
Declared at: llvm/include/llvm/IR/OptBisect.h:81
Parameters
- const llvm::StringRef PassName
- const llvm::StringRef TargetDesc
¶bool isEnabled() const
bool isEnabled() const
Description
isEnabled() should return true before calling shouldRunPass().
Declared at: llvm/include/llvm/IR/OptBisect.h:61
¶void setLimit(int Limit)
void setLimit(int Limit)
Description
Set the new optimization limit and reset the counter. Passing OptBisect::Disabled disables the limiting.
Declared at: llvm/include/llvm/IR/OptBisect.h:65
Parameters
- int Limit
¶bool shouldRunPass(const llvm::Pass* P,
llvm::StringRef IRDescription)
bool shouldRunPass(const llvm::Pass* P,
llvm::StringRef IRDescription)
Description
Checks the bisect limit to determine if the specified pass should run. This forwards to checkPass().
Declared at: llvm/include/llvm/IR/OptBisect.h:58
Parameters
- const llvm::Pass* P
- llvm::StringRef IRDescription
¶virtual ~OptBisect()
virtual ~OptBisect()
Declared at: llvm/include/llvm/IR/OptBisect.h:53