xref: /netbsd-src/external/apache2/llvm/dist/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 //===- CoroSplit.h - Converts a coroutine into a state machine -*- 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 // \file
10 // This file declares the pass that builds the coroutine frame and outlines
11 // the resume and destroy parts of the coroutine into separate functions.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
16 #define LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
17 
18 #include "llvm/Analysis/CGSCCPassManager.h"
19 #include "llvm/Analysis/LazyCallGraph.h"
20 #include "llvm/IR/PassManager.h"
21 
22 namespace llvm {
23 
24 struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
ReuseFrameSlotCoroSplitPass25   CoroSplitPass(bool ReuseFrameSlot = false) : ReuseFrameSlot(ReuseFrameSlot) {}
26 
27   PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
28                         LazyCallGraph &CG, CGSCCUpdateResult &UR);
isRequiredCoroSplitPass29   static bool isRequired() { return true; }
30 
31   // Would be true if the Optimization level isn't O0.
32   bool ReuseFrameSlot;
33 };
34 } // end namespace llvm
35 
36 #endif // LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
37