[PATCH] [ARM64] Fix the misleading diagnostic on bad extend amount of reg+reg addressing mode.

Kevin Qin kevinqindev at gmail.com
Sun May 11 23:34:42 PDT 2014


Hi Tim,

I agree with your point, that the AsmParser in ARM64 is already too
complexity. But for this bug, it can't avoid adding more codes in AsmParser
unless factoring whole address operand of load/store instructions. The
reason why I give up providing a suitably vague warning is that, there's
too many instructions sharing two diagnostics!

feeding diag.s in patch to llvm-mc built by trunk today, you will see

>llvm-mc -triple=arm64 -mattr=+neon -assemble -show-encoding <diag.s

.text
<stdin>:1:13: error: index must be a multiple of 4 in range [0, 16380].
ldrb w1   , [x3, w3, sxtw #4]
            ^
<stdin>:2:13: error: index must be a multiple of 4 in range [0, 16380].
ldrh w1   , [x3, w3, sxtw #4]
            ^
<stdin>:3:13: error: index must be a multiple of 4 in range [0, 16380].
ldr  w1   , [x3, w3, sxtw #4]
            ^
<stdin>:4:13: error: index must be a multiple of 8 in range [0, 32760].
ldr  x1   , [x3, w3, sxtw #4]
            ^
<stdin>:5:13: error: index must be a multiple of 8 in range [0, 32760].
ldr  b1   , [x3, w3, sxtw #4]
            ^
<stdin>:6:13: error: index must be a multiple of 8 in range [0, 32760].
ldr  h1   , [x3, w3, sxtw #4]
            ^
<stdin>:7:13: error: index must be a multiple of 8 in range [0, 32760].
ldr  s1   , [x3, w3, sxtw #4]
            ^
<stdin>:8:13: error: index must be a multiple of 8 in range [0, 32760].
ldr  d1   , [x3, w3, sxtw #4]
            ^
<stdin>:9:13: error: index must be a multiple of 8 in range [0, 32760].
ldr  q1   , [x3, w3, sxtw #1]
            ^

Each diagnostic will hold too many information and get end-users more
confused. Also, previous misleading diagnostic is for addressing mode [reg,
offset], the suggested offset ranges are incorrect
for 8/16/128 bit loading.
For example, when parsing "ldrb w1, [x3, #4096]", current diagnostic is "error:
index must be a multiple of 4 in range [0, 16380]."  But correct index
should be any integer in [0, 4095].
This patch can fix this problem as well.


2014-05-08 19:29 GMT+08:00 Tim Northover <t.p.northover at gmail.com>:

> Hi Kevin,
>
> I don't think that degree of hackery is justified for a slightly better
> diagnostic. ARM64 already suffers from too much C++ code in the AsmParser,
> We want to work towards decreasing that rather than making it worse.
>
> Cheers.
>
> Tim.
>
> http://reviews.llvm.org/D3662
>
>
>

http://reviews.llvm.org/D3662






More information about the llvm-commits mailing list