13#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_FUNCTIONSUMMARY_H
14#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_FUNCTIONSUMMARY_H
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/DenseSet.h"
20#include "llvm/ADT/SmallBitVector.h"
33 class FunctionSummary {
36 llvm::SmallBitVector VisitedBasicBlocks;
39 unsigned TotalBasicBlocks : 30;
43 unsigned InlineChecked : 1;
46 unsigned MayInline : 1;
49 unsigned TimesInlined : 32;
52 : TotalBasicBlocks(0), InlineChecked(0), MayInline(0),
56 using MapTy = llvm::DenseMap<const Decl *, FunctionSummary>;
61 MapTy::iterator I = Map.find(
D);
65 using KVPair = std::pair<const Decl *, FunctionSummary>;
67 I = Map.insert(KVPair(
D, FunctionSummary())).first;
68 assert(I != Map.end());
74 I->second.InlineChecked = 1;
75 I->second.MayInline = 1;
80 I->second.InlineChecked = 1;
81 I->second.MayInline = 0;
89 MapTy::const_iterator I = Map.find(
D);
90 if (I != Map.end() && I->second.InlineChecked)
91 return I->second.MayInline;
97 llvm::SmallBitVector &Blocks = I->second.VisitedBasicBlocks;
98 assert(
ID < TotalIDs);
99 if (TotalIDs > Blocks.size()) {
100 Blocks.resize(TotalIDs);
101 I->second.TotalBasicBlocks = TotalIDs;
107 MapTy::const_iterator I = Map.find(
D);
109 return I->second.VisitedBasicBlocks.count();
114 MapTy::const_iterator I = Map.find(
D);
116 return I->second.TimesInlined;
122 I->second.TimesInlined++;
127 MapTy::const_iterator I = Map.find(
D);
129 return ((I->second.VisitedBasicBlocks.count() * 100) /
130 I->second.TotalBasicBlocks);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Decl - This represents one declaration (or definition), e.g.
unsigned getTotalNumBasicBlocks()
std::optional< bool > mayInline(const Decl *D)
unsigned getTotalNumVisitedBasicBlocks()
void markVisitedBasicBlock(unsigned ID, const Decl *D, unsigned TotalIDs)
void markMayInline(const Decl *D)
unsigned getPercentBlocksReachable(const Decl *D)
Get the percentage of the reachable blocks.
unsigned getNumTimesInlined(const Decl *D)
void markShouldNotInline(const Decl *D)
void markReachedMaxBlockCount(const Decl *D)
unsigned getNumVisitedBasicBlocks(const Decl *D)
MapTy::iterator findOrInsertSummary(const Decl *D)
void bumpNumTimesInlined(const Decl *D)
llvm::DenseSet< const Decl * > SetOfConstDecls
std::deque< Decl * > SetOfDecls
The JSON file list parser is used to communicate input to InstallAPI.