LLVM 22.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"
23
24namespace llvm {
25
26namespace coro {
27class BaseABI;
28struct Shape;
29} // namespace coro
30
31struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {
32 using BaseABITy =
33 std::function<std::unique_ptr<coro::BaseABI>(Function &, coro::Shape &)>;
34
36
38 bool OptimizeFrame = false);
39
41 CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
42 bool OptimizeFrame = false);
43
45 CoroSplitPass(std::function<bool(Instruction &)> MaterializableCallback,
46 SmallVector<BaseABITy> GenCustomABIs,
47 bool OptimizeFrame = false);
48
52
53 static bool isRequired() { return true; }
54
55 // Generator for an ABI transformer
57
58 // Would be true if the Optimization level isn't O0.
60};
61} // end namespace llvm
62
63#endif // LLVM_TRANSFORMS_COROUTINES_COROSPLIT_H
This header provides classes for managing passes over SCCs of the call graph.
#define LLVM_ABI
Definition: Compiler.h:213
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:255
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:112
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
@ 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...
LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
Definition: CoroSplit.cpp:2192
BaseABITy CreateAndInitABI
Definition: CoroSplit.h:56
static bool isRequired()
Definition: CoroSplit.h:53
std::function< std::unique_ptr< coro::BaseABI >(Function &, coro::Shape &)> BaseABITy
Definition: CoroSplit.h:33
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70