Project

General

Profile

Revision f2b1c245

View differences:

src/corelang.ml
475 475
  nd.node_inputs @ nd.node_locals @ nd.node_outputs
476 476

  
477 477
let get_var id var_list =
478
 List.find (fun v -> v.var_id = id) var_list
478
    List.find (fun v -> v.var_id = id) var_list
479 479

  
480 480
let get_node_var id node =
481 481
  get_var id (get_node_vars node)
src/machine_code.ml
285 285
  | _   -> expr
286 286

  
287 287
let rec translate_expr node ((m, si, j, d, s) as args) expr =
288
 let expr = specialize_op expr in
288
  let expr = specialize_op expr in
289 289
 match expr.expr_desc with
290 290
 | Expr_const v                     -> Cst v
291 291
 | Expr_ident x                     -> translate_ident node args x
......
323 323
			    conditional g [translate_act node args (y, t)]
324 324
                              [translate_act node args (y, e)]
325 325
  | Expr_merge (x, hl)   -> MBranch (translate_ident node args x, List.map (fun (t,  h) -> t, [translate_act node args (y, h)]) hl)
326
  | _                    -> MLocalAssign (y, translate_expr node args expr)
326
  | _                    -> 
327
    MLocalAssign (y, translate_expr node args expr)
327 328

  
328 329
let reset_instance node args i r c =
329 330
  match r with
......
332 333
                   [control_on_clock node args c (conditional g [MReset i] [])]
333 334

  
334 335
let translate_eq node ((m, si, j, d, s) as args) eq =
335
  (*Format.eprintf "translate_eq %a with clock %a@." Printers.pp_node_eq eq Clocks.print_ck eq.eq_rhs.expr_clock;*)
336
  (* Format.eprintf "translate_eq %a with clock %a@." Printers.pp_node_eq eq Clocks.print_ck eq.eq_rhs.expr_clock; *)
336 337
  match eq.eq_lhs, eq.eq_rhs.expr_desc with
337 338
  | [x], Expr_arrow (e1, e2)                     ->
338 339
    let var_x = get_node_var x node in
src/main_lustre_compiler.ml
181 181
    Normalization.unfold_arrow_active := false;
182 182
  let prog = Normalization.normalize_prog prog in
183 183
  Log.report ~level:2 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@," Printers.pp_prog prog);
184

  
185 184
  (* Checking array accesses *)
186 185
  if !Options.check then
187 186
    begin
......
191 190

  
192 191
  (* Computation of node equation scheduling. It also breaks dependency cycles
193 192
     and warns about unused input or memory variables *)
194
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. scheduling@,");
193
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. scheduling@,@?");
195 194
  let prog, node_schs = Scheduling.schedule_prog prog in
196 195
  Log.report ~level:1 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@," Scheduling.pp_warning_unused node_schs);
197 196
  Log.report ~level:3 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@," Scheduling.pp_schedule node_schs);
......
208 207
    else
209 208
      prog
210 209
  in
211

  
212 210
  (* DFS with modular code generation *)
213 211
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. machines generation@,");
214 212
  let machine_code = Machine_code.translate_prog prog node_schs in
src/normalization.ml
358 358
      let assert_expr = assert_.assert_expr in
359 359
      let (defs, vars'), expr = 
360 360
	normalize_expr 
361
	  ~alias:false 
361
	  ~alias:true 
362 362
	  node 
363 363
	  [] (* empty offset for arrays *)
364 364
	  ([], vars) (* defvar only contains vars *)
365 365
	  assert_expr
366 366
      in
367
      (* Format.eprintf "New assert vars: %a@.@?" (fprintf_list ~sep:", " Printers.pp_var) vars'; *)
367 368
      vars', defs@def_accu, {assert_ with assert_expr = expr}::assert_accu
368 369
    ) (vars, [], []) node.node_asserts in
369 370
  let new_locals = List.filter is_local vars in
371
  (* Format.eprintf "New locals: %a@.@?" (fprintf_list ~sep:", " Printers.pp_var) new_locals; *)
372

  
370 373
  (* Compute traceability info: 
371 374
     - gather newly bound variables
372 375
     - compute the associated expression without aliases     
......
393 396
    node_asserts = asserts;
394 397
    node_annot = norm_traceability::node.node_annot;
395 398
  }
396
  in ((*Printers.pp_node Format.err_formatter node;*) node)
399
  in ((*Printers.pp_node Format.err_formatter node;*) 
400
    node
401
)
402

  
397 403

  
398 404
let normalize_decl decl =
399 405
  match decl.top_decl_desc with
400 406
  | Node nd ->
401
    {decl with top_decl_desc = Node (normalize_node nd)}
407
    let decl' = {decl with top_decl_desc = Node (normalize_node nd)} in
408
    Hashtbl.replace Corelang.node_table nd.node_id decl';
409
    decl'
402 410
  | Open _ | ImportedNode _ | Const _ | TypeDef _ -> decl
403 411
  
404 412
let normalize_prog decls = 

Also available in: Unified diff