! * Constructor */
| 44 | * Constructor |
| 45 | */ |
| 46 | BVDataPTAImpl::BVDataPTAImpl(SVFIR* p, PointerAnalysis::PTATY type, bool alias_check) : |
| 47 | PointerAnalysis(p, type, alias_check), ptCache() |
| 48 | { |
| 49 | if (type == Andersen_BASE || type == Andersen_WPA || type == AndersenWaveDiff_WPA |
| 50 | || type == TypeCPP_WPA || type == FlowS_DDA |
| 51 | || type == AndersenSCD_WPA || type == AndersenSFR_WPA || type == CFLFICI_WPA || type == CFLFSCS_WPA) |
| 52 | { |
| 53 | // Only maintain reverse points-to when the analysis is field-sensitive, as objects turning |
| 54 | // field-insensitive is all it is used for. |
| 55 | bool maintainRevPts = Options::MaxFieldLimit() != 0; |
| 56 | if (Options::ptDataBacking() == PTBackingType::Mutable) ptD = std::make_unique<MutDiffPTDataTy>(maintainRevPts); |
| 57 | else if (Options::ptDataBacking() == PTBackingType::Persistent) ptD = std::make_unique<PersDiffPTDataTy>(getPtCache(), maintainRevPts); |
| 58 | else assert(false && "BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!"); |
| 59 | } |
| 60 | else if (type == Steensgaard_WPA) |
| 61 | { |
| 62 | // Steensgaard is only field-insensitive (for now?), so no reverse points-to. |
| 63 | if (Options::ptDataBacking() == PTBackingType::Mutable) ptD = std::make_unique<MutDiffPTDataTy>(false); |
| 64 | else if (Options::ptDataBacking() == PTBackingType::Persistent) ptD = std::make_unique<PersDiffPTDataTy>(getPtCache(), false); |
| 65 | else assert(false && "BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!"); |
| 66 | } |
| 67 | else if (type == FSSPARSE_WPA) |
| 68 | { |
| 69 | if (Options::INCDFPTData()) |
| 70 | { |
| 71 | if (Options::ptDataBacking() == PTBackingType::Mutable) ptD = std::make_unique<MutIncDFPTDataTy>(false); |
| 72 | else if (Options::ptDataBacking() == PTBackingType::Persistent) ptD = std::make_unique<PersIncDFPTDataTy>(getPtCache(), false); |
| 73 | else assert(false && "BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!"); |
| 74 | } |
| 75 | else |
| 76 | { |
| 77 | if (Options::ptDataBacking() == PTBackingType::Mutable) ptD = std::make_unique<MutDFPTDataTy>(false); |
| 78 | else if (Options::ptDataBacking() == PTBackingType::Persistent) ptD = std::make_unique<PersDFPTDataTy>(getPtCache(), false); |
| 79 | else assert(false && "BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!"); |
| 80 | } |
| 81 | } |
| 82 | else if (type == VFS_WPA) |
| 83 | { |
| 84 | if (Options::ptDataBacking() == PTBackingType::Mutable) ptD = std::make_unique<MutVersionedPTDataTy>(false); |
| 85 | else if (Options::ptDataBacking() == PTBackingType::Persistent) ptD = std::make_unique<PersVersionedPTDataTy>(getPtCache(), false); |
| 86 | else assert(false && "BVDataPTAImpl::BVDataPTAImpl: unexpected points-to backing type!"); |
| 87 | } |
| 88 | else assert(false && "no points-to data available"); |
| 89 | |
| 90 | ptaImplTy = BVDataImpl; |
| 91 | } |
| 92 | |
| 93 | void BVDataPTAImpl::finalize() |
| 94 | { |
nothing calls this directly
no outgoing calls
no test coverage detected