1 //===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "X86MachineFunctionInfo.h"
10 #include "X86RegisterInfo.h"
11 #include "llvm/CodeGen/MachineRegisterInfo.h"
12 #include "llvm/CodeGen/TargetSubtargetInfo.h"
16 MachineFunctionInfo
*X86MachineFunctionInfo::clone(
17 BumpPtrAllocator
&Allocator
, MachineFunction
&DestMF
,
18 const DenseMap
<MachineBasicBlock
*, MachineBasicBlock
*> &Src2DstMBB
)
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
;