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/lib/Analysis/InstCount.cpp | |
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/lib/Analysis/InstCount.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Analysis/InstCount.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/contrib/libs/llvm12/lib/Analysis/InstCount.cpp b/contrib/libs/llvm12/lib/Analysis/InstCount.cpp index 8366bee083..f08bc82c82 100644 --- a/contrib/libs/llvm12/lib/Analysis/InstCount.cpp +++ b/contrib/libs/llvm12/lib/Analysis/InstCount.cpp @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/InstCount.h" +#include "llvm/Analysis/InstCount.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/Passes.h" #include "llvm/IR/Function.h" @@ -24,71 +24,71 @@ using namespace llvm; #define DEBUG_TYPE "instcount" -STATISTIC(TotalInsts, "Number of instructions (of all types)"); +STATISTIC(TotalInsts, "Number of instructions (of all types)"); STATISTIC(TotalBlocks, "Number of basic blocks"); -STATISTIC(TotalFuncs, "Number of non-external functions"); +STATISTIC(TotalFuncs, "Number of non-external functions"); -#define HANDLE_INST(N, OPCODE, CLASS) \ - STATISTIC(Num##OPCODE##Inst, "Number of " #OPCODE " insts"); +#define HANDLE_INST(N, OPCODE, CLASS) \ + STATISTIC(Num##OPCODE##Inst, "Number of " #OPCODE " insts"); #include "llvm/IR/Instruction.def" namespace { -class InstCount : public InstVisitor<InstCount> { - friend class InstVisitor<InstCount>; +class InstCount : public InstVisitor<InstCount> { + friend class InstVisitor<InstCount>; - void visitFunction(Function &F) { ++TotalFuncs; } - void visitBasicBlock(BasicBlock &BB) { ++TotalBlocks; } + void visitFunction(Function &F) { ++TotalFuncs; } + void visitBasicBlock(BasicBlock &BB) { ++TotalBlocks; } -#define HANDLE_INST(N, OPCODE, CLASS) \ - void visit##OPCODE(CLASS &) { \ - ++Num##OPCODE##Inst; \ - ++TotalInsts; \ - } +#define HANDLE_INST(N, OPCODE, CLASS) \ + void visit##OPCODE(CLASS &) { \ + ++Num##OPCODE##Inst; \ + ++TotalInsts; \ + } #include "llvm/IR/Instruction.def" - void visitInstruction(Instruction &I) { - errs() << "Instruction Count does not know about " << I; - llvm_unreachable(nullptr); - } -}; -} // namespace - -PreservedAnalyses InstCountPass::run(Function &F, - FunctionAnalysisManager &FAM) { - LLVM_DEBUG(dbgs() << "INSTCOUNT: running on function " << F.getName() - << "\n"); - InstCount().visit(F); - - return PreservedAnalyses::all(); -} - -namespace { -class InstCountLegacyPass : public FunctionPass { -public: - static char ID; // Pass identification, replacement for typeid - InstCountLegacyPass() : FunctionPass(ID) { - initializeInstCountLegacyPassPass(*PassRegistry::getPassRegistry()); - } - - bool runOnFunction(Function &F) override { - LLVM_DEBUG(dbgs() << "INSTCOUNT: running on function " << F.getName() - << "\n"); - InstCount().visit(F); - return false; + void visitInstruction(Instruction &I) { + errs() << "Instruction Count does not know about " << I; + llvm_unreachable(nullptr); + } +}; +} // namespace + +PreservedAnalyses InstCountPass::run(Function &F, + FunctionAnalysisManager &FAM) { + LLVM_DEBUG(dbgs() << "INSTCOUNT: running on function " << F.getName() + << "\n"); + InstCount().visit(F); + + return PreservedAnalyses::all(); +} + +namespace { +class InstCountLegacyPass : public FunctionPass { +public: + static char ID; // Pass identification, replacement for typeid + InstCountLegacyPass() : FunctionPass(ID) { + initializeInstCountLegacyPassPass(*PassRegistry::getPassRegistry()); + } + + bool runOnFunction(Function &F) override { + LLVM_DEBUG(dbgs() << "INSTCOUNT: running on function " << F.getName() + << "\n"); + InstCount().visit(F); + return false; }; - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.setPreservesAll(); - } - - void print(raw_ostream &O, const Module *M) const override {} -}; -} // namespace - -char InstCountLegacyPass::ID = 0; -INITIALIZE_PASS(InstCountLegacyPass, "instcount", + void getAnalysisUsage(AnalysisUsage &AU) const override { + AU.setPreservesAll(); + } + + void print(raw_ostream &O, const Module *M) const override {} +}; +} // namespace + +char InstCountLegacyPass::ID = 0; +INITIALIZE_PASS(InstCountLegacyPass, "instcount", "Counts the various types of Instructions", false, true) -FunctionPass *llvm::createInstCountPass() { return new InstCountLegacyPass(); } +FunctionPass *llvm::createInstCountPass() { return new InstCountLegacyPass(); } |