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 void X86MachineFunctionInfo::anchor() { }
18 void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction
*MF
) {
19 if (!RestoreBasePointerOffset
) {
20 const X86RegisterInfo
*RegInfo
= static_cast<const X86RegisterInfo
*>(
21 MF
->getSubtarget().getRegisterInfo());
22 unsigned SlotSize
= RegInfo
->getSlotSize();
23 for (const MCPhysReg
*CSR
= MF
->getRegInfo().getCalleeSavedRegs();
24 unsigned Reg
= *CSR
; ++CSR
) {
25 if (X86::GR64RegClass
.contains(Reg
) || X86::GR32RegClass
.contains(Reg
))
26 RestoreBasePointerOffset
-= SlotSize
;