Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
PassInstrumentation.cpp
Go to the documentation of this file.
1//===- PassInstrumentation.cpp - Pass Instrumentation interface -*- 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/// \file
9///
10/// This file provides the implementation of PassInstrumentation class.
11///
12//===----------------------------------------------------------------------===//
13
14#include "llvm/IR/PassInstrumentation.h"
15#include "llvm/ADT/STLExtras.h"
16#include "llvm/IR/PassManager.h"
17
18namespacellvm {
19
20templatestructLLVM_EXPORT_TEMPLATE Any::TypeId<const Module *>;
21templatestructLLVM_EXPORT_TEMPLATE Any::TypeId<const Function *>;
22templatestructLLVM_EXPORT_TEMPLATE Any::TypeId<const Loop *>;
23
24voidPassInstrumentationCallbacks::addClassToPassName(StringRef ClassName,
25StringRefPassName) {
26 ClassToPassName.try_emplace(ClassName,PassName.str());
27}
28
29StringRef
30PassInstrumentationCallbacks::getPassNameForClassName(StringRef ClassName) {
31if (!ClassToPassNameCallbacks.empty()) {
32for (auto &Fn : ClassToPassNameCallbacks)
33 Fn();
34 ClassToPassNameCallbacks.clear();
35 }
36return ClassToPassName[ClassName];
37}
38
39AnalysisKey PassInstrumentationAnalysis::Key;
40
41boolisSpecialPass(StringRef PassID,const std::vector<StringRef> &Specials) {
42size_t Pos = PassID.find('<');
43StringRef Prefix = PassID;
44if (Pos !=StringRef::npos)
45 Prefix = PassID.substr(0, Pos);
46returnany_of(Specials,
47 [Prefix](StringRef S) {return Prefix.ends_with(S); });
48}
49
50}// namespace llvm
PassManager.h
This header defines various interfaces for pass management in LLVM.
PassInstrumentation.h
This file defines the Pass Instrumentation classes that provide instrumentation points into the pass ...
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
PassName
static const char PassName[]
Definition:X86LowerAMXIntrinsics.cpp:666
llvm::SmallVectorBase::empty
bool empty() const
Definition:SmallVector.h:81
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::substr
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition:StringRef.h:571
llvm::StringRef::find
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Definition:StringRef.h:297
llvm::StringRef::npos
static constexpr size_t npos
Definition:StringRef.h:53
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1746
llvm::isSpecialPass
bool isSpecialPass(StringRef PassID, const std::vector< StringRef > &Specials)
Definition:PassInstrumentation.cpp:41
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition:Analysis.h:28
llvm::PassInstrumentationCallbacks::getPassNameForClassName
StringRef getPassNameForClassName(StringRef ClassName)
Get the pass name for a given pass class name.
Definition:PassInstrumentation.cpp:30
llvm::PassInstrumentationCallbacks::addClassToPassName
void addClassToPassName(StringRef ClassName, StringRef PassName)
Add a class name to pass name mapping for use by pass instrumentation.
Definition:PassInstrumentation.cpp:24

Generated on Sun Jul 20 2025 09:42:10 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp