[PATCH] D151107: [IR] Add GraalVM calling conventions

Sacha Coppey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 07:59:56 PDT 2023


Zeavee created this revision.
Zeavee added projects: All, LLVM.
Herald added subscribers: luke, frasercrmck, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, kristof.beyls, arichardson.
Zeavee requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay.

Adds GraalVM calling conventions. The only difference with the default calling conventions is that GraalVM reserves two registers for the heap base and the thread. Since the registers are then accessed by name, getRegisterByName has to be updated accordingly.

This patch implements the calling conventions only for X86, AArch64 and RISC-V.

For X86, the reserved registers are X14 and X15. For AArch64, they are X27 and X28. For RISC-V, they are X23 and X27.

This patch has been used by the LLVM backend of GraalVM's Native Image project in production for around 4 months with no major issues.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151107

Files:
  llvm/include/llvm/IR/CallingConv.h
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151107.524306.patch
Type: text/x-patch
Size: 4874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230522/8c6163a2/attachment.bin>


More information about the llvm-commits mailing list