Other compile fixes

The java backend is disabled temporarily
This commit is contained in:
Cédric Pasteur 2011-04-19 09:49:00 +02:00
parent 3c8fc39745
commit a2303ec7e1
6 changed files with 27 additions and 20 deletions

View file

@ -207,15 +207,16 @@ let const_dec cd =
Minils.c_type = cd.Heptagon.c_type;
Minils.c_loc = cd.Heptagon.c_loc; }
let program_desc pd = match pd with
| Heptagon.Ptype td -> Ptype (typedec td)
| Heptagon.Pnode nd -> Pnode (node nd)
| Heptagon.Pconst cd -> Pconst (const_dec cd)
let program
{ Heptagon.p_modname = modname;
Heptagon.p_opened = modules;
Heptagon.p_types = pt_list;
Heptagon.p_nodes = n_list;
Heptagon.p_consts = c_list; } =
Heptagon.p_desc = desc_list } =
{ p_modname = modname;
p_format_version = minils_format_version;
p_opened = modules;
p_types = List.map typedec pt_list;
p_nodes = List.map node n_list;
p_consts = List.map const_dec c_list}
p_desc = List.map program_desc desc_list }

View file

@ -641,17 +641,17 @@ let translate_const_def { Minils.c_name = name; Minils.c_value = se;
let program { Minils.p_modname = p_modname; Minils.p_opened = p_o; Minils.p_desc = pd; } =
build_anon pd;
let program_desc pd acc = match pd with
| Minils.Pnode n when not (Itfusion.is_anon_node n.Minils.n_name) ->
Pclass (translate_node n) :: acc
(* dont't translate anonymous nodes, they will be inlined TODO ?? inline obc code hein ?*)
(* dont't translate anonymous nodes, they will be inlined *)
| Minils.Pnode n -> acc
| Minils.Ptype t -> Ptype (translate_ty_def t) :: acc
| Minils.Pconst c -> Pconst (translate_const_def c) :: acc
in
let p_desc = List.fold_right program_desc [] pd in
let p_desc = List.fold_right program_desc pd [] in
{ p_modname = p_modname;
p_opened = p_module_list;
p_opened = p_o;
p_desc = p_desc }

View file

@ -41,7 +41,7 @@ let write_obc_file p =
let no_conf () = ()
let targets = [ "c",(Obc_no_params Cmain.program, no_conf);
"java", (Obc Java_main.program, Java_main.java_conf);
(*"java", (Obc Java_main.program, Java_main.java_conf);*)
"obc", (Obc write_obc_file, no_conf);
"obc_np", (Obc_no_params write_obc_file, no_conf);
"epo", (Minils write_object_file, no_conf) ]

View file

@ -186,6 +186,10 @@ let typing_node ({ n_input = i_list;
n_output = List.map set_clock o_list;
n_local = List.map set_clock l_list })
let program (({ p_nodes = p_node_list } as p)) =
{ (p) with p_nodes = List.map typing_node p_node_list; }
let program p =
let program_desc pd = match pd with
| Pnode nd -> Pnode (typing_node nd)
| _ -> pd
in
{ p with p_desc = List.map program_desc p.p_desc; }

View file

@ -260,9 +260,10 @@ let main_skel var_list prologue body =
let mk_main name p =
if !Compiler_options.simulation then (
let classes = program_classes p in
let n_names = !Compiler_options.assert_nodes in
let find_class n =
try List.find (fun cd -> cd.cd_name.name = n) p.p_classes
try List.find (fun cd -> cd.cd_name.name = n) classes
with Not_found ->
Format.eprintf "Unknown node %s.@." n;
exit 1 in

View file

@ -179,13 +179,14 @@ let print_const_dec ff c =
fprintf ff "const %a = %a@." print_qualname c.c_name
print_static_exp c.c_value
let print_prog ff { p_opened = modules; p_types = types;
p_consts = consts; p_classes = classes; } =
let print_prog_desc ff pd = match pd with
| Pclass cd -> print_class_def ff cd; fprintf ff "@\n@\n"
| Pconst cd -> print_const_dec ff cd
| Ptype td -> print_type_def ff td
let print_prog ff { p_opened = modules; p_desc = descs } =
List.iter (print_open_module ff) modules;
List.iter (print_type_def ff) types;
List.iter (print_const_dec ff) consts;
fprintf ff "@\n";
List.iter (fun cdef -> (print_class_def ff cdef; fprintf ff "@\n@\n")) classes
List.iter (print_prog_desc ff) descs
let print oc p =
let ff = formatter_of_out_channel oc in