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

Unified Diff: src/IceInstARM32.cpp

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 | « src/IceInstARM32.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstARM32.cpp
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp
index cd50eb17de29d3b5a4c440a3c43467274972e59e..b03daf24f51206952e204bffa211c163784126bc 100644
--- a/src/IceInstARM32.cpp
+++ b/src/IceInstARM32.cpp
@@ -84,6 +84,11 @@ CondARM32::Cond InstARM32::getOppositeCondition(CondARM32::Cond Cond) {
return InstARM32CondAttributes[Cond].Opposite;
}
+void InstARM32::startNextInst(const Cfg *Func) const {
+ if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>())
+ Asm->incEmitTextSize(InstSize);
+}
+
void InstARM32::emitUsingTextFixup(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
@@ -98,9 +103,13 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const {
OstreamLocker L(Ctx);
Ostream &OldStr = Ctx->getStrEmit();
Ctx->setStrEmit(StrBuf);
+ // Start counting instructions here, so that emit() methods don't
+ // need to call this for the first instruction.
+ Asm->resetEmitTextSize();
+ Asm->incEmitTextSize(InstSize);
emit(Func);
Ctx->setStrEmit(OldStr);
- Asm->emitTextInst(StrBuf.str());
+ Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize());
}
void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); }
@@ -810,6 +819,7 @@ void InstARM32Br::emit(const Cfg *Func) const {
} else {
Str << getTargetTrue()->getAsmName();
if (getTargetFalse()) {
+ startNextInst(Func);
Str << "\n\t"
<< "b"
<< "\t" << getTargetFalse()->getAsmName();
@@ -1069,6 +1079,7 @@ void InstARM32Pop::emit(const Cfg *Func) const {
for (const Operand *Op : Dests) {
if (isScalarIntegerType(Op->getType()))
continue;
+ startNextInst(Func);
Str << "\t"
<< "vpop"
<< "\t{";
@@ -1139,6 +1150,7 @@ void InstARM32Push::emit(const Cfg *Func) const {
Str << "}\n";
}
if (IntegerCount != 0) {
+ startNextInst(Func);
Str << "\t"
<< "push"
<< "\t{";
« no previous file with comments | « src/IceInstARM32.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698