[PATCH] D48411: [RISCV] Add support for _interrupt attribute
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 24 07:47:58 PDT 2018
asb added inline comments.
================
Comment at: lib/Target/RISCV/RISCVFrameLowering.cpp:217
+ // If interrupt is enabled and there are calls in the handler,
+ // unconditionally save all Caller-saved registers and
+ // all FP registers, regardless whether they are used.
----------------
apazos wrote:
> asb wrote:
> > callee-saved
> This code is forcing the saving of all arguments and temporaries plus all the floating point registers, even if they are not used.
> Arguments and temporaries are ra, t0-2, a0-a7, t3-t6 (which are all Caller-saved registers).
> So the comment is correct (includes Caller and floating point registers only).
>
> Here is the logic I am enforcing:
>
> - If interrupt is enabled:
> ---- If no calls
> Save all registers if they are used. That includes callee saved, caller saved, and FP registers.
> When you call getCalleeSavedRegs and getCallPreservedMask, it returns the data for the lists
> CSR_XLEN_F32 and CSR_XLEN_F64.
> In my last patch I missed getCallPreservedMask. I will update that function.
> ----If has calls
> Force saving all arguments and temporaries (these are the Caller saved registers), even if not used.
> Force saving all FP registers, even if not used.
> RISCVFrameLowering::determineCalleeSaves is the place to force saving these registers.
>
> I checked GCC and it seems to implement this behavior from what I could test.
>
> Let me know if you agree.
>
>
I agree that's the desired logic and your original comment is correct.
https://reviews.llvm.org/D48411
More information about the llvm-commits
mailing list