LLVM 17.0.0git
StandardInstrumentations.h
Go to the documentation of this file.
1//===- StandardInstrumentations.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/// \file
9///
10/// This header defines a class that provides bookkeeping for all standard
11/// (i.e in-tree) pass instrumentations.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_PASSES_STANDARDINSTRUMENTATIONS_H
16#define LLVM_PASSES_STANDARDINSTRUMENTATIONS_H
17
18#include "llvm/ADT/STLExtras.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/IR/BasicBlock.h"
22#include "llvm/IR/OptBisect.h"
24#include "llvm/IR/ValueHandle.h"
28
29#include <string>
30#include <utility>
31
32namespace llvm {
33
34class Module;
35class Function;
36class PassInstrumentationCallbacks;
37
38/// Instrumentation to print IR before/after passes.
39///
40/// Needs state to be able to print module after pass that invalidates IR unit
41/// (typically Loop or SCC).
43public:
45
47
48private:
49 void printBeforePass(StringRef PassID, Any IR);
50 void printAfterPass(StringRef PassID, Any IR);
51 void printAfterPassInvalidated(StringRef PassID);
52
53 bool shouldPrintBeforePass(StringRef PassID);
54 bool shouldPrintAfterPass(StringRef PassID);
55
56 using PrintModuleDesc = std::tuple<const Module *, std::string, StringRef>;
57
58 void pushModuleDesc(StringRef PassID, Any IR);
59 PrintModuleDesc popModuleDesc(StringRef PassID);
60
62 /// Stack of Module description, enough to print the module after a given
63 /// pass.
64 SmallVector<PrintModuleDesc, 2> ModuleDescStack;
65};
66
68public:
69 OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
71
72private:
73 bool DebugLogging;
74 bool shouldRun(StringRef PassID, Any IR);
75};
76
78 LLVMContext &Context;
79 bool HasWrittenIR = false;
80public:
84};
85
87 /// Print adaptors and pass managers.
88 bool Verbose = false;
89 /// Don't print information for analyses.
90 bool SkipAnalyses = false;
91 /// Indent based on hierarchy.
92 bool Indent = false;
93};
94
95// Debug logging for transformation and analysis passes.
97 raw_ostream &print();
98
99public:
101 : Enabled(Enabled), Opts(Opts) {}
103
104private:
105 bool Enabled;
106 PrintPassOptions Opts;
107 int Indent = 0;
108};
109
111public:
112 // Keeps sticky poisoned flag for the given basic block once it has been
113 // deleted or RAUWed.
114 struct BBGuard final : public CallbackVH {
115 BBGuard(const BasicBlock *BB) : CallbackVH(BB) {}
116 void deleted() override { CallbackVH::deleted(); }
118 bool isPoisoned() const { return !getValPtr(); }
119 };
120
121 // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic
122 // block, {(Succ, Multiplicity)} set of all pairs of the block's successors
123 // and the multiplicity of the edge (BB->Succ). As the mapped sets are
124 // unordered the order of successors is not tracked by the CFG. In other words
125 // this allows basic block successors to be swapped by a pass without
126 // reporting a CFG change. CFG can be guarded by basic block tracking pointers
127 // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
128 // then the CFG is treated poisoned and no block pointer of the Graph is used.
129 struct CFG {
130 std::optional<DenseMap<intptr_t, BBGuard>> BBGuards;
132
133 CFG(const Function *F, bool TrackBBLifetime);
134
135 bool operator==(const CFG &G) const {
136 return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph;
137 }
138
139 bool isPoisoned() const {
140 return BBGuards && llvm::any_of(*BBGuards, [](const auto &BB) {
141 return BB.second.isPoisoned();
142 });
143 }
144
145 static void printDiff(raw_ostream &out, const CFG &Before,
146 const CFG &After);
147 bool invalidate(Function &F, const PreservedAnalyses &PA,
149 };
150
151#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
153#endif
154
157};
158
159// Base class for classes that report changes to the IR.
160// It presents an interface for such classes and provides calls
161// on various events as the new pass manager transforms the IR.
162// It also provides filtering of information based on hidden options
163// specifying which functions are interesting.
164// Calls are made for the following events/queries:
165// 1. The initial IR processed.
166// 2. To get the representation of the IR (of type \p T).
167// 3. When a pass does not change the IR.
168// 4. When a pass changes the IR (given both before and after representations
169// of type \p T).
170// 5. When an IR is invalidated.
171// 6. When a pass is run on an IR that is not interesting (based on options).
172// 7. When a pass is ignored (pass manager or adapter pass).
173// 8. To compare two IR representations (of type \p T).
174template <typename IRUnitT> class ChangeReporter {
175protected:
176 ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
177
178public:
179 virtual ~ChangeReporter();
180
181 // Determine if this pass/IR is interesting and if so, save the IR
182 // otherwise it is left on the stack without data.
184 // Compare the IR from before the pass after the pass.
186 // Handle the situation where a pass is invalidated.
187 void handleInvalidatedPass(StringRef PassID);
188
189protected:
190 // Register required callbacks.
192
193 // Called on the first IR processed.
194 virtual void handleInitialIR(Any IR) = 0;
195 // Called before and after a pass to get the representation of the IR.
197 IRUnitT &Output) = 0;
198 // Called when the pass is not iteresting.
199 virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
200 // Called when an interesting IR has changed.
201 virtual void handleAfter(StringRef PassID, std::string &Name,
202 const IRUnitT &Before, const IRUnitT &After,
203 Any) = 0;
204 // Called when an interesting pass is invalidated.
205 virtual void handleInvalidated(StringRef PassID) = 0;
206 // Called when the IR or pass is not interesting.
207 virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
208 // Called when an ignored pass is encountered.
209 virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
210
211 // Stack of IRs before passes.
212 std::vector<IRUnitT> BeforeStack;
213 // Is this the first IR seen?
214 bool InitialIR = true;
215
216 // Run in verbose mode, printing everything?
217 const bool VerboseMode;
218};
219
220// An abstract template base class that handles printing banners and
221// reporting when things have not changed or are filtered out.
222template <typename IRUnitT>
223class TextChangeReporter : public ChangeReporter<IRUnitT> {
224protected:
226
227 // Print a module dump of the first IR that is changed.
228 void handleInitialIR(Any IR) override;
229 // Report that the IR was omitted because it did not change.
230 void omitAfter(StringRef PassID, std::string &Name) override;
231 // Report that the pass was invalidated.
232 void handleInvalidated(StringRef PassID) override;
233 // Report that the IR was filtered out.
234 void handleFiltered(StringRef PassID, std::string &Name) override;
235 // Report that the pass was ignored.
236 void handleIgnored(StringRef PassID, std::string &Name) override;
237 // Make substitutions in \p S suitable for reporting changes
238 // after the pass and then print it.
239
241};
242
243// A change printer based on the string representation of the IR as created
244// by unwrapAndPrint. The string representation is stored in a std::string
245// to preserve it as the IR changes in each pass. Note that the banner is
246// included in this representation but it is massaged before reporting.
247class IRChangedPrinter : public TextChangeReporter<std::string> {
248public:
253
254protected:
255 // Called before and after a pass to get the representation of the IR.
257 std::string &Output) override;
258 // Called when an interesting IR has changed.
259 void handleAfter(StringRef PassID, std::string &Name,
260 const std::string &Before, const std::string &After,
261 Any) override;
262};
263
265public:
267 ~IRChangedTester() override;
269
270protected:
271 void handleIR(const std::string &IR, StringRef PassID);
272
273 // Check initial IR
274 void handleInitialIR(Any IR) override;
275 // Do nothing.
276 void omitAfter(StringRef PassID, std::string &Name) override;
277 // Do nothing.
278 void handleInvalidated(StringRef PassID) override;
279 // Do nothing.
280 void handleFiltered(StringRef PassID, std::string &Name) override;
281 // Do nothing.
282 void handleIgnored(StringRef PassID, std::string &Name) override;
283
284 // Call test as interesting IR has changed.
285 void handleAfter(StringRef PassID, std::string &Name,
286 const std::string &Before, const std::string &After,
287 Any) override;
288};
289
290// Information that needs to be saved for a basic block in order to compare
291// before and after the pass to determine if it was changed by a pass.
292template <typename T> class BlockDataT {
293public:
294 BlockDataT(const BasicBlock &B) : Label(B.getName().str()), Data(B) {
296 B.print(SS, nullptr, true, true);
297 }
298
299 bool operator==(const BlockDataT &That) const { return Body == That.Body; }
300 bool operator!=(const BlockDataT &That) const { return Body != That.Body; }
301
302 // Return the label of the represented basic block.
303 StringRef getLabel() const { return Label; }
304 // Return the string representation of the basic block.
305 StringRef getBody() const { return Body; }
306
307 // Return the associated data
308 const T &getData() const { return Data; }
309
310protected:
311 std::string Label;
312 std::string Body;
313
314 // Extra data associated with a basic block
316};
317
318template <typename T> class OrderedChangedData {
319public:
320 // Return the names in the order they were saved
321 std::vector<std::string> &getOrder() { return Order; }
322 const std::vector<std::string> &getOrder() const { return Order; }
323
324 // Return a map of names to saved representations
325 StringMap<T> &getData() { return Data; }
326 const StringMap<T> &getData() const { return Data; }
327
328 bool operator==(const OrderedChangedData<T> &That) const {
329 return Data == That.getData();
330 }
331
332 // Call the lambda \p HandlePair on each corresponding pair of data from
333 // \p Before and \p After. The order is based on the order in \p After
334 // with ones that are only in \p Before interspersed based on where they
335 // occur in \p Before. This is used to present the output in an order
336 // based on how the data is ordered in LLVM.
337 static void report(const OrderedChangedData &Before,
338 const OrderedChangedData &After,
339 function_ref<void(const T *, const T *)> HandlePair);
340
341protected:
342 std::vector<std::string> Order;
344};
345
346// Do not need extra information for patch-style change reporter.
348public:
350};
351
352// The data saved for comparing functions.
353template <typename T>
354class FuncDataT : public OrderedChangedData<BlockDataT<T>> {
355public:
356 FuncDataT(std::string S) : EntryBlockName(S) {}
357
358 // Return the name of the entry block
359 std::string getEntryBlockName() const { return EntryBlockName; }
360
361protected:
362 std::string EntryBlockName;
363};
364
365// The data saved for comparing IRs.
366template <typename T>
367class IRDataT : public OrderedChangedData<FuncDataT<T>> {};
368
369// Abstract template base class for a class that compares two IRs. The
370// class is created with the 2 IRs to compare and then compare is called.
371// The static function analyzeIR is used to build up the IR representation.
372template <typename T> class IRComparer {
373public:
375 : Before(Before), After(After) {}
376
377 // Compare the 2 IRs. \p handleFunctionCompare is called to handle the
378 // compare of a function. When \p InModule is set,
379 // this function is being handled as part of comparing a module.
380 void compare(
381 bool CompareModule,
382 std::function<void(bool InModule, unsigned Minor,
383 const FuncDataT<T> &Before, const FuncDataT<T> &After)>
384 CompareFunc);
385
386 // Analyze \p IR and build the IR representation in \p Data.
387 static void analyzeIR(Any IR, IRDataT<T> &Data);
388
389protected:
390 // Generate the data for \p F into \p Data.
391 static bool generateFunctionData(IRDataT<T> &Data, const Function &F);
392
395};
396
397// A change printer that prints out in-line differences in the basic
398// blocks. It uses an InlineComparer to do the comparison so it shows
399// the differences prefixed with '-' and '+' for code that is removed
400// and added, respectively. Changes to the IR that do not affect basic
401// blocks are not reported as having changed the IR. The option
402// -print-module-scope does not affect this change reporter.
403class InLineChangePrinter : public TextChangeReporter<IRDataT<EmptyData>> {
404public:
405 InLineChangePrinter(bool VerboseMode, bool ColourMode)
407 UseColour(ColourMode) {}
410
411protected:
412 // Create a representation of the IR.
414 IRDataT<EmptyData> &Output) override;
415
416 // Called when an interesting IR has changed.
417 void handleAfter(StringRef PassID, std::string &Name,
418 const IRDataT<EmptyData> &Before,
419 const IRDataT<EmptyData> &After, Any) override;
420
422 StringRef Divider, bool InModule, unsigned Minor,
423 const FuncDataT<EmptyData> &Before,
424 const FuncDataT<EmptyData> &After);
425
427};
428
430 bool DebugLogging;
431
432public:
433 VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
435};
436
437/// This class implements --time-trace functionality for new pass manager.
438/// It provides the pass-instrumentation callbacks that measure the pass
439/// execution time. They collect time tracing info by TimeProfiler.
441public:
443 // We intend this to be unique per-compilation, thus no copies.
445 void operator=(const TimeProfilingPassesHandler &) = delete;
446
448
449private:
450 // Implementation of pass instrumentation callbacks.
451 void runBeforePass(StringRef PassID, Any IR);
452 void runAfterPass();
453};
454
455// Class that holds transitions between basic blocks. The transitions
456// are contained in a map of values to names of basic blocks.
457class DCData {
458public:
459 // Fill the map with the transitions from basic block \p B.
460 DCData(const BasicBlock &B);
461
462 // Return an iterator to the names of the successor blocks.
464 return Successors.begin();
465 }
467 return Successors.end();
468 }
469
470 // Return the label of the basic block reached on a transition on \p S.
472 assert(Successors.count(S) == 1 && "Expected to find successor.");
473 return Successors.find(S)->getValue();
474 }
475
476protected:
477 // Add a transition to \p Succ on \p Label
479 std::pair<std::string, std::string> SS{Succ.str(), Label.str()};
480 Successors.insert(SS);
481 }
482
484};
485
486// A change reporter that builds a website with links to pdf files showing
487// dot control flow graphs with changed instructions shown in colour.
488class DotCfgChangeReporter : public ChangeReporter<IRDataT<DCData>> {
489public:
491 ~DotCfgChangeReporter() override;
493
494protected:
495 // Initialize the HTML file and output the header.
496 bool initializeHTML();
497
498 // Called on the first IR processed.
499 void handleInitialIR(Any IR) override;
500 // Called before and after a pass to get the representation of the IR.
502 IRDataT<DCData> &Output) override;
503 // Called when the pass is not iteresting.
504 void omitAfter(StringRef PassID, std::string &Name) override;
505 // Called when an interesting IR has changed.
506 void handleAfter(StringRef PassID, std::string &Name,
507 const IRDataT<DCData> &Before, const IRDataT<DCData> &After,
508 Any) override;
509 // Called when an interesting pass is invalidated.
510 void handleInvalidated(StringRef PassID) override;
511 // Called when the IR or pass is not interesting.
512 void handleFiltered(StringRef PassID, std::string &Name) override;
513 // Called when an ignored pass is encountered.
514 void handleIgnored(StringRef PassID, std::string &Name) override;
515
516 // Generate the pdf file into \p Dir / \p PDFFileName using \p DotFile as
517 // input and return the html <a> tag with \Text as the content.
518 static std::string genHTML(StringRef Text, StringRef DotFile,
519 StringRef PDFFileName);
520
522 StringRef Divider, bool InModule, unsigned Minor,
523 const FuncDataT<DCData> &Before,
524 const FuncDataT<DCData> &After);
525
526 unsigned N = 0;
527 std::unique_ptr<raw_fd_ostream> HTML;
528};
529
530// Print IR on crash.
532public:
534 : SavedIR("*** Dump of IR Before Last Pass Unknown ***") {}
537 void reportCrashIR();
538
539protected:
540 std::string SavedIR;
541
542private:
543 // The crash reporter that will report on a crash.
544 static PrintCrashIRInstrumentation *CrashReporter;
545 // Crash handler registered when print-on-crash is specified.
546 static void SignalHandler(void *);
547};
548
549/// This class provides an interface to register all the standard pass
550/// instrumentations and manages their state (if any).
553 PrintPassInstrumentation PrintPass;
554 TimePassesHandler TimePasses;
555 TimeProfilingPassesHandler TimeProfilingPasses;
558 PreservedCFGCheckerInstrumentation PreservedCFGChecker;
559 IRChangedPrinter PrintChangedIR;
560 PseudoProbeVerifier PseudoProbeVerification;
561 InLineChangePrinter PrintChangedDiff;
562 DotCfgChangeReporter WebsiteChangeReporter;
563 PrintCrashIRInstrumentation PrintCrashIR;
564 IRChangedTester ChangeTester;
566
567 bool VerifyEach;
568
569public:
570 StandardInstrumentations(LLVMContext &Context, bool DebugLogging,
571 bool VerifyEach = false,
572 PrintPassOptions PrintPassOpts = PrintPassOptions());
573
574 // Register all the standard instrumentation callbacks. If \p FAM is nullptr
575 // then PreservedCFGChecker is not enabled.
577 ModuleAnalysisManager *MAM = nullptr);
578
579 TimePassesHandler &getTimePasses() { return TimePasses; }
580};
581
582extern template class ChangeReporter<std::string>;
583extern template class TextChangeReporter<std::string>;
584
585extern template class BlockDataT<EmptyData>;
586extern template class FuncDataT<EmptyData>;
587extern template class IRDataT<EmptyData>;
588extern template class ChangeReporter<IRDataT<EmptyData>>;
589extern template class TextChangeReporter<IRDataT<EmptyData>>;
590extern template class IRComparer<EmptyData>;
591
592} // namespace llvm
593
594#endif
basic Basic Alias true
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
std::string Name
Statically lint checks LLVM IR
Definition: Lint.cpp:746
#define F(x, y, z)
Definition: MD5.cpp:55
#define G(x, y, z)
Definition: MD5.cpp:56
Machine Check Debug Module
LLVMContext & Context
This file declares the interface for bisecting optimizations.
ModuleAnalysisManager MAM
bool VerifyEach
PassInstrumentationCallbacks PIC
This header defines classes/functions to handle pass execution timing information with interfaces for...
static StringRef getName(Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains some templates that are useful if you are working with the STL at all.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file defines the SmallVector class.
@ Text
Definition: TextStubV5.cpp:112
static const char PassName[]
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:661
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
Definition: Any.h:28
LLVM Basic Block Representation.
Definition: BasicBlock.h:56
bool operator!=(const BlockDataT &That) const
bool operator==(const BlockDataT &That) const
StringRef getLabel() const
BlockDataT(const BasicBlock &B)
const T & getData() const
StringRef getBody() const
Value handle with callbacks on RAUW and destruction.
Definition: ValueHandle.h:383
virtual void deleted()
Callback for Value destruction.
Definition: ValueHandle.h:414
void saveIRBeforePass(Any IR, StringRef PassID, StringRef PassName)
virtual void handleFiltered(StringRef PassID, std::string &Name)=0
virtual void handleAfter(StringRef PassID, std::string &Name, const IRUnitT &Before, const IRUnitT &After, Any)=0
virtual void handleIgnored(StringRef PassID, std::string &Name)=0
virtual void generateIRRepresentation(Any IR, StringRef PassID, IRUnitT &Output)=0
virtual void handleInitialIR(Any IR)=0
void handleIRAfterPass(Any IR, StringRef PassID, StringRef PassName)
virtual void handleInvalidated(StringRef PassID)=0
void registerRequiredCallbacks(PassInstrumentationCallbacks &PIC)
std::vector< IRUnitT > BeforeStack
virtual void omitAfter(StringRef PassID, std::string &Name)=0
void handleInvalidatedPass(StringRef PassID)
ChangeReporter(bool RunInVerboseMode)
void addSuccessorLabel(StringRef Succ, StringRef Label)
StringRef getSuccessorLabel(StringRef S) const
StringMap< std::string > Successors
StringMap< std::string >::const_iterator end() const
StringMap< std::string >::const_iterator begin() const
std::unique_ptr< raw_fd_ostream > HTML
void handleInvalidated(StringRef PassID) override
void generateIRRepresentation(Any IR, StringRef PassID, IRDataT< DCData > &Output) override
static std::string genHTML(StringRef Text, StringRef DotFile, StringRef PDFFileName)
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< DCData > &Before, const FuncDataT< DCData > &After)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void handleIgnored(StringRef PassID, std::string &Name) override
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< DCData > &Before, const IRDataT< DCData > &After, Any) override
void handleFiltered(StringRef PassID, std::string &Name) override
void omitAfter(StringRef PassID, std::string &Name) override
EmptyData(const BasicBlock &)
std::string getEntryBlockName() const
~IRChangedPrinter() override
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, Any) override
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void generateIRRepresentation(Any IR, StringRef PassID, std::string &Output) override
void handleIgnored(StringRef PassID, std::string &Name) override
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, Any) override
void omitAfter(StringRef PassID, std::string &Name) override
void handleInvalidated(StringRef PassID) override
void handleIR(const std::string &IR, StringRef PassID)
void handleInitialIR(Any IR) override
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void handleFiltered(StringRef PassID, std::string &Name) override
const IRDataT< T > & Before
const IRDataT< T > & After
IRComparer(const IRDataT< T > &Before, const IRDataT< T > &After)
static void analyzeIR(Any IR, IRDataT< T > &Data)
void compare(bool CompareModule, std::function< void(bool InModule, unsigned Minor, const FuncDataT< T > &Before, const FuncDataT< T > &After)> CompareFunc)
static bool generateFunctionData(IRDataT< T > &Data, const Function &F)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
InLineChangePrinter(bool VerboseMode, bool ColourMode)
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< EmptyData > &Before, const IRDataT< EmptyData > &After, Any) override
void generateIRRepresentation(Any IR, StringRef PassID, IRDataT< EmptyData > &Output) override
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< EmptyData > &Before, const FuncDataT< EmptyData > &After)
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
void registerCallbacks(PassInstrumentationCallbacks &PIC)
OptPassGateInstrumentation(LLVMContext &Context)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
bool shouldRun(StringRef PassName, Any IR)
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
Definition: OptBisect.h:26
bool operator==(const OrderedChangedData< T > &That) const
static void report(const OrderedChangedData &Before, const OrderedChangedData &After, function_ref< void(const T *, const T *)> HandlePair)
const std::vector< std::string > & getOrder() const
std::vector< std::string > Order
const StringMap< T > & getData() const
std::vector< std::string > & getOrder()
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Instrumentation to print IR before/after passes.
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
PrintPassInstrumentation(bool Enabled, PrintPassOptions Opts)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1200
This class provides an interface to register all the standard pass instrumentations and manages their...
void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM=nullptr)
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:111
iterator end()
Definition: StringMap.h:204
iterator begin()
Definition: StringMap.h:203
iterator find(StringRef Key)
Definition: StringMap.h:217
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition: StringMap.h:256
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:286
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:222
void handleInitialIR(Any IR) override
void handleInvalidated(StringRef PassID) override
void omitAfter(StringRef PassID, std::string &Name) override
void handleIgnored(StringRef PassID, std::string &Name) override
void handleFiltered(StringRef PassID, std::string &Name) override
This class implements -time-passes functionality for new pass manager.
This class implements –time-trace functionality for new pass manager.
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void operator=(const TimeProfilingPassesHandler &)=delete
TimeProfilingPassesHandler(const TimeProfilingPassesHandler &)=delete
Value * getValPtr() const
Definition: ValueHandle.h:99
LLVM Value Representation.
Definition: Value.h:74
void registerCallbacks(PassInstrumentationCallbacks &PIC)
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:642
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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:1826
Definition: BitVector.h:858
void deleted() override
Callback for Value destruction.
void allUsesReplacedWith(Value *) override
Callback for Value RAUW.
std::optional< DenseMap< intptr_t, BBGuard > > BBGuards
static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After)
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
DenseMap< const BasicBlock *, DenseMap< const BasicBlock *, unsigned > > Graph
bool SkipAnalyses
Don't print information for analyses.
bool Verbose
Print adaptors and pass managers.
bool Indent
Indent based on hierarchy.