Lines Matching +full:opt +full:- +full:out
1 //===- OptimizerDriver.cpp - Allow BugPoint to run passes safely ----------===//
8 //===----------------------------------------------------------------------===//
16 //===----------------------------------------------------------------------===//
42 extern cl::opt<std::string> OutputPrefix;
45 static cl::opt<bool> PreserveBitcodeUseListOrder(
46 "preserve-bc-uselistorder",
47 cl::desc("Preserve use-list order when writing LLVM bitcode."),
51 // ChildOutput - This option captures the name of the child output file that
53 cl::opt<std::string> ChildOutput("child-output", cl::ReallyHidden);
54 cl::opt<std::string> OptCmd("opt-command", cl::init(""),
55 cl::desc("Path to opt. (default: search path "
56 "for 'opt'.)"));
59 /// writeProgramToFile - This writes the current "Program" to the named bitcode
62 static bool writeProgramToFileAux(tool_output_file &Out, const Module *M) { in writeProgramToFileAux() argument
63 WriteBitcodeToFile(M, Out.os(), PreserveBitcodeUseListOrder); in writeProgramToFileAux()
64 Out.os().close(); in writeProgramToFileAux()
65 if (!Out.os().has_error()) { in writeProgramToFileAux()
66 Out.keep(); in writeProgramToFileAux()
74 tool_output_file Out(Filename, FD); in writeProgramToFile() local
75 return writeProgramToFileAux(Out, M); in writeProgramToFile()
81 tool_output_file Out(Filename, EC, sys::fs::F_None); in writeProgramToFile() local
83 return writeProgramToFileAux(Out, M); in writeProgramToFile()
88 /// EmitProgressBitcode - This function is used to output the current Program
89 /// to a file named "bugpoint-ID.bc".
95 // telling the user how to reproduce it: opt -foo blah.bc in EmitProgressBitcode()
97 std::string Filename = OutputPrefix + "-" + ID + ".bc"; in EmitProgressBitcode()
107 outs() << "opt " << Filename; in EmitProgressBitcode()
109 outs() << " -load " << PluginLoader::getPlugin(i); in EmitProgressBitcode()
114 cl::opt<bool> SilencePasses("silence-passes",
117 static cl::list<std::string> OptArgs("opt-args", cl::Positional,
118 cl::desc("<opt arguments>..."),
121 /// runPasses - Run the specified passes on Program, outputting a bitcode file
138 OutputPrefix + "-output-%%%%%%%.bc", UniqueFilename); in runPasses()
149 EC = sys::fs::createUniqueFile(OutputPrefix + "-input-%%%%%%%.bc", InputFD, in runPasses()
169 if (ErrorOr<std::string> Path = sys::findProgramByName("opt")) in runPasses()
175 errs() << "Cannot find `opt' in PATH!\n"; in runPasses()
192 // Ok, everything that could go wrong before running opt is done. in runPasses()
199 Args.push_back("--error-exitcode=1"); in runPasses()
200 Args.push_back("-q"); in runPasses()
205 Args.push_back("-o"); in runPasses()
211 pass_args.push_back( std::string("-load")); in runPasses()
216 pass_args.push_back( std::string("-") + (*I) ); in runPasses()
219 Args.push_back(I->c_str()); in runPasses()
226 for (unsigned i = 0, e = Args.size()-1; i != e; ++i) in runPasses()
254 if (result == -1) in runPasses()