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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 static int GetReturnValue(int Val) { | 186 static int GetReturnValue(int Val) { |
187 if (AlwaysExitSuccess) | 187 if (AlwaysExitSuccess) |
188 return 0; | 188 return 0; |
189 return Val; | 189 return Val; |
190 } | 190 } |
191 | 191 |
192 static struct { | 192 static struct { |
193 const char *FlagName; | 193 const char *FlagName; |
194 int FlagValue; | 194 int FlagValue; |
195 } ConditionalBuildAttributes[] = {{"text_asm", ALLOW_TEXT_ASM}, | 195 } ConditionalBuildAttributes[] = {{"dump", ALLOW_DUMP}, |
196 {"dump", ALLOW_DUMP}, | |
197 {"llvm_cl", ALLOW_LLVM_CL}, | 196 {"llvm_cl", ALLOW_LLVM_CL}, |
198 {"llvm_ir", ALLOW_LLVM_IR}, | 197 {"llvm_ir", ALLOW_LLVM_IR}, |
199 {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT}, | 198 {"llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT}, |
200 {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}}; | 199 {"disable_ir_gen", ALLOW_DISABLE_IR_GEN}}; |
201 | 200 |
202 // Validates values of build attributes. Prints them to Stream if | 201 // Validates values of build attributes. Prints them to Stream if |
203 // Stream is non-null. | 202 // Stream is non-null. |
204 static void ValidateAndGenerateBuildAttributes(raw_os_ostream *Stream) { | 203 static void ValidateAndGenerateBuildAttributes(raw_os_ostream *Stream) { |
205 | 204 |
206 if (Stream) | 205 if (Stream) |
(...skipping 22 matching lines...) Expand all Loading... |
229 } | 228 } |
230 | 229 |
231 int main(int argc, char **argv) { | 230 int main(int argc, char **argv) { |
232 | 231 |
233 cl::ParseCommandLineOptions(argc, argv); | 232 cl::ParseCommandLineOptions(argc, argv); |
234 | 233 |
235 if (DisableIRGeneration) | 234 if (DisableIRGeneration) |
236 DisableTranslation = true; | 235 DisableTranslation = true; |
237 | 236 |
238 Ice::VerboseMask VMask = Ice::IceV_None; | 237 Ice::VerboseMask VMask = Ice::IceV_None; |
239 for (unsigned i = 0; i != VerboseList.size(); ++i) | 238 // Don't generate verbose messages if routines |
240 VMask |= VerboseList[i]; | 239 // to dump messages are not available. |
| 240 if (ALLOW_DUMP) { |
| 241 for (unsigned i = 0; i != VerboseList.size(); ++i) |
| 242 VMask |= VerboseList[i]; |
| 243 } |
241 | 244 |
242 std::ofstream Ofs; | 245 std::ofstream Ofs; |
243 if (OutputFilename != "-") { | 246 if (OutputFilename != "-") { |
244 Ofs.open(OutputFilename.c_str(), std::ofstream::out); | 247 Ofs.open(OutputFilename.c_str(), std::ofstream::out); |
245 } | 248 } |
246 raw_os_ostream *Os = | 249 raw_os_ostream *Os = |
247 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); | 250 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); |
248 Os->SetUnbuffered(); | 251 Os->SetUnbuffered(); |
249 | 252 |
250 ValidateAndGenerateBuildAttributes(GenerateBuildAtts ? Os : nullptr); | 253 ValidateAndGenerateBuildAttributes(GenerateBuildAtts ? Os : nullptr); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 if (SubzeroTimingEnabled) | 327 if (SubzeroTimingEnabled) |
325 Ctx.dumpTimers(); | 328 Ctx.dumpTimers(); |
326 if (TimeEachFunction) { | 329 if (TimeEachFunction) { |
327 const bool DumpCumulative = false; | 330 const bool DumpCumulative = false; |
328 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 331 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
329 } | 332 } |
330 const bool FinalStats = true; | 333 const bool FinalStats = true; |
331 Ctx.dumpStats("_FINAL_", FinalStats); | 334 Ctx.dumpStats("_FINAL_", FinalStats); |
332 return GetReturnValue(ErrorStatus); | 335 return GetReturnValue(ErrorStatus); |
333 } | 336 } |
OLD | NEW |