LLVM  15.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 };
65 
67 public:
68  OptNoneInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
70 
71 private:
72  bool DebugLogging;
73  bool shouldRun(StringRef PassID, Any IR);
74 };
75 
77 public:
78  OptBisectInstrumentation() = default;
80 };
81 
83  /// Print adaptors and pass managers.
84  bool Verbose = false;
85  /// Don't print information for analyses.
86  bool SkipAnalyses = false;
87  /// Indent based on hierarchy.
88  bool Indent = false;
89 };
90 
91 // Debug logging for transformation and analysis passes.
93  raw_ostream &print();
94 
95 public:
97  : Enabled(Enabled), Opts(Opts) {}
99 
100 private:
101  bool Enabled;
102  PrintPassOptions Opts;
103  int Indent = 0;
104 };
105 
107 public:
108  // Keeps sticky poisoned flag for the given basic block once it has been
109  // deleted or RAUWed.
110  struct BBGuard final : public CallbackVH {
112  void deleted() override { CallbackVH::deleted(); }
114  bool isPoisoned() const { return !getValPtr(); }
115  };
116 
117  // CFG is a map BB -> {(Succ, Multiplicity)}, where BB is a non-leaf basic
118  // block, {(Succ, Multiplicity)} set of all pairs of the block's successors
119  // and the multiplicity of the edge (BB->Succ). As the mapped sets are
120  // unordered the order of successors is not tracked by the CFG. In other words
121  // this allows basic block successors to be swapped by a pass without
122  // reporting a CFG change. CFG can be guarded by basic block tracking pointers
123  // in the Graph (BBGuard). That is if any of the block is deleted or RAUWed
124  // then the CFG is treated poisoned and no block pointer of the Graph is used.
125  struct CFG {
128 
129  CFG(const Function *F, bool TrackBBLifetime);
130 
131  bool operator==(const CFG &G) const {
132  return !isPoisoned() && !G.isPoisoned() && Graph == G.Graph;
133  }
134 
135  bool isPoisoned() const {
136  return BBGuards &&
137  std::any_of(BBGuards->begin(), BBGuards->end(),
138  [](const auto &BB) { return BB.second.isPoisoned(); });
139  }
140 
141  static void printDiff(raw_ostream &out, const CFG &Before,
142  const CFG &After);
143  bool invalidate(Function &F, const PreservedAnalyses &PA,
145  };
146 
147 #ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
148  SmallVector<StringRef, 8> PassStack;
149 #endif
150 
154 };
155 
156 // Base class for classes that report changes to the IR.
157 // It presents an interface for such classes and provides calls
158 // on various events as the new pass manager transforms the IR.
159 // It also provides filtering of information based on hidden options
160 // specifying which functions are interesting.
161 // Calls are made for the following events/queries:
162 // 1. The initial IR processed.
163 // 2. To get the representation of the IR (of type \p T).
164 // 3. When a pass does not change the IR.
165 // 4. When a pass changes the IR (given both before and after representations
166 // of type \p T).
167 // 5. When an IR is invalidated.
168 // 6. When a pass is run on an IR that is not interesting (based on options).
169 // 7. When a pass is ignored (pass manager or adapter pass).
170 // 8. To compare two IR representations (of type \p T).
171 template <typename IRUnitT> class ChangeReporter {
172 protected:
173  ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
174 
175 public:
176  virtual ~ChangeReporter();
177 
178  // Determine if this pass/IR is interesting and if so, save the IR
179  // otherwise it is left on the stack without data.
180  void saveIRBeforePass(Any IR, StringRef PassID);
181  // Compare the IR from before the pass after the pass.
182  void handleIRAfterPass(Any IR, StringRef PassID);
183  // Handle the situation where a pass is invalidated.
184  void handleInvalidatedPass(StringRef PassID);
185 
186 protected:
187  // Register required callbacks.
189 
190  // Called on the first IR processed.
191  virtual void handleInitialIR(Any IR) = 0;
192  // Called before and after a pass to get the representation of the IR.
193  virtual void generateIRRepresentation(Any IR, StringRef PassID,
194  IRUnitT &Output) = 0;
195  // Called when the pass is not iteresting.
196  virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
197  // Called when an interesting IR has changed.
198  virtual void handleAfter(StringRef PassID, std::string &Name,
199  const IRUnitT &Before, const IRUnitT &After,
200  Any) = 0;
201  // Called when an interesting pass is invalidated.
202  virtual void handleInvalidated(StringRef PassID) = 0;
203  // Called when the IR or pass is not interesting.
204  virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
205  // Called when an ignored pass is encountered.
206  virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
207 
208  // Stack of IRs before passes.
209  std::vector<IRUnitT> BeforeStack;
210  // Is this the first IR seen?
211  bool InitialIR = true;
212 
213  // Run in verbose mode, printing everything?
214  const bool VerboseMode;
215 };
216 
217 // An abstract template base class that handles printing banners and
218 // reporting when things have not changed or are filtered out.
219 template <typename IRUnitT>
220 class TextChangeReporter : public ChangeReporter<IRUnitT> {
221 protected:
223 
224  // Print a module dump of the first IR that is changed.
225  void handleInitialIR(Any IR) override;
226  // Report that the IR was omitted because it did not change.
227  void omitAfter(StringRef PassID, std::string &Name) override;
228  // Report that the pass was invalidated.
229  void handleInvalidated(StringRef PassID) override;
230  // Report that the IR was filtered out.
231  void handleFiltered(StringRef PassID, std::string &Name) override;
232  // Report that the pass was ignored.
233  void handleIgnored(StringRef PassID, std::string &Name) override;
234  // Make substitutions in \p S suitable for reporting changes
235  // after the pass and then print it.
236 
238 };
239 
240 // A change printer based on the string representation of the IR as created
241 // by unwrapAndPrint. The string representation is stored in a std::string
242 // to preserve it as the IR changes in each pass. Note that the banner is
243 // included in this representation but it is massaged before reporting.
244 class IRChangedPrinter : public TextChangeReporter<std::string> {
245 public:
248  ~IRChangedPrinter() override;
250 
251 protected:
252  // Called before and after a pass to get the representation of the IR.
254  std::string &Output) override;
255  // Called when an interesting IR has changed.
256  void handleAfter(StringRef PassID, std::string &Name,
257  const std::string &Before, const std::string &After,
258  Any) override;
259 };
260 
261 // Information that needs to be saved for a basic block in order to compare
262 // before and after the pass to determine if it was changed by a pass.
263 template <typename T> class BlockDataT {
264 public:
265  BlockDataT(const BasicBlock &B) : Label(B.getName().str()), Data(B) {
267  B.print(SS, nullptr, true, true);
268  }
269 
270  bool operator==(const BlockDataT &That) const { return Body == That.Body; }
271  bool operator!=(const BlockDataT &That) const { return Body != That.Body; }
272 
273  // Return the label of the represented basic block.
274  StringRef getLabel() const { return Label; }
275  // Return the string representation of the basic block.
276  StringRef getBody() const { return Body; }
277 
278  // Return the associated data
279  const T &getData() const { return Data; }
280 
281 protected:
282  std::string Label;
283  std::string Body;
284 
285  // Extra data associated with a basic block
287 };
288 
289 template <typename T> class OrderedChangedData {
290 public:
291  // Return the names in the order they were saved
292  std::vector<std::string> &getOrder() { return Order; }
293  const std::vector<std::string> &getOrder() const { return Order; }
294 
295  // Return a map of names to saved representations
296  StringMap<T> &getData() { return Data; }
297  const StringMap<T> &getData() const { return Data; }
298 
299  bool operator==(const OrderedChangedData<T> &That) const {
300  return Data == That.getData();
301  }
302 
303  // Call the lambda \p HandlePair on each corresponding pair of data from
304  // \p Before and \p After. The order is based on the order in \p After
305  // with ones that are only in \p Before interspersed based on where they
306  // occur in \p Before. This is used to present the output in an order
307  // based on how the data is ordered in LLVM.
308  static void report(const OrderedChangedData &Before,
309  const OrderedChangedData &After,
310  function_ref<void(const T *, const T *)> HandlePair);
311 
312 protected:
313  std::vector<std::string> Order;
315 };
316 
317 // Do not need extra information for patch-style change reporter.
318 class EmptyData {
319 public:
320  EmptyData(const BasicBlock &) {}
321 };
322 
323 // The data saved for comparing functions.
324 template <typename T>
325 class FuncDataT : public OrderedChangedData<BlockDataT<T>> {
326 public:
327  FuncDataT(std::string S) : EntryBlockName(S) {}
328 
329  // Return the name of the entry block
330  std::string getEntryBlockName() const { return EntryBlockName; }
331 
332 protected:
333  std::string EntryBlockName;
334 };
335 
336 // The data saved for comparing IRs.
337 template <typename T>
338 class IRDataT : public OrderedChangedData<FuncDataT<T>> {};
339 
340 // Abstract template base class for a class that compares two IRs. The
341 // class is created with the 2 IRs to compare and then compare is called.
342 // The static function analyzeIR is used to build up the IR representation.
343 template <typename T> class IRComparer {
344 public:
346  : Before(Before), After(After) {}
347 
348  // Compare the 2 IRs. \p handleFunctionCompare is called to handle the
349  // compare of a function. When \p InModule is set,
350  // this function is being handled as part of comparing a module.
351  void compare(
352  bool CompareModule,
353  std::function<void(bool InModule, unsigned Minor,
354  const FuncDataT<T> &Before, const FuncDataT<T> &After)>
355  CompareFunc);
356 
357  // Analyze \p IR and build the IR representation in \p Data.
358  static void analyzeIR(Any IR, IRDataT<T> &Data);
359 
360 protected:
361  // Generate the data for \p F into \p Data.
362  static bool generateFunctionData(IRDataT<T> &Data, const Function &F);
363 
366 };
367 
368 // A change printer that prints out in-line differences in the basic
369 // blocks. It uses an InlineComparer to do the comparison so it shows
370 // the differences prefixed with '-' and '+' for code that is removed
371 // and added, respectively. Changes to the IR that do not affect basic
372 // blocks are not reported as having changed the IR. The option
373 // -print-module-scope does not affect this change reporter.
374 class InLineChangePrinter : public TextChangeReporter<IRDataT<EmptyData>> {
375 public:
376  InLineChangePrinter(bool VerboseMode, bool ColourMode)
378  UseColour(ColourMode) {}
379  ~InLineChangePrinter() override;
381 
382 protected:
383  // Create a representation of the IR.
384  virtual void generateIRRepresentation(Any IR, StringRef PassID,
385  IRDataT<EmptyData> &Output) override;
386 
387  // Called when an interesting IR has changed.
388  virtual void handleAfter(StringRef PassID, std::string &Name,
389  const IRDataT<EmptyData> &Before,
390  const IRDataT<EmptyData> &After, Any) override;
391 
393  StringRef Divider, bool InModule, unsigned Minor,
394  const FuncDataT<EmptyData> &Before,
395  const FuncDataT<EmptyData> &After);
396 
397  bool UseColour;
398 };
399 
401  bool DebugLogging;
402 
403 public:
404  VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
406 };
407 
408 // Class that holds transitions between basic blocks. The transitions
409 // are contained in a map of values to names of basic blocks.
410 class DCData {
411 public:
412  // Fill the map with the transitions from basic block \p B.
413  DCData(const BasicBlock &B);
414 
415  // Return an iterator to the names of the successor blocks.
417  return Successors.begin();
418  }
420  return Successors.end();
421  }
422 
423  // Return the label of the basic block reached on a transition on \p S.
425  assert(Successors.count(S) == 1 && "Expected to find successor.");
426  return Successors.find(S)->getValue();
427  }
428 
429 protected:
430  // Add a transition to \p Succ on \p Label
432  std::pair<std::string, std::string> SS{Succ.str(), Label.str()};
434  }
435 
437 };
438 
439 // A change reporter that builds a website with links to pdf files showing
440 // dot control flow graphs with changed instructions shown in colour.
441 class DotCfgChangeReporter : public ChangeReporter<IRDataT<DCData>> {
442 public:
444  ~DotCfgChangeReporter() override;
446 
447 protected:
448  // Initialize the HTML file and output the header.
449  bool initializeHTML();
450 
451  // Called on the first IR processed.
452  void handleInitialIR(Any IR) override;
453  // Called before and after a pass to get the representation of the IR.
455  IRDataT<DCData> &Output) override;
456  // Called when the pass is not iteresting.
457  void omitAfter(StringRef PassID, std::string &Name) override;
458  // Called when an interesting IR has changed.
459  void handleAfter(StringRef PassID, std::string &Name,
460  const IRDataT<DCData> &Before, const IRDataT<DCData> &After,
461  Any) override;
462  // Called when an interesting pass is invalidated.
463  void handleInvalidated(StringRef PassID) override;
464  // Called when the IR or pass is not interesting.
465  void handleFiltered(StringRef PassID, std::string &Name) override;
466  // Called when an ignored pass is encountered.
467  void handleIgnored(StringRef PassID, std::string &Name) override;
468 
469  // Generate the pdf file into \p Dir / \p PDFFileName using \p DotFile as
470  // input and return the html <a> tag with \Text as the content.
471  static std::string genHTML(StringRef Text, StringRef DotFile,
472  StringRef PDFFileName);
473 
475  StringRef Divider, bool InModule, unsigned Minor,
476  const FuncDataT<DCData> &Before,
477  const FuncDataT<DCData> &After);
478 
479  unsigned N = 0;
480  std::unique_ptr<raw_fd_ostream> HTML;
481 };
482 
483 /// This class provides an interface to register all the standard pass
484 /// instrumentations and manages their state (if any).
486  PrintIRInstrumentation PrintIR;
487  PrintPassInstrumentation PrintPass;
488  TimePassesHandler TimePasses;
489  OptNoneInstrumentation OptNone;
491  PreservedCFGCheckerInstrumentation PreservedCFGChecker;
492  IRChangedPrinter PrintChangedIR;
493  PseudoProbeVerifier PseudoProbeVerification;
494  InLineChangePrinter PrintChangedDiff;
495  DotCfgChangeReporter WebsiteChangeReporter;
496  VerifyInstrumentation Verify;
497 
498  bool VerifyEach;
499 
500 public:
501  StandardInstrumentations(bool DebugLogging, bool VerifyEach = false,
502  PrintPassOptions PrintPassOpts = PrintPassOptions());
503 
504  // Register all the standard instrumentation callbacks. If \p FAM is nullptr
505  // then PreservedCFGChecker is not enabled.
507  FunctionAnalysisManager *FAM = nullptr);
508 
509  TimePassesHandler &getTimePasses() { return TimePasses; }
510 };
511 
512 extern template class ChangeReporter<std::string>;
513 extern template class TextChangeReporter<std::string>;
514 
515 extern template class BlockDataT<EmptyData>;
516 extern template class FuncDataT<EmptyData>;
517 extern template class IRDataT<EmptyData>;
518 extern template class ChangeReporter<IRDataT<EmptyData>>;
519 extern template class TextChangeReporter<IRDataT<EmptyData>>;
520 extern template class IRComparer<EmptyData>;
521 
522 } // namespace llvm
523 
524 #endif
llvm::OrderedChangedData
Definition: StandardInstrumentations.h:289
llvm::BlockDataT::getData
const T & getData() const
Definition: StandardInstrumentations.h:279
llvm::BlockDataT::getLabel
StringRef getLabel() const
Definition: StandardInstrumentations.h:274
llvm::InLineChangePrinter::~InLineChangePrinter
~InLineChangePrinter() override
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm::ChangeReporter::omitAfter
virtual void omitAfter(StringRef PassID, std::string &Name)=0
llvm::IRDataT
Definition: StandardInstrumentations.h:338
llvm::ChangeReporter::ChangeReporter
ChangeReporter(bool RunInVerboseMode)
Definition: StandardInstrumentations.h:173
llvm::IRComparer::generateFunctionData
static bool generateFunctionData(IRDataT< T > &Data, const Function &F)
Definition: StandardInstrumentations.cpp:738
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm::PreservedCFGCheckerInstrumentation::BBGuard::isPoisoned
bool isPoisoned() const
Definition: StandardInstrumentations.h:114
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::CallbackVH::deleted
virtual void deleted()
Callback for Value destruction.
Definition: ValueHandle.h:414
llvm::DotCfgChangeReporter::~DotCfgChangeReporter
~DotCfgChangeReporter() override
Definition: StandardInstrumentations.cpp:2063
llvm::BlockDataT::operator!=
bool operator!=(const BlockDataT &That) const
Definition: StandardInstrumentations.h:271
llvm::ChangeReporter::handleFiltered
virtual void handleFiltered(StringRef PassID, std::string &Name)=0
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:160
llvm::OrderedChangedData::getOrder
std::vector< std::string > & getOrder()
Definition: StandardInstrumentations.h:292
llvm::Function
Definition: Function.h:60
StringRef.h
llvm::TextChangeReporter::handleIgnored
void handleIgnored(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:584
llvm::X86AS::SS
@ SS
Definition: X86.h:189
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:632
llvm::TextChangeReporter::TextChangeReporter
TextChangeReporter(bool Verbose)
Definition: StandardInstrumentations.cpp:552
llvm::InlinerFunctionImportStatsOpts::Verbose
@ Verbose
llvm::SmallVector< PrintModuleDesc, 2 >
llvm::DotCfgChangeReporter::generateIRRepresentation
void generateIRRepresentation(Any IR, StringRef PassID, IRDataT< DCData > &Output) override
Definition: StandardInstrumentations.cpp:1972
llvm::DotCfgChangeReporter::handleFunctionCompare
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< DCData > &Before, const FuncDataT< DCData > &After)
Definition: StandardInstrumentations.cpp:1887
llvm::TextChangeReporter::handleInitialIR
void handleInitialIR(Any IR) override
Definition: StandardInstrumentations.cpp:555
llvm::PrintPassInstrumentation::PrintPassInstrumentation
PrintPassInstrumentation(bool Enabled, PrintPassOptions Opts)
Definition: StandardInstrumentations.h:96
llvm::StandardInstrumentations::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC, FunctionAnalysisManager *FAM=nullptr)
Definition: StandardInstrumentations.cpp:2118
llvm::DotCfgChangeReporter::DotCfgChangeReporter
DotCfgChangeReporter(bool Verbose)
Definition: StandardInstrumentations.cpp:1884
llvm::OptNoneInstrumentation::OptNoneInstrumentation
OptNoneInstrumentation(bool DebugLogging)
Definition: StandardInstrumentations.h:68
llvm::PrintIRInstrumentation::~PrintIRInstrumentation
~PrintIRInstrumentation()
Definition: StandardInstrumentations.cpp:752
llvm::BlockDataT::BlockDataT
BlockDataT(const BasicBlock &B)
Definition: StandardInstrumentations.h:265
llvm::PreservedCFGCheckerInstrumentation
Definition: StandardInstrumentations.h:106
llvm::InLineChangePrinter::handleFunctionCompare
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< EmptyData > &Before, const FuncDataT< EmptyData > &After)
Definition: StandardInstrumentations.cpp:1232
llvm::DCData::end
StringMap< std::string >::const_iterator end() const
Definition: StandardInstrumentations.h:419
llvm::DotCfgChangeReporter::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:2088
FAM
FunctionAnalysisManager FAM
Definition: PassBuilderBindings.cpp:59
llvm::DotCfgChangeReporter::omitAfter
void omitAfter(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:1977
llvm::StringMap::end
iterator end()
Definition: StringMap.h:205
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:596
llvm::DotCfgChangeReporter::handleInitialIR
void handleInitialIR(Any IR) override
Definition: StandardInstrumentations.cpp:1948
PIC
PassInstrumentationCallbacks PIC
Definition: PassBuilderBindings.cpp:55
OptBisect.h
llvm::ValueHandleBase::getValPtr
Value * getValPtr() const
Definition: ValueHandle.h:99
llvm::PrintPassInstrumentation
Definition: StandardInstrumentations.h:92
llvm::Optional
Definition: APInt.h:33
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::IRComparer::IRComparer
IRComparer(const IRDataT< T > &Before, const IRDataT< T > &After)
Definition: StandardInstrumentations.h:345
llvm::TextChangeReporter::handleInvalidated
void handleInvalidated(StringRef PassID) override
Definition: StandardInstrumentations.cpp:571
STLExtras.h
llvm::InLineChangePrinter::generateIRRepresentation
virtual void generateIRRepresentation(Any IR, StringRef PassID, IRDataT< EmptyData > &Output) override
Definition: StandardInstrumentations.cpp:1210
llvm::StringMap::find
iterator find(StringRef Key)
Definition: StringMap.h:218
llvm::PreservedCFGCheckerInstrumentation::CFG::printDiff
static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After)
Definition: StandardInstrumentations.cpp:1012
llvm::StandardInstrumentations::StandardInstrumentations
StandardInstrumentations(bool DebugLogging, bool VerifyEach=false, PrintPassOptions PrintPassOpts=PrintPassOptions())
Definition: StandardInstrumentations.cpp:2105
llvm::ChangeReporter::saveIRBeforePass
void saveIRBeforePass(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:473
llvm::OrderedChangedData::Data
StringMap< T > Data
Definition: StandardInstrumentations.h:314
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::ChangeReporter::handleIgnored
virtual void handleIgnored(StringRef PassID, std::string &Name)=0
llvm::PreservedCFGCheckerInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC, FunctionAnalysisManager &FAM)
Definition: StandardInstrumentations.cpp:1106
llvm::ChangeReporter::registerRequiredCallbacks
void registerRequiredCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:536
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::FuncDataT::getEntryBlockName
std::string getEntryBlockName() const
Definition: StandardInstrumentations.h:330
llvm::IRChangedPrinter::IRChangedPrinter
IRChangedPrinter(bool VerboseMode)
Definition: StandardInstrumentations.h:246
llvm::ChangeReporter::BeforeStack
std::vector< IRUnitT > BeforeStack
Definition: StandardInstrumentations.h:209
PassTimingInfo.h
CommandLine.h
llvm::TextChangeReporter::Out
raw_ostream & Out
Definition: StandardInstrumentations.h:237
llvm::IRComparer::compare
void compare(bool CompareModule, std::function< void(bool InModule, unsigned Minor, const FuncDataT< T > &Before, const FuncDataT< T > &After)> CompareFunc)
Definition: StandardInstrumentations.cpp:690
llvm::PrintPassOptions::SkipAnalyses
bool SkipAnalyses
Don't print information for analyses.
Definition: StandardInstrumentations.h:86
llvm::PrintIRInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:851
llvm::DCData::DCData
DCData(const BasicBlock &B)
Definition: StandardInstrumentations.cpp:1861
llvm::OptNoneInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:873
llvm::OrderedChangedData::operator==
bool operator==(const OrderedChangedData< T > &That) const
Definition: StandardInstrumentations.h:299
llvm::DotCfgChangeReporter::genHTML
static std::string genHTML(StringRef Text, StringRef DotFile, StringRef PDFFileName)
Definition: StandardInstrumentations.cpp:1929
llvm::FuncDataT
Definition: StandardInstrumentations.h:325
llvm::StandardInstrumentations::getTimePasses
TimePassesHandler & getTimePasses()
Definition: StandardInstrumentations.h:509
llvm::PrintPassOptions
Definition: StandardInstrumentations.h:82
llvm::OptBisect
This class implements a mechanism to disable passes and individual optimizations at compile time base...
Definition: OptBisect.h:45
llvm::PseudoProbeVerifier
Definition: SampleProfileProbe.h:61
llvm::OrderedChangedData::getData
StringMap< T > & getData()
Definition: StandardInstrumentations.h:296
llvm::StringMap::insert
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:276
llvm::VerifyInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:1172
llvm::DotCfgChangeReporter
Definition: StandardInstrumentations.h:441
llvm::InLineChangePrinter::InLineChangePrinter
InLineChangePrinter(bool VerboseMode, bool ColourMode)
Definition: StandardInstrumentations.h:376
llvm::DCData::Successors
StringMap< std::string > Successors
Definition: StandardInstrumentations.h:436
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::FuncDataT::FuncDataT
FuncDataT(std::string S)
Definition: StandardInstrumentations.h:327
llvm::OrderedChangedData::report
static void report(const OrderedChangedData &Before, const OrderedChangedData &After, function_ref< void(const T *, const T *)> HandlePair)
Definition: StandardInstrumentations.cpp:622
llvm::DCData::getSuccessorLabel
StringRef getSuccessorLabel(StringRef S) const
Definition: StandardInstrumentations.h:424
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::PreservedCFGCheckerInstrumentation::BBGuard::BBGuard
BBGuard(const BasicBlock *BB)
Definition: StandardInstrumentations.h:111
llvm::IRComparer::After
const IRDataT< T > & After
Definition: StandardInstrumentations.h:365
llvm::BlockDataT
Definition: StandardInstrumentations.h:263
IR
Statically lint checks LLVM IR
Definition: Lint.cpp:745
llvm::DotCfgChangeReporter::N
unsigned N
Definition: StandardInstrumentations.h:479
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:667
llvm::ChangeReporter::handleInitialIR
virtual void handleInitialIR(Any IR)=0
llvm::StringRef::str
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:245
llvm::PrintPassOptions::Indent
bool Indent
Indent based on hierarchy.
Definition: StandardInstrumentations.h:88
llvm::DotCfgChangeReporter::handleAfter
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< DCData > &Before, const IRDataT< DCData > &After, Any) override
Definition: StandardInstrumentations.cpp:1986
llvm::DCData::addSuccessorLabel
void addSuccessorLabel(StringRef Succ, StringRef Label)
Definition: StandardInstrumentations.h:431
llvm::StringMap< T >
llvm::DotCfgChangeReporter::handleIgnored
void handleIgnored(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:2019
llvm::ChangeReporter::~ChangeReporter
virtual ~ChangeReporter()
Definition: StandardInstrumentations.cpp:468
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::PrintIRInstrumentation
Instrumentation to print IR before/after passes.
Definition: StandardInstrumentations.h:41
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
BasicBlock.h
llvm::cl::opt< bool >
llvm::ChangeReporter
Definition: StandardInstrumentations.h:171
llvm::PreservedCFGCheckerInstrumentation::BBGuard::deleted
void deleted() override
Callback for Value destruction.
Definition: StandardInstrumentations.h:112
llvm::OptNoneInstrumentation
Definition: StandardInstrumentations.h:66
llvm::StandardInstrumentations
This class provides an interface to register all the standard pass instrumentations and manages their...
Definition: StandardInstrumentations.h:485
llvm::IRChangedPrinter
Definition: StandardInstrumentations.h:244
llvm::TextChangeReporter::handleFiltered
void handleFiltered(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:576
llvm::DenseMap
Definition: DenseMap.h:716
llvm::TextChangeReporter
Definition: StandardInstrumentations.h:220
llvm::EmptyData
Definition: StandardInstrumentations.h:318
llvm::BlockDataT::Label
std::string Label
Definition: StandardInstrumentations.h:282
llvm::FuncDataT::EntryBlockName
std::string EntryBlockName
Definition: StandardInstrumentations.h:333
llvm::PreservedCFGCheckerInstrumentation::CFG::BBGuards
Optional< DenseMap< intptr_t, BBGuard > > BBGuards
Definition: StandardInstrumentations.h:126
llvm::BlockDataT::getBody
StringRef getBody() const
Definition: StandardInstrumentations.h:276
llvm::StringMap::begin
iterator begin()
Definition: StringMap.h:204
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ChangeReporter::handleIRAfterPass
void handleIRAfterPass(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:494
llvm::IRComparer::analyzeIR
static void analyzeIR(Any IR, IRDataT< T > &Data)
Definition: StandardInstrumentations.cpp:717
llvm::DotCfgChangeReporter::initializeHTML
bool initializeHTML()
Definition: StandardInstrumentations.cpp:2027
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::PreservedCFGCheckerInstrumentation::CFG::invalidate
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Definition: StandardInstrumentations.cpp:1098
SampleProfileProbe.h
llvm::PreservedCFGCheckerInstrumentation::CFG
Definition: StandardInstrumentations.h:125
llvm::InLineChangePrinter::UseColour
bool UseColour
Definition: StandardInstrumentations.h:397
llvm::IRChangedPrinter::handleAfter
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, Any) override
Definition: StandardInstrumentations.cpp:603
llvm::InLineChangePrinter
Definition: StandardInstrumentations.h:374
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:1612
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:135
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::PreservedCFGCheckerInstrumentation::BBGuard::allUsesReplacedWith
void allUsesReplacedWith(Value *) override
Callback for Value RAUW.
Definition: StandardInstrumentations.h:113
ValueHandle.h
llvm::PreservedCFGCheckerInstrumentation::CFG::operator==
bool operator==(const CFG &G) const
Definition: StandardInstrumentations.h:131
llvm::VerifyInstrumentation
Definition: StandardInstrumentations.h:400
llvm::PrintPassOptions::Verbose
bool Verbose
Print adaptors and pass managers.
Definition: StandardInstrumentations.h:84
llvm::InLineChangePrinter::handleAfter
virtual void handleAfter(StringRef PassID, std::string &Name, const IRDataT< EmptyData > &Before, const IRDataT< EmptyData > &After, Any) override
Definition: StandardInstrumentations.cpp:1215
llvm::OptBisectInstrumentation::OptBisectInstrumentation
OptBisectInstrumentation()=default
llvm::Any
Definition: Any.h:28
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
std
Definition: BitVector.h:851
llvm::EmptyData::EmptyData
EmptyData(const BasicBlock &)
Definition: StandardInstrumentations.h:320
llvm::IRComparer::Before
const IRDataT< T > & Before
Definition: StandardInstrumentations.h:364
llvm::DotCfgChangeReporter::handleInvalidated
void handleInvalidated(StringRef PassID) override
Definition: StandardInstrumentations.cpp:2002
llvm::TextChangeReporter::omitAfter
void omitAfter(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:565
llvm::InLineChangePrinter::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:1253
llvm::OrderedChangedData::getOrder
const std::vector< std::string > & getOrder() const
Definition: StandardInstrumentations.h:293
llvm::StringMap::count
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition: StringMap.h:246
llvm::OptBisectInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:894
llvm::PreservedCFGCheckerInstrumentation::BBGuard
Definition: StandardInstrumentations.h:110
llvm::CallbackVH
Value handle with callbacks on RAUW and destruction.
Definition: ValueHandle.h:383
llvm::BlockDataT::Data
T Data
Definition: StandardInstrumentations.h:286
llvm::ChangeReporter::handleInvalidated
virtual void handleInvalidated(StringRef PassID)=0
llvm::ChangeReporter::handleInvalidatedPass
void handleInvalidatedPass(StringRef PassID)
Definition: StandardInstrumentations.cpp:523
llvm::PreservedCFGCheckerInstrumentation::CFG::CFG
CFG(const Function *F, bool TrackBBLifetime)
Definition: StandardInstrumentations.cpp:971
llvm::ChangeReporter::InitialIR
bool InitialIR
Definition: StandardInstrumentations.h:211
SmallVector.h
llvm::BlockDataT::Body
std::string Body
Definition: StandardInstrumentations.h:283
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:214
llvm::DCData::begin
StringMap< std::string >::const_iterator begin() const
Definition: StandardInstrumentations.h:416
llvm::BlockDataT::operator==
bool operator==(const BlockDataT &That) const
Definition: StandardInstrumentations.h:270
llvm::DCData
Definition: StandardInstrumentations.h:410
llvm::TimePassesHandler
This class implements -time-passes functionality for new pass manager.
Definition: PassTimingInfo.h:44
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::IRChangedPrinter::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:590
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:76
llvm::IRChangedPrinter::~IRChangedPrinter
~IRChangedPrinter() override
llvm::DotCfgChangeReporter::HTML
std::unique_ptr< raw_fd_ostream > HTML
Definition: StandardInstrumentations.h:480
llvm::IRComparer
Definition: StandardInstrumentations.h:343
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::OrderedChangedData::getData
const StringMap< T > & getData() const
Definition: StandardInstrumentations.h:297
llvm::DotCfgChangeReporter::handleFiltered
void handleFiltered(StringRef PassID, std::string &Name) override
Definition: StandardInstrumentations.cpp:2010
llvm::OrderedChangedData::Order
std::vector< std::string > Order
Definition: StandardInstrumentations.h:313
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::PreservedCFGCheckerInstrumentation::CFG::Graph
DenseMap< const BasicBlock *, DenseMap< const BasicBlock *, unsigned > > Graph
Definition: StandardInstrumentations.h:127
llvm::VerifyInstrumentation::VerifyInstrumentation
VerifyInstrumentation(bool DebugLogging)
Definition: StandardInstrumentations.h:404
llvm::PrintPassInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:911
SpecialSubKind::string
@ string
llvm::PreservedCFGCheckerInstrumentation::VerifyPreservedCFG
static cl::opt< bool > VerifyPreservedCFG
Definition: StandardInstrumentations.h:151