#include "CoroInstr.h"
#include "CoroInternal.h"
#include "CoroShape.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cassert>
#include <cstddef>
#include <utility>
usingnamespacellvm;
coro::LowererBase::LowererBase(Module &M)
: … { … }
CallInst *coro::LowererBase::makeSubFnCall(Value *Arg, int Index,
Instruction *InsertPt) { … }
static const char *const CoroIntrinsics[] = …;
#ifndef NDEBUG
static bool isCoroutineIntrinsicName(StringRef Name) {
return Intrinsic::lookupLLVMIntrinsicByName(CoroIntrinsics, Name) != -1;
}
#endif
bool coro::isSuspendBlock(BasicBlock *BB) { … }
bool coro::declaresAnyIntrinsic(const Module &M) { … }
bool coro::declaresIntrinsics(const Module &M,
const std::initializer_list<StringRef> List) { … }
void coro::replaceCoroFree(CoroIdInst *CoroId, bool Elide) { … }
void coro::suppressCoroAllocs(CoroIdInst *CoroId) { … }
void coro::suppressCoroAllocs(LLVMContext &Context,
ArrayRef<CoroAllocInst *> CoroAllocs) { … }
static void clear(coro::Shape &Shape) { … }
static CoroSaveInst *createCoroSave(CoroBeginInst *CoroBegin,
CoroSuspendInst *SuspendInst) { … }
void coro::Shape::buildFrom(Function &F) { … }
static void propagateCallAttrsFromCallee(CallInst *Call, Function *Callee) { … }
static void addCallToCallGraph(CallGraph *CG, CallInst *Call, Function *Callee){ … }
Value *coro::Shape::emitAlloc(IRBuilder<> &Builder, Value *Size,
CallGraph *CG) const { … }
void coro::Shape::emitDealloc(IRBuilder<> &Builder, Value *Ptr,
CallGraph *CG) const { … }
[[noreturn]] static void fail(const Instruction *I, const char *Reason,
Value *V) { … }
static void checkWFRetconPrototype(const AnyCoroIdRetconInst *I, Value *V) { … }
static void checkWFAlloc(const Instruction *I, Value *V) { … }
static void checkWFDealloc(const Instruction *I, Value *V) { … }
static void checkConstantInt(const Instruction *I, Value *V,
const char *Reason) { … }
void AnyCoroIdRetconInst::checkWellFormed() const { … }
static void checkAsyncFuncPointer(const Instruction *I, Value *V) { … }
void CoroIdAsyncInst::checkWellFormed() const { … }
static void checkAsyncContextProjectFunction(const Instruction *I,
Function *F) { … }
void CoroSuspendAsyncInst::checkWellFormed() const { … }
void CoroAsyncEndInst::checkWellFormed() const { … }