diff options
Diffstat (limited to 'contrib/llvm/tools/opt')
-rw-r--r-- | contrib/llvm/tools/opt/GraphPrinters.cpp | 2 | ||||
-rw-r--r-- | contrib/llvm/tools/opt/PrintSCC.cpp | 2 | ||||
-rw-r--r-- | contrib/llvm/tools/opt/opt.cpp | 48 |
3 files changed, 31 insertions, 21 deletions
diff --git a/contrib/llvm/tools/opt/GraphPrinters.cpp b/contrib/llvm/tools/opt/GraphPrinters.cpp index 86f9932..e7c6d1e 100644 --- a/contrib/llvm/tools/opt/GraphPrinters.cpp +++ b/contrib/llvm/tools/opt/GraphPrinters.cpp @@ -56,7 +56,7 @@ namespace llvm { if (Node->getFunction()) return ((Value*)Node->getFunction())->getName(); else - return "Indirect call node"; + return "external node"; } }; } diff --git a/contrib/llvm/tools/opt/PrintSCC.cpp b/contrib/llvm/tools/opt/PrintSCC.cpp index 66709ff..ea486ca 100644 --- a/contrib/llvm/tools/opt/PrintSCC.cpp +++ b/contrib/llvm/tools/opt/PrintSCC.cpp @@ -102,7 +102,7 @@ bool CallGraphSCC::runOnModule(Module &M) { for (std::vector<CallGraphNode*>::const_iterator I = nextSCC.begin(), E = nextSCC.end(); I != E; ++I) outs() << ((*I)->getFunction() ? (*I)->getFunction()->getNameStr() - : std::string("Indirect CallGraph node")) << ", "; + : std::string("external node")) << ", "; if (nextSCC.size() == 1 && SCCI.hasLoop()) outs() << " (Has self-loop)."; } diff --git a/contrib/llvm/tools/opt/opt.cpp b/contrib/llvm/tools/opt/opt.cpp index 51b920f..0878737 100644 --- a/contrib/llvm/tools/opt/opt.cpp +++ b/contrib/llvm/tools/opt/opt.cpp @@ -112,7 +112,7 @@ OptLevelO3("O3", static cl::opt<bool> UnitAtATime("funit-at-a-time", cl::desc("Enable IPO. This is same as llvm-gcc's -funit-at-a-time"), - cl::init(true)); + cl::init(true)); static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls", @@ -377,24 +377,34 @@ int main(int argc, char **argv) { } // Figure out what stream we are supposed to write to... - // FIXME: outs() is not binary! - raw_ostream *Out = &outs(); // Default to printing to stdout... - if (OutputFilename != "-") { - if (NoOutput || AnalyzeOnly) { - errs() << "WARNING: The -o (output filename) option is ignored when\n" - "the --disable-output or --analyze options are used.\n"; + raw_ostream *Out = 0; + bool DeleteStream = false; + if (!NoOutput && !AnalyzeOnly) { + if (OutputFilename == "-") { + // Print to stdout. + Out = &outs(); + // If we're printing a bitcode file, switch stdout to binary mode. + // FIXME: This switches outs() globally, not just for the bitcode output. + if (!OutputAssembly) + sys::Program::ChangeStdoutToBinary(); } else { - // Make sure that the Output file gets unlinked from the disk if we get a - // SIGINT - sys::RemoveFileOnSignal(sys::Path(OutputFilename)); - - std::string ErrorInfo; - Out = new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo, - raw_fd_ostream::F_Binary); - if (!ErrorInfo.empty()) { - errs() << ErrorInfo << '\n'; - delete Out; - return 1; + if (NoOutput || AnalyzeOnly) { + errs() << "WARNING: The -o (output filename) option is ignored when\n" + "the --disable-output or --analyze options are used.\n"; + } else { + // Make sure that the Output file gets unlinked from the disk if we get + // a SIGINT. + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + + std::string ErrorInfo; + Out = new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo, + raw_fd_ostream::F_Binary); + if (!ErrorInfo.empty()) { + errs() << ErrorInfo << '\n'; + delete Out; + return 1; + } + DeleteStream = true; } } } @@ -540,7 +550,7 @@ int main(int argc, char **argv) { Passes.run(*M.get()); // Delete the raw_fd_ostream. - if (Out != &outs()) + if (DeleteStream) delete Out; return 0; } |