blob: 9518395916daa2032f4a20e96536b1ace4065e45 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- X86MachineFuctionInfo.cpp - X86 machine function info -------------===//
2//
David Blaikiea379b1812011-12-20 02:50:00 +00003// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liub22310f2012-02-18 12:03:15 +00007//
David Blaikiea379b1812011-12-20 02:50:00 +00008//===----------------------------------------------------------------------===//
9
10#include "X86MachineFunctionInfo.h"
Michael Liaod8faa612014-12-04 00:56:38 +000011#include "X86RegisterInfo.h"
12#include "llvm/Target/TargetSubtargetInfo.h"
David Blaikiea379b1812011-12-20 02:50:00 +000013
14using namespace llvm;
15
16void X86MachineFunctionInfo::anchor() { }
Michael Liaod8faa612014-12-04 00:56:38 +000017
18void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) {
19 if (!RestoreBasePointerOffset) {
20 const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
21 MF->getSubtarget().getRegisterInfo());
22 unsigned SlotSize = RegInfo->getSlotSize();
23 for (const MCPhysReg *CSR =
24 RegInfo->X86RegisterInfo::getCalleeSavedRegs(MF);
25 unsigned Reg = *CSR;
26 ++CSR)
27 {
28 if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
29 RestoreBasePointerOffset -= SlotSize;
30 }
31 }
32}
33