13#define DEBUG_TYPE "orc"
18template <
typename ORCABI>
22 constexpr unsigned MaxDisp = ORCABI::StubToPointerMaxDisplacement;
24 ExecutorAddr LastStub = FirstStub + ((NumStubs - 1) * ORCABI::StubSize);
26 ExecutorAddr LastPointer = FirstPointer + ((NumStubs - 1) * ORCABI::StubSize);
28 if (FirstStub < FirstPointer) {
29 if (LastStub >= FirstPointer)
31 return (FirstPointer - FirstStub <= MaxDisp) &&
32 (LastPointer - LastStub <= MaxDisp);
35 if (LastPointer >= FirstStub)
38 return (FirstStub - FirstPointer <= MaxDisp) &&
39 (LastStub - LastPointer <= MaxDisp);
126 const unsigned ReentryFnAddrOffset = 0x110;
127 const unsigned ReentryCtxAddrOffset = 0x118;
129 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
130 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnAddr,
132 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxAddr,
139 unsigned NumTrampolines) {
143 memcpy(TrampolineBlockWorkingMem + OffsetToPtr, &ResolverAddr,
151 reinterpret_cast<uint32_t *
>(TrampolineBlockWorkingMem);
154 Trampolines[3 *
I + 0] = 0xaa1e03f1;
155 Trampolines[3 *
I + 1] = 0x58000010 | (OffsetToPtr << 3);
156 Trampolines[3 *
I + 2] = 0xd63f0200;
161 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
162 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs) {
184 "Pointer and stub size must match for algorithm below");
185 assert(stubAndPointerRangesOk<OrcAArch64>(
186 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
187 "PointersBlock is out of range");
189 PointersBlockTargetAddress - StubsBlockTargetAddress;
190 assert((PtrDisplacement % 8 == 0) &&
191 "Displacement to pointer is not a multiple of 8");
193 uint64_t PtrOffsetField = ((PtrDisplacement >> 2) & 0x7ffff) << 5;
195 for (
unsigned I = 0;
I < NumStubs; ++
I)
196 Stub[
I] = 0xd61f020058000010 | PtrOffsetField;
202 unsigned NumTrampolines) {
206 memcpy(TrampolineBlockWorkingMem + OffsetToPtr, &ResolverAddr,
210 reinterpret_cast<uint64_t *
>(TrampolineBlockWorkingMem);
211 uint64_t CallIndirPCRel = 0xf1c40000000015ff;
214 Trampolines[
I] = CallIndirPCRel | ((OffsetToPtr - 6) << 16);
218 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
219 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs) {
242 "Pointer and stub size must match for algorithm below");
243 assert(stubAndPointerRangesOk<OrcX86_64_Base>(
244 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
245 "PointersBlock is out of range");
248 (PointersBlockTargetAddress - StubsBlockTargetAddress - 6) << 16;
249 for (
unsigned I = 0;
I < NumStubs; ++
I)
250 Stub[
I] = 0xF1C40000000025ff | PtrOffsetField;
259 dbgs() <<
"Writing resolver code to "
260 <<
formatv(
"{0:x16}", ResolverTargetAddress) <<
"\n";
263 const uint8_t ResolverCode[] = {
281 0x48, 0x81, 0xec, 0x08, 0x02, 0x00, 0x00,
282 0x48, 0x0f, 0xae, 0x04, 0x24,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x48, 0x8b, 0x75, 0x08,
289 0x48, 0x83, 0xee, 0x06,
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
296 0x48, 0x89, 0x45, 0x08,
297 0x48, 0x0f, 0xae, 0x0c, 0x24,
298 0x48, 0x81, 0xc4, 0x08, 0x02, 0x00, 0x00,
317 const unsigned ReentryFnAddrOffset = 0x3a;
318 const unsigned ReentryCtxAddrOffset = 0x28;
320 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
321 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnAddr,
323 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxAddr,
335 const uint8_t ResolverCode[] = {
353 0x48, 0x81, 0xec, 0x08, 0x02, 0x00, 0x00,
354 0x48, 0x0f, 0xae, 0x04, 0x24,
358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360 0x48, 0x8B, 0x55, 0x08,
361 0x48, 0x83, 0xea, 0x06,
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x48, 0x83, 0xEC, 0x20,
372 0x48, 0x83, 0xC4, 0x20,
374 0x48, 0x89, 0x45, 0x08,
375 0x48, 0x0f, 0xae, 0x0c, 0x24,
376 0x48, 0x81, 0xc4, 0x08, 0x02, 0x00, 0x00,
395 const unsigned ReentryFnAddrOffset = 0x3a;
396 const unsigned ReentryCtxAddrOffset = 0x28;
398 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
399 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnAddr,
401 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxAddr,
410 assert((ReentryFnAddr.
getValue() >> 32) == 0 &&
"ReentryFnAddr out of range");
412 "ReentryCtxAddr out of range");
414 const uint8_t ResolverCode[] = {
426 0x81, 0xec, 0x18, 0x02, 0x00, 0x00,
427 0x0f, 0xae, 0x44, 0x24, 0x10,
430 0x89, 0x74, 0x24, 0x04,
431 0xc7, 0x04, 0x24, 0x00, 0x00, 0x00,
433 0xb8, 0x00, 0x00, 0x00, 0x00,
436 0x0f, 0xae, 0x4c, 0x24, 0x10,
437 0x81, 0xc4, 0x18, 0x02, 0x00, 0x00,
449 const unsigned ReentryFnAddrOffset = 0x2a;
450 const unsigned ReentryCtxAddrOffset = 0x25;
452 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
453 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnAddr,
455 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxAddr,
462 unsigned NumTrampolines) {
463 assert((ResolverAddr.
getValue() >> 32) == 0 &&
"ResolverAddr out of range");
465 uint64_t CallRelImm = 0xF1C4C400000000e8;
466 uint64_t ResolverRel = ResolverAddr - TrampolineBlockTargetAddress - 5;
470 Trampolines[
I] = CallRelImm | (ResolverRel << 8);
478 "StubsBlockTargetAddress is out of range");
480 "PointersBlockTargetAddress is out of range");
502 assert(stubAndPointerRangesOk<OrcI386>(
503 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
504 "PointersBlock is out of range");
508 for (
unsigned I = 0;
I < NumStubs; ++
I, PtrAddr += 4)
509 Stub[
I] = 0xF1C40000000025ff | (PtrAddr << 16);
591 const unsigned ReentryFnAddrOffset = 0x7c;
592 const unsigned ReentryCtxAddrOffset = 0x6c;
593 const unsigned Offsett = 0xf8;
595 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
599 memcpy(ResolverWorkingMem + Offsett, &MoveVxT9,
sizeof(MoveVxT9));
602 0x3c040000 | (((ReentryCtxAddr.
getValue() + 0x8000) >> 16) & 0xFFFF);
603 uint32_t ReentryCtxADDiu = 0x24840000 | (ReentryCtxAddr.
getValue() & 0xFFFF);
604 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxLUi,
605 sizeof(ReentryCtxLUi));
606 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset + 4, &ReentryCtxADDiu,
607 sizeof(ReentryCtxADDiu));
610 0x3c190000 | (((ReentryFnAddr.
getValue() + 0x8000) >> 16) & 0xFFFF);
612 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnLUi,
613 sizeof(ReentryFnLUi));
614 memcpy(ResolverWorkingMem + ReentryFnAddrOffset + 4, &ReentryFnADDiu,
615 sizeof(ReentryFnADDiu));
621 unsigned NumTrampolines) {
623 assert((ResolverAddr.
getValue() >> 32) == 0 &&
"ResolverAddr out of range");
626 reinterpret_cast<uint32_t *
>(TrampolineBlockWorkingMem);
629 for (
unsigned I = 0;
I < NumTrampolines; ++
I) {
635 Trampolines[5 *
I + 0] = 0x03e0c025;
636 Trampolines[5 *
I + 1] = 0x3c190000 | (RHiAddr & 0xFFFF);
637 Trampolines[5 *
I + 2] = 0x27390000 | (ResolverAddr.
getValue() & 0xFFFF);
638 Trampolines[5 *
I + 3] = 0x0320f809;
639 Trampolines[5 *
I + 4] = 0x00000000;
644 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
645 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs) {
647 "InitialPtrVal is out of range");
671 assert(stubAndPointerRangesOk<OrcMips32_Base>(
672 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
673 "PointersBlock is out of range");
679 for (
unsigned I = 0;
I < NumStubs; ++
I) {
680 uint32_t HiAddr = ((PtrAddr + 0x8000) >> 16);
681 Stub[4 *
I + 0] = 0x3c190000 | (HiAddr & 0xFFFF);
682 Stub[4 *
I + 1] = 0x8f390000 | (PtrAddr & 0xFFFF);
683 Stub[4 *
I + 2] = 0x03200008;
684 Stub[4 *
I + 3] = 0x00000000;
775 const unsigned ReentryFnAddrOffset = 0x8c;
776 const unsigned ReentryCtxAddrOffset = 0x6c;
778 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
782 (((ReentryCtxAddr.
getValue() + 0x800080008000) >> 48) & 0xFFFF);
784 0x64840000 | (((ReentryCtxAddr.
getValue() + 0x80008000) >> 32) & 0xFFFF);
785 uint32_t ReentryCtxDSLL = 0x00042438;
787 0x64840000 | ((((ReentryCtxAddr.
getValue() + 0x8000) >> 16) & 0xFFFF));
788 uint32_t ReentryCtxDSLL2 = 0x00042438;
790 0x64840000 | (ReentryCtxAddr.
getValue() & 0xFFFF);
792 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxLUi,
793 sizeof(ReentryCtxLUi));
794 memcpy(ResolverWorkingMem + (ReentryCtxAddrOffset + 4), &ReentryCtxDADDiu,
795 sizeof(ReentryCtxDADDiu));
796 memcpy(ResolverWorkingMem + (ReentryCtxAddrOffset + 8), &ReentryCtxDSLL,
797 sizeof(ReentryCtxDSLL));
798 memcpy(ResolverWorkingMem + (ReentryCtxAddrOffset + 12), &ReentryCtxDADDiu2,
799 sizeof(ReentryCtxDADDiu2));
800 memcpy(ResolverWorkingMem + (ReentryCtxAddrOffset + 16), &ReentryCtxDSLL2,
801 sizeof(ReentryCtxDSLL2));
802 memcpy(ResolverWorkingMem + (ReentryCtxAddrOffset + 20), &ReentryCtxDADDiu3,
803 sizeof(ReentryCtxDADDiu3));
807 (((ReentryFnAddr.
getValue() + 0x800080008000) >> 48) & 0xFFFF);
810 0x67390000 | (((ReentryFnAddr.
getValue() + 0x80008000) >> 32) & 0xFFFF);
812 uint32_t ReentryFnDSLL = 0x0019cc38;
815 0x67390000 | (((ReentryFnAddr.
getValue() + 0x8000) >> 16) & 0xFFFF);
817 uint32_t ReentryFnDSLL2 = 0x0019cc38;
819 uint32_t ReentryFnDADDiu3 = 0x67390000 | (ReentryFnAddr.
getValue() & 0xFFFF);
821 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnLUi,
822 sizeof(ReentryFnLUi));
823 memcpy(ResolverWorkingMem + (ReentryFnAddrOffset + 4), &ReentryFnDADDiu,
824 sizeof(ReentryFnDADDiu));
825 memcpy(ResolverWorkingMem + (ReentryFnAddrOffset + 8), &ReentryFnDSLL,
826 sizeof(ReentryFnDSLL));
827 memcpy(ResolverWorkingMem + (ReentryFnAddrOffset + 12), &ReentryFnDADDiu2,
828 sizeof(ReentryFnDADDiu2));
829 memcpy(ResolverWorkingMem + (ReentryFnAddrOffset + 16), &ReentryFnDSLL2,
830 sizeof(ReentryFnDSLL2));
831 memcpy(ResolverWorkingMem + (ReentryFnAddrOffset + 20), &ReentryFnDADDiu3,
832 sizeof(ReentryFnDADDiu3));
838 unsigned NumTrampolines) {
841 reinterpret_cast<uint32_t *
>(TrampolineBlockWorkingMem);
847 for (
unsigned I = 0;
I < NumTrampolines; ++
I) {
848 Trampolines[10 *
I + 0] = 0x03e0c025;
849 Trampolines[10 *
I + 1] = 0x3c190000 | (HeighestAddr & 0xFFFF);
850 Trampolines[10 *
I + 2] = 0x67390000 | (HeigherAddr & 0xFFFF);
851 Trampolines[10 *
I + 3] = 0x0019cc38;
852 Trampolines[10 *
I + 4] = 0x67390000 | (HiAddr & 0xFFFF);
853 Trampolines[10 *
I + 5] = 0x0019cc38;
854 Trampolines[10 *
I + 6] = 0x67390000 | (ResolverAddr.
getValue() &
856 Trampolines[10 *
I + 7] = 0x0320f809;
857 Trampolines[10 *
I + 8] = 0x00000000;
858 Trampolines[10 *
I + 9] = 0x00000000;
894 assert(stubAndPointerRangesOk<OrcMips64>(
895 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
896 "PointersBlock is out of range");
902 for (
unsigned I = 0;
I < NumStubs; ++
I, PtrAddr += 8) {
903 uint64_t HeighestAddr = ((PtrAddr + 0x800080008000) >> 48);
904 uint64_t HeigherAddr = ((PtrAddr + 0x80008000) >> 32);
905 uint64_t HiAddr = ((PtrAddr + 0x8000) >> 16);
906 Stub[8 *
I + 0] = 0x3c190000 | (HeighestAddr & 0xFFFF);
907 Stub[8 *
I + 1] = 0x67390000 | (HeigherAddr & 0xFFFF);
908 Stub[8 *
I + 2] = 0x0019cc38;
909 Stub[8 *
I + 3] = 0x67390000 | (HiAddr & 0xFFFF);
910 Stub[8 *
I + 4] = 0x0019cc38;
911 Stub[8 *
I + 5] = 0xdf390000 | (PtrAddr & 0xFFFF);
912 Stub[8 *
I + 6] = 0x03200008;
913 Stub[8 *
I + 7] = 0x00000000;
1007 const unsigned ReentryCtxAddrOffset = 0x138;
1008 const unsigned ReentryFnAddrOffset = 0x140;
1010 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
1011 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnAddr,
1013 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxAddr,
1020 unsigned NumTrampolines) {
1024 memcpy(TrampolineBlockWorkingMem + OffsetToPtr, &ResolverAddr,
1028 reinterpret_cast<uint32_t *
>(TrampolineBlockWorkingMem);
1030 uint32_t Hi20 = (OffsetToPtr + 0x800) & 0xFFFFF000;
1031 uint32_t Lo12 = OffsetToPtr - Hi20;
1032 Trampolines[4 *
I + 0] = 0x00000297 | Hi20;
1033 Trampolines[4 *
I + 1] =
1034 0x0002b283 | ((Lo12 & 0xFFF) << 20);
1035 Trampolines[4 *
I + 2] = 0x00028367;
1036 Trampolines[4 *
I + 3] = 0xdeadface;
1041 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
1042 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs) {
1067 assert(stubAndPointerRangesOk<OrcRiscv64>(
1068 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
1069 "PointersBlock is out of range");
1073 for (
unsigned I = 0;
I < NumStubs; ++
I) {
1075 PointersBlockTargetAddress - StubsBlockTargetAddress;
1076 uint32_t Hi20 = (PtrDisplacement + 0x800) & 0xFFFFF000;
1077 uint32_t Lo12 = PtrDisplacement - Hi20;
1078 Stub[4 *
I + 0] = 0x00000297 | Hi20;
1079 Stub[4 *
I + 1] = 0x0002b283 | ((Lo12 & 0xFFF) << 20);
1080 Stub[4 *
I + 2] = 0x00028067;
1081 Stub[4 *
I + 3] = 0xfeedbeef;
1083 StubsBlockTargetAddress +=
StubSize;
1093 dbgs() <<
"Writing resolver code to "
1094 <<
formatv(
"{0:x16}", ResolverTargetAddress) <<
"\n";
1150 const unsigned ReentryCtxAddrOffset = 0xb8;
1151 const unsigned ReentryFnAddrOffset = 0xc0;
1153 memcpy(ResolverWorkingMem, ResolverCode,
sizeof(ResolverCode));
1154 memcpy(ResolverWorkingMem + ReentryFnAddrOffset, &ReentryFnAddr,
1156 memcpy(ResolverWorkingMem + ReentryCtxAddrOffset, &ReentryCtxAddr,
1163 unsigned NumTrampolines) {
1166 dbgs() <<
"Writing trampoline code to "
1167 <<
formatv(
"{0:x16}", TrampolineBlockTargetAddress) <<
"\n";
1172 memcpy(TrampolineBlockWorkingMem + OffsetToPtr, &ResolverAddr,
1176 reinterpret_cast<uint32_t *
>(TrampolineBlockWorkingMem);
1178 uint32_t Hi20 = (OffsetToPtr + 0x800) & 0xfffff000;
1179 uint32_t Lo12 = OffsetToPtr - Hi20;
1180 Trampolines[4 *
I + 0] =
1182 (((Hi20 >> 12) & 0xfffff) << 5);
1183 Trampolines[4 *
I + 1] =
1184 0x28c0018c | ((Lo12 & 0xfff) << 10);
1185 Trampolines[4 *
I + 2] = 0x4c00018d;
1186 Trampolines[4 *
I + 3] = 0x0;
1191 char *StubsBlockWorkingMem,
ExecutorAddr StubsBlockTargetAddress,
1192 ExecutorAddr PointersBlockTargetAddress,
unsigned NumStubs) {
1215 dbgs() <<
"Writing stubs code to "
1216 <<
formatv(
"{0:x16}", StubsBlockTargetAddress) <<
"\n";
1218 assert(stubAndPointerRangesOk<OrcLoongArch64>(
1219 StubsBlockTargetAddress, PointersBlockTargetAddress, NumStubs) &&
1220 "PointersBlock is out of range");
1224 for (
unsigned I = 0;
I < NumStubs; ++
I) {
1226 PointersBlockTargetAddress - StubsBlockTargetAddress;
1227 uint32_t Hi20 = (PtrDisplacement + 0x800) & 0xfffff000;
1228 uint32_t Lo12 = PtrDisplacement - Hi20;
1229 Stub[4 *
I + 0] = 0x1c00000c | (((Hi20 >> 12) & 0xfffff)
1232 0x28c0018c | ((Lo12 & 0xfff) << 10);
1233 Stub[4 *
I + 2] = 0x4c000180;
1234 Stub[4 *
I + 3] = 0x0;
1236 StubsBlockTargetAddress +=
StubSize;
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...
static bool stubAndPointerRangesOk(ExecutorAddr StubBlockAddr, ExecutorAddr PointerBlockAddr, unsigned NumStubs)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Represents an address in the executor process.
uint64_t getValue() const
static constexpr unsigned PointerSize
static void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr RentryCtxAddr)
Write the resolver code into the given memory.
static 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 void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned MinStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static 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 void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static constexpr unsigned TrampolineSize
static constexpr unsigned StubSize
static constexpr unsigned PointerSize
static constexpr unsigned TrampolineSize
static void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static 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 void writeResolverCode(char *ResolverBlockWorkingMem, ExecutorAddr ResolverBlockTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr, bool isBigEndian)
Write the resolver code into the given memory.
static void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static 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 void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static 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 void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static constexpr unsigned StubSize
static constexpr unsigned TrampolineSize
static void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static 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 void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static constexpr unsigned PointerSize
static constexpr unsigned StubSize
static void writeIndirectStubsBlock(char *StubsBlockWorkingMem, ExecutorAddr StubsBlockTargetAddress, ExecutorAddr PointersBlockTargetAddress, unsigned NumStubs)
Write NumStubs indirect stubs to working memory at StubsBlockWorkingMem.
static 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 void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
static void writeResolverCode(char *ResolverWorkingMem, ExecutorAddr ResolverTargetAddress, ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr)
Write the resolver code into the given memory.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.