LLVM 22.0.0git
EphemeralValuesCache.h
Go to the documentation of this file.
1//===- llvm/Analysis/EphemeralValuesCache.h ---------------------*- C++ -*-===//
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//
9// This pass caches ephemeral values, i.e., values that are only used by
10// @llvm.assume intrinsics, for cheap access after the initial collection.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_ANALYSIS_EPHEMERALVALUESCACHE_H
15#define LLVM_ANALYSIS_EPHEMERALVALUESCACHE_H
16
18#include "llvm/IR/PassManager.h"
20
21namespace llvm {
22
23class Function;
24class AssumptionCache;
25class Value;
26
27/// A cache of ephemeral values within a function.
30 Function &F;
32 bool Collected = false;
33
34 LLVM_ABI void collectEphemeralValues();
35
36public:
38 void clear() {
39 EphValues.clear();
40 Collected = false;
41 }
43 if (!Collected)
44 collectEphemeralValues();
45 return EphValues;
46 }
47};
48
50 : public AnalysisInfoMixin<EphemeralValuesAnalysis> {
52 LLVM_ABI static AnalysisKey Key;
53
54public:
57};
58
59} // namespace llvm
60
61#endif // LLVM_ANALYSIS_EPHEMERALVALUESCACHE_H
#define LLVM_ABI
Definition: Compiler.h:213
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
FunctionAnalysisManager FAM
This file defines the SmallPtrSet class.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
A cache of @llvm.assume calls within a function.
LLVM_ABI Result run(Function &F, FunctionAnalysisManager &FAM)
A cache of ephemeral values within a function.
const SmallPtrSetImpl< const Value * > & ephValues()
EphemeralValuesCache(Function &F, AssumptionCache &AC)
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:380
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:541
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:93
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:29