Chromium Code Reviews| Index: src/IceGlobalContext.h |
| diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h |
| index 763a75b487ced3554f3bf53127106f792eabdf31..4be18a652e7cecbbb3950062ebbf3acd4f1ae35f 100644 |
| --- a/src/IceGlobalContext.h |
| +++ b/src/IceGlobalContext.h |
| @@ -303,6 +303,8 @@ public: |
| // Emit file header for output file. |
| void emitFileHeader(); |
| + void lowerConstants(); |
| + |
| void emitQueueBlockingPush(EmitterWorkItem *Item); |
| EmitterWorkItem *emitQueueBlockingPop(); |
| void emitQueueNotifyEnd() { EmitQ.notifyEnd(); } |
| @@ -380,6 +382,13 @@ public: |
| // until the queue is empty. |
| void emitItems(); |
| + // Uses DataLowering to lower Globals. As a side effect, clears the Globals |
| + // array. |
| + void lowerGlobals(const IceString &SectionSuffix); |
| + |
| + // Lowers the profile information. |
| + void lowerProfileData(); |
| + |
| // Utility function to match a symbol name against a match string. |
| // This is used in a few cases where we want to take some action on |
| // a particular function or symbol based on a command-line argument, |
| @@ -435,6 +444,12 @@ private: |
| std::unique_ptr<ELFObjectWriter> ObjectWriter; |
| BoundedProducerConsumerQueue<Cfg> OptQ; |
| BoundedProducerConsumerQueue<EmitterWorkItem> EmitQ; |
| + std::unique_ptr<TargetDataLowering> DataLowering; |
|
Jim Stichnoth
2015/06/16 17:03:24
Non-const fields in the GlobalContext object gener
John
2015/06/16 17:30:55
The DataLowering is only ever used in
(1) emitItem
Jim Stichnoth
2015/06/17 16:04:56
I do think the fields should use a lock, to protec
|
| + // If !HasEmittedCode, SubZero will accumulate all Globals (which are "true" |
| + // program global variables) until the first code WorkItem is seen. |
| + bool HasSeenCode; |
| + VariableDeclarationList Globals; |
| + std::unique_ptr<VariableDeclaration> ProfileBlockInfoVarDecl; |
| LockedPtr<ArenaAllocator<>> getAllocator() { |
| return LockedPtr<ArenaAllocator<>>(&Allocator, &AllocLock); |
| @@ -449,6 +464,19 @@ private: |
| return LockedPtr<TimerList>(&Timers, &TimerLock); |
| } |
| + void accumulateGlobals(std::unique_ptr<VariableDeclarationList> Globls) { |
| + if (Globls != nullptr) |
| + Globals.insert(Globals.end(), Globls->begin(), Globls->end()); |
| + } |
| + |
| + void lowerGlobalsIfNoCodeHasBeenSeen() { |
| + if (HasSeenCode) |
| + return; |
| + constexpr char NoSuffix[] = ""; |
| + lowerGlobals(NoSuffix); |
| + HasSeenCode = true; |
| + } |
| + |
| llvm::SmallVector<ThreadContext *, 128> AllThreadContexts; |
| llvm::SmallVector<std::thread, 128> TranslationThreads; |
| llvm::SmallVector<std::thread, 128> EmitterThreads; |