2012-06-27 18:09:30 +02:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Heptagon *)
|
|
|
|
(* *)
|
|
|
|
(* Gwenael Delaval, LIG/INRIA, UJF *)
|
|
|
|
(* Leonard Gerard, Parkas, ENS *)
|
|
|
|
(* Adrien Guatto, Parkas, ENS *)
|
|
|
|
(* Cedric Pasteur, Parkas, ENS *)
|
2012-06-29 01:43:15 +02:00
|
|
|
(* Marc Pouzet, Parkas, ENS *)
|
2012-06-27 18:09:30 +02:00
|
|
|
(* *)
|
|
|
|
(* Copyright 2012 ENS, INRIA, UJF *)
|
|
|
|
(* *)
|
|
|
|
(* This file is part of the Heptagon compiler. *)
|
|
|
|
(* *)
|
|
|
|
(* Heptagon is free software: you can redistribute it and/or modify it *)
|
|
|
|
(* under the terms of the GNU General Public License as published by *)
|
|
|
|
(* the Free Software Foundation, either version 3 of the License, or *)
|
|
|
|
(* (at your option) any later version. *)
|
|
|
|
(* *)
|
|
|
|
(* Heptagon is distributed in the hope that it will be useful, *)
|
|
|
|
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
|
|
|
|
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
|
|
|
|
(* GNU General Public License for more details. *)
|
|
|
|
(* *)
|
|
|
|
(* You should have received a copy of the GNU General Public License *)
|
|
|
|
(* along with Heptagon. If not, see <http://www.gnu.org/licenses/> *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
2011-04-14 11:53:39 +02:00
|
|
|
open Compiler_utils
|
|
|
|
open Compiler_options
|
|
|
|
|
|
|
|
let pp p = if !verbose then Obc_printer.print stdout p
|
|
|
|
|
|
|
|
let compile_program p =
|
2011-04-20 18:20:53 +02:00
|
|
|
|
|
|
|
(* Memory allocation application *)
|
2011-09-09 16:05:44 +02:00
|
|
|
let p = pass "Application of Memory Allocation"
|
2014-03-18 11:01:56 +01:00
|
|
|
(!do_mem_alloc || !do_linear_typing) Memalloc_apply.program p pp in
|
2011-04-20 18:20:53 +02:00
|
|
|
|
2011-11-17 15:28:46 +01:00
|
|
|
(*Scalarize for wanting backends*)
|
|
|
|
let p = pass "Scalarize" (!do_scalarize) Scalarize.program p pp in
|
|
|
|
|
|
|
|
(*Simplify*)
|
|
|
|
let p = pass "Simplify" (!do_simplify) Simplify.program p pp in
|
|
|
|
|
2011-04-21 11:24:04 +02:00
|
|
|
(*Dead code removal*)
|
2011-09-09 16:05:44 +02:00
|
|
|
let p = pass "Dead code removal"
|
2014-03-18 11:01:56 +01:00
|
|
|
(!do_mem_alloc || !do_linear_typing) Deadcode.program p pp in
|
2011-04-21 11:24:04 +02:00
|
|
|
|
2011-11-03 00:43:36 +01:00
|
|
|
(*Control optimization*)
|
|
|
|
let p = pass "Control optimization" true Control.program p pp in
|
|
|
|
|
2012-02-08 16:16:41 +01:00
|
|
|
(*Loop unrolling*)
|
|
|
|
let p = pass "Loop unrolling" !Compiler_options.unroll_loops Unroll.program p pp in
|
|
|
|
|
2011-04-19 18:45:56 +02:00
|
|
|
p
|