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

Unified Diff: src/IceCfgNode.cpp

Issue 1323693002: Subzero: Provide a macro for iterating over instruction variables. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: "Addresses comments" Created 5 years, 4 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/IceCfg.cpp ('k') | src/IceInst.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfgNode.cpp
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index f0fae92af6de29990c3fd0fb42e16d76460dc83b..4199c41c2a53fa0c7bb441c78d92149c9d1bf0c2 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -19,6 +19,7 @@
#include "IceCfg.h"
#include "IceGlobalInits.h"
#include "IceInst.h"
+#include "IceInstVarIter.h"
#include "IceLiveness.h"
#include "IceOperand.h"
#include "IceTargetLowering.h"
@@ -846,26 +847,21 @@ void emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
// instruction started the dest variable's live range.
if (!Instr->isDestNonKillable() && Dest && Dest->hasReg())
++LiveRegCount[Dest->getRegNum()];
- for (SizeT I = 0; I < Instr->getSrcSize(); ++I) {
- Operand *Src = Instr->getSrc(I);
- SizeT NumVars = Src->getNumVars();
- for (SizeT J = 0; J < NumVars; ++J) {
- const Variable *Var = Src->getVar(J);
- bool ShouldReport = Instr->isLastUse(Var);
- if (ShouldReport && Var->hasReg()) {
- // Don't report end of live range until the live count reaches 0.
- SizeT NewCount = --LiveRegCount[Var->getRegNum()];
- if (NewCount)
- ShouldReport = false;
- }
- if (ShouldReport) {
- if (First)
- Str << " \t# END=";
- else
- Str << ",";
- Var->emit(Func);
- First = false;
- }
+ FOREACH_VAR_IN_INST(Var, *Instr) {
+ bool ShouldReport = Instr->isLastUse(Var);
+ if (ShouldReport && Var->hasReg()) {
+ // Don't report end of live range until the live count reaches 0.
+ SizeT NewCount = --LiveRegCount[Var->getRegNum()];
+ if (NewCount)
+ ShouldReport = false;
+ }
+ if (ShouldReport) {
+ if (First)
+ Str << " \t# END=";
+ else
+ Str << ",";
+ Var->emit(Func);
+ First = false;
}
}
}
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceInst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698