HomePhabricator

[RISCV] Add support for save/restore of callee-saved registers via libcalls

Authored by lewis-revill on Feb 11 2020, 1:23 PM.

Description

[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