LLVM 20.0.0git
|
BasicLayout simplifies the implementation of JITLinkMemoryManagers. More...
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
Classes | |
struct | ContiguousPageBasedLayoutSizes |
A convenience class that further groups segments based on memory deallocation policy. More... | |
class | Segment |
The Alignment, ContentSize and ZeroFillSize of each segment will be pre-filled from the Graph. More... | |
Public Member Functions | |
BasicLayout (LinkGraph &G) | |
LinkGraph & | getGraph () |
Return a reference to the graph this allocation was created from. | |
Expected< ContiguousPageBasedLayoutSizes > | getContiguousPageBasedLayoutSizes (uint64_t PageSize) |
Returns the total number of required to allocate all segments (with each segment padded out to page size) for all standard segments, and all finalize segments. | |
iterator_range< SegmentMap::iterator > | segments () |
Returns an iterator over the segments of the layout. | |
Error | apply () |
Apply the layout to the graph. | |
orc::shared::AllocActions & | graphAllocActions () |
Returns a reference to the AllocActions in the graph. | |
BasicLayout simplifies the implementation of JITLinkMemoryManagers.
BasicLayout groups Sections into Segments based on their memory protection and deallocation policies. JITLinkMemoryManagers can construct a BasicLayout from a Graph, and then assign working memory and addresses to each of the Segments. These addreses will be mapped back onto the Graph blocks in the apply method.
Definition at line 212 of file JITLinkMemoryManager.h.
llvm::jitlink::BasicLayout::BasicLayout | ( | LinkGraph & | G | ) |
Definition at line 24 of file JITLinkMemoryManager.cpp.
References llvm::jitlink::alignToBlock(), B, llvm::dbgs(), llvm::formatv(), G, LHS, LLVM_DEBUG, LLVM_LIKELY, llvm::orc::NoAlloc, RHS, and llvm::sort().
Error llvm::jitlink::BasicLayout::apply | ( | ) |
Apply the layout to the graph.
Definition at line 102 of file JITLinkMemoryManager.cpp.
References llvm::jitlink::alignToBlock(), assert(), B, and llvm::Error::success().
Expected< BasicLayout::ContiguousPageBasedLayoutSizes > llvm::jitlink::BasicLayout::getContiguousPageBasedLayoutSizes | ( | uint64_t | PageSize | ) |
Returns the total number of required to allocate all segments (with each segment padded out to page size) for all standard segments, and all finalize segments.
This is a convenience function for the common case where the segments will be allocated contiguously.
This function will return an error if any segment has an alignment that is higher than a page.
Definition at line 81 of file JITLinkMemoryManager.cpp.
References llvm::alignTo(), llvm::jitlink::BasicLayout::ContiguousPageBasedLayoutSizes::FinalizeSegs, llvm::inconvertibleErrorCode(), PageSize, segments(), llvm::orc::Standard, and llvm::jitlink::BasicLayout::ContiguousPageBasedLayoutSizes::StandardSegs.
|
inline |
Return a reference to the graph this allocation was created from.
Definition at line 257 of file JITLinkMemoryManager.h.
orc::shared::AllocActions & llvm::jitlink::BasicLayout::graphAllocActions | ( | ) |
Returns a reference to the AllocActions in the graph.
This convenience function saves callers from having to #include LinkGraph.h if all they need are allocation actions.
Definition at line 142 of file JITLinkMemoryManager.cpp.
References llvm::jitlink::LinkGraph::allocActions().
|
inline |
Returns an iterator over the segments of the layout.
Definition at line 272 of file JITLinkMemoryManager.h.
References llvm::orc::AllocGroupSmallMap< T >::begin(), and llvm::orc::AllocGroupSmallMap< T >::end().
Referenced by getContiguousPageBasedLayoutSizes().