Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: tools/pnacl-benchmark/pnacl-benchmark.cpp

Issue 770853002: Fix error reporting in the PNaCl bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix typo. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/pnacl-abicheck/pnacl-abicheck.cpp ('k') | tools/pnacl-llc/pnacl-llc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- pnacl-benchmark.cpp -----------------------------------------------===// 1 //===-- pnacl-benchmark.cpp -----------------------------------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // pnacl-benchmark: various benchmarking tools for the PNaCl LLVM toolchain. 10 // pnacl-benchmark: various benchmarking tools for the PNaCl LLVM toolchain.
(...skipping 27 matching lines...) Expand all
38 38
39 using namespace llvm; 39 using namespace llvm;
40 40
41 41
42 static cl::opt<std::string> 42 static cl::opt<std::string>
43 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-")); 43 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
44 44
45 static cl::opt<unsigned> 45 static cl::opt<unsigned>
46 NumRuns("num-runs", cl::desc("Number of runs"), cl::init(1)); 46 NumRuns("num-runs", cl::desc("Number of runs"), cl::init(1));
47 47
48 static cl::opt<bool>
49 VerboseErrors(
50 "verbose-parse-errors",
51 cl::desc("Print out more descriptive PNaCl bitcode parse errors"),
52 cl::init(false));
53
48 /// Used in a lexical block to measure and report the block's execution time. 54 /// Used in a lexical block to measure and report the block's execution time.
49 /// 55 ///
50 /// \param N block name 56 /// \param N block name
51 /// \param InputSize optional size of input operated upon. If given, the 57 /// \param InputSize optional size of input operated upon. If given, the
52 /// throughput will be reported as well in MB/sec. 58 /// throughput will be reported as well in MB/sec.
53 class TimingOperationBlock { 59 class TimingOperationBlock {
54 public: 60 public:
55 TimingOperationBlock(StringRef N, size_t InputSize=0) 61 TimingOperationBlock(StringRef N, size_t InputSize=0)
56 : InputSize(InputSize) { 62 : InputSize(InputSize) {
57 outs() << "Timing: " << N << "... "; 63 outs() << "Timing: " << N << "... ";
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 TimingOperationBlock T("Running bitcode analysis", BufSize); 201 TimingOperationBlock T("Running bitcode analysis", BufSize);
196 202
197 AnalysisDumpOptions DumpOptions; 203 AnalysisDumpOptions DumpOptions;
198 AnalyzeBitcodeInBuffer(FileBuf, nulls(), DumpOptions); 204 AnalyzeBitcodeInBuffer(FileBuf, nulls(), DumpOptions);
199 } 205 }
200 206
201 // Actual LLVM IR parsing and formation from the bitcode 207 // Actual LLVM IR parsing and formation from the bitcode
202 { 208 {
203 TimingOperationBlock T("LLVM IR parsing", BufSize); 209 TimingOperationBlock T("LLVM IR parsing", BufSize);
204 SMDiagnostic Err; 210 SMDiagnostic Err;
211 raw_ostream *Verbose = VerboseErrors ? &errs() : nullptr;
205 Module *M = NaClParseIRFile(InputFilename, PNaClFormat, 212 Module *M = NaClParseIRFile(InputFilename, PNaClFormat,
206 Err, getGlobalContext()); 213 Err, Verbose, getGlobalContext());
207 214
208 if (!M) { 215 if (!M) {
209 report_fatal_error("Unable to NaClParseIRFile"); 216 report_fatal_error("Unable to NaClParseIRFile");
210 } 217 }
211 } 218 }
212 } 219 }
213 220
214 int main(int argc, char **argv) { 221 int main(int argc, char **argv) {
215 sys::PrintStackTraceOnErrorSignal(); 222 sys::PrintStackTraceOnErrorSignal();
216 PrettyStackTraceProgram X(argc, argv); 223 PrettyStackTraceProgram X(argc, argv);
217 224
218 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. 225 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
219 cl::ParseCommandLineOptions(argc, argv, "pnacl-benchmark\n"); 226 cl::ParseCommandLineOptions(argc, argv, "pnacl-benchmark\n");
220 227
221 for (unsigned i = 0; i < NumRuns; i++) { 228 for (unsigned i = 0; i < NumRuns; i++) {
222 BenchmarkIRParsing(); 229 BenchmarkIRParsing();
223 } 230 }
224 231
225 return 0; 232 return 0;
226 } 233 }
OLDNEW
« no previous file with comments | « tools/pnacl-abicheck/pnacl-abicheck.cpp ('k') | tools/pnacl-llc/pnacl-llc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698