[llvm-commits] [llvm] r84707 - /llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
Anton Korobeynikov
asl at math.spbu.ru
Tue Oct 20 17:12:27 PDT 2009
Author: asl
Date: Tue Oct 20 19:12:27 2009
New Revision: 84707
URL: http://llvm.org/viewvc/llvm-project?rev=84707&view=rev
Log:
Add a workaround for different memops prefixes
Modified:
llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
Modified: llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp?rev=84707&r1=84706&r2=84707&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp Tue Oct 20 19:12:27 2009
@@ -36,8 +36,6 @@
void MSP430InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
const char *Modifier) {
- assert((Modifier == 0 || Modifier[0] == 0) && "Cannot print modifiers");
-
const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isReg()) {
O << getRegisterName(Op.getReg());
@@ -45,6 +43,8 @@
O << '#' << Op.getImm();
} else {
assert(Op.isExpr() && "unknown operand kind in printOperand");
+ bool isMemOp = Modifier && !strcmp(Modifier, "mem");
+ O << (isMemOp ? '&' : '#');
Op.getExpr()->print(O, &MAI);
}
}
@@ -54,7 +54,10 @@
const MCOperand &Base = MI->getOperand(OpNo);
const MCOperand &Disp = MI->getOperand(OpNo+1);
- if (Disp.isImm() && !Base.isReg())
+ // FIXME: move global to displacement field!
+ if (Base.isExpr())
+ printOperand(MI, OpNo, "mem");
+ else if (Disp.isImm() && !Base.isReg())
printOperand(MI, OpNo);
else if (Base.isReg()) {
if (Disp.getImm()) {
More information about the llvm-commits
mailing list