LLVM 24.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 ()=default
Function * getFunction () const
virtual void create ()
 Clone the body of the original function into a resume function of some sort.

Static Public Member Functions

static Function * createClone (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 ()
Value * deriveNewFramePointer ()
 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

Function & OrigF
const Twine & Suffix
coro::Shape & Shape
CloneKind FKind
IRBuilder Builder
TargetTransformInfo & TTI
ValueToValueMapTy VMap
Function * NewF = nullptr
Value * NewFramePtr = nullptr
AnyCoroSuspendInst * ActiveSuspend = nullptr
 The active suspend instruction; meaningful only for continuation and async ABIs.

Detailed Description

Definition at line 42 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

◆ BaseCloner() [2/2]

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

Definition at line 75 of file CoroCloner.h.

References Builder, FKind, getContext(), OrigF, Shape, Suffix, and TTI.

◆ ~BaseCloner()

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

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 96 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 611 of file CoroSplit.cpp.

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

Referenced by create().

◆ replaceCoroIsInRamp()

void coro::BaseCloner::replaceCoroIsInRamp ( )
protected

Definition at line 620 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 526 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 696 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 57 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

◆ OrigF

◆ Shape

◆ Suffix

◆ TTI

◆ VMap


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