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

Side by Side Diff: src/IceGlobalContext.h

Issue 872933002: Subzero: Second attempt at fixing MacOS 10.6 build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix comment Created 5 years, 10 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
OLDNEW
1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===// 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===//
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 declares aspects of the compilation that persist across 10 // This file declares aspects of the compilation that persist across
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 // TODO(wala,stichnot): Make the RNG play nicely with multithreaded 173 // TODO(wala,stichnot): Make the RNG play nicely with multithreaded
174 // translation. 174 // translation.
175 RandomNumberGenerator &getRNG() { return RNG; } 175 RandomNumberGenerator &getRNG() { return RNG; }
176 176
177 ELFObjectWriter *getObjectWriter() const { return ObjectWriter.get(); } 177 ELFObjectWriter *getObjectWriter() const { return ObjectWriter.get(); }
178 178
179 // Reset stats at the beginning of a function. 179 // Reset stats at the beginning of a function.
180 void resetStats() { 180 void resetStats() {
181 if (ALLOW_DUMP) 181 if (ALLOW_DUMP)
182 TLS->StatsFunction.reset(); 182 ICE_TLS_GET_FIELD(ThreadContext *, TLS)->StatsFunction.reset();
183 } 183 }
184 void dumpStats(const IceString &Name, bool Final = false); 184 void dumpStats(const IceString &Name, bool Final = false);
185 void statsUpdateEmitted(uint32_t InstCount) { 185 void statsUpdateEmitted(uint32_t InstCount) {
186 if (!ALLOW_DUMP || !getFlags().DumpStats) 186 if (!ALLOW_DUMP || !getFlags().DumpStats)
187 return; 187 return;
188 TLS->StatsFunction.updateEmitted(InstCount); 188 ICE_TLS_GET_FIELD(ThreadContext *, TLS)
189 ->StatsFunction.updateEmitted(InstCount);
189 getStatsCumulative()->updateEmitted(InstCount); 190 getStatsCumulative()->updateEmitted(InstCount);
190 } 191 }
191 void statsUpdateRegistersSaved(uint32_t Num) { 192 void statsUpdateRegistersSaved(uint32_t Num) {
192 if (!ALLOW_DUMP || !getFlags().DumpStats) 193 if (!ALLOW_DUMP || !getFlags().DumpStats)
193 return; 194 return;
194 TLS->StatsFunction.updateRegistersSaved(Num); 195 ICE_TLS_GET_FIELD(ThreadContext *, TLS)
196 ->StatsFunction.updateRegistersSaved(Num);
195 getStatsCumulative()->updateRegistersSaved(Num); 197 getStatsCumulative()->updateRegistersSaved(Num);
196 } 198 }
197 void statsUpdateFrameBytes(uint32_t Bytes) { 199 void statsUpdateFrameBytes(uint32_t Bytes) {
198 if (!ALLOW_DUMP || !getFlags().DumpStats) 200 if (!ALLOW_DUMP || !getFlags().DumpStats)
199 return; 201 return;
200 TLS->StatsFunction.updateFrameBytes(Bytes); 202 ICE_TLS_GET_FIELD(ThreadContext *, TLS)
203 ->StatsFunction.updateFrameBytes(Bytes);
201 getStatsCumulative()->updateFrameBytes(Bytes); 204 getStatsCumulative()->updateFrameBytes(Bytes);
202 } 205 }
203 void statsUpdateSpills() { 206 void statsUpdateSpills() {
204 if (!ALLOW_DUMP || !getFlags().DumpStats) 207 if (!ALLOW_DUMP || !getFlags().DumpStats)
205 return; 208 return;
206 TLS->StatsFunction.updateSpills(); 209 ICE_TLS_GET_FIELD(ThreadContext *, TLS)->StatsFunction.updateSpills();
207 getStatsCumulative()->updateSpills(); 210 getStatsCumulative()->updateSpills();
208 } 211 }
209 void statsUpdateFills() { 212 void statsUpdateFills() {
210 if (!ALLOW_DUMP || !getFlags().DumpStats) 213 if (!ALLOW_DUMP || !getFlags().DumpStats)
211 return; 214 return;
212 TLS->StatsFunction.updateFills(); 215 ICE_TLS_GET_FIELD(ThreadContext *, TLS)->StatsFunction.updateFills();
213 getStatsCumulative()->updateFills(); 216 getStatsCumulative()->updateFills();
214 } 217 }
215 218
216 // These are predefined TimerStackIdT values. 219 // These are predefined TimerStackIdT values.
217 enum TimerStackKind { 220 enum TimerStackKind {
218 TSK_Default = 0, 221 TSK_Default = 0,
219 TSK_Funcs, 222 TSK_Funcs,
220 TSK_Num 223 TSK_Num
221 }; 224 };
222 225
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 LockedPtr<CodeStats> getStatsCumulative() { 270 LockedPtr<CodeStats> getStatsCumulative() {
268 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock); 271 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock);
269 } 272 }
270 LockedPtr<std::vector<TimerStack>> getTimers() { 273 LockedPtr<std::vector<TimerStack>> getTimers() {
271 return LockedPtr<std::vector<TimerStack>>(&Timers, &TimerLock); 274 return LockedPtr<std::vector<TimerStack>>(&Timers, &TimerLock);
272 } 275 }
273 276
274 std::vector<ThreadContext *> AllThreadContexts; 277 std::vector<ThreadContext *> AllThreadContexts;
275 // Each thread has its own TLS pointer which is also held in 278 // Each thread has its own TLS pointer which is also held in
276 // AllThreadContexts. 279 // AllThreadContexts.
277 ICE_ATTRIBUTE_TLS static ThreadContext *TLS; 280 ICE_TLS_DECLARE_FIELD(ThreadContext *, TLS);
278 281
279 // Private helpers for mangleName() 282 // Private helpers for mangleName()
280 typedef llvm::SmallVector<char, 32> ManglerVector; 283 typedef llvm::SmallVector<char, 32> ManglerVector;
281 void incrementSubstitutions(ManglerVector &OldName) const; 284 void incrementSubstitutions(ManglerVector &OldName) const;
282 }; 285 };
283 286
284 // Helper class to push and pop a timer marker. The constructor 287 // Helper class to push and pop a timer marker. The constructor
285 // pushes a marker, and the destructor pops it. This is for 288 // pushes a marker, and the destructor pops it. This is for
286 // convenient timing of regions of code. 289 // convenient timing of regions of code.
287 class TimerMarker { 290 class TimerMarker {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } 325 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); }
323 ~OstreamLocker() { Ctx->unlockStr(); } 326 ~OstreamLocker() { Ctx->unlockStr(); }
324 327
325 private: 328 private:
326 GlobalContext *const Ctx; 329 GlobalContext *const Ctx;
327 }; 330 };
328 331
329 } // end of namespace Ice 332 } // end of namespace Ice
330 333
331 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H 334 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « src/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | src/IceTLS.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698