diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2013-09-01 15:45:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-13 11:41:23 +0200 |
commit | 9c82c105a1886473ca144b802ce9f5bec01e35e8 (patch) | |
tree | 2caeb5945e2b60f49ba046ec50a45c0bec4f2f7d /src/qml/compiler/qv4ssa_p.h | |
parent | 0ef673efe8bf381e1aa0202752deac27e86ada53 (diff) |
V4: Fix SSA decomposition when no regalloc is used.
Add scheduling for moves generated by removing phi nodes by re-using the
MoveMapping class from the register allocator. This change applies to
both the JIT when no register allocator is used, and the interpreter.
Change-Id: I38eac5b13759c7790132d1ef07fa17fcb53187e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4ssa_p.h')
-rw-r--r-- | src/qml/compiler/qv4ssa_p.h | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h index 2195cfd9bb..1fabc8e76f 100644 --- a/src/qml/compiler/qv4ssa_p.h +++ b/src/qml/compiler/qv4ssa_p.h @@ -118,17 +118,6 @@ public: class Optimizer { public: - struct SSADeconstructionMove - { - Stmt *phi; - Expr *source; - Temp *target; - - bool needsConversion() const - { return target->type != source->type; } - }; - -public: Optimizer(Function *function) : function(function) , inSSA(false) @@ -142,8 +131,6 @@ public: QHash<BasicBlock *, BasicBlock *> loopStartEndBlocks() const { return startEndLoops; } - QList<SSADeconstructionMove> ssaDeconstructionMoves(BasicBlock *basicBlock) const; - QList<LifeTimeInterval> lifeRanges() const; static void showMeTheCode(Function *function); @@ -154,6 +141,39 @@ private: QHash<BasicBlock *, BasicBlock *> startEndLoops; }; +class MoveMapping +{ + struct Move { + Expr *from; + Temp *to; + int id; + bool needsSwap; + + Move(Expr *from, Temp *to, int id) + : from(from), to(to), id(id), needsSwap(false) + {} + + bool operator==(const Move &other) const + { return from == other.from && to == other.to; } + }; + + QList<Move> _moves; + + int isUsedAsSource(Expr *e) const; + +public: + void add(Expr *from, Temp *to, int id = 0); + void order(); + void insertMoves(BasicBlock *predecessor, Function *function) const; + + void dump() const; + +private: + enum Action { NormalMove, NeedsSwap }; + Action schedule(const Move &m, QList<Move> &todo, QList<Move> &delayed, QList<Move> &output, + QList<Move> &swaps) const; +}; + } // V4IR namespace } // QQmlJS namespace QT_END_NAMESPACE |