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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 cl::desc("Use integrated assembler (default yes)"), | 162 cl::desc("Use integrated assembler (default yes)"), |
163 cl::init(true)); | 163 cl::init(true)); |
164 | 164 |
165 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), | 165 static cl::alias UseIas("ias", cl::desc("Alias for -integrated-as"), |
166 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); | 166 cl::NotHidden, cl::aliasopt(UseIntegratedAssembler)); |
167 | 167 |
168 static cl::opt<bool> AlwaysExitSuccess( | 168 static cl::opt<bool> AlwaysExitSuccess( |
169 "exit-success", cl::desc("Exit with success status, even if errors found"), | 169 "exit-success", cl::desc("Exit with success status, even if errors found"), |
170 cl::init(false)); | 170 cl::init(false)); |
171 | 171 |
172 static cl::opt<bool> GenerateBuildAtts( | 172 static cl::opt<bool> |
173 "build-atts", cl::desc("Generate list of build attributes associated with " | 173 GenerateBuildAtts("build-atts", |
| 174 cl::desc("Generate list of build attributes associated with " |
174 "this executable."), | 175 "this executable."), |
175 cl::init(false)); | 176 cl::init(false)); |
176 | 177 |
177 static int GetReturnValue(int Val) { | 178 static int GetReturnValue(int Val) { |
178 if (AlwaysExitSuccess) | 179 if (AlwaysExitSuccess) |
179 return 0; | 180 return 0; |
180 return Val; | 181 return Val; |
181 } | 182 } |
182 | 183 |
183 static struct { | 184 static struct { |
184 const char *FlagName; | 185 const char *FlagName; |
185 int FlagValue; | 186 int FlagValue; |
186 } ConditionalBuildAttributes[] = { | 187 } ConditionalBuildAttributes[] = { { "text_asm", ALLOW_TEXT_ASM }, |
187 { "text_asm", ALLOW_TEXT_ASM }, | 188 { "dump", ALLOW_DUMP }, |
188 { "dump", ALLOW_DUMP }, | 189 { "llvm_cl", ALLOW_LLVM_CL }, |
189 { "llvm_cl", ALLOW_LLVM_CL }, | 190 { "llvm_ir", ALLOW_LLVM_IR }, |
190 { "llvm_ir", ALLOW_LLVM_IR }, | 191 { "llvm_ir_as_input", |
191 { "llvm_ir_as_input", ALLOW_LLVM_IR_AS_INPUT } | 192 ALLOW_LLVM_IR_AS_INPUT } }; |
192 }; | |
193 | 193 |
194 // Validates values of build attributes. Prints them to Stream if | 194 // Validates values of build attributes. Prints them to Stream if |
195 // Stream is non-null. | 195 // Stream is non-null. |
196 static void ValidateAndGenerateBuildAttributes(raw_os_ostream *Stream) { | 196 static void ValidateAndGenerateBuildAttributes(raw_os_ostream *Stream) { |
197 | 197 |
198 if (Stream) | 198 if (Stream) |
199 *Stream << TargetArch << "\n"; | 199 *Stream << TargetArch << "\n"; |
200 | 200 |
201 for (size_t i = 0; i < array_lengthof(ConditionalBuildAttributes); ++i) { | 201 for (size_t i = 0; i < array_lengthof(ConditionalBuildAttributes); ++i) { |
202 switch (ConditionalBuildAttributes[i].FlagValue) { | 202 switch (ConditionalBuildAttributes[i].FlagValue) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 if (TimeEachFunction) { | 298 if (TimeEachFunction) { |
299 const bool DumpCumulative = false; | 299 const bool DumpCumulative = false; |
300 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); | 300 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); |
301 } | 301 } |
302 if (SubzeroTimingEnabled) | 302 if (SubzeroTimingEnabled) |
303 Ctx.dumpTimers(); | 303 Ctx.dumpTimers(); |
304 const bool FinalStats = true; | 304 const bool FinalStats = true; |
305 Ctx.dumpStats("_FINAL_", FinalStats); | 305 Ctx.dumpStats("_FINAL_", FinalStats); |
306 return GetReturnValue(ErrorStatus); | 306 return GetReturnValue(ErrorStatus); |
307 } | 307 } |
OLD | NEW |