This is an archive of the discontinued LLVM Phabricator instance.

[x86] introduce no_callee_saved_registers attribute
AbandonedPublic

Authored by NatashaKnk on Feb 1 2021, 4:46 PM.

Details

Reviewers
None
Summary

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.

Diff Detail

Event Timeline

NatashaKnk created this revision.Feb 1 2021, 4:46 PM
NatashaKnk requested review of this revision.Feb 1 2021, 4:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2021, 4:46 PM
NatashaKnk abandoned this revision.Feb 1 2021, 4:48 PM

What is the status of this? I think it could be very useful. Did you run into problems implementing it?

This was created by mistake as a result of me messing some commands up while familiarizing myself with the review process. Not sure where the code came from, but it's not mine so please ignore this revision :)