[all-commits] [llvm/llvm-project] 5da801: [AArch64AsmParser] Allow branch target symbol to h...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Feb 11 20:21:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5da801386c2b820a4596fc6d8da6b5f4a6da94b4
      https://github.com/llvm/llvm-project/commit/5da801386c2b820a4596fc6d8da6b5f4a6da94b4
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-02-11 (Sun, 11 Feb 2024)

  Changed paths:
    M llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
    M llvm/test/MC/AArch64/arm64-adr.s
    M llvm/test/MC/AArch64/arm64-branch-encoding.s
    M llvm/test/MC/AArch64/basic-a64-diagnostics.s

  Log Message:
  -----------
  [AArch64AsmParser] Allow branch target symbol to have a shift/extend modifier name (#80571)

Shift and extend modifiers are parsed as separate operands. When a
symbol operand of a branch instruction has such a "bad" name,
AArch64AsmParser will report an error.

```
% cat a.c
void lsl(); void lsr(); void asr(); void ror(); void uxtb(); void sxtx();
void foo() { lsl(); asr(); asr(); ror(); uxtb(); sxtx(); }
% clang --target=aarch64 -c -save-temps a.c
a.s:15:8: error: expected #imm after shift specifier
        bl      lsl
                   ^
a.s:16:8: error: expected #imm after shift specifier
        bl      asr
                   ^
a.s:17:8: error: expected #imm after shift specifier
        bl      asr
                   ^
a.s:18:8: error: expected #imm after shift specifier
        bl      ror
                   ^
a.s:19:5: error: expected label or encodable integer pc offset
        bl      uxtb
                ^
a.s:20:5: error: expected label or encodable integer pc offset
        bl      sxtx
                ^
```

In contrast, gas correctly parses these instructions.

Fix #79729 by parsing shift/extend modifier after an immediate
value/register




More information about the All-commits mailing list