AMDGPU: Mark test as XFAIL in expensive_checks builds
[llvm-project.git] / llvm / lib / Target / X86 / X86MachineFunctionInfo.cpp
blob7b57f7c23bf4da22d9f83b7ff7716ae3fe990adb
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 yaml::X86MachineFunctionInfo::X86MachineFunctionInfo(
17 const llvm::X86MachineFunctionInfo &MFI)
18 : AMXProgModel(MFI.getAMXProgModel()) {}
20 void yaml::X86MachineFunctionInfo::mappingImpl(yaml::IO &YamlIO) {
21 MappingTraits<X86MachineFunctionInfo>::mapping(YamlIO, *this);
24 MachineFunctionInfo *X86MachineFunctionInfo::clone(
25 BumpPtrAllocator &Allocator, MachineFunction &DestMF,
26 const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
27 const {
28 return DestMF.cloneInfo<X86MachineFunctionInfo>(*this);
31 void X86MachineFunctionInfo::initializeBaseYamlFields(
32 const yaml::X86MachineFunctionInfo &YamlMFI) {
33 AMXProgModel = YamlMFI.AMXProgModel;
36 void X86MachineFunctionInfo::anchor() { }
38 void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) {
39 if (!RestoreBasePointerOffset) {
40 const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
41 MF->getSubtarget().getRegisterInfo());
42 unsigned SlotSize = RegInfo->getSlotSize();
43 for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs();
44 unsigned Reg = *CSR; ++CSR) {
45 if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
46 RestoreBasePointerOffset -= SlotSize;