LLVM 22.0.0git
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

LLVM_ABI bool isTriviallyMaterializable (Instruction &I)
LLVM_ABI 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, ArrayRef< Intrinsic::ID > List)
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, DbgVariableRecord &DVR, bool UseEntryValue)
 Attempts to rewrite the location operand of debug records in terms of the coroutine frame pointer, folding pointer offsets into the DIExpression of the intrinsic.
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 26 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()

◆ collectSpillsFromArgs()

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

◆ collectSpillsFromDbgInfo()

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

◆ 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 102 of file Coroutines.cpp.

References declaresIntrinsics(), and NonOverloadedCoroIntrinsics.

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

◆ declaresIntrinsics()

◆ defaultMaterializable()

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

Default materializable callback.

Definition at line 236 of file MaterializationUtils.cpp.

References llvm::isa().

Referenced by isTriviallyMaterializable().

◆ doRematerializations()

◆ getSpillInsertionPt()

◆ isSuspendBlock()

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

◆ isTriviallyMaterializable()

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

◆ normalizeCoroutine()

◆ replaceCoroFree()

◆ salvageDebugInfo()

◆ sinkSpillUsesAfterCoroBegin()

◆ 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 142 of file Coroutines.cpp.

References llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::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 160 of file Coroutines.cpp.

References llvm::ConstantInt::getFalse().