scavenged frame index value re-use gets confused when more than one base

register is involved for thumb1. Work around this for the moment by only
re-using SP-relative offsets. This is temporary 'til the code can distinguish
multiple base registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98071 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2010-03-09 19:07:28 +00:00
parent bdc38e5aa2
commit 4e501545cd
2 changed files with 8 additions and 1 deletions

View File

@ -40,7 +40,7 @@
#include "llvm/Support/CommandLine.h"
using namespace llvm;
static cl::opt<bool>
cl::opt<bool>
ReuseFrameIndexVals("arm-reuse-frame-index-vals", cl::Hidden, cl::init(true),
cl::desc("Reuse repeated frame index values"));

View File

@ -33,10 +33,13 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
extern cl::opt<bool> ReuseFrameIndexVals;
Thumb1RegisterInfo::Thumb1RegisterInfo(const ARMBaseInstrInfo &tii,
const ARMSubtarget &sti)
: ARMBaseRegisterInfo(tii, sti) {
@ -640,6 +643,7 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
assert (Value && "Frame index virtual allocated, but Value arg is NULL!");
*Value = Offset;
bool UseRR = false;
bool TrackVReg = FrameReg == ARM::SP;
if (Opcode == ARM::tSpill) {
if (FrameReg == ARM::SP)
@ -648,6 +652,7 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
else {
emitLoadConstPool(MBB, II, dl, VReg, 0, Offset);
UseRR = true;
TrackVReg = false;
}
} else
emitThumbRegPlusImmediate(MBB, II, VReg, FrameReg, Offset, TII,
@ -658,6 +663,8 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
MI.addOperand(MachineOperand::CreateReg(FrameReg, false));
else // tSTR has an extra register operand.
MI.addOperand(MachineOperand::CreateReg(0, false));
if (!ReuseFrameIndexVals || !TrackVReg)
VReg = 0;
} else
assert(false && "Unexpected opcode!");