LLVM 22.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::coro {
20
21bool isSuspendBlock(BasicBlock *BB);
22bool declaresAnyIntrinsic(const Module &M);
24void replaceCoroFree(CoroIdInst *CoroId, bool Elide);
25
26/// Replaces all @llvm.coro.alloc intrinsics calls associated with a given
27/// call @llvm.coro.id instruction with boolean value false.
28void suppressCoroAllocs(CoroIdInst *CoroId);
29/// Replaces CoroAllocs with boolean value false.
30void suppressCoroAllocs(LLVMContext &Context,
31 ArrayRef<CoroAllocInst *> CoroAllocs);
32
33/// Attempts to rewrite the location operand of debug records in terms of
34/// the coroutine frame pointer, folding pointer offsets into the DIExpression
35/// of the intrinsic.
36/// If the frame pointer is an Argument, store it into an alloca to enhance the
37/// debugability.
39 SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
40 DbgVariableRecord &DVR, bool UseEntryValue);
41
42// Keeps data and helper functions for lowering coroutine intrinsics.
53
60} // End namespace llvm::coro
61
62#endif
AMDGPU Lower Kernel Arguments
#define F(x, y, z)
Definition MD5.cpp:55
Machine Check Debug Module
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:558
A debug info location.
Definition DebugLoc.h:124
Class to represent function types.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2788
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
Class to represent pointers.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
LLVM Value Representation.
Definition Value.h:75
bool defaultMaterializable(Instruction &V)
Default materializable callback.
bool declaresAnyIntrinsic(const Module &M)
bool isSuspendBlock(BasicBlock *BB)
void suppressCoroAllocs(CoroIdInst *CoroId)
Replaces all @llvm.coro.alloc intrinsics calls associated with a given call @llvm....
void normalizeCoroutine(Function &F, coro::Shape &Shape, TargetTransformInfo &TTI)
CallInst * createMustTailCall(DebugLoc Loc, Function *MustTailCallFn, TargetTransformInfo &TTI, ArrayRef< Value * > Arguments, IRBuilder<> &)
void replaceCoroFree(CoroIdInst *CoroId, bool Elide)
bool declaresIntrinsics(const Module &M, ArrayRef< Intrinsic::ID > List)
void salvageDebugInfo(SmallDenseMap< Argument *, AllocaInst *, 4 > &ArgToAllocaMap, DbgVariableRecord &DVR, bool UseEntryValue)
Attempts to rewrite the location operand of debug records in terms of the coroutine frame pointer,...
TargetTransformInfo TTI
ArrayRef(const T &OneElt) -> ArrayRef< T >
PointerType *const Int8Ptr
ConstantPointerNull *const NullPtr
CallInst * makeSubFnCall(Value *Arg, int Index, Instruction *InsertPt)
FunctionType *const ResumeFnType