2015-07-30 06:32:47 +08:00
|
|
|
//===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===//
|
2012-02-18 20:03:15 +08:00
|
|
|
//
|
2011-12-20 10:50:00 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2012-02-18 20:03:15 +08:00
|
|
|
//
|
2011-12-20 10:50:00 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "X86MachineFunctionInfo.h"
|
2014-12-04 08:56:38 +08:00
|
|
|
#include "X86RegisterInfo.h"
|
2017-03-14 17:09:26 +08:00
|
|
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
2017-11-17 09:07:10 +08:00
|
|
|
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
2011-12-20 10:50:00 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
void X86MachineFunctionInfo::anchor() { }
|
2014-12-04 08:56:38 +08:00
|
|
|
|
|
|
|
void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) {
|
|
|
|
if (!RestoreBasePointerOffset) {
|
|
|
|
const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
|
|
|
|
MF->getSubtarget().getRegisterInfo());
|
|
|
|
unsigned SlotSize = RegInfo->getSlotSize();
|
2017-03-14 17:09:26 +08:00
|
|
|
for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs();
|
|
|
|
unsigned Reg = *CSR; ++CSR) {
|
2014-12-04 08:56:38 +08:00
|
|
|
if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
|
|
|
|
RestoreBasePointerOffset -= SlotSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|