[PATCH] D98789: [PEI] add dwarf information for stack probe

YangKeao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 18 22:49:05 PDT 2021


YangKeao added a comment.

> Normally, I'd expect some register is naturally free in the prologue, but you could get into weird situations.  On 32-bit specifically, consider compiling with -mregparm=3; I think there are no registers which are unconditionally safe in that case.  One possibility is to always use EAX, and just save/restore it if necessary.  See isEAXAlive in X86FrameLowering::emitPrologue.
>
> Alternatively, you could ensure that some callee-save GPR is spilled, and explicitly use that register.  This is taking advantage of the fact this is part of the prologue: there can't be any other uses of callee-save registers at that point. (In theory, it might be possibly for an exotic calling convention to have no callee-save registers, but I don't think there are any in practice.)

Both solutions seems to be either complicate or with extra cost. And surprisingly found that the original implementation of stack probe is wrong on 32bit. Given that, I preferred to only provide DWARF information in 64bit situation (and left a comment), so that `r11` can be used and solve this problem easily.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98789/new/

https://reviews.llvm.org/D98789



More information about the llvm-commits mailing list