diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-19 21:57:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-19 21:57:05 +0000 |
commit | f1977ef5f64e12407799dbb7b6c113b4b0567db1 (patch) | |
tree | aa550a7b8a6785af708bde82ecb6c9f8a2d6d204 /lib | |
parent | 9521525ee4beef3f057a4b1921399322c5060f97 (diff) | |
download | external_llvm-f1977ef5f64e12407799dbb7b6c113b4b0567db1.zip external_llvm-f1977ef5f64e12407799dbb7b6c113b4b0567db1.tar.gz external_llvm-f1977ef5f64e12407799dbb7b6c113b4b0567db1.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp | 34 | ||||
-rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMInstPrinter.h | 2 |
2 files changed, 35 insertions, 1 deletions
diff --git a/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp index 41be859..95ff0a2 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 2b99dfd..f129c04 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) {} |