[RISCV] Add support for save/restore of callee-saved registers via libcalls
authorlewis-revill <lewis.revill@embecosm.com>
Tue, 11 Feb 2020 21:23:03 +0000 (21:23 +0000)
committerlewis-revill <lewis.revill@embecosm.com>
Tue, 11 Feb 2020 21:23:03 +0000 (21:23 +0000)
commit07f7c00208b393296f8f27d6cd3cec2b11d86fd8
tree827b0e81a6d311f445bd85df8acf83f41cb44015
parent52aec3221fa5766c669cfd16e6ba0cf0737d1fff
[RISCV] Add support for save/restore of callee-saved registers via libcalls

This patch adds the support required for using the __riscv_save and
__riscv_restore libcalls to implement a size-optimization for prologue
and epilogue code, whereby the spill and restore code of callee-saved
registers is implemented by common functions to reduce code duplication.

Logic is also included to ensure that if both this optimization and
shrink wrapping are enabled then the prologue and epilogue code can be
safely inserted into the basic blocks chosen by shrink wrapping.

Differential Revision: https://reviews.llvm.org/D62686
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/test/Driver/riscv-features.c
llvm/lib/Target/RISCV/RISCV.td
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
llvm/lib/Target/RISCV/RISCVFrameLowering.h
llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h
llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
llvm/lib/Target/RISCV/RISCVRegisterInfo.h
llvm/lib/Target/RISCV/RISCVSubtarget.h
llvm/test/CodeGen/RISCV/saverestore.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/shrinkwrap.ll