[PATCH] D120476: [LoongArch] Add basic support to AsmParser

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 27 23:10:19 PST 2022


MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp:228
+    assert(Expr && "Expr shouldn't be null!");
+    if (auto CE = dyn_cast<MCConstantExpr>(Expr))
+      Inst.addOperand(MCOperand::createImm(CE->getValue()));
----------------
delete assert

dyn_cast asserts non-null


================
Comment at: llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp:270
+  llvm_unreachable("Unimplemented function.");
+  return MatchOperand_NoMatch;
+}
----------------
delete return


================
Comment at: llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp:278
+
+  // Eat the $ prefix
+  getLexer().Lex();
----------------



================
Comment at: llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp:344
+  while (getLexer().is(AsmToken::Comma)) {
+    // Consume comma token.
+    getLexer().Lex();
----------------
The code self explains. Delete comment


================
Comment at: llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp:347
+
+    // Parse next operand.
+    if (parseOperand(Operands, Name))
----------------
The code self explains. Delete comment


================
Comment at: llvm/test/MC/LoongArch/ISA/Basic/Integer/invalid.s:8
+## uimm2
+bytepick.w $a0, $a0, $a0, -1 # CHECK: :[[@LINE]]:27: error: immediate must be an integer in the range [0, 3]
+bytepick.w $a0, $a0, $a0, 4 # CHECK: :[[@LINE]]:27: error: immediate must be an integer in the range [0, 3]
----------------
`[[@LINE]]` is deprecated FileCheck pattern. Use `[[#@LINE]]`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120476/new/

https://reviews.llvm.org/D120476



More information about the llvm-commits mailing list