@@ -377,14 +377,18 @@ type mutability =
377377 | Immutable
378378 | Maybe_mutable
379379
380+ type field_type =
381+ | Non_float
382+ | Float
383+
380384type expr =
381385 | Apply of
382386 { f : Var .t
383387 ; args : Var .t list
384388 ; exact : bool
385389 }
386390 | Block of int * Var .t array * array_or_not * mutability
387- | Field of Var .t * int
391+ | Field of Var .t * int * field_type
388392 | Closure of Var .t list * cont
389393 | Constant of constant
390394 | Prim of prim * prim_arg list
@@ -393,7 +397,7 @@ type expr =
393397type instr =
394398 | Let of Var .t * expr
395399 | Assign of Var .t * Var .t
396- | Set_field of Var .t * int * Var .t
400+ | Set_field of Var .t * int * field_type * Var .t
397401 | Offset_ref of Var .t * int
398402 | Array_set of Var .t * Var .t * Var .t
399403
@@ -537,7 +541,8 @@ module Print = struct
537541 Format. fprintf f " ; %d = %a" i Var. print a.(i)
538542 done ;
539543 Format. fprintf f " }"
540- | Field (x , i ) -> Format. fprintf f " %a[%d]" Var. print x i
544+ | Field (x , i , Non_float) -> Format. fprintf f " %a[%d]" Var. print x i
545+ | Field (x , i , Float) -> Format. fprintf f " FLOAT{%a[%d]}" Var. print x i
541546 | Closure (l , c ) -> Format. fprintf f " fun(%a){%a}" var_list l cont c
542547 | Constant c -> Format. fprintf f " CONST{%a}" constant c
543548 | Prim (p , l ) -> prim f p l
@@ -547,7 +552,10 @@ module Print = struct
547552 match i with
548553 | Let (x , e ) -> Format. fprintf f " %a = %a" Var. print x expr e
549554 | Assign (x , y ) -> Format. fprintf f " (assign) %a = %a" Var. print x Var. print y
550- | Set_field (x , i , y ) -> Format. fprintf f " %a[%d] = %a" Var. print x i Var. print y
555+ | Set_field (x , i , Non_float, y ) ->
556+ Format. fprintf f " %a[%d] = %a" Var. print x i Var. print y
557+ | Set_field (x , i , Float, y ) ->
558+ Format. fprintf f " FLOAT{%a[%d]} = %a" Var. print x i Var. print y
551559 | Offset_ref (x , i ) -> Format. fprintf f " %a[0] += %d" Var. print x i
552560 | Array_set (x , y , z ) ->
553561 Format. fprintf f " %a[%a] = %a" Var. print x Var. print y Var. print z
@@ -821,7 +829,7 @@ let invariant { blocks; start; _ } =
821829 let check_expr = function
822830 | Apply _ -> ()
823831 | Block (_ , _ , _ , _ ) -> ()
824- | Field (_ , _ ) -> ()
832+ | Field (_ , _ , _ ) -> ()
825833 | Closure (l , cont ) ->
826834 List. iter l ~f: define;
827835 check_cont cont
@@ -835,7 +843,7 @@ let invariant { blocks; start; _ } =
835843 define x;
836844 check_expr e
837845 | Assign _ -> ()
838- | Set_field (_ , _i , _ ) -> ()
846+ | Set_field (_ , _i , _ , _ ) -> ()
839847 | Offset_ref (_x , _i ) -> ()
840848 | Array_set (_x , _y , _z ) -> ()
841849 in
0 commit comments