Fedor Sergeev | ee8d31c | 2018-09-20 17:08:45 +0000 | [diff] [blame] | 1 | //===- PassInstrumentation.cpp - Pass Instrumentation interface -*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Fedor Sergeev | ee8d31c | 2018-09-20 17:08:45 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// \file |
| 9 | /// |
| 10 | /// This file provides the implementation of PassInstrumentation class. |
| 11 | /// |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/IR/PassInstrumentation.h" |
Yuanfang Chen | 555cf42 | 2020-07-28 17:08:24 -0700 | [diff] [blame] | 15 | #include "llvm/ADT/STLExtras.h" |
Fedor Sergeev | ee8d31c | 2018-09-20 17:08:45 +0000 | [diff] [blame] | 16 | #include "llvm/IR/PassManager.h" |
| 17 | |
| 18 | namespace llvm { |
| 19 | |
| 20 | AnalysisKey PassInstrumentationAnalysis::Key; |
| 21 | |
Yuanfang Chen | 555cf42 | 2020-07-28 17:08:24 -0700 | [diff] [blame] | 22 | bool isSpecialPass(StringRef PassID, const std::vector<StringRef> &Specials) { |
| 23 | size_t Pos = PassID.find('<'); |
| 24 | if (Pos == StringRef::npos) |
| 25 | return false; |
| 26 | StringRef Prefix = PassID.substr(0, Pos); |
| 27 | return any_of(Specials, [Prefix](StringRef S) { return Prefix.endswith(S); }); |
| 28 | } |
| 29 | |
Fedor Sergeev | ee8d31c | 2018-09-20 17:08:45 +0000 | [diff] [blame] | 30 | } // namespace llvm |