LLVM 22.0.0git
llvm::coro::Shape Struct Reference

#include "llvm/Transforms/Coroutines/CoroShape.h"

Classes

struct  AsyncLoweringStorage
struct  RetconLoweringStorage
struct  SwitchFieldIndex
struct  SwitchLoweringStorage

Public Member Functions

void clear ()
LLVM_ABI void analyze (Function &F, SmallVectorImpl< CoroFrameInst * > &CoroFrames, SmallVectorImpl< CoroSaveInst * > &UnusedCoroSaves, CoroPromiseInst *&CoroPromise)
LLVM_ABI void invalidateCoroutine (Function &F, SmallVectorImpl< CoroFrameInst * > &CoroFrames)
LLVM_ABI void initABI ()
LLVM_ABI void cleanCoroutine (SmallVectorImpl< CoroFrameInst * > &CoroFrames, SmallVectorImpl< CoroSaveInst * > &UnusedCoroSaves, CoroPromiseInst *CoroPromise)
CoroIdInstgetSwitchCoroId () const
AnyCoroIdRetconInstgetRetconCoroId () const
CoroIdAsyncInstgetAsyncCoroId () const
unsigned getSwitchIndexField () const
IntegerTypegetIndexType () const
ConstantIntgetIndex (uint64_t Value) const
PointerTypegetSwitchResumePointerType () const
FunctionTypegetResumeFunctionType () const
ArrayRef< Type * > getRetconResultTypes () const
ArrayRef< Type * > getRetconResumeTypes () const
CallingConv::ID getResumeFunctionCC () const
AllocaInstgetPromiseAlloca () const
BasicBlock::iterator getInsertPtAfterFramePtr () const
LLVM_ABI ValueemitAlloc (IRBuilder<> &Builder, Value *Size, CallGraph *CG) const
 Allocate memory according to the rules of the active lowering.
LLVM_ABI void emitDealloc (IRBuilder<> &Builder, Value *Ptr, CallGraph *CG) const
 Deallocate memory according to the rules of the active lowering.
 Shape ()=default
 Shape (Function &F)

Public Attributes

CoroBeginInstCoroBegin = nullptr
SmallVector< AnyCoroEndInst *, 4 > CoroEnds
SmallVector< CoroSizeInst *, 2 > CoroSizes
SmallVector< CoroAlignInst *, 2 > CoroAligns
SmallVector< AnyCoroSuspendInst *, 4 > CoroSuspends
SmallVector< CoroAwaitSuspendInst *, 4 > CoroAwaitSuspends
SmallVector< CallInst *, 2 > SymmetricTransfers
SmallVector< CallInst *, 2 > SwiftErrorOps
coro::ABI ABI
StructTypeFrameTy = nullptr
Align FrameAlign
uint64_t FrameSize = 0
ValueFramePtr = nullptr
BasicBlockAllocaSpillBlock = nullptr
union { 
   SwitchLoweringStorage   SwitchLowering 
   RetconLoweringStorage   RetconLowering 
   AsyncLoweringStorage   AsyncLowering 
}; 

Detailed Description

Definition at line 53 of file CoroShape.h.

Constructor & Destructor Documentation

◆ Shape() [1/2]

llvm::coro::Shape::Shape ( )
default

Referenced by doSplitCoroutine().

◆ Shape() [2/2]

llvm::coro::Shape::Shape ( Function & F)
inlineexplicit

Definition at line 272 of file CoroShape.h.

References analyze(), cleanCoroutine(), CoroBegin, F, and invalidateCoroutine().

Member Function Documentation

◆ analyze()

◆ cleanCoroutine()

◆ clear()

void llvm::coro::Shape::clear ( )
inline

◆ emitAlloc()

Value * coro::Shape::emitAlloc ( IRBuilder<> & Builder,
Value * Size,
CallGraph * CG ) const

Allocate memory according to the rules of the active lowering.

Parameters
CG- if non-null, will be updated for the new call

Definition at line 505 of file Coroutines.cpp.

References ABI, addCallToCallGraph(), llvm::Alloc, llvm::coro::Async, Call, llvm_unreachable, propagateCallAttrsFromCallee(), llvm::coro::Retcon, RetconLowering, llvm::coro::RetconOnce, Size, and llvm::coro::Switch.

◆ emitDealloc()

void coro::Shape::emitDealloc ( IRBuilder<> & Builder,
Value * Ptr,
CallGraph * CG ) const

Deallocate memory according to the rules of the active lowering.

Parameters
CG- if non-null, will be updated for the new call

Definition at line 528 of file Coroutines.cpp.

References ABI, addCallToCallGraph(), llvm::coro::Async, Call, llvm_unreachable, propagateCallAttrsFromCallee(), Ptr, llvm::coro::Retcon, RetconLowering, llvm::coro::RetconOnce, and llvm::coro::Switch.

Referenced by maybeFreeRetconStorage().

◆ getAsyncCoroId()

CoroIdAsyncInst * llvm::coro::Shape::getAsyncCoroId ( ) const
inline

Definition at line 168 of file CoroShape.h.

References ABI, assert(), llvm::coro::Async, llvm::cast(), and CoroBegin.

Referenced by analyze().

◆ getIndex()

ConstantInt * llvm::coro::Shape::getIndex ( uint64_t Value) const
inline

Definition at line 183 of file CoroShape.h.

References getIndexType().

Referenced by markCoroutineAsDone().

◆ getIndexType()

IntegerType * llvm::coro::Shape::getIndexType ( ) const
inline

Definition at line 178 of file CoroShape.h.

References ABI, assert(), llvm::cast(), FrameTy, getSwitchIndexField(), and llvm::coro::Switch.

Referenced by getIndex().

◆ getInsertPtAfterFramePtr()

BasicBlock::iterator llvm::coro::Shape::getInsertPtAfterFramePtr ( ) const
inline

◆ getPromiseAlloca()

AllocaInst * llvm::coro::Shape::getPromiseAlloca ( ) const
inline

Definition at line 244 of file CoroShape.h.

References ABI, llvm::coro::Switch, and SwitchLowering.

Referenced by buildFrameType(), and cleanCoroutine().

◆ getResumeFunctionCC()

CallingConv::ID llvm::coro::Shape::getResumeFunctionCC ( ) const
inline

◆ getResumeFunctionType()

◆ getRetconCoroId()

AnyCoroIdRetconInst * llvm::coro::Shape::getRetconCoroId ( ) const
inline

Definition at line 163 of file CoroShape.h.

References ABI, assert(), llvm::cast(), CoroBegin, llvm::coro::Retcon, and llvm::coro::RetconOnce.

Referenced by analyze(), and buildFrameType().

◆ getRetconResultTypes()

ArrayRef< Type * > llvm::coro::Shape::getRetconResultTypes ( ) const
inline

◆ getRetconResumeTypes()

ArrayRef< Type * > llvm::coro::Shape::getRetconResumeTypes ( ) const
inline

Definition at line 222 of file CoroShape.h.

References ABI, assert(), llvm::coro::Retcon, RetconLowering, and llvm::coro::RetconOnce.

◆ getSwitchCoroId()

CoroIdInst * llvm::coro::Shape::getSwitchCoroId ( ) const
inline

◆ getSwitchIndexField()

unsigned llvm::coro::Shape::getSwitchIndexField ( ) const
inline

Definition at line 173 of file CoroShape.h.

References ABI, assert(), FrameTy, llvm::coro::Switch, and SwitchLowering.

Referenced by getIndexType(), and markCoroutineAsDone().

◆ getSwitchResumePointerType()

PointerType * llvm::coro::Shape::getSwitchResumePointerType ( ) const
inline

◆ initABI()

LLVM_ABI void llvm::coro::Shape::initABI ( )

References LLVM_ABI.

◆ invalidateCoroutine()

void coro::Shape::invalidateCoroutine ( Function & F,
SmallVectorImpl< CoroFrameInst * > & CoroFrames )

Member Data Documentation

◆ [union]

union { ... } llvm::coro::Shape

◆ ABI

◆ AllocaSpillBlock

BasicBlock* llvm::coro::Shape::AllocaSpillBlock = nullptr

Definition at line 118 of file CoroShape.h.

Referenced by clear(), and insertSpills().

◆ AsyncLowering

AsyncLoweringStorage llvm::coro::Shape::AsyncLowering

◆ CoroAligns

SmallVector<CoroAlignInst *, 2> llvm::coro::Shape::CoroAligns

Definition at line 57 of file CoroShape.h.

Referenced by analyze(), clear(), and replaceFrameSizeAndAlignment().

◆ CoroAwaitSuspends

SmallVector<CoroAwaitSuspendInst *, 4> llvm::coro::Shape::CoroAwaitSuspends

Definition at line 59 of file CoroShape.h.

Referenced by analyze(), clear(), and lowerAwaitSuspends().

◆ CoroBegin

◆ CoroEnds

◆ CoroSizes

SmallVector<CoroSizeInst *, 2> llvm::coro::Shape::CoroSizes

Definition at line 56 of file CoroShape.h.

Referenced by analyze(), clear(), getFrameSizeForShape(), and replaceFrameSizeAndAlignment().

◆ CoroSuspends

◆ FrameAlign

◆ FramePtr

Value* llvm::coro::Shape::FramePtr = nullptr

◆ FrameSize

uint64_t llvm::coro::Shape::FrameSize = 0

Definition at line 116 of file CoroShape.h.

Referenced by buildFrameDebugInfo(), buildFrameType(), and llvm::CoroSplitPass::run().

◆ FrameTy

◆ RetconLowering

◆ SwiftErrorOps

SmallVector<CallInst *, 2> llvm::coro::Shape::SwiftErrorOps

◆ SwitchLowering

◆ SymmetricTransfers

SmallVector<CallInst *, 2> llvm::coro::Shape::SymmetricTransfers

Definition at line 60 of file CoroShape.h.

Referenced by clear(), and lowerAwaitSuspend().


The documentation for this struct was generated from the following files: