| 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 /// \file | 10 /// \file |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 CodeStats() { reset(); } | 99 CodeStats() { reset(); } |
| 100 void reset() { Stats.fill(0); } | 100 void reset() { Stats.fill(0); } |
| 101 void update(CSTag Tag, uint32_t Count = 1) { | 101 void update(CSTag Tag, uint32_t Count = 1) { |
| 102 assert(Tag < Stats.size()); | 102 assert(Tag < Stats.size()); |
| 103 Stats[Tag] += Count; | 103 Stats[Tag] += Count; |
| 104 } | 104 } |
| 105 void add(const CodeStats &Other) { | 105 void add(const CodeStats &Other) { |
| 106 for (uint32_t i = 0; i < Stats.size(); ++i) | 106 for (uint32_t i = 0; i < Stats.size(); ++i) |
| 107 Stats[i] += Other.Stats[i]; | 107 Stats[i] += Other.Stats[i]; |
| 108 } | 108 } |
| 109 void dump(const std::string &Name, GlobalContext *Ctx); | 109 /// Dumps the stats for the given Cfg. If Func==nullptr, it identifies it |
| 110 /// as the "final" cumulative stats instead as a specific function's name. |
| 111 void dump(const Cfg *Func, GlobalContext *Ctx); |
| 110 | 112 |
| 111 private: | 113 private: |
| 112 std::array<uint32_t, CS_NUM> Stats; | 114 std::array<uint32_t, CS_NUM> Stats; |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 /// TimerList is a vector of TimerStack objects, with extra methods | 117 /// TimerList is a vector of TimerStack objects, with extra methods |
| 116 /// to initialize and merge these vectors. | 118 /// to initialize and merge these vectors. |
| 117 class TimerList : public std::vector<TimerStack> { | 119 class TimerList : public std::vector<TimerStack> { |
| 118 TimerList(const TimerList &) = delete; | 120 TimerList(const TimerList &) = delete; |
| 119 TimerList &operator=(const TimerList &) = delete; | 121 TimerList &operator=(const TimerList &) = delete; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 296 |
| 295 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } | 297 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } |
| 296 | 298 |
| 297 ELFObjectWriter *getObjectWriter() const { return ObjectWriter.get(); } | 299 ELFObjectWriter *getObjectWriter() const { return ObjectWriter.get(); } |
| 298 | 300 |
| 299 /// Reset stats at the beginning of a function. | 301 /// Reset stats at the beginning of a function. |
| 300 void resetStats() { | 302 void resetStats() { |
| 301 if (BuildDefs::dump()) | 303 if (BuildDefs::dump()) |
| 302 ICE_TLS_GET_FIELD(TLS)->StatsFunction.reset(); | 304 ICE_TLS_GET_FIELD(TLS)->StatsFunction.reset(); |
| 303 } | 305 } |
| 304 void dumpStats(const std::string &Name, bool Final = false); | 306 void dumpStats(const Cfg *Func = nullptr); |
| 305 void statsUpdateEmitted(uint32_t InstCount) { | 307 void statsUpdateEmitted(uint32_t InstCount) { |
| 306 if (!getFlags().getDumpStats()) | 308 if (!getFlags().getDumpStats()) |
| 307 return; | 309 return; |
| 308 ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS); | 310 ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS); |
| 309 Tls->StatsFunction.update(CodeStats::CS_InstCount, InstCount); | 311 Tls->StatsFunction.update(CodeStats::CS_InstCount, InstCount); |
| 310 Tls->StatsCumulative.update(CodeStats::CS_InstCount, InstCount); | 312 Tls->StatsCumulative.update(CodeStats::CS_InstCount, InstCount); |
| 311 } | 313 } |
| 312 void statsUpdateRegistersSaved(uint32_t Num) { | 314 void statsUpdateRegistersSaved(uint32_t Num) { |
| 313 if (!getFlags().getDumpStats()) | 315 if (!getFlags().getDumpStats()) |
| 314 return; | 316 return; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 679 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
| 678 ~OstreamLocker() { Ctx->unlockStr(); } | 680 ~OstreamLocker() { Ctx->unlockStr(); } |
| 679 | 681 |
| 680 private: | 682 private: |
| 681 GlobalContext *const Ctx; | 683 GlobalContext *const Ctx; |
| 682 }; | 684 }; |
| 683 | 685 |
| 684 } // end of namespace Ice | 686 } // end of namespace Ice |
| 685 | 687 |
| 686 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 688 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| OLD | NEW |