diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-04-30 15:38:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-23 12:23:32 +0200 |
commit | 75c22465cf8fe262edfe6178bb9ca19661fb710e (patch) | |
tree | 69da4cbb16124ae88678f96ca3e37b76851e72f0 /src/qml/jit/qv4unop_p.h | |
parent | e950557e1133e8aac65a453597ab35400a5b9a10 (diff) |
V4: Split arguments/locals from temps.
There are a couple of reasons to split the temporaries off from the
arguments and locals:
Temporaries are invisible, and changes to them cannot be observed.
On the other hand, arguments and locals are visible, and writes to them
can be seen from other places (nested functions), or by using the
arguments array. So, in practice these correspond to memory locations.
(One could argue that if neither nested functions, nor eval(), nor
arguments[] is used, the loads/stores are invisible too. But that's an
optimization, and changing locals/arguments to temporaries can be done
in a separate pass.)
Because of the "volatile" nature of arguments and locals, their usage
cannot be optimized. All optimizations (SSA construction, register
allocation, copy elimination, etc.) work on temporaries. Being able to
easily ignore all non-temporaries has the benefit that optimizations can
be faster.
Previously, Temps were not uniquely numbered: argument 1, local 1, and
temporary 1 all had the same number and were distinguishable by their
type. So, for any mapping from Temp to something else, a QHash was used.
Now that Temps only hold proper temporaries, the indexes do uniquely
identify them. Add to that the fact that after transforming to SSA form
all temporaries are renumbered starting from 0 and without any holes in
the numbering, many of those datastructures can be changed to simple
vectors. That change gives a noticeable performance improvement.
One implication of this change is that a number of functions that took
a Temp as their argument, now need to take Temp-or-ArgLocal, so Expr.
However, it turns out that there are very few places where that applies,
as many of those places also need to take constants or names. However,
explicitly separating memory loads/stores for arguments/locals from
temporaries adds the benefit that it's now easier to do a peep-hole
optimizer for those load/store operations in the future: when a load is
directly preceded by a store, it can be eliminated if the value is
still available in a temporary.
Change-Id: I4114006b076795d9ea9fe3649cdb3b9d7b7508f0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jit/qv4unop_p.h')
-rw-r--r-- | src/qml/jit/qv4unop_p.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jit/qv4unop_p.h b/src/qml/jit/qv4unop_p.h index a8c62182ad..07fb6e5ad6 100644 --- a/src/qml/jit/qv4unop_p.h +++ b/src/qml/jit/qv4unop_p.h @@ -59,11 +59,11 @@ struct Unop { , op(operation) {} - void generate(IR::Temp *source, IR::Temp *target); + void generate(IR::Expr *source, IR::Expr *target); - void generateUMinus(IR::Temp *source, IR::Temp *target); - void generateNot(IR::Temp *source, IR::Temp *target); - void generateCompl(IR::Temp *source, IR::Temp *target); + void generateUMinus(IR::Expr *source, IR::Expr *target); + void generateNot(IR::Expr *source, IR::Expr *target); + void generateCompl(IR::Expr *source, IR::Expr *target); Assembler *as; IR::AluOp op; |