diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2013-09-13 18:43:46 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-25 09:46:15 +0200 |
commit | a5b82cca184c613b40ce55646e522d7cb7f7a60a (patch) | |
tree | 1e5ea11bad048a2c5fbaee9d68a4c36961ada54f /src/qml | |
parent | 51c31660b147c5cd9912ce6670399aa2bb4fb831 (diff) |
V4: fix move mapping
When resolving conflicting register use between basic blocks, only
insert the resolving moves into the successor when it has one incoming
edge. Because of the absence of critical edges, this implies that it is
also save to insert those moves into the predecessor block if there is
more than one incoming edge (the predecessor will only have one outgoing
edge).
Change-Id: I83c41b4ca86946d3aa09619f20ddab3e692136f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qv4regalloc.cpp | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 10 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa_p.h | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp index 2c13a5fdd1..7ba4bc0ff6 100644 --- a/src/qml/compiler/qv4regalloc.cpp +++ b/src/qml/compiler/qv4regalloc.cpp @@ -878,7 +878,9 @@ private: mapping.dump(); #endif // DEBUG_REGALLOC - mapping.insertMoves(predecessor, _function); + bool insertIntoPredecessor = successor->in.size() > 1; + mapping.insertMoves(insertIntoPredecessor ? predecessor : successor, _function, + insertIntoPredecessor); } Temp *createTemp(Temp::Kind kind, int index, Type type) const diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 6617cfeb82..805edd737a 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -2786,7 +2786,7 @@ void Optimizer::run() // showMeTheCode(function); - static bool doSSA = qgetenv("QV4_NO_SSA").isEmpty();; + static bool doSSA = qgetenv("QV4_NO_SSA").isEmpty(); static bool doOpt = qgetenv("QV4_NO_OPT").isEmpty(); if (!function->hasTry && !function->hasWith && doSSA) { @@ -2878,7 +2878,7 @@ void Optimizer::convertOutOfSSA() { moves.order(); - moves.insertMoves(bb, function); + moves.insertMoves(bb, function, true); } foreach (BasicBlock *bb, function->basicBlocks) { @@ -2983,15 +2983,15 @@ void MoveMapping::order() qSwap(_moves, output); } -void MoveMapping::insertMoves(BasicBlock *predecessor, Function *function) const +void MoveMapping::insertMoves(BasicBlock *bb, Function *function, bool atEnd) const { - int predecessorInsertionPoint = predecessor->statements.size() - 1; + int insertionPoint = atEnd ? bb->statements.size() - 1 : 0; foreach (const Move &m, _moves) { V4IR::Move *move = function->New<V4IR::Move>(); move->init(m.to, m.from, OpInvalid); move->id = m.id; move->swap = m.needsSwap; - predecessor->statements.insert(predecessorInsertionPoint++, move); + bb->statements.insert(insertionPoint++, move); } } diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h index 1fabc8e76f..1aa21eee11 100644 --- a/src/qml/compiler/qv4ssa_p.h +++ b/src/qml/compiler/qv4ssa_p.h @@ -164,7 +164,7 @@ class MoveMapping public: void add(Expr *from, Temp *to, int id = 0); void order(); - void insertMoves(BasicBlock *predecessor, Function *function) const; + void insertMoves(BasicBlock *bb, Function *function, bool atEnd) const; void dump() const; |