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

Unified Diff: src/IceAssemblerARM32.h

Issue 1426513004: Fix ARM emit() methods to count instructions generated. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 1 month 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 | « no previous file | src/IceAssemblerARM32.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssemblerARM32.h
diff --git a/src/IceAssemblerARM32.h b/src/IceAssemblerARM32.h
index 6cd120e5e864b65a9d01c559e6538f3c777d6445..c7ea86bc752a2cfe08900f44cc8232d2a44b2992 100644
--- a/src/IceAssemblerARM32.h
+++ b/src/IceAssemblerARM32.h
@@ -82,7 +82,7 @@ public:
SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align);
constexpr IValueT UndefinedInst = 0xe7fedef0; // udf #60896
constexpr SizeT InstSize = sizeof(IValueT);
- assert(BytesNeeded % InstSize == 0);
+ assert(BytesNeeded % InstARM32::InstSize == 0);
while (BytesNeeded > 0) {
AssemblerBuffer::EnsureCapacity ensured(&Buffer);
emitInst(UndefinedInst);
@@ -137,6 +137,14 @@ public:
return false;
}
+ /// Accessors to keep track of the number of bytes generated inside
+ /// InstARM32::emit() methods, when run inside of
+ /// InstARM32::emitUsingTextFixup().
+ void resetEmitTextSize() { EmitTextSize = 0; }
+ void incEmitTextSize(size_t Amount) { EmitTextSize += Amount; }
+ void decEmitTextSize(size_t Amount) { EmitTextSize -= Amount; }
+ size_t getEmitTextSize() const { return EmitTextSize; }
+
void bind(Label *label);
// List of instructions implemented by integrated assembler.
@@ -198,7 +206,7 @@ public:
return Asm->getKind() == Asm_ARM32;
}
- void emitTextInst(const std::string &Text, SizeT InstSize = sizeof(IValueT));
+ void emitTextInst(const std::string &Text, SizeT InstSize);
private:
// A vector of pool-allocated x86 labels for CFG nodes.
@@ -206,6 +214,9 @@ private:
LabelVector CfgNodeLabels;
// A vector of pool-allocated x86 labels for Local labels.
LabelVector LocalLabels;
+ // Number of bytes emitted by InstARM32::emit() methods, when run inside
+ // InstARM32::emitUsingTextFixup().
+ size_t EmitTextSize = 0;
Label *getOrCreateLabel(SizeT Number, LabelVector &Labels);
« no previous file with comments | « no previous file | src/IceAssemblerARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698