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 clone(BumpPtrAllocator & Allocator,MachineFunction & DestMF,const DenseMap<MachineBasicBlock *,MachineBasicBlock * > & Src2DstMBB) const16*0b57cec5SDimitry AndricMachineFunctionInfo *X86MachineFunctionInfo::clone( 17*0b57cec5SDimitry Andric BumpPtrAllocator &Allocator, MachineFunction &DestMF, 18*0b57cec5SDimitry Andric const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) 19*0b57cec5SDimitry Andric const { 20*0b57cec5SDimitry Andric return DestMF.cloneInfo<X86MachineFunctionInfo>(*this); 21*0b57cec5SDimitry Andric } 22*0b57cec5SDimitry Andric anchor()23*0b57cec5SDimitry Andricvoid X86MachineFunctionInfo::anchor() { } 24*0b57cec5SDimitry Andric setRestoreBasePointer(const MachineFunction * MF)25*0b57cec5SDimitry Andricvoid X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) { 26*0b57cec5SDimitry Andric if (!RestoreBasePointerOffset) { 27*0b57cec5SDimitry Andric const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>( 28*0b57cec5SDimitry Andric MF->getSubtarget().getRegisterInfo()); 29*0b57cec5SDimitry Andric unsigned SlotSize = RegInfo->getSlotSize(); 30*0b57cec5SDimitry Andric for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs(); 31 unsigned Reg = *CSR; ++CSR) { 32 if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg)) 33 RestoreBasePointerOffset -= SlotSize; 34 } 35 } 36 } 37 38