mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user