source: Deliverables/D2.3/8051-memoryspaces-branch/src/RTL/RTLtailcall.ml @ 461

Last change on this file since 461 was 453, checked in by ayache, 9 years ago

Import of the Paris's sources.

File size: 799 bytes
Line 
1
2(** Temporary issue backdoor: tranform tail calls into regular calls *)
3
4let simplify_stmt exit lbl stmt graph = match stmt with
5  | RTL.St_tailcall_id (f, args) ->
6    Label.Map.add lbl (RTL.St_call_id (f, args, [], exit)) graph
7  | RTL.St_tailcall_ptr (f1, f2, args) ->
8    Label.Map.add lbl (RTL.St_call_ptr (f1, f2, args, [], exit)) graph
9  | _ -> graph
10
11let simplify_graph exit graph =
12  Label.Map.fold (simplify_stmt exit) graph graph
13
14let simplify_internal def =
15  { def with RTL.f_graph = simplify_graph def.RTL.f_exit def.RTL.f_graph }
16
17let simplify_funct (id, def) =
18  let def' = match def with
19    | RTL.F_int def -> RTL.F_int (simplify_internal def)
20    | RTL.F_ext def -> RTL.F_ext def
21  in
22  (id, def')
23
24let simplify p =
25  { p with RTL.functs = List.map simplify_funct p.RTL.functs }
Note: See TracBrowser for help on using the repository browser.