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