@@ -223,7 +223,17 @@ let update_deps st { blocks; _ } =
223223 List. iter block.body ~f: (fun i ->
224224 match i with
225225 | Let (x , Block (_ , lst , _ , _ )) -> Array. iter ~f: (fun y -> add_dep st x y) lst
226- | Let (x , Prim (Extern ("%int_and" | "%int_or" | "%int_xor" ), lst )) ->
226+ | Let
227+ ( x
228+ , Prim
229+ ( Extern
230+ ( " %int_and"
231+ | " %int_or"
232+ | " %int_xor"
233+ | " caml_ba_get_1"
234+ | " caml_ba_get_2"
235+ | " caml_ba_get_3" )
236+ , lst ) ) ->
227237 (* The return type of these primitives depend on the input type *)
228238 List. iter
229239 ~f: (fun p ->
@@ -424,6 +434,35 @@ let prim_type ~approx prim args =
424434 | "caml_nativeint_to_int" -> Int Unnormalized
425435 | "caml_nativeint_of_int" -> Number Nativeint
426436 | "caml_int_compare" -> Int Normalized
437+ | "caml_ba_create" -> (
438+ match args with
439+ | [ Pc (Int kind); Pc (Int layout); _ ] ->
440+ Bigarray
441+ (Bigarray. make
442+ ~kind: (Targetint. to_int_exn kind)
443+ ~layout: (Targetint. to_int_exn layout))
444+ | _ -> Top )
445+ (* ZZZ *)
446+ | "caml_ba_get_1" (*| "caml_ba_get_2" | "caml_ba_get_3" * ) -> (
447+ match args with
448+ | ba :: _ -> (
449+ match arg_type ~approx ba with
450+ | Bot -> Bot
451+ | Bigarray { kind = Int8_unsigned | Char ; layout = C } -> Int Normalized
452+ (* ZZZ
453+ | Bigarray { kind; _ } -> (
454+ match kind with
455+ | Float16 | Float32 | Float64 -> Number Float
456+ | Int8_signed | Int8_unsigned | Int16_signed | Int16_unsigned | Char ->
457+ Int Normalized
458+ | Int -> Int Unnormalized
459+ | Int32 -> Number Int32
460+ | Int64 -> Number Int64
461+ | Nativeint -> Number Nativeint
462+ | Complex32 | Complex64 -> Tuple [Number Float; Number Float])
463+ *)
464+ | _ -> Top )
465+ | [] -> Top )
427466 | _ -> Top
428467
429468let propagate st approx x : Domain.t =
0 commit comments