LLVM 20.0.0git
CoroSplit.h
Go to the documentation of this file.
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
20#include "llvm/IR/PassManager.h"
22
23namespace llvm {
24
25namespace coro {
26class BaseABI;
27struct Shape;
28} // namespace coro
29
30struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
31 using BaseABITy =
32 std::function<std::unique_ptr<coro::BaseABI>(Function &, coro::Shape &)>;
33
34 CoroSplitPass(bool OptimizeFrame = false);
35
37 bool OptimizeFrame = false);
38
39 CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
40 bool OptimizeFrame = false);
41
42 CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
43 SmallVector<BaseABITy> GenCustomABIs,
44 bool OptimizeFrame = false);
45
48
49 static bool isRequired() { return true; }
50
51 // Generator for an ABI transformer
53
54 // Would be true if the Optimization level isn't O0.
56};
57} // end namespace llvm
58
59#endif // LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
This header provides classes for managing passes over SCCs of the call graph.
This header defines various interfaces for pass management in LLVM.
Implements a lazy call graph analysis and related passes for the new pass manager.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
An SCC of the call graph.
A lazily constructed view of the call graph of a module.
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
Definition: CoroSplit.cpp:2172
BaseABITy CreateAndInitABI
Definition: CoroSplit.h:52
static bool isRequired()
Definition: CoroSplit.h:49
std::function< std::unique_ptr< coro::BaseABI >(Function &, coro::Shape &)> BaseABITy
Definition: CoroSplit.h:32
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69