31void DwarfCFIException::addPersonality(
const GlobalValue *Personality) {
33 Personalities.push_back(Personality);
40 if (!
Asm->MAI.usesCFIForEH(
Asm->getModuleExceptionModel()))
51 for (
const GlobalValue *Personality : Personalities) {
56 Personalities.clear();
60 shouldEmitPersonality = shouldEmitLSDA =
false;
67 bool shouldEmitMoves =
73 if (
F.hasPersonalityFn())
77 forceEmitPersonality =
79 F.hasPersonalityFn() &&
83 F.needsUnwindTableEntry();
85 shouldEmitPersonality =
86 (forceEmitPersonality ||
91 shouldEmitLSDA = shouldEmitPersonality &&
98 (shouldEmitPersonality || shouldEmitMoves) && MAI.
usesCFIForEH(EH);
100 shouldEmitCFI =
Asm->usesCFIWithoutEH() && shouldEmitMoves;
107 if (!hasEmittedCFISections) {
113 Asm->TM.Options.ForceDwarfFrameSection ||
114 Asm->TM.Options.MCOptions.EmitSFrameUnwind)
115 Asm->OutStreamer->emitCFISections(
117 Asm->TM.Options.MCOptions.EmitSFrameUnwind);
118 hasEmittedCFISections =
true;
121 Asm->OutStreamer->emitCFIStartProc(
false);
124 if (!shouldEmitPersonality)
127 auto &
F =
MBB.getParent()->getFunction();
129 assert(
P &&
"Expected personality function");
136 Asm->OutStreamer->emitCFIPersonality(Sym, PerEncoding);
140 Asm->OutStreamer->emitCFILsda(
Asm->getMBBExceptionSym(
MBB),
146 Asm->OutStreamer->emitCFIEndProc();
152 if (!shouldEmitPersonality)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file contains constants used for implementing Dwarf debug support.
This class is intended to be used as a driving class for all asm writers.
@ None
Do not emit either .eh_frame or .debug_frame.
@ Debug
Emit .debug_frame.
void endBasicBlockSection(const MachineBasicBlock &MBB) override
Process the end of a basic-block-section within a function.
~DwarfCFIException() override
void beginBasicBlockSection(const MachineBasicBlock &MBB) override
Process the beginning of a new basic-block-section within a function.
void endFunction(const MachineFunction *) override
Gather and emit post-function exception information.
void endModule() override
Emit all exception information that should come after the content.
DwarfCFIException(AsmPrinter *A)
void beginFunction(const MachineFunction *MF) override
Gather pre-function exception information.
AsmPrinter * Asm
Target of directive emission.
MCSymbol * emitExceptionTable()
Emit landing pads and actions.
MachineModuleInfo * MMI
Collected machine module information.
EHStreamer(AsmPrinter *A)
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool usesCFIForEH(ExceptionHandling EH) const
Returns true if the exception handling method EH uses call frame information to unwind.
const MCAsmInfo & getAsmInfo() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCContext & getContext() const
Function & getFunction()
Return the LLVM function that this machine code represents.
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
unsigned getLSDAEncoding() const
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, const TargetMachine &TM, MachineModuleInfo *MMI) const
unsigned getPersonalityEncoding() const
virtual void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &TM, const MCSymbol *Sym, const MachineModuleInfo *MMI) const
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.
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
@ None
No exception support.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.