[PATCH] D59460: Use generic operand printer for modifiers
Afonso Bordado via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 16 12:05:16 PDT 2019
INdek updated this revision to Diff 190986.
INdek added a comment.
Herald added a subscriber: eraman.
- Add test for MSP430 asm printing modifiers
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59460/new/
https://reviews.llvm.org/D59460
Files:
llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
llvm/test/CodeGen/MSP430/inline-asm-modifiers.ll
Index: llvm/test/CodeGen/MSP430/inline-asm-modifiers.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/MSP430/inline-asm-modifiers.ll
@@ -0,0 +1,11 @@
+; RUN: llc -march=msp430 < %s | FileCheck %s
+
+define void @test() {
+entry:
+; CHECK: add 10, r1
+ call void asm sideeffect "add ${0:c}, r1", "i"( i8 10 )
+
+; CHECK: add -10, r1
+ call void asm sideeffect "add ${0:n}, r1", "i"( i8 10 )
+ ret void
+}
Index: llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
+++ llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
@@ -131,8 +131,15 @@
unsigned AsmVariant,
const char *ExtraCode, raw_ostream &O) {
// Does this asm operand have a single letter operand modifier?
- if (ExtraCode && ExtraCode[0])
- return true; // Unknown modifier.
+ if (ExtraCode && ExtraCode[0]) {
+ if (ExtraCode[1] != 0) return true; // Unknown modifier.
+
+ switch (ExtraCode[0]) {
+ default:
+ // See if this is a generic print operand
+ return AsmPrinter::PrintAsmOperand(MI, OpNo, AsmVariant, ExtraCode, O);
+ }
+ }
printOperand(MI, OpNo, O);
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59460.190986.patch
Type: text/x-patch
Size: 1315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190316/a5895ddc/attachment.bin>
More information about the llvm-commits
mailing list