LLVM: llvm::coro::BaseCloner Class Reference (original) (raw)

#include "[Transforms/Coroutines/CoroCloner.h](CoroCloner%5F8h%5Fsource.html)"

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.
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.

Definition at line 42 of file CoroCloner.h.

Create a cloner for a continuation lowering.

Definition at line 60 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]

~BaseCloner()

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

create()

void coro::BaseCloner::create ( ) virtual

Clone the body of the original function into a resume function of some sort.

FIXME: Is it really good to add the NoAlias attribute?

Reimplemented in llvm::coro::SwitchCloner.

Definition at line 876 of file CoroSplit.cpp.

References A(), ActiveSuspend, addAsyncContextAttrs(), addFramePointerAttrs(), addSwiftSelfAttrs(), assert(), llvm::coro::Async, llvm::SmallVectorTemplateCommon< T, typename >::back(), Builder, llvm::cast(), llvm::changeToUnreachable(), llvm::CloneFunctionInto(), deriveNewFramePointer(), llvm::Instruction::eraseFromParent(), llvm::GlobalValue::ExternalLinkage, llvm::MDString::get(), llvm::PoisonValue::get(), llvm::BasicBlock::getParent(), llvm::BasicBlock::getTerminator(), llvm::PointerType::getUnqual(), handleFinalSuspend(), llvm::LocalChangesOnly, NewF, NewFramePtr, OrigF, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), replaceCoroEnds(), replaceCoroIsInRamp(), replaceCoroSuspends(), replaceEntryBlock(), replaceRetconOrAsyncSuspendUses(), replaceSwiftErrorOps(), llvm::MDNode::replaceWithUniqued(), llvm::coro::Retcon, llvm::coro::RetconOnce, llvm::coro::salvageDebugInfo(), Shape, llvm::BasicBlock::splitBasicBlock(), llvm::coro::Switch, llvm::CallInst::TCK_MustTail, TTI, updateScopeLine(), and VMap.

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

createClone()

Create a clone for a continuation lowering.

Definition at line 83 of file CoroCloner.h.

References ActiveSuspend, assert(), llvm::coro::Async, BaseCloner(), create(), getFunction(), NewF, OrigF, llvm::coro::Retcon, llvm::coro::RetconOnce, Shape, Suffix, and TTI.

Referenced by llvm::coro::AnyRetconABI::splitCoroutine(), and llvm::coro::AsyncABI::splitCoroutine().

deriveNewFramePointer()

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

Derive the value of the new frame pointer.

Definition at line 742 of file CoroSplit.cpp.

References ActiveSuspend, assert(), llvm::coro::Async, Builder, llvm::cast(), llvm::Type::getInt8Ty(), llvm::PointerType::getUnqual(), llvm::InlineFunction(), InlineInfo, llvm_unreachable, NewF, llvm::coro::Retcon, llvm::coro::RetconOnce, Shape, llvm::coro::Switch, and VMap.

Referenced by create().

getFunction()

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

handleFinalSuspend()

void coro::BaseCloner::handleFinalSuspend ( ) protected

Definition at line 402 of file CoroSplit.cpp.

References assert(), Builder, llvm::cast(), Cond, llvm::Instruction::eraseFromParent(), llvm::BasicBlock::getTerminator(), isSwitchDestroyFunction(), NewF, NewFramePtr, llvm::coro::Shape::SwitchFieldIndex::Resume, Shape, llvm::BasicBlock::splitBasicBlock(), llvm::coro::Switch, and VMap.

Referenced by create().

isSwitchDestroyFunction()

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

replaceCoroEnds()

void coro::BaseCloner::replaceCoroEnds ( ) protected

replaceCoroIsInRamp()

void coro::BaseCloner::replaceCoroIsInRamp ( ) protected

replaceCoroSuspends()

void coro::BaseCloner::replaceCoroSuspends ( ) protected

replaceEntryBlock()

void coro::BaseCloner::replaceEntryBlock ( ) protected

Definition at line 673 of file CoroSplit.cpp.

References ActiveSuspend, assert(), llvm::coro::Async, Builder, llvm::cast(), llvm::dyn_cast(), F, I, instructions, llvm::isa(), llvm::DominatorTree::isReachableFromEntry(), llvm::make_early_inc_range(), NewF, llvm::coro::Retcon, llvm::coro::RetconOnce, Shape, Suffix, llvm::coro::Switch, and VMap.

Referenced by create().

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

salvageDebugInfo()

void coro::BaseCloner::salvageDebugInfo ( ) protected

Definition at line 640 of file CoroSplit.cpp.

References collectDbgVariableRecords(), llvm::dyn_cast(), llvm::for_each(), I, llvm::isa(), llvm::isa_and_nonnull(), llvm::isPotentiallyReachable(), NewF, OrigF, llvm::coro::salvageDebugInfo(), llvm::Value::users(), and Uses.

ActiveSuspend

Builder

FKind

NewF

Function* llvm::coro::BaseCloner::NewF = nullptr protected

Definition at line 52 of file CoroCloner.h.

Referenced by BaseCloner(), create(), llvm::coro::SwitchCloner::create(), createClone(), deriveNewFramePointer(), getFunction(), handleFinalSuspend(), replaceEntryBlock(), replaceRetconOrAsyncSuspendUses(), replaceSwiftErrorOps(), and salvageDebugInfo().

NewFramePtr

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

OrigF

Shape

Definition at line 46 of file CoroCloner.h.

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

Suffix

TTI

VMap


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