LLVM 20.0.0git
CountVisits.cpp
Go to the documentation of this file.
1//===- CountVisits.cpp ----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "llvm/ADT/Statistic.h"
11#include "llvm/IR/Function.h"
12#include "llvm/IR/PassManager.h"
13
14using namespace llvm;
15
16#define DEBUG_TYPE "count-visits"
17
18STATISTIC(MaxVisited, "Max number of times we visited a function");
19
21 uint32_t Count = Counts[F.getName()] + 1;
22 Counts[F.getName()] = Count;
23 if (Count > MaxVisited)
24 MaxVisited = Count;
26}
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Definition: Statistic.h:166
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: Analysis.h:117
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
PreservedAnalyses run(Function &F, FunctionAnalysisManager &)
Definition: CountVisits.cpp:20