Project

General

Profile

Revision 3ca27bc7 src/backends/C/c_backend_src.ml

View differences:

src/backends/C/c_backend_src.ml
327 327
    (Utils.fprintf_list ~sep:"@," (pp_machine_instr dependencies m self)) el
328 328

  
329 329
and pp_machine_instr dependencies (m: machine_t) self fmt instr =
330
  match instr with 
330
  match get_instr_desc instr with 
331 331
  | MNoReset _ -> ()
332 332
  | MReset i ->
333 333
    pp_machine_reset m self fmt i
......
341 341
      i.var_type (mk_val (StateVar i) i.var_type) v
342 342
  | MStep ([i0], i, vl) when Basic_library.is_value_internal_fun (mk_val (Fun (i, vl)) i0.var_type)  ->
343 343
    pp_machine_instr dependencies m self fmt 
344
      (MLocalAssign (i0, mk_val (Fun (i, vl)) i0.var_type))
344
      (update_instr_desc instr (MLocalAssign (i0, mk_val (Fun (i, vl)) i0.var_type)))
345 345
  | MStep ([i0], i, vl) when has_c_prototype i dependencies -> 
346 346
    fprintf fmt "%a = %s(%a);" 
347 347
      (pp_c_val self (pp_c_var_read m)) (mk_val (LocalVar i0) i0.var_type)
......
437 437
    (Utils.fprintf_list ~sep:"" print_dealloc_instance) m.minstances
438 438

  
439 439
let print_stateless_init_code dependencies fmt m self =
440
  let minit = List.map (function MReset i -> i | _ -> assert false) m.minit in
440
  let minit = List.map (fun i -> match get_instr_desc i with MReset i -> i | _ -> assert false) m.minit in
441 441
  let array_mems = List.filter (fun v -> Types.is_array_type v.var_type) m.mmemory in
442 442
  fprintf fmt "@[<v 2>%a {@,%a%t%a%t%a%treturn;@]@,}@.@."
443 443
    (print_init_prototype self) (m.mname.node_id, m.mstatic)
......
452 452
    (Utils.pp_newline_if_non_empty m.minit)
453 453

  
454 454
let print_stateless_clear_code dependencies fmt m self =
455
  let minit = List.map (function MReset i -> i | _ -> assert false) m.minit in
455
  let minit = List.map (fun i -> match get_instr_desc i with MReset i -> i | _ -> assert false) m.minit in
456 456
  let array_mems = List.filter (fun v -> Types.is_array_type v.var_type) m.mmemory in
457 457
  fprintf fmt "@[<v 2>%a {@,%a%t%a%t%a%treturn;@]@,}@.@."
458 458
    (print_clear_prototype self) (m.mname.node_id, m.mstatic)
......
522 522
    (Utils.pp_newline_if_non_empty m.minit)
523 523

  
524 524
let print_init_code dependencies fmt m self =
525
  let minit = List.map (function MReset i -> i | _ -> assert false) m.minit in
525
  let minit = List.map (fun i -> match get_instr_desc i with MReset i -> i | _ -> assert false) m.minit in
526 526
  let array_mems = List.filter (fun v -> Types.is_array_type v.var_type) m.mmemory in
527 527
  fprintf fmt "@[<v 2>%a {@,%a%t%a%t%a%treturn;@]@,}@.@."
528 528
    (print_init_prototype self) (m.mname.node_id, m.mstatic)
......
537 537
    (Utils.pp_newline_if_non_empty m.minit)
538 538

  
539 539
let print_clear_code dependencies fmt m self =
540
  let minit = List.map (function MReset i -> i | _ -> assert false) m.minit in
540
  let minit = List.map (fun i -> match get_instr_desc i with MReset i -> i | _ -> assert false) m.minit in
541 541
  let array_mems = List.filter (fun v -> Types.is_array_type v.var_type) m.mmemory in
542 542
  fprintf fmt "@[<v 2>%a {@,%a%t%a%t%a%treturn;@]@,}@.@."
543 543
    (print_clear_prototype self) (m.mname.node_id, m.mstatic)

Also available in: Unified diff