diff options
author | John Högberg <[email protected]> | 2019-01-24 08:52:21 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-01-24 08:52:21 +0100 |
commit | a0104bc16c8c6f57c2725d07b811bf3bcb0a2455 (patch) | |
tree | 02ea5e7585b66c04c3d775b42f8ccfa9a68a6d8b /lib/compiler/src/beam_ssa_codegen.erl | |
parent | 5a9adb7b9b600fc2a406e677a673047045a494d8 (diff) | |
parent | 294d66a295f6c2101fe3c2da630979ad4e736c08 (diff) | |
download | otp-a0104bc16c8c6f57c2725d07b811bf3bcb0a2455.tar.gz otp-a0104bc16c8c6f57c2725d07b811bf3bcb0a2455.tar.bz2 otp-a0104bc16c8c6f57c2725d07b811bf3bcb0a2455.zip |
Merge pull request #2100 from jhogberg/john/compiler/module-type-optimization
Apply type optimizations across local function calls
Diffstat (limited to 'lib/compiler/src/beam_ssa_codegen.erl')
-rw-r--r-- | lib/compiler/src/beam_ssa_codegen.erl | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_ssa_codegen.erl b/lib/compiler/src/beam_ssa_codegen.erl index fe1a0c8480..c2d5035b19 100644 --- a/lib/compiler/src/beam_ssa_codegen.erl +++ b/lib/compiler/src/beam_ssa_codegen.erl @@ -161,7 +161,7 @@ add_parameter_annos([{label, _}=Entry | Body], Anno) -> (_K, _V, Acc) -> Acc end, [], maps:get(registers, Anno)), - [Entry | Annos] ++ Body. + [Entry | sort(Annos)] ++ Body. cg_fun(Blocks, St0) -> Linear0 = linearize(Blocks), @@ -1449,7 +1449,12 @@ cg_call(#cg_set{anno=Anno,op=call,dst=Dst0,args=[#b_local{}=Func0|Args0]}, Line = call_line(Where, local, Anno), Call = build_call(call, Arity, {f,FuncLbl}, Context, Dst), Is = setup_args(Args, Anno, Context, St) ++ Line ++ Call, - {Is,St}; + case Anno of + #{ result_type := Info } -> + {Is ++ [{'%', {type_info, Dst, Info}}], St}; + #{} -> + {Is, St} + end; cg_call(#cg_set{anno=Anno0,op=call,dst=Dst0,args=[#b_remote{}=Func0|Args0]}, Where, Context, St) -> [Dst|Args] = beam_args([Dst0|Args0], St), @@ -1725,6 +1730,14 @@ copy(Src, Dst) -> [{move,Src,Dst}]. force_reg({literal,_}=Lit, Reg) -> {Reg,[{move,Lit,Reg}]}; +force_reg({integer,_}=Lit, Reg) -> + {Reg,[{move,Lit,Reg}]}; +force_reg({atom,_}=Lit, Reg) -> + {Reg,[{move,Lit,Reg}]}; +force_reg({float,_}=Lit, Reg) -> + {Reg,[{move,Lit,Reg}]}; +force_reg(nil=Lit, Reg) -> + {Reg,[{move,Lit,Reg}]}; force_reg({Kind,_}=R, _) when Kind =:= x; Kind =:= y -> {R,[]}. |