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

Unified Diff: src/IceFixups.h

Issue 1418523002: Add hybrid assembler concept to ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. 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
« no previous file with comments | « src/IceClFlags.cpp ('k') | src/IceFixups.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceFixups.h
diff --git a/src/IceFixups.h b/src/IceFixups.h
index 43284ac9fefb8b3f81fc40c35ec0e6d7c1eb3e0f..303e592bb3d35e582eadb5141139f481e10f8a8d 100644
--- a/src/IceFixups.h
+++ b/src/IceFixups.h
@@ -45,7 +45,9 @@ public:
void set_value(const Constant *Value) { value_ = Value; }
- void emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset) const;
+ /// Emits fixup, then returns the number of bytes to skip.
+ virtual size_t emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset,
+ bool IsPCRel) const;
private:
intptr_t position_ = 0;
@@ -53,6 +55,26 @@ private:
const Constant *value_ = nullptr;
};
+/// Extends a fixup to be textual. That is, it emits text instead of a sequence
+/// of bytes. This class is used as a fallback for unimplemented emitIAS
+/// methods, allowing them to generate compilable assembly code.
+class AssemblerTextFixup : public AssemblerFixup {
+ AssemblerTextFixup() = delete;
+ AssemblerTextFixup(const AssemblerTextFixup &) = delete;
+ AssemblerTextFixup &operator=(const AssemblerTextFixup &) = delete;
+
+public:
+ AssemblerTextFixup(const std::string &Message, size_t NumBytes)
+ : AssemblerFixup(), Message(Message), NumBytes(NumBytes) {}
+ ~AssemblerTextFixup() = default;
+ virtual size_t emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset,
+ bool isPcRel) const;
+
+private:
+ const std::string Message;
+ const size_t NumBytes;
+};
+
using FixupList = std::vector<AssemblerFixup>;
using FixupRefList = std::vector<AssemblerFixup *>;
« no previous file with comments | « src/IceClFlags.cpp ('k') | src/IceFixups.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698