| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 cl::init("-"), | 86 cl::init("-"), |
| 87 cl::value_desc("filename")); | 87 cl::value_desc("filename")); |
| 88 static cl::opt<std::string> | 88 static cl::opt<std::string> |
| 89 TestPrefix("prefix", cl::desc("Prepend a prefix to symbol names for testing"), | 89 TestPrefix("prefix", cl::desc("Prepend a prefix to symbol names for testing"), |
| 90 cl::init(""), cl::value_desc("prefix")); | 90 cl::init(""), cl::value_desc("prefix")); |
| 91 static cl::opt<bool> | 91 static cl::opt<bool> |
| 92 DisableInternal("externalize", | 92 DisableInternal("externalize", |
| 93 cl::desc("Externalize all symbols")); | 93 cl::desc("Externalize all symbols")); |
| 94 static cl::opt<bool> | 94 static cl::opt<bool> |
| 95 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); | 95 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); |
| 96 static cl::opt<std::string> |
| 97 TranslateOnly("translate-only", cl::desc("Translate only the given function"), |
| 98 cl::init("")); |
| 96 | 99 |
| 97 static cl::opt<bool> SubzeroTimingEnabled( | 100 static cl::opt<bool> SubzeroTimingEnabled( |
| 98 "timing", cl::desc("Enable breakdown timing of Subzero translation")); | 101 "timing", cl::desc("Enable breakdown timing of Subzero translation")); |
| 99 | 102 |
| 100 static cl::opt<bool> | 103 static cl::opt<bool> |
| 101 TimeEachFunction("timing-funcs", | 104 TimeEachFunction("timing-funcs", |
| 102 cl::desc("Print total translation time for each function")); | 105 cl::desc("Print total translation time for each function")); |
| 103 | 106 |
| 104 static cl::opt<std::string> TimingFocusOn( | 107 static cl::opt<std::string> TimingFocusOn( |
| 105 "timing-focus", | 108 "timing-focus", |
| 106 cl::desc("Break down timing for a specific function (use '*' for all)"), | 109 cl::desc("Break down timing for a specific function (use '*' for all)"), |
| 107 cl::init("")); | 110 cl::init("")); |
| 108 | 111 |
| 109 static cl::opt<std::string> VerboseFocusOn( | 112 static cl::opt<std::string> VerboseFocusOn( |
| 110 "verbose-focus", | 113 "verbose-focus", |
| 111 cl::desc("Temporarily enable full verbosity for a specific function"), | 114 cl::desc("Temporarily enable full verbosity for a specific function"), |
| 112 cl::init("")); | 115 cl::init("")); |
| 113 | 116 |
| 114 // This is currently unused, and is a placeholder for lit tests. | |
| 115 static cl::opt<bool> | 117 static cl::opt<bool> |
| 116 DisablePhiEdgeSplit("no-phi-edge-split", | 118 EnablePhiEdgeSplit("phi-edge-split", |
| 117 cl::desc("Disable edge splitting for Phi lowering")); | 119 cl::desc("Enable edge splitting for Phi lowering"), |
| 120 cl::init(true)); |
| 118 | 121 |
| 119 static cl::opt<bool> | 122 static cl::opt<bool> |
| 120 DumpStats("stats", | 123 DumpStats("stats", |
| 121 cl::desc("Print statistics after translating each function")); | 124 cl::desc("Print statistics after translating each function")); |
| 122 | 125 |
| 123 // This is currently needed by crosstest.py. | 126 // This is currently needed by crosstest.py. |
| 124 static cl::opt<bool> AllowUninitializedGlobals( | 127 static cl::opt<bool> AllowUninitializedGlobals( |
| 125 "allow-uninitialized-globals", | 128 "allow-uninitialized-globals", |
| 126 cl::desc("Allow global variables to be uninitialized")); | 129 cl::desc("Allow global variables to be uninitialized")); |
| 127 | 130 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 Ls->SetUnbuffered(); | 193 Ls->SetUnbuffered(); |
| 191 | 194 |
| 192 Ice::ClFlags Flags; | 195 Ice::ClFlags Flags; |
| 193 Flags.DisableInternal = DisableInternal; | 196 Flags.DisableInternal = DisableInternal; |
| 194 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; | 197 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; |
| 195 Flags.DisableTranslation = DisableTranslation; | 198 Flags.DisableTranslation = DisableTranslation; |
| 196 Flags.FunctionSections = FunctionSections; | 199 Flags.FunctionSections = FunctionSections; |
| 197 Flags.DataSections = DataSections; | 200 Flags.DataSections = DataSections; |
| 198 Flags.UseIntegratedAssembler = UseIntegratedAssembler; | 201 Flags.UseIntegratedAssembler = UseIntegratedAssembler; |
| 199 Flags.UseSandboxing = UseSandboxing; | 202 Flags.UseSandboxing = UseSandboxing; |
| 203 Flags.PhiEdgeSplit = EnablePhiEdgeSplit; |
| 200 Flags.DumpStats = DumpStats; | 204 Flags.DumpStats = DumpStats; |
| 201 Flags.AllowUninitializedGlobals = AllowUninitializedGlobals; | 205 Flags.AllowUninitializedGlobals = AllowUninitializedGlobals; |
| 202 Flags.TimeEachFunction = TimeEachFunction; | 206 Flags.TimeEachFunction = TimeEachFunction; |
| 203 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | 207 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
| 204 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; | 208 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
| 205 Flags.TimingFocusOn = TimingFocusOn; | 209 Flags.TimingFocusOn = TimingFocusOn; |
| 206 Flags.VerboseFocusOn = VerboseFocusOn; | 210 Flags.VerboseFocusOn = VerboseFocusOn; |
| 211 Flags.TranslateOnly = TranslateOnly; |
| 207 | 212 |
| 208 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 213 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
| 209 Flags); | 214 Flags); |
| 210 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); | 215 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); |
| 211 | 216 |
| 212 int ErrorStatus = 0; | 217 int ErrorStatus = 0; |
| 213 if (BuildOnRead) { | 218 if (BuildOnRead) { |
| 214 Ice::PNaClTranslator Translator(&Ctx, Flags); | 219 Ice::PNaClTranslator Translator(&Ctx, Flags); |
| 215 Translator.translate(IRFilename); | 220 Translator.translate(IRFilename); |
| 216 ErrorStatus = Translator.getErrorStatus(); | 221 ErrorStatus = Translator.getErrorStatus(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 233 if (TimeEachFunction) { | 238 if (TimeEachFunction) { |
| 234 const bool DumpCumulative = false; | 239 const bool DumpCumulative = false; |
| 235 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 240 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
| 236 } | 241 } |
| 237 if (SubzeroTimingEnabled) | 242 if (SubzeroTimingEnabled) |
| 238 Ctx.dumpTimers(); | 243 Ctx.dumpTimers(); |
| 239 const bool FinalStats = true; | 244 const bool FinalStats = true; |
| 240 Ctx.dumpStats("_FINAL_", FinalStats); | 245 Ctx.dumpStats("_FINAL_", FinalStats); |
| 241 return GetReturnValue(ErrorStatus); | 246 return GetReturnValue(ErrorStatus); |
| 242 } | 247 } |
| OLD | NEW |