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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 ~LockedPtr() { Lock->unlock(); } | 52 ~LockedPtr() { Lock->unlock(); } |
53 T *operator->() const { return Value; } | 53 T *operator->() const { return Value; } |
54 | 54 |
55 private: | 55 private: |
56 T *Value; | 56 T *Value; |
57 GlobalLockType *Lock; | 57 GlobalLockType *Lock; |
58 }; | 58 }; |
59 | 59 |
60 class GlobalContext { | 60 class GlobalContext { |
| 61 GlobalContext() = delete; |
61 GlobalContext(const GlobalContext &) = delete; | 62 GlobalContext(const GlobalContext &) = delete; |
62 GlobalContext &operator=(const GlobalContext &) = delete; | 63 GlobalContext &operator=(const GlobalContext &) = delete; |
63 | 64 |
64 // CodeStats collects rudimentary statistics during translation. | 65 // CodeStats collects rudimentary statistics during translation. |
65 class CodeStats { | 66 class CodeStats { |
66 CodeStats(const CodeStats &) = delete; | 67 CodeStats(const CodeStats &) = delete; |
67 CodeStats &operator=(const CodeStats &) = default; | 68 CodeStats &operator=(const CodeStats &) = default; |
68 #define CODESTATS_TABLE \ | 69 #define CODESTATS_TABLE \ |
69 /* dump string, enum value */ \ | 70 /* dump string, enum value */ \ |
70 X("Inst Count ", InstCount) \ | 71 X("Inst Count ", InstCount) \ |
(...skipping 22 matching lines...) Expand all Loading... |
93 } | 94 } |
94 void dump(const IceString &Name, Ostream &Str); | 95 void dump(const IceString &Name, Ostream &Str); |
95 | 96 |
96 private: | 97 private: |
97 std::array<uint32_t, CS_NUM> Stats; | 98 std::array<uint32_t, CS_NUM> Stats; |
98 }; | 99 }; |
99 | 100 |
100 // TimerList is a vector of TimerStack objects, with extra methods | 101 // TimerList is a vector of TimerStack objects, with extra methods |
101 // to initialize and merge these vectors. | 102 // to initialize and merge these vectors. |
102 class TimerList : public std::vector<TimerStack> { | 103 class TimerList : public std::vector<TimerStack> { |
| 104 TimerList(const TimerList &) = delete; |
| 105 TimerList &operator=(const TimerList &) = delete; |
| 106 |
103 public: | 107 public: |
| 108 TimerList() = default; |
104 // initInto() initializes a target list of timers based on the | 109 // initInto() initializes a target list of timers based on the |
105 // current list. In particular, it creates the same number of | 110 // current list. In particular, it creates the same number of |
106 // timers, in the same order, with the same names, but initially | 111 // timers, in the same order, with the same names, but initially |
107 // empty of timing data. | 112 // empty of timing data. |
108 void initInto(TimerList &Dest) const { | 113 void initInto(TimerList &Dest) const { |
109 if (!ALLOW_DUMP) | 114 if (!ALLOW_DUMP) |
110 return; | 115 return; |
111 Dest.clear(); | 116 Dest.clear(); |
112 for (const TimerStack &Stack : *this) { | 117 for (const TimerStack &Stack : *this) { |
113 Dest.push_back(TimerStack(Stack.getName())); | 118 Dest.push_back(TimerStack(Stack.getName())); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 void incrementSubstitutions(ManglerVector &OldName) const; | 455 void incrementSubstitutions(ManglerVector &OldName) const; |
451 | 456 |
452 public: | 457 public: |
453 static void TlsInit() { ICE_TLS_INIT_FIELD(TLS); } | 458 static void TlsInit() { ICE_TLS_INIT_FIELD(TLS); } |
454 }; | 459 }; |
455 | 460 |
456 // Helper class to push and pop a timer marker. The constructor | 461 // Helper class to push and pop a timer marker. The constructor |
457 // pushes a marker, and the destructor pops it. This is for | 462 // pushes a marker, and the destructor pops it. This is for |
458 // convenient timing of regions of code. | 463 // convenient timing of regions of code. |
459 class TimerMarker { | 464 class TimerMarker { |
| 465 TimerMarker() = delete; |
460 TimerMarker(const TimerMarker &) = delete; | 466 TimerMarker(const TimerMarker &) = delete; |
461 TimerMarker &operator=(const TimerMarker &) = delete; | 467 TimerMarker &operator=(const TimerMarker &) = delete; |
462 | 468 |
463 public: | 469 public: |
464 TimerMarker(TimerIdT ID, GlobalContext *Ctx, | 470 TimerMarker(TimerIdT ID, GlobalContext *Ctx, |
465 TimerStackIdT StackID = GlobalContext::TSK_Default) | 471 TimerStackIdT StackID = GlobalContext::TSK_Default) |
466 : ID(ID), Ctx(Ctx), StackID(StackID), Active(false) { | 472 : ID(ID), Ctx(Ctx), StackID(StackID), Active(false) { |
467 if (ALLOW_DUMP) | 473 if (ALLOW_DUMP) |
468 push(); | 474 push(); |
469 } | 475 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 507 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
502 ~OstreamLocker() { Ctx->unlockStr(); } | 508 ~OstreamLocker() { Ctx->unlockStr(); } |
503 | 509 |
504 private: | 510 private: |
505 GlobalContext *const Ctx; | 511 GlobalContext *const Ctx; |
506 }; | 512 }; |
507 | 513 |
508 } // end of namespace Ice | 514 } // end of namespace Ice |
509 | 515 |
510 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 516 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |