31void DwarfCFIException::addPersonality(
const GlobalValue *Personality) {
33 Personalities.push_back(Personality);
40 if (!
Asm->MAI->usesCFIForEH())
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 &&
97 MAI.
usesCFIForEH() && (shouldEmitPersonality || shouldEmitMoves);
99 shouldEmitCFI =
Asm->usesCFIWithoutEH() && shouldEmitMoves;
106 if (!hasEmittedCFISections) {
112 Asm->TM.Options.ForceDwarfFrameSection ||
113 Asm->TM.Options.MCOptions.EmitSFrameUnwind)
114 Asm->OutStreamer->emitCFISections(
116 Asm->TM.Options.MCOptions.EmitSFrameUnwind);
117 hasEmittedCFISections =
true;
120 Asm->OutStreamer->emitCFIStartProc(
false);
123 if (!shouldEmitPersonality)
126 auto &
F =
MBB.getParent()->getFunction();
128 assert(
P &&
"Expected personality function");
135 Asm->OutStreamer->emitCFIPersonality(Sym, PerEncoding);
139 Asm->OutStreamer->emitCFILsda(
Asm->getMBBExceptionSym(
MBB),
145 Asm->OutStreamer->emitCFIEndProc();
151 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() const
Returns true if the exception handling method for the platform uses call frame information to unwind.
ExceptionHandling getExceptionHandlingType() const
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.
@ None
No exception support.
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.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.