LLVM 19.0.0git
Classes | Public Member Functions | Public Attributes | List of all members
llvm::coro::Shape Struct Reference

#include "Transforms/Coroutines/CoroInternal.h"

Classes

struct  AsyncLoweringStorage
 
struct  RetconLoweringStorage
 
struct  SwitchFieldIndex
 
struct  SwitchLoweringStorage
 

Public Member Functions

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, bool OptimizeFrame=false)
 
void buildFrom (Function &F)
 

Public Attributes

CoroBeginInstCoroBegin
 
SmallVector< AnyCoroEndInst *, 4 > CoroEnds
 
SmallVector< CoroSizeInst *, 2 > CoroSizes
 
SmallVector< CoroAlignInst *, 2 > CoroAligns
 
SmallVector< AnyCoroSuspendInst *, 4 > CoroSuspends
 
SmallVector< CallInst *, 2 > SwiftErrorOps
 
SmallVector< CoroAwaitSuspendInst *, 4 > CoroAwaitSuspends
 
coro::ABI ABI
 
StructTypeFrameTy
 
Align FrameAlign
 
uint64_t FrameSize
 
ValueFramePtr
 
BasicBlockAllocaSpillBlock
 
bool OptimizeFrame
 This would only be true if optimization are enabled.
 
union {
   SwitchLoweringStorage   SwitchLowering
 
   RetconLoweringStorage   RetconLowering
 
   AsyncLoweringStorage   AsyncLowering
 
}; 
 

Detailed Description

Definition at line 80 of file CoroInternal.h.

Constructor & Destructor Documentation

◆ Shape() [1/2]

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

◆ Shape() [2/2]

llvm::coro::Shape::Shape ( Function F,
bool  OptimizeFrame = false 
)
inlineexplicit

Definition at line 268 of file CoroInternal.h.

References F.

Member Function Documentation

◆ buildFrom()

void coro::Shape::buildFrom ( Function F)

◆ 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 456 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 lowerNonLocalAlloca(), and splitRetconCoroutine().

◆ 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 479 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 lowerNonLocalAlloca(), and maybeFreeRetconStorage().

◆ getAsyncCoroId()

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

Definition at line 164 of file CoroInternal.h.

References assert(), and llvm::CoroBeginInst::getId().

◆ getIndex()

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

Definition at line 179 of file CoroInternal.h.

Referenced by markCoroutineAsDone().

◆ getIndexType()

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

Definition at line 174 of file CoroInternal.h.

References assert(), and llvm::StructType::getElementType().

◆ getInsertPtAfterFramePtr()

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

Definition at line 248 of file CoroInternal.h.

References FramePtr, and I.

Referenced by buildFrameDebugInfo(), and insertSpills().

◆ getPromiseAlloca()

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

Definition at line 242 of file CoroInternal.h.

Referenced by buildFrameDebugInfo(), and buildFrameType().

◆ getResumeFunctionCC()

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

Definition at line 228 of file CoroInternal.h.

References llvm_unreachable.

◆ getResumeFunctionType()

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

Definition at line 189 of file CoroInternal.h.

References llvm::Type::getContext(), and llvm_unreachable.

Referenced by createCloneDeclaration(), and replaceFallthroughCoroEnd().

◆ getRetconCoroId()

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

Definition at line 158 of file CoroInternal.h.

References assert(), and llvm::CoroBeginInst::getId().

Referenced by buildFrameType().

◆ getRetconResultTypes()

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

◆ getRetconResumeTypes()

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

Definition at line 219 of file CoroInternal.h.

References assert().

◆ getSwitchCoroId()

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

Definition at line 153 of file CoroInternal.h.

References assert(), and llvm::CoroBeginInst::getId().

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

◆ getSwitchIndexField()

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

Definition at line 169 of file CoroInternal.h.

References assert().

Referenced by markCoroutineAsDone().

◆ getSwitchResumePointerType()

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

Definition at line 183 of file CoroInternal.h.

References assert(), and llvm::StructType::getElementType().

Member Data Documentation

◆ 

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

◆ ABI

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

◆ AllocaSpillBlock

BasicBlock* llvm::coro::Shape::AllocaSpillBlock

Definition at line 110 of file CoroInternal.h.

Referenced by clear(), and insertSpills().

◆ AsyncLowering

AsyncLoweringStorage llvm::coro::Shape::AsyncLowering

◆ CoroAligns

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

Definition at line 84 of file CoroInternal.h.

Referenced by replaceFrameSizeAndAlignment().

◆ CoroAwaitSuspends

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

Definition at line 87 of file CoroInternal.h.

Referenced by lowerAwaitSuspends().

◆ CoroBegin

CoroBeginInst* llvm::coro::Shape::CoroBegin

◆ CoroEnds

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

◆ CoroSizes

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

Definition at line 83 of file CoroInternal.h.

Referenced by clear(), and replaceFrameSizeAndAlignment().

◆ CoroSuspends

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

◆ FrameAlign

Align llvm::coro::Shape::FrameAlign

◆ FramePtr

Value* llvm::coro::Shape::FramePtr

◆ FrameSize

uint64_t llvm::coro::Shape::FrameSize

Definition at line 108 of file CoroInternal.h.

Referenced by buildFrameDebugInfo(), and buildFrameType().

◆ FrameTy

StructType* llvm::coro::Shape::FrameTy

◆ OptimizeFrame

bool llvm::coro::Shape::OptimizeFrame

This would only be true if optimization are enabled.

Definition at line 113 of file CoroInternal.h.

Referenced by insertSpills(), and splitCoroutine().

◆ RetconLowering

RetconLoweringStorage llvm::coro::Shape::RetconLowering

Definition at line 149 of file CoroInternal.h.

Referenced by buildFrameType(), maybeFreeRetconStorage(), and splitRetconCoroutine().

◆ SwiftErrorOps

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

◆ SwitchLowering

SwitchLoweringStorage llvm::coro::Shape::SwitchLowering

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