Changeset 632 for Deliverables/D2.2/8051/src/ASM
- Timestamp:
- Mar 4, 2011, 3:59:42 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D2.2/8051/src/ASM/ASMCosts.ml
r631 r632 66 66 let block_cost mem costs pc = 67 67 let treat = treat mem costs in 68 let (init_cost, next_pcs) = treat pc in69 68 let rec aux = function 70 69 | [] -> 0 71 | [pc] when BitVectors.WordMap.mem pc costs -> 070 | [pc] when BitVectors.WordMap.mem pc costs -> 0 72 71 | [pc] -> full_cost pc 73 72 | [pc1 ; pc2] when BitVectors.WordMap.mem pc1 costs && … … 87 86 let (cost, next_pcs) = treat pc in 88 87 cost + (aux next_pcs) in 89 init_cost + (aux next_pcs)88 full_cost pc 90 89 91 90 … … 113 112 let first_cost_label mem costs = 114 113 let rec aux oldpc = 115 try (BitVectors.WordMap.find oldpc costs, 0)116 with117 | Not_found ->118 let inst,pc,inst_cost= ASMInterpret.fetch mem oldpc in119 120 121 122 123 124 125 126 127 128 129 114 if BitVectors.WordMap.mem oldpc costs then 115 (BitVectors.WordMap.find oldpc costs, 0) 116 else 117 let (inst, pc, inst_cost) = ASMInterpret.fetch mem oldpc in 118 match inst_nature oldpc inst with 119 | Direct_fun_call pc -> 120 let (lbl, cost) = aux pc in 121 (lbl, inst_cost + cost) 122 | Return 123 | Goto _ 124 | Branch _ -> 125 assert false (* no such instructions before calling main *) 126 | Other -> 127 let (lbl, cost) = aux pc in 128 (lbl, inst_cost + cost) 130 129 in 131 130 aux (BitVectors.zero `Sixteen)
Note: See TracChangeset
for help on using the changeset viewer.