summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/SystemZRegisterInfo.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:09:56 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:09:56 +0000
commit5a11e02fbd7f0df98338c75cd468c42d29ef16e4 (patch)
tree68c6b687ca8e911e750d000735d9e0e620552bc8 /lib/Target/SystemZ/SystemZRegisterInfo.cpp
parent720e3b00b869950bdc09ad065d92174772903da0 (diff)
downloadllvm-5a11e02fbd7f0df98338c75cd468c42d29ef16e4.tar.gz
llvm-5a11e02fbd7f0df98338c75cd468c42d29ef16e4.tar.bz2
llvm-5a11e02fbd7f0df98338c75cd468c42d29ef16e4.tar.xz
Fix fallout from 12-bit stuff landing: decide whether 20 bit displacements are needed during elimination of frame indexes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/SystemZRegisterInfo.cpp')
-rw-r--r--lib/Target/SystemZ/SystemZRegisterInfo.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/lib/Target/SystemZ/SystemZRegisterInfo.cpp
index c30d5efd4b..a65cec15c9 100644
--- a/lib/Target/SystemZ/SystemZRegisterInfo.cpp
+++ b/lib/Target/SystemZ/SystemZRegisterInfo.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "SystemZ.h"
+#include "SystemZInstrInfo.h"
#include "SystemZMachineFunctionInfo.h"
#include "SystemZRegisterInfo.h"
#include "SystemZSubtarget.h"
@@ -27,7 +28,7 @@
using namespace llvm;
SystemZRegisterInfo::SystemZRegisterInfo(SystemZTargetMachine &tm,
- const TargetInstrInfo &tii)
+ const SystemZInstrInfo &tii)
: SystemZGenRegisterInfo(SystemZ::ADJCALLSTACKUP, SystemZ::ADJCALLSTACKDOWN),
TM(tm), TII(tii) {
}
@@ -124,9 +125,14 @@ void SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
// displacement field.
MI.getOperand(i).ChangeToRegister(BasePtr, false);
- // Offset is a 20-bit integer.
+ // Offset is a either 12-bit unsigned or 20-bit signed integer.
// FIXME: handle "too long" displacements.
int Offset = getFrameIndexOffset(MF, FrameIndex) + MI.getOperand(i+1).getImm();
+
+ // Check whether displacement is too long to fit into 12 bit zext field.
+ if (Offset < 0 || Offset >= 4096)
+ MI.setDesc(TII.getLongDispOpc(MI.getOpcode()));
+
MI.getOperand(i+1).ChangeToImmediate(Offset);
}