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

-2c: override the enum mode when generating C code as the default (AsEnum)

generates unvalid C code.
parent 4508ea9f
No related branches found
No related tags found
No related merge requests found
OASISFormat: 0.4
Name: lustre-v6
Version: 1.660
Version: 1.661
Synopsis: The Lustre V6 Verimag compiler
Description: This package contains:
(1) lus2lic: the (current) name of the compiler (and interpreter via -exec).
......
(* Time-stamp: <modified the 05/09/2016 (at 10:28) by Erwan Jahier> *)
(* Time-stamp: <modified the 05/09/2016 (at 11:02) by Erwan Jahier> *)
(*
Le manager d'argument adapt de celui de lutin, plus joli
N.B. solution un peu batarde : les options sont stockes, comme avant, dans Global,
......@@ -247,6 +247,14 @@ let set_ec_options opt =
opt.expand_nodes <- true;
()
let set_c_options opt =
opt.gen_c <- true;
(match global_opt.expand_enums with
| AsEnum -> global_opt.expand_enums <- AsInt;
(* only override the default in this case *)
| AsInt | AsConst | AsBool -> ());
()
(*** USER OPTIONS TAB **)
let mkoptab (opt:t) : unit = (
mkopt opt
......@@ -270,15 +278,12 @@ let mkoptab (opt:t) : unit = (
;
mkopt opt
["-2c";"--to-c"]
(Arg.Unit (fun _ ->
opt.gen_c <- true;
global_opt.expand_enums <- AsInt;
))
(Arg.Unit (fun _ -> set_c_options opt))
["generate C code"]
;
mkopt opt ~doc_level:Basic
["-cc"; "--compile-generated-c"]
(Arg.Unit (fun i -> opt.gen_c <- true; opt.launch_cc <- true))
(Arg.Unit (fun i -> set_c_options opt; opt.launch_cc <- true))
["Try to compile the generated C files (force -2c)"]
;
mkopt opt
......@@ -392,12 +397,12 @@ let mkoptab (opt:t) : unit = (
;
mkopt opt ~doc_level:Advanced
["-2cil";"--2c-inline-loop"]
(Arg.Unit (fun i -> global_opt.soc2c_inline_loops <- true; opt.gen_c <- true))
(Arg.Unit (fun i -> global_opt.soc2c_inline_loops <- true; set_c_options opt))
["inline loops (that come from array iterators)"]
;
mkopt opt ~doc_level:Advanced
["-2cgc";"--2c-global-ctx"]
(Arg.Unit (fun i -> global_opt.soc2c_global_ctx <- true; opt.gen_c <- true))
(Arg.Unit (fun i -> global_opt.soc2c_global_ctx <- true; set_c_options opt))
["node context allocated as global variable (no \"new_ctx\" method)"]
;
......@@ -454,24 +459,26 @@ let mkoptab (opt:t) : unit = (
mkopt opt ~doc_level:Advanced
["-2cw7";"--2c-wcet"]
(Arg.Unit (fun i -> opt.gen_c <- true; opt.gen_wcet <- true;
global_opt.soc2c_global_ctx <- true))
(Arg.Unit (fun i ->
set_c_options opt;
opt.gen_wcet <- true;
global_opt.soc2c_global_ctx <- true))
["generates a main file for computing the wcet (force -2c -2cgc)"]
;
mkopt opt ~doc_level:Dev
["-2cs";"--2c-stack"]
(Arg.Unit (fun i -> opt.gen_c <- true; global_opt.io_transmit_mode <- Stack))
(Arg.Unit (fun i -> set_c_options opt; global_opt.io_transmit_mode <- Stack))
["Soc I/O are transmitted as params of the step functions (force -2c)"]
;
mkopt opt ~doc_level:Dev
["-2ch";"--2c-heap"]
(Arg.Unit (fun i -> opt.gen_c <- true; global_opt.io_transmit_mode <- Heap))
(Arg.Unit (fun i -> set_c_options opt; global_opt.io_transmit_mode <- Heap))
["Soc I/O are transmitted via a ctx structure in the heap (force -2c)"]
;
mkopt opt ~doc_level:Dev
["-2chs";"--2c-heap-and-stack"]
(Arg.Unit (fun i -> opt.gen_c <- true; global_opt.io_transmit_mode <- HeapStack))
(Arg.Unit (fun i -> set_c_options opt; global_opt.io_transmit_mode <- HeapStack))
["I/O of memoryless soc are transmitted via the stack, and the heap otherwise (force -2c)"]
;
......
(** Automatically generated from Makefile *)
let tool = "lus2lic"
let branch = "master"
let commit = "660"
let sha_1 = "9c822b3b5e15c279cb863183108cc3a9598abae4"
let commit = "661"
let sha_1 = "4508ea9fa98a3e651c3c3039d1525255d50ef17b"
let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
let maintainer = "jahier@imag.fr"
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