LLVM  8.0.1
Macros | Functions
CoroSplit.cpp File Reference
#include "CoroInstr.h"
#include "CoroInternal.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <iterator>
Include dependency graph for CoroSplit.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "coro-split"
 

Functions

static BasicBlockcreateResumeEntryBlock (Function &F, coro::Shape &Shape)
 
static void replaceFallthroughCoroEnd (IntrinsicInst *End, ValueToValueMapTy &VMap)
 
static void replaceUnwindCoroEnds (coro::Shape &Shape, ValueToValueMapTy &VMap)
 
static void handleFinalSuspend (IRBuilder<> &Builder, Value *FramePtr, coro::Shape &Shape, SwitchInst *Switch, bool IsDestroy)
 
static FunctioncreateClone (Function &F, Twine Suffix, coro::Shape &Shape, BasicBlock *ResumeEntry, int8_t FnIndex)
 
static void removeCoroEnds (coro::Shape &Shape)
 
static void replaceFrameSize (coro::Shape &Shape)
 
static void setCoroInfo (Function &F, CoroBeginInst *CoroBegin, std::initializer_list< Function *> Fns)
 
static void updateCoroFrame (coro::Shape &Shape, Function *ResumeFn, Function *DestroyFn, Function *CleanupFn)
 
static void postSplitCleanup (Function &F)
 
static void scanPHIsAndUpdateValueMap (Instruction *Prev, BasicBlock *NewBlock, DenseMap< Value *, Value *> &ResolvedValues)
 
static bool simplifyTerminatorLeadingToRet (Instruction *InitialInst)
 
static void addMustTailToCoroResumes (Function &F)
 
static void handleNoSuspendCoroutine (CoroBeginInst *CoroBegin, Type *FrameTy)
 
static bool hasCallsInBlockBetween (Instruction *From, Instruction *To)
 
static bool hasCallsInBlocksBetween (BasicBlock *SaveBB, BasicBlock *ResDesBB)
 
static bool hasCallsBetween (Instruction *Save, Instruction *ResumeOrDestroy)
 
static bool simplifySuspendPoint (CoroSuspendInst *Suspend, CoroBeginInst *CoroBegin)
 
static void simplifySuspendPoints (coro::Shape &Shape)
 
static SmallPtrSet< BasicBlock *, 4 > getCoroBeginPredBlocks (CoroBeginInst *CB)
 
static SmallPtrSet< Instruction *, 8 > getNotRelocatableInstructions (CoroBeginInst *CoroBegin, SmallPtrSetImpl< BasicBlock *> &RelocBlocks)
 
static void relocateInstructionBefore (CoroBeginInst *CoroBegin, Function &F)
 
static void splitCoroutine (Function &F, CallGraph &CG, CallGraphSCC &SCC)
 
static void prepareForSplit (Function &F, CallGraph &CG)
 
static void createDevirtTriggerFunc (CallGraph &CG, CallGraphSCC &SCC)
 
 INITIALIZE_PASS (CoroSplit, "coro-split", "Split coroutine into a set of functions driving its state machine", false, false) Pass *llvm
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "coro-split"

Definition at line 72 of file CoroSplit.cpp.

Function Documentation

◆ addMustTailToCoroResumes()

static void addMustTailToCoroResumes ( Function F)
static

◆ createClone()

static Function* createClone ( Function F,
Twine  Suffix,
coro::Shape Shape,
BasicBlock ResumeEntry,
int8_t  FnIndex 
)
static

◆ createDevirtTriggerFunc()

static void createDevirtTriggerFunc ( CallGraph CG,
CallGraphSCC SCC 
)
static

◆ createResumeEntryBlock()

static BasicBlock* createResumeEntryBlock ( Function F,
coro::Shape Shape 
)
static

◆ getCoroBeginPredBlocks()

static SmallPtrSet<BasicBlock *, 4> getCoroBeginPredBlocks ( CoroBeginInst CB)
static

◆ getNotRelocatableInstructions()

static SmallPtrSet<Instruction *, 8> getNotRelocatableInstructions ( CoroBeginInst CoroBegin,
SmallPtrSetImpl< BasicBlock *> &  RelocBlocks 
)
static

◆ handleFinalSuspend()

static void handleFinalSuspend ( IRBuilder<> &  Builder,
Value FramePtr,
coro::Shape Shape,
SwitchInst Switch,
bool  IsDestroy 
)
static

◆ handleNoSuspendCoroutine()

static void handleNoSuspendCoroutine ( CoroBeginInst CoroBegin,
Type FrameTy 
)
static

◆ hasCallsBetween()

static bool hasCallsBetween ( Instruction Save,
Instruction ResumeOrDestroy 
)
static

◆ hasCallsInBlockBetween()

static bool hasCallsInBlockBetween ( Instruction From,
Instruction To 
)
static

Definition at line 544 of file CoroSplit.cpp.

References I.

Referenced by hasCallsBetween(), and hasCallsInBlocksBetween().

◆ hasCallsInBlocksBetween()

static bool hasCallsInBlocksBetween ( BasicBlock SaveBB,
BasicBlock ResDesBB 
)
static

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( CoroSplit  ,
"coro-split ,
"Split coroutine into a set of functions driving its state machine"  ,
false  ,
false   
)

Definition at line 944 of file CoroSplit.cpp.

◆ postSplitCleanup()

static void postSplitCleanup ( Function F)
static

◆ prepareForSplit()

static void prepareForSplit ( Function F,
CallGraph CG 
)
static

◆ relocateInstructionBefore()

static void relocateInstructionBefore ( CoroBeginInst CoroBegin,
Function F 
)
static

◆ removeCoroEnds()

static void removeCoroEnds ( coro::Shape Shape)
static

◆ replaceFallthroughCoroEnd()

static void replaceFallthroughCoroEnd ( IntrinsicInst End,
ValueToValueMapTy VMap 
)
static

Definition at line 173 of file CoroSplit.cpp.

Referenced by createClone().

◆ replaceFrameSize()

static void replaceFrameSize ( coro::Shape Shape)
static

◆ replaceUnwindCoroEnds()

static void replaceUnwindCoroEnds ( coro::Shape Shape,
ValueToValueMapTy VMap 
)
static

◆ scanPHIsAndUpdateValueMap()

static void scanPHIsAndUpdateValueMap ( Instruction Prev,
BasicBlock NewBlock,
DenseMap< Value *, Value *> &  ResolvedValues 
)
static

◆ setCoroInfo()

static void setCoroInfo ( Function F,
CoroBeginInst CoroBegin,
std::initializer_list< Function *>  Fns 
)
static

◆ simplifySuspendPoint()

static bool simplifySuspendPoint ( CoroSuspendInst Suspend,
CoroBeginInst CoroBegin 
)
static

◆ simplifySuspendPoints()

static void simplifySuspendPoints ( coro::Shape Shape)
static

◆ simplifyTerminatorLeadingToRet()

static bool simplifyTerminatorLeadingToRet ( Instruction InitialInst)
static

◆ splitCoroutine()

static void splitCoroutine ( Function F,
CallGraph CG,
CallGraphSCC SCC 
)
static

◆ updateCoroFrame()

static void updateCoroFrame ( coro::Shape Shape,
Function ResumeFn,
Function DestroyFn,
Function CleanupFn 
)
static