47 : numObjects(4), numValues(4), numSymbols(4), numNodes(4), numType(0), strategy(
Options::NodeAllocStrat())
77 assert(
false &&
"NodeIDAllocator::allocateObjectId: unimplemented node allocation strategy.");
82 assert(
id != 0 &&
"NodeIDAllocator::allocateObjectId: ID not allocated");
121 assert(
id >
numSymbols &&
"NodeIDAllocator::allocateGepObjectId: GEP allocation clashing with other nodes");
125 assert(
false &&
"NodeIDAllocator::allocateGepObjectId: unimplemented node allocation strategy");
130 assert(
id != 0 &&
"NodeIDAllocator::allocateGepObjectId: ID not allocated");
159 assert(
false &&
"NodeIDAllocator::allocateValueId: unimplemented node allocation strategy");
165 assert(
id != 0 &&
"NodeIDAllocator::allocateValueId: ID not allocated");
195 assert(pta !=
nullptr &&
"Clusterer::cluster: given null BVDataPTAImpl");
215 for (
const std::pair<NodeID, unsigned> &
keyOcc :
keys)
300 if (pt.
empty())
continue;
314 std::vector<hclust_fast_methods>
methods;
406 std::vector<NodeID> reverseNodeMapping(nodeMapping.size(),
UINT_MAX);
407 for (
size_t i = 0;
i < nodeMapping.size(); ++
i)
411 reverseNodeMapping.at(
mapsTo) =
i;
414 return reverseNodeMapping;
420 return n*(
n-1)/2 - (
n-
i)*(
n-
i-1)/2 +
j -
i - 1;
425 return requiredBits(
pts.count());
430 if (
n == 0)
return 0;
460 std::vector<NodeID>
ptsVec;
462 for (
size_t i = 0;
i <
ptsVec.size(); ++
i)
467 for (
size_t j =
i + 1;
j <
ptsVec.size(); ++
j)
509 if (visited.find(
index) != visited.end())
return;
510 visited.insert(
index);
590 if (
pts.count() == 0)
continue;
607 if (
o < min) min =
o;
608 if (
o > max) max =
o;
661 std::pair<hclust_fast_methods, std::vector<NodeID>>
bestMapping = candidates[0];
663 size_t bestWords = std::numeric_limits<size_t>::max();
683 else assert(
false &&
"Clusterer::cluster: unsupported BV type for clustering.");
699 static const std::string
statKeys[] =
701 NumObjects, TheoreticalNumWords, OriginalSbvNumWords, OriginalBvNumWords,
702 NewSbvNumWords, NewBvNumWords, NumRegions, NumGtIntRegions,
703 NumNonTrivialRegionObjects, LargestRegion, RegioningTime,
704 DistanceMatrixTime, FastClusterTime, DendrogramTraversalTime,
705 EvalTime, TotalTime, BestCandidate
714 if (stat !=
stats.end())
#define NATIVE_INT_SIZE
Size of native integer that we'll use for bit vectors, in bits.
const PointsTo & getPts(NodeID id) override
static const std::string DistanceMatrixTime
static std::vector< NodeID > cluster(BVDataPTAImpl *pta, const std::vector< std::pair< NodeID, unsigned > > keys, std::vector< std::pair< hclust_fast_methods, std::vector< NodeID > > > &candidates, std::string evalSubtitle="")
static const std::string LargestRegion
static const std::string NumNonTrivialRegionObjects
static const std::string EvalTime
static std::vector< unsigned > regionObjects(const Map< NodeID, Set< NodeID > > &graph, size_t numObjects, size_t &numLabels)
static const std::string TheoreticalNumWords
static std::pair< hclust_fast_methods, std::vector< NodeID > > determineBestMapping(const std::vector< std::pair< hclust_fast_methods, std::vector< NodeID > > > &candidates, Map< PointsTo, unsigned > pointsToSets, const std::string &evalSubtitle, double &evalTime)
static const std::string BestCandidate
static std::vector< NodeID > getReverseNodeMapping(const std::vector< NodeID > &nodeMapping)
static const std::string OriginalSbvNumWords
static const std::string DendrogramTraversalTime
static const std::string NewSbvNumWords
static double * getDistanceMatrix(const std::vector< std::pair< const PointsTo *, unsigned > > pointsToSets, const size_t numObjects, const Map< NodeID, unsigned > &nodeMap, double &distanceMatrixTime)
static unsigned requiredBits(const PointsTo &pts)
Returns the minimum number of bits required to represent pts in a perfect world.
static void traverseDendrogram(std::vector< NodeID > &nodeMap, const int *dendrogram, const size_t numObjects, unsigned &allocCounter, Set< int > &visited, const int index, const std::vector< NodeID > ®ionNodeMap)
static void printStats(std::string title, Map< std::string, std::string > &stats)
static const std::string NumRegions
static size_t condensedIndex(size_t n, size_t i, size_t j)
static void evaluate(const std::vector< NodeID > &nodeMap, const Map< PointsTo, unsigned > pointsToSets, Map< std::string, std::string > &stats, bool accountForOcc)
Fills in *NumWords statistics in stats..
static const std::string RegioningTime
static const std::string NumGtIntRegions
static const std::string FastClusterTime
static const std::string OriginalBvNumWords
static const std::string NewBvNumWords
static const std::string NumObjects
static const std::string TotalTime
NodeID numValues
Number of values allocated, including specials.
static const NodeID nullPointerId
NodeID allocateValueId(void)
Allocate a value ID as determined by the strategy.
static NodeIDAllocator * get(void)
Return (singleton) allocator.
NodeID numSymbols
Number of explicit symbols allocated (e.g., llvm::Values), including specials.
enum Strategy strategy
Strategy to allocate with.
static const NodeID blackHolePointerId
NodeID numType
Total number of svftypes.
static NodeIDAllocator * allocator
Single allocator.
static const NodeID constantObjectId
NodeID allocateTypeId(void)
Allocate an type ID as determined by the strategy.
NodeID allocateObjectId(void)
Allocate an object ID as determined by the strategy.
static const NodeID blackHoleObjectId
@ SEQ
Allocate objects objects and values sequentially, intermixed.
NodeID numNodes
Total number of objects and values allocated.
NodeID endSymbolAllocation(void)
Notify the allocator that all symbols have had IDs allocated.
void increaseNumOfObjAndNodes()
NodeID allocateGepObjectId(NodeID base, u32_t offset, u32_t maxFieldLimit)
NodeIDAllocator(void)
Builds a node ID allocator with the strategy specified on the command line.
static void unset(void)
Deletes the (singleton) allocator.
Carries around command line options.
static const OptionMap< SVF::NodeIDAllocator::Strategy > NodeAllocStrat
static const OptionMap< PointsTo::Type > PtType
Type of points-to set to use for all analyses.
static const Option< bool > RegionAlign
Align identifiers in each region to a word.
static const Option< bool > RegionedClustering
Cluster partitions separately.
static const OptionMap< u32_t > ClusterMethod
bool empty() const
Returns true if set is empty.
void clear()
Empty the set.
const_iterator begin() const
static double getClk(bool mark=false)
int hclust_fast(int n, double *distmat, int method, int *merge, double *height)
std::string hclustMethodToString(hclust_fast_methods method)
Returns a string representation of a hclust method.
std::ostream & outs()
Overwrite llvm::outs()
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
llvm::IRBuilder IRBuilder