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 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "X86MachineFunctionInfo.h" |
10 | #include "X86RegisterInfo.h" |
11 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
12 | #include "llvm/CodeGen/TargetSubtargetInfo.h" |
13 | |
14 | using namespace llvm; |
15 | |
16 | MachineFunctionInfo *X86MachineFunctionInfo::clone( |
17 | BumpPtrAllocator &Allocator, MachineFunction &DestMF, |
18 | const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) |
19 | const { |
20 | return DestMF.cloneInfo<X86MachineFunctionInfo>(Old: *this); |
21 | } |
22 | |
23 | void X86MachineFunctionInfo::anchor() { } |
24 | |
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; |
34 | } |
35 | } |
36 | } |
37 | |
38 |