Checkpoint MCInst printer. We (almostly) able to print global / JT / constpool entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84706 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
index 243a5e1..84a2e02 100644
--- a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
+++ b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
@@ -45,6 +45,30 @@
O << '#' << Op.getImm();
} else {
assert(Op.isExpr() && "unknown operand kind in printOperand");
- assert(0 && "Unimplemented!");
+ Op.getExpr()->print(O, &MAI);
}
}
+
+void MSP430InstPrinter::printSrcMemOperand(const MCInst *MI, unsigned OpNo,
+ const char *Modifier) {
+ const MCOperand &Base = MI->getOperand(OpNo);
+ const MCOperand &Disp = MI->getOperand(OpNo+1);
+
+ if (Disp.isImm() && !Base.isReg())
+ printOperand(MI, OpNo);
+ else if (Base.isReg()) {
+ if (Disp.getImm()) {
+ O << Disp.getImm() << '(';
+ printOperand(MI, OpNo);
+ O << ')';
+ } else {
+ O << '@';
+ printOperand(MI, OpNo);
+ }
+ } else {
+ Base.dump();
+ Disp.dump();
+ llvm_unreachable("Unsupported memory operand");
+ }
+
+}