LLVM 20.0.0git
Classes | Typedefs | Enumerations | Functions
llvm::coro Namespace Reference

Classes

struct  AllocaInfo
 
class  AnyRetconABI
 
class  AsyncABI
 
class  BaseABI
 
class  BaseCloner
 
struct  LowererBase
 
struct  Shape
 
class  SwitchABI
 
class  SwitchCloner
 

Typedefs

using SpillInfo = SmallMapVector< Value *, SmallVector< Instruction *, 2 >, 8 >
 

Enumerations

enum class  ABI { Switch , Retcon , RetconOnce , Async }
 
enum class  CloneKind {
  SwitchResume , SwitchUnwind , SwitchCleanup , Continuation ,
  Async
}
 

Functions

bool isTriviallyMaterializable (Instruction &I)
 
void doRematerializations (Function &F, SuspendCrossingInfo &Checker, std::function< bool(Instruction &)> IsMaterializable)
 
void collectSpillsFromArgs (SpillInfo &Spills, Function &F, const SuspendCrossingInfo &Checker)
 
void collectSpillsAndAllocasFromInsts (SpillInfo &Spills, SmallVector< AllocaInfo, 8 > &Allocas, SmallVector< Instruction *, 4 > &DeadInstructions, SmallVector< CoroAllocaAllocInst *, 4 > &LocalAllocas, Function &F, const SuspendCrossingInfo &Checker, const DominatorTree &DT, const coro::Shape &Shape)
 
void collectSpillsFromDbgInfo (SpillInfo &Spills, Function &F, const SuspendCrossingInfo &Checker)
 
void sinkSpillUsesAfterCoroBegin (const DominatorTree &DT, CoroBeginInst *CoroBegin, coro::SpillInfo &Spills, SmallVectorImpl< coro::AllocaInfo > &Allocas)
 Async and Retcon{Once} conventions assume that all spill uses can be sunk after the coro.begin intrinsic.
 
BasicBlock::iterator getSpillInsertionPt (const coro::Shape &, Value *Def, const DominatorTree &DT)
 
bool isSuspendBlock (BasicBlock *BB)
 
bool declaresAnyIntrinsic (const Module &M)
 
bool declaresIntrinsics (const Module &M, const std::initializer_list< StringRef >)
 
void replaceCoroFree (CoroIdInst *CoroId, bool Elide)
 
void suppressCoroAllocs (CoroIdInst *CoroId)
 Replaces all @llvm.coro.alloc intrinsics calls associated with a given call @llvm.coro.id instruction with boolean value false.
 
void suppressCoroAllocs (LLVMContext &Context, ArrayRef< CoroAllocInst * > CoroAllocs)
 Replaces CoroAllocs with boolean value false.
 
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, folding pointer offsets into the DIExpression of the intrinsic.
 
void salvageDebugInfo (SmallDenseMap< Argument *, AllocaInst *, 4 > &ArgToAllocaMap, DbgVariableRecord &DVR, bool UseEntryValue)
 
bool defaultMaterializable (Instruction &V)
 Default materializable callback.
 
void normalizeCoroutine (Function &F, coro::Shape &Shape, TargetTransformInfo &TTI)
 
CallInstcreateMustTailCall (DebugLoc Loc, Function *MustTailCallFn, TargetTransformInfo &TTI, ArrayRef< Value * > Arguments, IRBuilder<> &)
 

Typedef Documentation

◆ SpillInfo

Definition at line 20 of file SpillUtils.h.

Enumeration Type Documentation

◆ ABI

enum class llvm::coro::ABI
strong
Enumerator
Switch 

The "resume-switch" lowering, where there are separate resume and destroy functions that are shared between all suspend points.

The coroutine frame implicitly stores the resume and destroy functions, the current index, and any promise value.

Retcon 

The "returned-continuation" lowering, where each suspend point creates a single continuation function that is used for both resuming and destroying.

Does not support promises.

RetconOnce 

The "unique returned-continuation" lowering, where each suspend point creates a single continuation function that is used for both resuming and destroying.

Does not support promises. The function is known to suspend at most once during its execution, and the return value of the continuation is void.

Async 

The "async continuation" lowering, where each suspend point creates a single continuation function.

The continuation function is available as an intrinsic.

Definition at line 25 of file CoroShape.h.

◆ CloneKind

enum class llvm::coro::CloneKind
strong
Enumerator
SwitchResume 

The shared resume function for a switch lowering.

SwitchUnwind 

The shared unwind function for a switch lowering.

SwitchCleanup 

The shared cleanup function for a switch lowering.

Continuation 

An individual continuation function.

Async 

An async resume function.

Definition at line 26 of file CoroCloner.h.

Function Documentation

◆ collectSpillsAndAllocasFromInsts()

void llvm::coro::collectSpillsAndAllocasFromInsts ( SpillInfo Spills,
SmallVector< AllocaInfo, 8 > &  Allocas,
SmallVector< Instruction *, 4 > &  DeadInstructions,
SmallVector< CoroAllocaAllocInst *, 4 > &  LocalAllocas,
Function F,
const SuspendCrossingInfo Checker,
const DominatorTree DT,
const coro::Shape Shape 
)

