Project

General

Profile

Revision 25320f03 src/machine_code.ml

View differences:

src/machine_code.ml
398 398
  (* Format.eprintf "ok1@.@?"; *)
399 399
  let schedule = sch.Scheduling_type.schedule in
400 400
  (* Format.eprintf "ok2@.@?"; *)
401
  let sorted_eqs = Scheduling.sort_equations_from_schedule eqs schedule in
401
  let sorted_eqs, unused = Scheduling.sort_equations_from_schedule eqs schedule in
402 402
  (* Format.eprintf "ok3@.locals=%a@.inout:%a@?"
403 403
   *   VSet.pp locals
404 404
   *   VSet.pp inout_vars
......
407 407
  let ctx, ctx0_s = translate_core (assert_instrs@sorted_eqs) locals inout_vars in
408 408
  
409 409
  (* Format.eprintf "ok4@.@?"; *)
410
  
411
 
410

  
411
  (* Removing computed memories from locals. We also removed unused variables. *)
412
  let updated_locals =
413
    let l = VSet.elements (VSet.diff locals ctx.m) in
414
    List.fold_left (fun res v -> if List.mem v.var_id unused then res else v::res) [] l
415
  in
412 416
  let mmap = Utils.IMap.elements ctx.j in
413 417
  {
414 418
    mname = nd;
......
421 425
    mstep = {
422 426
        step_inputs = nd.node_inputs;
423 427
        step_outputs = nd.node_outputs;
424
        step_locals = (* Removing computed memories from locals *)
425
          VSet.elements (VSet.diff locals ctx.m);
428
        step_locals = updated_locals;
426 429
        step_checks = List.map (fun d -> d.Dimension.dim_loc,
427 430
                                         translate_expr env 
428 431
                                           (expr_of_dimension d))

Also available in: Unified diff