123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106(**************************************************************************)(* *)(* This file is part of WP plug-in of Frama-C. *)(* *)(* Copyright (C) 2007-2025 *)(* CEA (Commissariat a l'energie atomique et aux energies *)(* 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). *)(* *)(**************************************************************************)(* -------------------------------------------------------------------------- *)(* --- Proxy to Region Analysis for Region Model --- *)(* -------------------------------------------------------------------------- *)typeregion=Region.nodeletget_map()=matchWpContext.get_scope()with|Kfkf->Region.mapkf|Global->Wp_parameters.not_yet_implemented"[region] logic context"letidregion=Region.uid(get_map())regionletof_idid=trySome(Region.find(get_map())id)withNot_found->Noneletcomparer1r2=Int.compare(Region.idr1)(Region.idr2)letprettyfmtr=Format.fprintffmt"R%03d"@@Region.idrmoduleR=structtypet=regionletcompare=compareletpretty=prettyend(* Keeping track of the decision to apply which memory model to each region *)moduleKind=WpContext.Generator(R)(structopenMemRegionletname="Wp.RegionAnalysis.Kind"typekey=regiontypedata=kindletkindmaprp=ifRegion.singletonmaprthenSinglepelseManypletcompiler=letmap=get_map()inmatchRegion.typedmaprwith|Somety->beginmatchCtypes.object_oftywith|C_inti->kindmapr(Inti)|C_floatf->kindmapr(Floatf)|C_pointer_->kindmaprPtr|_->Garbledend|None->Garbledend)moduleName=WpContext.Generator(R)(structletname="Wp.RegionAnalysis.Name"typekey=regiontypedata=stringoptionletcompiler=letmap=get_map()inmatchRegion.labelsmaprwith|label::_->Somelabel|[]->matchRegion.rootsmaprwith|v::_->Somev.vorig_name|_->Noneend)letkind=Kind.getletname=Name.getletpoints_toregion=Region.points_to(get_map())regionletseparatedr1r2=Region.separated(get_map())r1r2letincludedr1r2=Region.included(get_map())r1r2letcvarvar=trySome(Region.cvar(get_map())var)withNot_found->Noneletfieldrfd=trySome(Region.field(get_map())rfd)withNot_found->Noneletshiftrobj=trySome(Region.index(get_map())r(Ctypes.object_toobj))withNot_found->Noneletliteral~eid_=ignoreeid;Noneletfootprintr=Region.footprint(get_map())r