1 //===---- CoroConditionalWrapper.h ------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_TRANSFORMS_COROUTINES_COROCONDITIONALWRAPPER_H 10 #define LLVM_TRANSFORMS_COROUTINES_COROCONDITIONALWRAPPER_H 11 12 #include "llvm/IR/PassManager.h" 13 14 namespace llvm { 15 16 class Module; 17 18 // Only runs passes in the contained pass manager if the module contains any 19 // coroutine intrinsic declarations. 20 struct CoroConditionalWrapper : PassInfoMixin<CoroConditionalWrapper> { 21 CoroConditionalWrapper(ModulePassManager &&); 22 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 23 static bool isRequired() { return true; } 24 void printPipeline(raw_ostream &OS, 25 function_ref<StringRef(StringRef)> MapClassName2PassName); 26 27 private: 28 ModulePassManager PM; 29 }; 30 } // end namespace llvm 31 32 #endif // LLVM_TRANSFORMS_COROUTINES_COROCONDITIONALWRAPPER_H 33