llvm.org GIT mirror llvm / 7c767e2
[LLVM-C] Add coroutine passes Differential Revision: https://reviews.llvm.org/D50950 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340147 91177308-0d34-0410-b5e6-96231b3b80d8 whitequark 1 year, 1 month ago
2 changed file(s) with 72 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 /*===-- Coroutines.h - Coroutines Library C Interface -----------*- C++ -*-===*\
1 |* *|
2 |* The LLVM Compiler Infrastructure *|
3 |* *|
4 |* This file is distributed under the University of Illinois Open Source *|
5 |* License. See LICENSE.TXT for details. *|
6 |* *|
7 |*===----------------------------------------------------------------------===*|
8 |* *|
9 |* This header declares the C interface to libLLVMCoroutines.a, which *|
10 |* implements various scalar transformations of the LLVM IR. *|
11 |* *|
12 |* Many exotic languages can interoperate with C code but have a harder time *|
13 |* with C++ due to name mangling. So in addition to C, this interface enables *|
14 |* tools written in such languages. *|
15 |* *|
16 \*===----------------------------------------------------------------------===*/
17
18 #ifndef LLVM_C_TRANSFORMS_COROUTINES_H
19 #define LLVM_C_TRANSFORMS_COROUTINES_H
20
21 #include "llvm-c/Types.h"
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28 * @defgroup LLVMCTransformsCoroutines Coroutine transformations
29 * @ingroup LLVMCTransforms
30 *
31 * @{
32 */
33
34 /** See llvm::createCoroEarlyPass function. */
35 void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM);
36
37 /** See llvm::createCoroSplitPass function. */
38 void LLVMAddCoroSplitPass(LLVMPassManagerRef PM);
39
40 /** See llvm::createCoroElidePass function. */
41 void LLVMAddCoroElidePass(LLVMPassManagerRef PM);
42
43 /** See llvm::createCoroCleanupPass function. */
44 void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM);
45
46 /**
47 * @}
48 */
49
50 #ifdef __cplusplus
51 }
52 #endif /* defined(__cplusplus) */
53
54 #endif
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/Transforms/Coroutines.h"
14 #include "llvm-c/Transforms/Coroutines.h"
1415 #include "CoroInstr.h"
1516 #include "CoroInternal.h"
1617 #include "llvm/ADT/SmallVector.h"
343344 for (CoroSaveInst *CoroSave : UnusedCoroSaves)
344345 CoroSave->eraseFromParent();
345346 }
347
348 void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM) {
349 unwrap(PM)->add(createCoroEarlyPass());
350 }
351
352 void LLVMAddCoroSplitPass(LLVMPassManagerRef PM) {
353 unwrap(PM)->add(createCoroSplitPass());
354 }
355
356 void LLVMAddCoroElidePass(LLVMPassManagerRef PM) {
357 unwrap(PM)->add(createCoroElidePass());
358 }
359
360 void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM) {
361 unwrap(PM)->add(createCoroCleanupPass());
362 }