39 useImageRel32 =
A->TM.getTargetTriple().getArch() !=
Triple::x86;
40 isAArch64 =
Asm->TM.getTargetTriple().isAArch64();
48 auto &OS = *
Asm->OutStreamer;
51 if (
F.hasFnAttribute(
"safeseh"))
52 OS.emitCOFFSafeSEH(
Asm->getSymbol(&
F));
54 if (M->getModuleFlag(
"ehcontguard") && !EHContTargets.empty()) {
56 OS.switchSection(
Asm->OutContext.getObjectFileInfo()->getGEHContSection());
57 for (
const MCSymbol *S : EHContTargets) {
58 OS.emitCOFFSymbolIndex(S);
64 shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA =
false;
65 HasExplicitWinCFIRanges =
false;
80 if (
F.hasPersonalityFn()) {
85 bool forceEmitPersonality =
F.hasPersonalityFn() &&
87 F.needsUnwindTableEntry();
92 shouldEmitPersonality =
93 (forceEmitPersonality || ((hasLandingPads || hasEHFunclets) &&
98 shouldEmitLSDA = shouldEmitPersonality &&
111 emitEHRegistrationOffsetLabel(FuncInfo, FLinkageName);
113 shouldEmitLSDA = hasEHFunclets;
114 shouldEmitPersonality =
false;
122 if (isAArch64 && CurrentFuncletEntry &&
123 (shouldEmitMoves || shouldEmitPersonality) &&
124 (!HasExplicitWinCFIRanges ||
Asm->OutStreamer->hasActiveWinCFI()))
125 Asm->OutStreamer->emitWinCFIFuncletOrFuncEnd();
131 if (!shouldEmitPersonality && !shouldEmitMoves && !shouldEmitLSDA)
136 if (
F.hasPersonalityFn())
145 if (shouldEmitPersonality || shouldEmitLSDA) {
146 Asm->OutStreamer->pushSection();
149 MCSection *XData =
Asm->OutStreamer->getAssociatedXDataSection(
150 Asm->OutStreamer->getCurrentSectionOnly());
151 Asm->OutStreamer->switchSection(XData);
156 emitCSpecificHandlerTable(MF);
158 emitExceptHandlerTable(MF);
160 emitCXXFrameHandler3Table(MF);
162 emitCLRExceptionTable(MF);
166 Asm->OutStreamer->popSection();
189 StringRef HandlerPrefix =
MBB->isCleanupFuncletEntry() ?
"dtor" :
"catch";
190 return Ctx.getOrCreateSymbol(
"?" + HandlerPrefix +
"$" +
192 FuncLinkageName +
"@4HA");
197 CurrentFuncletEntry = &
MBB;
205 Asm->OutStreamer->beginCOFFSymbolDef(Sym);
209 Asm->OutStreamer->endCOFFSymbolDef();
214 std::max(
Asm->MF->getPreferredAlignment(),
MBB.getAlignment()), &
F);
217 Asm->OutStreamer->emitLabel(Sym);
221 if (shouldEmitMoves || shouldEmitPersonality) {
222 CurrentFuncletTextSection =
Asm->OutStreamer->getCurrentSectionOnly();
223 HasExplicitWinCFIRanges =
Asm->hasExplicitWinCFIRanges();
224 if (!HasExplicitWinCFIRanges)
225 Asm->OutStreamer->emitWinCFIStartProc(Sym);
228 if (shouldEmitPersonality) {
233 if (
F.hasPersonalityFn())
243 if (!CurrentFuncletEntry->isCleanupFuncletEntry())
244 Asm->OutStreamer->emitWinEHHandler(PersHandlerSym,
true,
true);
249 if (isAArch64 && CurrentFuncletEntry &&
250 (shouldEmitMoves || shouldEmitPersonality)) {
251 Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
252 Asm->OutStreamer->emitWinCFIFuncletOrFuncEnd();
257void WinException::endFuncletImpl() {
259 if (!CurrentFuncletEntry)
263 if (shouldEmitMoves || shouldEmitPersonality) {
266 if (
F.hasPersonalityFn())
278 Twine(
"$cppxdata$", FuncLinkageName));
287 emitCSpecificHandlerTable(MF);
288 }
else if (shouldEmitPersonality || shouldEmitLSDA) {
290 Asm->OutStreamer->emitWinEHHandlerData();
308 Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
309 if (!HasExplicitWinCFIRanges ||
Asm->OutStreamer->hasActiveWinCFI())
310 Asm->OutStreamer->emitWinCFIEndProc();
314 CurrentFuncletEntry =
nullptr;
327 return create32bitRef(
Asm->getSymbol(GV));
342const MCExpr *WinException::getOffsetPlusOne(
const MCSymbol *OffsetOf,
349int WinException::getFrameIndexOffset(
int FrameIndex,
351 const TargetFrameLowering &TFI = *
Asm->MF->getSubtarget().getFrameLowering();
353 if (
Asm->MF->usesWindowsUnwindInfo()) {
358 Asm->MF->getSubtarget()
360 ->getStackPointerRegisterToSaveRestore());
370 "Frame offsets with a scalable component are not supported");
377const int NullState = -1;
379struct InvokeStateChange {
401class InvokeStateChangeIterator {
402 InvokeStateChangeIterator(
const WinEHFuncInfo &EHInfo,
407 : EHInfo(EHInfo), MFI(MFI), MFE(MFE),
MBBI(
MBBI), BaseState(BaseState) {
408 LastStateChange.PreviousEndLabel =
nullptr;
409 LastStateChange.NewStartLabel =
nullptr;
410 LastStateChange.NewState = BaseState;
421 auto BlockBegin = Begin->begin();
422 auto BlockEnd = std::prev(
End)->end();
424 InvokeStateChangeIterator(EHInfo, Begin,
End, BlockBegin, BaseState),
425 InvokeStateChangeIterator(EHInfo,
End,
End, BlockEnd, BaseState));
429 bool operator==(
const InvokeStateChangeIterator &O)
const {
430 assert(BaseState ==
O.BaseState);
441 return CurrentEndLabel ==
O.CurrentEndLabel;
444 bool operator!=(
const InvokeStateChangeIterator &O)
const {
447 InvokeStateChange &
operator*() {
return LastStateChange; }
448 InvokeStateChange *operator->() {
return &LastStateChange; }
449 InvokeStateChangeIterator &operator++() {
return scan(); }
452 InvokeStateChangeIterator &scan();
454 const WinEHFuncInfo &EHInfo;
455 const MCSymbol *CurrentEndLabel =
nullptr;
459 InvokeStateChange LastStateChange;
460 bool VisitingInvoke =
false;
466InvokeStateChangeIterator &InvokeStateChangeIterator::scan() {
467 bool IsNewBlock =
false;
468 for (; MFI != MFE; ++MFI, IsNewBlock =
true) {
471 for (
auto MBBE = MFI->end();
MBBI != MBBE; ++
MBBI) {
473 if (!VisitingInvoke && LastStateChange.NewState != BaseState &&
478 LastStateChange.PreviousEndLabel = CurrentEndLabel;
479 LastStateChange.NewStartLabel =
nullptr;
480 LastStateChange.NewState = BaseState;
481 CurrentEndLabel =
nullptr;
491 if (Label == CurrentEndLabel) {
492 VisitingInvoke =
false;
499 auto &StateAndEnd = InvokeMapIter->second;
500 int NewState = StateAndEnd.first;
503 VisitingInvoke =
true;
504 if (NewState == LastStateChange.NewState) {
507 CurrentEndLabel = StateAndEnd.second;
511 LastStateChange.PreviousEndLabel = CurrentEndLabel;
512 LastStateChange.NewStartLabel =
Label;
513 LastStateChange.NewState = NewState;
515 CurrentEndLabel = StateAndEnd.second;
522 if (LastStateChange.NewState != BaseState) {
524 LastStateChange.PreviousEndLabel = CurrentEndLabel;
525 LastStateChange.NewStartLabel =
nullptr;
526 LastStateChange.NewState = BaseState;
528 assert(CurrentEndLabel !=
nullptr);
532 CurrentEndLabel =
nullptr;
564void WinException::emitCSpecificHandlerTable(
const MachineFunction *MF) {
565 auto &OS = *
Asm->OutStreamer;
566 MCContext &Ctx =
Asm->OutContext;
569 bool VerboseAsm = OS.isVerboseAsm();
570 auto AddComment = [&](
const Twine &
Comment) {
572 OS.AddComment(Comment);
578 StringRef FLinkageName =
582 const MCExpr *MCOffset =
584 Asm->OutStreamer->emitAssignment(ParentFrameOffset, MCOffset);
593 const MCExpr *LabelDiff = getOffset(TableEnd, TableBegin);
596 AddComment(
"Number of call sites");
597 OS.emitValue(EntryCount, 4);
599 OS.emitLabel(TableBegin);
608 const MCSymbol *LastStartLabel =
nullptr;
609 int LastEHState = -1;
614 while (Stop !=
End && !Stop->isEHFuncletEntry())
616 for (
const auto &StateChange :
617 InvokeStateChangeIterator::range(FuncInfo, MF->
begin(), Stop)) {
620 if (LastEHState != -1)
621 emitSEHActionsForRange(FuncInfo, LastStartLabel,
622 StateChange.PreviousEndLabel, LastEHState);
623 LastStartLabel = StateChange.NewStartLabel;
624 LastEHState = StateChange.NewState;
627 OS.emitLabel(TableEnd);
630void WinException::emitSEHActionsForRange(
const WinEHFuncInfo &FuncInfo,
632 const MCSymbol *EndLabel,
int State) {
633 auto &OS = *
Asm->OutStreamer;
634 MCContext &Ctx =
Asm->OutContext;
635 bool VerboseAsm = OS.isVerboseAsm();
636 auto AddComment = [&](
const Twine &
Comment) {
638 OS.AddComment(Comment);
641 assert(BeginLabel && EndLabel);
642 while (State != -1) {
643 const SEHUnwindMapEntry &UME = FuncInfo.
SEHUnwindMap[State];
644 const MCExpr *FilterOrFinally;
645 const MCExpr *ExceptOrNull;
653 FilterOrFinally = UME.
Filter ? create32bitRef(UME.
Filter)
654 : MCConstantExpr::create(1, Ctx);
655 ExceptOrNull = create32bitRef(Handler->getSymbol());
658 AddComment(
"LabelStart");
659 OS.emitValue(getLabel(BeginLabel), 4);
660 AddComment(
"LabelEnd");
661 OS.emitValue(getLabel(EndLabel), 4);
662 AddComment(UME.
IsFinally ?
"FinallyFunclet" : UME.
Filter ?
"FilterFunction"
664 OS.emitValue(FilterOrFinally, 4);
665 AddComment(UME.
IsFinally ?
"Null" :
"ExceptionHandler");
666 OS.emitValue(ExceptOrNull, 4);
673void WinException::emitCXXFrameHandler3Table(
const MachineFunction *MF) {
675 auto &OS = *
Asm->OutStreamer;
682 if (shouldEmitPersonality) {
686 Asm->OutContext.getOrCreateSymbol(Twine(
"$cppxdata$", FuncLinkageName));
687 computeIP2StateTable(MF, FuncInfo, IPToStateTable);
689 FuncInfoXData =
Asm->OutContext.getOrCreateLSDASymbol(FuncLinkageName);
692 int UnwindHelpOffset = 0;
703 MCSymbol *TryBlockMapXData =
nullptr;
706 UnwindMapXData =
Asm->OutContext.getOrCreateSymbol(
707 Twine(
"$stateUnwindMap$", FuncLinkageName));
710 Asm->OutContext.getOrCreateSymbol(Twine(
"$tryMap$", FuncLinkageName));
711 if (!IPToStateTable.
empty())
713 Asm->OutContext.getOrCreateSymbol(Twine(
"$ip2state$", FuncLinkageName));
715 bool VerboseAsm = OS.isVerboseAsm();
716 auto AddComment = [&](
const Twine &
Comment) {
718 OS.AddComment(Comment);
736 OS.emitValueToAlignment(
Align(4));
737 OS.emitLabel(FuncInfoXData);
739 AddComment(
"MagicNumber");
740 OS.emitInt32(0x19930522);
742 AddComment(
"MaxState");
745 AddComment(
"UnwindMap");
746 OS.emitValue(create32bitRef(UnwindMapXData), 4);
748 AddComment(
"NumTryBlocks");
751 AddComment(
"TryBlockMap");
752 OS.emitValue(create32bitRef(TryBlockMapXData), 4);
754 AddComment(
"IPMapEntries");
755 OS.emitInt32(IPToStateTable.
size());
757 AddComment(
"IPToStateXData");
758 OS.emitValue(create32bitRef(IPToStateXData), 4);
762 AddComment(
"UnwindHelp");
763 OS.emitInt32(UnwindHelpOffset);
766 AddComment(
"ESTypeList");
769 AddComment(
"EHFlags");
770 if (
MMI->getModule()->getModuleFlag(
"eh-asynch")) {
780 if (UnwindMapXData) {
781 OS.emitLabel(UnwindMapXData);
782 for (
const CxxUnwindMapEntry &UME : FuncInfo.
CxxUnwindMap) {
785 AddComment(
"ToState");
788 AddComment(
"Action");
789 OS.emitValue(create32bitRef(CleanupSym), 4);
800 if (TryBlockMapXData) {
801 OS.emitLabel(TryBlockMapXData);
804 const WinEHTryBlockMapEntry &TBME = FuncInfo.
TryBlockMap[
I];
806 MCSymbol *HandlerMapXData =
nullptr;
809 Asm->OutContext.getOrCreateSymbol(Twine(
"$handlerMap$")
812 .
concat(FuncLinkageName));
820 "bad trymap interval");
822 AddComment(
"TryLow");
823 OS.emitInt32(TBME.
TryLow);
825 AddComment(
"TryHigh");
828 AddComment(
"CatchHigh");
831 AddComment(
"NumCatches");
834 AddComment(
"HandlerArray");
835 OS.emitValue(create32bitRef(HandlerMapXData), 4);
839 unsigned ParentFrameOffset = 0;
840 if (shouldEmitPersonality) {
846 const WinEHTryBlockMapEntry &TBME = FuncInfo.
TryBlockMap[
I];
847 MCSymbol *HandlerMapXData = HandlerMaps[
I];
848 if (!HandlerMapXData)
857 OS.emitLabel(HandlerMapXData);
862 const MCExpr *FrameAllocOffsetRef =
nullptr;
865 assert(
Offset != 0 &&
"Illegal offset for catch object!");
874 AddComment(
"Adjectives");
880 AddComment(
"CatchObjOffset");
881 OS.emitValue(FrameAllocOffsetRef, 4);
883 AddComment(
"Handler");
884 OS.emitValue(create32bitRef(HandlerSym), 4);
886 if (shouldEmitPersonality) {
887 AddComment(
"ParentFrameOffset");
888 OS.emitInt32(ParentFrameOffset);
898 if (IPToStateXData) {
899 OS.emitLabel(IPToStateXData);
900 for (
auto &IPStatePair : IPToStateTable) {
902 OS.emitValue(IPStatePair.first, 4);
903 AddComment(
"ToState");
904 OS.emitInt32(IPStatePair.second);
909void WinException::computeIP2StateTable(
914 FuncletEnd = MF->
begin(),
916 FuncletStart !=
End; FuncletStart = FuncletEnd) {
918 while (++FuncletEnd !=
End) {
919 if (FuncletEnd->isEHFuncletEntry()) {
927 if (FuncletStart->isCleanupFuncletEntry())
932 if (FuncletStart == MF->
begin()) {
933 BaseState = NullState;
934 StartLabel =
Asm->getFunctionBegin();
937 FuncletStart->getBasicBlock()->getFirstNonPHIIt());
942 assert(StartLabel &&
"need local function start label");
943 IPToStateTable.push_back(
944 std::make_pair(create32bitRef(StartLabel), BaseState));
946 for (
const auto &StateChange : InvokeStateChangeIterator::range(
947 FuncInfo, FuncletStart, FuncletEnd, BaseState)) {
952 const MCSymbol *ChangeLabel = StateChange.NewStartLabel;
954 ChangeLabel = StateChange.PreviousEndLabel;
956 const MCExpr *LabelExpression = getLabel(ChangeLabel);
957 IPToStateTable.push_back(
958 std::make_pair(LabelExpression, StateChange.NewState));
964void WinException::emitEHRegistrationOffsetLabel(
const WinEHFuncInfo &FuncInfo,
978 const TargetFrameLowering *TFI =
Asm->MF->getSubtarget().getFrameLowering();
982 MCContext &Ctx =
Asm->OutContext;
985 Asm->OutStreamer->emitAssignment(ParentFrameOffset,
993 MCStreamer &OS = *
Asm->OutStreamer;
998 auto AddComment = [&](
const Twine &
Comment) {
1004 emitEHRegistrationOffsetLabel(FuncInfo, FLinkageName);
1007 MCSymbol *LSDALabel =
Asm->OutContext.getOrCreateLSDASymbol(FLinkageName);
1011 const auto *Per =
cast<Function>(
F.getPersonalityFn()->stripPointerCasts());
1012 StringRef PerName = Per->getName();
1014 if (PerName ==
"_except_handler4") {
1037 int GSCookieOffset = -2;
1049 int EHCookieOffset = 9999;
1058 AddComment(
"GSCookieOffset");
1060 AddComment(
"GSCookieXOROffset");
1062 AddComment(
"EHCookieOffset");
1064 AddComment(
"EHCookieXOROffset");
1070 for (
const SEHUnwindMapEntry &UME : FuncInfo.
SEHUnwindMap) {
1077 AddComment(
"ToState");
1079 AddComment(UME.
IsFinally ?
"Null" :
"FilterFunction");
1081 AddComment(UME.
IsFinally ?
"FinallyFunclet" :
"ExceptionHandler");
1082 OS.
emitValue(create32bitRef(ExceptOrFinally), 4);
1088 while (State != -1) {
1099 while (LeftRank < RightRank) {
1104 while (RightRank < LeftRank) {
1121 MCStreamer &OS = *
Asm->OutStreamer;
1138 assert(NumStates > 0 &&
"Don't need exception table!");
1139 DenseMap<const MachineBasicBlock *, int> HandlerStates;
1140 for (
int State = 0; State < NumStates; ++State) {
1141 MachineBasicBlock *HandlerBlock =
1143 HandlerStates[HandlerBlock] = State;
1148 "ill-formed state numbering");
1151 HandlerStates[&MF->
front()] = NullState;
1176 std::unique_ptr<MCSymbol *[]> EndSymbolMap(
new MCSymbol *[NumStates]);
1177 SmallVector<int, 4> MinClauseMap((
size_t)NumStates, NumStates);
1181 FuncletEnd = MF->
begin(),
1183 FuncletStart !=
End; FuncletStart = FuncletEnd) {
1184 int FuncletState = HandlerStates[&*FuncletStart];
1187 while (++FuncletEnd !=
End) {
1188 if (FuncletEnd->isEHFuncletEntry()) {
1195 OS.
emitValue(getOffset(EndSymbol, FuncBeginSym), 4);
1196 if (FuncletState != NullState) {
1198 EndSymbolMap[FuncletState] = EndSymbol;
1203 const MCSymbol *CurrentStartLabel =
nullptr;
1204 int CurrentState = NullState;
1206 for (
const auto &StateChange :
1207 InvokeStateChangeIterator::range(FuncInfo, FuncletStart, FuncletEnd)) {
1209 int StillPendingState =
1211 while (CurrentState != StillPendingState) {
1212 assert(CurrentState != NullState &&
1213 "Failed to find still-pending state!");
1215 Clauses.push_back({CurrentStartLabel, StateChange.PreviousEndLabel,
1216 CurrentState, FuncletState});
1218 CurrentState = FuncInfo.
ClrEHUnwindMap[CurrentState].TryParentState;
1221 if (HandlerStack.
back().second == CurrentState)
1225 if (StateChange.NewState != CurrentState) {
1229 for (
int EnteredState = StateChange.NewState;
1230 EnteredState != CurrentState;
1233 int &MinEnclosingState = MinClauseMap[EnteredState];
1234 if (FuncletState < MinEnclosingState)
1235 MinEnclosingState = FuncletState;
1239 HandlerStack.
emplace_back(CurrentStartLabel, CurrentState);
1240 CurrentStartLabel = StateChange.NewStartLabel;
1241 CurrentState = StateChange.NewState;
1249 for (ClrClause &Clause : Clauses) {
1298 const MCExpr *ClauseBegin =
1299 getOffsetPlusOne(Clause.StartLabel, FuncBeginSym);
1300 const MCExpr *ClauseEnd = getOffsetPlusOne(Clause.EndLabel, FuncBeginSym);
1305 const MCExpr *HandlerBegin = getOffset(BeginSym, FuncBeginSym);
1306 MCSymbol *EndSym = EndSymbolMap[Clause.State];
1307 const MCExpr *HandlerEnd = getOffset(EndSym, FuncBeginSym);
1310 switch (
Entry.HandlerType) {
1324 if (Clause.EnclosingState != MinClauseMap[Clause.State]) {
1327 assert(Clause.EnclosingState > MinClauseMap[Clause.State]);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
Promote Memory to Register
This file describes how to lower LLVM code to machine code.
static int getTryAncestor(const WinEHFuncInfo &FuncInfo, int Left, int Right)
static int getTryRank(const WinEHFuncInfo &FuncInfo, int State)
static MCSymbol * getMCSymbolForMBB(AsmPrinter *Asm, const MachineBasicBlock *MBB)
Retrieve the MCSymbol for a GlobalValue or MachineBasicBlock.
This class is intended to be used as a driving class for all asm writers.
MachineFunction * MF
The current machine function.
MCContext & OutContext
This is the context for the output file that we are streaming.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
static bool callToNoUnwindFunction(const MachineInstr *MI)
Return ‘true’ if this is a call to a function marked ‘nounwind’.
AsmPrinter * Asm
Target of directive emission.
MCSymbol * emitExceptionTable()
Emit landing pads and actions.
MachineModuleInfo * MMI
Collected machine module information.
EHStreamer(AsmPrinter *A)
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1',...
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
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 MCSymbol * getOrCreateParentFrameOffsetSymbol(const Twine &FuncName)
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
virtual bool isVerboseAsm() const
Return true if this streamer supports verbose assembly and if it is enabled.
virtual void AddComment(const Twine &T, bool EOL=true)
Add a textual comment.
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 emitInt32(uint64_t Value)
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 ...
MachineInstrBundleIterator< const MachineInstr > const_iterator
bool isEHFuncletEntry() const
Returns true if this is the entry block of an EH funclet.
bool isCleanupFuncletEntry() const
Returns true if this is the entry block of a cleanup funclet.
int getStackProtectorIndex() const
Return the index for the stack protector object.
bool hasStackProtectorIndex() const
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const std::vector< MCSymbol * > & getEHContTargets() const
Returns a reference to a list of symbols that are targets for Windows EH Continuation Guard.
MCContext & getContext() const
bool needsWinCFI() const
True if this function uses SEH unwind opcodes and needs an unwind table entry.
Function & getFunction()
Return the LLVM function that this machine code represents.
bool usesWindowsUnwindInfo() const
True if this function describes its unwind information with Windows SEH unwind opcodes (....
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
const MachineBasicBlock & front() const
bool hasEHFunclets() const
BasicBlockListType::const_iterator const_iterator
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
int64_t getFixed() const
Returns the fixed component of the stack.
static StackOffset getFixed(int64_t Fixed)
Represent a constant reference to a string, i.e.
virtual StackOffset getNonLocalFrameIndexReference(const MachineFunction &MF, int FI) const
getNonLocalFrameIndexReference - This method returns the offset used to reference a frame index locat...
virtual StackOffset getFrameIndexReferencePreferSP(const MachineFunction &MF, int FI, Register &FrameReg, bool IgnoreSPUpdates) const
Same as getFrameIndexReference, except that the stack pointer (as opposed to the frame pointer) will ...
virtual unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const
virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
unsigned getLSDAEncoding() const
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const
unsigned getPersonalityEncoding() const
virtual const TargetFrameLowering * getFrameLowering() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
void endFunction(const MachineFunction *) override
Gather and emit post-function exception information.
void markFunctionEnd() override
void beginFunclet(const MachineBasicBlock &MBB, MCSymbol *Sym) override
Emit target-specific EH funclet machinery.
void endModule() override
Emit all exception information that should come after the content.
WinException(AsmPrinter *A)
void endFunclet() override
void beginFunction(const MachineFunction *MF) override
Gather pre-function exception information.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ IMAGE_SYM_CLASS_STATIC
Static.
@ IMAGE_SYM_DTYPE_FUNCTION
A function that returns a base type.
@ SCT_COMPLEX_TYPE_SHIFT
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
EnumSet< Clause > Clauses
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
APInt operator*(APInt a, uint64_t RHS)
bool operator!=(uint64_t V1, const APInt &V2)
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&...Ranges)
Returns a concatenated range across two or more ranges.
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
@ End
Run the machine verifier once, at the end of the pipeline.
int ToState
If unwinding continues through this handler, transition to the handler at this state.
MBBOrBasicBlock Handler
Holds the __except or __finally basic block.
const Function * Filter
Holds the filter expression function.
SmallVector< SEHUnwindMapEntry, 4 > SEHUnwindMap
SmallVector< ClrEHUnwindMapEntry, 4 > ClrEHUnwindMap
DenseMap< const FuncletPadInst *, int > FuncletBaseStateMap
SmallVector< WinEHTryBlockMapEntry, 4 > TryBlockMap
DenseMap< MCSymbol *, std::pair< int, MCSymbol * > > LabelToStateMap
SmallVector< CxxUnwindMapEntry, 4 > CxxUnwindMap
GlobalVariable * TypeDescriptor
union llvm::WinEHHandlerType::@246205307012256373115155017221207221353102114334 CatchObj
The CatchObj starts out life as an LLVM alloca and is eventually turned frame index.
SmallVector< WinEHHandlerType, 1 > HandlerArray
constexpr size_t size() const