diff options
author | Björn-Egil Dahlberg <[email protected]> | 2013-11-06 08:58:32 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-01-28 15:56:28 +0100 |
commit | d4379900790b37498fefa237cd03ab2d5781bb6a (patch) | |
tree | 325ed00fd12baa5bef7f5712baa605c06f3f6695 /lib/compiler/src/cerl_trees.erl | |
parent | 813f61de8e7872481a0369de3297596c1b11881d (diff) | |
download | otp-d4379900790b37498fefa237cd03ab2d5781bb6a.tar.gz otp-d4379900790b37498fefa237cd03ab2d5781bb6a.tar.bz2 otp-d4379900790b37498fefa237cd03ab2d5781bb6a.zip |
compiler: Teach Maps understanding to inliner
Diffstat (limited to 'lib/compiler/src/cerl_trees.erl')
-rw-r--r-- | lib/compiler/src/cerl_trees.erl | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/lib/compiler/src/cerl_trees.erl b/lib/compiler/src/cerl_trees.erl index 1e3755025f..dc1cc606b3 100644 --- a/lib/compiler/src/cerl_trees.erl +++ b/lib/compiler/src/cerl_trees.erl @@ -55,7 +55,15 @@ update_c_let/4, update_c_letrec/3, update_c_module/5, update_c_primop/3, update_c_receive/4, update_c_seq/3, update_c_try/6, update_c_tuple/2, update_c_tuple_skel/2, - update_c_values/2, values_es/1, var_name/1]). + update_c_values/2, values_es/1, var_name/1, + + map_es/1, + update_c_map_skel/2, + update_c_map_pair_assoc_skel/2, update_c_map_pair_exact_skel/2, + ann_c_map_skel/2, + ann_c_map_pair_assoc_skel/2, ann_c_map_pair_exact_skel/2, + map_pair_assoc_es/1, map_pair_exact_es/1 + ]). %% --------------------------------------------------------------------- @@ -129,6 +137,12 @@ map_1(F, T) -> map(F, cons_tl(T))); tuple -> update_c_tuple_skel(T, map_list(F, tuple_es(T))); + map -> + update_c_map_skel(T, map_list(F, map_es(T))); + map_pair_assoc -> + update_c_map_pair_assoc_skel(T, map_list(F, map_pair_assoc_es(T))); + map_pair_exact -> + update_c_map_pair_exact_skel(T, map_list(F, map_pair_exact_es(T))); 'let' -> update_c_let(T, map_list(F, let_vars(T)), map(F, let_arg(T)), @@ -235,6 +249,12 @@ fold_1(F, S, T) -> fold(F, fold(F, S, cons_hd(T)), cons_tl(T)); tuple -> fold_list(F, S, tuple_es(T)); + map -> + fold_list(F, S, map_es(T)); + map_pair_assoc -> + fold_list(F, S, map_pair_assoc_es(T)); + map_pair_exact -> + fold_list(F, S, map_pair_exact_es(T)); 'let' -> fold(F, fold(F, fold_list(F, S, let_vars(T)), let_arg(T)), @@ -349,6 +369,15 @@ mapfold(F, S0, T) -> tuple -> {Ts, S1} = mapfold_list(F, S0, tuple_es(T)), F(update_c_tuple_skel(T, Ts), S1); + map -> + {Ts, S1} = mapfold_list(F, S0, map_es(T)), + F(update_c_map_skel(T, Ts), S1); + map_pair_assoc -> + {Ts, S1} = mapfold_list(F, S0, map_pair_assoc_es(T)), + F(update_c_map_pair_assoc_skel(T,Ts), S1); + map_pair_exact -> + {Ts, S1} = mapfold_list(F, S0, map_pair_exact_es(T)), + F(update_c_map_pair_exact_skel(T,Ts), S1); 'let' -> {Vs, S1} = mapfold_list(F, S0, let_vars(T)), {A, S2} = mapfold(F, S1, let_arg(T)), @@ -488,6 +517,12 @@ variables(T, S) -> variables(cons_tl(T), S)); tuple -> vars_in_list(tuple_es(T), S); + map -> + vars_in_list(map_es(T), S); + map_pair_assoc -> + vars_in_list(map_pair_assoc_es(T), S); + map_pair_exact -> + vars_in_list(map_pair_exact_es(T), S); 'let' -> Vs = variables(let_body(T), S), Vs1 = var_list_names(let_vars(T)), @@ -688,6 +723,18 @@ label(T, N, Env) -> {Ts, N1} = label_list(tuple_es(T), N, Env), {As, N2} = label_ann(T, N1), {ann_c_tuple_skel(As, Ts), N2}; + map -> + {Ts, N1} = label_list(map_es(T), N, Env), + {As, N2} = label_ann(T, N1), + {ann_c_map_skel(As, Ts), N2}; + map_pair_assoc -> + {Ts, N1} = label_list(map_pair_assoc_es(T), N, Env), + {As, N2} = label_ann(T, N1), + {ann_c_map_pair_assoc_skel(As, Ts), N2}; + map_pair_exact -> + {Ts, N1} = label_list(map_pair_exact_es(T), N, Env), + {As, N2} = label_ann(T, N1), + {ann_c_map_pair_exact_skel(As, Ts), N2}; 'let' -> {A, N1} = label(let_arg(T), N, Env), {Vs, N2, Env1} = label_vars(let_vars(T), N1, Env), |