LLVM
8.0.1
|
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 | PadRange |
Structure holding a try-range and the associated landing pad. More... | |
Public Member Functions | |
EHStreamer (AsmPrinter *A) | |
~EHStreamer () override | |
void | setSymbolSize (const MCSymbol *Sym, uint64_t Size) override |
For symbols that have a size designated (e.g. More... | |
void | beginInstruction (const MachineInstr *MI) override |
Process beginning of an instruction. More... | |
void | endInstruction () override |
Process end of an instruction. More... | |
Public Member Functions inherited from llvm::AsmPrinterHandler | |
virtual | ~AsmPrinterHandler () |
Pin vtable to this file. More... | |
virtual void | endModule ()=0 |
Emit all sections that should come after the content. More... | |
virtual void | beginFunction (const MachineFunction *MF)=0 |
Gather pre-function debug information. More... | |
virtual void | markFunctionEnd () |
virtual void | endFunction (const MachineFunction *MF)=0 |
Gather post-function debug information. More... | |
virtual void | beginFragment (const MachineBasicBlock *MBB, ExceptionSymbolProvider ESP) |
virtual void | endFragment () |
virtual void | beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr) |
Emit target-specific EH funclet machinery. More... | |
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'. More... | |
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. More... | |
void | computePadMap (const SmallVectorImpl< const LandingPadInfo *> &LandingPads, RangeMapType &PadMap) |
virtual void | computeCallSiteTable (SmallVectorImpl< CallSiteEntry > &CallSites, const SmallVectorImpl< const LandingPadInfo *> &LandingPads, const SmallVectorImpl< unsigned > &FirstActions) |
Compute the call-site table. More... | |
MCSymbol * | emitExceptionTable () |
Emit landing pads and actions. More... | |
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. More... | |
static bool | isFilterEHSelector (int Selector) |
static bool | isCleanupEHSelector (int Selector) |
static bool | isCatchEHSelector (int Selector) |
Protected Attributes | |
AsmPrinter * | Asm |
Target of directive emission. More... | |
MachineModuleInfo * | MMI |
Collected machine module information. More... | |
Emits exception handling directives.
Definition at line 31 of file EHStreamer.h.
|
protected |
Definition at line 52 of file EHStreamer.h.
EHStreamer::EHStreamer | ( | AsmPrinter * | A | ) |
Definition at line 40 of file EHStreamer.cpp.
References ~EHStreamer().
|
overridedefault |
Referenced by EHStreamer().
|
inlineoverridevirtual |
Process beginning of an instruction.
Implements llvm::AsmPrinterHandler.
Definition at line 131 of file EHStreamer.h.
|
static |
Return `true' if this is a call to a function marked `nounwind'.
Return `false' otherwise.
Definition at line 169 of file EHStreamer.cpp.
References assert(), llvm::Function::doesNotThrow(), llvm::dyn_cast(), E, F(), llvm::MachineOperand::getGlobal(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), I, llvm::MachineInstr::isCall(), and llvm::MachineOperand::isGlobal().
Referenced by computeCallSiteTable().
|
protected |
Compute the actions table and gather the first action index for each landing pad site.
Definition at line 61 of file EHStreamer.cpp.
References Asm, assert(), llvm::SmallVectorTemplateCommon< T >::begin(), E, llvm::SmallVectorTemplateCommon< T >::end(), llvm::MachineFunction::getFilterIds(), llvm::getSLEB128Size(), llvm::getULEB128Size(), I, isFilterEHSelector(), llvm::AsmPrinter::MF, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), sharedTypeIDs(), llvm::SmallVectorBase::size(), and llvm::LandingPadInfo::TypeIds.
Referenced by emitExceptionTable().
|
protectedvirtual |
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.
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.
Reimplemented in llvm::WasmException.
Definition at line 225 of file EHStreamer.cpp.
References llvm::EHStreamer::CallSiteEntry::Action, Asm, assert(), llvm::SmallVectorTemplateCommon< T >::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::getCallSiteBeginLabel(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::LandingPadInfo::LandingPadLabel, llvm::EHStreamer::CallSiteEntry::LPad, llvm::AsmPrinter::MAI, llvm::AsmPrinter::MF, MI, P, llvm::EHStreamer::PadRange::PadIndex, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::EHStreamer::PadRange::RangeIndex, llvm::SmallVectorImpl< T >::resize(), llvm::SmallVectorBase::size(), llvm::SjLj, and llvm::MCAsmInfo::usesCFIForEH().
Referenced by computePadMap(), and emitExceptionTable().
|
protected |
Definition at line 201 of file EHStreamer.cpp.
References assert(), llvm::LandingPadInfo::BeginLabels, computeCallSiteTable(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), E, N, P, and llvm::SmallVectorBase::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 350 of file EHStreamer.cpp.
References llvm::EHStreamer::CallSiteEntry::Action, Asm, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::EHStreamer::CallSiteEntry::BeginLabel, computeActionsTable(), computeCallSiteTable(), llvm::AsmPrinter::createTempSymbol(), llvm::dwarf::DW_EH_PE_omit, llvm::dwarf::DW_EH_PE_udata4, llvm::dwarf::DW_EH_PE_uleb128, E, llvm::AsmPrinter::EmitAlignment(), llvm::AsmPrinter::EmitEncodingByte(), llvm::AsmPrinter::EmitLabelDifferenceAsULEB128(), llvm::AsmPrinter::EmitSLEB128(), emitTypeInfos(), llvm::AsmPrinter::EmitULEB128(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::EHStreamer::CallSiteEntry::EndLabel, llvm::AsmPrinter::getCurExceptionSym(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::MachineFunction::getFilterIds(), llvm::AsmPrinter::getFunctionBegin(), llvm::AsmPrinter::getFunctionEnd(), llvm::AsmPrinter::getFunctionNumber(), llvm::MachineFunction::getLandingPads(), llvm::MCObjectFileInfo::getLSDASection(), llvm::MCSymbol::getName(), llvm::AsmPrinter::getObjFileLowering(), llvm::MCContext::getOrCreateSymbol(), llvm::TargetLoweringObjectFile::getTTypeEncoding(), llvm::MachineFunction::getTypeInfos(), I, llvm::LandingPadInfo::LandingPadLabel, llvm::EHStreamer::CallSiteEntry::LPad, llvm::AsmPrinter::MAI, llvm::AsmPrinter::MF, N, llvm::EHStreamer::ActionEntry::NextAction, llvm::AsmPrinter::OutContext, llvm::AsmPrinter::OutStreamer, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::SjLj, llvm::sort(), llvm::LandingPadInfo::TypeIds, llvm::EHStreamer::ActionEntry::ValueForTypeID, and llvm::Wasm.
Referenced by llvm::WasmException::endFunction(), llvm::DwarfCFIException::endFunction(), llvm::ARMException::endFunction(), and llvm::WinException::endFunction().
Definition at line 613 of file EHStreamer.cpp.
References Asm, E, llvm::AsmPrinter::EmitTTypeReference(), llvm::AsmPrinter::EmitULEB128(), llvm::MachineFunction::getFilterIds(), llvm::MachineFunction::getTypeInfos(), I, isFilterEHSelector(), llvm::make_range(), llvm::AsmPrinter::MF, and llvm::AsmPrinter::OutStreamer.
Referenced by emitExceptionTable().
|
inlineoverridevirtual |
Process end of an instruction.
Implements llvm::AsmPrinterHandler.
Definition at line 132 of file EHStreamer.h.
References MI.
|
inlinestaticprotected |
Definition at line 123 of file EHStreamer.h.
|
inlinestaticprotected |
Definition at line 122 of file EHStreamer.h.
|
inlinestaticprotected |
Definition at line 121 of file EHStreamer.h.
Referenced by computeActionsTable(), and emitTypeInfos().
For symbols that have a size designated (e.g.
common symbols), this tracks that size.
Implements llvm::AsmPrinterHandler.
Definition at line 130 of file EHStreamer.h.
|
staticprotected |
How many leading type ids two landing pads have in common.
Definition at line 45 of file EHStreamer.cpp.
References llvm::LandingPadInfo::TypeIds.
Referenced by computeActionsTable().
|
protected |
Target of directive emission.
Definition at line 34 of file EHStreamer.h.
Referenced by llvm::DwarfCFIException::beginFragment(), llvm::WinException::beginFunclet(), llvm::DwarfCFIException::beginFunction(), llvm::ARMException::beginFunction(), llvm::WinException::beginFunction(), computeActionsTable(), llvm::WasmException::computeCallSiteTable(), computeCallSiteTable(), emitExceptionTable(), emitTypeInfos(), llvm::DwarfCFIExceptionBase::endFragment(), llvm::WinException::endFunclet(), llvm::WasmException::endFunction(), llvm::ARMException::endFunction(), llvm::WinException::endFunction(), llvm::WasmException::endModule(), llvm::DwarfCFIException::endModule(), llvm::WinException::endModule(), getTryAncestor(), llvm::WasmException::markFunctionEnd(), llvm::DwarfCFIExceptionBase::markFunctionEnd(), llvm::WinException::WinException(), and llvm::ARMException::~ARMException().
|
protected |
Collected machine module information.
Definition at line 37 of file EHStreamer.h.
Referenced by llvm::DwarfCFIException::beginFragment(), llvm::WinException::beginFunclet(), llvm::DwarfCFIException::endModule(), and llvm::WinException::endModule().