LLVM  13.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"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/IR/BasicBlock.h"
22 #include "llvm/IR/OptBisect.h"
23 #include "llvm/IR/PassTimingInfo.h"
24 #include "llvm/IR/ValueHandle.h"
27 
28 #include <string>
29 #include <utility>
30 
31 namespace llvm {
32 
33 class Module;
34 class Function;
35 class PassInstrumentationCallbacks;
36 
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).
42 public:
44 
46 
47 private:
48  void printBeforePass(StringRef PassID, Any IR);
49  void printAfterPass(StringRef PassID, Any IR);
50  void printAfterPassInvalidated(StringRef PassID);
51 
52  bool shouldPrintBeforePass(StringRef PassID);
53  bool shouldPrintAfterPass(StringRef PassID);
54 
55  using PrintModuleDesc = std::tuple<const Module *, std::string, StringRef>;
56 
57  void pushModuleDesc(StringRef PassID, Any IR);
58  PrintModuleDesc popModuleDesc(StringRef PassID);
59 
61  /// Stack of Module description, enough to print the module after a given
62  /// pass.
63  SmallVector<PrintModuleDesc, 2> ModuleDescStack;
64  bool StoreModuleDesc = false;
65 };
66 
68 public:
69  OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
71 
72 private:
73  bool DebugLogging;
74  bool shouldRun(StringRef PassID, Any IR);
75 };
76 
78 public:
81 };
82 
84  /// Print adaptors and pass managers.
85  bool Verbose = false;
86  /// Don't print information for analyses.
87  bool SkipAnalyses = false;
88  /// Indent based on hierarchy.
89  bool Indent = false;
90 };
91 
92 // Debug logging for transformation and analysis passes.
94  raw_ostream &print();
95 
96 public:
98  : Enabled(Enabled), Opts(Opts) {}
100 
101 private:
102  bool Enabled;
103  PrintPassOptions Opts;
104  int Indent = 0;
105 };
106 
108 public:
109  // Keeps sticky poisoned flag for the given basic block once it has been
110  // deleted or RAUWed.
111  struct BBGuard final : public CallbackVH {
113  void deleted() override { CallbackVH::deleted(); }
115  bool isPoisoned() const { return !getValPtr(); }
116  };
117 
118  // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic
119  // block, {(Succ, Multiplicity)} set of all pairs of the block's successors
120  // and the multiplicity of the edge (BB->Succ). As the mapped sets are
121  // unordered the order of successors is not tracked by the CFG. In other words
122  // this allows basic block successors to be swapped by a pass without
123  // reporting a CFG change. CFG can be guarded by basic block tracking pointers
124  // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
125  // then the CFG is treated poisoned and no block pointer of the Graph is used.
126  struct CFG {
129 
130  CFG(const Function *F, bool TrackBBLifetime);
131 
132  bool operator==(const CFG &G) const {
133  return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph;
134  }
135 
136  bool isPoisoned() const {
137  return BBGuards &&
138  std::any_of(BBGuards->begin(), BBGuards->end(),
139  [](const auto &BB) { return BB.second.isPoisoned(); });
140  }
141 
142  static void printDiff(raw_ostream &out, const CFG &Before,
143  const CFG &After);
144  bool invalidate(Function &F, const PreservedAnalyses &PA,
146  };
147 
148 #ifndef NDEBUG
150 #endif
151 
155 };
156 
157 // Base class for classes that report changes to the IR.
158 // It presents an interface for such classes and provides calls
159 // on various events as the new pass manager transforms the IR.
160 // It also provides filtering of information based on hidden options
161 // specifying which functions are interesting.
162 // Calls are made for the following events/queries:
163 // 1. The initial IR processed.
164 // 2. To get the representation of the IR (of type \p T).
165 // 3. When a pass does not change the IR.
166 // 4. When a pass changes the IR (given both before and after representations
167 // of type \p T).
168 // 5. When an IR is invalidated.
169 // 6. When a pass is run on an IR that is not interesting (based on options).
170 // 7. When a pass is ignored (pass manager or adapter pass).
171 // 8. To compare two IR representations (of type \p T).
172 template <typename IRUnitT> class ChangeReporter {
173 protected:
174  ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
175 
176 public:
177  virtual ~ChangeReporter();
178 
179  // Determine if this pass/IR is interesting and if so, save the IR
180  // otherwise it is left on the stack without data.
181  void saveIRBeforePass(Any IR, StringRef PassID);
182  // Compare the IR from before the pass after the pass.
183  void handleIRAfterPass(Any IR, StringRef PassID);
184  // Handle the situation where a pass is invalidated.
185  void handleInvalidatedPass(StringRef PassID);
186 
187 protected:
188  // Register required callbacks.
190 
191  // Return true when this is a defined function for which printing
192  // of changes is desired.
193  bool isInterestingFunction(const Function &F);
194 
195  // Return true when this is a pass for which printing of changes is desired.
196  bool isInterestingPass(StringRef PassID);
197 
198  // Return true when this is a pass on IR for which printing
199  // of changes is desired.
200  bool isInteresting(Any IR, StringRef PassID);
201 
202  // Called on the first IR processed.
203  virtual void handleInitialIR(Any IR) = 0;
204  // Called before and after a pass to get the representation of the IR.
205  virtual void generateIRRepresentation(Any IR, StringRef PassID,
206  IRUnitT &Output) = 0;
207  // Called when the pass is not iteresting.
208  virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
209  // Called when an interesting IR has changed.
210  virtual void handleAfter(StringRef PassID, std::string &Name,
211  const IRUnitT &Before, const IRUnitT &After,
212  Any) = 0;
213  // Called when an interesting pass is invalidated.
214  virtual void handleInvalidated(StringRef PassID) = 0;
215  // Called when the IR or pass is not interesting.
216  virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
217  // Called when an ignored pass is encountered.
218  virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
219  // Called to compare the before and after representations of the IR.
220  virtual bool same(const IRUnitT &Before, const IRUnitT &After) = 0;
221 
222  // Stack of IRs before passes.
223  std::vector<IRUnitT> BeforeStack;
224  // Is this the first IR seen?
225  bool InitialIR = true;
226 
227  // Run in verbose mode, printing everything?
228  const bool VerboseMode;
229 };
230 
231 // An abstract template base class that handles printing banners and
232 // reporting when things have not changed or are filtered out.
233 template <typename IRUnitT>
234 class TextChangeReporter : public ChangeReporter<IRUnitT> {
235 protected:
237 
238  // Print a module dump of the first IR that is changed.
239  void handleInitialIR(Any IR) override;
240  // Report that the IR was omitted because it did not change.
241  void omitAfter(StringRef PassID, std::string &Name) override;
242  // Report that the pass was invalidated.
243  void handleInvalidated(StringRef PassID) override;
244  // Report that the IR was filtered out.
245  void handleFiltered(StringRef PassID, std::string &Name) override;
246  // Report that the pass was ignored.
247  void handleIgnored(StringRef PassID, std::string &Name) override;
248  // Make substitutions in \p S suitable for reporting changes
249  // after the pass and then print it.
250 
252 };
253 
254 // A change printer based on the string representation of the IR as created
255 // by unwrapAndPrint. The string representation is stored in a std::string
256 // to preserve it as the IR changes in each pass. Note that the banner is
257 // included in this representation but it is massaged before reporting.
258 class IRChangedPrinter : public TextChangeReporter<std::string> {
259 public:
262  ~IRChangedPrinter() override;
264 
265 protected:
266  // Called before and after a pass to get the representation of the IR.
268  std::string &Output) override;
269  // Called when an interesting IR has changed.
270  void handleAfter(StringRef PassID, std::string &Name,
271  const std::string &Before, const std::string &After,
272  Any) override;
273  // Called to compare the before and after representations of the IR.
274  bool same(const std::string &Before, const std::string &After) override;
275 };
276 
277 // The following classes hold a representation of the IR for a change
278 // reporter that uses string comparisons of the basic blocks
279 // that are created using print (ie, similar to dump()).
280 // These classes respect the filtering of passes and functions using
281 // -filter-passes and -filter-print-funcs.
282 //
283 // Information that needs to be saved for a basic block in order to compare
284 // before and after the pass to determine if it was changed by a pass.
286 public:
287  ChangedBlockData(const BasicBlock &B);
288 
289  bool operator==(const ChangedBlockData &That) const {
290  return Body == That.Body;
291  }
292  bool operator!=(const ChangedBlockData &That) const {
293  return Body != That.Body;
294  }
295 
296  // Return the label of the represented basic block.
297  StringRef getLabel() const { return Label; }
298  // Return the string representation of the basic block.
299  StringRef getBody() const { return Body; }
300 
301 protected:
302  std::string Label;
303  std::string Body;
304 };
305 
306 template <typename IRData> class OrderedChangedData {
307 public:
308  // Return the names in the order they were saved
309  std::vector<std::string> &getOrder() { return Order; }
310  const std::vector<std::string> &getOrder() const { return Order; }
311 
312  // Return a map of names to saved representations
314  const StringMap<IRData> &getData() const { return Data; }
315 
316  bool operator==(const OrderedChangedData<IRData> &That) const {
317  return Data == That.getData();
318  }
319 
320  // Call the lambda \p HandlePair on each corresponding pair of data from
321  // \p Before and \p After. The order is based on the order in \p After
322  // with ones that are only in \p Before interspersed based on where they
323  // occur in \p Before. This is used to present the output in an order
324  // based on how the data is ordered in LLVM.
325  static void
326  report(const OrderedChangedData &Before, const OrderedChangedData &After,
327  function_ref<void(const IRData *, const IRData *)> HandlePair);
328 
329 protected:
330  std::vector<std::string> Order;
332 };
333 
334 // The data saved for comparing functions.
336 
337 // A map of names to the saved data.
339 
340 // A class that compares two IRs and does a diff between them. The
341 // added lines are prefixed with a '+', the removed lines are prefixed
342 // with a '-' and unchanged lines are prefixed with a space (to have
343 // things line up).
345 public:
347  const ChangedIRData &After, bool ColourMode)
348  : Before(Before), After(After), Out(OS), UseColour(ColourMode) {}
349 
350  // Compare the 2 IRs.
352 
353  // Analyze \p IR and build the IR representation in \p Data.
354  static void analyzeIR(Any IR, ChangedIRData &Data);
355 
356 protected:
357  // Return the module when that is the appropriate level of
358  // comparison for \p IR.
359  static const Module *getModuleForComparison(Any IR);
360 
361  // Generate the data for \p F into \p Data.
362  static bool generateFunctionData(ChangedIRData &Data, const Function &F);
363 
364  // Called to handle the compare of a function. When \p InModule is set,
365  // this function is being handled as part of comparing a module.
367  bool InModule, const ChangedFuncData &Before,
368  const ChangedFuncData &After);
369 
373  bool UseColour;
374 };
375 
376 // A change printer that prints out in-line differences in the basic
377 // blocks. It uses an InlineComparer to do the comparison so it shows
378 // the differences prefixed with '-' and '+' for code that is removed
379 // and added, respectively. Changes to the IR that do not affect basic
380 // blocks are not reported as having changed the IR. The option
381 // -print-module-scope does not affect this change reporter.
382 class InLineChangePrinter : public TextChangeReporter<ChangedIRData> {
383 public:
384  InLineChangePrinter(bool VerboseMode, bool ColourMode)
386  ~InLineChangePrinter() override;
388 
389 protected:
390  // Create a representation of the IR.
391  virtual void generateIRRepresentation(Any IR, StringRef PassID,
392  ChangedIRData &Output) override;
393 
394  // Called when an interesting IR has changed.
395  virtual void handleAfter(StringRef PassID, std::string &Name,
396  const ChangedIRData &Before,
397  const ChangedIRData &After, Any) override;
398  // Called to compare the before and after representations of the IR.
399  virtual bool same(const ChangedIRData &Before,
400  const ChangedIRData &After) override;
401 
402  bool UseColour;
403 };
404 
406  bool DebugLogging;
407 
408 public:
409  VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
411 };
412 
413 /// This class provides an interface to register all the standard pass
414 /// instrumentations and manages their state (if any).
416  PrintIRInstrumentation PrintIR;
417  PrintPassInstrumentation PrintPass;
418  TimePassesHandler TimePasses;
419  OptNoneInstrumentation OptNone;
421  PreservedCFGCheckerInstrumentation PreservedCFGChecker;
422  IRChangedPrinter PrintChangedIR;
423  PseudoProbeVerifier PseudoProbeVerification;
424  InLineChangePrinter PrintChangedDiff;
425  VerifyInstrumentation Verify;
426 
427  bool VerifyEach;
428 
429 public:
430  StandardInstrumentations(bool DebugLogging, bool VerifyEach = false,
431  PrintPassOptions PrintPassOpts = PrintPassOptions());
432 
433  // Register all the standard instrumentation callbacks. If \p FAM is nullptr
434  // then PreservedCFGChecker is not enabled.
436  FunctionAnalysisManager *FAM = nullptr);
437 
438  TimePassesHandler &getTimePasses() { return TimePasses; }
439 };
440 
441 extern template class ChangeReporter<std::string>;
442 extern template class TextChangeReporter<std::string>;
443 
444 extern template class ChangeReporter<ChangedIRData>;
445 extern template class TextChangeReporter<ChangedIRData>;
446 
447 } // namespace llvm
448 
449 #endif
llvm::OrderedChangedData
Definition: StandardInstrumentations.h:306
llvm::InLineChangePrinter::~InLineChangePrinter
~InLineChangePrinter() override
Definition: StandardInstrumentations.cpp:1164
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::ChangeReporter::omitAfter
virtual void omitAfter(StringRef PassID, std::string &Name)=0
llvm::ChangeReporter::ChangeReporter
ChangeReporter(bool RunInVerboseMode)
Definition: StandardInstrumentations.h:174
llvm::PreservedCFGCheckerInstrumentation::BBGuard::isPoisoned
bool isPoisoned() const
Definition: StandardInstrumentations.h:115
llvm::InLineChangePrinter::handleAfter
virtual void handleAfter(StringRef PassID, std::string &Name, const ChangedIRData &Before, const ChangedIRData &After, Any) override
Definition: StandardInstrumentations.cpp:1171
llvm
Definition: AllocatorList.h:23
llvm::CallbackVH::deleted
virtual void deleted()
Callback for Value destruction.
Definition: ValueHandle.h:414
llvm::ChangedIRComparer::generateFunctionData
static bool generateFunctionData(ChangedIRData &Data, const Function &F)
Definition: StandardInstrumentations.cpp:692
llvm::ChangeReporter::handleFiltered
virtual void handleFiltered(StringRef PassID, std::string &Name)=0
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:164
llvm::IRChangedPrinter::same
bool same(const std::string &Before, const std::string &After) override
Definition: StandardInstrumentations.cpp:564
llvm::Function
Definition: Function.h:61
StringRef.h
llvm::TextChangeReporter::handleIgnored
void handleIgnored(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:525
llvm::TextChangeReporter::TextChangeReporter
TextChangeReporter(bool Verbose)
Definition: StandardInstrumentations.cpp:490
llvm::InlinerFunctionImportStatsOpts::Verbose
@ Verbose
llvm::SmallVector< PrintModuleDesc, 2 >
llvm::TextChangeReporter::handleInitialIR
void handleInitialIR(Any IR) override
Definition: StandardInstrumentations.cpp:494
llvm::PrintPassInstrumentation::PrintPassInstrumentation
PrintPassInstrumentation(bool Enabled, PrintPassOptions Opts)
Definition: StandardInstrumentations.h:97
llvm::OptNoneInstrumentation::OptNoneInstrumentation
OptNoneInstrumentation(bool DebugLogging)
Definition: StandardInstrumentations.h:69
llvm::PrintIRInstrumentation::~PrintIRInstrumentation
~PrintIRInstrumentation()
Definition: StandardInstrumentations.cpp:707
llvm::PreservedCFGCheckerInstrumentation
Definition: StandardInstrumentations.h:107
llvm::ChangeReporter::~ChangeReporter
virtual ~ChangeReporter()
Definition: StandardInstrumentations.cpp:374
FAM
FunctionAnalysisManager FAM
Definition: PassBuilderBindings.cpp:59
llvm::OrderedChangedData::getOrder
const std::vector< std::string > & getOrder() const
Definition: StandardInstrumentations.h:310
llvm::ChangeReporter::isInterestingFunction
bool isInterestingFunction(const Function &F)
Definition: StandardInstrumentations.cpp:379
llvm::ChangeReporter::handleAfter
virtual void handleAfter(StringRef PassID, std::string &Name, const IRUnitT &Before, const IRUnitT &After, Any)=0
llvm::IRChangedPrinter::generateIRRepresentation
void generateIRRepresentation(Any IR, StringRef PassID, std::string &Output) override
Definition: StandardInstrumentations.cpp:538
PIC
PassInstrumentationCallbacks PIC
Definition: PassBuilderBindings.cpp:55
OptBisect.h
llvm::ChangedBlockData::ChangedBlockData
ChangedBlockData(const BasicBlock &B)
Definition: StandardInstrumentations.cpp:483
llvm::ValueHandleBase::getValPtr
Value * getValPtr() const
Definition: ValueHandle.h:99
llvm::PrintPassInstrumentation
Definition: StandardInstrumentations.h:93
llvm::Optional
Definition: APInt.h:33
llvm::TextChangeReporter::handleInvalidated
void handleInvalidated(StringRef PassID) override
Definition: StandardInstrumentations.cpp:512
llvm::ChangedIRComparer::ChangedIRComparer
ChangedIRComparer(raw_ostream &OS, const ChangedIRData &Before, const ChangedIRData &After, bool ColourMode)
Definition: StandardInstrumentations.h:346
STLExtras.h
llvm::PreservedCFGCheckerInstrumentation::CFG::printDiff
static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After)
Definition: StandardInstrumentations.cpp:973
llvm::ChangeReporter::saveIRBeforePass
void saveIRBeforePass(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:405
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
llvm::ChangeReporter::handleIgnored
virtual void handleIgnored(StringRef PassID, std::string &Name)=0
llvm::PreservedCFGCheckerInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC, FunctionAnalysisManager &FAM)
Definition: StandardInstrumentations.cpp:1067
llvm::ChangeReporter::registerRequiredCallbacks
void registerRequiredCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:468
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::OrderedChangedData::getData
StringMap< IRData > & getData()
Definition: StandardInstrumentations.h:313
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::IRChangedPrinter::IRChangedPrinter
IRChangedPrinter(bool VerboseMode)
Definition: StandardInstrumentations.h:260
llvm::ChangeReporter::BeforeStack
std::vector< IRUnitT > BeforeStack
Definition: StandardInstrumentations.h:223
PassTimingInfo.h
CommandLine.h
llvm::TextChangeReporter::Out
raw_ostream & Out
Definition: StandardInstrumentations.h:251
llvm::PrintPassOptions::SkipAnalyses
bool SkipAnalyses
Don't print information for analyses.
Definition: StandardInstrumentations.h:87
llvm::StandardInstrumentations::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC, FunctionAnalysisManager *FAM=nullptr)
Definition: StandardInstrumentations.cpp:1226
llvm::PrintIRInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:810
llvm::OptNoneInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:833
llvm::ChangedBlockData::operator==
bool operator==(const ChangedBlockData &That) const
Definition: StandardInstrumentations.h:289
llvm::StandardInstrumentations::getTimePasses
TimePassesHandler & getTimePasses()
Definition: StandardInstrumentations.h:438
llvm::PrintPassOptions
Definition: StandardInstrumentations.h:83
llvm::OptBisect
This class implements a mechanism to disable passes and individual optimizations at compile time base...
Definition: OptBisect.h:44
llvm::PseudoProbeVerifier
Definition: SampleProfileProbe.h:59
llvm::ChangedBlockData::operator!=
bool operator!=(const ChangedBlockData &That) const
Definition: StandardInstrumentations.h:292
llvm::VerifyInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:1128
llvm::InLineChangePrinter::InLineChangePrinter
InLineChangePrinter(bool VerboseMode, bool ColourMode)
Definition: StandardInstrumentations.h:384
llvm::OrderedChangedData::getOrder
std::vector< std::string > & getOrder()
Definition: StandardInstrumentations.h:309
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::OrderedChangedData::Order
std::vector< std::string > Order
Definition: StandardInstrumentations.h:330
llvm::ChangedIRComparer::getModuleForComparison
static const Module * getModuleForComparison(Any IR)
Definition: StandardInstrumentations.cpp:681
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::OrderedChangedData::operator==
bool operator==(const OrderedChangedData< IRData > &That) const
Definition: StandardInstrumentations.h:316
llvm::PreservedCFGCheckerInstrumentation::BBGuard::BBGuard
BBGuard(const BasicBlock *BB)
Definition: StandardInstrumentations.h:112
llvm::OrderedChangedData::getData
const StringMap< IRData > & getData() const
Definition: StandardInstrumentations.h:314
IR
Statically lint checks LLVM IR
Definition: Lint.cpp:744
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:656
llvm::ChangeReporter::handleInitialIR
virtual void handleInitialIR(Any IR)=0
llvm::PrintPassOptions::Indent
bool Indent
Indent based on hierarchy.
Definition: StandardInstrumentations.h:89
llvm::ChangedIRComparer::Out
raw_ostream & Out
Definition: StandardInstrumentations.h:372
llvm::InLineChangePrinter::generateIRRepresentation
virtual void generateIRRepresentation(Any IR, StringRef PassID, ChangedIRData &Output) override
Definition: StandardInstrumentations.cpp:1166
llvm::PreservedCFGCheckerInstrumentation::PassStack
SmallVector< StringRef, 8 > PassStack
Definition: StandardInstrumentations.h:149
llvm::StringMap< IRData >
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:168
llvm::PrintIRInstrumentation
Instrumentation to print IR before/after passes.
Definition: StandardInstrumentations.h:41
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
BasicBlock.h
llvm::cl::opt< bool >
llvm::ChangeReporter
Definition: StandardInstrumentations.h:172
llvm::PreservedCFGCheckerInstrumentation::BBGuard::deleted
void deleted() override
Callback for Value destruction.
Definition: StandardInstrumentations.h:113
llvm::OptNoneInstrumentation
Definition: StandardInstrumentations.h:67
llvm::StandardInstrumentations
This class provides an interface to register all the standard pass instrumentations and manages their...
Definition: StandardInstrumentations.h:415
llvm::IRChangedPrinter
Definition: StandardInstrumentations.h:258
llvm::ChangedIRComparer::analyzeIR
static void analyzeIR(Any IR, ChangedIRData &Data)
Definition: StandardInstrumentations.cpp:661
llvm::TextChangeReporter::handleFiltered
void handleFiltered(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:517
llvm::DenseMap
Definition: DenseMap.h:714
llvm::OrderedChangedData::report
static void report(const OrderedChangedData &Before, const OrderedChangedData &After, function_ref< void(const IRData *, const IRData *)> HandlePair)
Definition: StandardInstrumentations.cpp:569
llvm::TextChangeReporter
Definition: StandardInstrumentations.h:234
llvm::ChangeReporter::isInteresting
bool isInteresting(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:396
llvm::ChangedIRComparer::UseColour
bool UseColour
Definition: StandardInstrumentations.h:373
llvm::PreservedCFGCheckerInstrumentation::CFG::BBGuards
Optional< DenseMap< intptr_t, BBGuard > > BBGuards
Definition: StandardInstrumentations.h:127
llvm::ChangedBlockData::getBody
StringRef getBody() const
Definition: StandardInstrumentations.h:299
llvm::ChangeReporter::handleIRAfterPass
void handleIRAfterPass(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:426
llvm::OptBisectInstrumentation::OptBisectInstrumentation
OptBisectInstrumentation()
Definition: StandardInstrumentations.h:79
llvm::PreservedCFGCheckerInstrumentation::CFG::invalidate
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Definition: StandardInstrumentations.cpp:1059
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
SampleProfileProbe.h
llvm::PreservedCFGCheckerInstrumentation::CFG
Definition: StandardInstrumentations.h:126
llvm::InLineChangePrinter::UseColour
bool UseColour
Definition: StandardInstrumentations.h:402
llvm::ChangedIRComparer::compare
void compare(Any IR, StringRef Prefix, StringRef PassID, StringRef Name)
Definition: StandardInstrumentations.cpp:636
llvm::ChangedIRComparer::After
const ChangedIRData & After
Definition: StandardInstrumentations.h:371
llvm::ChangedBlockData::getLabel
StringRef getLabel() const
Definition: StandardInstrumentations.h:297
llvm::IRChangedPrinter::handleAfter
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, Any) override
Definition: StandardInstrumentations.cpp:546
llvm::InLineChangePrinter
Definition: StandardInstrumentations.h:382
llvm::any_of
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:1489
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
VerifyEach
bool VerifyEach
Definition: PassBuilderBindings.cpp:52
llvm::ChangeReporter::generateIRRepresentation
virtual void generateIRRepresentation(Any IR, StringRef PassID, IRUnitT &Output)=0
llvm::PreservedCFGCheckerInstrumentation::CFG::isPoisoned
bool isPoisoned() const
Definition: StandardInstrumentations.h:136
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::InLineChangePrinter::same
virtual bool same(const ChangedIRData &Before, const ChangedIRData &After) override
Definition: StandardInstrumentations.cpp:1182
llvm::ChangedBlockData::Body
std::string Body
Definition: StandardInstrumentations.h:303
llvm::PreservedCFGCheckerInstrumentation::BBGuard::allUsesReplacedWith
void allUsesReplacedWith(Value *) override
Callback for Value RAUW.
Definition: StandardInstrumentations.h:114
ValueHandle.h
llvm::PreservedCFGCheckerInstrumentation::CFG::operator==
bool operator==(const CFG &G) const
Definition: StandardInstrumentations.h:132
llvm::VerifyInstrumentation
Definition: StandardInstrumentations.h:405
llvm::PrintPassOptions::Verbose
bool Verbose
Print adaptors and pass managers.
Definition: StandardInstrumentations.h:85
llvm::OrderedChangedData::Data
StringMap< IRData > Data
Definition: StandardInstrumentations.h:331
llvm::Any
Definition: Any.h:26
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::StandardInstrumentations::StandardInstrumentations
StandardInstrumentations(bool DebugLogging, bool VerifyEach=false, PrintPassOptions PrintPassOpts=PrintPassOptions())
Definition: StandardInstrumentations.cpp:1215
std
Definition: BitVector.h:838
llvm::TextChangeReporter::omitAfter
void omitAfter(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:505
llvm::InLineChangePrinter::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:1207
llvm::OptBisectInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:854
llvm::PreservedCFGCheckerInstrumentation::BBGuard
Definition: StandardInstrumentations.h:111
llvm::CallbackVH
Value handle with callbacks on RAUW and destruction.
Definition: ValueHandle.h:383
llvm::ChangeReporter::handleInvalidated
virtual void handleInvalidated(StringRef PassID)=0
llvm::ChangeReporter::handleInvalidatedPass
void handleInvalidatedPass(StringRef PassID)
Definition: StandardInstrumentations.cpp:455
llvm::ChangeReporter::same
virtual bool same(const IRUnitT &Before, const IRUnitT &After)=0
llvm::PreservedCFGCheckerInstrumentation::CFG::CFG
CFG(const Function *F, bool TrackBBLifetime)
Definition: StandardInstrumentations.cpp:932
llvm::ChangeReporter::InitialIR
bool InitialIR
Definition: StandardInstrumentations.h:225
SmallVector.h
llvm::PassInstrumentationCallbacks
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
Definition: PassInstrumentation.h:66
llvm::ChangeReporter::VerboseMode
const bool VerboseMode
Definition: StandardInstrumentations.h:228
llvm::ChangedIRComparer
Definition: StandardInstrumentations.h:344
llvm::TimePassesHandler
This class implements -time-passes functionality for new pass manager.
Definition: PassTimingInfo.h:46
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::ChangeReporter::isInterestingPass
bool isInterestingPass(StringRef PassID)
Definition: StandardInstrumentations.cpp:384
llvm::IRChangedPrinter::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:532
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::OptBisectInstrumentation
Definition: StandardInstrumentations.h:77
llvm::IRChangedPrinter::~IRChangedPrinter
~IRChangedPrinter() override
Definition: StandardInstrumentations.cpp:530
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::ChangedIRComparer::handleFunctionCompare
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, bool InModule, const ChangedFuncData &Before, const ChangedFuncData &After)
Definition: StandardInstrumentations.cpp:1187
llvm::ChangedBlockData
Definition: StandardInstrumentations.h:285
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::PreservedCFGCheckerInstrumentation::CFG::Graph
DenseMap< const BasicBlock *, DenseMap< const BasicBlock *, unsigned > > Graph
Definition: StandardInstrumentations.h:128
llvm::VerifyInstrumentation::VerifyInstrumentation
VerifyInstrumentation(bool DebugLogging)
Definition: StandardInstrumentations.h:409
llvm::PrintPassInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:871
SpecialSubKind::string
@ string
llvm::PreservedCFGCheckerInstrumentation::VerifyPreservedCFG
static cl::opt< bool > VerifyPreservedCFG
Definition: StandardInstrumentations.h:152
llvm::ChangedBlockData::Label
std::string Label
Definition: StandardInstrumentations.h:302
llvm::ChangedIRComparer::Before
const ChangedIRData & Before
Definition: StandardInstrumentations.h:370