summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2014-01-06 14:20:41 +0000
committerRobert Lytton <robert@xmos.com>2014-01-06 14:20:41 +0000
commita53360a339998a4523b2f819d727b77454ea6fa5 (patch)
treed0651fea0ac43c844d7b4049c08489ac9839d8de /llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp
parent9288eea910813bcd26dc9b6ec862782653fee644 (diff)
downloadbcm5719-llvm-a53360a339998a4523b2f819d727b77454ea6fa5.tar.gz
bcm5719-llvm-a53360a339998a4523b2f819d727b77454ea6fa5.zip
XCore target: Refactor LR handling
We also narrow the liveness of FP & LR during the prologue to reflect the actual usage of the registers. I have been unable to construct a test to prove the previous live range was too large. llvm-svn: 198611
Diffstat (limited to 'llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp')
-rw-r--r--llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp b/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp
index 91b29760080..c41a3d5f923 100644
--- a/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/XCore/XCoreMachineFunctionInfo.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "XCoreMachineFunctionInfo.h"
+#include "XCoreInstrInfo.h"
+#include "llvm/IR/Function.h"
using namespace llvm;
@@ -28,3 +30,31 @@ bool XCoreFunctionInfo::isLargeFrame(const MachineFunction &MF) const {
// 16KB of function arguments.
return CachedEStackSize > 0xf000;
}
+
+int XCoreFunctionInfo::createLRSpillSlot(MachineFunction &MF) {
+ if (LRSpillSlotSet) {
+ return LRSpillSlot;
+ }
+ const TargetRegisterClass *RC = &XCore::GRRegsRegClass;
+ MachineFrameInfo *MFI = MF.getFrameInfo();
+ if (! MF.getFunction()->isVarArg()) {
+ // A fixed offset of 0 allows us to save / restore LR using entsp / retsp.
+ LRSpillSlot = MFI->CreateFixedObject(RC->getSize(), 0, true);
+ } else {
+ LRSpillSlot = MFI->CreateStackObject(RC->getSize(), RC->getAlignment(), true);
+ }
+ LRSpillSlotSet = true;
+ return LRSpillSlot;
+}
+
+int XCoreFunctionInfo::createFPSpillSlot(MachineFunction &MF) {
+ if (FPSpillSlotSet) {
+ return FPSpillSlot;
+ }
+ const TargetRegisterClass *RC = &XCore::GRRegsRegClass;
+ MachineFrameInfo *MFI = MF.getFrameInfo();
+ FPSpillSlot = MFI->CreateStackObject(RC->getSize(), RC->getAlignment(), true);
+ FPSpillSlotSet = true;
+ return FPSpillSlot;
+}
+
OpenPOWER on IntegriCloud