本文整理汇总了C++中machinefunction::const_iterator::isEHFuncletEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::isEHFuncletEntry方法的具体用法?C++ const_iterator::isEHFuncletEntry怎么用?C++ const_iterator::isEHFuncletEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类machinefunction::const_iterator
的用法示例。
在下文中一共展示了const_iterator::isEHFuncletEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitCSpecificHandlerTable
/// Emit the language-specific data that __C_specific_handler expects. This
/// handler lives in the x64 Microsoft C runtime and allows catching or cleaning
/// up after faults with __try, __except, and __finally. The typeinfo values
/// are not really RTTI data, but pointers to filter functions that return an
/// integer (1, 0, or -1) indicating how to handle the exception. For __finally
/// blocks and other cleanups, the landing pad label is zero, and the filter
/// function is actually a cleanup handler with the same prototype. A catch-all
/// entry is modeled with a null filter function field and a non-zero landing
/// pad label.
///
/// Possible filter function return values:
/// EXCEPTION_EXECUTE_HANDLER (1):
/// Jump to the landing pad label after cleanups.
/// EXCEPTION_CONTINUE_SEARCH (0):
/// Continue searching this table or continue unwinding.
/// EXCEPTION_CONTINUE_EXECUTION (-1):
/// Resume execution at the trapping PC.
///
/// Inferred table structure:
/// struct Table {
/// int NumEntries;
/// struct Entry {
/// imagerel32 LabelStart;
/// imagerel32 LabelEnd;
/// imagerel32 FilterOrFinally; // One means catch-all.
/// imagerel32 LabelLPad; // Zero means __finally.
/// } Entries[NumEntries];
/// };
void WinException::emitCSpecificHandlerTable(const MachineFunction *MF) {
auto &OS = *Asm->OutStreamer;
MCContext &Ctx = Asm->OutContext;
WinEHFuncInfo &FuncInfo = MMI->getWinEHFuncInfo(MF->getFunction());
// Use the assembler to compute the number of table entries through label
// difference and division.
MCSymbol *TableBegin =
Ctx.createTempSymbol("lsda_begin", /*AlwaysAddSuffix=*/true);
MCSymbol *TableEnd =
Ctx.createTempSymbol("lsda_end", /*AlwaysAddSuffix=*/true);
const MCExpr *LabelDiff = getOffset(TableEnd, TableBegin);
const MCExpr *EntrySize = MCConstantExpr::create(16, Ctx);
const MCExpr *EntryCount = MCBinaryExpr::createDiv(LabelDiff, EntrySize, Ctx);
OS.EmitValue(EntryCount, 4);
OS.EmitLabel(TableBegin);
// Iterate over all the invoke try ranges. Unlike MSVC, LLVM currently only
// models exceptions from invokes. LLVM also allows arbitrary reordering of
// the code, so our tables end up looking a bit different. Rather than
// trying to match MSVC's tables exactly, we emit a denormalized table. For
// each range of invokes in the same state, we emit table entries for all
// the actions that would be taken in that state. This means our tables are
// slightly bigger, which is OK.
const MCSymbol *LastStartLabel = nullptr;
int LastEHState = -1;
// Break out before we enter into a finally funclet.
// FIXME: We need to emit separate EH tables for cleanups.
MachineFunction::const_iterator End = MF->end();
MachineFunction::const_iterator Stop = std::next(MF->begin());
while (Stop != End && !Stop->isEHFuncletEntry())
++Stop;
for (const auto &StateChange :
InvokeStateChangeIterator::range(FuncInfo, MF->begin(), Stop)) {
// Emit all the actions for the state we just transitioned out of
// if it was not the null state
if (LastEHState != -1)
emitSEHActionsForRange(FuncInfo, LastStartLabel,
StateChange.PreviousEndLabel, LastEHState);
LastStartLabel = StateChange.NewStartLabel;
LastEHState = StateChange.NewState;
}
OS.EmitLabel(TableEnd);
}