LLVM 20.0.0git
Classes | Public Member Functions | Public Attributes | List of all members
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 ()
 
void analyze (Function &F, SmallVectorImpl< CoroFrameInst * > &CoroFrames, SmallVectorImpl< CoroSaveInst * > &UnusedCoroSaves)
 
void invalidateCoroutine (Function &F, SmallVectorImpl< CoroFrameInst * > &CoroFrames)
 
void initABI ()
 
void cleanCoroutine (SmallVectorImpl< CoroFrameInst * > &CoroFrames, SmallVectorImpl< CoroSaveInst * > &UnusedCoroSaves)
 
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
 
ValueemitAlloc (IRBuilder<> &Builder, Value *Size, CallGraph *CG) const
 Allocate memory according to the rules of the active lowering.
 
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 52 of file CoroShape.h.

Constructor & Destructor Documentation

◆ Shape() [1/2]

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

◆ Shape() [2/2]

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

Definition at line 265 of file CoroShape.h.

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

Member Function Documentation

◆ analyze()

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

◆ cleanCoroutine()

void coro::Shape::cleanCoroutine ( SmallVectorImpl< CoroFrameInst * > &  CoroFrames,
SmallVectorImpl< CoroSaveInst * > &  UnusedCoroSaves 
)

Definition at line 479 of file Coroutines.cpp.

References llvm::SmallVectorImpl< T >::clear().

Referenced by Shape().

◆ 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 addCallToCallGraph(), llvm::Alloc, llvm::coro::Async, llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateIntCast(), llvm_unreachable, propagateCallAttrsFromCallee(), llvm::coro::Retcon, llvm::coro::RetconOnce, Size, and llvm::coro::Switch.

Referenced by llvm::coro::AnyRetconABI::splitCoroutine().

◆ 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 addCallToCallGraph(), llvm::coro::Async, llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateCall(), llvm_unreachable, propagateCallAttrsFromCallee(), Ptr, llvm::coro::Retcon, llvm::coro::RetconOnce, and llvm::coro::Switch.

Referenced by maybeFreeRetconStorage().

◆ getAsyncCoroId()

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

◆ getIndex()

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

Definition at line 178 of file CoroShape.h.

References getIndexType().

Referenced by markCoroutineAsDone().

◆ getIndexType()

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

◆ getInsertPtAfterFramePtr()

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

Definition at line 245 of file CoroShape.h.

References FramePtr, and I.

Referenced by buildFrameDebugInfo(), llvm::coro::getSpillInsertionPt(), and insertSpills().

◆ getPromiseAlloca()

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

◆ getResumeFunctionCC()

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

◆ getResumeFunctionType()

FunctionType * llvm::coro::Shape::getResumeFunctionType ( ) const
inline

◆ getRetconCoroId()

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

◆ getRetconResultTypes()

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

◆ getRetconResumeTypes()

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

◆ getSwitchCoroId()

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

◆ getSwitchIndexField()

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

◆ getSwitchResumePointerType()

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

◆ initABI()

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

◆ invalidateCoroutine()

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

Member Data Documentation

◆ 

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

◆ ABI

coro::ABI llvm::coro::Shape::ABI

◆ AllocaSpillBlock

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

Definition at line 113 of file CoroShape.h.

Referenced by clear(), insertSpills(), and llvm::coro::BaseCloner::replaceEntryBlock().

◆ AsyncLowering

AsyncLoweringStorage llvm::coro::Shape::AsyncLowering

◆ CoroAligns

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

Definition at line 56 of file CoroShape.h.

Referenced by clear(), and replaceFrameSizeAndAlignment().

◆ CoroAwaitSuspends

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

Definition at line 58 of file CoroShape.h.

Referenced by clear(), and lowerAwaitSuspends().

◆ CoroBegin

CoroBeginInst* llvm::coro::Shape::CoroBegin = nullptr

◆ CoroEnds

SmallVector<AnyCoroEndInst *, 4> llvm::coro::Shape::CoroEnds

◆ CoroSizes

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

Definition at line 55 of file CoroShape.h.

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

◆ CoroSuspends

SmallVector<AnyCoroSuspendInst *, 4> llvm::coro::Shape::CoroSuspends

◆ FrameAlign

Align llvm::coro::Shape::FrameAlign

◆ FramePtr

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

◆ FrameSize

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

◆ FrameTy

StructType* llvm::coro::Shape::FrameTy = nullptr

◆ RetconLowering

RetconLoweringStorage llvm::coro::Shape::RetconLowering

◆ SwiftErrorOps

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

◆ SwitchLowering

SwitchLoweringStorage llvm::coro::Shape::SwitchLowering

◆ SymmetricTransfers

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

Definition at line 59 of file CoroShape.h.

Referenced by clear(), llvm::coro::BaseCloner::create(), and lowerAwaitSuspend().


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