OLD | NEW |
---|---|
1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// | 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
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 // This file defines a driver that uses LLVM capabilities to parse a | 10 // This file defines a driver that uses LLVM capabilities to parse a |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 | 158 |
159 // Note: While this flag isn't used in the minimal build, we keep this | 159 // Note: While this flag isn't used in the minimal build, we keep this |
160 // flag so that tests can set this command-line flag without concern | 160 // flag so that tests can set this command-line flag without concern |
161 // to the type of build. We double check that this flag at runtime | 161 // to the type of build. We double check that this flag at runtime |
162 // to make sure the consistency is maintained. | 162 // to make sure the consistency is maintained. |
163 static cl::opt<bool> | 163 static cl::opt<bool> |
164 BuildOnRead("build-on-read", | 164 BuildOnRead("build-on-read", |
165 cl::desc("Build ICE instructions when reading bitcode"), | 165 cl::desc("Build ICE instructions when reading bitcode"), |
166 cl::init(true)); | 166 cl::init(true)); |
167 | 167 |
168 | |
169 static cl::opt<bool> | |
170 LLVMVerboseErrors( | |
171 "verbose-llvm-parse-errors", | |
172 cl::desc("Print out more descriptive PNaCl bitcode parse errors when " | |
173 "building LLVM IR first"), | |
174 cl::init(false)); | |
Jim Stichnoth
2014/12/03 20:35:15
I realize the default false value is consistent wi
Karl
2014/12/03 20:57:29
I didn't worry about the verbose messages. Verbose
| |
175 | |
168 static cl::opt<bool> | 176 static cl::opt<bool> |
169 UseIntegratedAssembler("integrated-as", | 177 UseIntegratedAssembler("integrated-as", |
170 cl::desc("Use integrated assembler (default yes)"), | 178 cl::desc("Use integrated assembler (default yes)"), |
171 cl::init(true)); | 179 cl::init(true)); |
172 | 180 |
173 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), | 181 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), |
174 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); | 182 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); |
175 | 183 |
176 static cl::opt<bool> AlwaysExitSuccess( | 184 static cl::opt<bool> AlwaysExitSuccess( |
177 "exit-success", cl::desc("Exit with success status, even if errors found"), | 185 "exit-success", cl::desc("Exit with success status, even if errors found"), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 | 309 |
302 int ErrorStatus = 0; | 310 int ErrorStatus = 0; |
303 if (BuildOnRead) { | 311 if (BuildOnRead) { |
304 Ice::PNaClTranslator Translator(&Ctx, Flags); | 312 Ice::PNaClTranslator Translator(&Ctx, Flags); |
305 Translator.translate(IRFilename); | 313 Translator.translate(IRFilename); |
306 ErrorStatus = Translator.getErrorStatus(); | 314 ErrorStatus = Translator.getErrorStatus(); |
307 } else if (ALLOW_LLVM_IR) { | 315 } else if (ALLOW_LLVM_IR) { |
308 // Parse the input LLVM IR file into a module. | 316 // Parse the input LLVM IR file into a module. |
309 SMDiagnostic Err; | 317 SMDiagnostic Err; |
310 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); | 318 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); |
319 raw_ostream *Verbose = LLVMVerboseErrors ? &errs() : nullptr; | |
311 Module *Mod = | 320 Module *Mod = |
312 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); | 321 NaClParseIRFile(IRFilename, InputFileFormat, Err, Verbose, |
322 getGlobalContext()); | |
313 | 323 |
314 if (!Mod) { | 324 if (!Mod) { |
315 Err.print(argv[0], errs()); | 325 Err.print(argv[0], errs()); |
316 return GetReturnValue(1); | 326 return GetReturnValue(1); |
317 } | 327 } |
318 | 328 |
319 Ice::Converter Converter(Mod, &Ctx, Flags); | 329 Ice::Converter Converter(Mod, &Ctx, Flags); |
320 Converter.convertToIce(); | 330 Converter.convertToIce(); |
321 ErrorStatus = Converter.getErrorStatus(); | 331 ErrorStatus = Converter.getErrorStatus(); |
322 } else { | 332 } else { |
323 *Ls << "Error: Build doesn't allow LLVM IR, " | 333 *Ls << "Error: Build doesn't allow LLVM IR, " |
324 << "--build-on-read=0 not allowed\n"; | 334 << "--build-on-read=0 not allowed\n"; |
325 return GetReturnValue(1); | 335 return GetReturnValue(1); |
326 } | 336 } |
327 if (SubzeroTimingEnabled) | 337 if (SubzeroTimingEnabled) |
328 Ctx.dumpTimers(); | 338 Ctx.dumpTimers(); |
329 if (TimeEachFunction) { | 339 if (TimeEachFunction) { |
330 const bool DumpCumulative = false; | 340 const bool DumpCumulative = false; |
331 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 341 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
332 } | 342 } |
333 const bool FinalStats = true; | 343 const bool FinalStats = true; |
334 Ctx.dumpStats("_FINAL_", FinalStats); | 344 Ctx.dumpStats("_FINAL_", FinalStats); |
335 return GetReturnValue(ErrorStatus); | 345 return GetReturnValue(ErrorStatus); |
336 } | 346 } |
OLD | NEW |