Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:38

0001 //===- CoroSplit.h - Converts a coroutine into a state machine -*- C++ -*--===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // \file
0010 // This file declares the pass that builds the coroutine frame and outlines
0011 // the resume and destroy parts of the coroutine into separate functions.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
0016 #define LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
0017 
0018 #include "llvm/Analysis/CGSCCPassManager.h"
0019 #include "llvm/Analysis/LazyCallGraph.h"
0020 #include "llvm/IR/PassManager.h"
0021 #include "llvm/Transforms/Coroutines/ABI.h"
0022 
0023 namespace llvm {
0024 
0025 namespace coro {
0026 class BaseABI;
0027 struct Shape;
0028 } // namespace coro
0029 
0030 struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
0031   using BaseABITy =
0032       std::function<std::unique_ptr<coro::BaseABI>(Function &, coro::Shape &)>;
0033 
0034   CoroSplitPass(bool OptimizeFrame = false);
0035 
0036   CoroSplitPass(SmallVector<BaseABITy> GenCustomABIs,
0037                 bool OptimizeFrame = false);
0038 
0039   CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
0040                 bool OptimizeFrame = false);
0041 
0042   CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
0043                 SmallVector<BaseABITy> GenCustomABIs,
0044                 bool OptimizeFrame = false);
0045 
0046   PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
0047                         LazyCallGraph &CG, CGSCCUpdateResult &UR);
0048 
0049   static bool isRequired() { return true; }
0050 
0051   // Generator for an ABI transformer
0052   BaseABITy CreateAndInitABI;
0053 
0054   // Would be true if the Optimization level isn't O0.
0055   bool OptimizeFrame;
0056 };
0057 } // end namespace llvm
0058 
0059 #endif // LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H