Index: src/IceAssembler.h |
diff --git a/src/IceAssembler.h b/src/IceAssembler.h |
index 2f5a505363f329f5b544d6378032c35ab155bca6..5e7815d321718308611d1f995edb7d45b41f0099 100644 |
--- a/src/IceAssembler.h |
+++ b/src/IceAssembler.h |
@@ -174,6 +174,20 @@ public: |
/// Create and track a fixup in the current function. |
AssemblerFixup *createFixup(FixupKind Kind, const Constant *Value); |
+ /// Create and track a textual fixup in the current function. |
+ AssemblerTextFixup *createTextFixup(const std::string &Text, |
+ size_t BytesUsed); |
+ |
+ /// Mark that an attempt was made to emit, but failed. Hence, in order to |
+ /// continue, one must emit a text fixup. |
+ void setNeedsTextFixup() { TextFixupNeeded = true; } |
+ |
+ /// Returns true if last emit failed and needs a text fixup. |
+ bool needsTextFixup() const { return TextFixupNeeded; } |
+ |
+ /// Installs a created fixup, after it has been allocated. |
+ void installFixup(AssemblerFixup *F); |
+ |
const FixupRefList &fixups() const { return Fixups; } |
void setSize(intptr_t NewSize) { |
@@ -194,6 +208,9 @@ private: |
Assembler &Assemblr; |
/// List of pool-allocated fixups relative to the current function. |
FixupRefList Fixups; |
+ // True if a textual fixup is needed, because the assembler was unable to |
+ // emit the last request. |
+ bool TextFixupNeeded; |
uintptr_t cursor() const { return Cursor; } |
uintptr_t limit() const { return Limit; } |
@@ -268,12 +285,24 @@ public: |
// Return a view of all the bytes of code for the current function. |
llvm::StringRef getBufferView() const; |
+ /// Emit a fixup at the current location. |
+ void emitFixup(AssemblerFixup *Fixup) { Buffer.emitFixup(Fixup); } |
+ |
const FixupRefList &fixups() const { return Buffer.fixups(); } |
AssemblerFixup *createFixup(FixupKind Kind, const Constant *Value) { |
return Buffer.createFixup(Kind, Value); |
} |
+ AssemblerTextFixup *createTextFixup(const std::string &Text, |
+ size_t BytesUsed) { |
+ return Buffer.createTextFixup(Text, BytesUsed); |
+ } |
+ |
+ void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } |
+ |
+ bool needsTextFixup() const { return Buffer.needsTextFixup(); } |
+ |
void emitIASBytes() const; |
bool getInternal() const { return IsInternal; } |
void setInternal(bool Internal) { IsInternal = Internal; } |
@@ -306,6 +335,9 @@ private: |
/// fully committed (Preliminary=false). |
bool Preliminary = false; |
+ /// Installs a created fixup, after it has been allocated. |
+ void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } |
+ |
protected: |
GlobalContext *Ctx; |
// Buffer's constructor uses the Allocator, so it needs to appear after it. |