[PATCH] D137532: [LoongArch] Implement the TargetLowering::getRegisterByName hook

Gong LingQin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 01:58:20 PST 2022


gonglingqin added a comment.

In D137532#3924134 <https://reviews.llvm.org/D137532#3924134>, @xen0n wrote:

> In D137532#3924037 <https://reviews.llvm.org/D137532#3924037>, @gonglingqin wrote:
>
>> In D137532#3923952 <https://reviews.llvm.org/D137532#3923952>, @xen0n wrote:
>>
>>> I'm curious what usage case motivated the change? Not to say it's unnecessary but it's better to have people know a bit more background behind this work.
>>
>> This interface is required by the code in https://github.com/loongson/linux/blob/master/arch/loongarch/include/asm/percpu.h#L12-L18. This patch can avoid crashes when compiling the kernel with llvm in the future.
>
> Very nice to know.
>
> BTW, are the normal GPRs already supported like this too (things like global `register long foo __asm__("$a0")`), even without this change, or are such usages invalid in the first place? Memory is failing me.

As @xry111 said, any local register variables with assigned GPR can be read (the analysis process is completed by clang), but only reserved registers can be read when reading global registers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137532



More information about the llvm-commits mailing list