Chromium Code Reviews| Index: src/IceAssembler.h |
| diff --git a/src/IceAssembler.h b/src/IceAssembler.h |
| index 8247e66cf1af8f27cdf3d686781cdbc5673dc821..68ff3f3f1a5e95d44a071c73988edb17caf91251 100644 |
| --- a/src/IceAssembler.h |
| +++ b/src/IceAssembler.h |
| @@ -30,6 +30,8 @@ |
| namespace Ice { |
| +class GlobalContext; |
|
Jim Stichnoth
2015/10/08 23:50:41
GlobalContext is already forward-declared in IceDe
John
2015/10/09 12:12:23
ah, the beauty of forward decs and cyclic includes
Jim Stichnoth
2015/10/09 13:36:30
Well, I tried out the patch and everything compile
Karl
2015/10/09 19:08:18
Removed.
|
| + |
| /// A Label can be in one of three states: |
| /// - Unused. |
| /// - Linked, unplaced and tracking the position of branches to the label. |
| @@ -64,17 +66,20 @@ public: |
| return Position - kWordSize; |
| } |
| + void setPosition(intptr_t NewValue) { Position = NewValue; } |
| + |
| bool isBound() const { return Position < 0; } |
| bool isLinked() const { return Position > 0; } |
| + |
| virtual bool isUnused() const { return Position == 0; } |
| -protected: |
| void bindTo(intptr_t position) { |
| assert(!isBound()); |
| Position = -position - kWordSize; |
| assert(isBound()); |
| } |
| +protected: |
| void linkTo(intptr_t position) { |
| assert(!isBound()); |
| Position = position + kWordSize; |
| @@ -83,7 +88,6 @@ protected: |
| intptr_t Position = 0; |
| -private: |
| // TODO(jvoung): why are labels offset by this? |
| static constexpr uint32_t kWordSize = sizeof(uint32_t); |
| }; |
| @@ -272,6 +276,7 @@ public: |
| return Buffer.createFixup(Kind, Value); |
| } |
| + // TODO(kschimpf): Remove Ctx argument, no longer needed. |
|
Jim Stichnoth
2015/10/08 23:50:41
Can you just do it now, and not leave a TODO?
|
| void emitIASBytes(GlobalContext *Ctx) const; |
|
John
2015/10/09 12:12:23
Just a personal preference, but I would not introd
Karl
2015/10/09 19:08:17
While I agree with this comment in general, the gl
|
| bool getInternal() const { return IsInternal; } |
| void setInternal(bool Internal) { IsInternal = Internal; } |
| @@ -286,8 +291,8 @@ public: |
| AssemblerKind getKind() const { return Kind; } |
| protected: |
| - explicit Assembler(AssemblerKind Kind) |
| - : Kind(Kind), Allocator(), Buffer(*this) {} |
| + explicit Assembler(AssemblerKind Kind, GlobalContext *Ctx) |
| + : Kind(Kind), Allocator(), Ctx(Ctx), Buffer(*this) {} |
| private: |
| const AssemblerKind Kind; |
| @@ -305,6 +310,7 @@ private: |
| bool Preliminary = false; |
| protected: |
| + GlobalContext *Ctx; |
| // Buffer's constructor uses the Allocator, so it needs to appear after it. |
| // TODO(jpp): dependencies on construction order are a nice way of shooting |
| // yourself in the foot. Fix this. |