15#ifndef LLVM_PASSES_STANDARDINSTRUMENTATIONS_H
16#define LLVM_PASSES_STANDARDINSTRUMENTATIONS_H
36class PassInstrumentationCallbacks;
51 void printAfterPassInvalidated(
StringRef PassID);
53 bool shouldPrintBeforePass(
StringRef PassID);
54 bool shouldPrintAfterPass(
StringRef PassID);
55 bool shouldPrintPassNumbers();
56 bool shouldPrintAtPassNumber();
58 using PrintModuleDesc = std::tuple<const Module *, std::string, StringRef>;
61 PrintModuleDesc popModuleDesc(
StringRef PassID);
69 unsigned CurrentPassNumber = 0;
84 bool HasWrittenIR =
false;
106 : Enabled(Enabled), Opts(Opts) {}
135 std::optional<DenseMap<intptr_t, BBGuard>>
BBGuards;
146 return BB.second.isPoisoned();
156#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
202 IRUnitT &Output) = 0;
207 const IRUnitT &Before,
const IRUnitT &After,
227template <
typename IRUnitT>
262 std::string &Output)
override;
265 const std::string &Before,
const std::string &After,
291 const std::string &Before,
const std::string &After,
301 B.print(SS,
nullptr,
true,
true);
387 std::function<
void(
bool InModule,
unsigned Minor,
427 StringRef Divider,
bool InModule,
unsigned Minor,
484 std::pair<std::string, std::string> SS{Succ.
str(), Label.str()};
527 StringRef Divider,
bool InModule,
unsigned Minor,
532 std::unique_ptr<raw_fd_ostream>
HTML;
539 :
SavedIR(
"*** Dump of IR Before Last Pass Unknown ***") {}
551 static void SignalHandler(
void *);
587extern template class ChangeReporter<std::string>;
588extern template class TextChangeReporter<std::string>;
590extern template class BlockDataT<EmptyData>;
591extern template class FuncDataT<EmptyData>;
592extern template class IRDataT<EmptyData>;
593extern template class ChangeReporter<IRDataT<EmptyData>>;
594extern template class TextChangeReporter<IRDataT<EmptyData>>;
595extern template class IRComparer<EmptyData>;
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Legalize the Machine IR a function s Machine IR
Machine Check Debug Module
This file declares the interface for bisecting optimizations.
ModuleAnalysisManager MAM
PassInstrumentationCallbacks PIC
This header defines classes/functions to handle pass execution timing information with interfaces for...
static StringRef getName(Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file defines the SmallVector class.
static const char PassName[]
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
LLVM Basic Block Representation.
bool operator!=(const BlockDataT &That) const
bool operator==(const BlockDataT &That) const
StringRef getLabel() const
BlockDataT(const BasicBlock &B)
const T & getData() const
StringRef getBody() const
Value handle with callbacks on RAUW and destruction.
virtual void deleted()
Callback for Value destruction.
void saveIRBeforePass(Any IR, StringRef PassID, StringRef PassName)
virtual void handleFiltered(StringRef PassID, std::string &Name)=0
virtual void handleAfter(StringRef PassID, std::string &Name, const IRUnitT &Before, const IRUnitT &After, Any)=0
virtual void handleIgnored(StringRef PassID, std::string &Name)=0
virtual void generateIRRepresentation(Any IR, StringRef PassID, IRUnitT &Output)=0
virtual void handleInitialIR(Any IR)=0
void handleIRAfterPass(Any IR, StringRef PassID, StringRef PassName)
virtual void handleInvalidated(StringRef PassID)=0
void registerRequiredCallbacks(PassInstrumentationCallbacks &PIC)
std::vector< IRUnitT > BeforeStack
virtual void omitAfter(StringRef PassID, std::string &Name)=0
void handleInvalidatedPass(StringRef PassID)
ChangeReporter(bool RunInVerboseMode)
virtual ~ChangeReporter()
void addSuccessorLabel(StringRef Succ, StringRef Label)
StringRef getSuccessorLabel(StringRef S) const
StringMap< std::string > Successors
StringMap< std::string >::const_iterator end() const
StringMap< std::string >::const_iterator begin() const
std::unique_ptr< raw_fd_ostream > HTML
void handleInvalidated(StringRef PassID) override
void generateIRRepresentation(Any IR, StringRef PassID, IRDataT< DCData > &Output) override
static std::string genHTML(StringRef Text, StringRef DotFile, StringRef PDFFileName)
void handleInitialIR(Any IR) override
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< DCData > &Before, const FuncDataT< DCData > &After)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void handleIgnored(StringRef PassID, std::string &Name) override
~DotCfgChangeReporter() override
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< DCData > &Before, const IRDataT< DCData > &After, Any) override
void handleFiltered(StringRef PassID, std::string &Name) override
void omitAfter(StringRef PassID, std::string &Name) override
EmptyData(const BasicBlock &)
std::string getEntryBlockName() const
std::string EntryBlockName
IRChangedPrinter(bool VerboseMode)
~IRChangedPrinter() override
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, Any) override
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void generateIRRepresentation(Any IR, StringRef PassID, std::string &Output) override
void handleIgnored(StringRef PassID, std::string &Name) override
void handleAfter(StringRef PassID, std::string &Name, const std::string &Before, const std::string &After, Any) override
void omitAfter(StringRef PassID, std::string &Name) override
void handleInvalidated(StringRef PassID) override
void handleIR(const std::string &IR, StringRef PassID)
void handleInitialIR(Any IR) override
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void handleFiltered(StringRef PassID, std::string &Name) override
~IRChangedTester() override
const IRDataT< T > & Before
const IRDataT< T > & After
IRComparer(const IRDataT< T > &Before, const IRDataT< T > &After)
static void analyzeIR(Any IR, IRDataT< T > &Data)
void compare(bool CompareModule, std::function< void(bool InModule, unsigned Minor, const FuncDataT< T > &Before, const FuncDataT< T > &After)> CompareFunc)
static bool generateFunctionData(IRDataT< T > &Data, const Function &F)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
InLineChangePrinter(bool VerboseMode, bool ColourMode)
~InLineChangePrinter() override
void handleAfter(StringRef PassID, std::string &Name, const IRDataT< EmptyData > &Before, const IRDataT< EmptyData > &After, Any) override
void generateIRRepresentation(Any IR, StringRef PassID, IRDataT< EmptyData > &Output) override
void handleFunctionCompare(StringRef Name, StringRef Prefix, StringRef PassID, StringRef Divider, bool InModule, unsigned Minor, const FuncDataT< EmptyData > &Before, const FuncDataT< EmptyData > &After)
This is an important class for using LLVM in a threaded context.
void registerCallbacks(PassInstrumentationCallbacks &PIC)
OptNoneInstrumentation(bool DebugLogging)
OptPassGateInstrumentation(LLVMContext &Context)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
bool shouldRun(StringRef PassName, Any IR)
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
bool operator==(const OrderedChangedData< T > &That) const
static void report(const OrderedChangedData &Before, const OrderedChangedData &After, function_ref< void(const T *, const T *)> HandlePair)
const std::vector< std::string > & getOrder() const
StringMap< T > & getData()
std::vector< std::string > Order
const StringMap< T > & getData() const
std::vector< std::string > & getOrder()
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
A set of analyses that are preserved following a run of a transformation pass.
void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM)
~PrintCrashIRInstrumentation()
PrintCrashIRInstrumentation()
void registerCallbacks(PassInstrumentationCallbacks &PIC)
Instrumentation to print IR before/after passes.
~PrintIRInstrumentation()
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
PrintPassInstrumentation(bool Enabled, PrintPassOptions Opts)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class provides an interface to register all the standard pass instrumentations and manages their...
void registerCallbacks(PassInstrumentationCallbacks &PIC, ModuleAnalysisManager *MAM=nullptr)
TimePassesHandler & getTimePasses()
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
iterator find(StringRef Key)
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
void handleInitialIR(Any IR) override
void handleInvalidated(StringRef PassID) override
void omitAfter(StringRef PassID, std::string &Name) override
void handleIgnored(StringRef PassID, std::string &Name) override
void handleFiltered(StringRef PassID, std::string &Name) override
This class implements -time-passes functionality for new pass manager.
This class implements –time-trace functionality for new pass manager.
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void operator=(const TimeProfilingPassesHandler &)=delete
TimeProfilingPassesHandler()
TimeProfilingPassesHandler(const TimeProfilingPassesHandler &)=delete
Value * getValPtr() const
LLVM Value Representation.
VerifyInstrumentation(bool DebugLogging)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
This is an optimization pass for GlobalISel generic memory operations.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
BBGuard(const BasicBlock *BB)
void deleted() override
Callback for Value destruction.
void allUsesReplacedWith(Value *) override
Callback for Value RAUW.
std::optional< DenseMap< intptr_t, BBGuard > > BBGuards
static void printDiff(raw_ostream &out, const CFG &Before, const CFG &After)
bool operator==(const CFG &G) const
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
DenseMap< const BasicBlock *, DenseMap< const BasicBlock *, unsigned > > Graph
bool SkipAnalyses
Don't print information for analyses.
bool Verbose
Print adaptors and pass managers.
bool Indent
Indent based on hierarchy.