LLVM 24.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/ADT/StringSet.h"
23#include "llvm/IR/BasicBlock.h"
26#include "llvm/IR/IRUnitRef.h"
27#include "llvm/IR/OptBisect.h"
29#include "llvm/IR/ValueHandle.h"
34
35#include <string>
36#include <utility>
37
38namespace llvm {
39
40class Module;
41class Function;
42class MachineFunction;
44
45/// Instrumentation to print IR before/after passes.
46///
47/// Needs state to be able to print module after pass that invalidates IR unit
48/// (typically Loop or SCC).
50public:
52
54
55private:
56 struct PassRunDescriptor {
57 const Module *M;
58 const unsigned PassNumber;
59 const std::string IRFileDisplayName;
60 const std::string IRName;
61 const StringRef PassID;
62
63 PassRunDescriptor(const Module *M, unsigned PassNumber,
64 std::string &&IRFileDisplayName, std::string &&IRName,
65 const StringRef PassID)
66 : M{M}, PassNumber{PassNumber}, IRFileDisplayName(IRFileDisplayName),
67 IRName{IRName}, PassID(PassID) {}
68 };
69
70 void printBeforePass(StringRef PassID, IRUnitRef IR);
71 void printAfterPass(StringRef PassID, IRUnitRef IR);
72 void printAfterPassInvalidated(StringRef PassID);
73
74 bool shouldPrintBeforePass(StringRef PassID);
75 bool shouldPrintAfterPass(StringRef PassID);
76 bool shouldPrintBeforeCurrentPassNumber();
77 bool shouldPrintAfterCurrentPassNumber();
78 bool shouldPrintPassNumbers();
79 bool shouldPrintBeforeSomePassNumber();
80 bool shouldPrintAfterSomePassNumber();
81
82 void pushPassRunDescriptor(StringRef PassID, IRUnitRef IR,
83 unsigned PassNumber);
84 PassRunDescriptor popPassRunDescriptor(StringRef PassID);
85
86 enum class IRDumpFileSuffixType {
87 Before,
88 After,
89 Invalidated,
90 };
91
92 static StringRef
93 getFileSuffix(PrintIRInstrumentation::IRDumpFileSuffixType Type);
94 std::string fetchDumpFilename(StringRef PassId, StringRef IRFileDisplayName,
95 unsigned PassNumber,
96 IRDumpFileSuffixType SuffixType);
97
99 /// Stack of Pass Run descriptions, enough to print the IR unit after a given
100 /// pass.
101 SmallVector<PassRunDescriptor, 2> PassRunDescriptorStack;
102
103 /// Used for print-at-pass-number
104 unsigned CurrentPassNumber = 0;
105};
106
108public:
109 OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
111
112private:
113 bool DebugLogging;
114 bool shouldRun(StringRef PassID, IRUnitRef IR);
115};
116
118 LLVMContext &Context;
119 bool HasWrittenIR = false;
120public:
121 OptPassGateInstrumentation(LLVMContext &Context) : Context(Context) {}
124};
125
127 /// Print adaptors and pass managers.
128 bool Verbose = false;
129 /// Don't print information for analyses.
130 bool SkipAnalyses = false;
131 /// Indent based on hierarchy.
132 bool Indent = false;
133};
134
135// Debug logging for transformation and analysis passes.
137 raw_ostream &print();
138
139public:
141 : Enabled(Enabled), Opts(Opts) {}
143
144private:
145 bool Enabled;
146 PrintPassOptions Opts;
147 int Indent = 0;
148};
149
151public:
152 // Keeps sticky poisoned flag for the given basic block once it has been
153 // deleted or RAUWed.
154 struct BBGuard final : public CallbackVH {
155 BBGuard(const BasicBlock *BB) : CallbackVH(BB) {}
156 void deleted() override { CallbackVH::deleted(); }
158 bool isPoisoned() const { return !getValPtr(); }
159 };
160
161 // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic
162 // block, {(Succ, Multiplicity)} set of all pairs of the block's successors
163 // and the multiplicity of the edge (BB->Succ). As the mapped sets are
164 // unordered the order of successors is not tracked by the CFG. In other words
165 // this allows basic block successors to be swapped by a pass without
166 // reporting a CFG change. CFG can be guarded by basic block tracking pointers
167 // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
168 // then the CFG is treated poisoned and no block pointer of the Graph is used.
169 struct CFG {
170 std::optional<DenseMap<intptr_t, BBGuard>> BBGuards;
172
173 LLVM_ABI CFG(const Function *F, bool TrackBBLifetime);
174
175 bool operator==(const CFG &G) const {
176 return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph;
177 }
178
179 bool isPoisoned() const {
180 return BBGuards && llvm::any_of(*BBGuards, [](const auto &BB) {
181 return BB.second.isPoisoned();
182 });
183 }
184
185 LLVM_ABI static void printDiff(raw_ostream &out, const CFG &Before,
186 const CFG &After);
188 FunctionAnalysisManager::Invalidator &);
189 };
190
191#if LLVM_ENABLE_ABI_BREAKING_CHECKS
193#endif
194
197};
198
199// Base class for classes that report changes to the IR.
200// It presents an interface for such classes and provides calls
201// on various events as the new pass manager transforms the IR.
202// It also provides filtering of information based on hidden options
203// specifying which functions are interesting.
204// Calls are made for the following events/queries:
205// 1. The initial IR processed.
206// 2. To get the representation of the IR (of type \p T).
207// 3. When a pass does not change the IR.
208// 4. When a pass changes the IR (given both before and after representations
209// of type \p T).
210// 5. When an IR is invalidated.
211// 6. When a pass is run on an IR that is not interesting (based on options).
212// 7. When a pass is ignored (pass manager or adapter pass).
213// 8. To compare two IR representations (of type \p T).
214template <typename IRUnitT> class LLVM_ABI ChangeReporter {
215protected:
216 ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
217
218public:
219 virtual ~ChangeReporter();
220
221 // Determine if this pass/IR is interesting and if so, save the IR
222 // otherwise it is left on the stack without data.
223 void saveIRBeforePass(IRUnitRef IR, StringRef PassID, StringRef PassName);
224 // Compare the IR from before the pass after the pass.
225 void handleIRAfterPass(IRUnitRef IR, StringRef PassID, StringRef PassName);
226 // Handle the situation where a pass is invalidated.
227 void handleInvalidatedPass(StringRef PassID);
228
229protected:
230 // Register required callbacks.
231 void registerRequiredCallbacks(PassInstrumentationCallbacks &PIC);
232
233 // Called on the first IR processed.
234 virtual void handleInitialIR(IRUnitRef IR) = 0;
235 // Called before and after a pass to get the representation of the IR.
237 IRUnitT &Output) = 0;
238 // Called when the pass is not iteresting.
239 virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
240 // Called when an interesting IR has changed.
241 virtual void handleAfter(StringRef PassID, std::string &Name,
242 const IRUnitT &Before, const IRUnitT &After,
243 IRUnitRef) = 0;
244 // Called when an interesting pass is invalidated.
245 virtual void handleInvalidated(StringRef PassID) = 0;
246 // Called when the IR or pass is not interesting.
247 virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
248 // Called when an ignored pass is encountered.
249 virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
250
251 // Stack of IRs before passes.
252 std::vector<IRUnitT> BeforeStack;
253 // Is this the first IR seen?
254 bool InitialIR = true;
255
256 // Run in verbose mode, printing everything?
257 const bool VerboseMode;
258};
259
260// An abstract template base class that handles printing banners and
261// reporting when things have not changed or are filtered out.
262template <typename IRUnitT>
264protected:
266
267 // Print a module dump of the first IR that is changed.
268 void handleInitialIR(IRUnitRef IR) override;
269 // Report that the IR was omitted because it did not change.
270 void omitAfter(StringRef PassID, std::string &Name) override;
271 // Report that the pass was invalidated.
272 void handleInvalidated(StringRef PassID) override;
273 // Report that the IR was filtered out.
274 void handleFiltered(StringRef PassID, std::string &Name) override;
275 // Report that the pass was ignored.
276 void handleIgnored(StringRef PassID, std::string &Name) override;
277 // Make substitutions in \p S suitable for reporting changes
278 // after the pass and then print it.
279
281};
282
283// A change printer based on the string representation of the IR as created
284// by unwrapAndPrint. The string representation is stored in a std::string
285// to preserve it as the IR changes in each pass. Note that the banner is
286// included in this representation but it is massaged before reporting.
287class LLVM_ABI IRChangedPrinter : public TextChangeReporter<std::string> {
288public:
293
294protected:
295 // Called before and after a pass to get the representation of the IR.
297 std::string &Output) override;
298 // Called when an interesting IR has changed.
299 void handleAfter(StringRef PassID, std::string &Name,
300 const std::string &Before, const std::string &After,
301 IRUnitRef) override;
302};
303
305public:
309
310protected:
311 void handleIR(const std::string &IR, StringRef PassID);
312
313 // Check initial IR
314 void handleInitialIR(IRUnitRef IR) override;
315 // Do nothing.
316 void omitAfter(StringRef PassID, std::string &Name) override;
317 // Do nothing.
318 void handleInvalidated(StringRef PassID) override;
319 // Do nothing.
320 void handleFiltered(StringRef PassID, std::string &Name) override;
321 // Do nothing.
322 void handleIgnored(StringRef PassID, std::string &Name) override;
323
324 // Call test as interesting IR has changed.
325 void handleAfter(StringRef PassID, std::string &Name,
326 const std::string &Before, const std::string &After,
327 IRUnitRef) override;
328};
329
330// Information that needs to be saved for a basic block in order to compare
331// before and after the pass to determine if it was changed by a pass.
332template <typename T> class BlockDataT {
333public:
334 BlockDataT(const BasicBlock &B) : Label(B.getName().str()), Data(B) {
336 B.print(SS, nullptr, true, true);
337 }
338
341 B.print(SS);
342 }
343
344 bool operator==(const BlockDataT &That) const { return Body == That.Body; }
345 bool operator!=(const BlockDataT &That) const { return Body != That.Body; }
346
347 // Return the label of the represented basic block.
348 StringRef getLabel() const { return Label; }
349 // Return the string representation of the basic block.
350 StringRef getBody() const { return Body; }
351
352 // Return the associated data
353 const T &getData() const { return Data; }
354
355protected:
356 std::string Label;
357 std::string Body;
358
359 // Extra data associated with a basic block
361};
362
363template <typename T> class OrderedChangedData {
364public:
365 // Return the names in the order they were saved
366 std::vector<std::string> &getOrder() { return Order; }
367 const std::vector<std::string> &getOrder() const { return Order; }
368
369 // Return a map of names to saved representations
370 StringMap<T> &getData() { return Data; }
371 const StringMap<T> &getData() const { return Data; }
372
373 bool operator==(const OrderedChangedData<T> &That) const {
374 return Data == That.getData();
375 }
376
377 // Call the lambda \p HandlePair on each corresponding pair of data from
378 // \p Before and \p After. The order is based on the order in \p After
379 // with ones that are only in \p Before interspersed based on where they
380 // occur in \p Before. This is used to present the output in an order
381 // based on how the data is ordered in LLVM.
382 static void report(const OrderedChangedData &Before,
383 const OrderedChangedData &After,
384 function_ref<void(const T *, const T *)> HandlePair);
385
386protected:
387 std::vector<std::string> Order;
389};
390
391// Do not need extra information for patch-style change reporter.
393public:
396};
397
398// The data saved for comparing functions.
399template <typename T>
400class FuncDataT : public OrderedChangedData<BlockDataT<T>> {
401public:
402 FuncDataT(std::string S) : EntryBlockName(S) {}
403
404 // Return the name of the entry block
405 std::string getEntryBlockName() const { return EntryBlockName; }
406
407protected:
408 std::string EntryBlockName;
409};
410
411// The data saved for comparing IRs.
412template <typename T>
413class IRDataT : public OrderedChangedData<FuncDataT<T>> {};
414
415// Abstract template base class for a class that compares two IRs. The
416// class is created with the 2 IRs to compare and then compare is called.
417// The static function analyzeIR is used to build up the IR representation.
418template <typename T> class IRComparer {
419public:
422
423 // Compare the 2 IRs. \p handleFunctionCompare is called to handle the
424 // compare of a function. When \p InModule is set,
425 // this function is being handled as part of comparing a module.
426 void compare(
427 bool CompareModule,
428 std::function<void(bool InModule, unsigned Minor,
429 const FuncDataT<T> &Before, const FuncDataT<T> &After)>
430 CompareFunc);
431
432 // Analyze \p IR and build the IR representation in \p Data.
433 static void analyzeIR(IRUnitRef IR, IRDataT<T> &Data);
434
435protected:
436 // Generate the data for \p F into \p Data.
437 template <typename FunctionT>
438 static bool generateFunctionData(IRDataT<T> &Data, const FunctionT &F);
439
442};
443
444// A change printer that prints out in-line differences in the basic
445// blocks. It uses an InlineComparer to do the comparison so it shows
446// the differences prefixed with '-' and '+' for code that is removed
447// and added, respectively. Changes to the IR that do not affect basic
448// blocks are not reported as having changed the IR. The option
449// -print-module-scope does not affect this change reporter.
451 : public TextChangeReporter<IRDataT<EmptyData>> {
452public:
453 InLineChangePrinter(bool VerboseMode, bool ColourMode)
455 UseColour(ColourMode) {}
458
459protected:
460 // Create a representation of the IR.
462 IRDataT<EmptyData> &Output) override;
463
464 // Called when an interesting IR has changed.
465 void handleAfter(StringRef PassID, std::string &Name,
466 const IRDataT<EmptyData> &Before,
467 const IRDataT<EmptyData> &After, IRUnitRef) override;
468
469 void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID,
470 StringRef Divider, bool InModule, unsigned Minor,
471 const FuncDataT<EmptyData> &Before,
472 const FuncDataT<EmptyData> &After);
473
475};
476
478 bool DebugLogging;
479
480public:
481 VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
484};
485
486/// This class implements --time-trace functionality for new pass manager.
487/// It provides the pass-instrumentation callbacks that measure the pass
488/// execution time. They collect time tracing info by TimeProfiler.
490public:
492 // We intend this to be unique per-compilation, thus no copies.
494 void operator=(const TimeProfilingPassesHandler &) = delete;
495
497
498private:
499 // Implementation of pass instrumentation callbacks.
500 void runBeforePass(StringRef PassID, IRUnitRef IR);
501 void runAfterPass();
502};
503
504// Class that holds transitions between basic blocks. The transitions
505// are contained in a map of values to names of basic blocks.
506class DCData {
507public:
508 // Fill the map with the transitions from basic block \p B.
509 LLVM_ABI DCData(const BasicBlock &B);
511
512 // Return an iterator to the names of the successor blocks.
514 return Successors.begin();
515 }
517 return Successors.end();
518 }
519
520 // Return the label of the basic block reached on a transition on \p S.
522 assert(Successors.count(S) == 1 && "Expected to find successor.");
523 return Successors.find(S)->getValue();
524 }
525
526protected:
527 // Add a transition to \p Succ on \p Label
529 std::pair<std::string, std::string> SS{Succ.str(), Label.str()};
530 Successors.insert(SS);
531 }
532
534};
535
536// A change reporter that builds a website with links to pdf files showing
537// dot control flow graphs with changed instructions shown in colour.
538class LLVM_ABI DotCfgChangeReporter : public ChangeReporter<IRDataT<DCData>> {
539public:
541 ~DotCfgChangeReporter() override;
543
544protected:
545 // Initialize the HTML file and output the header.
546 bool initializeHTML();
547
548 // Called on the first IR processed.
549 void handleInitialIR(IRUnitRef IR) override;
550 // Called before and after a pass to get the representation of the IR.
552 IRDataT<DCData> &Output) override;
553 // Called when the pass is not iteresting.
554 void omitAfter(StringRef PassID, std::string &Name) override;
555 // Called when an interesting IR has changed.
556 void handleAfter(StringRef PassID, std::string &Name,
557 const IRDataT<DCData> &Before, const IRDataT<DCData> &After,
558 IRUnitRef) override;
559 // Called when an interesting pass is invalidated.
560 void handleInvalidated(StringRef PassID) override;
561 // Called when the IR or pass is not interesting.
562 void handleFiltered(StringRef PassID, std::string &Name) override;
563 // Called when an ignored pass is encountered.
564 void handleIgnored(StringRef PassID, std::string &Name) override;
565
566 // Generate the pdf file into \p Dir / \p PDFFileName using \p DotFile as
567 // input and return the html <a> tag with \Text as the content.
568 static std::string genHTML(StringRef Text, StringRef DotFile,
569 StringRef PDFFileName);
570
571 void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID,
572 StringRef Divider, bool InModule, unsigned Minor,
573 const FuncDataT<DCData> &Before,
574 const FuncDataT<DCData> &After);
575
576 unsigned N = 0;
577 std::unique_ptr<raw_fd_ostream> HTML;
578};
579
580// Print IR on crash.
582public:
584 : SavedIR("*** Dump of IR Before Last Pass Unknown ***") {}
587 LLVM_ABI void reportCrashIR();
588
589protected:
590 std::string SavedIR;
591
592private:
593 // The crash reporter that will report on a crash.
594 static PrintCrashIRInstrumentation *CrashReporter;
595 // Crash handler registered when print-on-crash is specified.
596 static void SignalHandler(void *);
597};
598
599/// This class provides an interface to register all the standard pass
600/// instrumentations and manages their state (if any).
603 PrintPassInstrumentation PrintPass;
604 TimePassesHandler TimePasses;
605 TimeProfilingPassesHandler TimeProfilingPasses;
607 OptPassGateInstrumentation OptPassGate;
608 PreservedCFGCheckerInstrumentation PreservedCFGChecker;
609 IRChangedPrinter PrintChangedIR;
610 PseudoProbeVerifier PseudoProbeVerification;
611 InLineChangePrinter PrintChangedDiff;
612 DotCfgChangeReporter WebsiteChangeReporter;
613 PrintCrashIRInstrumentation PrintCrashIR;
614 IRChangedTester ChangeTester;
616 DroppedVariableStatsIR DroppedStatsIR;
617
618 bool VerifyEach;
619
620public:
622 StandardInstrumentations(LLVMContext &Context, bool DebugLogging,
623 bool VerifyEach = false,
624 PrintPassOptions PrintPassOpts = PrintPassOptions());
625
626 // Register all the standard instrumentation callbacks. If \p FAM is nullptr
627 // then PreservedCFGChecker is not enabled.
629 ModuleAnalysisManager *MAM = nullptr);
630
631 TimePassesHandler &getTimePasses() { return TimePasses; }
632};
633
634extern template class BlockDataT<EmptyData>;
635extern template class FuncDataT<EmptyData>;
636extern template class IRDataT<EmptyData>;
637extern template class IRComparer<EmptyData>;
638
639} // namespace llvm
640
641#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
===- DroppedVariableStatsIR.h - Opt Diagnostics -*- C++ -*-----------—===//
Flatten the CFG
This file defines IRUnitRef, a type-erased reference to the IR unit a pass or analysis is running on,...
Legalize the Machine IR a function s Machine IR
Definition Legalizer.cpp:81
#define F(x, y, z)
Definition MD5.cpp:54
#define G(x, y, z)
Definition MD5.cpp:55
#define T
This file declares the interface for bisecting optimizations.
ModuleAnalysisManager MAM
SI registerCallbacks(PIC, &MAM)
PassInstrumentationCallbacks PIC
This header defines classes/functions to handle pass execution timing information with interfaces for...
static StringRef getName(Value *V)
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.
StringSet - A set-like wrapper for the StringMap.
static const char PassName[]
LLVM Basic Block Representation.
Definition BasicBlock.h:62
bool operator!=(const BlockDataT &That) const
bool operator==(const BlockDataT &That) const
BlockDataT(const MachineBasicBlock &B)
BlockDataT(const BasicBlock &B)
CallbackVH(const CallbackVH &)=default
virtual void deleted()
Callback for Value destruction.
virtual void handleFiltered(StringRef PassID, std::string &Name)=0
virtual void handleInitialIR(IRUnitRef IR)=0
virtual void generateIRRepresentation(IRUnitRef IR, StringRef PassID, IRUnitT &Output)=0
virtual void handleIgnored(StringRef PassID, std::string &Name)=0
virtual void handleAfter(StringRef PassID, std::string &Name, const IRUnitT &Before, const IRUnitT &After, IRUnitRef)=0
virtual void handleInvalidated(StringRef PassID)=0
std::vector< IRUnitT > BeforeStack
virtual void omitAfter(StringRef PassID, std::string &Name)=0
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
LLVM_ABI DCData(const BasicBlock &B)
StringMap< std::string >::const_iterator begin() const
void generateIRRepresentation(IRUnitRef IR, StringRef PassID, IRDataT< DCData > &Output) override
std::unique_ptr< raw_fd_ostream > HTML
void handleInvalidated(StringRef PassID) override
static std::string genHTML(StringRef Text, StringRef DotFile, StringRef PDFFileName)
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< DCData > &Before, const IRDataT< DCData > &After, IRUnitRef) override
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< DCData > &Before, const FuncDataT< DCData > &After)
void handleIgnored(StringRef PassID, std::string &Name) override
void handleInitialIR(IRUnitRef IR) override
void handleFiltered(StringRef PassID, std::string &Name) override
void omitAfter(StringRef PassID, std::string &Name) override
A class to collect and print dropped debug information due to LLVM IR optimization passes.
EmptyData(const MachineBasicBlock &)
EmptyData(const BasicBlock &)
std::string getEntryBlockName() const
~IRChangedPrinter() override
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, IRUnitRef) override
void generateIRRepresentation(IRUnitRef 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, IRUnitRef) override
void omitAfter(StringRef PassID, std::string &Name) override
void handleInvalidated(StringRef PassID) override
void handleIR(const std::string &IR, StringRef PassID)
void handleFiltered(StringRef PassID, std::string &Name) override
~IRChangedTester() override
void handleInitialIR(IRUnitRef IR) override
const IRDataT< T > & Before
static bool generateFunctionData(IRDataT< T > &Data, const FunctionT &F)
static void analyzeIR(IRUnitRef IR, IRDataT< T > &Data)
const IRDataT< T > & After
IRComparer(const IRDataT< T > &Before, const IRDataT< T > &After)
void compare(bool CompareModule, std::function< void(bool InModule, unsigned Minor, const FuncDataT< T > &Before, const FuncDataT< T > &After)> CompareFunc)
A type-erased reference to the IR unit a pass or analysis is running on, together with the kind of IR...
Definition IRUnitRef.h:60
void generateIRRepresentation(IRUnitRef IR, StringRef PassID, IRDataT< EmptyData > &Output) override
InLineChangePrinter(bool VerboseMode, bool ColourMode)
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< EmptyData > &Before, const IRDataT< EmptyData > &After, IRUnitRef) 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:68
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC)
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC)
LLVM_ABI bool shouldRun(StringRef PassName, IRUnitRef IR)
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 Analysis.h:112
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM)
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC)
Instrumentation to print IR before/after passes.
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC)
LLVM_ABI 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.
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM=nullptr)
LLVM_ABI StandardInstrumentations(LLVMContext &Context, bool DebugLogging, bool VerifyEach=false, PrintPassOptions PrintPassOpts=PrintPassOptions())
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:128
StringMapIterBase< ValueTy, true > const_iterator
Definition StringMap.h:207
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::string str() const
Get the contents as an std::string.
Definition StringRef.h:222
void handleInvalidated(StringRef PassID) override
void handleInitialIR(IRUnitRef IR) 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.
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC)
void operator=(const TimeProfilingPassesHandler &)=delete
TimeProfilingPassesHandler(const TimeProfilingPassesHandler &)=delete
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
Value * getValPtr() const
LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM)
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:53
A raw_ostream that writes to an std::string.
This is an optimization pass for GlobalISel generic memory operations.
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
@ Enabled
Convert any .debug_str_offsets tables to DWARF64 if needed.
Definition DWP.h:31
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
void deleted() override
Callback for Value destruction.
void allUsesReplacedWith(Value *) override
Callback for Value RAUW.
std::optional< DenseMap< intptr_t, BBGuard > > BBGuards
static LLVM_ABI void printDiff(raw_ostream &out, const CFG &Before, const CFG &After)
LLVM_ABI CFG(const Function *F, bool TrackBBLifetime)
LLVM_ABI 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.