Project

General

Profile

Revision cf9cc6f9 src/main_lustre_compiler.ml

View differences:

src/main_lustre_compiler.ml
86 86
  end
87 87

  
88 88

  
89
let functional_backend () = 
90
  match !Options.output with
91
  | "horn" | "lustre" | "acsl" -> true
92
  | _ -> false
89 93

  
90 94
(* compile a .lus source file *)
91 95
let rec compile_source dirname basename extension =
......
236 240

  
237 241
  (* Optimize machine code *)
238 242
  let machine_code =
239
    if !Options.optimization >= 4 && !Options.output <> "horn" then
243
    if !Options.optimization >= 4 (* && !Options.output <> "horn" *) then
240 244
      begin
241
	Log.report ~level:1 (fun fmt -> fprintf fmt ".. machines optimization (phase 3)@,");
245
	Log.report ~level:1 
246
	  (fun fmt -> fprintf fmt ".. machines optimization: sub-expression elimination@,");
242 247
	Optimize_machine.machines_cse machine_code
243 248
      end
244 249
    else
......
247 252

  
248 253
  (* Optimize machine code *)
249 254
  let machine_code =
250
    if !Options.optimization >= 2 && !Options.output <> "horn" then
255
    if !Options.optimization >= 2 (* && !Options.output <> "horn" *) then
251 256
      begin
252
	Log.report ~level:1 (fun fmt -> fprintf fmt ".. machines optimization (phase 1)@,");
257
	Log.report ~level:1 
258
	  (fun fmt -> fprintf fmt 
259
	    ".. machines optimization: const. inlining (partial eval. with const)@,");
253 260
	Optimize_machine.machines_unfold (Corelang.get_consts prog) node_schs machine_code
254 261
      end
255 262
    else
256 263
      machine_code
257 264
  in
258 265
  (* Optimize machine code *)
259
  let machine_code =
260
    if !Options.optimization >= 3 && !Options.output <> "horn" then
266
  let machine_code = (* TODO reactivate. I disabled it because output variables were removed *)
267
    if false && !Options.optimization >= 3 && not (functional_backend ()) then
261 268
      begin
262
	Log.report ~level:1 (fun fmt -> fprintf fmt ".. machines optimization (phase 2)@,");
263
	Optimize_machine.machines_fusion (Optimize_machine.machines_reuse_variables machine_code node_schs)
269
	Log.report ~level:1 
270
	  (fun fmt -> fprintf fmt ".. machines optimization: minimize heap alloc by reusing vars@,");
271
	Optimize_machine.machines_fusion 
272
	  (Optimize_machine.machines_reuse_variables machine_code node_schs)
264 273
      end
265 274
    else
266 275
      machine_code

Also available in: Unified diff