summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm-c
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-04-28 18:19:25 +0000
committerJuergen Ributzka <juergen@apple.com>2014-04-28 18:19:25 +0000
commit4989255432a7954ce8c3937a3561595891edf83d (patch)
tree3708381fd96f0ffcca677eb497a7bb1745af51a8 /llvm/include/llvm-c
parent4482dcd0721794fc7560b6b5022e47a69df901c2 (diff)
downloadbcm5719-llvm-4989255432a7954ce8c3937a3561595891edf83d.tar.gz
bcm5719-llvm-4989255432a7954ce8c3937a3561595891edf83d.zip
[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> llvm-svn: 207430
Diffstat (limited to 'llvm/include/llvm-c')
-rw-r--r--llvm/include/llvm-c/Core.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index df2de2441a2..f7121a5c61a 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -112,12 +112,23 @@ typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
*/
typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
+/** @see llvm::Pass */
+typedef struct LLVMOpaquePass *LLVMPassRef;
+
/** @see llvm::PassManagerBase */
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
/** @see llvm::PassRegistry */
typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
+/** @see llvm::PassRunListener */
+typedef struct LLVMOpaquePassRunListener *LLVMPassRunListenerRef;
+
+/** @see llvm::LLVMPassRunListener */
+typedef void (*LLVMPassRunListenerHandlerTy)(LLVMContextRef, LLVMPassRef,
+ LLVMModuleRef, LLVMValueRef,
+ LLVMBasicBlockRef);
+
/**
* Used to get the users and usees of a Value.
*
@@ -515,6 +526,10 @@ unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
unsigned SLen);
unsigned LLVMGetMDKindID(const char* Name, unsigned SLen);
+LLVMPassRunListenerRef LLVMAddPassRunListener(LLVMContextRef,
+ LLVMPassRunListenerHandlerTy);
+void LLVMRemovePassRunListener(LLVMContextRef, LLVMPassRunListenerRef);
+
/**
* @}
*/
@@ -2764,6 +2779,18 @@ void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
*/
/**
+ * @defgroup LLVMCCorePass Pass
+ *
+ * @{
+ */
+
+const char *LLVMGetPassName(LLVMPassRef);
+
+/**
+ * @}
+ */
+
+/**
* @defgroup LLVMCCorePassRegistry Pass Registry
*
* @{
OpenPOWER on IntegriCloud