Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: src/llvm2ice.cpp

Issue 610813002: Subzero: Rewrite the pass timing infrastructure. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« Makefile.standalone ('K') | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 Os->SetUnbuffered(); 155 Os->SetUnbuffered();
157 std::ofstream Lfs; 156 std::ofstream Lfs;
158 if (LogFilename != "-") { 157 if (LogFilename != "-") {
159 Lfs.open(LogFilename.c_str(), std::ofstream::out); 158 Lfs.open(LogFilename.c_str(), std::ofstream::out);
160 } 159 }
161 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs); 160 raw_os_ostream *Ls = new raw_os_ostream(LogFilename == "-" ? std::cout : Lfs);
162 Ls->SetUnbuffered(); 161 Ls->SetUnbuffered();
163 162
164 Ice::ClFlags Flags; 163 Ice::ClFlags Flags;
165 Flags.DisableInternal = DisableInternal; 164 Flags.DisableInternal = DisableInternal;
166 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled;
167 Flags.DisableTranslation = DisableTranslation; 165 Flags.DisableTranslation = DisableTranslation;
168 Flags.DisableGlobals = DisableGlobals; 166 Flags.DisableGlobals = DisableGlobals;
169 Flags.FunctionSections = FunctionSections; 167 Flags.FunctionSections = FunctionSections;
170 Flags.UseIntegratedAssembler = UseIntegratedAssembler; 168 Flags.UseIntegratedAssembler = UseIntegratedAssembler;
171 Flags.UseSandboxing = UseSandboxing; 169 Flags.UseSandboxing = UseSandboxing;
172 Flags.DumpStats = DumpStats; 170 Flags.DumpStats = DumpStats;
173 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; 171 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix;
174 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; 172 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix;
175 173
176 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, 174 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix,
177 Flags); 175 Flags);
176 Ice::TimerMarker T("szmain", &Ctx);
178 177
179 int ErrorStatus = 0; 178 int ErrorStatus = 0;
180 if (BuildOnRead) { 179 if (BuildOnRead) {
181 Ice::PNaClTranslator Translator(&Ctx, Flags); 180 Ice::PNaClTranslator Translator(&Ctx, Flags);
182 Translator.translate(IRFilename); 181 Translator.translate(IRFilename);
183 ErrorStatus = Translator.getErrorStatus(); 182 ErrorStatus = Translator.getErrorStatus();
184 } else { 183 } else {
185 // Parse the input LLVM IR file into a module. 184 // Parse the input LLVM IR file into a module.
186 SMDiagnostic Err; 185 SMDiagnostic Err;
187 Ice::Timer T; 186 Ice::TimerMarker("parse", &Ctx);
188 Module *Mod = 187 Module *Mod =
189 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); 188 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext());
190 189
191 if (SubzeroTimingEnabled) {
192 std::cerr << "[Subzero timing] IR Parsing: " << T.getElapsedSec()
193 << " sec\n";
194 }
195
196 if (!Mod) { 190 if (!Mod) {
197 Err.print(argv[0], errs()); 191 Err.print(argv[0], errs());
198 return 1; 192 return 1;
199 } 193 }
200 194
201 Ice::Converter Converter(Mod, &Ctx, Flags); 195 Ice::Converter Converter(Mod, &Ctx, Flags);
202 Converter.convertToIce(); 196 Converter.convertToIce();
203 ErrorStatus = Converter.getErrorStatus(); 197 ErrorStatus = Converter.getErrorStatus();
204 } 198 }
199 if (SubzeroTimingEnabled)
200 Ctx.dumpTimers();
205 const bool FinalStats = true; 201 const bool FinalStats = true;
206 Ctx.dumpStats("_FINAL_", FinalStats); 202 Ctx.dumpStats("_FINAL_", FinalStats);
207 return ErrorStatus; 203 return ErrorStatus;
208 } 204 }
OLDNEW
« Makefile.standalone ('K') | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698