[PATCH] D141020: [X86][ABI] Clobber %RAX for preserve_allcc and preserve_mostcc CCs

Anton Bikineev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 12:25:29 PST 2023


AntonBikineev added a comment.

Thanks everybody for the feedback! Sorry for the delayed response - I was occupied with the regular work.

> However, it's consistent to say that a register is preserved if and only if it is not used to return a value.

I thought about it first, but just found cloberring %rax as a quick fix. But I 100% agree - having a flexible CC would be the best solution:

- would allow callers to use more registers when callees are void,
- would stay backward compatible, assuming the clients are not using the CCs with the return value (as otherwise their code would be broken).

> MostRegs doesn't, but AllRegs does?

Yeah, all return registers must be addressed..

> Oen possible solution would be to make a Chromium specific calling convention and also name it as such.

I thought about this as well, but `preserve_most` is conceptually already what we need. It would be better to save a chromium-specific CC for a future use case :)

There is already logic that nicely allows to disable CSRs dynamically, which was introduced for the Intel's regcall CC (here https://reviews.llvm.org/D28566). So I'll just piggyback on it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141020



More information about the llvm-commits mailing list