StandardInstrumentations.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- StandardInstrumentations.h ------------------------------*- C++ -*--===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. ///
  15. /// This header defines a class that provides bookkeeping for all standard
  16. /// (i.e in-tree) pass instrumentations.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_PASSES_STANDARDINSTRUMENTATIONS_H
  20. #define LLVM_PASSES_STANDARDINSTRUMENTATIONS_H
  21. #include "llvm/ADT/STLExtras.h"
  22. #include "llvm/ADT/SmallVector.h"
  23. #include "llvm/ADT/StringRef.h"
  24. #include "llvm/IR/BasicBlock.h"
  25. #include "llvm/IR/OptBisect.h"
  26. #include "llvm/IR/PassTimingInfo.h"
  27. #include "llvm/IR/ValueHandle.h"
  28. #include "llvm/Support/CommandLine.h"
  29. #include "llvm/Support/TimeProfiler.h"
  30. #include "llvm/Transforms/IPO/SampleProfileProbe.h"
  31. #include <string>
  32. #include <utility>
  33. namespace llvm {
  34. class Module;
  35. class Function;
  36. class PassInstrumentationCallbacks;
  37. /// Instrumentation to print IR before/after passes.
  38. ///
  39. /// Needs state to be able to print module after pass that invalidates IR unit
  40. /// (typically Loop or SCC).
  41. class PrintIRInstrumentation {
  42. public:
  43. ~PrintIRInstrumentation();
  44. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  45. private:
  46. void printBeforePass(StringRef PassID, Any IR);
  47. void printAfterPass(StringRef PassID, Any IR);
  48. void printAfterPassInvalidated(StringRef PassID);
  49. bool shouldPrintBeforePass(StringRef PassID);
  50. bool shouldPrintAfterPass(StringRef PassID);
  51. using PrintModuleDesc = std::tuple<const Module *, std::string, StringRef>;
  52. void pushModuleDesc(StringRef PassID, Any IR);
  53. PrintModuleDesc popModuleDesc(StringRef PassID);
  54. PassInstrumentationCallbacks *PIC;
  55. /// Stack of Module description, enough to print the module after a given
  56. /// pass.
  57. SmallVector<PrintModuleDesc, 2> ModuleDescStack;
  58. };
  59. class OptNoneInstrumentation {
  60. public:
  61. OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
  62. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  63. private:
  64. bool DebugLogging;
  65. bool shouldRun(StringRef PassID, Any IR);
  66. };
  67. class OptPassGateInstrumentation {
  68. LLVMContext &Context;
  69. bool HasWrittenIR = false;
  70. public:
  71. OptPassGateInstrumentation(LLVMContext &Context) : Context(Context) {}
  72. bool shouldRun(StringRef PassName, Any IR);
  73. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  74. };
  75. struct PrintPassOptions {
  76. /// Print adaptors and pass managers.
  77. bool Verbose = false;
  78. /// Don't print information for analyses.
  79. bool SkipAnalyses = false;
  80. /// Indent based on hierarchy.
  81. bool Indent = false;
  82. };
  83. // Debug logging for transformation and analysis passes.
  84. class PrintPassInstrumentation {
  85. raw_ostream &print();
  86. public:
  87. PrintPassInstrumentation(bool Enabled, PrintPassOptions Opts)
  88. : Enabled(Enabled), Opts(Opts) {}
  89. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  90. private:
  91. bool Enabled;
  92. PrintPassOptions Opts;
  93. int Indent = 0;
  94. };
  95. class PreservedCFGCheckerInstrumentation {
  96. public:
  97. // Keeps sticky poisoned flag for the given basic block once it has been
  98. // deleted or RAUWed.
  99. struct BBGuard final : public CallbackVH {
  100. BBGuard(const BasicBlock *BB) : CallbackVH(BB) {}
  101. void deleted() override { CallbackVH::deleted(); }
  102. void allUsesReplacedWith(Value *) override { CallbackVH::deleted(); }
  103. bool isPoisoned() const { return !getValPtr(); }
  104. };
  105. // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic
  106. // block, {(Succ, Multiplicity)} set of all pairs of the block's successors
  107. // and the multiplicity of the edge (BB->Succ). As the mapped sets are
  108. // unordered the order of successors is not tracked by the CFG. In other words
  109. // this allows basic block successors to be swapped by a pass without
  110. // reporting a CFG change. CFG can be guarded by basic block tracking pointers
  111. // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
  112. // then the CFG is treated poisoned and no block pointer of the Graph is used.
  113. struct CFG {
  114. std::optional<DenseMap<intptr_t, BBGuard>> BBGuards;
  115. DenseMap<const BasicBlock *, DenseMap<const BasicBlock *, unsigned>> Graph;
  116. CFG(const Function *F, bool TrackBBLifetime);
  117. bool operator==(const CFG &G) const {
  118. return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph;
  119. }
  120. bool isPoisoned() const {
  121. return BBGuards && llvm::any_of(*BBGuards, [](const auto &BB) {
  122. return BB.second.isPoisoned();
  123. });
  124. }
  125. static void printDiff(raw_ostream &out, const CFG &Before,
  126. const CFG &After);
  127. bool invalidate(Function &F, const PreservedAnalyses &PA,
  128. FunctionAnalysisManager::Invalidator &);
  129. };
  130. #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
  131. SmallVector<StringRef, 8> PassStack;
  132. #endif
  133. static cl::opt<bool> VerifyPreservedCFG;
  134. void registerCallbacks(PassInstrumentationCallbacks &PIC,
  135. FunctionAnalysisManager &FAM);
  136. };
  137. // Base class for classes that report changes to the IR.
  138. // It presents an interface for such classes and provides calls
  139. // on various events as the new pass manager transforms the IR.
  140. // It also provides filtering of information based on hidden options
  141. // specifying which functions are interesting.
  142. // Calls are made for the following events/queries:
  143. // 1. The initial IR processed.
  144. // 2. To get the representation of the IR (of type \p T).
  145. // 3. When a pass does not change the IR.
  146. // 4. When a pass changes the IR (given both before and after representations
  147. // of type \p T).
  148. // 5. When an IR is invalidated.
  149. // 6. When a pass is run on an IR that is not interesting (based on options).
  150. // 7. When a pass is ignored (pass manager or adapter pass).
  151. // 8. To compare two IR representations (of type \p T).
  152. template <typename IRUnitT> class ChangeReporter {
  153. protected:
  154. ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
  155. public:
  156. virtual ~ChangeReporter();
  157. // Determine if this pass/IR is interesting and if so, save the IR
  158. // otherwise it is left on the stack without data.
  159. void saveIRBeforePass(Any IR, StringRef PassID, StringRef PassName);
  160. // Compare the IR from before the pass after the pass.
  161. void handleIRAfterPass(Any IR, StringRef PassID, StringRef PassName);
  162. // Handle the situation where a pass is invalidated.
  163. void handleInvalidatedPass(StringRef PassID);
  164. protected:
  165. // Register required callbacks.
  166. void registerRequiredCallbacks(PassInstrumentationCallbacks &PIC);
  167. // Called on the first IR processed.
  168. virtual void handleInitialIR(Any IR) = 0;
  169. // Called before and after a pass to get the representation of the IR.
  170. virtual void generateIRRepresentation(Any IR, StringRef PassID,
  171. IRUnitT &Output) = 0;
  172. // Called when the pass is not iteresting.
  173. virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
  174. // Called when an interesting IR has changed.
  175. virtual void handleAfter(StringRef PassID, std::string &Name,
  176. const IRUnitT &Before, const IRUnitT &After,
  177. Any) = 0;
  178. // Called when an interesting pass is invalidated.
  179. virtual void handleInvalidated(StringRef PassID) = 0;
  180. // Called when the IR or pass is not interesting.
  181. virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
  182. // Called when an ignored pass is encountered.
  183. virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
  184. // Stack of IRs before passes.
  185. std::vector<IRUnitT> BeforeStack;
  186. // Is this the first IR seen?
  187. bool InitialIR = true;
  188. // Run in verbose mode, printing everything?
  189. const bool VerboseMode;
  190. };
  191. // An abstract template base class that handles printing banners and
  192. // reporting when things have not changed or are filtered out.
  193. template <typename IRUnitT>
  194. class TextChangeReporter : public ChangeReporter<IRUnitT> {
  195. protected:
  196. TextChangeReporter(bool Verbose);
  197. // Print a module dump of the first IR that is changed.
  198. void handleInitialIR(Any IR) override;
  199. // Report that the IR was omitted because it did not change.
  200. void omitAfter(StringRef PassID, std::string &Name) override;
  201. // Report that the pass was invalidated.
  202. void handleInvalidated(StringRef PassID) override;
  203. // Report that the IR was filtered out.
  204. void handleFiltered(StringRef PassID, std::string &Name) override;
  205. // Report that the pass was ignored.
  206. void handleIgnored(StringRef PassID, std::string &Name) override;
  207. // Make substitutions in \p S suitable for reporting changes
  208. // after the pass and then print it.
  209. raw_ostream &Out;
  210. };
  211. // A change printer based on the string representation of the IR as created
  212. // by unwrapAndPrint. The string representation is stored in a std::string
  213. // to preserve it as the IR changes in each pass. Note that the banner is
  214. // included in this representation but it is massaged before reporting.
  215. class IRChangedPrinter : public TextChangeReporter<std::string> {
  216. public:
  217. IRChangedPrinter(bool VerboseMode)
  218. : TextChangeReporter<std::string>(VerboseMode) {}
  219. ~IRChangedPrinter() override;
  220. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  221. protected:
  222. // Called before and after a pass to get the representation of the IR.
  223. void generateIRRepresentation(Any IR, StringRef PassID,
  224. std::string &Output) override;
  225. // Called when an interesting IR has changed.
  226. void handleAfter(StringRef PassID, std::string &Name,
  227. const std::string &Before, const std::string &After,
  228. Any) override;
  229. };
  230. class IRChangedTester : public IRChangedPrinter {
  231. public:
  232. IRChangedTester() : IRChangedPrinter(true) {}
  233. ~IRChangedTester() override;
  234. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  235. protected:
  236. void handleIR(const std::string &IR, StringRef PassID);
  237. // Check initial IR
  238. void handleInitialIR(Any IR) override;
  239. // Do nothing.
  240. void omitAfter(StringRef PassID, std::string &Name) override;
  241. // Do nothing.
  242. void handleInvalidated(StringRef PassID) override;
  243. // Do nothing.
  244. void handleFiltered(StringRef PassID, std::string &Name) override;
  245. // Do nothing.
  246. void handleIgnored(StringRef PassID, std::string &Name) override;
  247. // Call test as interesting IR has changed.
  248. void handleAfter(StringRef PassID, std::string &Name,
  249. const std::string &Before, const std::string &After,
  250. Any) override;
  251. };
  252. // Information that needs to be saved for a basic block in order to compare
  253. // before and after the pass to determine if it was changed by a pass.
  254. template <typename T> class BlockDataT {
  255. public:
  256. BlockDataT(const BasicBlock &B) : Label(B.getName().str()), Data(B) {
  257. raw_string_ostream SS(Body);
  258. B.print(SS, nullptr, true, true);
  259. }
  260. bool operator==(const BlockDataT &That) const { return Body == That.Body; }
  261. bool operator!=(const BlockDataT &That) const { return Body != That.Body; }
  262. // Return the label of the represented basic block.
  263. StringRef getLabel() const { return Label; }
  264. // Return the string representation of the basic block.
  265. StringRef getBody() const { return Body; }
  266. // Return the associated data
  267. const T &getData() const { return Data; }
  268. protected:
  269. std::string Label;
  270. std::string Body;
  271. // Extra data associated with a basic block
  272. T Data;
  273. };
  274. template <typename T> class OrderedChangedData {
  275. public:
  276. // Return the names in the order they were saved
  277. std::vector<std::string> &getOrder() { return Order; }
  278. const std::vector<std::string> &getOrder() const { return Order; }
  279. // Return a map of names to saved representations
  280. StringMap<T> &getData() { return Data; }
  281. const StringMap<T> &getData() const { return Data; }
  282. bool operator==(const OrderedChangedData<T> &That) const {
  283. return Data == That.getData();
  284. }
  285. // Call the lambda \p HandlePair on each corresponding pair of data from
  286. // \p Before and \p After. The order is based on the order in \p After
  287. // with ones that are only in \p Before interspersed based on where they
  288. // occur in \p Before. This is used to present the output in an order
  289. // based on how the data is ordered in LLVM.
  290. static void report(const OrderedChangedData &Before,
  291. const OrderedChangedData &After,
  292. function_ref<void(const T *, const T *)> HandlePair);
  293. protected:
  294. std::vector<std::string> Order;
  295. StringMap<T> Data;
  296. };
  297. // Do not need extra information for patch-style change reporter.
  298. class EmptyData {
  299. public:
  300. EmptyData(const BasicBlock &) {}
  301. };
  302. // The data saved for comparing functions.
  303. template <typename T>
  304. class FuncDataT : public OrderedChangedData<BlockDataT<T>> {
  305. public:
  306. FuncDataT(std::string S) : EntryBlockName(S) {}
  307. // Return the name of the entry block
  308. std::string getEntryBlockName() const { return EntryBlockName; }
  309. protected:
  310. std::string EntryBlockName;
  311. };
  312. // The data saved for comparing IRs.
  313. template <typename T>
  314. class IRDataT : public OrderedChangedData<FuncDataT<T>> {};
  315. // Abstract template base class for a class that compares two IRs. The
  316. // class is created with the 2 IRs to compare and then compare is called.
  317. // The static function analyzeIR is used to build up the IR representation.
  318. template <typename T> class IRComparer {
  319. public:
  320. IRComparer(const IRDataT<T> &Before, const IRDataT<T> &After)
  321. : Before(Before), After(After) {}
  322. // Compare the 2 IRs. \p handleFunctionCompare is called to handle the
  323. // compare of a function. When \p InModule is set,
  324. // this function is being handled as part of comparing a module.
  325. void compare(
  326. bool CompareModule,
  327. std::function<void(bool InModule, unsigned Minor,
  328. const FuncDataT<T> &Before, const FuncDataT<T> &After)>
  329. CompareFunc);
  330. // Analyze \p IR and build the IR representation in \p Data.
  331. static void analyzeIR(Any IR, IRDataT<T> &Data);
  332. protected:
  333. // Generate the data for \p F into \p Data.
  334. static bool generateFunctionData(IRDataT<T> &Data, const Function &F);
  335. const IRDataT<T> &Before;
  336. const IRDataT<T> &After;
  337. };
  338. // A change printer that prints out in-line differences in the basic
  339. // blocks. It uses an InlineComparer to do the comparison so it shows
  340. // the differences prefixed with '-' and '+' for code that is removed
  341. // and added, respectively. Changes to the IR that do not affect basic
  342. // blocks are not reported as having changed the IR. The option
  343. // -print-module-scope does not affect this change reporter.
  344. class InLineChangePrinter : public TextChangeReporter<IRDataT<EmptyData>> {
  345. public:
  346. InLineChangePrinter(bool VerboseMode, bool ColourMode)
  347. : TextChangeReporter<IRDataT<EmptyData>>(VerboseMode),
  348. UseColour(ColourMode) {}
  349. ~InLineChangePrinter() override;
  350. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  351. protected:
  352. // Create a representation of the IR.
  353. void generateIRRepresentation(Any IR, StringRef PassID,
  354. IRDataT<EmptyData> &Output) override;
  355. // Called when an interesting IR has changed.
  356. void handleAfter(StringRef PassID, std::string &Name,
  357. const IRDataT<EmptyData> &Before,
  358. const IRDataT<EmptyData> &After, Any) override;
  359. void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID,
  360. StringRef Divider, bool InModule, unsigned Minor,
  361. const FuncDataT<EmptyData> &Before,
  362. const FuncDataT<EmptyData> &After);
  363. bool UseColour;
  364. };
  365. class VerifyInstrumentation {
  366. bool DebugLogging;
  367. public:
  368. VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
  369. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  370. };
  371. /// This class implements --time-trace functionality for new pass manager.
  372. /// It provides the pass-instrumentation callbacks that measure the pass
  373. /// execution time. They collect time tracing info by TimeProfiler.
  374. class TimeProfilingPassesHandler {
  375. public:
  376. TimeProfilingPassesHandler();
  377. // We intend this to be unique per-compilation, thus no copies.
  378. TimeProfilingPassesHandler(const TimeProfilingPassesHandler &) = delete;
  379. void operator=(const TimeProfilingPassesHandler &) = delete;
  380. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  381. private:
  382. // Implementation of pass instrumentation callbacks.
  383. void runBeforePass(StringRef PassID, Any IR);
  384. void runAfterPass();
  385. };
  386. // Class that holds transitions between basic blocks. The transitions
  387. // are contained in a map of values to names of basic blocks.
  388. class DCData {
  389. public:
  390. // Fill the map with the transitions from basic block \p B.
  391. DCData(const BasicBlock &B);
  392. // Return an iterator to the names of the successor blocks.
  393. StringMap<std::string>::const_iterator begin() const {
  394. return Successors.begin();
  395. }
  396. StringMap<std::string>::const_iterator end() const {
  397. return Successors.end();
  398. }
  399. // Return the label of the basic block reached on a transition on \p S.
  400. StringRef getSuccessorLabel(StringRef S) const {
  401. assert(Successors.count(S) == 1 && "Expected to find successor.");
  402. return Successors.find(S)->getValue();
  403. }
  404. protected:
  405. // Add a transition to \p Succ on \p Label
  406. void addSuccessorLabel(StringRef Succ, StringRef Label) {
  407. std::pair<std::string, std::string> SS{Succ.str(), Label.str()};
  408. Successors.insert(SS);
  409. }
  410. StringMap<std::string> Successors;
  411. };
  412. // A change reporter that builds a website with links to pdf files showing
  413. // dot control flow graphs with changed instructions shown in colour.
  414. class DotCfgChangeReporter : public ChangeReporter<IRDataT<DCData>> {
  415. public:
  416. DotCfgChangeReporter(bool Verbose);
  417. ~DotCfgChangeReporter() override;
  418. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  419. protected:
  420. // Initialize the HTML file and output the header.
  421. bool initializeHTML();
  422. // Called on the first IR processed.
  423. void handleInitialIR(Any IR) override;
  424. // Called before and after a pass to get the representation of the IR.
  425. void generateIRRepresentation(Any IR, StringRef PassID,
  426. IRDataT<DCData> &Output) override;
  427. // Called when the pass is not iteresting.
  428. void omitAfter(StringRef PassID, std::string &Name) override;
  429. // Called when an interesting IR has changed.
  430. void handleAfter(StringRef PassID, std::string &Name,
  431. const IRDataT<DCData> &Before, const IRDataT<DCData> &After,
  432. Any) override;
  433. // Called when an interesting pass is invalidated.
  434. void handleInvalidated(StringRef PassID) override;
  435. // Called when the IR or pass is not interesting.
  436. void handleFiltered(StringRef PassID, std::string &Name) override;
  437. // Called when an ignored pass is encountered.
  438. void handleIgnored(StringRef PassID, std::string &Name) override;
  439. // Generate the pdf file into \p Dir / \p PDFFileName using \p DotFile as
  440. // input and return the html <a> tag with \Text as the content.
  441. static std::string genHTML(StringRef Text, StringRef DotFile,
  442. StringRef PDFFileName);
  443. void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID,
  444. StringRef Divider, bool InModule, unsigned Minor,
  445. const FuncDataT<DCData> &Before,
  446. const FuncDataT<DCData> &After);
  447. unsigned N = 0;
  448. std::unique_ptr<raw_fd_ostream> HTML;
  449. };
  450. // Print IR on crash.
  451. class PrintCrashIRInstrumentation {
  452. public:
  453. PrintCrashIRInstrumentation()
  454. : SavedIR("*** Dump of IR Before Last Pass Unknown ***") {}
  455. ~PrintCrashIRInstrumentation();
  456. void registerCallbacks(PassInstrumentationCallbacks &PIC);
  457. void reportCrashIR();
  458. protected:
  459. std::string SavedIR;
  460. private:
  461. // The crash reporter that will report on a crash.
  462. static PrintCrashIRInstrumentation *CrashReporter;
  463. // Crash handler registered when print-on-crash is specified.
  464. static void SignalHandler(void *);
  465. };
  466. /// This class provides an interface to register all the standard pass
  467. /// instrumentations and manages their state (if any).
  468. class StandardInstrumentations {
  469. PrintIRInstrumentation PrintIR;
  470. PrintPassInstrumentation PrintPass;
  471. TimePassesHandler TimePasses;
  472. TimeProfilingPassesHandler TimeProfilingPasses;
  473. OptNoneInstrumentation OptNone;
  474. OptPassGateInstrumentation OptPassGate;
  475. PreservedCFGCheckerInstrumentation PreservedCFGChecker;
  476. IRChangedPrinter PrintChangedIR;
  477. PseudoProbeVerifier PseudoProbeVerification;
  478. InLineChangePrinter PrintChangedDiff;
  479. DotCfgChangeReporter WebsiteChangeReporter;
  480. PrintCrashIRInstrumentation PrintCrashIR;
  481. IRChangedTester ChangeTester;
  482. VerifyInstrumentation Verify;
  483. bool VerifyEach;
  484. public:
  485. StandardInstrumentations(LLVMContext &Context, bool DebugLogging,
  486. bool VerifyEach = false,
  487. PrintPassOptions PrintPassOpts = PrintPassOptions());
  488. // Register all the standard instrumentation callbacks. If \p FAM is nullptr
  489. // then PreservedCFGChecker is not enabled.
  490. void registerCallbacks(PassInstrumentationCallbacks &PIC,
  491. FunctionAnalysisManager *FAM = nullptr);
  492. TimePassesHandler &getTimePasses() { return TimePasses; }
  493. };
  494. extern template class ChangeReporter<std::string>;
  495. extern template class TextChangeReporter<std::string>;
  496. extern template class BlockDataT<EmptyData>;
  497. extern template class FuncDataT<EmptyData>;
  498. extern template class IRDataT<EmptyData>;
  499. extern template class ChangeReporter<IRDataT<EmptyData>>;
  500. extern template class TextChangeReporter<IRDataT<EmptyData>>;
  501. extern template class IRComparer<EmptyData>;
  502. } // namespace llvm
  503. #endif
  504. #ifdef __GNUC__
  505. #pragma GCC diagnostic pop
  506. #endif