[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls
Lewis Revill via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 04:15:43 PDT 2019
lewis-revill added inline comments.
================
Comment at: lib/Target/RISCV/RISCVFrameLowering.cpp:401
+ default:
+ llvm_unreachable("Something has gone wrong!");
+ case /*s11*/ RISCV::X27: return "__riscv_save_12";
----------------
lewis-revill wrote:
> lenary wrote:
> > Won't we hit this case if (after the hard float ABI lands) someone uses any of fs0-fs11?
> >
> > Would it not be better to return `nullptr`, so the code can bail out, rather than asserting?
> >
> > The same applies in `getRestoreLibCallName`
> I think the assertion is valid behaviour, since something has definitely gone wrong if any register not present in the list of callee-saved registers below is used as a callee-saved register. We would currently hit this if float ABI callee-saved registers are used, which would indicate that more logic needs to be added to explicitly handle that case.
GCC's behaviour is to add manual floating point save/restore code in addition to any libcall that has been inserted for non-fp registers. I realize that this would break a lot of the logic throughout this patch where I assume that either all callee-save registers would be save/restored by libcall or none of them would, so perhaps the approach for now should be to bail out of using libcalls if any of the fp registers require save/restoring.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62686/new/
https://reviews.llvm.org/D62686
More information about the llvm-commits
mailing list