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;
79 if (
F.hasPersonalityFn()) {
84 bool forceEmitPersonality =
F.hasPersonalityFn() &&
86 F.needsUnwindTableEntry();
91 shouldEmitPersonality =
92 (forceEmitPersonality || ((hasLandingPads || hasEHFunclets) &&
97 shouldEmitLSDA = shouldEmitPersonality &&
110 emitEHRegistrationOffsetLabel(FuncInfo, FLinkageName);
112 shouldEmitLSDA = hasEHFunclets;
113 shouldEmitPersonality =
false;
121 if (isAArch64 && CurrentFuncletEntry &&
122 (shouldEmitMoves || shouldEmitPersonality))
123 Asm->OutStreamer->emitWinCFIFuncletOrFuncEnd();
129 if (!shouldEmitPersonality && !shouldEmitMoves && !shouldEmitLSDA)
134 if (
F.hasPersonalityFn())
143 if (shouldEmitPersonality || shouldEmitLSDA) {
144 Asm->OutStreamer->pushSection();
147 MCSection *XData =
Asm->OutStreamer->getAssociatedXDataSection(
148 Asm->OutStreamer->getCurrentSectionOnly());
149 Asm->OutStreamer->switchSection(XData);
154 emitCSpecificHandlerTable(MF);
156 emitExceptHandlerTable(MF);
158 emitCXXFrameHandler3Table(MF);
160 emitCLRExceptionTable(MF);
164 Asm->OutStreamer->popSection();
187 StringRef HandlerPrefix =
MBB->isCleanupFuncletEntry() ?
"dtor" :
"catch";
188 return Ctx.getOrCreateSymbol(
"?" + HandlerPrefix +
"$" +
190 FuncLinkageName +
"@4HA");
195 CurrentFuncletEntry = &
MBB;
203 Asm->OutStreamer->beginCOFFSymbolDef(Sym);
207 Asm->OutStreamer->endCOFFSymbolDef();
212 std::max(
Asm->MF->getPreferredAlignment(),
MBB.getAlignment()), &
F);
215 Asm->OutStreamer->emitLabel(Sym);
219 if (shouldEmitMoves || shouldEmitPersonality) {
220 CurrentFuncletTextSection =
Asm->OutStreamer->getCurrentSectionOnly();
221 Asm->OutStreamer->emitWinCFIStartProc(Sym);
224 if (shouldEmitPersonality) {
229 if (
F.hasPersonalityFn())
239 if (!CurrentFuncletEntry->isCleanupFuncletEntry())
240 Asm->OutStreamer->emitWinEHHandler(PersHandlerSym,
true,
true);
245 if (isAArch64 && CurrentFuncletEntry &&
246 (shouldEmitMoves || shouldEmitPersonality)) {
247 Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
248 Asm->OutStreamer->emitWinCFIFuncletOrFuncEnd();
253void WinException::endFuncletImpl() {
255 if (!CurrentFuncletEntry)
259 if (shouldEmitMoves || shouldEmitPersonality) {
262 if (
F.hasPersonalityFn())
274 Twine(
"$cppxdata$", FuncLinkageName));
283 emitCSpecificHandlerTable(MF);
284 }
else if (shouldEmitPersonality || shouldEmitLSDA) {
286 Asm->OutStreamer->emitWinEHHandlerData();
304 Asm->OutStreamer->switchSection(CurrentFuncletTextSection);
305 Asm->OutStreamer->emitWinCFIEndProc();
309 CurrentFuncletEntry =
nullptr;
322 return create32bitRef(
Asm->getSymbol(GV));
337const MCExpr *WinException::getOffsetPlusOne(
const MCSymbol *OffsetOf,
344int WinException::getFrameIndexOffset(
int FrameIndex,
346 const TargetFrameLowering &TFI = *
Asm->MF->getSubtarget().getFrameLowering();
348 if (
Asm->MF->usesWindowsUnwindInfo()) {
353 Asm->MF->getSubtarget()
355 ->getStackPointerRegisterToSaveRestore());
365 "Frame offsets with a scalable component are not supported");
372const int NullState = -1;
374struct InvokeStateChange {
396class InvokeStateChangeIterator {
397 InvokeStateChangeIterator(
const WinEHFuncInfo &EHInfo,
402 : EHInfo(EHInfo), MFI(MFI), MFE(MFE),
MBBI(
MBBI), BaseState(BaseState) {
403 LastStateChange.PreviousEndLabel =
nullptr;
404 LastStateChange.NewStartLabel =
nullptr;
405 LastStateChange.NewState = BaseState;
416 auto BlockBegin = Begin->begin();
417 auto BlockEnd = std::prev(
End)->end();
419 InvokeStateChangeIterator(EHInfo, Begin,
End, BlockBegin, BaseState),
420 InvokeStateChangeIterator(EHInfo,
End,
End, BlockEnd, BaseState));
424 bool operator==(
const InvokeStateChangeIterator &O)
const {
425 assert(BaseState ==
O.BaseState);
436 return CurrentEndLabel ==
O.CurrentEndLabel;
439 bool operator!=(
const InvokeStateChangeIterator &O)
const {
442 InvokeStateChange &
operator*() {
return LastStateChange; }
443 InvokeStateChange *operator->() {
return &LastStateChange; }
444 InvokeStateChangeIterator &operator++() {
return scan(); }
447 InvokeStateChangeIterator &scan();
449 const WinEHFuncInfo &EHInfo;
450 const MCSymbol *CurrentEndLabel =
nullptr;
454 InvokeStateChange LastStateChange;
455 bool VisitingInvoke =
false;
461InvokeStateChangeIterator &InvokeStateChangeIterator::scan() {
462 bool IsNewBlock =
false;
463 for (; MFI != MFE; ++MFI, IsNewBlock =
true) {
466 for (
auto MBBE = MFI->end();
MBBI != MBBE; ++
MBBI) {
468 if (!VisitingInvoke && LastStateChange.NewState != BaseState &&
473 LastStateChange.PreviousEndLabel = CurrentEndLabel;
474 LastStateChange.NewStartLabel =
nullptr;
475 LastStateChange.NewState = BaseState;
476 CurrentEndLabel =
nullptr;
486 if (Label == CurrentEndLabel) {
487 VisitingInvoke =
false;
494 auto &StateAndEnd = InvokeMapIter->second;
495 int NewState = StateAndEnd.first;
498 VisitingInvoke =
true;
499 if (NewState == LastStateChange.NewState) {
502 CurrentEndLabel = StateAndEnd.second;
506 LastStateChange.PreviousEndLabel = CurrentEndLabel;
507 LastStateChange.NewStartLabel =
Label;
508 LastStateChange.NewState = NewState;
510 CurrentEndLabel = StateAndEnd.second;
517 if (LastStateChange.NewState != BaseState) {
519 LastStateChange.PreviousEndLabel = CurrentEndLabel;
520 LastStateChange.NewStartLabel =
nullptr;
521 LastStateChange.NewState = BaseState;
523 assert(CurrentEndLabel !=
nullptr);
527 CurrentEndLabel =
nullptr;
559void WinException::emitCSpecificHandlerTable(
const MachineFunction *MF) {
560 auto &OS = *
Asm->OutStreamer;
561 MCContext &Ctx =
Asm->OutContext;
564 bool VerboseAsm = OS.isVerboseAsm();
565 auto AddComment = [&](
const Twine &
Comment) {
567 OS.AddComment(Comment);
573 StringRef FLinkageName =
577 const MCExpr *MCOffset =
579 Asm->OutStreamer->emitAssignment(ParentFrameOffset, MCOffset);
588 const MCExpr *LabelDiff = getOffset(TableEnd, TableBegin);
591 AddComment(
"Number of call sites");
592 OS.emitValue(EntryCount, 4);
594 OS.emitLabel(TableBegin);
603 const MCSymbol *LastStartLabel =
nullptr;
604 int LastEHState = -1;
609 while (Stop !=
End && !Stop->isEHFuncletEntry())
611 for (
const auto &StateChange :
612 InvokeStateChangeIterator::range(FuncInfo, MF->
begin(), Stop)) {
615 if (LastEHState != -1)
616 emitSEHActionsForRange(FuncInfo, LastStartLabel,
617 StateChange.PreviousEndLabel, LastEHState);
618 LastStartLabel = StateChange.NewStartLabel;
619 LastEHState = StateChange.NewState;
622 OS.emitLabel(TableEnd);
625void WinException::emitSEHActionsForRange(
const WinEHFuncInfo &FuncInfo,
627 const MCSymbol *EndLabel,
int State) {
628 auto &OS = *
Asm->OutStreamer;
629 MCContext &Ctx =
Asm->OutContext;
630 bool VerboseAsm = OS.isVerboseAsm();
631 auto AddComment = [&](
const Twine &
Comment) {
633 OS.AddComment(Comment);
636 assert(BeginLabel && EndLabel);
637 while (State != -1) {
638 const SEHUnwindMapEntry &UME = FuncInfo.
SEHUnwindMap[State];
639 const MCExpr *FilterOrFinally;
640 const MCExpr *ExceptOrNull;
648 FilterOrFinally = UME.
Filter ? create32bitRef(UME.
Filter)
649 : MCConstantExpr::create(1, Ctx);
650 ExceptOrNull = create32bitRef(Handler->getSymbol());
653 AddComment(
"LabelStart");
654 OS.emitValue(getLabel(BeginLabel), 4);
655 AddComment(
"LabelEnd");
656 OS.emitValue(getLabel(EndLabel), 4);
657 AddComment(UME.
IsFinally ?
"FinallyFunclet" : UME.
Filter ?
"FilterFunction"
659 OS.emitValue(FilterOrFinally, 4);
660 AddComment(UME.
IsFinally ?
"Null" :
"ExceptionHandler");
661 OS.emitValue(ExceptOrNull, 4);
668void WinException::emitCXXFrameHandler3Table(
const MachineFunction *MF) {
670 auto &OS = *
Asm->OutStreamer;
677 if (shouldEmitPersonality) {
681 Asm->OutContext.getOrCreateSymbol(Twine(
"$cppxdata$", FuncLinkageName));
682 computeIP2StateTable(MF, FuncInfo, IPToStateTable);
684 FuncInfoXData =
Asm->OutContext.getOrCreateLSDASymbol(FuncLinkageName);
687 int UnwindHelpOffset = 0;
698 MCSymbol *TryBlockMapXData =
nullptr;
701 UnwindMapXData =
Asm->OutContext.getOrCreateSymbol(
702 Twine(
"$stateUnwindMap$", FuncLinkageName));
705 Asm->OutContext.getOrCreateSymbol(Twine(
"$tryMap$", FuncLinkageName));
706 if (!IPToStateTable.
empty())
708 Asm->OutContext.getOrCreateSymbol(Twine(
"$ip2state$", FuncLinkageName));
710 bool VerboseAsm = OS.isVerboseAsm();
711 auto AddComment = [&](
const Twine &
Comment) {
713 OS.AddComment(Comment);
731 OS.emitValueToAlignment(
Align(4));
732 OS.emitLabel(FuncInfoXData);
734 AddComment(
"MagicNumber");
735 OS.emitInt32(0x19930522);
737 AddComment(
"MaxState");
740 AddComment(
"UnwindMap");
741 OS.emitValue(create32bitRef(UnwindMapXData), 4);
743 AddComment(
"NumTryBlocks");
746 AddComment(
"TryBlockMap");
747 OS.emitValue(create32bitRef(TryBlockMapXData), 4);
749 AddComment(
"IPMapEntries");
750 OS.emitInt32(IPToStateTable.
size());
752 AddComment(
"IPToStateXData");
753 OS.emitValue(create32bitRef(IPToStateXData), 4);
757 AddComment(
"UnwindHelp");
758 OS.emitInt32(UnwindHelpOffset);
761 AddComment(
"ESTypeList");
764 AddComment(
"EHFlags");
765 if (
MMI->getModule()->getModuleFlag(
"eh-asynch")) {
775 if (UnwindMapXData) {
776 OS.emitLabel(UnwindMapXData);
777 for (
const CxxUnwindMapEntry &UME : FuncInfo.
CxxUnwindMap) {
780 AddComment(
"ToState");
783 AddComment(
"Action");
784 OS.emitValue(create32bitRef(CleanupSym), 4);
795 if (TryBlockMapXData) {
796 OS.emitLabel(TryBlockMapXData);
799 const WinEHTryBlockMapEntry &TBME = FuncInfo.
TryBlockMap[
I];
801 MCSymbol *HandlerMapXData =
nullptr;
804 Asm->OutContext.getOrCreateSymbol(Twine(
"$handlerMap$")
807 .
concat(FuncLinkageName));
815 "bad trymap interval");
817 AddComment(
"TryLow");
818 OS.emitInt32(TBME.
TryLow);
820 AddComment(
"TryHigh");
823 AddComment(
"CatchHigh");
826 AddComment(
"NumCatches");
829 AddComment(
"HandlerArray");
830 OS.emitValue(create32bitRef(HandlerMapXData), 4);
834 unsigned ParentFrameOffset = 0;
835 if (shouldEmitPersonality) {
841 const WinEHTryBlockMapEntry &TBME = FuncInfo.
TryBlockMap[
I];
842 MCSymbol *HandlerMapXData = HandlerMaps[
I];
843 if (!HandlerMapXData)
852 OS.emitLabel(HandlerMapXData);
857 const MCExpr *FrameAllocOffsetRef =
nullptr;
860 assert(
Offset != 0 &&
"Illegal offset for catch object!");
869 AddComment(
"Adjectives");
875 AddComment(
"CatchObjOffset");
876 OS.emitValue(FrameAllocOffsetRef, 4);
878 AddComment(
"Handler");
879 OS.emitValue(create32bitRef(HandlerSym), 4);
881 if (shouldEmitPersonality) {
882 AddComment(
"ParentFrameOffset");
883 OS.emitInt32(ParentFrameOffset);
893 if (IPToStateXData) {
894 OS.emitLabel(IPToStateXData);
895 for (
auto &IPStatePair : IPToStateTable) {
897 OS.emitValue(IPStatePair.first, 4);
898 AddComment(
"ToState");
899 OS.emitInt32(IPStatePair.second);
904void WinException::computeIP2StateTable(
909 FuncletEnd = MF->
begin(),
911 FuncletStart !=
End; FuncletStart = FuncletEnd) {
913 while (++FuncletEnd !=
End) {
914 if (FuncletEnd->isEHFuncletEntry()) {
922 if (FuncletStart->isCleanupFuncletEntry())
927 if (FuncletStart == MF->
begin()) {
928 BaseState = NullState;
929 StartLabel =
Asm->getFunctionBegin();
932 FuncletStart->getBasicBlock()->getFirstNonPHIIt());
937 assert(StartLabel &&
"need local function start label");
938 IPToStateTable.push_back(
939 std::make_pair(create32bitRef(StartLabel), BaseState));
941 for (
const auto &StateChange : InvokeStateChangeIterator::range(
942 FuncInfo, FuncletStart, FuncletEnd, BaseState)) {
947 const MCSymbol *ChangeLabel = StateChange.NewStartLabel;
949 ChangeLabel = StateChange.PreviousEndLabel;
951 const MCExpr *LabelExpression = getLabel(ChangeLabel);
952 IPToStateTable.push_back(
953 std::make_pair(LabelExpression, StateChange.NewState));
959void WinException::emitEHRegistrationOffsetLabel(
const WinEHFuncInfo &FuncInfo,
973 const TargetFrameLowering *TFI =
Asm->MF->getSubtarget().getFrameLowering();
977 MCContext &Ctx =
Asm->OutContext;
980 Asm->OutStreamer->emitAssignment(ParentFrameOffset,
988 MCStreamer &OS = *
Asm->OutStreamer;
993 auto AddComment = [&](
const Twine &
Comment) {
999 emitEHRegistrationOffsetLabel(FuncInfo, FLinkageName);
1002 MCSymbol *LSDALabel =
Asm->OutContext.getOrCreateLSDASymbol(FLinkageName);
1006 const auto *Per =
cast<Function>(
F.getPersonalityFn()->stripPointerCasts());
1007 StringRef PerName = Per->getName();
1009 if (PerName ==
"_except_handler4") {
1032 int GSCookieOffset = -2;
1044 int EHCookieOffset = 9999;
1053 AddComment(
"GSCookieOffset");
1055 AddComment(
"GSCookieXOROffset");
1057 AddComment(
"EHCookieOffset");
1059 AddComment(
"EHCookieXOROffset");
1065 for (
const SEHUnwindMapEntry &UME : FuncInfo.
SEHUnwindMap) {
1072 AddComment(
"ToState");
1074 AddComment(UME.
IsFinally ?
"Null" :
"FilterFunction");
1076 AddComment(UME.
IsFinally ?
"FinallyFunclet" :
"ExceptionHandler");
1077 OS.
emitValue(create32bitRef(ExceptOrFinally), 4);
1083 while (State != -1) {
1094 while (LeftRank < RightRank) {
1099 while (RightRank < LeftRank) {
1116 MCStreamer &OS = *
Asm->OutStreamer;
1133 assert(NumStates > 0 &&
"Don't need exception table!");
1134 DenseMap<const MachineBasicBlock *, int> HandlerStates;
1135 for (
int State = 0; State < NumStates; ++State) {
1136 MachineBasicBlock *HandlerBlock =
1138 HandlerStates[HandlerBlock] = State;
1143 "ill-formed state numbering");
1146 HandlerStates[&MF->
front()] = NullState;
1171 std::unique_ptr<MCSymbol *[]> EndSymbolMap(
new MCSymbol *[NumStates]);
1172 SmallVector<int, 4> MinClauseMap((
size_t)NumStates, NumStates);
1176 FuncletEnd = MF->
begin(),
1178 FuncletStart !=
End; FuncletStart = FuncletEnd) {
1179 int FuncletState = HandlerStates[&*FuncletStart];
1182 while (++FuncletEnd !=
End) {
1183 if (FuncletEnd->isEHFuncletEntry()) {
1190 OS.
emitValue(getOffset(EndSymbol, FuncBeginSym), 4);
1191 if (FuncletState != NullState) {
1193 EndSymbolMap[FuncletState] = EndSymbol;
1198 const MCSymbol *CurrentStartLabel =
nullptr;
1199 int CurrentState = NullState;
1201 for (
const auto &StateChange :
1202 InvokeStateChangeIterator::range(FuncInfo, FuncletStart, FuncletEnd)) {
1204 int StillPendingState =
1206 while (CurrentState != StillPendingState) {
1207 assert(CurrentState != NullState &&
1208 "Failed to find still-pending state!");
1210 Clauses.push_back({CurrentStartLabel, StateChange.PreviousEndLabel,
1211 CurrentState, FuncletState});
1213 CurrentState = FuncInfo.
ClrEHUnwindMap[CurrentState].TryParentState;
1216 if (HandlerStack.
back().second == CurrentState)
1220 if (StateChange.NewState != CurrentState) {
1224 for (
int EnteredState = StateChange.NewState;
1225 EnteredState != CurrentState;
1228 int &MinEnclosingState = MinClauseMap[EnteredState];
1229 if (FuncletState < MinEnclosingState)
1230 MinEnclosingState = FuncletState;
1234 HandlerStack.
emplace_back(CurrentStartLabel, CurrentState);
1235 CurrentStartLabel = StateChange.NewStartLabel;
1236 CurrentState = StateChange.NewState;
1244 for (ClrClause &Clause : Clauses) {
1293 const MCExpr *ClauseBegin =
1294 getOffsetPlusOne(Clause.StartLabel, FuncBeginSym);
1295 const MCExpr *ClauseEnd = getOffsetPlusOne(Clause.EndLabel, FuncBeginSym);
1300 const MCExpr *HandlerBegin = getOffset(BeginSym, FuncBeginSym);
1301 MCSymbol *EndSym = EndSymbolMap[Clause.State];
1302 const MCExpr *HandlerEnd = getOffset(EndSym, FuncBeginSym);
1305 switch (
Entry.HandlerType) {
1319 if (Clause.EnclosingState != MinClauseMap[Clause.State]) {
1322 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