LLVM 22.0.0git
llvm::jitlink::SimpleSegmentAlloc Class Reference

A utility class for making simple allocations using JITLinkMemoryManager. More...

#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"

Classes

struct  Segment
 Describes a segment to be allocated. More...
struct  SegmentInfo
 Describes the segment working memory and executor address. More...

Public Types

using SegmentMap = orc::AllocGroupSmallMap<Segment>
using OnCreatedFunction = unique_function<void(Expected<SimpleSegmentAlloc>)>
using OnFinalizedFunction

Public Member Functions

LLVM_ABI SimpleSegmentAlloc (SimpleSegmentAlloc &&)
LLVM_ABI SimpleSegmentAllocoperator= (SimpleSegmentAlloc &&)
LLVM_ABI ~SimpleSegmentAlloc ()
LLVM_ABI SegmentInfo getSegInfo (orc::AllocGroup AG)
 Returns the SegmentInfo for the given group.
void finalize (OnFinalizedFunction OnFinalized)
 Finalize all groups (async version).
Expected< JITLinkMemoryManager::FinalizedAllocfinalize ()
 Finalize all groups.

Static Public Member Functions

static LLVM_ABI void Create (JITLinkMemoryManager &MemMgr, std::shared_ptr< orc::SymbolStringPool > SSP, Triple TT, const JITLinkDylib *JD, SegmentMap Segments, OnCreatedFunction OnCreated)
static LLVM_ABI Expected< SimpleSegmentAllocCreate (JITLinkMemoryManager &MemMgr, std::shared_ptr< orc::SymbolStringPool > SSP, Triple TT, const JITLinkDylib *JD, SegmentMap Segments)

Detailed Description

A utility class for making simple allocations using JITLinkMemoryManager.

SimpleSegementAlloc takes a mapping of AllocGroups to Segments and uses this to create a LinkGraph with one Section (containing one Block) per Segment. Clients can obtain a pointer to the working memory and executor address of that block using the Segment's AllocGroup. Once memory has been populated, clients can call finalize to finalize the memory.

Note: Segments with MemLifetime::NoAlloc are not permitted, since they would not be useful, and their presence is likely to indicate a bug.

Definition at line 299 of file JITLinkMemoryManager.h.

Member Typedef Documentation

◆ OnCreatedFunction

◆ OnFinalizedFunction

◆ SegmentMap

Constructor & Destructor Documentation

◆ SimpleSegmentAlloc()

llvm::jitlink::SimpleSegmentAlloc::SimpleSegmentAlloc ( SimpleSegmentAlloc && )
default

◆ ~SimpleSegmentAlloc()

llvm::jitlink::SimpleSegmentAlloc::~SimpleSegmentAlloc ( )
default

References LLVM_ABI.

Member Function Documentation

◆ Create() [1/2]

Expected< SimpleSegmentAlloc > llvm::jitlink::SimpleSegmentAlloc::Create ( JITLinkMemoryManager & MemMgr,
std::shared_ptr< orc::SymbolStringPool > SSP,
Triple TT,
const JITLinkDylib * JD,
SegmentMap Segments )
static

Definition at line 206 of file JITLinkMemoryManager.cpp.

References Create().

◆ Create() [2/2]

◆ finalize() [1/2]

Expected< JITLinkMemoryManager::FinalizedAlloc > llvm::jitlink::SimpleSegmentAlloc::finalize ( )
inline

Finalize all groups.

Definition at line 347 of file JITLinkMemoryManager.h.

◆ finalize() [2/2]

void llvm::jitlink::SimpleSegmentAlloc::finalize ( OnFinalizedFunction OnFinalized)
inline

Finalize all groups (async version).

Definition at line 342 of file JITLinkMemoryManager.h.

◆ getSegInfo()

SimpleSegmentAlloc::SegmentInfo llvm::jitlink::SimpleSegmentAlloc::getSegInfo ( orc::AllocGroup AG)

Returns the SegmentInfo for the given group.

Definition at line 224 of file JITLinkMemoryManager.cpp.

References B(), getSegInfo(), and I.

Referenced by getSegInfo().

◆ operator=()

SimpleSegmentAlloc & llvm::jitlink::SimpleSegmentAlloc::operator= ( SimpleSegmentAlloc && )
default

References LLVM_ABI, and SimpleSegmentAlloc().


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