29class MCUnwindV2EpilogTargetExpr final :
public MCTargetExpr {
30 const WinEH::FrameInfo &FrameInfo;
36 MCUnwindV2EpilogTargetExpr(
const WinEH::FrameInfo &FrameInfo,
37 const WinEH::FrameInfo::Epilog &
Epilog,
39 : FrameInfo(FrameInfo), UnwindV2Start(
Epilog.UnwindV2Start),
40 EpilogEnd(
Epilog.End), EpilogSize(EpilogSize_), Loc(
Epilog.Loc) {
41 assert(UnwindV2Start &&
"Epilog must have a start");
42 assert(EpilogEnd &&
"Epilog must have an end");
46 static MCUnwindV2EpilogTargetExpr *
47 create(
const WinEH::FrameInfo &FrameInfo,
48 const WinEH::FrameInfo::Epilog &
Epilog, uint8_t EpilogSize_,
50 return new (Ctx) MCUnwindV2EpilogTargetExpr(FrameInfo,
Epilog, EpilogSize_);
53 void printImpl(raw_ostream &OS,
const MCAsmInfo *MAI)
const override {
55 UnwindV2Start->
print(OS, MAI);
58 bool evaluateAsRelocatableImpl(MCValue &Res,
59 const MCAssembler *Asm)
const override;
61 void visitUsedExpr(MCStreamer &Streamer)
const override {
65 MCFragment *findAssociatedFragment()
const override {
75 for (
const auto &
I : Insns) {
94 Count += (
I.Offset > 512 * 1024 - 8) ? 3 : 2;
120 if (Diff->evaluateAsAbsolute(
125 "Label difference out of 16-bit unsigned range for V3 unwind info");
146 SMLoc(),
"UOP_Push2 (PUSH2 with two registers) requires V3 unwind "
147 "info. Use `.seh_unwindversion 3`.");
156 if (inst.
Offset > 512 * 1024 - 8) {
169 b2 |= (((inst.
Offset - 8) >> 3) & 0x0F) << 4;
245static std::optional<int64_t>
256 if (!Diff->evaluateAsAbsolute(value, Assembler))
283 "UOP_AllocSmall outside expected range or alignment");
289 if (Inst.
Offset > 512 * 1024 - 8) {
312 "SET_FPREG frame register does not fit in 4 bits");
349 "SAVE_XMM128 register does not fit in 4 bits (XMM16-31 unsupported)");
362 "bits (XMM16-31 unsupported)");
383 if (Reg2 == Reg1 + 1) {
391 Out.
push_back(((Reg2 & 0x1F) << 3) | ((Reg1 >> 2) & 0x07));
404 assert(!Needle.
empty() &&
"FindInPool called with empty Needle");
405 auto It = std::search(Haystack.
begin(), Haystack.
end(), Needle.
begin(),
407 if (It == Haystack.
end())
409 return static_cast<uint16_t>(std::distance(Haystack.
begin(), It));
416 if (
A.Instructions.size() !=
B.Instructions.size())
418 for (
unsigned I = 0;
I <
A.Instructions.size(); ++
I) {
421 if (!OffA || !OffB || *OffA != *OffB)
430 assert(!Info->Symbol &&
"UNWIND_INFO already has a symbol");
436 MCSymbol *Label = Context.createTempSymbol();
439 Info->Symbol = Label;
447 for (
auto It = Info->Instructions.rbegin(); It != Info->Instructions.rend();
453 unsigned PrologOpCount = Info->Instructions.
size();
454 if (PrologOpCount > 31) {
456 "Too many prolog unwind codes for V3 encoding. Maximum "
457 "is 31. This function has " +
458 Twine(PrologOpCount));
460 for (
auto It = Info->Instructions.rbegin(); It != Info->Instructions.rend();
462 PrologIpLabels.
push_back({It->Label, Info->Begin});
468 bool NeedsLargeProlog =
false;
469 if (Info->PrologEnd) {
470 auto MaybePrologSize =
472 if (MaybePrologSize) {
473 if (*MaybePrologSize < 0)
475 if (*MaybePrologSize > UINT16_MAX)
477 "SizeOfProlog exceeds 16-bit range for V3 unwind info");
478 NeedsLargeProlog = (*MaybePrologSize > 255);
480 NeedsLargeProlog =
true;
483 for (
auto &[InstLabel, BeginLabel] : PrologIpLabels) {
484 if (NeedsLargeProlog)
488 if (*MaybeOffset < 0)
490 if (*MaybeOffset > UINT16_MAX)
492 "Prolog IP offset exceeds 16-bit range for V3 unwind info");
493 NeedsLargeProlog = (*MaybeOffset > 255);
495 NeedsLargeProlog =
true;
500 struct EpilogEmitInfo {
510 for (
const auto &[EpilogSym,
Epilog] : Info->EpilogMap) {
511 if (
Epilog.Instructions.empty())
516 EI.NumberOfOps =
Epilog.Instructions.size();
517 if (EI.NumberOfOps > 31)
519 "Too many epilog unwind codes for V3 encoding. Maximum "
520 "is 31. This epilog has " +
521 Twine(EI.NumberOfOps));
522 EI.Inherited =
false;
523 EI.NeedsLarge =
false;
528 auto MaybeLastInstOfs =
530 if (MaybeLastInstOfs) {
531 if (*MaybeLastInstOfs < 0)
533 "Negative IpOffsetOfLastInstruction in V3 unwind info");
534 if (*MaybeLastInstOfs > UINT16_MAX)
536 "IpOffsetOfLastInstruction exceeds 16-bit range for "
538 EI.NeedsLarge = (*MaybeLastInstOfs > 255);
540 EI.NeedsLarge =
true;
544 for (
const auto &EpiInst :
Epilog.Instructions) {
550 if (*MaybeOffset < 0)
552 if (*MaybeOffset > UINT16_MAX)
554 "Epilog IP offset exceeds 16-bit range for V3 unwind info");
555 EI.NeedsLarge = (*MaybeOffset > 255);
557 EI.NeedsLarge =
true;
562 for (
const auto &Inst :
Epilog.Instructions)
570 EI.FirstOp = WODPool.
size();
571 WODPool.
append(EI.WODBytes.begin(), EI.WODBytes.end());
576 if (EpilogInfos.
size() > 7)
578 " This function has " +
585 for (
unsigned I = 1;
I < EpilogInfos.
size(); ++
I) {
586 auto &Prev = EpilogInfos[
I - 1];
587 auto &Curr = EpilogInfos[
I];
588 if (Curr.FirstOp == Prev.FirstOp && Curr.NumberOfOps == Prev.NumberOfOps &&
589 Curr.NeedsLarge == Prev.NeedsLarge &&
591 Curr.Inherited =
true;
595 unsigned PrologIpEntrySize = NeedsLargeProlog ? 2 : 1;
596 unsigned EpilogDescBytes = 0;
597 for (
const auto &EI : EpilogInfos) {
599 EpilogDescBytes += 3;
600 }
else if (EI.NeedsLarge) {
602 EpilogDescBytes += 7 + EI.NumberOfOps * 2;
605 EpilogDescBytes += 6 + EI.NumberOfOps;
609 unsigned PrologIpBytes = PrologOpCount * PrologIpEntrySize;
610 unsigned WODPoolBytes = WODPool.
size();
615 unsigned LargeHeaderBytes = NeedsLargeProlog ? 1 : 0;
616 unsigned TotalPayloadBytes =
617 LargeHeaderBytes + PrologIpBytes + EpilogDescBytes + WODPoolBytes;
618 if (TotalPayloadBytes > 255 * 2) {
620 "510 bytes. This function has " +
621 Twine(TotalPayloadBytes));
623 uint8_t PayloadWords = (TotalPayloadBytes + 1) / 2;
631 if (Info->ChainedParent)
634 if (Info->HandlesUnwind)
636 if (Info->HandlesExceptions)
639 if (NeedsLargeProlog)
643 Streamer.
emitInt8((Flags << 3) | 3);
646 if (Info->PrologEnd) {
647 if (NeedsLargeProlog) {
651 auto MaybePrologSize =
653 if (MaybePrologSize) {
654 Streamer.
emitInt8(*MaybePrologSize & 0xFF);
671 Streamer.
emitInt8((NumberOfEpilogs << 5) | (PrologOpCount & 0x1F));
674 if (NeedsLargeProlog) {
675 if (Info->PrologEnd) {
676 auto MaybePrologSize =
678 if (MaybePrologSize) {
679 Streamer.
emitInt8((*MaybePrologSize >> 8) & 0xFF);
696 for (
auto &[InstLabel, BeginLabel] : PrologIpLabels) {
697 if (NeedsLargeProlog)
704 const MCSymbol *PrevEpilogStart =
nullptr;
705 for (
const auto &EI : EpilogInfos) {
706 const auto &
Epilog = *EI.Epilog;
711 if (EI.NeedsLarge && !EI.Inherited)
713 uint8_t EpiNumOps = EI.Inherited ? 0 : EI.NumberOfOps;
714 Streamer.
emitInt8((EpiNumOps << 3) | EpiFlags);
721 const MCSymbol *
Base = PrevEpilogStart ? PrevEpilogStart : Info->Begin;
728 if (EpilogOffsetExpr->evaluateAsAbsolute(OffsetValue,
730 if (OffsetValue < INT16_MIN || OffsetValue > INT16_MAX)
732 "Epilog offset out of signed 16-bit range for V3 encoding");
738 PrevEpilogStart =
Epilog.Start;
743 Streamer.
emitInt8(EI.FirstOp & 0xFF);
744 Streamer.
emitInt8((EI.FirstOp >> 8) & 0xFF);
752 unsigned FixupSize = EI.NeedsLarge ? 2 : 1;
759 for (
const auto &EpiInst :
Epilog.Instructions) {
774 if (TotalPayloadBytes % 2 != 0)
783 if (PayloadWords % 2 != 0)
795 else if (PayloadWords == 0) {
807 if (
info->Version == 3) {
816 for (
const auto &Inst :
info->Instructions) {
819 SMLoc(),
"UOP_Push2 (PUSH2 with two registers) requires V3 unwind "
820 "info. Use `.seh_unwindversion 3`.");
834 info->Symbol = Label;
837 bool LastEpilogIsAtEnd =
false;
838 bool AddPaddingEpilogCode =
false;
840 bool EnableUnwindV2 = (
info->Version >= 2) && !
info->EpilogMap.empty();
841 if (EnableUnwindV2) {
842 auto &LastEpilog =
info->EpilogMap.back().second;
851 LastEpilog.UnwindV2Start &&
852 "If unwind v2 is enabled, epilog must have a unwind v2 start marker");
853 assert(LastEpilog.End &&
"Epilog must have an end");
855 OS->
getAssembler(), LastEpilog.End, LastEpilog.UnwindV2Start);
858 "Failed to evaluate epilog size for Unwind v2 in " +
859 info->Function->getName());
863 if (*MaybeSize >= (int64_t)UINT8_MAX) {
865 "Epilog size is too large for Unwind v2 in " +
866 info->Function->getName());
869 EpilogSize = *MaybeSize + 1;
880 LastEpilogIsAtEnd = (LastEpilogToFuncEnd == EpilogSize);
884 size_t numEpilogCodes =
885 info->EpilogMap.size() + (LastEpilogIsAtEnd ? 0 : 1);
886 if ((numEpilogCodes % 2) != 0) {
887 AddPaddingEpilogCode =
true;
892 if ((
size_t)numCodes + numEpilogCodes > UINT8_MAX) {
894 "Too many unwind codes with Unwind v2 enabled in " +
895 info->Function->getName());
899 numCodes += numEpilogCodes;
904 if (
info->ChainedParent)
907 if (
info->HandlesUnwind)
909 if (
info->HandlesExceptions)
922 if (
info->LastFrameInst >= 0) {
930 if (EnableUnwindV2) {
939 uint8_t Flags = LastEpilogIsAtEnd ? 0x01 : 0;
943 if (LastEpilogIsAtEnd)
950 auto *MCE = MCUnwindV2EpilogTargetExpr::create(*
info,
Epilog.second,
951 EpilogSize, context);
956 if (AddPaddingEpilogCode)
961 for (
uint8_t c = 0; c < numInst; ++c) {
963 info->Instructions.pop_back();
982 else if (numCodes == 0) {
990bool MCUnwindV2EpilogTargetExpr::evaluateAsRelocatableImpl(
996 Asm->getContext().reportError(
997 Loc,
"Failed to evaluate epilog offset for Unwind v2 in " +
1002 constexpr uint16_t MaxEpilogOffset = 0x0fff;
1003 if (*
Offset > MaxEpilogOffset) {
1004 Asm->getContext().reportError(
1005 Loc,
"Epilog offset is too large for Unwind v2 in " +
1012 if (
Size != (EpilogSize - 1)) {
1013 Asm->getContext().reportError(
1014 Loc,
"Size of this epilog does not match size of last epilog in " +
1019 auto HighBits = *
Offset >> 8;
1043 bool HandlerData)
const {
1073 std::optional<int64_t> MaybeDiff =
1086 std::optional<int64_t> MaybeDistance =
1092 for (
const auto &
I : Insns) {
1108 if (Distance != InstructionBytes) {
1110 SMLoc(),
"Incorrect size for " + Name +
" " +
Type +
": " +
1112 " bytes of instructions in range, but .seh directives "
1113 "corresponding to " +
1114 Twine(InstructionBytes) +
" bytes\n");
1120 for (
const auto &
I : Insns) {
1235 b = (inst.
Offset >> 4) & 0x1F;
1252 b = (w & 0x00FF0000) >> 16;
1254 b = (w & 0x0000FF00) >> 8;
1276 b |= (inst.
Offset >> 3) & 0x1F;
1281 b |= ((inst.
Offset >> 3) - 1) & 0x3F;
1286 b |= (inst.
Offset >> 3) & 0x3F;
1292 b = 0xD0 | ((reg & 0xC) >> 2);
1294 b = ((reg & 0x3) << 6) | (inst.
Offset >> 3);
1300 b = 0xD4 | ((reg & 0x8) >> 3);
1302 b = ((reg & 0x7) << 5) | ((inst.
Offset >> 3) - 1);
1308 b = 0xC8 | ((reg & 0xC) >> 2);
1310 b = ((reg & 0x3) << 6) | (inst.
Offset >> 3);
1316 b = 0xCC | ((reg & 0xC) >> 2);
1318 b = ((reg & 0x3) << 6) | ((inst.
Offset >> 3) - 1);
1324 assert((reg % 2) == 0 &&
"Saved reg must be 19+2*X");
1326 b = 0xD6 | ((reg & 0x7) >> 2);
1328 b = ((reg & 0x3) << 6) | (inst.
Offset >> 3);
1334 b = 0xDC | ((reg & 0x4) >> 2);
1336 b = ((reg & 0x3) << 6) | (inst.
Offset >> 3);
1344 b = ((reg & 0x7) << 5) | ((inst.
Offset >> 3) - 1);
1350 b = 0xD8 | ((reg & 0x4) >> 2);
1352 b = ((reg & 0x3) << 6) | (inst.
Offset >> 3);
1358 b = 0xDA | ((reg & 0x4) >> 2);
1360 b = ((reg & 0x3) << 6) | ((inst.
Offset >> 3) - 1);
1409 int Writeback =
Op / 6;
1410 int Paired =
Op % 2;
1413 if (Writeback || Paired ||
Mode == 2)
1420 b = inst.
Register | (Writeback << 5) | (Paired << 6);
1439 b = ((inst.
Offset & 0xC0) >> 1) | reg;
1441 b = 0xC0 | (inst.
Offset & 0x3F);
1451 b = ((inst.
Offset & 0xC0) >> 1) | 0x10 | reg;
1453 b = 0xC0 | (inst.
Offset & 0x3F);
1466 const std::vector<MCSymbol *>& Epilogs,
1468 for (
auto *EpilogStart : Epilogs) {
1469 auto InstrsIter =
info->EpilogMap.find(EpilogStart);
1470 assert(InstrsIter !=
info->EpilogMap.end() &&
1471 "Epilog not found in EpilogMap");
1472 const auto &Instrs = InstrsIter->second.Instructions;
1474 if (Instrs.size() != EpilogInstrs.size())
1478 for (
unsigned i = 0; i < Instrs.size(); ++i)
1479 if (Instrs[i] != EpilogInstrs[i]) {
1492 unsigned PrevOffset = -1;
1493 unsigned PrevRegister = -1;
1505 Inst.Register == 29) {
1509 Inst.Register == 19 && Inst.Offset <= 248) {
1515 Inst.Register == PrevRegister + 2 &&
1516 Inst.Offset == PrevOffset + 16) {
1531 PrevRegister = Inst.Register;
1533 PrevOffset = Inst.Offset;
1534 PrevRegister = Inst.Register;
1548 const std::vector<WinEH::Instruction> &
Epilog) {
1555 for (
int I =
Epilog.size() - 1;
I >= 0;
I--) {
1570 int PrologCodeBytes) {
1576 const std::vector<WinEH::Instruction> &
Epilog =
1577 info->EpilogMap[Sym].Instructions;
1583 if (DistanceFromEnd / 4 !=
Epilog.size())
1591 if (PrologCodeBytes <= 31 &&
1593 RetVal = PrologCodeBytes;
1602 if (
Offset > 31 || PrologCodeBytes > 124)
1607 info->EpilogMap.erase(Sym);
1612 int PackedEpilogOffset) {
1613 if (PackedEpilogOffset == 0) {
1619 }
else if (PackedEpilogOffset == 1) {
1629 unsigned RegI = 0, RegF = 0;
1630 int Predecrement = 0;
1642 bool StandaloneLR =
false, FPLRPair =
false;
1652 for (
auto It =
info->Instructions.begin(), EndIt =
info->Instructions.end();
1653 It != EndIt; It++) {
1657 if (Location != Start)
1662 if (Location != Start2)
1668 if (Location != Start2 && Location != Start3)
1670 Predecrement = Inst.
Offset;
1675 if (Location != Start2 && Location != Start3)
1677 Predecrement = Inst.
Offset;
1681 StandaloneLR =
true;
1685 Location = FloatRegs;
1712 StandaloneLR =
true;
1716 Location = FloatRegs;
1723 StandaloneLR =
true;
1724 Location = FloatRegs;
1731 if (Location != FloatRegs || RegF == 0 || Inst.
Register != 8 + RegF ||
1732 Inst.
Offset != 8 * (RegI + (StandaloneLR ? 1 : 0) + RegF))
1735 Location = InputArgs;
1738 if ((Location != Start2 && Location != Start3) || Inst.
Register != 8)
1740 Predecrement = Inst.
Offset;
1742 Location = FloatRegs;
1745 if ((Location !=
IntRegs && Location != FloatRegs) ||
1747 Inst.
Offset != 8 * (RegI + (StandaloneLR ? 1 : 0) + RegF))
1750 Location = FloatRegs;
1755 else if (Location == FloatRegs)
1761 if (Location !=
IntRegs && Location != FloatRegs && Location != InputArgs)
1763 Location = InputArgs;
1768 if (Location != Start2 && Location != Start3 && Location !=
IntRegs &&
1769 Location != FloatRegs && Location != InputArgs &&
1770 Location != StackAdjust)
1776 if (Location == Start2) {
1777 auto NextIt = It + 1;
1778 if (NextIt != EndIt) {
1782 assert(Predecrement == 0);
1785 Predecrement = Inst.
Offset;
1787 StandaloneLR =
true;
1788 Location = FloatRegs;
1802 Location = StackAdjust;
1807 if (Location != Start2 && Location != Start3 && Location !=
IntRegs &&
1808 Location != FloatRegs && Location != InputArgs)
1811 Location = FrameRecord;
1816 if (Location != StackAdjust || Inst.
Offset != 0)
1818 Location = FrameRecord;
1822 if (Location != FrameRecord)
1866 if (RegI > 10 || RegF > 8)
1868 if (StandaloneLR && FPLRPair)
1870 if (FPLRPair && Location != End)
1872 if (Nops != 0 && Nops != 4)
1874 if (PAC && !FPLRPair)
1901 if (StandaloneLR && RegI == 1 && RegF > 0)
1903 int IntSZ = 8 * RegI;
1906 int FpSZ = 8 * RegF;
1907 int SavSZ = (IntSZ + FpSZ + 8 * 8 *
H + 0xF) & ~0xF;
1908 if (Predecrement != SavSZ)
1915 if (FrameSize > 0x1FF)
1917 assert(RegF != 1 &&
"One single float reg not allowed");
1920 assert(FuncLength <= 0x7FF &&
"FuncLength should have been checked earlier");
1922 int CR = PAC ? 2 : FPLRPair ? 3 : StandaloneLR ? 1 : 0;
1923 info->PackedInfo |= Flag << 0;
1924 info->PackedInfo |= (FuncLength & 0x7FF) << 2;
1925 info->PackedInfo |= (RegF & 0x7) << 13;
1926 info->PackedInfo |= (RegI & 0xF) << 16;
1927 info->PackedInfo |= (
H & 0x1) << 20;
1928 info->PackedInfo |= (CR & 0x3) << 21;
1929 info->PackedInfo |= (FrameSize & 0x1FF) << 23;
1938 std::vector<MCSymbol *> EpilogStarts;
1940 EpilogStarts.push_back(
I.first);
1943 std::vector<MCSymbol *> AddedEpilogs;
1944 for (
auto *S : EpilogStarts) {
1946 auto &EpilogInstrs =
info->EpilogMap[S].Instructions;
1952 if (MatchingEpilog) {
1953 assert(EpilogInfo.contains(MatchingEpilog) &&
1954 "Duplicate epilog not found");
1955 EpilogInfo[EpilogStart] = EpilogInfo.lookup(MatchingEpilog);
1958 EpilogInstrs.clear();
1960 EpilogInstrs)) >= 0) {
1961 EpilogInfo[EpilogStart] = PrologOffset;
1965 EpilogInfo[EpilogStart] += 1;
1968 EpilogInstrs.clear();
1970 EpilogInfo[EpilogStart] = TotalCodeBytes;
1971 TotalCodeBytes += CodeBytes;
1972 AddedEpilogs.push_back(EpilogStart);
1979 int64_t RawFuncLength) {
1980 if (
info->PrologEnd)
1982 info->PrologEnd,
info->Function->getName(),
1984 struct EpilogStartEnd {
1991 for (
auto &
I :
info->EpilogMap) {
1993 auto &Instrs =
I.second.Instructions;
1996 info->Function->getName(),
"epilogue");
1998 "Epilogs should be monotonically ordered");
2005 int64_t SegLimit = 0xFFFFC;
2006 int64_t SegOffset = 0;
2008 if (RawFuncLength > SegLimit) {
2010 int64_t RemainingLength = RawFuncLength;
2012 while (RemainingLength > SegLimit) {
2016 int64_t SegLength = SegLimit;
2017 int64_t SegEnd = SegOffset + SegLength;
2021 while (
E < Epilogs.
size() && Epilogs[
E].End < SegEnd) {
2023 EpilogsInSegment[Epilogs[
E].Start] = Epilogs[
E].Offset;
2034 if (
E < Epilogs.
size() && Epilogs[
E].Offset <= SegEnd)
2036 SegLength = Epilogs[
E].Offset - SegOffset;
2039 SegOffset, SegLength, !SegOffset);
2040 Seg.Epilogs = std::move(EpilogsInSegment);
2041 info->Segments.push_back(Seg);
2043 SegOffset += SegLength;
2044 RemainingLength -= SegLength;
2053 for (;
E < Epilogs.
size(); ++
E)
2054 LastSeg.Epilogs[Epilogs[
E].Start] = Epilogs[
E].Offset;
2055 info->Segments.push_back(LastSeg);
2061 bool TryPacked =
true) {
2070 info->Symbol = Label;
2073 bool HasEpilogs = (Seg.
Epilogs.size() != 0);
2078 int PackedEpilogOffset = HasEpilogs ?
2085 if (
info->Segments.size() == 1 && PackedEpilogOffset >= 0 &&
2086 uint32_t(PackedEpilogOffset) < PrologCodeBytes &&
2087 !
info->HandlesExceptions && SegLength <= 0x7ff && TryPacked) {
2102 PrologCodeBytes += 1;
2103 if (PackedEpilogOffset >= 0)
2104 PackedEpilogOffset += 1;
2112 PackedEpilogOffset = 0;
2115 uint32_t TotalCodeBytes = PrologCodeBytes;
2123 uint32_t CodeWords = TotalCodeBytes / 4;
2124 uint32_t CodeWordsMod = TotalCodeBytes % 4;
2128 PackedEpilogOffset >= 0 ? PackedEpilogOffset : Seg.
Epilogs.size();
2129 bool ExtensionWord = EpilogCount > 31 || TotalCodeBytes > 124;
2130 if (!ExtensionWord) {
2131 row1 |= (EpilogCount & 0x1F) << 22;
2132 row1 |= (CodeWords & 0x1F) << 27;
2134 if (
info->HandlesExceptions)
2136 if (PackedEpilogOffset >= 0)
2138 row1 |= SegLength & 0x3FFFF;
2142 if (ExtensionWord) {
2144 if (CodeWords > 0xFF || EpilogCount > 0xFFFF)
2146 "SEH unwind data splitting is only implemented for large functions, "
2147 "cases of too many code words or too many epilogs will be done "
2150 row2 |= (CodeWords & 0xFF) << 16;
2151 row2 |= (EpilogCount & 0xFFFF);
2155 if (PackedEpilogOffset < 0) {
2157 for (
auto &
I : EpilogInfo) {
2165 row3 |= (EpilogIndex & 0x3FF) << 22;
2186 auto &EpilogInstrs =
info->EpilogMap[
I.first].Instructions;
2191 int32_t BytesMod = CodeWords * 4 - TotalCodeBytes;
2193 for (
int i = 0; i < BytesMod; i++)
2196 if (
info->HandlesExceptions)
2206 bool TryPacked =
true) {
2214 if (
info->empty()) {
2215 info->EmitAttempted =
true;
2218 if (
info->EmitAttempted) {
2225 SMLoc(),
"Earlier .seh_handlerdata for " +
info->Function->getName() +
2226 " skipped due to no unwind info at the time "
2227 "(.seh_handlerdata too early?), but the function later "
2228 "did get unwind info that can't be emitted");
2233 for (
auto &
I :
info->EpilogMap)
2236 int64_t RawFuncLength;
2237 if (!
info->FuncletOrFuncEnd) {
2276 for (
auto &S :
info->Segments)
2280 info->Instructions.clear();
2285 for (
const auto &
I : Insns) {
2343 for (J = 3; J > 0; J--)
2344 if (
I.Offset & (0xffu << (8 * J)))
2355 bool *HasCustom =
nullptr) {
2357 for (
const auto &
I : Insns) {
2419 std::optional<int64_t> MaybeDistance =
2424 bool HasCustom =
false;
2428 if (Distance != InstructionBytes) {
2430 SMLoc(),
"Incorrect size for " + Name +
" " +
Type +
": " +
2432 " bytes of instructions in range, but .seh directives "
2433 "corresponding to " +
2434 Twine(InstructionBytes) +
" bytes\n");
2466 w = 0x8000 | (inst.
Register & 0x1fff) | (lr << 13);
2467 streamer.
emitInt8((w >> 8) & 0xff);
2468 streamer.
emitInt8((w >> 0) & 0xff);
2491 w = 0xe800 | (inst.
Offset / 4);
2492 streamer.
emitInt8((w >> 8) & 0xff);
2493 streamer.
emitInt8((w >> 0) & 0xff);
2498 w = 0xec00 | (inst.
Register & 0x0ff) | (lr << 8);
2499 streamer.
emitInt8((w >> 8) & 0xff);
2500 streamer.
emitInt8((w >> 0) & 0xff);
2527 streamer.
emitInt8((w >> 8) & 0xff);
2528 streamer.
emitInt8((w >> 0) & 0xff);
2535 streamer.
emitInt8((w >> 16) & 0xff);
2536 streamer.
emitInt8((w >> 8) & 0xff);
2537 streamer.
emitInt8((w >> 0) & 0xff);
2544 streamer.
emitInt8((w >> 8) & 0xff);
2545 streamer.
emitInt8((w >> 0) & 0xff);
2552 streamer.
emitInt8((w >> 16) & 0xff);
2553 streamer.
emitInt8((w >> 8) & 0xff);
2554 streamer.
emitInt8((w >> 0) & 0xff);
2572 for (i = 3; i > 0; i--)
2573 if (inst.
Offset & (0xffu << (8 * i)))
2588 const std::vector<WinEH::Instruction> &
Epilog,
2589 bool CanTweakProlog) {
2598 int EndIdx = CanTweakProlog ? 1 : 0;
2599 for (
int I =
Epilog.size() - 1;
I >= EndIdx;
I--) {
2606 if (CanTweakProlog) {
2624 int PrologCodeBytes) {
2626 if (
info->EpilogMap.size() != 1)
2631 if (EpilogInfo.Condition != 0xe)
2634 const std::vector<WinEH::Instruction> &
Epilog = EpilogInfo.Instructions;
2636 if (
info->Instructions.empty() ||
Epilog.empty())
2642 streamer,
info->FuncletOrFuncEnd,
info->EpilogMap.begin()->first);
2647 if (DistanceFromEnd != InstructionBytes)
2655 if (PrologCodeBytes <= 31 &&
2657 RetVal = PrologCodeBytes;
2667 if (
Offset > 31 || PrologCodeBytes > 63)
2676 info->EpilogMap.clear();
2681 unsigned &Folded,
int &
IntRegs) {
2682 if (Mask & (1 << 14)) {
2686 if (Mask & (1 << 11)) {
2696 while ((Mask & 1) == 0) {
2700 if ((Mask & (Mask + 1)) != 0)
2704 while (Mask & (1 <<
N))
2723 bool Homing =
false;
2724 bool HasR11 =
false;
2725 bool HasChain =
false;
2730 unsigned StackAdjust = 0;
2765 if (Step != 1 && Step != 2)
2780 if (Step == 1 && Inst.
Register == 0x0f) {
2788 if (Step != 1 && Step != 2)
2800 if (Step != 3 || !HasR11 ||
IntRegs >= 0 || PF > 0)
2807 if (Step != 3 || !HasR11 || (
IntRegs < 0 && PF == 0))
2814 if (Step != 1 && Step != 2 && Step != 3 && Step != 4)
2827 if (Step != 1 && Step != 2 && Step != 3 && Step != 4 && Step != 5)
2831 if (Inst.
Offset / 4 >= 0x3f4)
2833 StackAdjust = Inst.
Offset / 4;
2838 if (HasR11 && !HasChain) {
2847 if (HasChain && !HasLR)
2851 if (
info->EpilogMap.size() > 1)
2856 if (
info->EpilogMap.size() == 0) {
2863 info->EpilogMap.begin()->second;
2864 if (EpilogInfo.Condition != 0xe)
2866 const std::vector<WinEH::Instruction> &
Epilog = EpilogInfo.Instructions;
2868 streamer,
info->FuncletOrFuncEnd,
info->EpilogMap.begin()->first);
2873 if (DistanceFromEnd != InstructionBytes)
2876 bool GotStackAdjust =
false;
2877 bool GotFloatRegs =
false;
2878 bool GotIntRegs =
false;
2879 bool GotHomingRestore =
false;
2880 bool GotLRRestore =
false;
2881 bool NeedsReturn =
false;
2882 bool GotReturn =
false;
2904 if (Inst.
Offset / 4 >= 0x3f4)
2907 if (Homing && FloatRegs < 0 &&
IntRegs < 0 && StackAdjust == 0 &&
2908 PF == 0 && Inst.
Offset == 16) {
2909 GotHomingRestore =
true;
2912 if (StackAdjust > 0) {
2914 if (StackAdjust != Inst.
Offset / 4)
2916 GotStackAdjust =
true;
2917 }
else if (PF == Inst.
Offset / 4) {
2919 StackAdjust = Inst.
Offset / 4;
2920 GotStackAdjust =
true;
2927 }
else if (Step == 7 || Step == 8 || Step == 9) {
2928 if (!Homing || Inst.
Offset != 16)
2930 GotHomingRestore =
true;
2937 if (Step != 6 && Step != 7)
2940 if (FloatRegs != (
int)(Inst.
Register - 8))
2942 GotFloatRegs =
true;
2949 if (Step != 6 && Step != 7 && Step != 8)
2953 if (Homing && HasLR) {
2957 GotLRRestore =
true;
2963 if (HasLR != (Inst.
Offset == 1))
2966 GotLRRestore = Inst.
Offset == 1;
2985 if (Step != 6 && Step != 7 && Step != 8)
2990 bool CurHasLR =
false, CurHasR11 =
false;
2995 if (EF != PF && EF != StackAdjust)
2998 if (Homing && HasLR) {
3002 GotLRRestore =
true;
3008 if (CurHasLR != HasLR)
3010 GotLRRestore = CurHasLR;
3037 if (Step != 6 && Step != 7 && Step != 8 && Step != 9)
3039 if (!Homing || Inst.
Offset != 20 || GotLRRestore)
3041 GotLRRestore =
true;
3042 GotHomingRestore =
true;
3052 if (Step != 6 && Step != 7 && Step != 8 && Step != 9 && Step != 10)
3061 if (StackAdjust > 0 && !GotStackAdjust && EF == 0)
3063 if (FloatRegs >= 0 && !GotFloatRegs)
3065 if (
IntRegs >= 0 && !GotIntRegs)
3067 if (Homing && !GotHomingRestore)
3069 if (HasLR && !GotLRRestore)
3071 if (NeedsReturn && !GotReturn)
3075 assert(PF == 0 || EF == 0 ||
3077 if (PF > 0 || EF > 0) {
3078 StackAdjust = PF > 0 ? (PF - 1) : (EF - 1);
3079 assert(StackAdjust <= 3);
3080 StackAdjust |= 0x3f0;
3082 StackAdjust |= 1 << 2;
3084 StackAdjust |= 1 << 3;
3087 assert(FuncLength <= 0x7FF &&
"FuncLength should have been checked earlier");
3088 int Flag =
info->Fragment ? 0x02 : 0x01;
3089 int H = Homing ? 1 : 0;
3090 int L = HasLR ? 1 : 0;
3091 int C = HasChain ? 1 : 0;
3098 }
else if (FloatRegs >= 0) {
3107 info->PackedInfo |= Flag << 0;
3108 info->PackedInfo |= (FuncLength & 0x7FF) << 2;
3109 info->PackedInfo |= (Ret & 0x3) << 13;
3110 info->PackedInfo |=
H << 15;
3111 info->PackedInfo |=
Reg << 16;
3112 info->PackedInfo |= R << 19;
3113 info->PackedInfo |= L << 20;
3114 info->PackedInfo |=
C << 21;
3115 assert(StackAdjust <= 0x3ff);
3116 info->PackedInfo |= StackAdjust << 22;
3123 bool TryPacked =
true) {
3131 if (
info->empty()) {
3132 info->EmitAttempted =
true;
3135 if (
info->EmitAttempted) {
3142 SMLoc(),
"Earlier .seh_handlerdata for " +
info->Function->getName() +
3143 " skipped due to no unwind info at the time "
3144 "(.seh_handlerdata too early?), but the function later "
3145 "did get unwind info that can't be emitted");
3154 info->Symbol = Label;
3156 if (!
info->PrologEnd)
3158 info->Function->getName() +
3159 " not correctly terminated");
3161 if (
info->PrologEnd && !
info->Fragment)
3163 info->PrologEnd,
info->Function->getName(),
3165 for (
auto &
I :
info->EpilogMap) {
3169 info->Function->getName(),
"epilogue");
3170 if (
Epilog.Instructions.empty() ||
3173 SMLoc(),
"Epilogue in " +
info->Function->getName() +
3174 " not correctly terminated");
3177 std::optional<int64_t> RawFuncLength;
3178 const MCExpr *FuncLengthExpr =
nullptr;
3179 if (!
info->FuncletOrFuncEnd) {
3198 FuncLength = (
uint32_t)*RawFuncLength / 2;
3199 if (FuncLength > 0x3FFFF)
3202 uint32_t TotalCodeBytes = PrologCodeBytes;
3204 if (!
info->HandlesExceptions && RawFuncLength && FuncLength <= 0x7ff &&
3218 int PackedEpilogOffset =
3224 std::vector<MCSymbol *> AddedEpilogs;
3226 bool CanTweakProlog =
true;
3227 for (
auto &
I :
info->EpilogMap) {
3229 auto &EpilogInstrs =
I.second.Instructions;
3235 if (MatchingEpilog) {
3236 assert(EpilogInfo.contains(MatchingEpilog) &&
3237 "Duplicate epilog not found");
3238 EpilogInfo[EpilogStart] = EpilogInfo.lookup(MatchingEpilog);
3241 EpilogInstrs.clear();
3243 info->Instructions, EpilogInstrs, CanTweakProlog)) >= 0) {
3244 if (CanTweakProlog) {
3247 info->Instructions.front() = EpilogInstrs.back();
3249 CanTweakProlog =
false;
3251 EpilogInfo[EpilogStart] = PrologOffset;
3254 EpilogInstrs.clear();
3256 EpilogInfo[EpilogStart] = TotalCodeBytes;
3257 TotalCodeBytes += CodeBytes;
3258 AddedEpilogs.push_back(EpilogStart);
3264 uint32_t CodeWords = TotalCodeBytes / 4;
3265 uint32_t CodeWordsMod = TotalCodeBytes % 4;
3269 PackedEpilogOffset >= 0 ? PackedEpilogOffset :
info->EpilogMap.size();
3270 bool ExtensionWord = EpilogCount > 31 || CodeWords > 15;
3271 if (!ExtensionWord) {
3272 row1 |= (EpilogCount & 0x1F) << 23;
3273 row1 |= (CodeWords & 0x0F) << 28;
3275 if (
info->HandlesExceptions)
3277 if (PackedEpilogOffset >= 0)
3281 row1 |= FuncLength & 0x3FFFF;
3291 if (ExtensionWord) {
3293 if (CodeWords > 0xFF || EpilogCount > 0xFFFF)
3296 row2 |= (CodeWords & 0xFF) << 16;
3297 row2 |= (EpilogCount & 0xFFFF);
3301 if (PackedEpilogOffset < 0) {
3303 for (
auto &
I : EpilogInfo) {
3307 std::optional<int64_t> MaybeEpilogOffset =
3309 const MCExpr *OffsetExpr =
nullptr;
3311 if (MaybeEpilogOffset)
3312 EpilogOffset = *MaybeEpilogOffset / 2;
3316 assert(
info->EpilogMap.contains(EpilogStart));
3317 unsigned Condition =
info->EpilogMap[EpilogStart].Condition;
3318 assert(Condition <= 0xf);
3321 row3 |= Condition << 20;
3322 row3 |= (EpilogIndex & 0x3FF) << 24;
3323 if (MaybeEpilogOffset)
3335 for (
uint8_t c = 0; c < numInst; ++c) {
3337 info->Instructions.pop_back();
3342 for (
auto &
I :
info->EpilogMap) {
3343 auto &EpilogInstrs =
I.second.Instructions;
3348 int32_t BytesMod = CodeWords * 4 - TotalCodeBytes;
3350 for (
int i = 0; i < BytesMod; i++)
3353 if (
info->HandlesExceptions)
3365 for (
const auto &S :
info->Segments) {
3367 if (
info->PackedInfo)
3384 if (
info->PackedInfo)
3420 bool HandlerData)
const {
3427 if (!
info->FuncletOrFuncEnd) {
3465 bool HandlerData)
const {
3472 if (!
info->FuncletOrFuncEnd) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static int checkARM64PackedEpilog(MCStreamer &streamer, WinEH::FrameInfo *info, WinEH::FrameInfo::Segment *Seg, int PrologCodeBytes)
static void ARM64EmitUnwindInfoForSegment(MCStreamer &streamer, WinEH::FrameInfo *info, WinEH::FrameInfo::Segment &Seg, bool TryPacked=true)
static uint32_t ARMCountOfUnwindCodes(ArrayRef< WinEH::Instruction > Insns)
static uint32_t ARM64CountOfUnwindCodes(ArrayRef< WinEH::Instruction > Insns)
static void checkARMInstructions(MCStreamer &Streamer, ArrayRef< WinEH::Instruction > Insns, const MCSymbol *Begin, const MCSymbol *End, StringRef Name, StringRef Type)
static bool isARMTerminator(const WinEH::Instruction &inst)
static void ARM64EmitUnwindCode(MCStreamer &streamer, const WinEH::Instruction &inst)
static void simplifyARM64Opcodes(std::vector< WinEH::Instruction > &Instructions, bool Reverse)
static void ARMEmitUnwindCode(MCStreamer &streamer, const WinEH::Instruction &inst)
static bool EpilogIpOffsetsMatch(const WinEH::FrameInfo::Epilog &A, const WinEH::FrameInfo::Epilog &B, const MCAssembler &Asm)
Compare the relative IP offset arrays of two epilogs.
static std::optional< int64_t > GetOptionalAbsDifference(const MCAssembler &Assembler, const MCSymbol *LHS, const MCSymbol *RHS)
static int getARM64OffsetInProlog(const std::vector< WinEH::Instruction > &Prolog, const std::vector< WinEH::Instruction > &Epilog)
static void ARMEmitRuntimeFunction(MCStreamer &streamer, const WinEH::FrameInfo *info)
static bool tryARM64PackedUnwind(WinEH::FrameInfo *info, uint32_t FuncLength, int PackedEpilogOffset)
static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info)
static void EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin, WinEH::Instruction &inst)
static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info, bool TryPacked=true)
static int getARMOffsetInProlog(const std::vector< WinEH::Instruction > &Prolog, const std::vector< WinEH::Instruction > &Epilog, bool CanTweakProlog)
static void ARM64EmitRuntimeFunction(MCStreamer &streamer, const WinEH::FrameInfo *info)
static void EmitSymbolRefWithOfs(MCStreamer &streamer, const MCSymbol *Base, int64_t Offset)
static bool parseRegMask(unsigned Mask, bool &HasLR, bool &HasR11, unsigned &Folded, int &IntRegs)
static int checkARMPackedEpilog(MCStreamer &streamer, WinEH::FrameInfo *info, int PrologCodeBytes)
static void EmitAbsDifference16(MCStreamer &Streamer, const MCSymbol *LHS, const MCSymbol *RHS)
Emit a 16-bit (2-byte LE) label difference.
static int64_t GetAbsDifference(MCStreamer &Streamer, const MCSymbol *LHS, const MCSymbol *RHS)
static void ARM64FindSegmentsInFunction(MCStreamer &streamer, WinEH::FrameInfo *info, int64_t RawFuncLength)
static bool tryARMPackedUnwind(MCStreamer &streamer, WinEH::FrameInfo *info, uint32_t FuncLength)
static void EmitUnwindInfoV3(MCStreamer &Streamer, WinEH::FrameInfo *Info)
Emit V3 UNWIND_INFO for a single frame.
static MCSymbol * FindMatchingEpilog(const std::vector< WinEH::Instruction > &EpilogInstrs, const std::vector< MCSymbol * > &Epilogs, const WinEH::FrameInfo *info)
static void EmitRuntimeFunction(MCStreamer &streamer, const WinEH::FrameInfo *info)
static void checkARM64Instructions(MCStreamer &Streamer, ArrayRef< WinEH::Instruction > Insns, const MCSymbol *Begin, const MCSymbol *End, StringRef Name, StringRef Type)
static const MCExpr * GetSubDivExpr(MCStreamer &Streamer, const MCSymbol *LHS, const MCSymbol *RHS, int Div)
static void EmitAbsDifference(MCStreamer &Streamer, const MCSymbol *LHS, const MCSymbol *RHS)
static void ARMEmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info, bool TryPacked=true)
static uint32_t ARMCountOfInstructionBytes(ArrayRef< WinEH::Instruction > Insns, bool *HasCustom=nullptr)
static void ARM64ProcessEpilogs(WinEH::FrameInfo *info, WinEH::FrameInfo::Segment *Seg, uint32_t &TotalCodeBytes, MapVector< MCSymbol *, uint32_t > &EpilogInfo)
static std::optional< uint16_t > FindInPool(ArrayRef< uint8_t > Haystack, ArrayRef< uint8_t > Needle)
Try to find Needle as a contiguous subsequence within Haystack.
static uint8_t CountOfUnwindCodes(std::vector< WinEH::Instruction > &Insns)
static void printImpl(const MCAsmInfo &MAI, raw_ostream &OS, const MCSpecifierExpr &Expr)
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
static const MCPhysReg IntRegs[32]
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
bool empty() const
Check if the array is empty.
Tagged union holding either a T or a Error.
MCContext & getContext() const
static const MCBinaryExpr * createLShr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
static const MCBinaryExpr * createOr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createDiv(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
Base class for the full range of assembler expressions which are needed for parsing.
Streaming object file generation interface.
MCAssembler & getAssembler()
void appendContents(ArrayRef< char > Contents)
void addFixup(const MCExpr *Value, MCFixupKind Kind)
void ensureHeadroom(size_t Headroom)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
virtual MCSymbol * emitCFILabel()
When emitting an object file, create and emit a real label.
MCSection * getAssociatedPDataSection(const MCSection *TextSec)
Get the .pdata section used for the given section.
MCContext & getContext() const
MCSection * getAssociatedXDataSection(const MCSection *TextSec)
Get the .xdata section used for the given section.
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void emitInt16(uint64_t Value)
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
void emitInt32(uint64_t Value)
ArrayRef< std::unique_ptr< WinEH::FrameInfo > > getWinFrameInfos() const
void emitInt8(uint64_t Value)
Represent a reference to a symbol from inside an expression.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
StringRef getName() const
getName - Get the symbol name.
MCFragment * getFragment() const
static MCValue get(const MCSymbol *SymA, const MCSymbol *SymB=nullptr, int64_t Val=0, uint32_t Specifier=0)
This class implements a map that also provides access to all stored values in a deterministic order.
Represents a location in source code.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StackOffset holds a fixed and a scalable offset in bytes.
Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI, bool HandlerData) const override
void Emit(MCStreamer &Streamer) const override
This emits the unwind info sections (.pdata and .xdata in PE/COFF).
void Emit(MCStreamer &Streamer) const override
This emits the unwind info sections (.pdata and .xdata in PE/COFF).
void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI, bool HandlerData) const override
void Emit(MCStreamer &Streamer) const override
This emits the unwind info sections (.pdata and .xdata in PE/COFF).
void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI, bool HandlerData) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
@ EPILOG_INFO_LARGE
When set, the extended descriptor uses EPILOG_INFO_LARGE_EX_V3 (16-bit IpOffsetOfLastInstruction) and...
@ UNW_TerminateHandler
UNW_TerminateHandler - Specifies that this function has a termination handler.
@ UNW_FlagLarge
UNW_FlagLarge - V3 only.
@ UNW_ExceptionHandler
UNW_ExceptionHandler - Specifies that this function has an exception handler.
@ UNW_ChainInfo
UNW_ChainInfo - Specifies that this UnwindInfo structure is chained to another one.
UnwindOpcodes
UnwindOpcodes - Enumeration whose values specify a single operation in the prolog of a function.
@ UOP_WideSaveRegsR4R11LR
@ WOD_PUSH_CANONICAL_FRAME
void EncodeWOD(const WinEH::Instruction &Inst, SmallVectorImpl< uint8_t > &Out)
Encode a single WinEH::Instruction as V3 WOD bytes.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
auto reverse(ContainerTy &&C)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
FunctionAddr VTableAddr Count
auto reverse_conditionally(ContainerTy &&C, bool ShouldReverse)
Return a range that conditionally reverses C.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_2
A two-byte fixup.
DWARFExpression::Operation Op
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
This struct is a compact representation of a valid (non-zero power of two) alignment.
MapVector< MCSymbol *, int64_t > Epilogs
const MCSymbol * Function