[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / llvm / lib / Target / X86 / X86MachineFunctionInfo.cpp
blob2e88e01ce7fdfa6ed9921800f5aac75002830e11
1 //===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "X86MachineFunctionInfo.h"
10 #include "X86RegisterInfo.h"
11 #include "llvm/CodeGen/MachineRegisterInfo.h"
12 #include "llvm/CodeGen/TargetSubtargetInfo.h"
14 using namespace llvm;
16 MachineFunctionInfo *X86MachineFunctionInfo::clone(
17 BumpPtrAllocator &Allocator, MachineFunction &DestMF,
18 const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
19 const {
20 return DestMF.cloneInfo<X86MachineFunctionInfo>(*this);
23 void X86MachineFunctionInfo::anchor() { }
25 void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) {
26 if (!RestoreBasePointerOffset) {
27 const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
28 MF->getSubtarget().getRegisterInfo());
29 unsigned SlotSize = RegInfo->getSlotSize();
30 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;