diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2018-08-31 11:41:14 +0200 |
---|---|---|
committer | Björn Gustavsson <bjorn@erlang.org> | 2018-09-17 06:41:02 +0200 |
commit | 1e81c5e279acbe231432d3b6e7f7d03ac04c9d86 (patch) | |
tree | 7b11d400011122c96421d4b61691804f35665216 /lib | |
parent | 6de7b652697ecdb17a003e64418ab297c9111faa (diff) | |
download | erlang-1e81c5e279acbe231432d3b6e7f7d03ac04c9d86.tar.gz |
beam_ssa_type: Infer types for more instructions and BIFs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/beam_ssa_type.erl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_type.erl b/lib/compiler/src/beam_ssa_type.erl index 7ef64c0c4d..89fa5ce3d7 100644 --- a/lib/compiler/src/beam_ssa_type.erl +++ b/lib/compiler/src/beam_ssa_type.erl @@ -428,6 +428,8 @@ type(is_tagged_tuple, [Src,#b_literal{val=Size},#b_literal{val=Tag}], Ts, _Ds) - _ -> t_atom(false) end; +type(put_map, _Args, _Ts, _Ds) -> + map; type(put_list, _Args, _Ts, _Ds) -> cons; type(put_tuple, Args, _Ts, _Ds) -> @@ -762,6 +764,8 @@ bif_type(floor, [_]) -> t_integer(); bif_type(is_map_key, [_,_]) -> t_boolean(); bif_type(length, [_]) -> t_integer(); bif_type(map_size, [_]) -> t_integer(); +bif_type(node, []) -> #t_atom{}; +bif_type(node, [_]) -> #t_atom{}; bif_type(round, [_]) -> t_integer(); bif_type(size, [_]) -> t_integer(); bif_type(trunc, [_]) -> t_integer(); @@ -803,8 +807,12 @@ inferred_bif_type(byte_size, [_]) -> {binary,1}; inferred_bif_type(ceil, [_]) -> number; inferred_bif_type(float, [_]) -> number; inferred_bif_type(floor, [_]) -> number; +inferred_bif_type(hd, [_]) -> cons; +inferred_bif_type(length, [_]) -> list; +inferred_bif_type(map_size, [_]) -> map; inferred_bif_type(round, [_]) -> number; inferred_bif_type(trunc, [_]) -> number; +inferred_bif_type(tl, [_]) -> cons; inferred_bif_type(tuple_size, [_]) -> #t_tuple{}; inferred_bif_type(_, _) -> any. |