[llvm] r365881 - [RISCV] Allow parsing dot '.' in assembly
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 01:36:07 PDT 2019
Author: lenary
Date: Fri Jul 12 01:36:07 2019
New Revision: 365881
URL: http://llvm.org/viewvc/llvm-project?rev=365881&view=rev
Log:
[RISCV] Allow parsing dot '.' in assembly
Summary:
Useful for jumps, such as `j .`.
I am not sure who should review this. Do not hesitate to change the reviewers if needed.
Reviewers: asb, jrtc27, lenary
Reviewed By: lenary
Subscribers: MaskRay, lenary, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63669
Patch by John LLVM (JohnLLVM)
Modified:
llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/trunk/test/MC/RISCV/rv32i-aliases-invalid.s
llvm/trunk/test/MC/RISCV/rv32i-valid.s
llvm/trunk/test/MC/RISCV/rvi-aliases-valid.s
Modified: llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp?rev=365881&r1=365880&r2=365881&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp Fri Jul 12 01:36:07 2019
@@ -1119,6 +1119,7 @@ OperandMatchResultTy RISCVAsmParser::par
default:
return MatchOperand_NoMatch;
case AsmToken::LParen:
+ case AsmToken::Dot:
case AsmToken::Minus:
case AsmToken::Plus:
case AsmToken::Exclaim:
Modified: llvm/trunk/test/MC/RISCV/rv32i-aliases-invalid.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/RISCV/rv32i-aliases-invalid.s?rev=365881&r1=365880&r2=365881&view=diff
==============================================================================
--- llvm/trunk/test/MC/RISCV/rv32i-aliases-invalid.s (original)
+++ llvm/trunk/test/MC/RISCV/rv32i-aliases-invalid.s Fri Jul 12 01:36:07 2019
@@ -19,5 +19,7 @@ sll x2, x3, -1 # CHECK: :[[@LINE]]:13:
srl x2, x3, -2 # CHECK: :[[@LINE]]:13: error: immediate must be an integer in the range [0, 31]
sra x2, x3, -3 # CHECK: :[[@LINE]]:13: error: immediate must be an integer in the range [0, 31]
+addi x1, . # CHECK: :[[@LINE]]:10: error: invalid operand for instruction
+
foo:
.space 4
Modified: llvm/trunk/test/MC/RISCV/rv32i-valid.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/RISCV/rv32i-valid.s?rev=365881&r1=365880&r2=365881&view=diff
==============================================================================
--- llvm/trunk/test/MC/RISCV/rv32i-valid.s (original)
+++ llvm/trunk/test/MC/RISCV/rv32i-valid.s Fri Jul 12 01:36:07 2019
@@ -90,6 +90,9 @@ jal s0, (0)
# CHECK-ASM-AND-OBJ: jal s0, 156
# CHECK-ASM: encoding: [0x6f,0x04,0xc0,0x09]
jal s0, (0xff-99)
+# CHECK-ASM: encoding: [0x6f,0bAAAA0000,A,A]
+# CHECK-OBJ: jal zero, 0
+jal zero, .
# CHECK-ASM-AND-OBJ: jalr a0, a1, -2048
# CHECK-ASM: encoding: [0x67,0x85,0x05,0x80]
Modified: llvm/trunk/test/MC/RISCV/rvi-aliases-valid.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/RISCV/rvi-aliases-valid.s?rev=365881&r1=365880&r2=365881&view=diff
==============================================================================
--- llvm/trunk/test/MC/RISCV/rvi-aliases-valid.s (original)
+++ llvm/trunk/test/MC/RISCV/rvi-aliases-valid.s Fri Jul 12 01:36:07 2019
@@ -117,6 +117,13 @@ j foo
# CHECK-OBJ: j 0
# CHECK-OBJ: R_RISCV_JAL a0
j a0
+# CHECK-S-NOALIAS: [[LABEL:.L[[:alnum:]_]+]]:
+# CHECK-S-NOALIAS-NEXT: jal zero, [[LABEL]]
+# CHECK-S: [[LABEL:.L[[:alnum:]_]+]]:
+# CHECK-S-NEXT: j [[LABEL]]
+# CHECK-OBJ-NOALIAS: jal zero, 0
+# CHECK-OBJ: j 0
+j .
# CHECK-S-OBJ-NOALIAS: jal ra, 2040
# CHECK-S-OBJ: jal 2040
jal 2040
More information about the llvm-commits
mailing list