History | View | Annotate | Download (22.4 kB)
tcg/optimize: rework copy progagation
The copy propagation pass tries to keep track what is a copy of whatand what has copy of what, and in addition it keep a circular list ofof all the copies. Unfortunately this doesn't fully work: a mov froma temp which has a state "COPY" changed it into a state "HAS_COPY"....
tcg/optimize: remove TCG_TEMP_ANY
TCG_TEMP_ANY has no different meaning than TCG_TEMP_UNDEF, so usethe later instead.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/optimize: check types in copy propagation
The copy propagation doesn't check the types of the temps during copypropagation. However TCG is using the mov_i32 for the i64 to i32conversion and thus the two are not equivalent.
With this patch tcg_opt_gen_mov() doesn't consider two temps of...
tcg: Optimize movcond for constant comparisons
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Optimize two-address commutative operations
While swapping constants to the second operand, swapsources matching destinations to the first operand.
tcg/optimize: fix end of basic block detection
Commit e31b0a7c050711884ad570fe73df806520953618 fixed copy propagation on32-bit host by restricting the copy between different types. This was thewrong fix.
The real problem is that the all temps states should be reset at the end...
revert "TCG: fix copy propagation"
Given the copy propagation breakage on 32-bit hosts has been fixedcommit e31b0a7c050711884ad570fe73df806520953618 can be reverted.
Cc: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/optimize: fix if/else/break coding style
optimizer.c contains some cases were the break is appearing in both theif and the else parts. Fix that by moving it to the outer part. Alsomove some common code there.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
tcg/optimize: add constant folding for brcond
tcg/optimize: add constant folding for setcond
tcg/optimize: swap brcond/setcond arguments when possible
brcond and setcond ops are not commutative, but it's easy to compute thenew condition after swapping the arguments. Try to always put the constantargument in second position like for commutative ops, to help backends to...
tcg/optimize: simplify shift/rot r, 0, a => movi r, 0 cases
shift/rot r, 0, a is equivalent to movi r, 0.
tcg/optimize: simplify and r, a, 0 cases
and r, a, 0 is equivalent to a movi r, 0.
tcg/optimize: simplify or/xor r, a, 0 cases
or/xor r, a, 0 is equivalent to a mov r, a.
tcg/optimize: split expression simplification
Split expression simplification in multiple parts so that a given opcan appear multiple times. This patch should not change anything.
TCG: improve optimizer debugging
Use enum TCGOpcode instead of plain old int so that the name ofcurrent op can be seen in GDB. Add a default case to switchso that GCC does not complain about unhandled enum cases.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Constant fold neg, andc, orc, eqv, nand, nor.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Always define all of the TCGOpcode enum members.
By always defining these symbols, we can eliminate a lot of ifdefs.
To allow this to be checked reliably, the semantics of theTCG_TARGET_HAS_* macros must be changed from def/undef to true/false.This allows even more ifdefs to be removed, converting them into...
tcg: Add and use TCG_OPF_64BIT.
This allows the simplification of the op_bits function fromtcg/optimize.c.
TCG: fix copy propagation
Copy propagation introduced in 22613af4a6d9602001e6d0e7b6d98aa40aa018dcconsidered only global registers. However, register temps and stackallocated locals must be handled differently because register tempsdon't survive across brcond....
TCG: fix breakage by previous patch
Fix incorrect logic and typos in previous commit1bfd07bdfe56cea43dbe258dcb161e46b0ee29b7.
TCG: fix breakage on some RISC hosts
Fix breakage by a640f03178c22355a158fa9378e4f8bfa4f517a6and 55c0975c5b358e948b9ae7bd7b07eff92508e756.
Some TCG targets don't implement all TCG ops, so makeoptimizing those conditional.
Do constant folding for unary operations.
Perform constant folding for NOT and EXT{8,16,32}{S,U} operations.
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Do constant folding for boolean operations.
Perform constant folding for AND, OR, XOR operations.
Do constant folding for shift operations.
Perform constant forlding for SHR, SHL, SAR, ROTR, ROTL operations.
Do constant folding for basic arithmetic operations.
Perform actual constant folding for ADD, SUB and MUL operations.
Add copy and constant propagation.
Make tcg_constant_folding do copy and constant propagation. It is apreparational work before actual constant folding.
Add TCG optimizations stub
Added file tcg/optimize.c to hold TCG optimizations. Function tcg_optimizeis called from tcg_gen_code_common. It calls other functions performingspecific optimizations. Stub for constant folding was added.
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>...