2010-06-18 14:00:58 +02:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Heptagon *)
|
|
|
|
(* *)
|
|
|
|
(* Author : Marc Pouzet *)
|
|
|
|
(* Organization : Demons, LRI, University of Paris-Sud, Orsay *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
open Misc
|
2010-07-27 13:31:13 +02:00
|
|
|
open Location
|
2010-06-18 14:00:58 +02:00
|
|
|
open Compiler_utils
|
|
|
|
|
2010-07-27 13:31:13 +02:00
|
|
|
let pp p = if !verbose then Mls_printer.print stdout p
|
|
|
|
|
2010-09-09 00:35:06 +02:00
|
|
|
let parse parsing_fun lexing_fun lexbuf =
|
2010-07-27 13:31:13 +02:00
|
|
|
try
|
2010-09-09 00:35:06 +02:00
|
|
|
parsing_fun lexing_fun lexbuf
|
2010-07-27 13:31:13 +02:00
|
|
|
with
|
|
|
|
| Mls_lexer.Lexical_error(err, loc) ->
|
|
|
|
lexical_error err loc
|
|
|
|
| Mls_parser.Error ->
|
|
|
|
let pos1 = Lexing.lexeme_start_p lexbuf
|
|
|
|
and pos2 = Lexing.lexeme_end_p lexbuf in
|
|
|
|
let l = Loc(pos1,pos2) in
|
|
|
|
syntax_error l
|
|
|
|
|
2010-08-17 15:04:16 +02:00
|
|
|
let parse_implementation prog_name lexbuf =
|
2010-09-09 00:35:06 +02:00
|
|
|
let p = parse Mls_parser.program Mls_lexer.token lexbuf in
|
|
|
|
{ p with Mls_parsetree.p_modname = prog_name }
|
2010-07-27 13:31:13 +02:00
|
|
|
|
2010-06-18 14:00:58 +02:00
|
|
|
let compile pp p =
|
|
|
|
(* Clocking *)
|
2010-09-09 00:35:06 +02:00
|
|
|
let p = pass "Clocking" true Clocking.program p pp in
|
2010-06-18 14:00:58 +02:00
|
|
|
|
|
|
|
(* Check that the dataflow code is well initialized *)
|
2010-09-09 00:35:06 +02:00
|
|
|
(*let p = silent_pass "Initialization check" !init Init.program p in *)
|
2010-06-18 14:00:58 +02:00
|
|
|
|
2010-07-21 17:19:51 +02:00
|
|
|
(* Iterator fusion *)
|
2010-09-09 00:35:06 +02:00
|
|
|
(*let p = pass "Iterator fusion" false Itfusion.program p pp in*)
|
2010-07-21 17:19:51 +02:00
|
|
|
|
2010-06-18 14:00:58 +02:00
|
|
|
(* Normalization to maximize opportunities *)
|
2010-09-09 00:35:06 +02:00
|
|
|
let p = pass "Normalization" true Normalize.program p pp in
|
2010-06-26 16:53:25 +02:00
|
|
|
|
2010-06-18 14:00:58 +02:00
|
|
|
(* Scheduling *)
|
2010-09-09 00:35:06 +02:00
|
|
|
let p = pass "Scheduling" true Schedule.program p pp in
|
2010-06-26 16:53:25 +02:00
|
|
|
|
|
|
|
p
|