XCoreMachineFunctionInfo.cpp [plain text]
#include "XCoreMachineFunctionInfo.h"
#include "XCoreInstrInfo.h"
#include "llvm/IR/Function.h"
using namespace llvm;
void XCoreFunctionInfo::anchor() { }
bool XCoreFunctionInfo::isLargeFrame(const MachineFunction &MF) const {
if (CachedEStackSize == -1) {
CachedEStackSize = MF.getFrameInfo()->estimateStackSize(MF);
}
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()) {
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;
}