LLVM 20.0.0git
|
Emits exception handling directives. More...
#include "CodeGen/AsmPrinter/EHStreamer.h"
Classes | |
struct | ActionEntry |
Structure describing an entry in the actions table. More... | |
struct | CallSiteEntry |
Structure describing an entry in the call-site table. More... | |
struct | CallSiteRange |
Structure describing a contiguous range of call-sites which reside in the same procedure fragment. More... | |
struct | PadRange |
Structure holding a try-range and the associated landing pad. More... | |
Public Member Functions | |
EHStreamer (AsmPrinter *A) | |
~EHStreamer () override | |
Public Member Functions inherited from llvm::AsmPrinterHandler | |
virtual | ~AsmPrinterHandler () |
Pin vtable to this file. | |
virtual void | beginModule (Module *M) |
virtual void | endModule ()=0 |
Emit all sections that should come after the content. | |
virtual void | beginFunction (const MachineFunction *MF)=0 |
Gather pre-function debug information. | |
virtual void | markFunctionEnd () |
virtual void | endFunction (const MachineFunction *MF)=0 |
Gather post-function debug information. | |
virtual void | beginBasicBlockSection (const MachineBasicBlock &MBB) |
Process the beginning of a new basic-block-section within a function. | |
virtual void | endBasicBlockSection (const MachineBasicBlock &MBB) |
Process the end of a basic-block-section within a function. | |
virtual void | beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr) |
Emit target-specific EH funclet machinery. | |
virtual void | endFunclet () |
Static Public Member Functions | |
static bool | callToNoUnwindFunction (const MachineInstr *MI) |
Return ‘true’ if this is a call to a function marked ‘nounwind’. | |
Protected Types | |
using | RangeMapType = DenseMap< MCSymbol *, PadRange > |
Protected Member Functions | |
void | computeActionsTable (const SmallVectorImpl< const LandingPadInfo * > &LandingPads, SmallVectorImpl< ActionEntry > &Actions, SmallVectorImpl< unsigned > &FirstActions) |
Compute the actions table and gather the first action index for each landing pad site. | |
void | computePadMap (const SmallVectorImpl< const LandingPadInfo * > &LandingPads, RangeMapType &PadMap) |
virtual void | computeCallSiteTable (SmallVectorImpl< CallSiteEntry > &CallSites, SmallVectorImpl< CallSiteRange > &CallSiteRanges, const SmallVectorImpl< const LandingPadInfo * > &LandingPads, const SmallVectorImpl< unsigned > &FirstActions) |
Compute the call-site table and the call-site ranges. | |
MCSymbol * | emitExceptionTable () |
Emit landing pads and actions. | |
virtual void | emitTypeInfos (unsigned TTypeEncoding, MCSymbol *TTBaseLabel) |
Static Protected Member Functions | |
static unsigned | sharedTypeIDs (const LandingPadInfo *L, const LandingPadInfo *R) |
How many leading type ids two landing pads have in common. | |
static bool | isFilterEHSelector (int Selector) |
static bool | isCleanupEHSelector (int Selector) |
static bool | isCatchEHSelector (int Selector) |
Protected Attributes | |
AsmPrinter * | Asm |
Target of directive emission. | |
MachineModuleInfo * | MMI |
Collected machine module information. | |
Emits exception handling directives.
Definition at line 30 of file EHStreamer.h.
|
protected |
Definition at line 51 of file EHStreamer.h.
EHStreamer::EHStreamer | ( | AsmPrinter * | A | ) |
Definition at line 37 of file EHStreamer.cpp.
|
overridedefault |
|
static |
Return ‘true’ if this is a call to a function marked ‘nounwind’.
Return ‘false’ otherwise.
Definition at line 157 of file EHStreamer.cpp.
References assert(), F, and MI.
Referenced by computeCallSiteTable().
|
protected |
Compute the actions table and gather the first action index for each landing pad site.
Definition at line 52 of file EHStreamer.cpp.
References Asm, assert(), llvm::MachineFunction::getFilterIds(), llvm::getSLEB128Size(), llvm::getULEB128Size(), isFilterEHSelector(), llvm::AsmPrinter::MF, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), sharedTypeIDs(), llvm::SmallVectorBase< Size_T >::size(), and llvm::LandingPadInfo::TypeIds.
Referenced by emitExceptionTable().
|
protectedvirtual |
Compute the call-site table and the call-site ranges.
Compute the call-site table.
The entry for an invoke has a try-range containing the call, a non-zero landing pad and an appropriate action. The entry for an ordinary call has a try-range containing the call and zero for the landing pad and the action. Calls marked 'nounwind' have no entry and must not be contained in the try-range of any entry - they form gaps in the table. Entries must be ordered by try-range address. CallSiteRanges vector is only populated for Itanium exception handling.
The entry for an invoke has a try-range containing the call, a non-zero landing pad, and an appropriate action. The entry for an ordinary call has a try-range containing the call and zero for the landing pad and the action. Calls marked 'nounwind' have no entry and must not be contained in the try-range of any entry - they form gaps in the table. Entries must be ordered by try-range address.
Call-sites are split into one or more call-site ranges associated with different sections of the function.
Reimplemented in llvm::WasmException.
Definition at line 230 of file EHStreamer.cpp.
References llvm::EHStreamer::CallSiteEntry::Action, llvm::AIX, Asm, assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::MachineFunction::back(), llvm::LandingPadInfo::BeginLabels, callToNoUnwindFunction(), computePadMap(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::EHStreamer::CallSiteEntry::EndLabel, llvm::LandingPadInfo::EndLabels, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::MachineFunction::front(), llvm::MachineFunction::getCallSiteBeginLabel(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::AsmPrinter::getFunctionBegin(), llvm::AsmPrinter::getMBBExceptionSym(), llvm::MachineBasicBlock::getSectionID(), llvm::MachineBasicBlock::isBeginSection(), llvm::MachineBasicBlock::isEHPad(), llvm::MachineBasicBlock::isEndSection(), llvm::LandingPadInfo::LandingPadLabel, llvm::EHStreamer::CallSiteEntry::LPad, llvm::AsmPrinter::MAI, MBB, llvm::AsmPrinter::MBBSectionRanges, llvm::AsmPrinter::MF, MI, P, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::resize(), llvm::SmallVectorBase< Size_T >::size(), llvm::SjLj, and llvm::MCAsmInfo::usesCFIForEH().
Referenced by emitExceptionTable().
|
protected |
Definition at line 187 of file EHStreamer.cpp.
References assert(), llvm::LandingPadInfo::BeginLabels, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::MCSymbol::isDefined(), N, P, and llvm::SmallVectorBase< Size_T >::size().
Referenced by computeCallSiteTable().
|
protected |
Emit landing pads and actions.
The general organization of the table is complex, but the basic concepts are easy. First there is a header which describes the location and organization of the three components that follow.
Returns the starting symbol of an exception table.
The general organization of the table is complex, but the basic concepts are easy. First there is a header which describes the location and organization of the three components that follow.
Returns the starting symbol of an exception table.
Definition at line 380 of file EHStreamer.cpp.
References llvm::EHStreamer::CallSiteEntry::Action, Asm, assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::EHStreamer::CallSiteEntry::BeginLabel, llvm::EHStreamer::CallSiteRange::CallSiteBeginIdx, llvm::EHStreamer::CallSiteRange::CallSiteEndIdx, computeActionsTable(), computeCallSiteTable(), llvm::MCSymbolRefExpr::create(), llvm::MCBinaryExpr::createSub(), llvm::MCContext::createTempSymbol(), llvm::AsmPrinter::createTempSymbol(), llvm::AsmPrinter::CurrentFnSym, llvm::dwarf::DW_EH_PE_absptr, llvm::dwarf::DW_EH_PE_omit, llvm::dwarf::DW_EH_PE_pcrel, llvm::dwarf::DW_EH_PE_udata4, llvm::AsmPrinter::emitAlignment(), llvm::AsmPrinter::emitCallSiteOffset(), llvm::AsmPrinter::emitCallSiteValue(), llvm::AsmPrinter::emitEncodingByte(), llvm::AsmPrinter::emitLabelDifferenceAsULEB128(), llvm::AsmPrinter::emitSLEB128(), emitTypeInfos(), llvm::AsmPrinter::emitULEB128(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::EHStreamer::CallSiteEntry::EndLabel, llvm::EHStreamer::CallSiteRange::FragmentBeginLabel, llvm::MachineFunction::front(), llvm::TargetLoweringObjectFile::getCallSiteEncoding(), llvm::MCAsmInfo::getCodePointerSize(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::MachineFunction::getFilterIds(), llvm::MachineFunction::getFunction(), llvm::AsmPrinter::getFunctionNumber(), llvm::MachineFunction::getLandingPads(), llvm::AsmPrinter::getMBBExceptionSym(), llvm::MCSymbol::getName(), llvm::AsmPrinter::getObjFileLowering(), llvm::MCContext::getOrCreateSymbol(), llvm::TargetLoweringObjectFile::getSectionForLSDA(), llvm::AsmPrinter::GetSizeOfEncodedValue(), llvm::getSLEB128Size(), llvm::TargetLoweringObjectFile::getTTypeEncoding(), llvm::MachineFunction::getTypeInfos(), llvm::getULEB128Size(), llvm::MCAsmInfo::hasLEB128Directives(), I, llvm::AsmPrinter::isPositionIndependent(), llvm::LandingPadInfo::LandingPadLabel, llvm::EHStreamer::CallSiteEntry::LPad, llvm::AsmPrinter::MAI, llvm::AsmPrinter::MF, llvm::AsmPrinter::OutContext, llvm::AsmPrinter::OutStreamer, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::report_fatal_error(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorBase< Size_T >::size(), llvm::SjLj, llvm::sort(), llvm::AsmPrinter::TM, and llvm::Wasm.
Referenced by llvm::DwarfCFIException::endFunction(), llvm::ARMException::endFunction(), llvm::WinException::endFunction(), llvm::AIXException::endFunction(), and llvm::WasmException::endFunction().
Definition at line 809 of file EHStreamer.cpp.
References Asm, llvm::AsmPrinter::emitTTypeReference(), llvm::AsmPrinter::emitULEB128(), llvm::MachineFunction::getFilterIds(), llvm::MachineFunction::getTypeInfos(), I, isFilterEHSelector(), llvm::AsmPrinter::MF, llvm::AsmPrinter::OutStreamer, and llvm::reverse().
Referenced by emitExceptionTable().
|
inlinestaticprotected |
Definition at line 147 of file EHStreamer.h.
|
inlinestaticprotected |
Definition at line 146 of file EHStreamer.h.
|
inlinestaticprotected |
Definition at line 145 of file EHStreamer.h.
Referenced by computeActionsTable(), and emitTypeInfos().
|
staticprotected |
How many leading type ids two landing pads have in common.
Definition at line 42 of file EHStreamer.cpp.
Referenced by computeActionsTable().
|
protected |
Target of directive emission.
Definition at line 33 of file EHStreamer.h.
Referenced by llvm::DwarfCFIException::beginBasicBlockSection(), llvm::WinException::beginFunclet(), llvm::DwarfCFIException::beginFunction(), llvm::ARMException::beginFunction(), llvm::WinException::beginFunction(), computeActionsTable(), computeCallSiteTable(), llvm::WasmException::computeCallSiteTable(), emitExceptionTable(), emitTypeInfos(), llvm::DwarfCFIException::endBasicBlockSection(), llvm::WinException::endFunclet(), llvm::ARMException::endFunction(), llvm::WinException::endFunction(), llvm::AIXException::endFunction(), llvm::WasmException::endFunction(), llvm::DwarfCFIException::endModule(), llvm::WasmException::endModule(), llvm::WinException::endModule(), llvm::ARMException::markFunctionEnd(), llvm::WinException::markFunctionEnd(), and llvm::WinException::WinException().
|
protected |
Collected machine module information.
Definition at line 36 of file EHStreamer.h.
Referenced by llvm::DwarfCFIException::beginBasicBlockSection(), llvm::WinException::beginFunclet(), and llvm::WinException::endModule().