17#ifndef LLVM_EXECUTIONENGINE_ORC_ORCABISUPPORT_H
18#define LLVM_EXECUTIONENGINE_ORC_ORCABISUPPORT_H
36template <
typename ORCABI>
40 (RoundToMultipleOf == 0 || (RoundToMultipleOf % ORCABI::StubSize == 0)) &&
41 "RoundToMultipleOf is not a multiple of stub size");
42 uint64_t StubBytes = MinStubs * ORCABI::StubSize;
43 if (RoundToMultipleOf)
44 StubBytes =
alignTo(StubBytes, RoundToMultipleOf);
45 unsigned NumStubs = StubBytes / ORCABI::StubSize;
46 uint64_t PointerBytes = NumStubs * ORCABI::PointerSize;
47 return {StubBytes, PointerBytes, NumStubs};
75 unsigned NumTrampolines) {
85 "writeIndirectStubsBlock is not supported by the generic host "
123 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
124 ExecutorAddr PointersBlockTargetAddress,
unsigned MinStubs);
150 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
151 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs);
230 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
231 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs);
270 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
271 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs);
281 ReentryFnAddr, ReentryCtxAddr,
false);
292 ReentryFnAddr, ReentryCtxAddr,
true);
331 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
332 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs);
370 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
371 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs);
410 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
411 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static std::optional< bool > isBigEndian(const SmallDenseMap< int64_t, int64_t, 8 > &MemOffset2Idx, int64_t LowestIdx)
Given a map from byte offsets in memory to indices in a load/store, determine if that map corresponds...
Represents an address in the executor process.
static constexpr unsigned PointerSize
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned ResolverCodeSize
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr RentryCtxAddr)
Write the resolver code into the given memory.
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static constexpr unsigned TrampolineSize
static constexpr unsigned StubSize
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned MinStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static void writeResolverCode(char *ResolveWorkingMem, ExecutorAddr ResolverTargetAddr, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
static constexpr unsigned StubSize
static constexpr unsigned PointerSize
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned ResolverCodeSize
static void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
static constexpr unsigned TrampolineSize
static void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddr, ExecutorAddr ResolverAddr, unsigned NumTrampolines)
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static constexpr unsigned PointerSize
static constexpr unsigned ResolverCodeSize
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned StubSize
static constexpr unsigned TrampolineSize
static constexpr unsigned ResolverCodeSize
static constexpr unsigned StubSize
static constexpr unsigned PointerSize
static constexpr unsigned TrampolineSize
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverFnAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static constexpr unsigned StubToPointerMaxDisplacement
static void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
static void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
static constexpr unsigned StubSize
static LLVM_ABI void writeResolverCode(char *ResolverBlockWorkingMem, ExecutorAddr ResolverBlockTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr, bool isBigEndian)
Write the resolver code into the given memory.
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned PointerSize
static constexpr unsigned TrampolineSize
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static constexpr unsigned ResolverCodeSize
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned PointerSize
static constexpr unsigned ResolverCodeSize
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverFnAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static constexpr unsigned StubSize
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static constexpr unsigned TrampolineSize
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned StubSize
static constexpr unsigned TrampolineSize
static constexpr unsigned ResolverCodeSize
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverFnAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static constexpr unsigned PointerSize
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
X86_64 code that's common to all ABIs.
static constexpr unsigned PointerSize
static constexpr unsigned StubSize
static LLVM_ABI void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static LLVM_ABI void writeTrampolines(char *TrampolineBlockWorkingMem, ExecutorAddr TrampolineBlockTargetAddress, ExecutorAddr ResolverAddr, unsigned NumTrampolines)
Write the requested number of trampolines into the given memory, which must be big enough to hold 1 p...
static constexpr unsigned StubToPointerMaxDisplacement
static constexpr unsigned TrampolineSize
X86_64 support for SysV ABI (Linux, MacOSX).
static constexpr unsigned ResolverCodeSize
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
X86_64 support for Win32.
static constexpr unsigned ResolverCodeSize
static LLVM_ABI void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
IndirectStubsAllocationSizes getIndirectStubsBlockSizes(unsigned MinStubs, unsigned RoundToMultipleOf=0)
This is an optimization pass for GlobalISel generic memory operations.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.