[PATCH] D136436: [Clang][LoongArch] Add register alias handling without `$` prefix

Youling Tang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 02:49:39 PDT 2022


tangyouling created this revision.
tangyouling added reviewers: SixWeining, xen0n, xry111, MaskRay, wangleiat.
Herald added subscribers: jeroen.dobbelaere, StephenFan.
Herald added a project: All.
tangyouling requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add `a0`, `r4` without the prefix `$` is handled in inline assembly,
while keeping in line with gcc.
GCC recognizes four methods (`a0`, `$a0`, `r4`, `$r4`), but only for
`GPR`. for `FPR`, gcc only supports `f0` and `$f0` writing styles,
but not `fa0` and `$fa0`.

Also solve the following build problem:
In file included from /home/loongson/llvm-work/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:196:
llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc:27:23: error: unknown register name 'a7' in asm

  register u64 a7 asm("a7") = nr;
                      ^

llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc:28:23: error: unknown register name 'a0' in asm

  register u64 a0 asm("a0");                      ^


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136436

Files:
  clang/lib/Basic/Targets/LoongArch.cpp
  clang/test/CodeGen/LoongArch/inline-asm-gcc-regs-error.c
  clang/test/CodeGen/LoongArch/inline-asm-gcc-regs.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136436.469522.patch
Type: text/x-patch
Size: 8787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221021/97d995f2/attachment-0001.bin>


More information about the cfe-commits mailing list