From e965d90b5fe84fcb519ab8a8d41f7c0acb4c4c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 19 Apr 2010 07:29:54 +0200 Subject: beam_type: Improve coalescing of fmove/2 and move/2 instructions The following instruction sequence: fmove {fr,Fr} {x,TempXreg} move {x,TempXreg} {y,Dest} is rewritten to: fmove {fr,Fr} {y,Dest} (Provided that {x,TempXreg} is killed by the instructions following the sequence.) Generalize the optimization to also handle: fmove {fr,Fr} {x,TempXreg} move {x,TempXreg} {_,Dest} That is, the destination register can be either an X or Y register. --- lib/compiler/src/beam_type.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/compiler/src/beam_type.erl') diff --git a/lib/compiler/src/beam_type.erl b/lib/compiler/src/beam_type.erl index 66c8816409..3729ccb0da 100644 --- a/lib/compiler/src/beam_type.erl +++ b/lib/compiler/src/beam_type.erl @@ -183,7 +183,7 @@ simplify_float_1([], Ts, Rs, Acc0) -> {Is,Ts}. opt_fmoves([{set,[{x,_}=R],[{fr,_}]=Src,fmove}=I1, - {set,[{y,_}]=Dst,[{x,_}=R],move}=I2|Is], Acc) -> + {set,[_]=Dst,[{x,_}=R],move}=I2|Is], Acc) -> case beam_utils:is_killed_block(R, Is) of false -> opt_fmoves(Is, [I2,I1|Acc]); true -> opt_fmoves(Is, [{set,Dst,Src,fmove}|Acc]) -- cgit v1.2.3