[PATCH] D148302: [M68k] Fix printing of immediate in `M68kOperand::print`
Ian D. Scott via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 16 12:57:01 PDT 2023
ids1024 updated this revision to Diff 514045.
ids1024 added a comment.
Regression test and curly braces.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148302/new/
https://reviews.llvm.org/D148302
Files:
llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
llvm/test/MC/M68k/operand.s
Index: llvm/test/MC/M68k/operand.s
===================================================================
--- /dev/null
+++ llvm/test/MC/M68k/operand.s
@@ -0,0 +1,5 @@
+# RUN: llvm-mc -triple=m68k -show-inst-operands %s 2> %t0
+# RUN: FileCheck %s < %t0
+
+; CHECK: parsed instruction: [token 'move.l', immediate 123, %24]
+move.l #123, %d0
Index: llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
===================================================================
--- llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
+++ llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
@@ -133,7 +133,6 @@
SMLoc Start, End;
union {
StringRef Token;
- int64_t Imm;
const MCExpr *Expr;
M68kMemOp MemOp;
};
@@ -1069,9 +1068,12 @@
OS << "token '" << Token << "'";
break;
- case KindTy::Imm:
- OS << "immediate " << Imm;
+ case KindTy::Imm: {
+ int64_t Value;
+ Expr->evaluateAsAbsolute(Value);
+ OS << "immediate " << Value;
break;
+ }
case KindTy::MemOp:
MemOp.print(OS);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148302.514045.patch
Type: text/x-patch
Size: 1020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230416/497dd04c/attachment.bin>
More information about the llvm-commits
mailing list