[all-commits] [llvm/llvm-project] 46e764: [x86] introduce no_callee_saved_registers attribute

Philip Reames via All-commits all-commits at lists.llvm.org
Mon Feb 1 16:19:34 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 46e764a628da81795af3f64bd28970b7bd4115d6
      https://github.com/llvm/llvm-project/commit/46e764a628da81795af3f64bd28970b7bd4115d6
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-02-01 (Mon, 01 Feb 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86FastISel.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86RegisterInfo.cpp
    A llvm/test/CodeGen/X86/x86-no_callee_saved_registers.ll

  Log Message:
  -----------
  [x86] introduce no_callee_saved_registers attribute

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.




More information about the All-commits mailing list