Skip to content
Snippets Groups Projects
Commit a082a93b authored by Erwan Jahier's avatar Erwan Jahier
Browse files

soc2c: do not generate empty _ext.c/h.

parent cbdf20e3
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ test_files:
cp -rf $(LUS2LICDIR)/test/myec2c $(RELNAME)/test/
cp -rf $(shell which lurettetop) $(RELNAME)/test/
cp -rf $(LUS2LICDIR)/utils/test_lus2lic_no_node $(RELNAME)/utils
rm -f $(RELNAME)/test/*/*.lus~
rm -f $(RELNAME)/test/*/normal.lus
rm -f $(RELNAME)/test/*/*/normal.lus
rm -f $(RELNAME)/test/*/ELMU.lus
......@@ -89,11 +90,13 @@ www: $(RELNAME).tgz
cp $(LUS2LICDIR)/lv6-ref-man/lv6-ref-man.pdf $(WWW_DIR)/doc/
LAB_INSTALL_DIR=/usr/local/tools/lustre/v6
LAB_INSTALL_DIR=/import/linux/x86_64/tools/lustre/v6
verimag:
cp $(RELNAME).tgz /usr/local/tools/lustre-v6
cd /usr/local/tools/lustre-v6 ; tar xvfz $(RELNAME).tgz
rm /usr/local/tools/lustre-v6/current
ln -s /usr/local/tools/lustre-v6/$(RELNAME) /usr/local/tools/lustre-v6/current
cp $(RELNAME).tgz $(LAB_INSTALL_DIR)
cd $(LAB_INSTALL_DIR) ; tar xvfz $(RELNAME).tgz
rm -f $(LAB_INSTALL_DIR)/current
ln -s $(LAB_INSTALL_DIR)/$(RELNAME) $(LAB_INSTALL_DIR)/current
clean:
......
(* Time-stamp: <modified the 09/07/2014 (at 12:17) by Erwan Jahier> *)
(* Time-stamp: <modified the 11/07/2014 (at 14:02) by Erwan Jahier> *)
open Soc2cIdent
......@@ -20,9 +20,10 @@ let (type_decl : LicPrg.t -> string) =
else acc
in
let preambule = "\n/* XXX FIXME: The following types must be defined/fixed */" ^
"\n#define FAKE_TYPE_DEF_2FIX int"
"\n#define FAKE_TYPE_DEF_2FIX int\n"
in
(LicPrg.fold_types type_to_string prg preambule)^"\n"
let str = LicPrg.fold_types type_to_string prg "" in
if str = "" then "" else (preambule^""^str^"\n")
let (cpy_def : LicPrg.t -> string) =
fun prg ->
......@@ -33,7 +34,8 @@ let (cpy_def : LicPrg.t -> string) =
| _ -> acc
in
let preambule = "\n/* XXX FIXME: The following copy functions must be defined/fixed */" in
(LicPrg.fold_types type_to_string prg preambule)^"\n"
let str = LicPrg.fold_types type_to_string prg "" in
if str = "" then "" else (preambule^str^"\n")
(* exported *)
let (cpy_declaration : LicPrg.t -> string) =
......@@ -45,7 +47,8 @@ let (cpy_declaration : LicPrg.t -> string) =
| _ -> acc
in
let preambule = "/* */\n" in
(LicPrg.fold_types type_to_string prg preambule)^"\n"
let str = LicPrg.fold_types type_to_string prg "" in
if str = "" then "" else (preambule^str^"\n")
let (cpy_decl : LicPrg.t -> string) =
fun prg ->
......@@ -56,7 +59,8 @@ let (cpy_decl : LicPrg.t -> string) =
| _ -> acc
in
let preambule = "/* */\n" in
(LicPrg.fold_types type_to_string prg preambule)^"\n"
let str = LicPrg.fold_types type_to_string prg "" in
if str = "" then "" else (preambule^str^"\n")
let (const_def : LicPrg.t -> string) =
......@@ -70,7 +74,8 @@ let (const_def : LicPrg.t -> string) =
in
let preambule = "\n/* XXX FIXME: The following const def must be defined/fixed */" ^
"\n#define FAKE_CONST_DEF_2FIX 1" in
(LicPrg.fold_consts const_to_string prg preambule)^"\n"
let str = LicPrg.fold_consts const_to_string prg "" in
if str = "" then "" else (preambule^str^"\n")
(* exported *)
let (const_declaration : LicPrg.t -> string) =
......@@ -83,7 +88,8 @@ let (const_declaration : LicPrg.t -> string) =
| _ -> acc
in
let preambule = "/* */\n" in
(LicPrg.fold_consts const_to_string prg preambule)^"\n"
let str = LicPrg.fold_consts const_to_string prg "" in
if str = "" then "" else (preambule^str^"\n")
open Soc
......@@ -107,7 +113,7 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string-> string -> bo
let needs_cfile = extern_steps <> [] in
let needs_hfile = needs_cfile || extern_types<>[] || extern_consts<>[] in
if not (Sys.file_exists ext_hfile) then (
if not (Sys.file_exists ext_hfile) && needs_hfile then (
let ext_och = open_out ext_hfile in
output_string ext_och (type_decl licprg);
output_string ext_och (cpy_decl licprg);
......@@ -123,9 +129,10 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string-> string -> bo
print_string (Printf.sprintf "%s has been generated.\n" ext_hfile);
);
if not (Sys.file_exists ext_cfile) then (
if not (Sys.file_exists ext_cfile) && needs_cfile then (
let ext_occ = open_out ext_cfile in
output_string ext_occ (Printf.sprintf "#include \"%s\"\n" hfile);
if needs_hfile then
output_string ext_occ (Printf.sprintf "#include \"%s\"\n" hfile);
output_string ext_occ (cpy_def licprg);
output_string ext_occ (const_def licprg);
List.iter (fun (sm,soc) ->
......
(* Time-stamp: <modified the 01/07/2014 (at 17:58) by Erwan Jahier> *)
(* Time-stamp: <modified the 10/07/2014 (at 11:54) by Erwan Jahier> *)
let colcol = Str.regexp "::"
let id2s id = (* XXX Refuser les noms de module à la con plutot *)
......@@ -45,7 +45,7 @@ let (key_op2str : Soc.key_opt -> string) = function
| Nomore -> ""
| Slic(b,e,s) -> Printf.sprintf "_slice_%d_%d_%d" b e s
| MemInit(var_expr) -> "_" ^
(* XXX This is wrong !!! *)
(* XXX This is wrong because hash is not an injection !!! *)
(string_of_int (Hashtbl.hash var_expr))
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ foreach f $ok_files {
wait -i $id5
if { [emptyfile "${basef}_${basef}.c"] } {
eval spawn "rm -f a.out"
if { [emptyfile "${basef}_${basef}_ext.c"] } {
set id6 [should_work "Check that the generated C code compiles " "gcc ${basef}_${basef}.c ${basef}_${basef}_ext.c ${basef}_${basef}_loop.c"]
} else {
......@@ -40,6 +41,9 @@ foreach f $ok_files {
wait -i $id6
catch { exp_close -i $id6 }
catch { exp_wait -i $id6 } output
}
catch { exp_close -i $id5 }
catch { exp_wait -i $id5 } output
......
testcase ./lus2lic.tests/non-reg.exp completed in 140 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
......@@ -2,6 +2,7 @@ set lus2lic "./lus2lic"
set ec2c "./ec2c"
set ec2c "./myec2c"
set test_lus2lic_no_node "../utils/test_lus2lic_no_node"
set compare_exec_and_2c "../utils/compare_exec_and_2c"
set timeout 10
......
......@@ -57,7 +57,7 @@ http://www.di.ens.fr/~pouzet/bib/lctes12.pdf
faire comme pour _assign_EXT_TYPE en s'inspirant de ce que fait ec2c
** TODO lic2c : slice en partie gauche pas traitée
** TODO lic2c : slice en partie gauche pas traitée
1. file:test/should_work/morel.lus lus2lic -2c should_work/morel.lus -n morel
2. file:test/should_work/morel2.lus lus2lic -2c should_work/morel2.lus -n morel2
......@@ -65,7 +65,7 @@ faire comme pour _assign_EXT_TYPE en s'inspirant de ce que fait ec2c
4. file:test/should_work/morel4.lus lus2lic -2c should_work/morel4.lus -n morel4
5. file:test/should_work/left.lus lus2lic -2c should_work/left.lus -n left
** TODO polymorphisme
** TODO lic2c : polymorphisme
- State "TODO" from "" [2014-07-09 Wed 17:13]
lus2lic -2c should_work/cond01.lus -n cond01
......@@ -83,10 +83,78 @@ par ailleur, l2lSplit ne devrait pas splitter les ites, si on veut
pouvoir faire l'optimisation qui consiste à n'executer qu'une des 2
branches si les noeuds ne font pas d'effet de bord.
** TODO pb en utilisant -2c et -esa en meme temps
- State "TODO" from "" [2014-07-04 Fri 16:16]
** TODO nommage des soc à mémoires avec valeurs initiales
Pour distinguer les différentes instances de soc à memoire (arrow
et fby), j'utilise le hash de leur valeur initiale, ce qui est faux,
car hash n'est pas une injection.
Est-ce la bonne approche ? Une alternative serait de n'avoir qu'une
seule soc et de faire la bonne initialisation en passant la valeur
initiale en argument de la fonction reset.
Une autre solution serait d'utiliser un générateur de nom unique, par
exemple basé sur un compteur.
[...] sauf qu'en fait, a fonstion de hash renvoie toujours la meme valeur (bug)
et que ca marche tres bien. Ce qui prouve bien que ca ne sert a rien cette affaire...
** TODO divergence -exec et -2c
- State "TODO" from "" [2014-07-11 Fri 12:02]
../utils/compare_exec_and_2c should_work/ck5.lus
../utils/compare_exec_and_2c should_work/ck6.lus
../utils/compare_exec_and_2c should_work/testPilote.lus
../utils/compare_exec_and_2c should_work/call06.lus
../utils/compare_exec_and_2c should_work/testCapt.lus
../utils/compare_exec_and_2c should_work/minmax5.lus
../utils/compare_exec_and_2c should_work/call05.lus
../utils/compare_exec_and_2c should_work/test_node_expand2.lus
../utils/compare_exec_and_2c should_work/minmax5_random.lus
../utils/compare_exec_and_2c should_work/test_node_expand.lus
../utils/compare_exec_and_2c should_work/X6.lus
../utils/compare_exec_and_2c should_work/sincos.lus
../utils/compare_exec_and_2c should_work/test_extern.lus
../utils/compare_exec_and_2c should_work/clock_ite.lus
../utils/compare_exec_and_2c should_work/integrator.lus
../utils/compare_exec_and_2c should_work/complex.lus
../utils/compare_exec_and_2c should_work/PCOND1.lus
../utils/compare_exec_and_2c should_work/call.lus
../utils/compare_exec_and_2c should_work/lustre_test1_ok.lus
../utils/compare_exec_and_2c should_work/sample_time_change.lus
../utils/compare_exec_and_2c should_work/CURRENT.lus
../utils/compare_exec_and_2c should_work/multiclock.lus
../utils/compare_exec_and_2c should_work/TIME_STABLE.lus
../utils/compare_exec_and_2c should_work/multipar.lus
../utils/compare_exec_and_2c should_work/pack1.lus
../utils/compare_exec_and_2c should_work/bob.lus
../utils/compare_exec_and_2c should_work/test_condact.lus
../utils/compare_exec_and_2c should_work/ck4.lus
../utils/compare_exec_and_2c should_work/filliter.lus
../utils/compare_exec_and_2c should_work/X2.lus
../utils/compare_exec_and_2c should_work/hanane.lus
../utils/compare_exec_and_2c should_work/ck3.lus
../utils/compare_exec_and_2c should_work/ck7.lus
../utils/compare_exec_and_2c should_work/PCOND.lus
../utils/compare_exec_and_2c should_work/ck2.lus
../utils/compare_exec_and_2c should_work/X.lus
../utils/compare_exec_and_2c should_work/clock1_2ms.lus
l 45
eval spawn "grep extern $f || { echo xxx > do_test$f.tmp } "
# do_test is used to avoid to perforn a comparison on files that contains extern nodes
if { [emptyfile a.out] && [emptyfile do_testt$f.tmp] } {
set id7 [should_work "Try to compare lus2lic -exec and -2c" "$compare_exec_and_2c" "$f"]
catch { exp_close -i $id7 }
catch { exp_wait -i $id7 } output
non-reg tests: compare lus2lic -exec and -2c.
# of expected passe s 1339 -> 1511
# of unexpected failures 100 -> 139
lus2lic should_work/modes3x2_v4.lus -n modes3x2_v4 -esa -o xxx -2c
* Packages, modeles, etc.
** STARTED Il ne detecte plus les erreurs de type lors d'instanciation de noeuds
......@@ -428,3 +496,4 @@ infos Lic.type_, donc autant attendre un peu avant de s'en passer.
- State "TODO" from "" [2013-05-31 Fri 16:42]
../utils/test_lus2lic_no_node should_work/sincos.lus
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment