LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
llvm::DwarfException Class Reference

#include <DwarfException.h>

Inheritance diagram for llvm::DwarfException:
Inheritance graph
[legend]
Collaboration diagram for llvm::DwarfException:
Collaboration graph
[legend]

Classes

struct  ActionEntry
 ActionEntry - Structure describing an entry in the actions table. More...
 
struct  CallSiteEntry
 CallSiteEntry - Structure describing an entry in the call-site table. More...
 
struct  PadRange
 PadRange - Structure holding a try-range and the associated landing pad. More...
 

Public Member Functions

 DwarfException (AsmPrinter *A)
 
virtual ~DwarfException ()
 
virtual void EndModule ()
 
virtual void BeginFunction (const MachineFunction *MF)
 
virtual void EndFunction ()
 EndFunction - Gather and emit post-function exception information. More...
 

Protected Types

typedef DenseMap< MCSymbol
*, PadRange
RangeMapType
 

Protected Member Functions

unsigned ComputeActionsTable (const SmallVectorImpl< const LandingPadInfo * > &LPs, SmallVectorImpl< ActionEntry > &Actions, SmallVectorImpl< unsigned > &FirstActions)
 
bool CallToNoUnwindFunction (const MachineInstr *MI)
 
void ComputeCallSiteTable (SmallVectorImpl< CallSiteEntry > &CallSites, const RangeMapType &PadMap, const SmallVectorImpl< const LandingPadInfo * > &LPs, const SmallVectorImpl< unsigned > &FirstActions)
 
void EmitExceptionTable ()
 
virtual void EmitTypeInfos (unsigned TTypeEncoding)
 

Static Protected Member Functions

static unsigned SharedTypeIds (const LandingPadInfo *L, const LandingPadInfo *R)
 SharedTypeIds - How many leading type ids two landing pads have in common. More...
 
static bool PadLT (const LandingPadInfo *L, const LandingPadInfo *R)
 PadLT - Order landing pads lexicographically by type id. More...
 

Protected Attributes

AsmPrinterAsm
 Asm - Target of Dwarf emission. More...
 
MachineModuleInfoMMI
 MMI - Collected machine module information. More...
 

Detailed Description

DwarfException - Emits Dwarf exception handling directives.

Definition at line 38 of file DwarfException.h.

Member Typedef Documentation

Definition at line 61 of file DwarfException.h.

Constructor & Destructor Documentation

DwarfException::DwarfException ( AsmPrinter A)

Definition at line 40 of file DwarfException.cpp.

DwarfException::~DwarfException ( )
virtual

Definition at line 43 of file DwarfException.cpp.

Member Function Documentation

void DwarfException::BeginFunction ( const MachineFunction MF)
virtual

BeginFunction - Gather pre-function exception information. Assumes being emitted immediately after the function entry point.

BeginFunction - Gather pre-function exception information. Assumes it's being emitted immediately after the function entry point.

Reimplemented in llvm::Win64Exception, llvm::ARMException, and llvm::DwarfCFIException.

Definition at line 728 of file DwarfException.cpp.

References llvm_unreachable.

Referenced by llvm::AsmPrinter::EmitFunctionHeader().

bool DwarfException::CallToNoUnwindFunction ( const MachineInstr MI)
protected

CallToNoUnwindFunction - Return `true' if this is a call to a function marked `nounwind'. Return `false' otherwise.

Definition at line 186 of file DwarfException.cpp.

References llvm::Function::doesNotThrow(), llvm::dyn_cast(), F(), llvm::MachineOperand::getGlobal(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), I, llvm::MachineInstr::isCall(), and llvm::MachineOperand::isGlobal().

Referenced by ComputeCallSiteTable().

unsigned DwarfException::ComputeActionsTable ( const SmallVectorImpl< const LandingPadInfo * > &  LandingPads,
SmallVectorImpl< ActionEntry > &  Actions,
SmallVectorImpl< unsigned > &  FirstActions 
)
protected
void DwarfException::ComputeCallSiteTable ( SmallVectorImpl< CallSiteEntry > &  CallSites,
const RangeMapType PadMap,
const SmallVectorImpl< const LandingPadInfo * > &  LandingPads,
const SmallVectorImpl< unsigned > &  FirstActions 
)
protected

ComputeCallSiteTable - 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.

ComputeCallSiteTable - 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.

Definition at line 226 of file DwarfException.cpp.

References llvm::DwarfException::CallSiteEntry::Action, Asm, llvm::SmallVectorTemplateCommon< T >::back(), llvm::MachineFunction::begin(), llvm::LandingPadInfo::BeginLabels, CallToNoUnwindFunction(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::MachineFunction::end(), llvm::DwarfException::CallSiteEntry::EndLabel, llvm::LandingPadInfo::EndLabels, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), llvm::MachineModuleInfo::getCallSiteBeginLabel(), I, llvm::MCAsmInfo::isExceptionHandlingDwarf(), llvm::LandingPadInfo::LandingPadLabel, llvm::AsmPrinter::MAI, llvm::AsmPrinter::MF, llvm::A64CC::MI, MMI, P, llvm::DwarfException::PadRange::PadIndex, llvm::DwarfException::CallSiteEntry::PadLabel, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::DwarfException::PadRange::RangeIndex, llvm::SmallVectorImpl< T >::resize(), and llvm::SmallVectorTemplateCommon< T >::size().

Referenced by EmitExceptionTable().

void DwarfException::EmitExceptionTable ( )
protected

EmitExceptionTable - 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.

  1. The landing pad site information describes the range of code covered by the try. In our case it's an accumulation of the ranges covered by the invokes in the try. There is also a reference to the landing pad that handles the exception once processed. Finally an index into the actions table.
  2. The action table, in our case, is composed of pairs of type ids and next action offset. Starting with the action index from the landing pad site, each type Id is checked for a match to the current exception. If it matches then the exception and type id are passed on to the landing pad. Otherwise the next action is looked up. This chain is terminated with a next action of zero. If no type id is found the frame is unwound and handling continues.
  3. Type id table contains references to all the C++ typeinfo for all catches in the function. This tables is reversed indexed base 1.

EmitExceptionTable - 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.

  1. The landing pad site information describes the range of code covered by the try. In our case it's an accumulation of the ranges covered by the invokes in the try. There is also a reference to the landing pad that handles the exception once processed. Finally an index into the actions table.
  2. The action table, in our case, is composed of pairs of type IDs and next action offset. Starting with the action index from the landing pad site, each type ID is checked for a match to the current exception. If it matches then the exception and type id are passed on to the landing pad. Otherwise the next action is looked up. This chain is terminated with a next action of zero. If no type id is found then the frame is unwound and handling continues.
  3. Type ID table contains references to all the C++ typeinfo for all catches in the function. This tables is reverse indexed base 1.

Definition at line 347 of file DwarfException.cpp.

References llvm::DwarfException::CallSiteEntry::Action, llvm::MCStreamer::AddComment(), Asm, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::DwarfException::CallSiteEntry::BeginLabel, llvm::LandingPadInfo::BeginLabels, ComputeActionsTable(), ComputeCallSiteTable(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::count(), llvm::dwarf::DW_EH_PE_omit, llvm::dwarf::DW_EH_PE_udata4, llvm::AsmPrinter::EmitAlignment(), llvm::AsmPrinter::EmitEncodingByte(), llvm::MCStreamer::EmitIntValue(), llvm::MCStreamer::EmitLabel(), llvm::AsmPrinter::EmitLabelDifference(), llvm::AsmPrinter::EmitSLEB128(), EmitTypeInfos(), llvm::AsmPrinter::EmitULEB128(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::DwarfException::CallSiteEntry::EndLabel, llvm::AsmPrinter::getDataLayout(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::MachineModuleInfo::getFilterIds(), llvm::AsmPrinter::getFunctionNumber(), llvm::MachineModuleInfo::getLandingPads(), llvm::MCObjectFileInfo::getLSDASection(), llvm::MCSymbol::getName(), llvm::AsmPrinter::getObjFileLowering(), llvm::MCContext::GetOrCreateSymbol(), llvm::DataLayout::getPointerSize(), llvm::AsmPrinter::GetSizeOfEncodedValue(), llvm::AsmPrinter::GetTempSymbol(), llvm::MCObjectFileInfo::getTTypeEncoding(), llvm::MachineModuleInfo::getTypeInfos(), llvm::MCAsmInfo::getULEB128Size(), I, llvm::MCAsmInfo::isExceptionHandlingDwarf(), llvm::MCStreamer::isVerboseAsm(), llvm::AsmPrinter::MAI, MMI, N, llvm::DwarfException::ActionEntry::NextAction, llvm::AsmPrinter::OutContext, llvm::AsmPrinter::OutStreamer, P, llvm::DwarfException::CallSiteEntry::PadLabel, PadLT(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::ExceptionHandling::SjLj, llvm::MCStreamer::SwitchSection(), and llvm::DwarfException::ActionEntry::ValueForTypeID.

Referenced by llvm::DwarfCFIException::EndFunction(), llvm::ARMException::EndFunction(), and llvm::Win64Exception::EndFunction().

void DwarfException::EmitTypeInfos ( unsigned  TTypeEncoding)
protectedvirtual
void DwarfException::EndFunction ( )
virtual

EndFunction - Gather and emit post-function exception information.

EndFunction - Gather and emit post-function exception information.

Reimplemented in llvm::Win64Exception, llvm::ARMException, and llvm::DwarfCFIException.

Definition at line 734 of file DwarfException.cpp.

References llvm_unreachable.

Referenced by llvm::AsmPrinter::EmitFunctionBody().

void DwarfException::EndModule ( )
virtual

EndModule - Emit all exception information that should come after the content.

Reimplemented in llvm::Win64Exception, llvm::ARMException, and llvm::DwarfCFIException.

Definition at line 722 of file DwarfException.cpp.

References llvm_unreachable.

Referenced by llvm::AsmPrinter::doFinalization().

bool DwarfException::PadLT ( const LandingPadInfo L,
const LandingPadInfo R 
)
staticprotected

PadLT - Order landing pads lexicographically by type id.

Definition at line 61 of file DwarfException.cpp.

References llvm::LandingPadInfo::TypeIds.

Referenced by EmitExceptionTable().

unsigned DwarfException::SharedTypeIds ( const LandingPadInfo L,
const LandingPadInfo R 
)
staticprotected

SharedTypeIds - How many leading type ids two landing pads have in common.

Definition at line 46 of file DwarfException.cpp.

References llvm::LandingPadInfo::TypeIds.

Referenced by ComputeActionsTable().

Member Data Documentation

AsmPrinter* llvm::DwarfException::Asm
protected
MachineModuleInfo* llvm::DwarfException::MMI
protected

The documentation for this class was generated from the following files: