47 : numObjects(4), numValues(4), numSymbols(4), numNodes(4), strategy(
Options::NodeAllocStrat())
77 assert(
false &&
"NodeIDAllocator::allocateObjectId: unimplemented node allocation strategy.");
82 assert(
id != 0 &&
"NodeIDAllocator::allocateObjectId: ID not allocated");
115 assert(
id >
numSymbols &&
"NodeIDAllocator::allocateGepObjectId: GEP allocation clashing with other nodes");
119 assert(
false &&
"NodeIDAllocator::allocateGepObjectId: unimplemented node allocation strategy");
124 assert(
id != 0 &&
"NodeIDAllocator::allocateGepObjectId: ID not allocated");
153 assert(
false &&
"NodeIDAllocator::allocateValueId: unimplemented node allocation strategy");
159 assert(
id != 0 &&
"NodeIDAllocator::allocateValueId: ID not allocated");
189 assert(pta !=
nullptr &&
"Clusterer::cluster: given null BVDataPTAImpl");
209 for (
const std::pair<NodeID, unsigned> &
keyOcc :
keys)
294 if (pt.
empty())
continue;
308 std::vector<hclust_fast_methods>
methods;
400 std::vector<NodeID> reverseNodeMapping(nodeMapping.size(),
UINT_MAX);
401 for (
size_t i = 0;
i < nodeMapping.size(); ++
i)
405 reverseNodeMapping.at(
mapsTo) =
i;
408 return reverseNodeMapping;
414 return n*(
n-1)/2 - (
n-
i)*(
n-
i-1)/2 +
j -
i - 1;
419 return requiredBits(
pts.count());
424 if (
n == 0)
return 0;
454 std::vector<NodeID>
ptsVec;
456 for (
size_t i = 0;
i <
ptsVec.size(); ++
i)
461 for (
size_t j =
i + 1;
j <
ptsVec.size(); ++
j)
503 if (visited.find(
index) != visited.end())
return;
504 visited.insert(
index);
584 if (
pts.count() == 0)
continue;
601 if (
o < min) min =
o;
602 if (
o > max) max =
o;
655 std::pair<hclust_fast_methods, std::vector<NodeID>>
bestMapping = candidates[0];
657 size_t bestWords = std::numeric_limits<size_t>::max();
677 else assert(
false &&
"Clusterer::cluster: unsupported BV type for clustering.");
693 static const std::string
statKeys[] =
695 NumObjects, TheoreticalNumWords, OriginalSbvNumWords, OriginalBvNumWords,
696 NewSbvNumWords, NewBvNumWords, NumRegions, NumGtIntRegions,
697 NumNonTrivialRegionObjects, LargestRegion, RegioningTime,
698 DistanceMatrixTime, FastClusterTime, DendrogramTraversalTime,
699 EvalTime, TotalTime, BestCandidate
708 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
static NodeIDAllocator * allocator
Single allocator.
static const NodeID constantObjectId
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< enum hclust_fast_methods > 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