LLVM: lib/IR/PassInstrumentation.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
17
18using namespace llvm;
19
23
26 assert(.empty() && "PassName can't be empty!");
27 ClassToPassName.try_emplace(ClassName, PassName.str());
28}
29
32 if (!ClassToPassNameCallbacks.empty()) {
33 for (auto &Fn : ClassToPassNameCallbacks)
34 Fn();
35 ClassToPassNameCallbacks.clear();
36 }
37 auto PassNameIter = ClassToPassName.find(ClassName);
38 if (PassNameIter != ClassToPassName.end())
39 return PassNameIter->second;
40 return {};
41}
42
43AnalysisKey PassInstrumentationAnalysis::Key;
44
46 const std::vector &Specials) {
47 size_t Pos = PassID.find('<');
50 Prefix = PassID.substr(0, Pos);
51 return any_of(Specials,
52 [Prefix](StringRef S) { return Prefix.ends_with(S); });
53}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_EXPORT_TEMPLATE
This header defines various interfaces for pass management in LLVM.
This file defines the Pass Instrumentation classes that provide instrumentation points into the pass ...
static const char PassName[]
LLVM_ABI void addClassToPassName(StringRef ClassName, StringRef PassName)
Add a class name to pass name mapping for use by pass instrumentation.
Definition PassInstrumentation.cpp:24
LLVM_ABI StringRef getPassNameForClassName(StringRef ClassName)
Get the pass name for a given pass class name. Empty if no match found.
Definition PassInstrumentation.cpp:31
StringRef - Represent a constant reference to a string, i.e.
static constexpr size_t npos
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
This is an optimization pass for GlobalISel generic memory operations.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI bool isSpecialPass(StringRef PassID, const std::vector< StringRef > &Specials)
Definition PassInstrumentation.cpp:45
A special type used by analysis passes to provide an address that identifies that particular analysis...