LLVM  14.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:
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  // Return true when this is a defined function for which printing
191  // of changes is desired.
192  bool isInterestingFunction(const Function &F);
193 
194  // Return true when this is a pass for which printing of changes is desired.
195  bool isInterestingPass(StringRef PassID);
196 
197  // Return true when this is a pass on IR for which printing
198  // of changes is desired.
199  bool isInteresting(Any IR, StringRef PassID);
200 
201  // Called on the first IR processed.
202  virtual void handleInitialIR(Any IR) = 0;
203  // Called before and after a pass to get the representation of the IR.
204  virtual void generateIRRepresentation(Any IR, StringRef PassID,
205  IRUnitT &Output) = 0;
206  // Called when the pass is not iteresting.
207  virtual void omitAfter(StringRef PassID, std::string &Name) = 0;
208  // Called when an interesting IR has changed.
209  virtual void handleAfter(StringRef PassID, std::string &Name,
210  const IRUnitT &Before, const IRUnitT &After,
211  Any) = 0;
212  // Called when an interesting pass is invalidated.
213  virtual void handleInvalidated(StringRef PassID) = 0;
214  // Called when the IR or pass is not interesting.
215  virtual void handleFiltered(StringRef PassID, std::string &Name) = 0;
216  // Called when an ignored pass is encountered.
217  virtual void handleIgnored(StringRef PassID, std::string &Name) = 0;
218  // Called to compare the before and after representations of the IR.
219  virtual bool same(const IRUnitT &Before, const IRUnitT &After) = 0;
220 
221  // Stack of IRs before passes.
222  std::vector<IRUnitT> BeforeStack;
223  // Is this the first IR seen?
224  bool InitialIR = true;
225 
226  // Run in verbose mode, printing everything?
227  const bool VerboseMode;
228 };
229 
230 // An abstract template base class that handles printing banners and
231 // reporting when things have not changed or are filtered out.
232 template <typename IRUnitT>
233 class TextChangeReporter : public ChangeReporter<IRUnitT> {
234 protected:
236 
237  // Print a module dump of the first IR that is changed.
238  void handleInitialIR(Any IR) override;
239  // Report that the IR was omitted because it did not change.
240  void omitAfter(StringRef PassID, std::string &Name) override;
241  // Report that the pass was invalidated.
242  void handleInvalidated(StringRef PassID) override;
243  // Report that the IR was filtered out.
244  void handleFiltered(StringRef PassID, std::string &Name) override;
245  // Report that the pass was ignored.
246  void handleIgnored(StringRef PassID, std::string &Name) override;
247  // Make substitutions in \p S suitable for reporting changes
248  // after the pass and then print it.
249 
251 };
252 
253 // A change printer based on the string representation of the IR as created
254 // by unwrapAndPrint. The string representation is stored in a std::string
255 // to preserve it as the IR changes in each pass. Note that the banner is
256 // included in this representation but it is massaged before reporting.
257 class IRChangedPrinter : public TextChangeReporter<std::string> {
258 public:
261  ~IRChangedPrinter() override;
263 
264 protected:
265  // Called before and after a pass to get the representation of the IR.
267  std::string &Output) override;
268  // Called when an interesting IR has changed.
269  void handleAfter(StringRef PassID, std::string &Name,
270  const std::string &Before, const std::string &After,
271  Any) override;
272  // Called to compare the before and after representations of the IR.
273  bool same(const std::string &Before, const std::string &After) override;
274 };
275 
276 // The following classes hold a representation of the IR for a change
277 // reporter that uses string comparisons of the basic blocks
278 // that are created using print (ie, similar to dump()).
279 // These classes respect the filtering of passes and functions using
280 // -filter-passes and -filter-print-funcs.
281 //
282 // Information that needs to be saved for a basic block in order to compare
283 // before and after the pass to determine if it was changed by a pass.
285 public:
286  ChangedBlockData(const BasicBlock &B);
287 
288  bool operator==(const ChangedBlockData &That) const {
289  return Body == That.Body;
290  }
291  bool operator!=(const ChangedBlockData &That) const {
292  return Body != That.Body;
293  }
294 
295  // Return the label of the represented basic block.
296  StringRef getLabel() const { return Label; }
297  // Return the string representation of the basic block.
298  StringRef getBody() const { return Body; }
299 
300 protected:
301  std::string Label;
302  std::string Body;
303 };
304 
305 template <typename IRData> class OrderedChangedData {
306 public:
307  // Return the names in the order they were saved
308  std::vector<std::string> &getOrder() { return Order; }
309  const std::vector<std::string> &getOrder() const { return Order; }
310 
311  // Return a map of names to saved representations
313  const StringMap<IRData> &getData() const { return Data; }
314 
315  bool operator==(const OrderedChangedData<IRData> &That) const {
316  return Data == That.getData();
317  }
318 
319  // Call the lambda \p HandlePair on each corresponding pair of data from
320  // \p Before and \p After. The order is based on the order in \p After
321  // with ones that are only in \p Before interspersed based on where they
322  // occur in \p Before. This is used to present the output in an order
323  // based on how the data is ordered in LLVM.
324  static void
325  report(const OrderedChangedData &Before, const OrderedChangedData &After,
326  function_ref<void(const IRData *, const IRData *)> HandlePair);
327 
328 protected:
329  std::vector<std::string> Order;
331 };
332 
333 // The data saved for comparing functions.
335 
336 // A map of names to the saved data.
338 
339 // A class that compares two IRs and does a diff between them. The
340 // added lines are prefixed with a '+', the removed lines are prefixed
341 // with a '-' and unchanged lines are prefixed with a space (to have
342 // things line up).
344 public:
346  const ChangedIRData &After, bool ColourMode)
347  : Before(Before), After(After), Out(OS), UseColour(ColourMode) {}
348 
349  // Compare the 2 IRs.
351 
352  // Analyze \p IR and build the IR representation in \p Data.
353  static void analyzeIR(Any IR, ChangedIRData &Data);
354 
355 protected:
356  // Return the module when that is the appropriate level of
357  // comparison for \p IR.
358  static const Module *getModuleForComparison(Any IR);
359 
360  // Generate the data for \p F into \p Data.
361  static bool generateFunctionData(ChangedIRData &Data, const Function &F);
362 
363  // Called to handle the compare of a function. When \p InModule is set,
364  // this function is being handled as part of comparing a module.
366  bool InModule, const ChangedFuncData &Before,
367  const ChangedFuncData &After);
368 
372  bool UseColour;
373 };
374 
375 // A change printer that prints out in-line differences in the basic
376 // blocks. It uses an InlineComparer to do the comparison so it shows
377 // the differences prefixed with '-' and '+' for code that is removed
378 // and added, respectively. Changes to the IR that do not affect basic
379 // blocks are not reported as having changed the IR. The option
380 // -print-module-scope does not affect this change reporter.
381 class InLineChangePrinter : public TextChangeReporter<ChangedIRData> {
382 public:
383  InLineChangePrinter(bool VerboseMode, bool ColourMode)
385  ~InLineChangePrinter() override;
387 
388 protected:
389  // Create a representation of the IR.
390  virtual void generateIRRepresentation(Any IR, StringRef PassID,
391  ChangedIRData &Output) override;
392 
393  // Called when an interesting IR has changed.
394  virtual void handleAfter(StringRef PassID, std::string &Name,
395  const ChangedIRData &Before,
396  const ChangedIRData &After, Any) override;
397  // Called to compare the before and after representations of the IR.
398  virtual bool same(const ChangedIRData &Before,
399  const ChangedIRData &After) override;
400 
401  bool UseColour;
402 };
403 
405  bool DebugLogging;
406 
407 public:
408  VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
410 };
411 
412 /// This class provides an interface to register all the standard pass
413 /// instrumentations and manages their state (if any).
415  PrintIRInstrumentation PrintIR;
416  PrintPassInstrumentation PrintPass;
417  TimePassesHandler TimePasses;
418  OptNoneInstrumentation OptNone;
420  PreservedCFGCheckerInstrumentation PreservedCFGChecker;
421  IRChangedPrinter PrintChangedIR;
422  PseudoProbeVerifier PseudoProbeVerification;
423  InLineChangePrinter PrintChangedDiff;
424  VerifyInstrumentation Verify;
425 
426  bool VerifyEach;
427 
428 public:
429  StandardInstrumentations(bool DebugLogging, bool VerifyEach = false,
430  PrintPassOptions PrintPassOpts = PrintPassOptions());
431 
432  // Register all the standard instrumentation callbacks. If \p FAM is nullptr
433  // then PreservedCFGChecker is not enabled.
435  FunctionAnalysisManager *FAM = nullptr);
436 
437  TimePassesHandler &getTimePasses() { return TimePasses; }
438 };
439 
440 extern template class ChangeReporter<std::string>;
441 extern template class TextChangeReporter<std::string>;
442 
443 extern template class ChangeReporter<ChangedIRData>;
444 extern template class TextChangeReporter<ChangedIRData>;
445 
446 } // namespace llvm
447 
448 #endif
llvm::OrderedChangedData
Definition: StandardInstrumentations.h:305
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:173
llvm::PreservedCFGCheckerInstrumentation::BBGuard::isPoisoned
bool isPoisoned() const
Definition: StandardInstrumentations.h:114
llvm::InLineChangePrinter::handleAfter
virtual void handleAfter(StringRef PassID, std::string &Name, const ChangedIRData &Before, const ChangedIRData &After, Any) override
Definition: StandardInstrumentations.cpp:1171
llvm
---------------------— PointerInfo ------------------------------------—
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:691
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:96
llvm::OptNoneInstrumentation::OptNoneInstrumentation
OptNoneInstrumentation(bool DebugLogging)
Definition: StandardInstrumentations.h:68
llvm::PrintIRInstrumentation::~PrintIRInstrumentation
~PrintIRInstrumentation()
Definition: StandardInstrumentations.cpp:706
llvm::PreservedCFGCheckerInstrumentation
Definition: StandardInstrumentations.h:106
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:309
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:92
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:345
STLExtras.h
llvm::PreservedCFGCheckerInstrumentation::CFG::printDiff
static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After)
Definition: StandardInstrumentations.cpp:967
llvm::ChangeReporter::saveIRBeforePass
void saveIRBeforePass(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:405
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:1061
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:312
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::IRChangedPrinter::IRChangedPrinter
IRChangedPrinter(bool VerboseMode)
Definition: StandardInstrumentations.h:259
llvm::ChangeReporter::BeforeStack
std::vector< IRUnitT > BeforeStack
Definition: StandardInstrumentations.h:222
PassTimingInfo.h
CommandLine.h
llvm::TextChangeReporter::Out
raw_ostream & Out
Definition: StandardInstrumentations.h:250
llvm::PrintPassOptions::SkipAnalyses
bool SkipAnalyses
Don't print information for analyses.
Definition: StandardInstrumentations.h:86
llvm::StandardInstrumentations::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC, FunctionAnalysisManager *FAM=nullptr)
Definition: StandardInstrumentations.cpp:1226
llvm::PrintIRInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:805
llvm::OptNoneInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:827
llvm::ChangedBlockData::operator==
bool operator==(const ChangedBlockData &That) const
Definition: StandardInstrumentations.h:288
llvm::StandardInstrumentations::getTimePasses
TimePassesHandler & getTimePasses()
Definition: StandardInstrumentations.h:437
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:59
llvm::ChangedBlockData::operator!=
bool operator!=(const ChangedBlockData &That) const
Definition: StandardInstrumentations.h:291
llvm::VerifyInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:1128
llvm::InLineChangePrinter::InLineChangePrinter
InLineChangePrinter(bool VerboseMode, bool ColourMode)
Definition: StandardInstrumentations.h:383
llvm::OrderedChangedData::getOrder
std::vector< std::string > & getOrder()
Definition: StandardInstrumentations.h:308
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::OrderedChangedData::Order
std::vector< std::string > Order
Definition: StandardInstrumentations.h:329
llvm::ChangedIRComparer::getModuleForComparison
static const Module * getModuleForComparison(Any IR)
Definition: StandardInstrumentations.cpp:680
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::OrderedChangedData::operator==
bool operator==(const OrderedChangedData< IRData > &That) const
Definition: StandardInstrumentations.h:315
llvm::PreservedCFGCheckerInstrumentation::BBGuard::BBGuard
BBGuard(const BasicBlock *BB)
Definition: StandardInstrumentations.h:111
llvm::OrderedChangedData::getData
const StringMap< IRData > & getData() const
Definition: StandardInstrumentations.h:313
IR
Statically lint checks LLVM IR
Definition: Lint.cpp:744
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:666
llvm::ChangeReporter::handleInitialIR
virtual void handleInitialIR(Any IR)=0
llvm::PrintPassOptions::Indent
bool Indent
Indent based on hierarchy.
Definition: StandardInstrumentations.h:88
llvm::ChangedIRComparer::Out
raw_ostream & Out
Definition: StandardInstrumentations.h:371
llvm::InLineChangePrinter::generateIRRepresentation
virtual void generateIRRepresentation(Any IR, StringRef PassID, ChangedIRData &Output) override
Definition: StandardInstrumentations.cpp:1166
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: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:414
llvm::IRChangedPrinter
Definition: StandardInstrumentations.h:257
llvm::ChangedIRComparer::analyzeIR
static void analyzeIR(Any IR, ChangedIRData &Data)
Definition: StandardInstrumentations.cpp:660
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:233
llvm::ChangeReporter::isInteresting
bool isInteresting(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:396
llvm::ChangedIRComparer::UseColour
bool UseColour
Definition: StandardInstrumentations.h:372
llvm::PreservedCFGCheckerInstrumentation::CFG::BBGuards
Optional< DenseMap< intptr_t, BBGuard > > BBGuards
Definition: StandardInstrumentations.h:126
llvm::ChangedBlockData::getBody
StringRef getBody() const
Definition: StandardInstrumentations.h:298
llvm::ChangeReporter::handleIRAfterPass
void handleIRAfterPass(Any IR, StringRef PassID)
Definition: StandardInstrumentations.cpp:426
llvm::OptBisectInstrumentation::OptBisectInstrumentation
OptBisectInstrumentation()
Definition: StandardInstrumentations.h:78
llvm::PreservedCFGCheckerInstrumentation::CFG::invalidate
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Definition: StandardInstrumentations.cpp:1053
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:125
llvm::InLineChangePrinter::UseColour
bool UseColour
Definition: StandardInstrumentations.h:401
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:370
llvm::ChangedBlockData::getLabel
StringRef getLabel() const
Definition: StandardInstrumentations.h:296
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:381
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:1558
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
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:302
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:404
llvm::PrintPassOptions::Verbose
bool Verbose
Print adaptors and pass managers.
Definition: StandardInstrumentations.h:84
llvm::OrderedChangedData::Data
StringMap< IRData > Data
Definition: StandardInstrumentations.h:330
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:848
llvm::PreservedCFGCheckerInstrumentation::BBGuard
Definition: StandardInstrumentations.h:110
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:926
llvm::ChangeReporter::InitialIR
bool InitialIR
Definition: StandardInstrumentations.h:224
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:227
llvm::ChangedIRComparer
Definition: StandardInstrumentations.h:343
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:76
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:284
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:408
llvm::PrintPassInstrumentation::registerCallbacks
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Definition: StandardInstrumentations.cpp:865
SpecialSubKind::string
@ string
llvm::PreservedCFGCheckerInstrumentation::VerifyPreservedCFG
static cl::opt< bool > VerifyPreservedCFG
Definition: StandardInstrumentations.h:151
llvm::ChangedBlockData::Label
std::string Label
Definition: StandardInstrumentations.h:301
llvm::ChangedIRComparer::Before
const ChangedIRData & Before
Definition: StandardInstrumentations.h:369