LLVM 19.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
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 = JITLinkMemoryManager::InFlightAlloc::OnFinalizedFunction
 

Public Member Functions

 SimpleSegmentAlloc (SimpleSegmentAlloc &&)
 
SimpleSegmentAllocoperator= (SimpleSegmentAlloc &&)
 
 ~SimpleSegmentAlloc ()
 
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 void Create (JITLinkMemoryManager &MemMgr, const JITLinkDylib *JD, SegmentMap Segments, OnCreatedFunction OnCreated)
 
static Expected< SimpleSegmentAllocCreate (JITLinkMemoryManager &MemMgr, 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 297 of file JITLinkMemoryManager.h.

Member Typedef Documentation

◆ OnCreatedFunction

Definition at line 317 of file JITLinkMemoryManager.h.

◆ OnFinalizedFunction

Definition at line 319 of file JITLinkMemoryManager.h.

◆ SegmentMap

Definition at line 315 of file JITLinkMemoryManager.h.

Constructor & Destructor Documentation

◆ SimpleSegmentAlloc()

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

◆ ~SimpleSegmentAlloc()

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

Member Function Documentation

◆ Create() [1/2]

Expected< SimpleSegmentAlloc > llvm::jitlink::SimpleSegmentAlloc::Create ( JITLinkMemoryManager MemMgr,
const JITLinkDylib JD,
SegmentMap  Segments 
)
static

Definition at line 204 of file JITLinkMemoryManager.cpp.

References Create().

◆ Create() [2/2]

void llvm::jitlink::SimpleSegmentAlloc::Create ( JITLinkMemoryManager MemMgr,
const JITLinkDylib JD,
SegmentMap  Segments,
OnCreatedFunction  OnCreated 
)
static

◆ finalize() [1/2]

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

Finalize all groups.

Definition at line 342 of file JITLinkMemoryManager.h.

◆ finalize() [2/2]

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

Finalize all groups (async version).

Definition at line 337 of file JITLinkMemoryManager.h.

◆ getSegInfo()

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

Returns the SegmentInfo for the given group.

Definition at line 221 of file JITLinkMemoryManager.cpp.

References B, and I.

◆ operator=()

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

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