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

Side by Side Diff: src/llvm2ice.cpp

Issue 689433002: Remove IceConverter when LLVM IR is not allowed. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Merged with master Created 6 years, 1 month 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 | « pydir/run-llvm2ice.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 cl::desc("Define default global prefix for naming " 141 cl::desc("Define default global prefix for naming "
142 "unnamed globals"), 142 "unnamed globals"),
143 cl::init("Global")); 143 cl::init("Global"));
144 144
145 static cl::opt<std::string> 145 static cl::opt<std::string>
146 DefaultFunctionPrefix("default-function-prefix", 146 DefaultFunctionPrefix("default-function-prefix",
147 cl::desc("Define default function prefix for naming " 147 cl::desc("Define default function prefix for naming "
148 "unnamed functions"), 148 "unnamed functions"),
149 cl::init("Function")); 149 cl::init("Function"));
150 150
151 // Note: While this flag isn't used in the minimal build, we keep this
152 // flag so that tests can set this command-line flag without concern
153 // to the type of build. We double check that this flag at runtime
154 // to make sure the consistency is maintained.
151 static cl::opt<bool> 155 static cl::opt<bool>
152 BuildOnRead("build-on-read", 156 BuildOnRead("build-on-read",
153 cl::desc("Build ICE instructions when reading bitcode"), 157 cl::desc("Build ICE instructions when reading bitcode"),
154 cl::init(false)); 158 cl::init(true));
155 159
156 static cl::opt<bool> 160 static cl::opt<bool>
157 UseIntegratedAssembler("integrated-as", 161 UseIntegratedAssembler("integrated-as",
158 cl::desc("Use integrated assembler (default yes)"), 162 cl::desc("Use integrated assembler (default yes)"),
159 cl::init(true)); 163 cl::init(true));
160 164
161 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), 165 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"),
162 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); 166 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler));
163 167
164 static cl::opt<bool> AlwaysExitSuccess( 168 static cl::opt<bool> AlwaysExitSuccess(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, 268 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix,
265 Flags); 269 Flags);
266 270
267 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); 271 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx);
268 272
269 int ErrorStatus = 0; 273 int ErrorStatus = 0;
270 if (BuildOnRead) { 274 if (BuildOnRead) {
271 Ice::PNaClTranslator Translator(&Ctx, Flags); 275 Ice::PNaClTranslator Translator(&Ctx, Flags);
272 Translator.translate(IRFilename); 276 Translator.translate(IRFilename);
273 ErrorStatus = Translator.getErrorStatus(); 277 ErrorStatus = Translator.getErrorStatus();
274 } else { 278 } else if (ALLOW_LLVM_IR) {
275 // Parse the input LLVM IR file into a module. 279 // Parse the input LLVM IR file into a module.
276 SMDiagnostic Err; 280 SMDiagnostic Err;
277 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx); 281 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
278 Module *Mod = 282 Module *Mod =
279 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); 283 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext());
280 284
281 if (!Mod) { 285 if (!Mod) {
282 Err.print(argv[0], errs()); 286 Err.print(argv[0], errs());
283 return GetReturnValue(1); 287 return GetReturnValue(1);
284 } 288 }
285 289
286 Ice::Converter Converter(Mod, &Ctx, Flags); 290 Ice::Converter Converter(Mod, &Ctx, Flags);
287 Converter.convertToIce(); 291 Converter.convertToIce();
288 ErrorStatus = Converter.getErrorStatus(); 292 ErrorStatus = Converter.getErrorStatus();
293 } else {
294 *Ls << "Error: Build doesn't allow LLVM IR, "
295 << "--build-on-read=0 not allowed\n";
296 return GetReturnValue(1);
289 } 297 }
290 if (TimeEachFunction) { 298 if (TimeEachFunction) {
291 const bool DumpCumulative = false; 299 const bool DumpCumulative = false;
292 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); 300 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative);
293 } 301 }
294 if (SubzeroTimingEnabled) 302 if (SubzeroTimingEnabled)
295 Ctx.dumpTimers(); 303 Ctx.dumpTimers();
296 const bool FinalStats = true; 304 const bool FinalStats = true;
297 Ctx.dumpStats("_FINAL_", FinalStats); 305 Ctx.dumpStats("_FINAL_", FinalStats);
298 return GetReturnValue(ErrorStatus); 306 return GetReturnValue(ErrorStatus);
299 } 307 }
OLDNEW
« no previous file with comments | « pydir/run-llvm2ice.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698