Index: src/assembler.h |
diff --git a/src/assembler.h b/src/assembler.h |
index dfd8cd123bfdc09418d095c80666b1be53c322f8..ea331c856e4740e1fd9551eee460c091bbc7735d 100644 |
--- a/src/assembler.h |
+++ b/src/assembler.h |
@@ -115,6 +115,11 @@ public: |
const FixupRefList &fixups() const { return fixups_; } |
+ void setSize(intptr_t NewSize) { |
+ assert(NewSize <= Size()); |
+ cursor_ = contents_ + NewSize; |
+ } |
+ |
private: |
// The limit is set to kMinimumGap bytes before the end of the data area. |
// This leaves enough space for the longest possible instruction and allows |
@@ -149,7 +154,9 @@ class Assembler { |
Assembler &operator=(const Assembler &) = delete; |
public: |
- Assembler() : FunctionName(""), IsInternal(false), buffer_(*this) {} |
+ Assembler() |
+ : FunctionName(""), IsInternal(false), Preliminary(false), |
+ buffer_(*this) {} |
virtual ~Assembler() {} |
// Allocate a chunk of bytes using the per-Assembler allocator. |
@@ -194,6 +201,13 @@ public: |
void setInternal(bool Internal) { IsInternal = Internal; } |
const IceString &getFunctionName() { return FunctionName; } |
void setFunctionName(const IceString &NewName) { FunctionName = NewName; } |
+ intptr_t getBufferSize() const { return buffer_.Size(); } |
+ // Roll back to a (smaller) size. |
+ void setBufferSize(intptr_t NewSize) { buffer_.setSize(NewSize); } |
+ void setPreliminary(bool Value) { Preliminary = Value; } |
+ bool getPreliminary() const { return Preliminary; } |
+ // Add nop padding of a particular width. |
+ virtual void padWithNop(intptr_t Padding) = 0; |
jvoung (off chromium)
2015/02/19 21:01:47
Maybe put this padWithNop along with the alignFunc
Jim Stichnoth
2015/02/19 23:17:39
Done.
|
private: |
ArenaAllocator<32 * 1024> Allocator; |
@@ -202,6 +216,7 @@ private: |
// assembler buffer is emitted. |
IceString FunctionName; |
bool IsInternal; |
+ bool Preliminary; |
jvoung (off chromium)
2015/02/19 21:01:47
Document what Preliminary does
Jim Stichnoth
2015/02/19 23:17:39
Done.
|
protected: |
AssemblerBuffer buffer_; |