Last change
on this file since 1319 was
818,
checked in by ayache, 10 years ago
|
32 and 16 bits operations support in D2.2/8051
|
File size:
1.2 KB
|
Line | |
---|
1 | (* Pasted from Pottier's PP compiler *) |
---|
2 | |
---|
3 | (* This module offers functions that count how many times each |
---|
4 | pseudo-register is used within a piece of [ERTL] code. This |
---|
5 | is used in [Coloring] to drive the spilling heuristics. *) |
---|
6 | |
---|
7 | open ERTL |
---|
8 | |
---|
9 | let lookup uses r = |
---|
10 | try |
---|
11 | Register.Map.find r uses |
---|
12 | with Not_found -> |
---|
13 | 0 |
---|
14 | |
---|
15 | let count r uses = Register.Map.add r (lookup uses r + 1) uses |
---|
16 | |
---|
17 | let examine_statement _ stmt uses = |
---|
18 | match stmt with |
---|
19 | | St_skip _ |
---|
20 | | St_comment _ |
---|
21 | | St_cost _ |
---|
22 | | St_hdw_to_hdw _ |
---|
23 | | St_newframe _ |
---|
24 | | St_delframe _ |
---|
25 | | St_clear_carry _ |
---|
26 | | St_set_carry _ |
---|
27 | | St_call_id _ |
---|
28 | | St_return _ -> |
---|
29 | uses |
---|
30 | | St_get_hdw (r, _, _) |
---|
31 | | St_set_hdw (_, r, _) |
---|
32 | | St_framesize (r, _) |
---|
33 | | St_pop (r, _) |
---|
34 | | St_push (r, _) |
---|
35 | | St_int (r, _, _) |
---|
36 | | St_addrH (r, _, _) |
---|
37 | | St_addrL (r, _, _) |
---|
38 | | St_cond (r, _, _) -> |
---|
39 | count r uses |
---|
40 | | St_move (r1, r2, _) |
---|
41 | | St_op1 (_, r1, r2, _) -> |
---|
42 | count r1 (count r2 uses) |
---|
43 | | St_opaccsA (_, r1, r2, r3, _) |
---|
44 | | St_opaccsB (_, r1, r2, r3, _) |
---|
45 | | St_op2 (_, r1, r2, r3, _) |
---|
46 | | St_load (r1, r2, r3, _) |
---|
47 | | St_store (r1, r2, r3, _) -> |
---|
48 | count r1 (count r2 (count r3 uses)) |
---|
49 | |
---|
50 | let examine_internal int_fun = |
---|
51 | let uses = |
---|
52 | Label.Map.fold examine_statement int_fun.f_graph Register.Map.empty |
---|
53 | in |
---|
54 | lookup uses |
---|
55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.