1*0b57cec5SDimitry Andric //===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric #include "X86MachineFunctionInfo.h" 10*0b57cec5SDimitry Andric #include "X86RegisterInfo.h" 11*0b57cec5SDimitry Andric #include "llvm/CodeGen/MachineRegisterInfo.h" 12*0b57cec5SDimitry Andric #include "llvm/CodeGen/TargetSubtargetInfo.h" 13*0b57cec5SDimitry Andric 14*0b57cec5SDimitry Andric using namespace llvm; 15*0b57cec5SDimitry Andric 16*0b57cec5SDimitry Andric void X86MachineFunctionInfo::anchor() { } 17*0b57cec5SDimitry Andric 18*0b57cec5SDimitry Andric void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) { 19*0b57cec5SDimitry Andric if (!RestoreBasePointerOffset) { 20*0b57cec5SDimitry Andric const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>( 21*0b57cec5SDimitry Andric MF->getSubtarget().getRegisterInfo()); 22*0b57cec5SDimitry Andric unsigned SlotSize = RegInfo->getSlotSize(); 23*0b57cec5SDimitry Andric for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs(); 24*0b57cec5SDimitry Andric unsigned Reg = *CSR; ++CSR) { 25*0b57cec5SDimitry Andric if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg)) 26*0b57cec5SDimitry Andric RestoreBasePointerOffset -= SlotSize; 27*0b57cec5SDimitry Andric } 28*0b57cec5SDimitry Andric } 29*0b57cec5SDimitry Andric } 30*0b57cec5SDimitry Andric 31