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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 cl::init("-"), | 87 cl::init("-"), |
88 cl::value_desc("filename")); | 88 cl::value_desc("filename")); |
89 static cl::opt<std::string> | 89 static cl::opt<std::string> |
90 TestPrefix("prefix", cl::desc("Prepend a prefix to symbol names for testing"), | 90 TestPrefix("prefix", cl::desc("Prepend a prefix to symbol names for testing"), |
91 cl::init(""), cl::value_desc("prefix")); | 91 cl::init(""), cl::value_desc("prefix")); |
92 static cl::opt<bool> | 92 static cl::opt<bool> |
93 DisableInternal("externalize", | 93 DisableInternal("externalize", |
94 cl::desc("Externalize all symbols")); | 94 cl::desc("Externalize all symbols")); |
95 static cl::opt<bool> | 95 static cl::opt<bool> |
96 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); | 96 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); |
97 static cl::opt<bool> | |
98 DisableIRGeneration("noIRgen", cl::desc("Disable generating Subzero IR.")); | |
97 static cl::opt<std::string> | 99 static cl::opt<std::string> |
98 TranslateOnly("translate-only", cl::desc("Translate only the given function"), | 100 TranslateOnly("translate-only", cl::desc("Translate only the given function"), |
99 cl::init("")); | 101 cl::init("")); |
100 | 102 |
101 static cl::opt<bool> SubzeroTimingEnabled( | 103 static cl::opt<bool> SubzeroTimingEnabled( |
102 "timing", cl::desc("Enable breakdown timing of Subzero translation")); | 104 "timing", cl::desc("Enable breakdown timing of Subzero translation")); |
103 | 105 |
104 static cl::opt<bool> | 106 static cl::opt<bool> |
105 TimeEachFunction("timing-funcs", | 107 TimeEachFunction("timing-funcs", |
106 cl::desc("Print total translation time for each function")); | 108 cl::desc("Print total translation time for each function")); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 << ConditionalBuildAttributes[i].FlagValue; | 222 << ConditionalBuildAttributes[i].FlagValue; |
221 report_fatal_error(StrBuf.str()); | 223 report_fatal_error(StrBuf.str()); |
222 } | 224 } |
223 } | 225 } |
224 } | 226 } |
225 } | 227 } |
226 | 228 |
227 int main(int argc, char **argv) { | 229 int main(int argc, char **argv) { |
228 | 230 |
229 cl::ParseCommandLineOptions(argc, argv); | 231 cl::ParseCommandLineOptions(argc, argv); |
230 | 232 |
jvoung (off chromium)
2014/11/04 22:30:15
I wonder if there will be an easy way to compile-o
Karl
2014/11/05 21:13:34
Done.
| |
233 if (DisableIRGeneration) | |
234 DisableTranslation = true; | |
235 | |
231 Ice::VerboseMask VMask = Ice::IceV_None; | 236 Ice::VerboseMask VMask = Ice::IceV_None; |
232 for (unsigned i = 0; i != VerboseList.size(); ++i) | 237 for (unsigned i = 0; i != VerboseList.size(); ++i) |
233 VMask |= VerboseList[i]; | 238 VMask |= VerboseList[i]; |
234 | 239 |
235 std::ofstream Ofs; | 240 std::ofstream Ofs; |
236 if (OutputFilename != "-") { | 241 if (OutputFilename != "-") { |
237 Ofs.open(OutputFilename.c_str(), std::ofstream::out); | 242 Ofs.open(OutputFilename.c_str(), std::ofstream::out); |
238 } | 243 } |
239 raw_os_ostream *Os = | 244 raw_os_ostream *Os = |
240 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); | 245 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); |
(...skipping 21 matching lines...) Expand all Loading... | |
262 Flags.PhiEdgeSplit = EnablePhiEdgeSplit; | 267 Flags.PhiEdgeSplit = EnablePhiEdgeSplit; |
263 Flags.DecorateAsm = DecorateAsm; | 268 Flags.DecorateAsm = DecorateAsm; |
264 Flags.DumpStats = DumpStats; | 269 Flags.DumpStats = DumpStats; |
265 Flags.AllowUninitializedGlobals = AllowUninitializedGlobals; | 270 Flags.AllowUninitializedGlobals = AllowUninitializedGlobals; |
266 Flags.TimeEachFunction = TimeEachFunction; | 271 Flags.TimeEachFunction = TimeEachFunction; |
267 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | 272 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
268 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; | 273 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
269 Flags.TimingFocusOn = TimingFocusOn; | 274 Flags.TimingFocusOn = TimingFocusOn; |
270 Flags.VerboseFocusOn = VerboseFocusOn; | 275 Flags.VerboseFocusOn = VerboseFocusOn; |
271 Flags.TranslateOnly = TranslateOnly; | 276 Flags.TranslateOnly = TranslateOnly; |
277 Flags.DisableIRGeneration = DisableIRGeneration; | |
272 | 278 |
273 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 279 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
274 Flags); | 280 Flags); |
275 | 281 |
276 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); | 282 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); |
277 | 283 |
278 int ErrorStatus = 0; | 284 int ErrorStatus = 0; |
279 if (BuildOnRead) { | 285 if (BuildOnRead) { |
280 Ice::PNaClTranslator Translator(&Ctx, Flags); | 286 Ice::PNaClTranslator Translator(&Ctx, Flags); |
281 Translator.translate(IRFilename); | 287 Translator.translate(IRFilename); |
(...skipping 21 matching lines...) Expand all Loading... | |
303 if (SubzeroTimingEnabled) | 309 if (SubzeroTimingEnabled) |
304 Ctx.dumpTimers(); | 310 Ctx.dumpTimers(); |
305 if (TimeEachFunction) { | 311 if (TimeEachFunction) { |
306 const bool DumpCumulative = false; | 312 const bool DumpCumulative = false; |
307 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 313 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
308 } | 314 } |
309 const bool FinalStats = true; | 315 const bool FinalStats = true; |
310 Ctx.dumpStats("_FINAL_", FinalStats); | 316 Ctx.dumpStats("_FINAL_", FinalStats); |
311 return GetReturnValue(ErrorStatus); | 317 return GetReturnValue(ErrorStatus); |
312 } | 318 } |
OLD | NEW |