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

Unified Diff: src/IceTargetLowering.cpp

Issue 2116213002: Subzero: Allow deeper levels of variable splitting. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rename getLinkedToTop() to getLinkedToRoot() Created 4 years, 6 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/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 207a76cbb0c1e060059bc7daed228c334a9ff6fb..6362533ec928ed7645aba7459c964db536b7152a 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -583,6 +583,30 @@ void TargetLowering::getVarStackSlotParams(
}
}
+ // Find each variable Var where:
+ // - Var is actively referenced
+ // - Var does not have a register
+ // - Var's furthest ancestor through LinkedTo: Root
John 2016/07/06 16:07:39 Instead of Root, did you mean Ancestor?
Jim Stichnoth 2016/07/08 10:37:54 After patchset #1, I meant to change "ancestor" an
+ // - Root has no active references, or has a register
+ //
+ // When any such Var is found, swap Var->LinkedTo and Root->LinkedTo. This
+ // ensures that when Var needs a stack slot, either its LinkedTo field is
+ // nullptr, or Var->getLinkedToRoot() returns a variable with a stack slot.
+ for (Variable *Var : Func->getVariables()) {
+ if (!IsVarReferenced[Var->getIndex()])
John 2016/07/06 16:07:39 It took me a while to understand what this is doin
Jim Stichnoth 2016/07/08 10:37:54 Nice, done.
+ continue;
+ if (Var->hasReg())
+ continue;
+ Variable *Ancestor = Var->getLinkedToRoot();
John 2016/07/06 16:07:39 auto?
Jim Stichnoth 2016/07/08 10:37:54 hmm, I think it wouldn't be obvious that getLinked
+ if (Ancestor == nullptr)
+ continue;
+ assert(Ancestor->getLinkedTo() == nullptr);
+ if (!Ancestor->hasReg() && IsVarReferenced[Ancestor->getIndex()])
+ continue;
+ Ancestor->setLinkedTo(Var);
+ Var->setLinkedTo(nullptr);
+ }
+
// If SimpleCoalescing is false, each variable without a register gets its
// own unique stack slot, which leads to large stack frames. If
// SimpleCoalescing is true, then each "global" variable without a register

Powered by Google App Engine
This is Rietveld 408576698