diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-08-11 13:20:07 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-08-13 10:03:09 +0200 |
commit | c7b85b0cdcba7e0aecb210b04d5a99f77ec4375c (patch) | |
tree | 2ba2b195eabe689130b5bcc6640e5ea6c6e5ee19 /src | |
parent | ccb69a858fcf1b42ff36605007aeabc3dbb4a8d7 (diff) |
V4 RegAlloc: fix use position calculation for phi node arguments.
The correct calculation was already done, but the value was discarded.
Change-Id: I600aeb9414736a3b7924a4a607233ab9bf6c02b6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jit/qv4regalloc.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index 2192b8e60b..50f35e3db5 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -53,7 +53,8 @@ struct Use { unsigned pos : 31; Use(): flag(MustHaveRegister), pos(0) {} - Use(int pos, RegisterFlag flag): flag(flag), pos(pos) {} + Use(int position, RegisterFlag flag): flag(flag), pos(position) + { Q_ASSERT(position >= 0); } bool mustHaveRegister() const { return flag == MustHaveRegister; } }; @@ -162,14 +163,12 @@ class RegAllocInfo: public IRDecoder std::vector<int> _calls; std::vector<QList<Temp> > _hints; - int defPosition(Stmt *s) const - { - return usePosition(s) + 1; - } - int usePosition(Stmt *s) const { - return _lifeTimeIntervals->positionForStatement(s); + int usePos = _lifeTimeIntervals->positionForStatement(s); + if (usePos == Stmt::InvalidId) // phi-node operand, so: + usePos = _lifeTimeIntervals->startPosition(_currentBB); + return usePos; } public: @@ -752,9 +751,7 @@ private: void addUses(Expr *e, Use::RegisterFlag flag) { - int usePos = usePosition(_currentStmt); - if (usePos == Stmt::InvalidId) - usePos = _lifeTimeIntervals->startPosition(_currentBB); + const int usePos = usePosition(_currentStmt); Q_ASSERT(usePos > 0); if (!e) return; @@ -762,7 +759,7 @@ private: if (!t) return; if (t && t->kind == Temp::VirtualRegister) - _uses[t->index].push_back(Use(usePosition(_currentStmt), flag)); + _uses[t->index].push_back(Use(usePos, flag)); } void addUses(ExprList *l, Use::RegisterFlag flag) |