From: Chris Lattner Date: Mon, 19 Oct 2009 21:57:05 +0000 (+0000) Subject: add addrmode2 support, getting us up to: X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=084f87d445620bd63573c0e8d9adf776dc62d87d;p=oota-llvm.git add addrmode2 support, getting us up to: _main: stm , mov r7, sp sub sp, sp, #4 mov r0, #0 str r0, [sp] ldr r0, LCPI1_0 bl _printf ldr r0, [sp] mov sp, r7 ldm , git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84543 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp index 41be859ce0d..95ff0a23d64 100644 --- a/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp @@ -77,3 +77,37 @@ void ARMInstPrinter::printSOImmOperand(const MCInst *MI, unsigned OpNum) { assert(MO.isImm() && "Not a valid so_imm value!"); printSOImm(O, MO.getImm(), VerboseAsm, &MAI); } + + + +void ARMInstPrinter::printAddrMode2Operand(const MCInst *MI, unsigned Op) { + const MCOperand &MO1 = MI->getOperand(Op); + const MCOperand &MO2 = MI->getOperand(Op+1); + const MCOperand &MO3 = MI->getOperand(Op+2); + + if (!MO1.isReg()) { // FIXME: This is for CP entries, but isn't right. + printOperand(MI, Op); + return; + } + + O << "[" << getRegisterName(MO1.getReg()); + + if (!MO2.getReg()) { + if (ARM_AM::getAM2Offset(MO3.getImm())) // Don't print +0. + O << ", #" + << (char)ARM_AM::getAM2Op(MO3.getImm()) + << ARM_AM::getAM2Offset(MO3.getImm()); + O << "]"; + return; + } + + O << ", " + << (char)ARM_AM::getAM2Op(MO3.getImm()) + << getRegisterName(MO2.getReg()); + + if (unsigned ShImm = ARM_AM::getAM2Offset(MO3.getImm())) + O << ", " + << ARM_AM::getShiftOpcStr(ARM_AM::getAM2ShiftOpc(MO3.getImm())) + << " #" << ShImm; + O << "]"; +} diff --git a/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h b/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h index 2b99dfd3d53..f129c0482c9 100644 --- a/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h +++ b/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h @@ -40,7 +40,7 @@ public: void printSOImm2PartOperand(const MCInst *MI, unsigned OpNum) {} void printSORegOperand(const MCInst *MI, unsigned OpNum) {} - void printAddrMode2Operand(const MCInst *MI, unsigned OpNum) {} + void printAddrMode2Operand(const MCInst *MI, unsigned OpNum); void printAddrMode2OffsetOperand(const MCInst *MI, unsigned OpNum) {} void printAddrMode3Operand(const MCInst *MI, unsigned OpNum) {} void printAddrMode3OffsetOperand(const MCInst *MI, unsigned OpNum) {}