summaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInstrInfo.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-11-17 01:36:23 +0000
committerAndrew Trick <atrick@apple.com>2013-11-17 01:36:23 +0000
commitbb756ca24401e190e3b704e5d92759c7a79cc6b7 (patch)
tree0c4bcba47b3a9717739a7c8f876a88363dc3ae02 /lib/CodeGen/TargetInstrInfo.cpp
parentb7dabccbce5fc6fcf7b36669eb04abcb001e7f9e (diff)
downloadllvm-bb756ca24401e190e3b704e5d92759c7a79cc6b7.tar.gz
llvm-bb756ca24401e190e3b704e5d92759c7a79cc6b7.tar.bz2
llvm-bb756ca24401e190e3b704e5d92759c7a79cc6b7.tar.xz
Added a size field to the stack map record to handle subregister spills.
Implementing this on bigendian platforms could get strange. I added a target hook, getStackSlotRange, per Jakob's recommendation to make this as explicit as possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInstrInfo.cpp')
-rw-r--r--lib/CodeGen/TargetInstrInfo.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetInstrInfo.cpp b/lib/CodeGen/TargetInstrInfo.cpp
index edeca3d5b8..bf4fd6587e 100644
--- a/lib/CodeGen/TargetInstrInfo.cpp
+++ b/lib/CodeGen/TargetInstrInfo.cpp
@@ -17,6 +17,7 @@
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/CodeGen/ScoreboardHazardRecognizer.h"
+#include "llvm/IR/DataLayout.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/Support/CommandLine.h"
@@ -276,6 +277,36 @@ bool TargetInstrInfo::hasStoreToStackSlot(const MachineInstr *MI,
return false;
}
+bool TargetInstrInfo::getStackSlotRange(const TargetRegisterClass *RC,
+ unsigned SubIdx, unsigned &Size,
+ unsigned &Offset,
+ const TargetMachine *TM) const {
+ if (!SubIdx) {
+ Size = RC->getSize();
+ Offset = 0;
+ return true;
+ }
+ unsigned BitSize = TM->getRegisterInfo()->getSubRegIdxSize(SubIdx);
+ // Convert bit size to byte size to be consistent with
+ // MCRegisterClass::getSize().
+ if (BitSize % 8)
+ return false;
+
+ int BitOffset = TM->getRegisterInfo()->getSubRegIdxOffset(SubIdx);
+ if (BitOffset < 0 || BitOffset % 8)
+ return false;
+
+ Size = BitSize /= 8;
+ Offset = (unsigned)BitOffset / 8;
+
+ assert(RC->getSize() >= (Offset + Size) && "bad subregister range");
+
+ if (!TM->getDataLayout()->isLittleEndian()) {
+ Offset = RC->getSize() - (Offset + Size);
+ }
+ return true;
+}
+
void TargetInstrInfo::reMaterialize(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
unsigned DestReg,