LLVM 22.0.0git
Functions | Variables
Coroutines.cpp File Reference
#include "CoroInternal.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/Coroutines/ABI.h"
#include "llvm/Transforms/Coroutines/CoroInstr.h"
#include "llvm/Transforms/Coroutines/CoroShape.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cassert>
#include <cstddef>
#include <utility>

Go to the source code of this file.

Functions

static CoroSaveInstcreateCoroSave (CoroBeginInst *CoroBegin, CoroSuspendInst *SuspendInst)
 
static void propagateCallAttrsFromCallee (CallInst *Call, Function *Callee)
 
static void addCallToCallGraph (CallGraph *CG, CallInst *Call, Function *Callee)
 
static void fail (const Instruction *I, const char *Reason, Value *V)
 
static void checkWFRetconPrototype (const AnyCoroIdRetconInst *I, Value *V)
 Check that the given value is a well-formed prototype for the llvm.coro.id.retcon.
 
static void checkWFAlloc (const Instruction *I, Value *V)
 Check that the given value is a well-formed allocator.
 
static void checkWFDealloc (const Instruction *I, Value *V)
 Check that the given value is a well-formed deallocator.
 
static void checkConstantInt (const Instruction *I, Value *V, const char *Reason)
 
static void checkAsyncFuncPointer (const Instruction *I, Value *V)
 
static void checkAsyncContextProjectFunction (const Instruction *I, Function *F)
 

Variables

static Intrinsic::ID NonOverloadedCoroIntrinsics []
 

Function Documentation

◆ addCallToCallGraph()

static void addCallToCallGraph ( CallGraph CG,
CallInst Call,
Function Callee 
)
static

Definition at line 500 of file Coroutines.cpp.

Referenced by llvm::coro::Shape::emitAlloc(), and llvm::coro::Shape::emitDealloc().

◆ checkAsyncContextProjectFunction()

static void checkAsyncContextProjectFunction ( const Instruction I,
Function F 
)
static

Definition at line 663 of file Coroutines.cpp.

References F, fail(), and I.

Referenced by llvm::CoroSuspendAsyncInst::checkWellFormed().

◆ checkAsyncFuncPointer()

static void checkAsyncFuncPointer ( const Instruction I,
Value V 
)
static

Definition at line 647 of file Coroutines.cpp.

References fail(), and I.

Referenced by llvm::CoroIdAsyncInst::checkWellFormed().

◆ checkConstantInt()

static void checkConstantInt ( const Instruction I,
Value V,
const char Reason 
)
static

Definition at line 630 of file Coroutines.cpp.

References fail(), and I.

Referenced by llvm::AnyCoroIdRetconInst::checkWellFormed(), and llvm::CoroIdAsyncInst::checkWellFormed().

◆ checkWFAlloc()

static void checkWFAlloc ( const Instruction I,
Value V 
)
static

Check that the given value is a well-formed allocator.

Definition at line 601 of file Coroutines.cpp.

References F, fail(), and I.

Referenced by llvm::AnyCoroIdRetconInst::checkWellFormed().

◆ checkWFDealloc()

static void checkWFDealloc ( const Instruction I,
Value V 
)
static

Check that the given value is a well-formed deallocator.

Definition at line 616 of file Coroutines.cpp.

References F, fail(), and I.

Referenced by llvm::AnyCoroIdRetconInst::checkWellFormed().

◆ checkWFRetconPrototype()

static void checkWFRetconPrototype ( const AnyCoroIdRetconInst I,
Value V 
)
static

Check that the given value is a well-formed prototype for the llvm.coro.id.retcon.

  • intrinsics.

Definition at line 565 of file Coroutines.cpp.

References F, fail(), and I.

Referenced by llvm::AnyCoroIdRetconInst::checkWellFormed().

◆ createCoroSave()

static CoroSaveInst * createCoroSave ( CoroBeginInst CoroBegin,
CoroSuspendInst SuspendInst 
)
static

◆ fail()

static void fail ( const Instruction I,
const char Reason,
Value V 
)
static

Definition at line 550 of file Coroutines.cpp.

References llvm::errs(), I, and llvm::report_fatal_error().

◆ propagateCallAttrsFromCallee()

static void propagateCallAttrsFromCallee ( CallInst Call,
Function Callee 
)
static

Definition at line 495 of file Coroutines.cpp.

Referenced by llvm::coro::Shape::emitAlloc(), and llvm::coro::Shape::emitDealloc().

Variable Documentation

◆ NonOverloadedCoroIntrinsics

Intrinsic::ID NonOverloadedCoroIntrinsics[]
static
Initial value:
= {
Intrinsic::coro_alloc,
Intrinsic::coro_async_context_alloc,
Intrinsic::coro_async_context_dealloc,
Intrinsic::coro_async_resume,
Intrinsic::coro_async_size_replace,
Intrinsic::coro_await_suspend_bool,
Intrinsic::coro_await_suspend_handle,
Intrinsic::coro_await_suspend_void,
Intrinsic::coro_begin,
Intrinsic::coro_begin_custom_abi,
Intrinsic::coro_destroy,
Intrinsic::coro_done,
Intrinsic::coro_end,
Intrinsic::coro_end_async,
Intrinsic::coro_frame,
Intrinsic::coro_free,
Intrinsic::coro_id,
Intrinsic::coro_id_async,
Intrinsic::coro_id_retcon,
Intrinsic::coro_id_retcon_once,
Intrinsic::coro_noop,
Intrinsic::coro_prepare_async,
Intrinsic::coro_prepare_retcon,
Intrinsic::coro_promise,
Intrinsic::coro_resume,
Intrinsic::coro_save,
Intrinsic::coro_subfn_addr,
Intrinsic::coro_suspend,
}

Definition at line 67 of file Coroutines.cpp.

Referenced by llvm::coro::declaresAnyIntrinsic().