Subzero: Completely remove tracking of stack pointer live range.
Specifically, if a variable is marked with IgnoreLiveness=true, then:
1. Completely avoid adding any segments to its live range
2. Assert that no one tries to add segments to its live range
This is done in part by incorporating Variable::IgnoreLiveness into Liveness::RangeMask.
Also, change a functor into a lambda because C++11.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/1273823003.
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 44e9d3e..462cbcb 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -667,15 +667,13 @@
std::sort(MapBegin.begin(), MapBegin.end());
std::sort(MapEnd.begin(), MapEnd.end());
// Verify there are no duplicates.
- struct ComparePair {
- bool operator()(const LiveBeginEndMapEntry &A,
- const LiveBeginEndMapEntry &B) {
- return A.first == B.first;
- }
- };
- assert(std::adjacent_find(MapBegin.begin(), MapBegin.end(), ComparePair()) ==
+ auto ComparePair =
+ [](const LiveBeginEndMapEntry &A, const LiveBeginEndMapEntry &B) {
+ return A.first == B.first;
+ };
+ assert(std::adjacent_find(MapBegin.begin(), MapBegin.end(), ComparePair) ==
MapBegin.end());
- assert(std::adjacent_find(MapEnd.begin(), MapEnd.end(), ComparePair()) ==
+ assert(std::adjacent_find(MapEnd.begin(), MapEnd.end(), ComparePair) ==
MapEnd.end());
LivenessBV LiveInAndOut = LiveIn;
@@ -700,21 +698,16 @@
InstNumberT LE = i == i2 ? IEB->second : LastInstNum + 1;
Variable *Var = Liveness->getVariable(i, this);
- // TODO(stichnot): Push getIgnoreLiveness() into the initialization of
- // Liveness::RangeMask so that LiveBegin and LiveEnd never even reference
- // such variables.
- if (!Var->getIgnoreLiveness()) {
- if (LB > LE) {
- Var->addLiveRange(FirstInstNum, LE, 1);
- Var->addLiveRange(LB, LastInstNum + 1, 1);
- // Assert that Var is a global variable by checking that its
- // liveness index is less than the number of globals. This
- // ensures that the LiveInAndOut[] access is valid.
- assert(i < Liveness->getNumGlobalVars());
- LiveInAndOut[i] = false;
- } else {
- Var->addLiveRange(LB, LE, 1);
- }
+ if (LB > LE) {
+ Var->addLiveRange(FirstInstNum, LE, 1);
+ Var->addLiveRange(LB, LastInstNum + 1, 1);
+ // Assert that Var is a global variable by checking that its
+ // liveness index is less than the number of globals. This
+ // ensures that the LiveInAndOut[] access is valid.
+ assert(i < Liveness->getNumGlobalVars());
+ LiveInAndOut[i] = false;
+ } else {
+ Var->addLiveRange(LB, LE, 1);
}
if (i == i1)
++IBB;