50 (
"Invalid limit for -opt-bisect-limit: " +
llvm::utostr(Limit))
54 "Maximum optimization to perform (equivalent to -opt-bisect=1-N)"));
59 if (IntervalStr ==
"-1") {
69 errs() <<
"Error: Invalid interval specification for -opt-bisect: "
70 << IntervalStr <<
" (" << E.getMessage() <<
")\n";
76 cl::desc(
"Run optimization passes only for the specified intervals. "
77 "Format: '1-10,20-30,45' runs passes 1-10, 20-30, and 45, where "
78 "index 1 is the first pass. Supply '0' to run no passes and -1 to "
91 cl::desc(
"Optimization pass(es) to disable (comma-separated list)"));
95 cl::desc(
"Show verbose output when opt-disable is set"),
101 errs() <<
"BISECT: " <<
Status <<
"running pass (" << PassNum <<
") " << Name
102 <<
" on " << TargetDesc <<
'\n';
109 int CurBisectNum = ++LastBisectNum;
123 dbgs() <<
"OptDisable: " <<
Status <<
"running pass " << Name <<
" on "
124 << TargetDesc <<
"\n";
133 const bool ShouldRun = !DisabledPasses.contains(
PassName);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static void printPassMessage(StringRef Name, int PassNum, StringRef TargetDesc, bool Running)
static cl::opt< bool > OptBisectVerbose("opt-bisect-verbose", cl::desc("Show verbose output when opt-bisect-limit is set"), cl::Hidden, cl::init(true), cl::Optional)
static cl::opt< bool > OptDisableVerbose("opt-disable-enable-verbosity", cl::desc("Show verbose output when opt-disable is set"), cl::Hidden, cl::init(false), cl::Optional)
static void printDisablePassMessage(const StringRef &Name, StringRef TargetDesc, bool Running)
static cl::opt< std::string > OptBisectIntervals("opt-bisect", cl::Hidden, cl::Optional, cl::cb< void, const std::string & >([](const std::string &IntervalStr) { if(IntervalStr=="-1") { getOptBisector().setIntervals({{1, std::numeric_limits< int >::max()}});return;} auto Intervals=IntegerInclusiveIntervalUtils::parseIntervals(IntervalStr);if(!Intervals) { handleAllErrors(Intervals.takeError(), [&](const StringError &E) { errs()<< "Error: Invalid interval specification for -opt-bisect: "<< IntervalStr<< " ("<< E.getMessage()<< ")\n";});exit(1);} getOptBisector().setIntervals(std::move(*Intervals));}), cl::desc("Run optimization passes only for the specified intervals. " "Format: '1-10,20-30,45' runs passes 1-10, 20-30, and 45, where " "index 1 is the first pass. Supply '0' to run no passes and -1 to " "run all passes."))
static OptBisect & getOptBisector()
static cl::opt< int > OptBisectLimit("opt-bisect-limit", cl::Hidden, cl::init(-1), cl::Optional, cl::cb< void, int >([](int Limit) { if(Limit==-1) getOptBisector().setIntervals({{1, std::numeric_limits< int >::max()}});else if(Limit==0) getOptBisector().setIntervals({{0, 0}});else if(Limit > 0) getOptBisector().setIntervals({{1, Limit}});else llvm_unreachable(("Invalid limit for -opt-bisect-limit: "+llvm::utostr(Limit)) .c_str());}), cl::desc("Maximum optimization to perform (equivalent to -opt-bisect=1-N)"))
static OptDisable & getOptDisabler()
static cl::list< std::string > OptDisablePasses("opt-disable", cl::Hidden, cl::CommaSeparated, cl::Optional, cl::cb< void, std::string >([](const std::string &Pass) { getOptDisabler().setDisabled(Pass);}), cl::desc("Optimization pass(es) to disable (comma-separated list)"))
This file declares the interface for bisecting optimizations.
static const char PassName[]
This class implements a mechanism to disable passes and individual optimizations at compile time base...
bool shouldRunPass(StringRef PassName, StringRef IRDescription) const override
Checks the bisect intervals to determine if the specified pass should run.
void setIntervals(IntegerInclusiveIntervalUtils::IntervalList Intervals)
Set intervals directly from an IntervalList.
bool isEnabled() const override
isEnabled() should return true before calling shouldRunPass().
This class implements a mechanism to disable passes and individual optimizations at compile time base...
bool shouldRunPass(StringRef PassName, StringRef IRDescription) const override
Checks the pass name to determine if the specified pass should run.
bool isEnabled() const override
isEnabled() should return true before calling shouldRunPass().
void setDisabled(StringRef Pass)
Parses the command line argument to extract the names of the passes to be disabled.
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
Pass interface - Implemented by all 'passes'.
This class wraps a string in an Error.
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool contains(ArrayRef< IntegerInclusiveInterval > Intervals, int64_t Value)
Check if a value is contained in any of the intervals.
Expected< IntervalList > parseIntervals(StringRef IntervalStr, char Separator=',')
Parse a interval specification string like "1-10,20-30,45" or "1-10:20-30:45".
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
LLVM_ABI OptPassGate & getGlobalPassGate()
Singleton instance of the OptPassGate class, so multiple pass managers don't need to coordinate their...
std::string utostr(uint64_t X, bool isNeg=false)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.