diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h b/contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h index 56a25af596..81bdf6fa7b 100644 --- a/contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h +++ b/contrib/libs/llvm12/include/llvm/Analysis/FunctionPropertiesAnalysis.h @@ -1,97 +1,97 @@ -#pragma once - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -//=- FunctionPropertiesAnalysis.h - Function Properties Analysis --*- C++ -*-=// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines the FunctionPropertiesInfo and FunctionPropertiesAnalysis -// classes used to extract function properties. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_FUNCTIONPROPERTIESANALYSIS_H_ -#define LLVM_FUNCTIONPROPERTIESANALYSIS_H_ - -#include "llvm/Analysis/LoopInfo.h" -#include "llvm/IR/PassManager.h" - -namespace llvm { -class Function; - -class FunctionPropertiesInfo { -public: - static FunctionPropertiesInfo getFunctionPropertiesInfo(const Function &F, - const LoopInfo &LI); - - void print(raw_ostream &OS) const; - - /// Number of basic blocks - int64_t BasicBlockCount = 0; - - /// Number of blocks reached from a conditional instruction, or that are - /// 'cases' of a SwitchInstr. - // FIXME: We may want to replace this with a more meaningful metric, like - // number of conditionally executed blocks: - // 'if (a) s();' would be counted here as 2 blocks, just like - // 'if (a) s(); else s2(); s3();' would. - int64_t BlocksReachedFromConditionalInstruction = 0; - - /// Number of uses of this function, plus 1 if the function is callable - /// outside the module. - int64_t Uses = 0; - - /// Number of direct calls made from this function to other functions - /// defined in this module. - int64_t DirectCallsToDefinedFunctions = 0; - - // Load Instruction Count - int64_t LoadInstCount = 0; - - // Store Instruction Count - int64_t StoreInstCount = 0; - - // Maximum Loop Depth in the Function - int64_t MaxLoopDepth = 0; - - // Number of Top Level Loops in the Function - int64_t TopLevelLoopCount = 0; -}; - -// Analysis pass -class FunctionPropertiesAnalysis - : public AnalysisInfoMixin<FunctionPropertiesAnalysis> { - -public: - static AnalysisKey Key; - - using Result = FunctionPropertiesInfo; - - Result run(Function &F, FunctionAnalysisManager &FAM); -}; - -/// Printer pass for the FunctionPropertiesAnalysis results. -class FunctionPropertiesPrinterPass - : public PassInfoMixin<FunctionPropertiesPrinterPass> { - raw_ostream &OS; - -public: - explicit FunctionPropertiesPrinterPass(raw_ostream &OS) : OS(OS) {} - - PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); -}; - -} // namespace llvm -#endif // LLVM_FUNCTIONPROPERTIESANALYSIS_H_ - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//=- FunctionPropertiesAnalysis.h - Function Properties Analysis --*- C++ -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the FunctionPropertiesInfo and FunctionPropertiesAnalysis +// classes used to extract function properties. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_FUNCTIONPROPERTIESANALYSIS_H_ +#define LLVM_FUNCTIONPROPERTIESANALYSIS_H_ + +#include "llvm/Analysis/LoopInfo.h" +#include "llvm/IR/PassManager.h" + +namespace llvm { +class Function; + +class FunctionPropertiesInfo { +public: + static FunctionPropertiesInfo getFunctionPropertiesInfo(const Function &F, + const LoopInfo &LI); + + void print(raw_ostream &OS) const; + + /// Number of basic blocks + int64_t BasicBlockCount = 0; + + /// Number of blocks reached from a conditional instruction, or that are + /// 'cases' of a SwitchInstr. + // FIXME: We may want to replace this with a more meaningful metric, like + // number of conditionally executed blocks: + // 'if (a) s();' would be counted here as 2 blocks, just like + // 'if (a) s(); else s2(); s3();' would. + int64_t BlocksReachedFromConditionalInstruction = 0; + + /// Number of uses of this function, plus 1 if the function is callable + /// outside the module. + int64_t Uses = 0; + + /// Number of direct calls made from this function to other functions + /// defined in this module. + int64_t DirectCallsToDefinedFunctions = 0; + + // Load Instruction Count + int64_t LoadInstCount = 0; + + // Store Instruction Count + int64_t StoreInstCount = 0; + + // Maximum Loop Depth in the Function + int64_t MaxLoopDepth = 0; + + // Number of Top Level Loops in the Function + int64_t TopLevelLoopCount = 0; +}; + +// Analysis pass +class FunctionPropertiesAnalysis + : public AnalysisInfoMixin<FunctionPropertiesAnalysis> { + +public: + static AnalysisKey Key; + + using Result = FunctionPropertiesInfo; + + Result run(Function &F, FunctionAnalysisManager &FAM); +}; + +/// Printer pass for the FunctionPropertiesAnalysis results. +class FunctionPropertiesPrinterPass + : public PassInfoMixin<FunctionPropertiesPrinterPass> { + raw_ostream &OS; + +public: + explicit FunctionPropertiesPrinterPass(raw_ostream &OS) : OS(OS) {} + + PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); +}; + +} // namespace llvm +#endif // LLVM_FUNCTIONPROPERTIESANALYSIS_H_ + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif |