llvm-project/llvm/lib/CodeGen/AsmPrinter
Martin Storsjö 6b75a3523f [ARM] [MC] Add support for writing ARM WinEH unwind info
This includes .seh_* directives for generating it from assembly.
It is designed fairly similarly to the ARM64 handling.

For .seh_handler directives, such as
".seh_handler __C_specific_handler, @except" (which is supported
on x86_64 and aarch64 so far), the "@except" bit doesn't work in
ARM assembly, as '@' is used as a comment character (on all current
platforms).

Allow using '%' instead of '@' for this purpose. This convention
is used by GAS in similar contexts already,
e.g. [1]:

    Note on targets where the @ character is the start of a comment
    (eg ARM) then another character is used instead. For example the
    ARM port uses the % character.

In practice, this unfortunately means that all such .seh_handler
directives will need ifdefs for ARM.

Contrary to ARM64, on ARM, it's quite common that we can't evaluate
e.g. the function length at this point, due to instructions whose
length is finalized later. (Also, inline jump tables end with
a ".p2align 1".)

If unable to to evaluate the function length immediately, emit
it as an MCExpr instead. If we'd implement splitting the unwind
info for a function (which isn't implemented for ARM64 yet either),
we wouldn't know whether we need to split it though.

Avoid calling getFrameIndexOffset() on an unset
FuncInfo.UnwindHelpFrameIdx, to avoid triggering asserts in the
preexisting testcase CodeGen/ARM/Windows/wineh-basic.ll. (Once
MSVC exception handling is fully implemented, those changes
can be reverted.)

[1] https://sourceware.org/binutils/docs/as/Section.html#Section

Differential Revision: https://reviews.llvm.org/D125645
2022-06-01 11:25:48 +03:00
..
AIXException.cpp [XCOFF][AIX] Use unique section names for LSDA and EH info sections with -ffunction-sections 2022-05-05 09:01:36 -04:00
ARMException.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
AccelTable.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
AddressPool.cpp DebugInfo: Don't allow type units to references types in the CU 2022-03-25 23:49:03 +00:00
AddressPool.h
AsmPrinter.cpp [MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC 2022-05-26 00:14:08 -07:00
AsmPrinterDwarf.cpp [MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC 2022-05-26 00:14:08 -07:00
AsmPrinterInlineAsm.cpp [CodeGen] Apply clang-tidy fixes for readability-redundant-smartptr-get (NFC) 2022-03-20 23:11:06 -07:00
ByteStreamer.h [DwarfDebug] Restore code that make comments stay aligned in DwarfDebug::emitDebugLocEntry 2022-01-18 09:46:03 +01:00
CMakeLists.txt
CodeViewDebug.cpp [MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC 2022-05-26 00:14:08 -07:00
CodeViewDebug.h [CodeView] Combine variable def ranges that are continuous. 2022-05-20 12:12:14 -07:00
DIE.cpp [DebugInfo] Include DW_TAG_skeleton_unit when looking for parent UnitDie 2022-03-12 13:27:42 -08:00
DIEHash.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DIEHash.h DebugInfo: Don't hash DIE offsets before they're computed 2021-12-25 16:09:12 -08:00
DIEHashAttributes.def
DbgEntityHistoryCalculator.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DebugHandlerBase.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DebugLocEntry.h [AsmPrinter] DebugLocEntry::dump() - Use const-ref iterator in for-range loop. NFCI. 2021-09-17 12:11:54 +01:00
DebugLocStream.cpp
DebugLocStream.h
DwarfCFIException.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DwarfCompileUnit.cpp Reland "[dwarf] Emit a DIGlobalVariable for constant strings." 2022-05-18 13:56:45 -07:00
DwarfCompileUnit.h Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DwarfDebug.cpp Revert "Round up zero-sized symbols to 1 byte in `.debug_aranges`." 2022-05-31 11:03:44 +02:00
DwarfDebug.h DebugInfo: Don't allow type units to references types in the CU 2022-03-25 23:49:03 +00:00
DwarfException.h [CodeGen] Use default member initialization (NFC) 2022-01-30 12:32:51 -08:00
DwarfExpression.cpp [DWARF][FIX] Handle the use of multiple registers gracefully 2022-04-15 13:43:50 -05:00
DwarfExpression.h [DwarfDebug] Refuse to emit DW_OP_LLVM_arg values wider than 64 bits 2021-12-10 09:33:27 -08:00
DwarfFile.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DwarfFile.h Revert "[DwarfDebug] Support emitting function-local declaration for a lexical block" & dependent patches 2021-12-24 00:47:04 +02:00
DwarfStringPool.cpp
DwarfStringPool.h
DwarfUnit.cpp [DebugInfo] Add a TargetFuncName field in DISubprogram for 2022-04-15 16:38:23 -04:00
DwarfUnit.h [CodeGen] Use default member initialization (NFC) 2022-01-30 12:32:51 -08:00
EHStreamer.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
EHStreamer.h
ErlangGCPrinter.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
OcamlGCPrinter.cpp [llvm] Use range-based for loops (NFC) 2021-12-05 08:33:02 -08:00
PseudoProbePrinter.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
PseudoProbePrinter.h [llvm] Remove unused forward declarations (NFC) 2022-01-07 20:00:34 -08:00
WasmException.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
WasmException.h Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
WinCFGuard.cpp [MC] Lower case the first letter of EmitCOFF* EmitWin* EmitCV*. NFC 2022-05-26 00:14:08 -07:00
WinCFGuard.h
WinException.cpp [ARM] [MC] Add support for writing ARM WinEH unwind info 2022-06-01 11:25:48 +03:00
WinException.h Fix SEH table addresses for Windows 2021-08-20 22:32:12 +03:00