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 21 matching lines...) Expand all Loading... | |
228 } | 227 } |
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 |
237 // Don't generate verbose messages if routines | |
238 // to dump messages are not available. | |
239 if (!ALLOW_DUMP) | |
240 VerboseList.clear(); | |
241 | |
238 Ice::VerboseMask VMask = Ice::IceV_None; | 242 Ice::VerboseMask VMask = Ice::IceV_None; |
239 for (unsigned i = 0; i != VerboseList.size(); ++i) | 243 for (unsigned i = 0; i != VerboseList.size(); ++i) |
Jim Stichnoth
2014/11/12 14:34:15
Might be slightly cleaner to move the ALLOW_DUMP t
Karl
2014/11/17 18:59:46
Done.
| |
240 VMask |= VerboseList[i]; | 244 VMask |= VerboseList[i]; |
241 | 245 |
242 std::ofstream Ofs; | 246 std::ofstream Ofs; |
243 if (OutputFilename != "-") { | 247 if (OutputFilename != "-") { |
244 Ofs.open(OutputFilename.c_str(), std::ofstream::out); | 248 Ofs.open(OutputFilename.c_str(), std::ofstream::out); |
245 } | 249 } |
246 raw_os_ostream *Os = | 250 raw_os_ostream *Os = |
247 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); | 251 new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); |
248 Os->SetUnbuffered(); | 252 Os->SetUnbuffered(); |
249 | 253 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 if (SubzeroTimingEnabled) | 321 if (SubzeroTimingEnabled) |
318 Ctx.dumpTimers(); | 322 Ctx.dumpTimers(); |
319 if (TimeEachFunction) { | 323 if (TimeEachFunction) { |
320 const bool DumpCumulative = false; | 324 const bool DumpCumulative = false; |
321 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 325 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
322 } | 326 } |
323 const bool FinalStats = true; | 327 const bool FinalStats = true; |
324 Ctx.dumpStats("_FINAL_", FinalStats); | 328 Ctx.dumpStats("_FINAL_", FinalStats); |
325 return GetReturnValue(ErrorStatus); | 329 return GetReturnValue(ErrorStatus); |
326 } | 330 } |
OLD | NEW |