jyknight added a comment.

In D110869#3295477 <https://reviews.llvm.org/D110869#3295477>, @nathanchance 
wrote:

> Rather interesting function to have problems with as a result of this patch 
> but it seems like this function is being used in a very specific way further 
> down the file with the `__PV_IS_CALLEE_SAVE` macro.

AFAICT, `__PV_IS_CALLEE_SAVE` is just bogus. It appears to be used in order to 
promise that a given function preserves all GPR registers (including those 
registers that are normally caller-saved), as an optimized alternative to 
generating a wrapper for the function with `PC_CALLEE_SAVE_REGS_THUNK`, to save 
the extra registers. That would be fine if the functions it was making the 
promise about were written in asm, or the compiler was informed about the 
adjusted calling convention expectation...

However, it's being applied to functions which are implemented in C with no 
special calling-convention attributes on them . That's a promise that simply 
cannot be upheld -- I mean, I guess it //happens// to work currently, but 
that's super-fragile.

Also the whole mechanism (including the asm thunk) should be unnecessary in 
Clang, as it provides an attribute you can put on a function to use a calling 
convention that'll preserve all GPRs except r11. I imagine the call locations 
could easily be adjusted to avoid needing to have r11 preserved, if that's not 
already the case. 
https://clang.llvm.org/docs/AttributeReference.html#preserve-most


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110869

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to