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;
55 : TotalBasicBlocks(0), InlineChecked(0), MayInline(0),
59 using MapTy = llvm::DenseMap<const Decl *, FunctionSummary>;
64 MapTy::iterator I = Map.find(D);
68 using KVPair = std::pair<const Decl *, FunctionSummary>;
70 I = Map.insert(KVPair(D, FunctionSummary())).first;
71 assert(I != Map.end());
77 return I == Map.end() ?
nullptr : &I->second;
82 I->second.InlineChecked = 1;
83 I->second.MayInline = 1;
88 I->second.InlineChecked = 1;
89 I->second.MayInline = 0;
93 MapTy::const_iterator I = Map.find(D);
94 if (I != Map.end() && I->second.InlineChecked)
95 return I->second.MayInline;
101 llvm::SmallBitVector &Blocks = I->second.VisitedBasicBlocks;
102 assert(ID < TotalIDs);
103 if (TotalIDs > Blocks.size()) {
104 Blocks.resize(TotalIDs);
105 I->second.TotalBasicBlocks = TotalIDs;
111 MapTy::const_iterator I = Map.find(D);
113 return I->second.VisitedBasicBlocks.count();
118 MapTy::const_iterator I = Map.find(D);
120 return I->second.TimesInlined;
126 I->second.TimesInlined++;
131 MapTy::const_iterator I = Map.find(D);
133 return ((I->second.VisitedBasicBlocks.count() * 100) /
134 I->second.TotalBasicBlocks);
static UnsignedEPStat SyntaxRunningTime("SyntaxRunningTime")
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)
FunctionSummary const * findSummary(const Decl *D) const
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)
unsigned getNumVisitedBasicBlocks(const Decl *D)
MapTy::iterator findOrInsertSummary(const Decl *D)
void bumpNumTimesInlined(const Decl *D)
std::deque< Decl * > SetOfDecls
llvm::DenseSet< const Decl * > SetOfConstDecls
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...