Line | |
---|
1 | |
---|
2 | (** Temporary issue backdoor: tranform tail calls into regular calls *) |
---|
3 | |
---|
4 | let 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 | |
---|
11 | let simplify_graph exit graph = |
---|
12 | Label.Map.fold (simplify_stmt exit) graph graph |
---|
13 | |
---|
14 | let simplify_internal def = |
---|
15 | { def with RTL.f_graph = simplify_graph def.RTL.f_exit def.RTL.f_graph } |
---|
16 | |
---|
17 | let 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 | |
---|
24 | let simplify p = |
---|
25 | { p with RTL.functs = List.map simplify_funct p.RTL.functs } |
---|
Note: See
TracBrowser
for help on using the repository browser.