mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
[PM] Add pass run listeners to the pass manager.
This commit provides the necessary C/C++ APIs and infastructure to enable fine- grain progress report and safe suspension points after each pass in the pass manager. Clients can provide a callback function to the pass manager to call after each pass. This can be used in a variety of ways (progress report, dumping of IR between passes, safe suspension of threads, etc). The run listener list is maintained in the LLVMContext, which allows a multi- threaded client to be only informed for it's own thread. This of course assumes that the client created a LLVMContext for each thread. This fixes <rdar://problem/16728690> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,6 +40,7 @@ class ConstantFP;
|
||||
class LLVMContext;
|
||||
class Type;
|
||||
class Value;
|
||||
struct PassRunListener;
|
||||
|
||||
struct DenseMapAPIntKeyInfo {
|
||||
struct KeyTy {
|
||||
@@ -368,13 +369,26 @@ public:
|
||||
typedef DenseMap<const Function *, ReturnInst *> PrefixDataMapTy;
|
||||
PrefixDataMapTy PrefixDataMap;
|
||||
|
||||
/// \brief List of listeners to notify about a pass run.
|
||||
SmallVector<PassRunListener *, 4> RunListeners;
|
||||
|
||||
/// \brief Return true if the given pass name should emit optimization
|
||||
/// remarks.
|
||||
bool optimizationRemarksEnabledFor(const char *PassName) const;
|
||||
|
||||
int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx);
|
||||
int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx);
|
||||
|
||||
|
||||
/// \brief Notify that we finished running a pass.
|
||||
void notifyPassRun(LLVMContext *, Pass *, Module *, Function *, BasicBlock *);
|
||||
/// \brief Register the given PassRunListener to receive notifyPassRun()
|
||||
/// callbacks whenever a pass ran. The context will take ownership of the
|
||||
/// listener and free it when the context is destroyed.
|
||||
void addRunListener(PassRunListener *);
|
||||
/// \brief Unregister a PassRunListener so that it no longer receives
|
||||
/// notifyPassRun() callbacks. Remove and free the listener from the context.
|
||||
void removeRunListener(PassRunListener *);
|
||||
|
||||
LLVMContextImpl(LLVMContext &C);
|
||||
~LLVMContextImpl();
|
||||
};
|
||||
|
Reference in New Issue
Block a user