33 lines · cpp
1//===- CoroConditionalWrapper.cpp -----------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "llvm/Transforms/Coroutines/CoroConditionalWrapper.h"10#include "CoroInternal.h"11#include "llvm/IR/Module.h"12 13using namespace llvm;14 15CoroConditionalWrapper::CoroConditionalWrapper(ModulePassManager &&PM)16 : PM(std::move(PM)) {}17 18PreservedAnalyses CoroConditionalWrapper::run(Module &M,19 ModuleAnalysisManager &AM) {20 if (!coro::declaresAnyIntrinsic(M))21 return PreservedAnalyses::all();22 23 return PM.run(M, AM);24}25 26void CoroConditionalWrapper::printPipeline(27 raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {28 OS << "coro-cond";29 OS << '(';30 PM.printPipeline(OS, MapClassName2PassName);31 OS << ')';32}33