Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: src/IceAssembler.h

Issue 1397933002: Start incorporating the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Clean up code. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « src/DartARM32/assembler_arm.cc ('k') | src/IceAssemblerARM32.h » ('j') | src/IceAssemblerARM32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698