From c38f2bc3c29337f777c48b33daa8b1d6c76c27bf Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 23 Jan 2007 22:59:13 +0000 Subject: - Reorg Thumb load / store instructions. Combine each rr and ri pair of instructions into one (e.g. tLDRrr, tLDRri -> tLDR). - Thumb ldrsb and ldrsh only have the [reg, reg] address format. If the address is not an add, materialize a 0 immediate into a register and use it as the offset field. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33470 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMAsmPrinter.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'lib/Target/ARM/ARMAsmPrinter.cpp') diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index bd87539aa0..1ca8bfd75c 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -98,9 +98,9 @@ namespace { void printThumbAddrModeRROperand(const MachineInstr *MI, int OpNo); void printThumbAddrModeRI5Operand(const MachineInstr *MI, int OpNo, unsigned Scale); - void printThumbAddrModeRI5_1Operand(const MachineInstr *MI, int OpNo); - void printThumbAddrModeRI5_2Operand(const MachineInstr *MI, int OpNo); - void printThumbAddrModeRI5_4Operand(const MachineInstr *MI, int OpNo); + void printThumbAddrModeS1Operand(const MachineInstr *MI, int OpNo); + void printThumbAddrModeS2Operand(const MachineInstr *MI, int OpNo); + void printThumbAddrModeS4Operand(const MachineInstr *MI, int OpNo); void printThumbAddrModeSPOperand(const MachineInstr *MI, int OpNo); void printCCOperand(const MachineInstr *MI, int opNum); void printPCLabel(const MachineInstr *MI, int opNum); @@ -518,7 +518,7 @@ void ARMAsmPrinter::printThumbAddrModeRI5Operand(const MachineInstr *MI, int Op, unsigned Scale) { const MachineOperand &MO1 = MI->getOperand(Op); - const MachineOperand &MO2 = MI->getOperand(Op+1); + const MachineOperand &MO2 = MI->getOperand(Op+2); if (!MO1.isRegister()) { // FIXME: This is for CP entries, but isn't right. printOperand(MI, Op); @@ -535,16 +535,25 @@ ARMAsmPrinter::printThumbAddrModeRI5Operand(const MachineInstr *MI, int Op, } void -ARMAsmPrinter::printThumbAddrModeRI5_1Operand(const MachineInstr *MI, int Op) { - printThumbAddrModeRI5Operand(MI, Op, 1); +ARMAsmPrinter::printThumbAddrModeS1Operand(const MachineInstr *MI, int Op) { + if (MI->getOperand(Op+1).getReg()) + printThumbAddrModeRROperand(MI, Op); + else + printThumbAddrModeRI5Operand(MI, Op, 1); } void -ARMAsmPrinter::printThumbAddrModeRI5_2Operand(const MachineInstr *MI, int Op) { - printThumbAddrModeRI5Operand(MI, Op, 2); +ARMAsmPrinter::printThumbAddrModeS2Operand(const MachineInstr *MI, int Op) { + if (MI->getOperand(Op+1).getReg()) + printThumbAddrModeRROperand(MI, Op); + else + printThumbAddrModeRI5Operand(MI, Op, 2); } void -ARMAsmPrinter::printThumbAddrModeRI5_4Operand(const MachineInstr *MI, int Op) { - printThumbAddrModeRI5Operand(MI, Op, 4); +ARMAsmPrinter::printThumbAddrModeS4Operand(const MachineInstr *MI, int Op) { + if (MI->getOperand(Op+1).getReg()) + printThumbAddrModeRROperand(MI, Op); + else + printThumbAddrModeRI5Operand(MI, Op, 4); } void ARMAsmPrinter::printThumbAddrModeSPOperand(const MachineInstr *MI,int Op) { -- cgit v1.2.3-70-g09d2