◆ collectSpillsFromArgs()

void llvm::coro::collectSpillsFromArgs ( SpillInfo Spills,
Function F,
const SuspendCrossingInfo Checker 
)

Definition at line 452 of file SpillUtils.cpp.

References A, and F.

Referenced by llvm::coro::BaseABI::buildCoroutineFrame().

◆ collectSpillsFromDbgInfo()

void llvm::coro::collectSpillsFromDbgInfo ( SpillInfo Spills,
Function F,
const SuspendCrossingInfo Checker 
)

Definition at line 516 of file SpillUtils.cpp.

References llvm::findDbgValues().

Referenced by llvm::coro::BaseABI::buildCoroutineFrame().

◆ createMustTailCall()

CallInst * llvm::coro::createMustTailCall ( DebugLoc  Loc,
Function MustTailCallFn,
TargetTransformInfo TTI,
ArrayRef< Value * >  Arguments,
IRBuilder<> &  Builder 
)

◆ declaresAnyIntrinsic()

bool llvm::coro::declaresAnyIntrinsic ( const Module M)

Definition at line 111 of file Coroutines.cpp.

References CoroIntrinsics, and Name.

Referenced by llvm::CoroConditionalWrapper::run().

◆ declaresIntrinsics()

bool llvm::coro::declaresIntrinsics ( const Module M,
const std::initializer_list< StringRef List 
)

◆ defaultMaterializable()

bool llvm::coro::defaultMaterializable ( Instruction V)

Default materializable callback.

Definition at line 235 of file MaterializationUtils.cpp.

Referenced by isTriviallyMaterializable().

◆ doRematerializations()

void llvm::coro::doRematerializations ( Function F,
SuspendCrossingInfo Checker,
std::function< bool(Instruction &)>  IsMaterializable 
)

◆ getSpillInsertionPt()

BasicBlock::iterator llvm::coro::getSpillInsertionPt ( const coro::Shape Shape,
Value Def,
const DominatorTree DT 
)

◆ isSuspendBlock()

bool llvm::coro::isSuspendBlock ( BasicBlock BB)

◆ isTriviallyMaterializable()

bool llvm::coro::isTriviallyMaterializable ( Instruction I)

Definition at line 240 of file MaterializationUtils.cpp.

References defaultMaterializable().

Referenced by llvm::CoroSplitPass::CoroSplitPass().

◆ normalizeCoroutine()

void llvm::coro::normalizeCoroutine ( Function F,
coro::Shape Shape,
TargetTransformInfo TTI 
)

◆ replaceCoroFree()

void llvm::coro::replaceCoroFree ( CoroIdInst CoroId,
bool  Elide 
)

◆ salvageDebugInfo() [1/2]

void llvm::coro::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, folding pointer offsets into the DIExpression of the intrinsic.

If the frame pointer is an Argument, store it into an alloca to enhance the debugability.

Definition at line 1927 of file CoroFrame.cpp.

References F, llvm::Instruction::getDebugLoc(), llvm::DbgVariableIntrinsic::getExpression(), llvm::Instruction::getFunction(), llvm::DbgVariableIntrinsic::getVariableLocationOp(), I, llvm::Instruction::moveBefore(), llvm::DbgVariableIntrinsic::replaceVariableLocationOp(), salvageDebugInfoImpl(), llvm::Instruction::setDebugLoc(), and llvm::DbgVariableIntrinsic::setExpression().

Referenced by llvm::coro::BaseCloner::create(), doSplitCoroutine(), insertSpills(), and llvm::coro::BaseCloner::salvageDebugInfo().

◆ salvageDebugInfo() [2/2]

void llvm::coro::salvageDebugInfo ( SmallDenseMap< Argument *, AllocaInst *, 4 > &  ArgToAllocaMap,
DbgVariableRecord DVR,
bool  UseEntryValue 
)

◆ sinkSpillUsesAfterCoroBegin()

void llvm::coro::sinkSpillUsesAfterCoroBegin ( const DominatorTree DT,
CoroBeginInst CoroBegin,
coro::SpillInfo Spills,
SmallVectorImpl< coro::AllocaInfo > &  Allocas 
)

◆ suppressCoroAllocs() [1/2]

void llvm::coro::suppressCoroAllocs ( CoroIdInst CoroId)

Replaces all @llvm.coro.alloc intrinsics calls associated with a given call @llvm.coro.id instruction with boolean value false.

Definition at line 155 of file Coroutines.cpp.

References llvm::SmallVectorBase< Size_T >::empty(), llvm::Value::getContext(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), suppressCoroAllocs(), and llvm::Value::users().

Referenced by suppressCoroAllocs().

◆ suppressCoroAllocs() [2/2]

void llvm::coro::suppressCoroAllocs ( LLVMContext Context,
ArrayRef< CoroAllocInst * >  CoroAllocs 
)

Replaces CoroAllocs with boolean value false.

Definition at line 173 of file Coroutines.cpp.

References llvm::ConstantInt::getFalse().