[all-commits] [llvm/llvm-project] 1c235c: [Sparc] Add tail call support

doac via All-commits all-commits at lists.llvm.org
Tue Mar 8 04:52:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1c235c375492180c2eecb6331f169486019fd2d2
      https://github.com/llvm/llvm-project/commit/1c235c375492180c2eecb6331f169486019fd2d2
  Author: Daniel Cederman <cederman at gaisler.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M llvm/lib/Target/Sparc/DelaySlotFiller.cpp
    M llvm/lib/Target/Sparc/SparcCallingConv.td
    M llvm/lib/Target/Sparc/SparcFrameLowering.cpp
    M llvm/lib/Target/Sparc/SparcISelLowering.cpp
    M llvm/lib/Target/Sparc/SparcISelLowering.h
    M llvm/lib/Target/Sparc/SparcInstrInfo.td
    M llvm/test/CodeGen/SPARC/2011-01-11-Call.ll
    M llvm/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
    A llvm/test/CodeGen/SPARC/tailcall.ll

  Log Message:
  -----------
  [Sparc] Add tail call support

This patch adds tail call support to the 32-bit Sparc backend.

Two new instructions are defined, TAIL_CALL and TAIL_CALLri. They are
encoded the same as CALL and BINDri, but are marked with isReturn so
that the epilogue gets emitted. In contrast to CALL, TAIL_CALL is not
marked with isCall. This makes it possible to use the leaf function
optimization when the only call a function makes is a tail call.

TAIL_CALL modifies the return address in %o7, so for leaf functions
the value in %o7 needs to be restored after the call. For normal
functions which uses the restore instruction this is not necessary.

Reviewed By: koakuma

Differential Revision: https://reviews.llvm.org/D51206




More information about the All-commits mailing list