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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 static int GetReturnValue(int Val) { | 221 static int GetReturnValue(int Val) { |
222 if (AlwaysExitSuccess) | 222 if (AlwaysExitSuccess) |
223 return 0; | 223 return 0; |
224 return Val; | 224 return Val; |
225 } | 225 } |
226 | 226 |
227 static struct { | 227 static struct { |
228 const char *FlagName; | 228 const char *FlagName; |
229 int FlagValue; | 229 int FlagValue; |
230 } ConditionalBuildAttributes[] = {{"dump", ALLOW_DUMP}, | 230 } ConditionalBuildAttributes[] = {{"dump", ALLOW_DUMP}, |
| 231 {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}, |
231 {"llvm_cl", ALLOW_LLVM_CL}, | 232 {"llvm_cl", ALLOW_LLVM_CL}, |
232 {"llvm_ir", ALLOW_LLVM_IR}, | 233 {"llvm_ir", ALLOW_LLVM_IR}, |
233 {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT}, | 234 {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT}, |
234 {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}}; | 235 {"minimal_build", ALLOW_MINIMAL_BUILD}}; |
235 | 236 |
236 // Validates values of build attributes. Prints them to Stream if | 237 // Validates values of build attributes. Prints them to Stream if |
237 // Stream is non-null. | 238 // Stream is non-null. |
238 static void ValidateAndGenerateBuildAttributes(Ice::Ostream *Stream) { | 239 static void ValidateAndGenerateBuildAttributes(Ice::Ostream *Stream) { |
239 | 240 |
240 if (Stream) | 241 if (Stream) |
241 *Stream << TargetArch << "\n"; | 242 *Stream << TargetArch << "\n"; |
242 | 243 |
243 for (size_t i = 0; i < array_lengthof(ConditionalBuildAttributes); ++i) { | 244 for (size_t i = 0; i < array_lengthof(ConditionalBuildAttributes); ++i) { |
244 switch (ConditionalBuildAttributes[i].FlagValue) { | 245 switch (ConditionalBuildAttributes[i].FlagValue) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (GenerateBuildAtts) | 292 if (GenerateBuildAtts) |
292 return GetReturnValue(Ice::EC_None); | 293 return GetReturnValue(Ice::EC_None); |
293 | 294 |
294 if (!ALLOW_DISABLE_IR_GEN && DisableIRGeneration) { | 295 if (!ALLOW_DISABLE_IR_GEN && DisableIRGeneration) { |
295 *Ls << "Error: Build doesn't allow --no-ir-gen when not " | 296 *Ls << "Error: Build doesn't allow --no-ir-gen when not " |
296 << "ALLOW_DISABLE_IR_GEN!\n"; | 297 << "ALLOW_DISABLE_IR_GEN!\n"; |
297 return GetReturnValue(Ice::EC_Args); | 298 return GetReturnValue(Ice::EC_Args); |
298 } | 299 } |
299 | 300 |
300 Ice::ClFlags Flags; | 301 Ice::ClFlags Flags; |
301 Flags.DisableInternal = DisableInternal; | 302 Flags.setAllowErrorRecovery(AllowErrorRecovery); |
302 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 303 Flags.setAllowUninitializedGlobals(AllowUninitializedGlobals); |
303 Flags.DisableTranslation = DisableTranslation; | 304 Flags.setDataSections(DataSections); |
304 Flags.FunctionSections = FunctionSections; | 305 Flags.setDecorateAsm(DecorateAsm); |
305 Flags.DataSections = DataSections; | 306 Flags.setDefaultFunctionPrefix(DefaultFunctionPrefix); |
306 Flags.UseELFWriter = UseELFWriter; | 307 Flags.setDefaultGlobalPrefix(DefaultGlobalPrefix); |
307 Flags.UseIntegratedAssembler = UseIntegratedAssembler; | 308 Flags.setDisableInternal(DisableInternal); |
308 Flags.UseSandboxing = UseSandboxing; | 309 Flags.setDisableIRGeneration(DisableIRGeneration); |
309 Flags.PhiEdgeSplit = EnablePhiEdgeSplit; | 310 Flags.setDisableTranslation(DisableTranslation); |
310 Flags.DecorateAsm = DecorateAsm; | 311 Flags.setDumpStats(DumpStats); |
311 Flags.DumpStats = DumpStats; | 312 Flags.setFunctionSections(FunctionSections); |
312 Flags.AllowUninitializedGlobals = AllowUninitializedGlobals; | 313 Flags.setNumTranslationThreads(NumThreads); |
313 Flags.TimeEachFunction = TimeEachFunction; | 314 Flags.setPhiEdgeSplit(EnablePhiEdgeSplit); |
314 Flags.NumTranslationThreads = NumThreads; | 315 Flags.setStubConstantCalls(StubConstantCalls); |
315 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | 316 Flags.setSubzeroTimingEnabled(SubzeroTimingEnabled); |
316 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; | 317 Flags.setTimeEachFunction(TimeEachFunction); |
317 Flags.TimingFocusOn = TimingFocusOn; | 318 Flags.setTimingFocusOn(TimingFocusOn); |
318 Flags.VerboseFocusOn = VerboseFocusOn; | 319 Flags.setTranslateOnly(TranslateOnly); |
319 Flags.TranslateOnly = TranslateOnly; | 320 Flags.setUseELFWriter(UseELFWriter); |
320 Flags.DisableIRGeneration = DisableIRGeneration; | 321 Flags.setUseIntegratedAssembler(UseIntegratedAssembler); |
321 Flags.AllowErrorRecovery = AllowErrorRecovery; | 322 Flags.setUseSandboxing(UseSandboxing); |
322 Flags.StubConstantCalls = StubConstantCalls; | 323 Flags.setVerboseFocusOn(VerboseFocusOn); |
323 | 324 |
324 // Force -build-on-read=0 for .ll files. | 325 // Force -build-on-read=0 for .ll files. |
325 const std::string LLSuffix = ".ll"; | 326 const std::string LLSuffix = ".ll"; |
326 if (IRFilename.length() >= LLSuffix.length() && | 327 if (IRFilename.length() >= LLSuffix.length() && |
327 IRFilename.compare(IRFilename.length() - LLSuffix.length(), | 328 IRFilename.compare(IRFilename.length() - LLSuffix.length(), |
328 LLSuffix.length(), LLSuffix) == 0) | 329 LLSuffix.length(), LLSuffix) == 0) |
329 BuildOnRead = false; | 330 BuildOnRead = false; |
330 | 331 |
331 // With the ELF writer, use a raw_fd_ostream to allow seeking. | 332 // With the ELF writer, use a raw_fd_ostream to allow seeking. |
332 // Also don't buffer, otherwise it gets pretty slow. | 333 // Also don't buffer, otherwise it gets pretty slow. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 if (SubzeroTimingEnabled) | 412 if (SubzeroTimingEnabled) |
412 Ctx.dumpTimers(); | 413 Ctx.dumpTimers(); |
413 if (TimeEachFunction) { | 414 if (TimeEachFunction) { |
414 const bool DumpCumulative = false; | 415 const bool DumpCumulative = false; |
415 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 416 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
416 } | 417 } |
417 const bool FinalStats = true; | 418 const bool FinalStats = true; |
418 Ctx.dumpStats("_FINAL_", FinalStats); | 419 Ctx.dumpStats("_FINAL_", FinalStats); |
419 return GetReturnValue(Ctx.getErrorStatus()->value()); | 420 return GetReturnValue(Ctx.getErrorStatus()->value()); |
420 } | 421 } |
OLD | NEW |