[PATCH] D95836: [x86] introduce no_callee_saved_registers attribute

Natasha Kononenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 16:46:12 PST 2021


NatashaKnk created this revision.
Herald added subscribers: pengfei, hiraditya.
NatashaKnk requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is directly analogous to the existing no_caller_saved_registers, but with the opposite intention.  A function or call so marked shifts the responsibility of spilling the usual CSRs to it's caller.

An indirect call site and callee which don't agree on the attribute is ill defined.

The motivation for this change is that being able to prune callee saves (without modifying other details of the calling convention) is sometimes useful when generating stubs and adapters.  There's no intention to expose this as a source language feature; this is expected to be used by frontends to implement adapters where warranted.

Some specific examples of use cases:

- GC compatible compiled code wants to call an externally defined library function without needing to track pointer values through CSRs.
- debug enabled code wants to call precompiled library which doesn't provide enough information to track CSRs while preserving debug quality in caller.
- adapter stub entering hand written assembler which doesn't follow normal calling conventions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95836

Files:
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/test/CodeGen/X86/x86-no_callee_saved_registers.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95836.320634.patch
Type: text/x-patch
Size: 11228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210202/4ea6adcb/attachment.bin>


More information about the llvm-commits mailing list