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/CodeGen/MachineRegisterInfo.h" 13 #include "llvm/CodeGen/TargetSubtargetInfo.h" 14 15 using namespace llvm; 16 anchor()17void X86MachineFunctionInfo::anchor() { } 18 setRestoreBasePointer(const MachineFunction * MF)19void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) { 20 if (!RestoreBasePointerOffset) { 21 const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>( 22 MF->getSubtarget().getRegisterInfo()); 23 unsigned SlotSize = RegInfo->getSlotSize(); 24 for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs(); 25 unsigned Reg = *CSR; ++CSR) { 26 if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg)) 27 RestoreBasePointerOffset -= SlotSize; 28 } 29 } 30 } 31 32