[PATCH] D148302: [M68k] Fix printing of immediate in `M68kOperand::print`

Ian D. Scott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 22:23:58 PDT 2023


ids1024 created this revision.
ids1024 added a reviewer: myhsu.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ids1024 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The `Imm` union variant wasn't initialized anywhere. This fixes what is printed by `llvm-mc -arch m68k --show-inst-operands`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148302

Files:
  llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp


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;
   };
@@ -1070,7 +1069,9 @@
     break;
 
   case KindTy::Imm:
-    OS << "immediate " << Imm;
+    int64_t Value;
+    Expr->evaluateAsAbsolute(Value);
+    OS << "immediate " << Value;
     break;
 
   case KindTy::MemOp:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148302.513435.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/20922295/attachment.bin>


More information about the llvm-commits mailing list