Project

General

Profile

« Previous | Next » 

Revision f20d8ac7

Added by Christophe Garion almost 3 years ago

Ada: skeletons for Ada compiler

View differences:

src/compiler_stages.ml
9 9
  match !Options.output, !Options.spec with
10 10
  | "C", "C" -> true
11 11
  | _ -> false
12
     
12

  
13 13

  
14 14
(* check whether a source file has a compiled header, if not, generate the
15 15
   compiled header *)
......
68 68
  let orig, prog =
69 69
    if !Options.global_inline && !Options.main_node <> "" then
70 70
      (if !Options.witnesses then prog else []),
71
      Inliner.global_inline basename prog 
71
      Inliner.global_inline basename prog
72 72
    else (* if !Option.has_local_inline *)
73 73
      [],
74 74
      Inliner.local_inline prog (* type_env clock_env *)
......
88 88

  
89 89
  (* Registering and checking machine types *)
90 90
  if Machine_types.is_active then Machine_types.load prog;
91
  
91

  
92 92

  
93 93
  (* Generating a .lusi header file only *)
94 94
  if !Options.lusi then
......
96 96
       exported as a lusi *)
97 97
    raise (StopPhase1 prog);
98 98

  
99
  (* Optimization of prog: 
100
     - Unfold consts 
99
  (* Optimization of prog:
100
     - Unfold consts
101 101
     - eliminate trivial expressions
102 102
  *)
103 103
  (*
104
    let prog = 
104
    let prog =
105 105
    if !Options.const_unfold || !Options.optimization >= 5 then
106 106
    begin
107 107
    Log.report ~level:1 (fun fmt -> fprintf fmt ".. eliminating constants and aliases@,");
......
139 139
  Clock_calculus.uneval_prog_generics prog;
140 140

  
141 141

  
142
(* Disabling witness option. Could but reactivated later 
142
(* Disabling witness option. Could but reactivated later
143 143
  if !Options.global_inline && !Options.main_node <> "" && !Options.witnesses then
144 144
    begin
145 145
      let orig = Corelang.copy_prog orig in
......
154 154
	!Options.main_node
155 155
	orig prog type_env clock_env
156 156
    end;
157
*)  
157
*)
158 158

  
159 159
  (* Computes and stores generic calls for each node,
160 160
     only useful for ANSI C90 compliant generic node compilation *)
......
201 201
      Access.check_prog prog;
202 202
    end;
203 203

  
204
  
204

  
205 205
  let prog = SortProg.sort_nodes_locals prog in
206
  
206

  
207 207
  prog, dependencies
208 208

  
209 209

  
210 210
    (* from source to machine code, with optimization *)
211
let stage2 prog =    
211
let stage2 prog =
212 212
  (* Computation of node equation scheduling. It also breaks dependency cycles
213 213
     and warns about unused input or memory variables *)
214 214
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. @[<v 2>scheduling@ ");
215 215
  let prog, node_schs =
216
    try 
216
    try
217 217
      Scheduling.schedule_prog prog
218 218
    with Causality.Error _ -> (* Error is not kept. It is recomputed in a more
219 219
				 systemtic way in AlgebraicLoop module *)
......
226 226
  Log.report ~level:3 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@," Printers.pp_prog prog);
227 227
  Log.report ~level:1 (fun fmt -> fprintf fmt "@]@ ");
228 228

  
229
  (* TODO Salsa optimize prog: 
229
  (* TODO Salsa optimize prog:
230 230
     - emits warning for programs with pre inside expressions
231 231
     - make sure each node arguments and memory is bounded by a local annotation
232 232
     - introduce fresh local variables for each real pure subexpression
......
238 238
  Log.report ~level:3 (fun fmt -> fprintf fmt ".. generated machines (unoptimized):@ %a@ " Machine_code_common.pp_machines machine_code);
239 239

  
240 240
  (* Optimize machine code *)
241
  Optimize_machine.optimize prog node_schs machine_code   
241
  Optimize_machine.optimize prog node_schs machine_code
242 242

  
243 243

  
244 244
(* printing code *)
245 245
let stage3 prog machine_code dependencies basename =
246 246
  let basename    =  Filename.basename basename in
247 247
  match !Options.output with
248
    "C" -> 
248
    "C" ->
249 249
      begin
250 250
	Log.report ~level:1 (fun fmt -> fprintf fmt ".. C code generation@,");
251 251
	C_backend.translate_to_c
......
262 262
       Log.report ~level:1 (fun fmt -> fprintf fmt ".. java code generation@,@?");
263 263
       Java_backend.translate_to_java source_fmt basename normalized_prog machine_code;*)
264 264
     end
265
  | "Ada" ->
266
    begin
267
      Log.report ~level:1 (fun fmt -> fprintf fmt ".. Ada code generation@,");
268
      Ada_backend.translate_to_ada
269
	basename prog machine_code dependencies
270
    end
265 271
  | "horn" ->
266 272
     begin
267 273
       let destname = !Options.dest_dir ^ "/" ^ basename in

Also available in: Unified diff