|
61 | 61 | (* let compute_array_offset ~idcs ~dims = Array.fold2_exn idcs dims ~init:0 ~f:(fun offset idx dim |
62 | 62 | -> idx + (offset * dim)) *) |
63 | 63 | let print_includes ppf = |
64 | | - Stdlib.Format.(fprintf ppf {|@[<v 0>%a@,|} (pp_print_list pp_include) B.includes) |
| 64 | + Stdlib.Format.(fprintf ppf {|@[<v 0>%a@,@,|} (pp_print_list pp_include) B.includes) |
65 | 65 |
|
66 | 66 | let compile_main ~traced_store ppf llc : unit = |
67 | 67 | let open Stdlib.Format in |
@@ -266,20 +266,19 @@ struct |
266 | 266 | List.rev |
267 | 267 | @@ Hashtbl.fold traced_store ~init:[] ~f:(fun ~key:tn ~data:_ params -> |
268 | 268 | (* A rough approximation to the type Gccjit_backend.mem_properties. *) |
269 | | - let backend_info = |
270 | | - Sexp.Atom |
271 | | - (if Tn.is_virtual_force tn 334 then "Virt" |
272 | | - else |
273 | | - match in_ctx tn with |
274 | | - | Some true -> "Ctx" |
275 | | - | Some false -> "Local" |
276 | | - | None -> "Unk") |
| 269 | + let backend_info, is_param = |
| 270 | + if Tn.is_virtual_force tn 334 then ("Virt", false) |
| 271 | + else if Option.value ~default:false @@ in_ctx tn then ("Ctx", true) |
| 272 | + else if Tn.is_materialized_force tn 335 then ("Global or ctx", true) |
| 273 | + else if Tn.known_not_materialized tn then ("Local", false) |
| 274 | + else assert false |
277 | 275 | in |
| 276 | + let backend_info = Sexp.Atom backend_info in |
278 | 277 | if not @@ Utils.sexp_mem ~elem:backend_info tn.backend_info then |
279 | 278 | tn.backend_info <- Utils.sexp_append ~elem:backend_info tn.backend_info; |
280 | 279 | (* We often don't know ahead of linking with relevant contexts what the stream sharing |
281 | 280 | mode of the node will become. Conservatively, use passing as argument. *) |
282 | | - if Option.value ~default:true (in_ctx tn) then |
| 281 | + if is_param then |
283 | 282 | (B.typ_of_prec (Lazy.force tn.Tn.prec) ^ " *" ^ get_ident tn, Param_ptr tn) :: params |
284 | 283 | else params) |
285 | 284 | in |
@@ -345,7 +344,7 @@ struct |
345 | 344 | params); |
346 | 345 | fprintf ppf "/* Local declarations and initialization. */@ "; |
347 | 346 | Hashtbl.iteri traced_store ~f:(fun ~key:tn ~data:node -> |
348 | | - if not (Tn.is_virtual_force tn 333 || Option.value ~default:true (in_ctx tn)) then |
| 347 | + if not (Tn.is_virtual_force tn 333 || Tn.is_materialized_force tn 336) then |
349 | 348 | fprintf ppf "%s %s[%d]%s;@ " |
350 | 349 | (B.typ_of_prec @@ Lazy.force tn.prec) |
351 | 350 | (get_ident tn) (Tn.num_elems tn) |
|
0 commit comments