[PATCH] D45919: [mips] Show an error if register number is out of range
Simon Atanasyan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 21 00:55:29 PDT 2018
atanasyan created this revision.
atanasyan added a reviewer: sdardis.
Herald added a subscriber: arichardson.
Current code does not check that a register number is in the 0-31 range. Sometimes the parser checks that later for some kinds of instructions, but that leads to unclear / incorrect error messages like that:
% cat test.s
.text
lb $4, 8($32)
% llvm-mc test.s -triple=mips64-unknown-linux
test.s:2:10: error: expected memory with 16-bit signed offset
lb $4, 8($32)
^
Sometimes the parser just crashes:
% cat test.s
.text
lw $4, 8($32)
% llvm-mc test.s -triple=mips64-unknown-linux
This patch resolves the problem by checking that register number after '$' sign is in the 0-31 range. If the number is out of the range the parser shows the `invalid register number` error, but treats invalid register number as a normal one to continue parsing and catch other possible errors.
Repository:
rL LLVM
https://reviews.llvm.org/D45919
Files:
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
test/MC/Mips/eva/invalid.s
test/MC/Mips/eva/invalid_R6.s
test/MC/Mips/micromips-invalid.s
test/MC/Mips/micromips/invalid.s
test/MC/Mips/micromips32r6/invalid.s
test/MC/Mips/mips-register-names-invalid.s
test/MC/Mips/mips32r5/invalid.s
test/MC/Mips/mips32r6/invalid-mips5-wrong-error.s
test/MC/Mips/mips32r6/invalid.s
test/MC/Mips/mips64r3/invalid.s
test/MC/Mips/mips64r5/invalid.s
test/MC/Mips/mips64r6/invalid.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45919.143432.patch
Type: text/x-patch
Size: 68862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180421/698d5b8d/attachment-0001.bin>
More information about the llvm-commits
mailing list