Chromium Code Reviews| Index: src/IceGlobalContext.h |
| diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h |
| index d19249d40c2f9aaa6bedf2b27a2b4e328abb4914..d95e974aac600fb9b8ab70bfcc97f92152d7237e 100644 |
| --- a/src/IceGlobalContext.h |
| +++ b/src/IceGlobalContext.h |
| @@ -20,6 +20,7 @@ |
| #include "IceClFlags.h" |
| #include "IceIntrinsics.h" |
| #include "IceRNG.h" |
| +#include "IceSwitchLowering.h" |
| #include "IceThreading.h" |
| #include "IceTimerTree.h" |
| #include "IceTypes.h" |
| @@ -55,6 +56,7 @@ public: |
| } |
| ~LockedPtr() { Lock->unlock(); } |
| T *operator->() const { return Value; } |
| + T &operator*() const { return *Value; } |
| private: |
| T *Value; |
| @@ -209,6 +211,17 @@ public: |
| /// Returns a copy of the list of external symbols. |
| ConstantList getConstantExternSyms(); |
| + /// Return a locked pointer to the registered jump tables. |
| + LockedPtr<std::vector<JumpTableData>> getJumpTables() { |
| + return LockedPtr<std::vector<JumpTableData>>(&JumpTables, &JumpTablesLock); |
| + } |
| + /// Create a new jump table entry and return a reference to it. |
| + JumpTableData &addJumpTable(IceString FuncName, SizeT Id, SizeT NumTargets) { |
|
jvoung (off chromium)
2015/07/29 21:31:16
Maybe outline this instead of having it inline in
ascull
2015/07/29 22:43:04
Done.
|
| + LockedPtr<std::vector<JumpTableData>> JumpTables = getJumpTables(); |
| + JumpTables->emplace_back(FuncName, Id, NumTargets); |
| + return JumpTables->back(); |
| + } |
| + |
| const ClFlags &getFlags() const { return Flags; } |
| bool isIRGenerationDisabled() const { |
| @@ -335,6 +348,8 @@ public: |
| void lowerConstants(); |
| + void lowerJumpTables(); |
| + |
| void emitQueueBlockingPush(EmitterWorkItem *Item); |
| EmitterWorkItem *emitQueueBlockingPop(); |
| void emitQueueNotifyEnd() { EmitQ.notifyEnd(); } |
| @@ -456,6 +471,11 @@ private: |
| std::unique_ptr<ConstantPool> ConstPool; |
| ICE_CACHELINE_BOUNDARY; |
| + // Managed by getJumpTables() |
| + GlobalLockType JumpTablesLock; |
| + std::vector<JumpTableData> JumpTables; |
| + |
| + ICE_CACHELINE_BOUNDARY; |
| // Managed by getErrorStatus() |
| GlobalLockType ErrorStatusLock; |
| ErrorCode ErrorStatus; |