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"
|
|
|
|
#include "llvm/Target/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();
|
2014-12-04 13:20:33 +08:00
|
|
|
for (const MCPhysReg *CSR =
|
2014-12-04 08:56:38 +08:00
|
|
|
RegInfo->X86RegisterInfo::getCalleeSavedRegs(MF);
|
|
|
|
unsigned Reg = *CSR;
|
|
|
|
++CSR)
|
|
|
|
{
|
|
|
|
if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
|
|
|
|
RestoreBasePointerOffset -= SlotSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|