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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 | 470 |
471 void setDisposeGlobalVariablesAfterLowering(bool Value) { | 471 void setDisposeGlobalVariablesAfterLowering(bool Value) { |
472 DisposeGlobalVariablesAfterLowering = Value; | 472 DisposeGlobalVariablesAfterLowering = Value; |
473 } | 473 } |
474 /// @} | 474 /// @} |
475 | 475 |
476 LockedPtr<StringPool> getStrings() const { | 476 LockedPtr<StringPool> getStrings() const { |
477 return LockedPtr<StringPool>(Strings.get(), &StringsLock); | 477 return LockedPtr<StringPool>(Strings.get(), &StringsLock); |
478 } | 478 } |
479 | 479 |
480 /// Number of function blocks that can be queued before waiting for | |
Jim Stichnoth
2016/04/13 15:33:19
reflow comment
| |
481 /// translation | |
482 /// threads to consume. | |
483 static constexpr size_t MaxOptQSize = 1 << 16; | |
484 | |
480 private: | 485 private: |
481 // Try to ensure mutexes are allocated on separate cache lines. | 486 // Try to ensure mutexes are allocated on separate cache lines. |
482 | 487 |
483 // Destructors collaborate with Allocator | 488 // Destructors collaborate with Allocator |
484 ICE_CACHELINE_BOUNDARY; | 489 ICE_CACHELINE_BOUNDARY; |
485 // Managed by getAllocator() | 490 // Managed by getAllocator() |
486 mutable GlobalLockType AllocLock; | 491 mutable GlobalLockType AllocLock; |
487 ArenaAllocator Allocator; | 492 ArenaAllocator Allocator; |
488 | 493 |
489 ICE_CACHELINE_BOUNDARY; | 494 ICE_CACHELINE_BOUNDARY; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 Ostream *StrError; /// Stream for logging errors. | 541 Ostream *StrError; /// Stream for logging errors. |
537 | 542 |
538 // True if waitForWorkerThreads() has been called. | 543 // True if waitForWorkerThreads() has been called. |
539 std::atomic_bool WaitForWorkerThreadsCalled; | 544 std::atomic_bool WaitForWorkerThreadsCalled; |
540 | 545 |
541 ICE_CACHELINE_BOUNDARY; | 546 ICE_CACHELINE_BOUNDARY; |
542 | 547 |
543 Intrinsics IntrinsicsInfo; | 548 Intrinsics IntrinsicsInfo; |
544 // TODO(jpp): move to EmitterContext. | 549 // TODO(jpp): move to EmitterContext. |
545 std::unique_ptr<ELFObjectWriter> ObjectWriter; | 550 std::unique_ptr<ELFObjectWriter> ObjectWriter; |
546 static constexpr size_t MaxOptQSize = 1 << 16; | 551 // Value defining when to wake up the main parse thread. |
552 const size_t OptQWakeupSize; | |
547 BoundedProducerConsumerQueue<OptWorkItem, MaxOptQSize> OptQ; | 553 BoundedProducerConsumerQueue<OptWorkItem, MaxOptQSize> OptQ; |
548 BoundedProducerConsumerQueue<EmitterWorkItem> EmitQ; | 554 BoundedProducerConsumerQueue<EmitterWorkItem> EmitQ; |
549 // DataLowering is only ever used by a single thread at a time (either in | 555 // DataLowering is only ever used by a single thread at a time (either in |
550 // emitItems(), or in IceCompiler::run before the compilation is over.) | 556 // emitItems(), or in IceCompiler::run before the compilation is over.) |
551 // TODO(jpp): move to EmitterContext. | 557 // TODO(jpp): move to EmitterContext. |
552 std::unique_ptr<TargetDataLowering> DataLowering; | 558 std::unique_ptr<TargetDataLowering> DataLowering; |
553 /// If !HasEmittedCode, SubZero will accumulate all Globals (which are "true" | 559 /// If !HasEmittedCode, SubZero will accumulate all Globals (which are "true" |
554 /// program global variables) until the first code WorkItem is seen. | 560 /// program global variables) until the first code WorkItem is seen. |
555 // TODO(jpp): move to EmitterContext. | 561 // TODO(jpp): move to EmitterContext. |
556 bool HasSeenCode = false; | 562 bool HasSeenCode = false; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 684 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
679 ~OstreamLocker() { Ctx->unlockStr(); } | 685 ~OstreamLocker() { Ctx->unlockStr(); } |
680 | 686 |
681 private: | 687 private: |
682 GlobalContext *const Ctx; | 688 GlobalContext *const Ctx; |
683 }; | 689 }; |
684 | 690 |
685 } // end of namespace Ice | 691 } // end of namespace Ice |
686 | 692 |
687 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 693 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |