|
141 | 141 |
|
142 | 142 | module CfgEdgeH = BatHashtbl.Make (CfgEdge) |
143 | 143 |
|
144 | | -let ignore_asm = get_bool "asm_is_nop" |
145 | | - |
146 | 144 | let createCFG (file: file) = |
147 | 145 | let cfgF = H.create 113 in |
148 | 146 | let cfgB = H.create 113 in |
@@ -378,19 +376,21 @@ let createCFG (file: file) = |
378 | 376 |
|
379 | 377 | | Asm (_, tmpls, outs, ins, _, labels, loc) -> |
380 | 378 | begin match real_succs () with |
381 | | - | [] -> failwith "MyCFG.createCFG: 0 Asm succ" |
382 | | - | [succ, skippedStatements] -> begin |
| 379 | + | [] -> failwith "MyCFG.createCFG: 0 Asm succ" |
| 380 | + | [succ, skippedStatements] -> begin |
383 | 381 | addEdge ~skippedStatements (Statement stmt) (loc, ASM(tmpls, outs, ins, false)) (Statement succ); |
384 | | - if not ignore_asm then |
385 | | - List.iter (fun label -> |
386 | | - let succ, skippedStatements = find_real_stmt ~parent:stmt !label in |
387 | | - addEdge ~skippedStatements (Statement stmt) (loc, ASM(tmpls, outs, ins, true)) (Statement succ) |
388 | | - ) labels |
389 | | - else () |
| 382 | + let unique_dests = List.fold_left (fun acc label -> |
| 383 | + let succ, skippedStatements = find_real_stmt ~parent:stmt !label in |
| 384 | + match List.assoc_opt succ acc with |
| 385 | + | Some _ -> acc |
| 386 | + | None -> (succ, skippedStatements) :: acc |
| 387 | + ) [] labels in |
| 388 | + List.iter (fun (succ, skippedStatements) -> |
| 389 | + addEdge ~skippedStatements (Statement stmt) (loc, ASM(tmpls, outs, ins, true)) (Statement succ) |
| 390 | + ) unique_dests; |
390 | 391 | end |
391 | | - | _ -> failwith "MyCFG.createCFG: >1 Asm succ" |
| 392 | + | _ -> failwith "MyCFG.createCFG: >1 Asm succ" |
392 | 393 | end |
393 | | - |
394 | 394 | | Continue _ |
395 | 395 | | Break _ |
396 | 396 | | Switch _ -> |
|
0 commit comments