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 26 matching lines...) Expand all Loading... |
37 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), | 37 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), |
38 clEnumValN(Ice::IceV_InstNumbers, "instnum", | 38 clEnumValN(Ice::IceV_InstNumbers, "instnum", |
39 "Print instruction numbers"), | 39 "Print instruction numbers"), |
40 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), | 40 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), |
41 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), | 41 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), |
42 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), | 42 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), |
43 clEnumValN(Ice::IceV_RegManager, "rmgr", "Register manager status"), | 43 clEnumValN(Ice::IceV_RegManager, "rmgr", "Register manager status"), |
44 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), | 44 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), |
45 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), | 45 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), |
46 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), | 46 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), |
47 clEnumValN(Ice::IceV_Timing, "time", "Pass timing details"), | |
48 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), | 47 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), |
49 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), | 48 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), |
50 clEnumValN(Ice::IceV_Most, "most", | 49 clEnumValN(Ice::IceV_Most, "most", |
51 "Use all verbose options except 'regalloc' and 'time'"), | 50 "Use all verbose options except 'regalloc' and 'time'"), |
52 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)); | 51 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)); |
53 static cl::opt<Ice::TargetArch> TargetArch( | 52 static cl::opt<Ice::TargetArch> TargetArch( |
54 "target", cl::desc("Target architecture:"), cl::init(Ice::Target_X8632), | 53 "target", cl::desc("Target architecture:"), cl::init(Ice::Target_X8632), |
55 cl::values( | 54 cl::values( |
56 clEnumValN(Ice::Target_X8632, "x8632", "x86-32"), | 55 clEnumValN(Ice::Target_X8632, "x8632", "x86-32"), |
57 clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"), | 56 clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 Flags.DisableGlobals = DisableGlobals; | 167 Flags.DisableGlobals = DisableGlobals; |
169 Flags.FunctionSections = FunctionSections; | 168 Flags.FunctionSections = FunctionSections; |
170 Flags.UseIntegratedAssembler = UseIntegratedAssembler; | 169 Flags.UseIntegratedAssembler = UseIntegratedAssembler; |
171 Flags.UseSandboxing = UseSandboxing; | 170 Flags.UseSandboxing = UseSandboxing; |
172 Flags.DumpStats = DumpStats; | 171 Flags.DumpStats = DumpStats; |
173 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; | 172 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
174 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; | 173 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
175 | 174 |
176 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, | 175 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, |
177 Flags); | 176 Flags); |
| 177 static Ice::TimerIdT IDszmain = Ice::GlobalContext::getTimerID("szmain"); |
| 178 Ice::TimerMarker T(IDszmain, &Ctx); |
178 | 179 |
179 int ErrorStatus = 0; | 180 int ErrorStatus = 0; |
180 if (BuildOnRead) { | 181 if (BuildOnRead) { |
181 Ice::PNaClTranslator Translator(&Ctx, Flags); | 182 Ice::PNaClTranslator Translator(&Ctx, Flags); |
182 Translator.translate(IRFilename); | 183 Translator.translate(IRFilename); |
183 ErrorStatus = Translator.getErrorStatus(); | 184 ErrorStatus = Translator.getErrorStatus(); |
184 } else { | 185 } else { |
185 // Parse the input LLVM IR file into a module. | 186 // Parse the input LLVM IR file into a module. |
186 SMDiagnostic Err; | 187 SMDiagnostic Err; |
187 Ice::Timer T; | 188 static Ice::TimerIdT IDparse = Ice::GlobalContext::getTimerID("parse"); |
| 189 Ice::TimerMarker T1(IDparse, &Ctx); |
188 Module *Mod = | 190 Module *Mod = |
189 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); | 191 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); |
190 | 192 |
191 if (SubzeroTimingEnabled) { | |
192 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec() | |
193 << " sec\n"; | |
194 } | |
195 | |
196 if (!Mod) { | 193 if (!Mod) { |
197 Err.print(argv[0], errs()); | 194 Err.print(argv[0], errs()); |
198 return 1; | 195 return 1; |
199 } | 196 } |
200 | 197 |
201 Ice::Converter Converter(Mod, &Ctx, Flags); | 198 Ice::Converter Converter(Mod, &Ctx, Flags); |
202 Converter.convertToIce(); | 199 Converter.convertToIce(); |
203 ErrorStatus = Converter.getErrorStatus(); | 200 ErrorStatus = Converter.getErrorStatus(); |
204 } | 201 } |
| 202 if (SubzeroTimingEnabled) |
| 203 Ctx.dumpTimers(); |
205 const bool FinalStats = true; | 204 const bool FinalStats = true; |
206 Ctx.dumpStats("_FINAL_", FinalStats); | 205 Ctx.dumpStats("_FINAL_", FinalStats); |
207 return ErrorStatus; | 206 return ErrorStatus; |
208 } | 207 } |
OLD | NEW |