Inline extvalues: do not inline array literals.

This commit is contained in:
Adrien Guatto 2012-01-30 16:36:53 +01:00
parent 1910e7f868
commit 946a1f8228
2 changed files with 7 additions and 2 deletions

View file

@ -118,7 +118,7 @@ type kind = ExtValue | Any
let add context expected_kind e =
let up = match e.e_desc, expected_kind with
(* static arrays should be normalized to simplify code generation *)
| Econst { se_desc = Sarray _ }, ExtValue -> true
| Econst { se_desc = Sarray _ | Sarray_power _ }, ExtValue -> true
| (Evar _ | Eapp ({ a_op = Efield | Etuple | Ereinit }, _, _) | Ewhen _
| Econst _) , ExtValue -> false
| _ , ExtValue -> true

View file

@ -56,9 +56,14 @@ let gather_extvalues_node nd =
| _ -> false
in
let inlinable w = match w.w_desc with
| Wconst { se_desc = Sarray _ | Sarray_power _ } -> false
| _ -> true
in
let gather_extvalues_eq _ env eq =
let env = match eq.eq_lhs, eq.eq_rhs.e_desc with
| Evarpat x, Eextvalue w when not (is_linear w) -> Env.add x w env
| Evarpat x, Eextvalue w when not (is_linear w) && inlinable w -> Env.add x w env
| _ -> env
in
eq, env