let callgraph () =
  SGState.memo
    (fun () ->
       let g = SGraph.create () in
       !Value.compute ();
       Globals.Functions.iter
         (fun kf ->
            if !Value.is_called kf then SGraph.add_vertex g kf;
            List.iter
              (fun (caller,call_sites) ->
                 List.iter
                   (fun call_site -> SGraph.add_edge_e g (kf,call_site,caller))
                   call_sites)
              (!Value.callers kf));
       g)