[clang] [clang][AArch64] Add validation for Global Register Variable. (PR #94271)

KAWASHIMA Takahiro via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 04:46:56 PDT 2024


https://github.com/kawashima-fj approved this pull request.

Thanks for the fix. I left a minor suggestion.

Some notes:

- This commit make Clang emit `error: size of register '???' does not match variable size` error instead of `fatal error: error in backend: Invalid register name "???"`, regardless of the `-ffixed-???` option.
- #76426 says "When `-ffixed-x15` is specified, it can be compiled.". When `-ffixed-x15` is specified, older revisions (including 18.1.x releases) compiles the program in #76426 without an error but the generated code is incorrect (the `foo` function is compiled into `mrs w0, NZCV; ret`!). Recent revisions emits `fatal error: error in backend: Invalid register name "x15".`. So make it a Clang error is appropriate.
- GCC allows this variable-register size mismatch. Clang does not allow.
- We don't need to use `starts_with_insensitive`. Register names are case-sensitive (same as GCC).

https://github.com/llvm/llvm-project/pull/94271


More information about the cfe-commits mailing list