[all-commits] [llvm/llvm-project] a6065f: Arm64EC entry/exit thunks, consolidated. (#79067)

Eli Friedman via All-commits all-commits at lists.llvm.org
Mon Jan 22 21:28:18 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a6065f0fa55aaf694b5f85ecad7badec5cc02425
      https://github.com/llvm/llvm-project/commit/a6065f0fa55aaf694b5f85ecad7badec5cc02425
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2024-01-22 (Mon, 22 Jan 2024)

  Changed paths:
    M clang/lib/CodeGen/CGCXX.cpp
    M llvm/include/llvm/IR/CallingConv.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/Target/AArch64/AArch64.h
    A llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp
    M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
    M llvm/lib/Target/AArch64/AArch64CallingConvention.h
    M llvm/lib/Target/AArch64/AArch64CallingConvention.td
    M llvm/lib/Target/AArch64/AArch64FastISel.cpp
    M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.h
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    M llvm/lib/Target/AArch64/AArch64InstrInfo.td
    M llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
    M llvm/lib/Target/AArch64/AArch64MCInstLower.h
    M llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
    M llvm/lib/Target/AArch64/AArch64Subtarget.cpp
    M llvm/lib/Target/AArch64/AArch64Subtarget.h
    M llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
    M llvm/lib/Target/AArch64/CMakeLists.txt
    M llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
    M llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
    M llvm/test/CodeGen/AArch64/arm64ec-dllimport.ll
    A llvm/test/CodeGen/AArch64/arm64ec-entry-thunks-local-linkage.ll
    A llvm/test/CodeGen/AArch64/arm64ec-entry-thunks.ll
    A llvm/test/CodeGen/AArch64/arm64ec-exit-thunks.ll
    M llvm/test/CodeGen/AArch64/arm64ec-reservedregs.ll
    M llvm/test/CodeGen/AArch64/arm64ec-varargs.ll
    M llvm/test/CodeGen/AArch64/stack-protector-target.ll
    M llvm/test/CodeGen/AArch64/win-alloca.ll

  Log Message:
  -----------
  Arm64EC entry/exit thunks, consolidated. (#79067)

This combines the previously posted patches with some additional work
I've done to more closely match MSVC output.

Most of the important logic here is implemented in
AArch64Arm64ECCallLowering. The purpose of the
AArch64Arm64ECCallLowering is to take "normal" IR we'd generate for
other targets, and generate most of the Arm64EC-specific bits:
generating thunks, mangling symbols, generating aliases, and generating
the .hybmp$x table. This is all done late for a few reasons: to
consolidate the logic as much as possible, and to ensure the IR exposed
to optimization passes doesn't contain complex arm64ec-specific
constructs.

The other changes are supporting changes, to handle the new constructs
generated by that pass.

There's a global llvm.arm64ec.symbolmap representing the .hybmp$x
entries for the thunks. This gets handled directly by the AsmPrinter
because it needs symbol indexes that aren't available before that.

There are two new calling conventions used to represent calls to and
from thunks: ARM64EC_Thunk_X64 and ARM64EC_Thunk_Native. There are a few
changes to handle the associated exception-handling info,
SEH_SaveAnyRegQP and SEH_SaveAnyRegQPX.

I've intentionally left out handling for structs with small
non-power-of-two sizes, because that's easily separated out. The rest of
my current work is here. I squashed my current patches because they were
split in ways that didn't really make sense. Maybe I could split out
some bits, but it's hard to meaningfully test most of the parts
independently.

Thanks to @dpaoliello for extensive testing and suggestions.

(Originally posted as https://reviews.llvm.org/D157547 .)




More information about the All-commits mailing list