diff options
author | Quentin Colombet <qcolombet@apple.com> | 2017-04-01 01:26:24 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2017-04-01 01:26:24 +0000 |
commit | 49d70d0529ab6d98a2c0a7c9aa65e9d1a92c2e4d (patch) | |
tree | f60fa846f9aa4e95dd6d1adce48369dff93f7c0c /llvm/tools | |
parent | fc8f048c13d9dc1ab1ddc1550cfcbd3f5118fe23 (diff) | |
download | bcm5719-llvm-49d70d0529ab6d98a2c0a7c9aa65e9d1a92c2e4d.tar.gz bcm5719-llvm-49d70d0529ab6d98a2c0a7c9aa65e9d1a92c2e4d.zip |
Revert "Feature generic option to setup start/stop-after/before"
This reverts commit r299282.
Didn't intend to commit this :(
llvm-svn: 299288
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/llc/llc.cpp | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 3de9706b1fe..43f97f112f6 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -118,6 +118,22 @@ static cl::opt<bool> DiscardValueNames( cl::desc("Discard names from Value (other than GlobalValue)."), cl::init(false), cl::Hidden); +static cl::opt<std::string> StopBefore("stop-before", + cl::desc("Stop compilation before a specific pass"), + cl::value_desc("pass-name"), cl::init("")); + +static cl::opt<std::string> StopAfter("stop-after", + cl::desc("Stop compilation after a specific pass"), + cl::value_desc("pass-name"), cl::init("")); + +static cl::opt<std::string> StartBefore("start-before", + cl::desc("Resume compilation before a specific pass"), + cl::value_desc("pass-name"), cl::init("")); + +static cl::opt<std::string> StartAfter("start-after", + cl::desc("Resume compilation after a specific pass"), + cl::value_desc("pass-name"), cl::init("")); + static cl::list<std::string> IncludeDirs("I", cl::desc("include search path")); static cl::opt<bool> PassRemarksWithHotness( @@ -322,12 +338,15 @@ int main(int argc, char **argv) { static bool addPass(PassManagerBase &PM, const char *argv0, StringRef PassName, TargetPassConfig &TPC) { - if (PassName.empty() || PassName == "none") + if (PassName == "none") return false; - const PassInfo *PI = - TargetMachine::getPassInfo(PassName, /*AbortIfNotRegistered=*/true); - assert(PI && "We should have aborted in the previous call in that case"); + const PassRegistry *PR = PassRegistry::getPassRegistry(); + const PassInfo *PI = PR->getPassInfo(PassName); + if (!PI) { + errs() << argv0 << ": run-pass " << PassName << " is not registered.\n"; + return true; + } Pass *P; if (PI->getTargetMachineCtor()) @@ -345,6 +364,20 @@ static bool addPass(PassManagerBase &PM, const char *argv0, return false; } +static AnalysisID getPassID(const char *argv0, const char *OptionName, + StringRef PassName) { + if (PassName.empty()) + return nullptr; + + const PassRegistry &PR = *PassRegistry::getPassRegistry(); + const PassInfo *PI = PR.getPassInfo(PassName); + if (!PI) { + errs() << argv0 << ": " << OptionName << " pass is not registered.\n"; + exit(1); + } + return PI->getTypeInfo(); +} + static int compileModule(char **argv, LLVMContext &Context) { // Load the module to be compiled... SMDiagnostic Err; @@ -476,13 +509,9 @@ static int compileModule(char **argv, LLVMContext &Context) { OS = BOS.get(); } - AnalysisID StartBeforeID = TargetMachine::getStartBeforeID(); - AnalysisID StartAfterID = TargetMachine::getStartAfterID(); - AnalysisID StopAfterID = TargetMachine::getStopAfterID(); - AnalysisID StopBeforeID = TargetMachine::getStopBeforeID(); - if (!RunPassNames->empty()) { - if (StartAfterID || StopAfterID || StartBeforeID || StopBeforeID) { + if (!StartAfter.empty() || !StopAfter.empty() || !StartBefore.empty() || + !StopBefore.empty()) { errs() << argv[0] << ": start-after and/or stop-after passes are " "redundant when run-pass is specified.\n"; return 1; @@ -505,6 +534,11 @@ static int compileModule(char **argv, LLVMContext &Context) { } PM.add(createPrintMIRPass(*OS)); } else { + const char *argv0 = argv[0]; + AnalysisID StartBeforeID = getPassID(argv0, "start-before", StartBefore); + AnalysisID StartAfterID = getPassID(argv0, "start-after", StartAfter); + AnalysisID StopAfterID = getPassID(argv0, "stop-after", StopAfter); + AnalysisID StopBeforeID = getPassID(argv0, "stop-before", StopBefore); if (StartBeforeID && StartAfterID) { errs() << argv[0] << ": -start-before and -start-after specified!\n"; |