Revision b3f91fdb
Added by Xavier Thirioux almost 8 years ago
src/corelang.ml | ||
---|---|---|
376 | 376 |
| Expr_ident id -> id |
377 | 377 |
| _ -> assert false |
378 | 378 |
|
379 |
(* Generate a new ident expression from a declared variable *) |
|
380 |
let expr_of_vdecl v = |
|
381 |
{ expr_tag = Utils.new_tag (); |
|
382 |
expr_desc = Expr_ident v.var_id; |
|
383 |
expr_type = v.var_type; |
|
384 |
expr_clock = v.var_clock; |
|
385 |
expr_delay = Delay.new_var (); |
|
386 |
expr_annot = None; |
|
387 |
expr_loc = v.var_loc } |
|
388 |
|
|
379 | 389 |
(* Caution, returns an untyped and unclocked expression *) |
380 | 390 |
let expr_of_ident id loc = |
381 | 391 |
{expr_tag = Utils.new_tag (); |
... | ... | |
429 | 439 |
mkexpr dim.dim_loc (Expr_appl (id, expr_of_expr_list dim.dim_loc (List.map expr_of_dimension args), None)) |
430 | 440 |
| Dlink dim' -> expr_of_dimension dim' |
431 | 441 |
| Dvar |
432 |
| Dunivar -> (Format.eprintf "internal error: expr_of_dimension %a@." Dimension.pp_dimension dim; |
|
442 |
| Dunivar -> (Format.eprintf "internal error: Corelang.expr_of_dimension %a@." Dimension.pp_dimension dim;
|
|
433 | 443 |
assert false) |
434 | 444 |
|
435 | 445 |
let dimension_of_const loc const = |
... | ... | |
478 | 488 |
let get_node_vars nd = |
479 | 489 |
nd.node_inputs @ nd.node_locals @ nd.node_outputs |
480 | 490 |
|
491 |
let mk_new_node_name nd id = |
|
492 |
let used_vars = get_node_vars nd in |
|
493 |
let used v = List.exists (fun vdecl -> vdecl.var_id = v) used_vars in |
|
494 |
mk_new_name used id |
|
495 |
|
|
481 | 496 |
let get_var id var_list = |
482 | 497 |
List.find (fun v -> v.var_id = id) var_list |
483 | 498 |
|
Also available in: Unified diff
LOTS of bug correction wrt inlining, still a work in progress...
- global constants were not accounted for
- no good avoidance of name capture when inlining
- static parameters (array sizes and clocks) not handled
- ill-typed generated expressions, when inlining array expressions