[llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrThumb.td ARMISelDAGToDAG.cpp ARMAsmPrinter.cpp
Evan Cheng
evan.cheng at apple.com
Mon Jan 29 18:35:48 PST 2007
Changes in directory llvm/lib/Target/ARM:
ARMInstrThumb.td updated: 1.8 -> 1.9
ARMISelDAGToDAG.cpp updated: 1.103 -> 1.104
ARMAsmPrinter.cpp updated: 1.51 -> 1.52
---
Log message:
Change the operand orders to t_addrmode_s* to make it easier to morph
instructions that use these address modes to instructions that use
t_addrmode_sp.
---
Diffs of the changes: (+26 -32)
ARMAsmPrinter.cpp | 22 ++++++++--------------
ARMISelDAGToDAG.cpp | 30 +++++++++++++++---------------
ARMInstrThumb.td | 6 +++---
3 files changed, 26 insertions(+), 32 deletions(-)
Index: llvm/lib/Target/ARM/ARMInstrThumb.td
diff -u llvm/lib/Target/ARM/ARMInstrThumb.td:1.8 llvm/lib/Target/ARM/ARMInstrThumb.td:1.9
--- llvm/lib/Target/ARM/ARMInstrThumb.td:1.8 Mon Jan 29 19:13:37 2007
+++ llvm/lib/Target/ARM/ARMInstrThumb.td Mon Jan 29 20:35:32 2007
@@ -124,7 +124,7 @@
def t_addrmode_s4 : Operand<i32>,
ComplexPattern<i32, 3, "SelectThumbAddrModeS4", []> {
let PrintMethod = "printThumbAddrModeS4Operand";
- let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
+ let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm, GPR:$offsreg);
}
// t_addrmode_s2 := reg + reg
@@ -133,7 +133,7 @@
def t_addrmode_s2 : Operand<i32>,
ComplexPattern<i32, 3, "SelectThumbAddrModeS2", []> {
let PrintMethod = "printThumbAddrModeS2Operand";
- let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
+ let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm, GPR:$offsreg);
}
// t_addrmode_s1 := reg + reg
@@ -142,7 +142,7 @@
def t_addrmode_s1 : Operand<i32>,
ComplexPattern<i32, 3, "SelectThumbAddrModeS1", []> {
let PrintMethod = "printThumbAddrModeS1Operand";
- let MIOperandInfo = (ops GPR:$base, GPR:$offsreg, i32imm:$offsimm);
+ let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm, GPR:$offsreg);
}
// t_addrmode_sp := sp + imm8 * 4
Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.103 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.104
--- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.103 Wed Jan 24 02:53:17 2007
+++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jan 29 20:35:32 2007
@@ -72,14 +72,14 @@
bool SelectThumbAddrModeRR(SDOperand Op, SDOperand N, SDOperand &Base,
SDOperand &Offset);
bool SelectThumbAddrModeRI5(SDOperand Op, SDOperand N, unsigned Scale,
- SDOperand &Base, SDOperand &Offset,
- SDOperand &OffImm);
+ SDOperand &Base, SDOperand &OffImm,
+ SDOperand &Offset);
bool SelectThumbAddrModeS1(SDOperand Op, SDOperand N, SDOperand &Base,
- SDOperand &Offset, SDOperand &OffImm);
+ SDOperand &OffImm, SDOperand &Offset);
bool SelectThumbAddrModeS2(SDOperand Op, SDOperand N, SDOperand &Base,
- SDOperand &Offset, SDOperand &OffImm);
+ SDOperand &OffImm, SDOperand &Offset);
bool SelectThumbAddrModeS4(SDOperand Op, SDOperand N, SDOperand &Base,
- SDOperand &Offset, SDOperand &OffImm);
+ SDOperand &OffImm, SDOperand &Offset);
bool SelectThumbAddrModeSP(SDOperand Op, SDOperand N, SDOperand &Base,
SDOperand &OffImm);
@@ -375,7 +375,7 @@
bool
ARMDAGToDAGISel::SelectThumbAddrModeRI5(SDOperand Op, SDOperand N,
unsigned Scale, SDOperand &Base,
- SDOperand &Offset, SDOperand &OffImm) {
+ SDOperand &OffImm, SDOperand &Offset) {
if (Scale == 4) {
SDOperand TmpBase, TmpOffImm;
if (SelectThumbAddrModeSP(Op, N, TmpBase, TmpOffImm))
@@ -413,21 +413,21 @@
}
bool ARMDAGToDAGISel::SelectThumbAddrModeS1(SDOperand Op, SDOperand N,
- SDOperand &Base, SDOperand &Offset,
- SDOperand &OffImm) {
- return SelectThumbAddrModeRI5(Op, N, 1, Base, Offset, OffImm);
+ SDOperand &Base, SDOperand &OffImm,
+ SDOperand &Offset) {
+ return SelectThumbAddrModeRI5(Op, N, 1, Base, OffImm, Offset);
}
bool ARMDAGToDAGISel::SelectThumbAddrModeS2(SDOperand Op, SDOperand N,
- SDOperand &Base, SDOperand &Offset,
- SDOperand &OffImm) {
- return SelectThumbAddrModeRI5(Op, N, 2, Base, Offset, OffImm);
+ SDOperand &Base, SDOperand &OffImm,
+ SDOperand &Offset) {
+ return SelectThumbAddrModeRI5(Op, N, 2, Base, OffImm, Offset);
}
bool ARMDAGToDAGISel::SelectThumbAddrModeS4(SDOperand Op, SDOperand N,
- SDOperand &Base, SDOperand &Offset,
- SDOperand &OffImm) {
- return SelectThumbAddrModeRI5(Op, N, 4, Base, Offset, OffImm);
+ SDOperand &Base, SDOperand &OffImm,
+ SDOperand &Offset) {
+ return SelectThumbAddrModeRI5(Op, N, 4, Base, OffImm, Offset);
}
bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDOperand Op, SDOperand N,
Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp
diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.51 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.52
--- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.51 Fri Jan 26 20:29:44 2007
+++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jan 29 20:35:32 2007
@@ -523,7 +523,8 @@
ARMAsmPrinter::printThumbAddrModeRI5Operand(const MachineInstr *MI, int Op,
unsigned Scale) {
const MachineOperand &MO1 = MI->getOperand(Op);
- const MachineOperand &MO2 = MI->getOperand(Op+2);
+ const MachineOperand &MO2 = MI->getOperand(Op+1);
+ const MachineOperand &MO3 = MI->getOperand(Op+2);
if (!MO1.isRegister()) { // FIXME: This is for CP entries, but isn't right.
printOperand(MI, Op);
@@ -531,7 +532,9 @@
}
O << "[" << TM.getRegisterInfo()->get(MO1.getReg()).Name;
- if (unsigned ImmOffs = MO2.getImm()) {
+ if (MO3.getReg())
+ O << ", " << TM.getRegisterInfo()->get(MO3.getReg()).Name;
+ else if (unsigned ImmOffs = MO2.getImm()) {
O << ", #" << ImmOffs;
if (Scale > 1)
O << " * " << Scale;
@@ -541,24 +544,15 @@
void
ARMAsmPrinter::printThumbAddrModeS1Operand(const MachineInstr *MI, int Op) {
- if (MI->getOperand(Op+1).getReg())
- printThumbAddrModeRROperand(MI, Op);
- else
- printThumbAddrModeRI5Operand(MI, Op, 1);
+ printThumbAddrModeRI5Operand(MI, Op, 1);
}
void
ARMAsmPrinter::printThumbAddrModeS2Operand(const MachineInstr *MI, int Op) {
- if (MI->getOperand(Op+1).getReg())
- printThumbAddrModeRROperand(MI, Op);
- else
- printThumbAddrModeRI5Operand(MI, Op, 2);
+ printThumbAddrModeRI5Operand(MI, Op, 2);
}
void
ARMAsmPrinter::printThumbAddrModeS4Operand(const MachineInstr *MI, int Op) {
- if (MI->getOperand(Op+1).getReg())
- printThumbAddrModeRROperand(MI, Op);
- else
- printThumbAddrModeRI5Operand(MI, Op, 4);
+ printThumbAddrModeRI5Operand(MI, Op, 4);
}
void ARMAsmPrinter::printThumbAddrModeSPOperand(const MachineInstr *MI,int Op) {
More information about the llvm-commits
mailing list