LLVM 22.0.0git
llvm::coro::BaseCloner Class Reference

#include "Transforms/Coroutines/CoroCloner.h"

Inheritance diagram for llvm::coro::BaseCloner:
[legend]

Public Member Functions

 BaseCloner (Function &OrigF, const Twine &Suffix, coro::Shape &Shape, CloneKind FKind, TargetTransformInfo &TTI)
virtual ~BaseCloner ()
FunctiongetFunction () const
virtual void create ()
 Clone the body of the original function into a resume function of some sort.

Static Public Member Functions

static FunctioncreateClone (Function &OrigF, const Twine &Suffix, coro::Shape &Shape, Function *NewF, AnyCoroSuspendInst *ActiveSuspend, TargetTransformInfo &TTI)
 Create a clone for a continuation lowering.

Protected Member Functions

 BaseCloner (Function &OrigF, const Twine &Suffix, coro::Shape &Shape, Function *NewF, AnyCoroSuspendInst *ActiveSuspend, TargetTransformInfo &TTI)
 Create a cloner for a continuation lowering.
bool isSwitchDestroyFunction ()
void replaceEntryBlock ()
ValuederiveNewFramePointer ()
 Derive the value of the new frame pointer.
void replaceRetconOrAsyncSuspendUses ()
 Replace uses of the active llvm.coro.suspend.retcon/async call with the arguments to the continuation function.
void replaceCoroSuspends ()
void replaceCoroEnds ()
void replaceCoroIsInRamp ()
void replaceSwiftErrorOps ()
void salvageDebugInfo ()
void handleFinalSuspend ()

Protected Attributes

FunctionOrigF
const TwineSuffix
coro::ShapeShape
CloneKind FKind
IRBuilder Builder
TargetTransformInfoTTI
ValueToValueMapTy VMap
FunctionNewF = nullptr
ValueNewFramePtr = nullptr
AnyCoroSuspendInstActiveSuspend = nullptr
 The active suspend instruction; meaningful only for continuation and async ABIs.

Detailed Description

Definition at line 43 of file CoroCloner.h.

Constructor & Destructor Documentation

◆ BaseCloner() [1/2]

llvm::coro::BaseCloner::BaseCloner ( Function & OrigF,
const Twine & Suffix,
coro::Shape & Shape,
Function * NewF,
AnyCoroSuspendInst * ActiveSuspend,
TargetTransformInfo & TTI )
inlineprotected

Create a cloner for a continuation lowering.

Definition at line 61 of file CoroCloner.h.

References ActiveSuspend, assert(), llvm::coro::Async, Builder, llvm::coro::Continuation, FKind, NewF, OrigF, llvm::coro::Retcon, llvm::coro::RetconOnce, Shape, Suffix, and TTI.

Referenced by createClone(), and llvm::coro::SwitchCloner::SwitchCloner().

◆ BaseCloner() [2/2]

llvm::coro::BaseCloner::BaseCloner ( Function & OrigF,
const Twine & Suffix,
coro::Shape & Shape,
CloneKind FKind,
TargetTransformInfo & TTI )
inline

Definition at line 76 of file CoroCloner.h.

References Builder, FKind, OrigF, Shape, Suffix, and TTI.

◆ ~BaseCloner()

virtual llvm::coro::BaseCloner::~BaseCloner ( )
inlinevirtual

Definition at line 81 of file CoroCloner.h.

Member Function Documentation

◆ create()

◆ createClone()

Function * llvm::coro::BaseCloner::createClone ( Function & OrigF,
const Twine & Suffix,
coro::Shape & Shape,
Function * NewF,
AnyCoroSuspendInst * ActiveSuspend,
TargetTransformInfo & TTI )
inlinestatic

◆ deriveNewFramePointer()

Value * coro::BaseCloner::deriveNewFramePointer ( )
protected

◆ getFunction()

Function * llvm::coro::BaseCloner::getFunction ( ) const
inline

Definition at line 97 of file CoroCloner.h.

References assert(), and NewF.

Referenced by createClone(), and llvm::coro::SwitchCloner::createClone().

◆ handleFinalSuspend()

◆ isSwitchDestroyFunction()

bool llvm::coro::BaseCloner::isSwitchDestroyFunction ( )
inlineprotected

◆ replaceCoroEnds()

void coro::BaseCloner::replaceCoroEnds ( )
protected

Definition at line 551 of file CoroSplit.cpp.

References llvm::cast(), NewFramePtr, replaceCoroEnd(), Shape, and VMap.

Referenced by create().

◆ replaceCoroIsInRamp()

void coro::BaseCloner::replaceCoroIsInRamp ( )
protected

Definition at line 560 of file CoroSplit.cpp.

References llvm::cast(), llvm::ConstantInt::getFalse(), II, OrigF, Shape, and VMap.

Referenced by create().

◆ replaceCoroSuspends()

void coro::BaseCloner::replaceCoroSuspends ( )
protected

◆ replaceEntryBlock()

◆ replaceRetconOrAsyncSuspendUses()

void coro::BaseCloner::replaceRetconOrAsyncSuspendUses ( )
protected

Replace uses of the active llvm.coro.suspend.retcon/async call with the arguments to the continuation function.

This assumes that the builder has a meaningful insertion point.

Definition at line 466 of file CoroSplit.cpp.

References ActiveSuspend, assert(), llvm::coro::Async, Builder, llvm::dyn_cast(), llvm::enumerate(), llvm::PoisonValue::get(), I, llvm::isa(), llvm::make_early_inc_range(), NewF, llvm::coro::Retcon, llvm::coro::RetconOnce, Shape, and VMap.

Referenced by create().

◆ replaceSwiftErrorOps()

void coro::BaseCloner::replaceSwiftErrorOps ( )
protected

Definition at line 636 of file CoroSplit.cpp.

References NewF, replaceSwiftErrorOps(), Shape, and VMap.

◆ salvageDebugInfo()

Member Data Documentation

◆ ActiveSuspend

AnyCoroSuspendInst* llvm::coro::BaseCloner::ActiveSuspend = nullptr
protected

The active suspend instruction; meaningful only for continuation and async ABIs.

Definition at line 58 of file CoroCloner.h.

Referenced by BaseCloner(), create(), llvm::coro::SwitchCloner::create(), createClone(), deriveNewFramePointer(), replaceCoroSuspends(), replaceEntryBlock(), and replaceRetconOrAsyncSuspendUses().

◆ Builder

◆ FKind

◆ NewF

◆ NewFramePtr

Value* llvm::coro::BaseCloner::NewFramePtr = nullptr
protected

Definition at line 54 of file CoroCloner.h.

Referenced by create(), handleFinalSuspend(), and replaceCoroEnds().

◆ OrigF

◆ Shape

◆ Suffix

◆ TTI

◆ VMap


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