[PATCH] D86529: [5/5] [AArch64] Generate and parse SEH assembly directives

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 04:43:30 PDT 2020


mstorsjo created this revision.
mstorsjo added reviewers: efriedma, ssijaric, TomTan.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
Herald added a project: LLVM.
mstorsjo requested review of this revision.

This ensures that you get the same output regardless if generating code directly to an object file or if generating assembly and assembling that.

Add implementations of the EmitARM64WinCFI*() methods in AArch64TargetAsmStreamer, and fill in one blank in MCAsmStreamer.

Add corresponding directive handlers in AArch64AsmParser and COFFAsmParser.

The SEH directives have been picked to match the prior art for SEH assembly directives for x86_64, e.g. the spelling of ".seh_startepilogue" matching the preexisting ".seh_endepilogue", and ".seh_savereg x24, 16" matching the preexisting
".seh_savereg %rsi, 16".

There's some attempt at both consistency with this, but also readability, in choosing where to separate words with underscores, and where to write them all together, e.g. ".seh_savereg" vs ".seh_save_fplr", and ".seh_savefregp_x". I'm very open to suggestions that would be (more) consistent and readable.

Directives in the epilogues have the same names as in prologues, e.g. .seh_savereg, even though the registers are restored, not saved, at that point.

I didn't add any specific test for the generated assembly, other than updates to existing tests where the directives end up 
visible between existing CHECK-NEXT entries, but maybe more comprehensive tests of that aspect are needed as well. Are there suggestions for what to base such a test on?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86529

Files:
  llvm/lib/MC/MCAsmStreamer.cpp
  llvm/lib/MC/MCParser/COFFAsmParser.cpp
  llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
  llvm/test/CodeGen/AArch64/arm64-windows-calls.ll
  llvm/test/CodeGen/AArch64/lrint-conv-fp16-win.ll
  llvm/test/CodeGen/AArch64/lrint-conv-win.ll
  llvm/test/CodeGen/AArch64/lround-conv-fp16-win.ll
  llvm/test/CodeGen/AArch64/lround-conv-win.ll
  llvm/test/CodeGen/AArch64/powi-windows.ll
  llvm/test/CodeGen/AArch64/seh_funclet_x1.ll
  llvm/test/CodeGen/AArch64/win64-jumptable.ll
  llvm/test/CodeGen/AArch64/win_cst_pool.ll
  llvm/test/CodeGen/AArch64/windows-extern-weak.ll
  llvm/test/CodeGen/AArch64/wineh-try-catch-cbz.ll
  llvm/test/CodeGen/AArch64/wineh-try-catch-nobase.ll
  llvm/test/CodeGen/AArch64/wineh-try-catch-realign.ll
  llvm/test/CodeGen/AArch64/wineh-try-catch-vla.ll
  llvm/test/MC/AArch64/seh.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86529.287632.patch
Type: text/x-patch
Size: 30449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200825/13ef4db4/attachment.bin>


More information about the llvm-commits mailing list