123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120(**************************************************************************)(* *)(* This file is part of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)openLocationsmoduleTbl=Kernel_function.Make_Table(Function_Froms)(structletname="Functionwise dependencies"letsize=17letdependencies=[Eva.Analysis.self]end)let()=From_parameters.ForceDeps.set_output_dependencies[Tbl.self](* Forward reference to a function computing the from for a given function *)letforce_compute=ref(fun_->assertfalse)moduleTo_Use=structletstmt_requeststmt=Eva.Results.beforestmtletmemokf=Tbl.memo(funkf->!force_computekf;tryTbl.findkfwithNot_found->invalid_arg"could not compute dependencies")kfletget_from_callkf_=memokfletkeep_basekf=(* Eta-expansion required *)Eva.Logic_inout.accept_base~formals:false~locals:falsekfletcleanupkffroms=ifFunction_Froms.Memory.is_bottomfroms.Function_Froms.deps_tablethenfromselseletaccept_base=Eva.Logic_inout.accept_base~formals:true~locals:falsekfinletfbintervs=ifaccept_basebthenZone.injectbintervselseZone.bottominletjoiner=Zone.joininletprojection_=Int_Intervals.topinletzone_substitution=Zone.cached_fold~cache_name:"from cleanup"~temporary:true~f~joiner~empty:Zone.bottom~projectioninletzone_substitutionx=tryzone_substitutionxwithAbstract_interp.Error_Top->Zone.topinletmap_zone=Function_Froms.Deps.mapzone_substitutioninletsubst=Function_Froms.DepsOrUnassigned.substmap_zoneinletopenFunction_Fromsin{deps_table=Memory.mapsubstfroms.deps_table;deps_return=Deps.mapzone_substitutionfroms.deps_return;}letcleanup_and_savekffroms=letfroms=cleanupkffromsinTbl.addkffroms;fromsendmoduleFrom=From_compute.Make(To_Use)let()=force_compute:=From.computeletself=Tbl.selfletcomputekf=ignore(To_Use.memokf)letforce_compute_all()=Eva.Analysis.compute();Callgraph.Uses.iter_in_rev_order@@funkf->letis_definition=Kernel_function.is_definitionkfinifis_definition&&Eva.Results.is_calledkfthencomputekfletcompute_all=letname="From.compute_all"inState_builder.apply_oncename[Tbl.self]force_compute_all|>fstletis_computed=Tbl.memletget=To_Use.memoletprettyfmtv=Function_Froms.pretty_with_type(Kernel_function.get_typev)fmt(getv)(*
Local Variables:
compile-command: "make -C ../../.."
End:
*)