aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2006-08-08 20:35:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2006-08-08 20:35:03 +0000
commit46adf8119df362bfed7c6d71dd467527981b97da (patch)
tree2b75ac8fbb4976c1451c5ccccacb9c719fe1e5ca /lib
parentd9ea017494c6895f04c5d79ccb990c831c67ef27 (diff)
downloadexternal_llvm-46adf8119df362bfed7c6d71dd467527981b97da.zip
external_llvm-46adf8119df362bfed7c6d71dd467527981b97da.tar.gz
external_llvm-46adf8119df362bfed7c6d71dd467527981b97da.tar.bz2
change the addressing mode of the str instruction to reg+imm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMInstrInfo.cpp4
-rw-r--r--lib/Target/ARM/ARMInstrInfo.h4
-rw-r--r--lib/Target/ARM/ARMInstrInfo.td6
-rw-r--r--lib/Target/ARM/ARMRegisterInfo.cpp6
4 files changed, 13 insertions, 7 deletions
diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp
index 5437c1d..4384c28 100644
--- a/lib/Target/ARM/ARMInstrInfo.cpp
+++ b/lib/Target/ARM/ARMInstrInfo.cpp
@@ -22,6 +22,10 @@ ARMInstrInfo::ARMInstrInfo()
: TargetInstrInfo(ARMInsts, sizeof(ARMInsts)/sizeof(ARMInsts[0])) {
}
+const TargetRegisterClass *ARMInstrInfo::getPointerRegClass() const {
+ return &ARM::IntRegsRegClass;
+}
+
/// Return true if the instruction is a register to register move and
/// leave the source and dest operands in the passed parameters.
///
diff --git a/lib/Target/ARM/ARMInstrInfo.h b/lib/Target/ARM/ARMInstrInfo.h
index e75a71d..6318caa 100644
--- a/lib/Target/ARM/ARMInstrInfo.h
+++ b/lib/Target/ARM/ARMInstrInfo.h
@@ -31,6 +31,10 @@ public:
///
virtual const MRegisterInfo &getRegisterInfo() const { return RI; }
+ /// getPointerRegClass - Return the register class to use to hold pointers.
+ /// This is used for addressing modes.
+ virtual const TargetRegisterClass *getPointerRegClass() const;
+
/// Return true if the instruction is a register to register move and
/// leave the source and dest operands in the passed parameters.
///
diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td
index 5ba4deb..9dc596a 100644
--- a/lib/Target/ARM/ARMInstrInfo.td
+++ b/lib/Target/ARM/ARMInstrInfo.td
@@ -67,9 +67,9 @@ def ldr : InstARM<(ops IntRegs:$dst, memri:$addr),
"ldr $dst, $addr",
[(set IntRegs:$dst, (load iaddr:$addr))]>;
-def str : InstARM<(ops IntRegs:$src, IntRegs:$addr),
- "str $src, [$addr]",
- [(store IntRegs:$src, IntRegs:$addr)]>;
+def str : InstARM<(ops IntRegs:$src, memri:$addr),
+ "str $src, $addr",
+ [(store IntRegs:$src, iaddr:$addr)]>;
def movrr : InstARM<(ops IntRegs:$dst, IntRegs:$src),
"mov $dst, $src", []>;
diff --git a/lib/Target/ARM/ARMRegisterInfo.cpp b/lib/Target/ARM/ARMRegisterInfo.cpp
index 719ce32..67d0b7c 100644
--- a/lib/Target/ARM/ARMRegisterInfo.cpp
+++ b/lib/Target/ARM/ARMRegisterInfo.cpp
@@ -135,10 +135,8 @@ void ARMRegisterInfo::emitPrologue(MachineFunction &MF) const {
//sub sp, sp, #NumBytes
BuildMI(MBB, MBBI, ARM::subri, 2, ARM::R13).addReg(ARM::R13).addImm(NumBytes);
- //add ip, sp, #NumBytes - 4
- BuildMI(MBB, MBBI, ARM::addri, 2, ARM::R12).addReg(ARM::R13).addImm(NumBytes - 4);
- //str lr, [ip]
- BuildMI(MBB, MBBI, ARM::str, 1, ARM::R14).addReg(ARM::R12);
+ //str lr, [sp, #NumBytes - 4]
+ BuildMI(MBB, MBBI, ARM::str, 2, ARM::R14).addImm(NumBytes - 4).addReg(ARM::R13);
}
void ARMRegisterInfo::emitEpilogue(MachineFunction &MF,