diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-11-20 09:35:32 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2012-11-20 12:05:41 +0100 |
commit | 43cd73b7a03cfb0d1de1f2ab9f579b4fd5842722 (patch) | |
tree | 2f97f1033c0f53eea885480cb589b26314cd565a /qv4codegen.cpp | |
parent | 72cda7ed8c06103d0a66a6441ddf1ab52d3010f1 (diff) |
Compress temp usage in the interpreter.
Uses a variation on linear scan register allocation as the algorithm. As
it depends on liveness analysis, keep that data around after codegen is
finished (in IR::Stmt::Data). Added clean-up code for it in the
IR::Function destructor.
Change-Id: If3636648efbafcc1df469a24aaa885e21e6a2f16
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'qv4codegen.cpp')
-rw-r--r-- | qv4codegen.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/qv4codegen.cpp b/qv4codegen.cpp index 7a367ca9a7..30def8f5d4 100644 --- a/qv4codegen.cpp +++ b/qv4codegen.cpp @@ -1432,7 +1432,17 @@ void Codegen::linearize(IR::Function *function) if (IR::BasicBlock *bb = leader.value(s)) { qout << endl; - qout << 'L' << bb->index << ':' << endl; + QByteArray str; + str.append('L'); + str.append(QByteArray::number(bb->index)); + str.append(':'); + for (int i = 66 - str.length(); i; --i) + str.append(' '); + qout << str; + qout << "// predecessor blocks:"; + foreach (IR::BasicBlock *in, bb->in) + qout << " L" << in->index; + qout << endl; } IR::Stmt *n = (i + 1) < code.size() ? code.at(i + 1) : 0; if (n && s->asJump() && s->asJump()->target == leader.value(n)) { @@ -1467,7 +1477,7 @@ void Codegen::linearize(IR::Function *function) // } if (! s->d->liveOut.isEmpty()) { - qout << " // lives:"; + qout << " // lives out:"; for (int i = 0; i < s->d->liveOut.size(); ++i) { if (s->d->liveOut.testBit(i)) qout << " %" << i; @@ -1487,13 +1497,6 @@ void Codegen::linearize(IR::Function *function) qout << "}" << endl << endl; } - -#ifndef QV4_NO_LIVENESS - foreach (IR::BasicBlock *block, function->basicBlocks) { - foreach (IR::Stmt *s, block->statements) - s->destroyData(); - } -#endif } IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast, |