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

Side by Side Diff: src/llvm2ice.cpp

Issue 620373004: Subzero: Add a few performance measurement tools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Improve the use of containers 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
« no previous file with comments | « 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 static cl::opt<bool> 88 static cl::opt<bool>
89 DisableInternal("externalize", 89 DisableInternal("externalize",
90 cl::desc("Externalize all symbols")); 90 cl::desc("Externalize all symbols"));
91 static cl::opt<bool> 91 static cl::opt<bool>
92 DisableTranslation("notranslate", cl::desc("Disable Subzero translation")); 92 DisableTranslation("notranslate", cl::desc("Disable Subzero translation"));
93 93
94 static cl::opt<bool> SubzeroTimingEnabled( 94 static cl::opt<bool> SubzeroTimingEnabled(
95 "timing", cl::desc("Enable breakdown timing of Subzero translation")); 95 "timing", cl::desc("Enable breakdown timing of Subzero translation"));
96 96
97 static cl::opt<bool> 97 static cl::opt<bool>
98 DisableGlobals("disable-globals", 98 TimeEachFunction("timing-funcs",
99 cl::desc("Disable global initializer translation")); 99 cl::desc("Print total translation time for each function"));
100
101 static cl::opt<std::string> TimingFocusOn(
102 "timing-focus",
103 cl::desc("Break down timing for a specific function (use '*' for all)"),
104 cl::init(""));
105
106 static cl::opt<std::string> VerboseFocusOn(
107 "verbose-focus",
108 cl::desc("Temporarily enable full verbosity for a specific function"),
109 cl::init(""));
110
111 static cl::opt<bool>
112 DisableGlobals("disable-globals",
113 cl::desc("Disable global initializer translation"));
100 114
101 // This is currently unused, and is a placeholder for lit tests. 115 // This is currently unused, and is a placeholder for lit tests.
102 static cl::opt<bool> 116 static cl::opt<bool>
103 DisablePhiEdgeSplit("no-phi-edge-split", 117 DisablePhiEdgeSplit("no-phi-edge-split",
104 cl::desc("Disable edge splitting for Phi lowering")); 118 cl::desc("Disable edge splitting for Phi lowering"));
105 119
106 static cl::opt<bool> 120 static cl::opt<bool>
107 DumpStats("stats", 121 DumpStats("stats",
108 cl::desc("Print statistics after translating each function")); 122 cl::desc("Print statistics after translating each function"));
109 123
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 176
163 Ice::ClFlags Flags; 177 Ice::ClFlags Flags;
164 Flags.DisableInternal = DisableInternal; 178 Flags.DisableInternal = DisableInternal;
165 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled; 179 Flags.SubzeroTimingEnabled = SubzeroTimingEnabled;
166 Flags.DisableTranslation = DisableTranslation; 180 Flags.DisableTranslation = DisableTranslation;
167 Flags.DisableGlobals = DisableGlobals; 181 Flags.DisableGlobals = DisableGlobals;
168 Flags.FunctionSections = FunctionSections; 182 Flags.FunctionSections = FunctionSections;
169 Flags.UseIntegratedAssembler = UseIntegratedAssembler; 183 Flags.UseIntegratedAssembler = UseIntegratedAssembler;
170 Flags.UseSandboxing = UseSandboxing; 184 Flags.UseSandboxing = UseSandboxing;
171 Flags.DumpStats = DumpStats; 185 Flags.DumpStats = DumpStats;
186 Flags.TimeEachFunction = TimeEachFunction;
172 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; 187 Flags.DefaultGlobalPrefix = DefaultGlobalPrefix;
173 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; 188 Flags.DefaultFunctionPrefix = DefaultFunctionPrefix;
189 Flags.TimingFocusOn = TimingFocusOn;
190 Flags.VerboseFocusOn = VerboseFocusOn;
174 191
175 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix, 192 Ice::GlobalContext Ctx(Ls, Os, VMask, TargetArch, OptLevel, TestPrefix,
176 Flags); 193 Flags);
177 static Ice::TimerIdT IDszmain = Ice::GlobalContext::getTimerID("szmain"); 194 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx);
178 Ice::TimerMarker T(IDszmain, &Ctx);
179 195
180 int ErrorStatus = 0; 196 int ErrorStatus = 0;
181 if (BuildOnRead) { 197 if (BuildOnRead) {
182 Ice::PNaClTranslator Translator(&Ctx, Flags); 198 Ice::PNaClTranslator Translator(&Ctx, Flags);
183 Translator.translate(IRFilename); 199 Translator.translate(IRFilename);
184 ErrorStatus = Translator.getErrorStatus(); 200 ErrorStatus = Translator.getErrorStatus();
185 } else { 201 } else {
186 // Parse the input LLVM IR file into a module. 202 // Parse the input LLVM IR file into a module.
187 SMDiagnostic Err; 203 SMDiagnostic Err;
188 static Ice::TimerIdT IDparse = Ice::GlobalContext::getTimerID("parse"); 204 Ice::TimerMarker T1(Ice::TimerStack::TT_parse, &Ctx);
189 Ice::TimerMarker T1(IDparse, &Ctx);
190 Module *Mod = 205 Module *Mod =
191 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext()); 206 NaClParseIRFile(IRFilename, InputFileFormat, Err, getGlobalContext());
192 207
193 if (!Mod) { 208 if (!Mod) {
194 Err.print(argv[0], errs()); 209 Err.print(argv[0], errs());
195 return 1; 210 return 1;
196 } 211 }
197 212
198 Ice::Converter Converter(Mod, &Ctx, Flags); 213 Ice::Converter Converter(Mod, &Ctx, Flags);
199 Converter.convertToIce(); 214 Converter.convertToIce();
200 ErrorStatus = Converter.getErrorStatus(); 215 ErrorStatus = Converter.getErrorStatus();
201 } 216 }
217 if (TimeEachFunction) {
218 const bool DumpCumulative = false;
219 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative);
220 }
202 if (SubzeroTimingEnabled) 221 if (SubzeroTimingEnabled)
203 Ctx.dumpTimers(); 222 Ctx.dumpTimers();
204 const bool FinalStats = true; 223 const bool FinalStats = true;
205 Ctx.dumpStats("_FINAL_", FinalStats); 224 Ctx.dumpStats("_FINAL_", FinalStats);
206 return ErrorStatus; 225 return ErrorStatus;
207 } 226 }
OLDNEW
« no previous file with comments | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698