Index: bindings/go/llvm/transforms_pmbuilder.go =================================================================== --- bindings/go/llvm/transforms_pmbuilder.go +++ bindings/go/llvm/transforms_pmbuilder.go @@ -15,6 +15,7 @@ /* #include "llvm-c/Transforms/PassManagerBuilder.h" +#include "llvm-c/Transforms/Coroutines.h" */ import "C" @@ -66,3 +67,7 @@ func (pmb PassManagerBuilder) UseInlinerWithThreshold(threshold uint) { C.LLVMPassManagerBuilderUseInlinerWithThreshold(pmb.C, C.uint(threshold)) } + +func (pmb PassManagerBuilder) AddCoroutinePassesToExtensionPoints() { + C.LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints(pmb.C); +} Index: include/llvm-c/Transforms/Coroutines.h =================================================================== --- include/llvm-c/Transforms/Coroutines.h +++ include/llvm-c/Transforms/Coroutines.h @@ -20,6 +20,7 @@ #define LLVM_C_TRANSFORMS_COROUTINES_H #include "llvm-c/Types.h" +#include "llvm-c/Transforms/PassManagerBuilder.h" #ifdef __cplusplus extern "C" { @@ -44,6 +45,9 @@ /** See llvm::createCoroCleanupPass function. */ void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM); +/** See llvm::addCoroutinePassesToExtensionPoints. */ +void LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints(LLVMPassManagerBuilderRef PMB); + /** * @} */ Index: include/llvm/Transforms/IPO/PassManagerBuilder.h =================================================================== --- include/llvm/Transforms/IPO/PassManagerBuilder.h +++ include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -15,6 +15,7 @@ #ifndef LLVM_TRANSFORMS_IPO_PASSMANAGERBUILDER_H #define LLVM_TRANSFORMS_IPO_PASSMANAGERBUILDER_H +#include "llvm-c/Transforms/PassManagerBuilder.h" #include #include #include @@ -213,5 +214,13 @@ } }; +inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) { + return reinterpret_cast(P); +} + +inline LLVMPassManagerBuilderRef wrap(PassManagerBuilder *P) { + return reinterpret_cast(P); +} + } // end namespace llvm #endif Index: lib/Transforms/Coroutines/Coroutines.cpp =================================================================== --- lib/Transforms/Coroutines/Coroutines.cpp +++ lib/Transforms/Coroutines/Coroutines.cpp @@ -361,3 +361,9 @@ void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createCoroCleanupPass()); } + +void +LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints(LLVMPassManagerBuilderRef PMB) { + PassManagerBuilder *Builder = unwrap(PMB); + addCoroutinePassesToExtensionPoints(*Builder); +} Index: lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- lib/Transforms/IPO/PassManagerBuilder.cpp +++ lib/Transforms/IPO/PassManagerBuilder.cpp @@ -980,14 +980,6 @@ PM.add(createVerifierPass()); } -inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) { - return reinterpret_cast(P); -} - -inline LLVMPassManagerBuilderRef wrap(PassManagerBuilder *P) { - return reinterpret_cast(P); -} - LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate() { PassManagerBuilder *PMB = new PassManagerBuilder(); return wrap(PMB);