Project

General

Profile

Revision 07d8e7e7 src/c_backend.ml

View differences:

src/c_backend.ml
618 618
let print_static_link_instance fmt (i, (m, _)) =
619 619
 fprintf fmt "%a(%s)" pp_machine_static_link_name (node_name m) i
620 620

  
621
(* Allocation of a node struct:
622
   - if node memory is an array/matrix/etc, we cast it to a pointer (see pp_registers_struct)
623
*)
621 624
let print_static_link_macro fmt m =
622 625
  let array_mem = List.filter (fun v -> Types.is_array_type v.var_type) m.mmemory in
623 626
  fprintf fmt "@[<v>@[<v 2>#define %a(inst) do {\\@,%a%t%a;\\@]@,} while (0)@.@]"
624 627
    pp_machine_static_link_name m.mname.node_id
625 628
    (Utils.fprintf_list ~sep:";\\@,"
626 629
       (fun fmt v ->
627
	 fprintf fmt "inst._reg.%s = &%s"
630
	 fprintf fmt "inst._reg.%s = (%a*) &%s"
628 631
	   v.var_id
632
           (fun fmt v -> pp_c_type "" fmt (Types.array_base_type v.var_type)) v
629 633
	   v.var_id
630 634
       )) array_mem
631 635
    (Utils.pp_final_char_if_non_empty ";\\@," array_mem)

Also available in: Unified diff