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 23 matching lines...) Expand all Loading... |
34 #include <functional> | 34 #include <functional> |
35 #include <memory> | 35 #include <memory> |
36 #include <mutex> | 36 #include <mutex> |
37 #include <thread> | 37 #include <thread> |
38 #include <type_traits> | 38 #include <type_traits> |
39 #include <utility> | 39 #include <utility> |
40 #include <vector> | 40 #include <vector> |
41 | 41 |
42 namespace Ice { | 42 namespace Ice { |
43 | 43 |
44 class ClFlags; | |
45 class ConstantPool; | 44 class ConstantPool; |
46 class EmitterWorkItem; | 45 class EmitterWorkItem; |
47 class FuncSigType; | 46 class FuncSigType; |
48 | 47 |
49 // Runtime helper function IDs | 48 // Runtime helper function IDs |
50 | 49 |
51 enum class RuntimeHelper { | 50 enum class RuntimeHelper { |
52 #define X(Tag, Name) H_##Tag, | 51 #define X(Tag, Name) H_##Tag, |
53 RUNTIME_HELPER_FUNCTIONS_TABLE | 52 RUNTIME_HELPER_FUNCTIONS_TABLE |
54 #undef X | 53 #undef X |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return Result; | 265 return Result; |
267 } | 266 } |
268 GlobalString getGlobalString(const std::string &Name); | 267 GlobalString getGlobalString(const std::string &Name); |
269 | 268 |
270 /// Return a locked pointer to the registered jump tables. | 269 /// Return a locked pointer to the registered jump tables. |
271 JumpTableDataList getJumpTables(); | 270 JumpTableDataList getJumpTables(); |
272 /// Create a new jump table entry and return a reference to it. | 271 /// Create a new jump table entry and return a reference to it. |
273 JumpTableData &addJumpTable(GlobalString FuncName, SizeT Id, | 272 JumpTableData &addJumpTable(GlobalString FuncName, SizeT Id, |
274 const JumpTableData::TargetList &TargetList); | 273 const JumpTableData::TargetList &TargetList); |
275 | 274 |
276 static const ClFlags &getFlags() { return Flags; } | |
277 | |
278 /// Allocate data of type T using the global allocator. We allow entities | 275 /// Allocate data of type T using the global allocator. We allow entities |
279 /// allocated from this global allocator to be either trivially or | 276 /// allocated from this global allocator to be either trivially or |
280 /// non-trivially destructible. We optimize the case when T is trivially | 277 /// non-trivially destructible. We optimize the case when T is trivially |
281 /// destructible by not registering a destructor. Destructors will be invoked | 278 /// destructible by not registering a destructor. Destructors will be invoked |
282 /// during GlobalContext destruction in the reverse object creation order. | 279 /// during GlobalContext destruction in the reverse object creation order. |
283 template <typename T> | 280 template <typename T> |
284 typename std::enable_if<std::is_trivially_destructible<T>::value, T>::type * | 281 typename std::enable_if<std::is_trivially_destructible<T>::value, T>::type * |
285 allocate() { | 282 allocate() { |
286 return getAllocator()->Allocate<T>(); | 283 return getAllocator()->Allocate<T>(); |
287 } | 284 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 void dumpConstantLookupCounts(); | 450 void dumpConstantLookupCounts(); |
454 | 451 |
455 /// Utility function to match a symbol name against a match string. This is | 452 /// Utility function to match a symbol name against a match string. This is |
456 /// used in a few cases where we want to take some action on a particular | 453 /// used in a few cases where we want to take some action on a particular |
457 /// function or symbol based on a command-line argument, such as changing the | 454 /// function or symbol based on a command-line argument, such as changing the |
458 /// verbose level for a particular function. An empty Match argument means | 455 /// verbose level for a particular function. An empty Match argument means |
459 /// match everything. Returns true if there is a match. | 456 /// match everything. Returns true if there is a match. |
460 static bool matchSymbolName(const GlobalString &SymbolName, | 457 static bool matchSymbolName(const GlobalString &SymbolName, |
461 const std::string &Match); | 458 const std::string &Match); |
462 | 459 |
463 static ClFlags Flags; | |
464 | |
465 /// DisposeGlobalVariablesAfterLowering controls whether the memory used by | 460 /// DisposeGlobalVariablesAfterLowering controls whether the memory used by |
466 /// GlobaleVariables can be reclaimed right after they have been lowered. | 461 /// GlobaleVariables can be reclaimed right after they have been lowered. |
467 /// @{ | 462 /// @{ |
468 bool getDisposeGlobalVariablesAfterLowering() const { | 463 bool getDisposeGlobalVariablesAfterLowering() const { |
469 return DisposeGlobalVariablesAfterLowering; | 464 return DisposeGlobalVariablesAfterLowering; |
470 } | 465 } |
471 | 466 |
472 void setDisposeGlobalVariablesAfterLowering(bool Value) { | 467 void setDisposeGlobalVariablesAfterLowering(bool Value) { |
473 DisposeGlobalVariablesAfterLowering = Value; | 468 DisposeGlobalVariablesAfterLowering = Value; |
474 } | 469 } |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 674 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
680 ~OstreamLocker() { Ctx->unlockStr(); } | 675 ~OstreamLocker() { Ctx->unlockStr(); } |
681 | 676 |
682 private: | 677 private: |
683 GlobalContext *const Ctx; | 678 GlobalContext *const Ctx; |
684 }; | 679 }; |
685 | 680 |
686 } // end of namespace Ice | 681 } // end of namespace Ice |
687 | 682 |
688 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 683 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |