LLVM: llvm::coro Namespace Reference (original) (raw)

Classes
struct AllocaInfo
class AnyRetconABI
class AsyncABI
class BaseABI
class BaseCloner
struct LowererBase
struct Shape
class SwitchABI
class SwitchCloner
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)
CallInst * createMustTailCall (DebugLoc Loc, Function *MustTailCallFn, TargetTransformInfo &TTI, ArrayRef< Value * > Arguments, IRBuilder<> &)

SpillInfo

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 25 of file CoroCloner.h.

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 )

Definition at line 459 of file SpillUtils.cpp.

References llvm::Alloc, llvm::cast(), collectFrameAlloca(), llvm::coro::Shape::CoroBegin, llvm::dyn_cast(), F, I, instructions, llvm::isa(), llvm::SuspendCrossingInfo::isDefinitionAcrossSuspend(), isLocalAlloca(), isNonSpilledIntrinsic(), lowerNonLocalAlloca(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::report_fatal_error().

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

collectSpillsFromArgs()

collectSpillsFromDbgInfo()

createMustTailCall()

declaresAnyIntrinsic()

declaresIntrinsics()

defaultMaterializable()

doRematerializations()

Definition at line 254 of file MaterializationUtils.cpp.

References llvm::cast(), llvm::dbgs(), dumpRemats(), F, I, instructions, llvm::SuspendCrossingInfo::isDefinitionAcrossSuspend(), LLVM_DEBUG, rewriteMaterializableInstructions(), and llvm::MapVector< KeyT, ValueT, MapType, VectorType >::try_emplace().

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

getSpillInsertionPt()

Definition at line 579 of file SpillUtils.cpp.

References assert(), llvm::cast(), llvm::coro::Shape::CoroBegin, llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::BasicBlock::getFirstInsertionPt(), llvm::coro::Shape::getInsertPtAfterFramePtr(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::BasicBlock::getTerminator(), I, II, llvm::isa(), splitBeforeCatchSwitch(), and llvm::SplitEdge().

Referenced by insertSpills().

isSuspendBlock()

isTriviallyMaterializable()

normalizeCoroutine()

Definition at line 2021 of file CoroFrame.cpp.

References llvm::coro::Shape::ABI, Arguments, llvm::ArrayRef(), Async, Call, cleanupSinglePredPHIs(), llvm::CoroIdInst::clearPromise(), llvm::coro::Shape::CoroEnds, llvm::coro::Shape::CoroSuspends, createMustTailCall(), llvm::dyn_cast(), eliminateSwiftError(), F, llvm::coro::Shape::getSwitchCoroId(), llvm::coro::Shape::SwitchLoweringStorage::PromiseAlloca, rewritePHIs(), splitAround(), Switch, and llvm::coro::Shape::SwitchLowering.

Referenced by doSplitCoroutine().

replaceCoroFree()

Definition at line 123 of file Coroutines.cpp.

References llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::ConstantPointerNull::get(), llvm::PointerType::get(), llvm::Value::getContext(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Value::users().

Referenced by llvm::coro::SwitchCloner::create(), and handleNoSuspendCoroutine().

salvageDebugInfo()

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.

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

Definition at line 1963 of file CoroFrame.cpp.

References llvm::DbgVariableRecord::Declare, llvm::DbgVariableRecord::DeclareValue, llvm::dyn_cast(), F, llvm::DbgRecord::getDebugLoc(), llvm::DbgVariableRecord::getExpression(), llvm::DbgRecord::getFunction(), llvm::DbgVariableRecord::getRawLocation(), llvm::DbgVariableRecord::getType(), llvm::DbgVariableRecord::getVariableLocationOp(), I, llvm::isa(), llvm::DbgVariableRecord::isDbgDeclare(), llvm::DbgVariableRecord::isDbgDeclareValue(), llvm::DbgRecord::removeFromParent(), llvm::DbgVariableRecord::replaceVariableLocationOp(), llvm::salvageDebugInfoImpl(), llvm::DbgRecord::setDebugLoc(), llvm::DbgVariableRecord::setExpression(), llvm::DbgVariableRecord::Type, and llvm::DbgVariableRecord::Value.

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

sinkSpillUsesAfterCoroBegin()

Async and Retcon{Once} conventions assume that all spill uses can be sunk after the coro.begin intrinsic.

Definition at line 533 of file SpillUtils.cpp.

References A(), B(), llvm::SetVector< T, Vector, Set, N >::begin(), llvm::cast(), llvm::DominatorTree::dominates(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SetVector< T, Vector, Set, N >::end(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::Instruction::moveBefore(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().

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

suppressCoroAllocs() [1/2]

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

suppressCoroAllocs() [2/2]