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

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: Add llvm:: prefix 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
« no previous file with comments | « src/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | 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/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(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(TLS)->StatsFunction.updateEmitted(InstCount);
189 getStatsCumulative()->updateEmitted(InstCount); 189 getStatsCumulative()->updateEmitted(InstCount);
190 } 190 }
191 void statsUpdateRegistersSaved(uint32_t Num) { 191 void statsUpdateRegistersSaved(uint32_t Num) {
192 if (!ALLOW_DUMP || !getFlags().DumpStats) 192 if (!ALLOW_DUMP || !getFlags().DumpStats)
193 return; 193 return;
194 TLS->StatsFunction.updateRegistersSaved(Num); 194 ICE_TLS_GET_FIELD(TLS)->StatsFunction.updateRegistersSaved(Num);
195 getStatsCumulative()->updateRegistersSaved(Num); 195 getStatsCumulative()->updateRegistersSaved(Num);
196 } 196 }
197 void statsUpdateFrameBytes(uint32_t Bytes) { 197 void statsUpdateFrameBytes(uint32_t Bytes) {
198 if (!ALLOW_DUMP || !getFlags().DumpStats) 198 if (!ALLOW_DUMP || !getFlags().DumpStats)
199 return; 199 return;
200 TLS->StatsFunction.updateFrameBytes(Bytes); 200 ICE_TLS_GET_FIELD(TLS)->StatsFunction.updateFrameBytes(Bytes);
201 getStatsCumulative()->updateFrameBytes(Bytes); 201 getStatsCumulative()->updateFrameBytes(Bytes);
202 } 202 }
203 void statsUpdateSpills() { 203 void statsUpdateSpills() {
204 if (!ALLOW_DUMP || !getFlags().DumpStats) 204 if (!ALLOW_DUMP || !getFlags().DumpStats)
205 return; 205 return;
206 TLS->StatsFunction.updateSpills(); 206 ICE_TLS_GET_FIELD(TLS)->StatsFunction.updateSpills();
207 getStatsCumulative()->updateSpills(); 207 getStatsCumulative()->updateSpills();
208 } 208 }
209 void statsUpdateFills() { 209 void statsUpdateFills() {
210 if (!ALLOW_DUMP || !getFlags().DumpStats) 210 if (!ALLOW_DUMP || !getFlags().DumpStats)
211 return; 211 return;
212 TLS->StatsFunction.updateFills(); 212 ICE_TLS_GET_FIELD(TLS)->StatsFunction.updateFills();
213 getStatsCumulative()->updateFills(); 213 getStatsCumulative()->updateFills();
214 } 214 }
215 215
216 // These are predefined TimerStackIdT values. 216 // These are predefined TimerStackIdT values.
217 enum TimerStackKind { 217 enum TimerStackKind {
218 TSK_Default = 0, 218 TSK_Default = 0,
219 TSK_Funcs, 219 TSK_Funcs,
220 TSK_Num 220 TSK_Num
221 }; 221 };
222 222
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 LockedPtr<CodeStats> getStatsCumulative() { 267 LockedPtr<CodeStats> getStatsCumulative() {
268 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock); 268 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock);
269 } 269 }
270 LockedPtr<std::vector<TimerStack>> getTimers() { 270 LockedPtr<std::vector<TimerStack>> getTimers() {
271 return LockedPtr<std::vector<TimerStack>>(&Timers, &TimerLock); 271 return LockedPtr<std::vector<TimerStack>>(&Timers, &TimerLock);
272 } 272 }
273 273
274 std::vector<ThreadContext *> AllThreadContexts; 274 std::vector<ThreadContext *> AllThreadContexts;
275 // Each thread has its own TLS pointer which is also held in 275 // Each thread has its own TLS pointer which is also held in
276 // AllThreadContexts. 276 // AllThreadContexts.
277 ICE_ATTRIBUTE_TLS static ThreadContext *TLS; 277 ICE_TLS_DECLARE_FIELD(ThreadContext *, TLS);
278 278
279 // Private helpers for mangleName() 279 // Private helpers for mangleName()
280 typedef llvm::SmallVector<char, 32> ManglerVector; 280 typedef llvm::SmallVector<char, 32> ManglerVector;
281 void incrementSubstitutions(ManglerVector &OldName) const; 281 void incrementSubstitutions(ManglerVector &OldName) const;
282
283 public:
284 static void TlsInit() { ICE_TLS_INIT_FIELD(TLS); }
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 {
288 TimerMarker(const TimerMarker &) = delete; 291 TimerMarker(const TimerMarker &) = delete;
289 TimerMarker &operator=(const TimerMarker &) = delete; 292 TimerMarker &operator=(const TimerMarker &) = delete;
290 293
291 public: 294 public:
(...skipping 30 matching lines...) Expand all
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698