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
158};
159
160// Base class for classes that report changes to the IR.
161// It presents an interface for such classes and provides calls
162// on various events as the new pass manager transforms the IR.
163// It also provides filtering of information based on hidden options
164// specifying which functions are interesting.
165// Calls are made for the following events/queries:
166// 1. The initial IR processed.
167// 2. To get the representation of the IR (of type \p T).
168// 3. When a pass does not change the IR.
169// 4. When a pass changes the IR (given both before and after representations
170// of type \p T).
171// 5. When an IR is invalidated.
172// 6. When a pass is run on an IR that is not interesting (based on options).
173// 7. When a pass is ignored (pass manager or adapter pass).
174// 8. To compare two IR representations (of type \p T).
175template <typename IRUnitT> class ChangeReporter {
176protected:
177 ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
178
179public:
180 virtual ~ChangeReporter();
181
182 // Determine if this pass/IR is interesting and if so, save the IR
183 // otherwise it is left on the stack without data.
185 // Compare the IR from before the pass after the pass.
187 // Handle the situation where a pass is invalidated.
188 void handleInvalidatedPass(StringRef PassID);
189
190protected:
191 // Register required callbacks.
193
194 // Called on the first IR processed.
195 virtual void handleInitialIR(Any IR) = 0;
196 // Called before and after a pass to get the representation of the IR.
198 IRUnitT &Output) = 0;
199 // Called when the pass is not iteresting.
200 virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
201 // Called when an interesting IR has changed.
202 virtual void handleAfter(StringRef PassID, std::string &Name,
203 const IRUnitT &Before, const IRUnitT &After,
204 Any) = 0;
205 // Called when an interesting pass is invalidated.
206 virtual void handleInvalidated(StringRef PassID) = 0;
207 // Called when the IR or pass is not interesting.
208 virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
209 // Called when an ignored pass is encountered.
210 virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
211
212 // Stack of IRs before passes.
213 std::vector<IRUnitT> BeforeStack;
214 // Is this the first IR seen?
215 bool InitialIR = true;
216
217 // Run in verbose mode, printing everything?
218 const bool VerboseMode;
219};
220
221// An abstract template base class that handles printing banners and
222// reporting when things have not changed or are filtered out.
223template <typename IRUnitT>
224class TextChangeReporter : public ChangeReporter<IRUnitT> {
225protected:
227
228 // Print a module dump of the first IR that is changed.
229 void handleInitialIR(Any IR) override;
230 // Report that the IR was omitted because it did not change.
231 void omitAfter(StringRef PassID, std::string &Name) override;
232 // Report that the pass was invalidated.
233 void handleInvalidated(StringRef PassID) override;
234 // Report that the IR was filtered out.
235 void handleFiltered(StringRef PassID, std::string &Name) override;
236 // Report that the pass was ignored.
237 void handleIgnored(StringRef PassID, std::string &Name) override;
238 // Make substitutions in \p S suitable for reporting changes
239 // after the pass and then print it.
240
242};
243
244// A change printer based on the string representation of the IR as created
245// by unwrapAndPrint. The string representation is stored in a std::string
246// to preserve it as the IR changes in each pass. Note that the banner is
247// included in this representation but it is massaged before reporting.
248class IRChangedPrinter : public TextChangeReporter<std::string> {
249public:
254
255protected:
256 // Called before and after a pass to get the representation of the IR.
258 std::string &Output) override;
259 // Called when an interesting IR has changed.
260 void handleAfter(StringRef PassID, std::string &Name,
261 const std::string &Before, const std::string &After,
262 Any) override;
263};
264
266public:
268 ~IRChangedTester() override;
270
271protected:
272 void handleIR(const std::string &IR, StringRef PassID);
273
274 // Check initial IR
275 void handleInitialIR(Any IR) override;
276 // Do nothing.
277 void omitAfter(StringRef PassID, std::string &Name) override;
278 // Do nothing.
279 void handleInvalidated(StringRef PassID) override;
280 // Do nothing.
281 void handleFiltered(StringRef PassID, std::string &Name) override;
282 // Do nothing.
283 void handleIgnored(StringRef PassID, std::string &Name) override;
284
285 // Call test as interesting IR has changed.
286 void handleAfter(StringRef PassID, std::string &Name,
287 const std::string &Before, const std::string &After,
288 Any) override;
289};
290
291// Information that needs to be saved for a basic block in order to compare
292// before and after the pass to determine if it was changed by a pass.
293template <typename T> class BlockDataT {
294public:
295 BlockDataT(const BasicBlock &B) : Label(B.getName().str()), Data(B) {
297 B.print(SS, nullptr, true, true);
298 }
299
300 bool operator==(const BlockDataT &That) const { return Body == That.Body; }
301 bool operator!=(const BlockDataT &That) const { return Body != That.Body; }
302
303 // Return the label of the represented basic block.
304 StringRef getLabel() const { return Label; }
305 // Return the string representation of the basic block.
306 StringRef getBody() const { return Body; }
307
308 // Return the associated data
309 const T &getData() const { return Data; }
310
311protected:
312 std::string Label;
313 std::string Body;
314
315 // Extra data associated with a basic block
317};
318
319template <typename T> class OrderedChangedData {
320public:
321 // Return the names in the order they were saved
322 std::vector<std::string> &getOrder() { return Order; }
323 const std::vector<std::string> &getOrder() const { return Order; }
324
325 // Return a map of names to saved representations
326 StringMap<T> &getData() { return Data; }
327 const StringMap<T> &getData() const { return Data; }
328
329 bool operator==(const OrderedChangedData<T> &That) const {
330 return Data == That.getData();
331 }
332
333 // Call the lambda \p HandlePair on each corresponding pair of data from
334 // \p Before and \p After. The order is based on the order in \p After
335 // with ones that are only in \p Before interspersed based on where they
336 // occur in \p Before. This is used to present the output in an order
337 // based on how the data is ordered in LLVM.
338 static void report(const OrderedChangedData &Before,
339 const OrderedChangedData &After,
340 function_ref<void(const T *, const T *)> HandlePair);
341
342protected:
343 std::vector<std::string> Order;
345};
346
347// Do not need extra information for patch-style change reporter.
349public:
351};
352
353// The data saved for comparing functions.
354template <typename T>
355class FuncDataT : public OrderedChangedData<BlockDataT<T>> {
356public:
357 FuncDataT(std::string S) : EntryBlockName(S) {}
358
359 // Return the name of the entry block
360 std::string getEntryBlockName() const { return EntryBlockName; }
361
362protected:
363 std::string EntryBlockName;
364};
365
366// The data saved for comparing IRs.
367template <typename T>
368class IRDataT : public OrderedChangedData<FuncDataT<T>> {};
369
370// Abstract template base class for a class that compares two IRs. The
371// class is created with the 2 IRs to compare and then compare is called.
372// The static function analyzeIR is used to build up the IR representation.
373template <typename T> class IRComparer {
374public:
376 : Before(Before), After(After) {}
377
378 // Compare the 2 IRs. \p handleFunctionCompare is called to handle the
379 // compare of a function. When \p InModule is set,
380 // this function is being handled as part of comparing a module.
381 void compare(
382 bool CompareModule,
383 std::function<void(bool InModule, unsigned Minor,
384 const FuncDataT<T> &Before, const FuncDataT<T> &After)>
385 CompareFunc);
386
387 // Analyze \p IR and build the IR representation in \p Data.
388 static void analyzeIR(Any IR, IRDataT<T> &Data);
389
390protected:
391 // Generate the data for \p F into \p Data.
392 static bool generateFunctionData(IRDataT<T> &Data, const Function &F);
393
396};
397
398// A change printer that prints out in-line differences in the basic
399// blocks. It uses an InlineComparer to do the comparison so it shows
400// the differences prefixed with '-' and '+' for code that is removed
401// and added, respectively. Changes to the IR that do not affect basic
402// blocks are not reported as having changed the IR. The option
403// -print-module-scope does not affect this change reporter.
404class InLineChangePrinter : public TextChangeReporter<IRDataT<EmptyData>> {
405public:
406 InLineChangePrinter(bool VerboseMode, bool ColourMode)
408 UseColour(ColourMode) {}
411
412protected:
413 // Create a representation of the IR.
415 IRDataT<EmptyData> &Output) override;
416
417 // Called when an interesting IR has changed.
418 void handleAfter(StringRef PassID, std::string &Name,
419 const IRDataT<EmptyData> &Before,
420 const IRDataT<EmptyData> &After, Any) override;
421
423 StringRef Divider, bool InModule, unsigned Minor,
424 const FuncDataT<EmptyData> &Before,
425 const FuncDataT<EmptyData> &After);
426
428};
429
431 bool DebugLogging;
432
433public:
434 VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
436};
437
438/// This class implements --time-trace functionality for new pass manager.
439/// It provides the pass-instrumentation callbacks that measure the pass
440/// execution time. They collect time tracing info by TimeProfiler.
442public:
444 // We intend this to be unique per-compilation, thus no copies.
446 void operator=(const TimeProfilingPassesHandler &) = delete;
447
449
450private:
451 // Implementation of pass instrumentation callbacks.
452 void runBeforePass(StringRef PassID, Any IR);
453 void runAfterPass();
454};
455
456// Class that holds transitions between basic blocks. The transitions
457// are contained in a map of values to names of basic blocks.
458class DCData {
459public:
460 // Fill the map with the transitions from basic block \p B.
461 DCData(const BasicBlock &B);
462
463 // Return an iterator to the names of the successor blocks.
465 return Successors.begin();
466 }
468 return Successors.end();
469 }
470
471 // Return the label of the basic block reached on a transition on \p S.
473 assert(Successors.count(S) == 1 && "Expected to find successor.");
474 return Successors.find(S)->getValue();
475 }
476
477protected:
478 // Add a transition to \p Succ on \p Label
480 std::pair<std::string, std::string> SS{Succ.str(), Label.str()};
481 Successors.insert(SS);
482 }
483
485};
486
487// A change reporter that builds a website with links to pdf files showing
488// dot control flow graphs with changed instructions shown in colour.
489class DotCfgChangeReporter : public ChangeReporter<IRDataT<DCData>> {
490public:
492 ~DotCfgChangeReporter() override;
494
495protected:
496 // Initialize the HTML file and output the header.
497 bool initializeHTML();
498
499 // Called on the first IR processed.
500 void handleInitialIR(Any IR) override;
501 // Called before and after a pass to get the representation of the IR.
503 IRDataT<DCData> &Output) override;
504 // Called when the pass is not iteresting.
505 void omitAfter(StringRef PassID, std::string &Name) override;
506 // Called when an interesting IR has changed.
507 void handleAfter(StringRef PassID, std::string &Name,
508 const IRDataT<DCData> &Before, const IRDataT<DCData> &After,
509 Any) override;
510 // Called when an interesting pass is invalidated.
511 void handleInvalidated(StringRef PassID) override;
512 // Called when the IR or pass is not interesting.
513 void handleFiltered(StringRef PassID, std::string &Name) override;
514 // Called when an ignored pass is encountered.
515 void handleIgnored(StringRef PassID, std::string &Name) override;
516
517 // Generate the pdf file into \p Dir / \p PDFFileName using \p DotFile as
518 // input and return the html <a> tag with \Text as the content.
519 static std::string genHTML(StringRef Text, StringRef DotFile,
520 StringRef PDFFileName);
521
523 StringRef Divider, bool InModule, unsigned Minor,
524 const FuncDataT<DCData> &Before,
525 const FuncDataT<DCData> &After);
526
527 unsigned N = 0;
528 std::unique_ptr<raw_fd_ostream> HTML;
529};
530
531// Print IR on crash.
533public:
535 : SavedIR("*** Dump of IR Before Last Pass Unknown ***") {}
538 void reportCrashIR();
539
540protected:
541 std::string SavedIR;
542
543private:
544 // The crash reporter that will report on a crash.
545 static PrintCrashIRInstrumentation *CrashReporter;
546 // Crash handler registered when print-on-crash is specified.
547 static void SignalHandler(void *);
548};
549
550/// This class provides an interface to register all the standard pass
551/// instrumentations and manages their state (if any).
554 PrintPassInstrumentation PrintPass;
555 TimePassesHandler TimePasses;
556 TimeProfilingPassesHandler TimeProfilingPasses;
559 PreservedCFGCheckerInstrumentation PreservedCFGChecker;
560 IRChangedPrinter PrintChangedIR;
561 PseudoProbeVerifier PseudoProbeVerification;
562 InLineChangePrinter PrintChangedDiff;
563 DotCfgChangeReporter WebsiteChangeReporter;
564 PrintCrashIRInstrumentation PrintCrashIR;
565 IRChangedTester ChangeTester;
567
568 bool VerifyEach;
569
570public:
571 StandardInstrumentations(LLVMContext &Context, bool DebugLogging,
572 bool VerifyEach = false,
573 PrintPassOptions PrintPassOpts = PrintPassOptions());
574
575 // Register all the standard instrumentation callbacks. If \p FAM is nullptr
576 // then PreservedCFGChecker is not enabled.
578 FunctionAnalysisManager *FAM = nullptr);
579
580 TimePassesHandler &getTimePasses() { return TimePasses; }
581};
582
583extern template class ChangeReporter<std::string>;
584extern template class TextChangeReporter<std::string>;
585
586extern template class BlockDataT<EmptyData>;
587extern template class FuncDataT<EmptyData>;
588extern template class IRDataT<EmptyData>;
589extern template class ChangeReporter<IRDataT<EmptyData>>;
590extern template class TextChangeReporter<IRDataT<EmptyData>>;
591extern template class IRComparer<EmptyData>;
592
593} // namespace llvm
594
595#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.
FunctionAnalysisManager FAM
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.
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, FunctionAnalysisManager &FAM)
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, FunctionAnalysisManager *FAM=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:245
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:275
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:1742
Definition: BitVector.h:851
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.