Simplest: use smallest blk addr as entry point

This commit is contained in:
Théophile Bastian 2018-11-16 18:02:12 +01:00
parent b7a5caf87f
commit aec0ab59ad

View file

@ -279,10 +279,16 @@ let rec dfs_propagate changemap propagated parent_val node graph =
dfs_propagate changemap accu cur_val (CFG.Edge.dst edge) graph) dfs_propagate changemap accu cur_val (CFG.Edge.dst edge) graph)
let get_entry_blk graph = let get_entry_blk graph =
let entry = let entry = BStd.Seq.min_elt (CFG.nodes graph) ~cmp:(fun x y ->
BStd.Seq.find (CFG.nodes graph) let ax = opt_addr_of @@ CFG.Node.label x
(fun node -> BStd.Seq.is_empty @@ CFG.Node.inputs node graph) and ay = opt_addr_of @@ CFG.Node.label y in
in match entry with match ax, ay with
| None, None -> compare x y
| Some _, None -> -1
| None, Some _ -> 1
| Some ax, Some ay -> compare (to_int64_addr ax) (to_int64_addr ay))
in
match entry with
| None -> assert false | None -> assert false
| Some x -> x | Some x -> x