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

Unified Diff: src/IceRegAlloc.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
Index: src/IceRegAlloc.cpp
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index 2c6d742c4dcd62c687892a06d438ce61279fc655..cad7fb582e8e329676d16e1916358e568047ed76 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -18,6 +18,7 @@
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceInst.h"
+#include "IceInstVarIter.h"
#include "IceOperand.h"
#include "IceTargetLowering.h"
@@ -180,16 +181,11 @@ void LinearScan::initForInfOnly() {
}
}
}
- for (SizeT I = 0; I < Inst.getSrcSize(); ++I) {
- Operand *Src = Inst.getSrc(I);
- SizeT NumVars = Src->getNumVars();
- for (SizeT J = 0; J < NumVars; ++J) {
- const Variable *Var = Src->getVar(J);
- if (Var->getIgnoreLiveness())
- continue;
- if (Var->hasReg() || Var->mustHaveReg())
- LREnd[Var->getIndex()] = Inst.getNumber();
- }
+ FOREACH_VAR_IN_INST(Var, Inst) {
ascull 2015/08/31 19:03:17 Looking at how this is used I was a bit confused a
John 2015/08/31 19:11:05 The header file declaring the macros states that V
ascull 2015/08/31 19:28:05 It's not redundant as it shows the declaration of
John 2015/08/31 22:07:03 It is redundant -- Types in variable declarations
ascull 2015/08/31 22:31:56 #define remove_variable(decl) abc##decl #define ab
+ if (Var->getIgnoreLiveness())
+ continue;
+ if (Var->hasReg() || Var->mustHaveReg())
+ LREnd[Var->getIndex()] = Inst.getNumber();
}
}
}
@@ -298,14 +294,9 @@ void LinearScan::addSpillFill(IterationState &Iter) {
// Remove from RegMask any physical registers referenced during Cur's live
// range. Start looking after SpillPoint gets set, i.e. once Cur's live
// range begins.
- for (SizeT i = 0; i < I->getSrcSize(); ++i) {
- Operand *Src = I->getSrc(i);
- SizeT NumVars = Src->getNumVars();
- for (SizeT j = 0; j < NumVars; ++j) {
- const Variable *Var = Src->getVar(j);
- if (Var->hasRegTmp())
- Iter.RegMask[Var->getRegNumTmp()] = false;
- }
+ FOREACH_VAR_IN_INST(Var, *I) {
+ if (Var->hasRegTmp())
+ Iter.RegMask[Var->getRegNumTmp()] = false;
}
}
}
« src/IceInstVarIter.h ('K') | « src/IceOperand.cpp ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698