| OLD | NEW | 
|---|
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 65   // CodeStats collects rudimentary statistics during translation. | 65   // CodeStats collects rudimentary statistics during translation. | 
| 66   class CodeStats { | 66   class CodeStats { | 
| 67     CodeStats(const CodeStats &) = delete; | 67     CodeStats(const CodeStats &) = delete; | 
| 68     CodeStats &operator=(const CodeStats &) = default; | 68     CodeStats &operator=(const CodeStats &) = default; | 
| 69 #define CODESTATS_TABLE                                                        \ | 69 #define CODESTATS_TABLE                                                        \ | 
| 70   /* dump string, enum value */                                                \ | 70   /* dump string, enum value */                                                \ | 
| 71   X("Inst Count  ", InstCount)                                                 \ | 71   X("Inst Count  ", InstCount)                                                 \ | 
| 72   X("Regs Saved  ", RegsSaved)                                                 \ | 72   X("Regs Saved  ", RegsSaved)                                                 \ | 
| 73   X("Frame Bytes ", FrameByte)                                                 \ | 73   X("Frame Bytes ", FrameByte)                                                 \ | 
| 74   X("Spills      ", NumSpills)                                                 \ | 74   X("Spills      ", NumSpills)                                                 \ | 
| 75   X("Fills       ", NumFills) | 75   X("Fills       ", NumFills)                                                  \ | 
|  | 76   X("R/P Imms    ", NumRPImms) | 
| 76     //#define X(str, tag) | 77     //#define X(str, tag) | 
| 77 | 78 | 
| 78   public: | 79   public: | 
| 79     enum CSTag { | 80     enum CSTag { | 
| 80 #define X(str, tag) CS_##tag, | 81 #define X(str, tag) CS_##tag, | 
| 81       CODESTATS_TABLE | 82       CODESTATS_TABLE | 
| 82 #undef X | 83 #undef X | 
| 83           CS_NUM | 84           CS_NUM | 
| 84     }; | 85     }; | 
| 85     CodeStats() { reset(); } | 86     CodeStats() { reset(); } | 
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 256     Tls->StatsCumulative.update(CodeStats::CS_NumSpills); | 257     Tls->StatsCumulative.update(CodeStats::CS_NumSpills); | 
| 257   } | 258   } | 
| 258   void statsUpdateFills() { | 259   void statsUpdateFills() { | 
| 259     if (!getFlags().getDumpStats()) | 260     if (!getFlags().getDumpStats()) | 
| 260       return; | 261       return; | 
| 261     ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS); | 262     ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS); | 
| 262     Tls->StatsFunction.update(CodeStats::CS_NumFills); | 263     Tls->StatsFunction.update(CodeStats::CS_NumFills); | 
| 263     Tls->StatsCumulative.update(CodeStats::CS_NumFills); | 264     Tls->StatsCumulative.update(CodeStats::CS_NumFills); | 
| 264   } | 265   } | 
| 265 | 266 | 
|  | 267   // Number of Randomized or Pooled Immediates | 
|  | 268   void statsUpdateRPImms() { | 
|  | 269     if (!getFlags().getDumpStats()) | 
|  | 270       return; | 
|  | 271     ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS); | 
|  | 272     Tls->StatsFunction.update(CodeStats::CS_NumRPImms); | 
|  | 273     Tls->StatsCumulative.update(CodeStats::CS_NumRPImms); | 
|  | 274   } | 
|  | 275 | 
| 266   // These are predefined TimerStackIdT values. | 276   // These are predefined TimerStackIdT values. | 
| 267   enum TimerStackKind { TSK_Default = 0, TSK_Funcs, TSK_Num }; | 277   enum TimerStackKind { TSK_Default = 0, TSK_Funcs, TSK_Num }; | 
| 268 | 278 | 
| 269   // newTimerStackID() creates a new TimerStack in the global space. | 279   // newTimerStackID() creates a new TimerStack in the global space. | 
| 270   // It does not affect any TimerStack objects in TLS. | 280   // It does not affect any TimerStack objects in TLS. | 
| 271   TimerStackIdT newTimerStackID(const IceString &Name); | 281   TimerStackIdT newTimerStackID(const IceString &Name); | 
| 272   // dumpTimers() dumps the global timer data.  As such, one probably | 282   // dumpTimers() dumps the global timer data.  As such, one probably | 
| 273   // wants to call mergeTimerStacks() as a prerequisite. | 283   // wants to call mergeTimerStacks() as a prerequisite. | 
| 274   void dumpTimers(TimerStackIdT StackID = TSK_Default, | 284   void dumpTimers(TimerStackIdT StackID = TSK_Default, | 
| 275                   bool DumpCumulative = true); | 285                   bool DumpCumulative = true); | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 393   // This is used in a few cases where we want to take some action on | 403   // This is used in a few cases where we want to take some action on | 
| 394   // a particular function or symbol based on a command-line argument, | 404   // a particular function or symbol based on a command-line argument, | 
| 395   // such as changing the verbose level for a particular function.  An | 405   // such as changing the verbose level for a particular function.  An | 
| 396   // empty Match argument means match everything.  Returns true if | 406   // empty Match argument means match everything.  Returns true if | 
| 397   // there is a match. | 407   // there is a match. | 
| 398   static bool matchSymbolName(const IceString &SymbolName, | 408   static bool matchSymbolName(const IceString &SymbolName, | 
| 399                               const IceString &Match) { | 409                               const IceString &Match) { | 
| 400     return Match.empty() || Match == SymbolName; | 410     return Match.empty() || Match == SymbolName; | 
| 401   } | 411   } | 
| 402 | 412 | 
|  | 413   // Return the randomization cookie for diversification. | 
|  | 414   // Initialize the cookie if necessary | 
|  | 415   uint32_t getRandomizationCookie() const { return RandomizationCookie; } | 
|  | 416 | 
| 403 private: | 417 private: | 
| 404   // Try to ensure mutexes are allocated on separate cache lines. | 418   // Try to ensure mutexes are allocated on separate cache lines. | 
| 405 | 419 | 
| 406   ICE_CACHELINE_BOUNDARY; | 420   ICE_CACHELINE_BOUNDARY; | 
| 407   // Managed by getAllocator() | 421   // Managed by getAllocator() | 
| 408   GlobalLockType AllocLock; | 422   GlobalLockType AllocLock; | 
| 409   ArenaAllocator<> Allocator; | 423   ArenaAllocator<> Allocator; | 
| 410 | 424 | 
| 411   ICE_CACHELINE_BOUNDARY; | 425   ICE_CACHELINE_BOUNDARY; | 
| 412   // Managed by getConstantPool() | 426   // Managed by getConstantPool() | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 488   llvm::SmallVector<std::thread, 128> TranslationThreads; | 502   llvm::SmallVector<std::thread, 128> TranslationThreads; | 
| 489   llvm::SmallVector<std::thread, 128> EmitterThreads; | 503   llvm::SmallVector<std::thread, 128> EmitterThreads; | 
| 490   // Each thread has its own TLS pointer which is also held in | 504   // Each thread has its own TLS pointer which is also held in | 
| 491   // AllThreadContexts. | 505   // AllThreadContexts. | 
| 492   ICE_TLS_DECLARE_FIELD(ThreadContext *, TLS); | 506   ICE_TLS_DECLARE_FIELD(ThreadContext *, TLS); | 
| 493 | 507 | 
| 494   // Private helpers for mangleName() | 508   // Private helpers for mangleName() | 
| 495   typedef llvm::SmallVector<char, 32> ManglerVector; | 509   typedef llvm::SmallVector<char, 32> ManglerVector; | 
| 496   void incrementSubstitutions(ManglerVector &OldName) const; | 510   void incrementSubstitutions(ManglerVector &OldName) const; | 
| 497 | 511 | 
|  | 512   // Randomization Cookie | 
|  | 513   // Managed by getRandomizationCookie() | 
|  | 514   GlobalLockType RandomizationCookieLock; | 
|  | 515   uint32_t RandomizationCookie; | 
|  | 516 | 
| 498 public: | 517 public: | 
| 499   static void TlsInit() { ICE_TLS_INIT_FIELD(TLS); } | 518   static void TlsInit() { ICE_TLS_INIT_FIELD(TLS); } | 
| 500 }; | 519 }; | 
| 501 | 520 | 
| 502 // Helper class to push and pop a timer marker.  The constructor | 521 // Helper class to push and pop a timer marker.  The constructor | 
| 503 // pushes a marker, and the destructor pops it.  This is for | 522 // pushes a marker, and the destructor pops it.  This is for | 
| 504 // convenient timing of regions of code. | 523 // convenient timing of regions of code. | 
| 505 class TimerMarker { | 524 class TimerMarker { | 
| 506   TimerMarker() = delete; | 525   TimerMarker() = delete; | 
| 507   TimerMarker(const TimerMarker &) = delete; | 526   TimerMarker(const TimerMarker &) = delete; | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 548   explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 567   explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 
| 549   ~OstreamLocker() { Ctx->unlockStr(); } | 568   ~OstreamLocker() { Ctx->unlockStr(); } | 
| 550 | 569 | 
| 551 private: | 570 private: | 
| 552   GlobalContext *const Ctx; | 571   GlobalContext *const Ctx; | 
| 553 }; | 572 }; | 
| 554 | 573 | 
| 555 } // end of namespace Ice | 574 } // end of namespace Ice | 
| 556 | 575 | 
| 557 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 576 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 
| OLD | NEW | 
|---|