LLVM 20.0.0git
CoroInternal.h
Go to the documentation of this file.
1//===- CoroInternal.h - Internal Coroutine interfaces ---------*- 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// Common definitions/declarations used internally by coroutine lowering passes.
9//===----------------------------------------------------------------------===//
10
11#ifndef LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H
12#define LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H
13
15#include "llvm/IR/IRBuilder.h"
18
19namespace llvm {
20
21class CallGraph;
22
23namespace coro {
24
25bool isSuspendBlock(BasicBlock *BB);
26bool declaresAnyIntrinsic(const Module &M);
27bool declaresIntrinsics(const Module &M,
28 const std::initializer_list<StringRef>);
29void replaceCoroFree(CoroIdInst *CoroId, bool Elide);
30
31/// Replaces all @llvm.coro.alloc intrinsics calls associated with a given
32/// call @llvm.coro.id instruction with boolean value false.
33void suppressCoroAllocs(CoroIdInst *CoroId);
34/// Replaces CoroAllocs with boolean value false.
35void suppressCoroAllocs(LLVMContext &Context,
36 ArrayRef<CoroAllocInst *> CoroAllocs);
37
38/// Attempts to rewrite the location operand of debug intrinsics in terms of
39/// the coroutine frame pointer, folding pointer offsets into the DIExpression
40/// of the intrinsic.
41/// If the frame pointer is an Argument, store it into an alloca to enhance the
42/// debugability.
44 SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
45 DbgVariableIntrinsic &DVI, bool IsEntryPoint);
47 SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
48 DbgVariableRecord &DVR, bool UseEntryValue);
49
50// Keeps data and helper functions for lowering coroutine intrinsics.
57
59 CallInst *makeSubFnCall(Value *Arg, int Index, Instruction *InsertPt);
60};
61
65CallInst *createMustTailCall(DebugLoc Loc, Function *MustTailCallFn,
68} // End namespace coro.
69} // End namespace llvm
70
71#endif
AMDGPU Lower Kernel Arguments
uint32_t Index
#define F(x, y, z)
Definition: MD5.cpp:55
This pass exposes codegen information to IR-level passes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This class represents a function call, abstracting a target machine's calling convention.
A constant pointer value that points to null.
Definition: Constants.h:552
A debug info location.
Definition: DebugLoc.h:33
Class to represent function types.
Definition: DerivedTypes.h:105
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2697
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Class to represent pointers.
Definition: DerivedTypes.h:670
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
LLVM Value Representation.
Definition: Value.h:74
void salvageDebugInfo(SmallDenseMap< Argument *, AllocaInst *, 4 > &ArgToAllocaMap, DbgVariableIntrinsic &DVI, bool IsEntryPoint)
Attempts to rewrite the location operand of debug intrinsics in terms of the coroutine frame pointer,...
Definition: CoroFrame.cpp:1927
bool defaultMaterializable(Instruction &V)
Default materializable callback.
bool declaresAnyIntrinsic(const Module &M)
Definition: Coroutines.cpp:111
bool isSuspendBlock(BasicBlock *BB)
Definition: Coroutines.cpp:107
bool declaresIntrinsics(const Module &M, const std::initializer_list< StringRef >)
Definition: Coroutines.cpp:122
void suppressCoroAllocs(CoroIdInst *CoroId)
Replaces all @llvm.coro.alloc intrinsics calls associated with a given call @llvm....
Definition: Coroutines.cpp:155
void normalizeCoroutine(Function &F, coro::Shape &Shape, TargetTransformInfo &TTI)
Definition: CoroFrame.cpp:2013
CallInst * createMustTailCall(DebugLoc Loc, Function *MustTailCallFn, TargetTransformInfo &TTI, ArrayRef< Value * > Arguments, IRBuilder<> &)
Definition: CoroSplit.cpp:1664
void replaceCoroFree(CoroIdInst *CoroId, bool Elide)
Definition: Coroutines.cpp:135
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
PointerType *const Int8Ptr
Definition: CoroInternal.h:54
ConstantPointerNull *const NullPtr
Definition: CoroInternal.h:56
CallInst * makeSubFnCall(Value *Arg, int Index, Instruction *InsertPt)
Definition: Coroutines.cpp:52
LLVMContext & Context
Definition: CoroInternal.h:53
FunctionType *const ResumeFnType
Definition: CoroInternal.h:55