1//===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "X86MachineFunctionInfo.h"
11#include "X86RegisterInfo.h"
12#include "llvm/Target/TargetSubtargetInfo.h"
13
14using namespace llvm;
15
16void X86MachineFunctionInfo::anchor() { }
17
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
34