Lines Matching +full:string +full:- +full:support

1 //===- OptimizerDriver.cpp - Allow BugPoint to run passes safely ----------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
15 //===----------------------------------------------------------------------===//
22 #include "llvm/Support/CommandLine.h"
23 #include "llvm/Support/Debug.h"
24 #include "llvm/Support/FileUtilities.h"
25 #include "llvm/Support/Path.h"
26 #include "llvm/Support/Program.h"
27 #include "llvm/Support/ToolOutputFile.h"
30 #include "llvm/Support/PluginLoader.h"
38 extern cl::opt<std::string> OutputPrefix;
42 "preserve-bc-uselistorder",
43 cl::desc("Preserve use-list order when writing LLVM bitcode."),
46 static cl::opt<std::string>
47 OptCmd("opt-command", cl::init(""),
63 bool BugDriver::writeProgramToFile(const std::string &Filename, int FD,
79 bool BugDriver::writeProgramToFile(const std::string &Filename,
89 /// "bugpoint-ID.bc".
90 void BugDriver::EmitProgressBitcode(const Module &M, const std::string &ID,
93 // telling the user how to reproduce it: opt -foo blah.bc
95 std::string Filename = OutputPrefix + "-" + ID + ".bc";
109 outs() << " -load " << PluginLoader::getPlugin(i);
115 "silence-passes",
118 static cl::list<std::string> OptArgs("opt-args", cl::Positional,
122 /// runPasses - Run the specified passes on Program, outputting a bitcode file
126 /// deleted on success, and the filename string is undefined. This prints to
131 const std::vector<std::string> &Passes,
132 std::string &OutputFilename, bool DeleteOutput,
133 bool Quiet, ArrayRef<std::string> ExtraArgs) const {
138 OutputPrefix + "-output-%%%%%%%.bc", UniqueFilename);
144 OutputFilename = std::string(UniqueFilename);
148 sys::fs::TempFile::create(OutputPrefix + "-input-%%%%%%%.bc");
156 raw_fd_ostream OS(Temp->FD, /*shouldClose*/ false);
161 errs() << "Error writing bitcode file: " << Temp->TmpName << "\n";
166 std::string tool = OptCmd;
168 if (ErrorOr<std::string> Path =
183 std::string Prog;
185 if (ErrorOr<std::string> Path = sys::findProgramByName("valgrind"))
200 Args.push_back("--error-exitcode=1");
201 Args.push_back("-q");
210 Args.push_back("-bugpoint-enable-legacy-pm");
211 Args.push_back("-disable-symbolication");
212 Args.push_back("-o");
214 std::vector<std::string> pass_args;
216 pass_args.push_back(std::string("-load"));
219 for (std::vector<std::string>::const_iterator I = Passes.begin(),
222 pass_args.push_back(std::string("-") + (*I));
223 for (std::vector<std::string>::const_iterator I = pass_args.begin(),
227 Args.push_back(Temp->TmpName);
231 for (unsigned i = 0, e = Args.size() - 1; i != e; ++i) errs()
243 std::string ErrMsg;
258 if (result == -1)
272 BugDriver::runPassesOn(Module *M, const std::vector<std::string> &Passes,
273 ArrayRef<std::string> ExtraArgs) {
274 std::string BitcodeResult;