#include "llvm/Analysis/FunctionPropertiesAnalysis.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/CommandLine.h"
#include <deque>
usingnamespacellvm;
namespace llvm {
cl::opt<bool> EnableDetailedFunctionProperties(
"enable-detailed-function-properties", cl::Hidden, cl::init(false),
cl::desc("Whether or not to compute detailed function properties."));
cl::opt<unsigned> BigBasicBlockInstructionThreshold(
"big-basic-block-instruction-threshold", cl::Hidden, cl::init(500),
cl::desc("The minimum number of instructions a basic block should contain "
"before being considered big."));
cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
"medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15),
cl::desc("The minimum number of instructions a basic block should contain "
"before being considered medium-sized."));
}
static cl::opt<unsigned> CallWithManyArgumentsThreshold(
"call-with-many-arguments-threshold", cl::Hidden, cl::init(4),
cl::desc("The minimum number of arguments a function call must have before "
"it is considered having many arguments."));
namespace {
int64_t getNumBlocksFromCond(const BasicBlock &BB) { … }
int64_t getUses(const Function &F) { … }
}
void FunctionPropertiesInfo::reIncludeBB(const BasicBlock &BB) { … }
void FunctionPropertiesInfo::updateForBB(const BasicBlock &BB,
int64_t Direction) { … }
void FunctionPropertiesInfo::updateAggregateStats(const Function &F,
const LoopInfo &LI) { … }
FunctionPropertiesInfo FunctionPropertiesInfo::getFunctionPropertiesInfo(
Function &F, FunctionAnalysisManager &FAM) { … }
FunctionPropertiesInfo FunctionPropertiesInfo::getFunctionPropertiesInfo(
const Function &F, const DominatorTree &DT, const LoopInfo &LI) { … }
void FunctionPropertiesInfo::print(raw_ostream &OS) const { … }
AnalysisKey FunctionPropertiesAnalysis::Key;
FunctionPropertiesInfo
FunctionPropertiesAnalysis::run(Function &F, FunctionAnalysisManager &FAM) { … }
PreservedAnalyses
FunctionPropertiesPrinterPass::run(Function &F, FunctionAnalysisManager &AM) { … }
FunctionPropertiesUpdater::FunctionPropertiesUpdater(
FunctionPropertiesInfo &FPI, CallBase &CB)
: … { … }
DominatorTree &FunctionPropertiesUpdater::getUpdatedDominatorTree(
FunctionAnalysisManager &FAM) const { … }
void FunctionPropertiesUpdater::finish(FunctionAnalysisManager &FAM) const { … }
bool FunctionPropertiesUpdater::isUpdateValid(Function &F,
const FunctionPropertiesInfo &FPI,
FunctionAnalysisManager &FAM) { … }