LLVM 24.0.0git
X86MachineFunctionInfo.cpp
Go to the documentation of this file.
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
10#include "X86RegisterInfo.h"
14
15using namespace llvm;
16
19 : AMXProgModel(MFI.getAMXProgModel()), ACEProgModel(MFI.getACEProgModel()),
20 HasVAStartSaveXMMRegs(MFI.getHasVAStartSaveXMMRegs()) {}
21
25
32
34 const yaml::X86MachineFunctionInfo &YamlMFI) {
35 AMXProgModel = YamlMFI.AMXProgModel;
36 ACEProgModel = YamlMFI.ACEProgModel;
37 HasVAStartSaveXMMRegs = YamlMFI.HasVAStartSaveXMMRegs;
38}
39
40void X86MachineFunctionInfo::anchor() { }
41
43 ACEProgModelEnum Model) {
44 // The two models configure the same tiles differently, so reject a mix once.
45 if (ACEProgModel != ACEProgModelEnum::ACE_None && ACEProgModel != Model) {
46 if (!ReportedACEProgModelMix) {
47 ReportedACEProgModelMix = true;
48 const Function &F = MF->getFunction();
49 F.getContext().diagnose(DiagnosticInfoUnsupported(
50 F, "ACE tile operations mix the macro and the managed programming "
51 "model; a function can use only one of them"));
52 }
53 return;
54 }
55 ACEProgModel = Model;
56}
57
59 if (!RestoreBasePointerOffset) {
60 const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
61 MF->getSubtarget().getRegisterInfo());
62 unsigned SlotSize = RegInfo->getSlotSize();
63 for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs();
64 unsigned Reg = *CSR; ++CSR) {
65 if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
66 RestoreBasePointerOffset -= SlotSize;
67 }
68 }
69}
70
#define F(x, y, z)
Definition MD5.cpp:54
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition Value.cpp:479
Diagnostic information for unsupported feature in backend.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * cloneInfo(const Ty &Old)
LLVM_ABI const MCPhysReg * getCalleeSavedRegs() const
Returns list of callee saved registers.
X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...
void setACEProgModel(const MachineFunction *MF, ACEProgModelEnum Model)
Record the ACE programming model of MF, reporting an error if it already uses the other one.
void setRestoreBasePointer(const MachineFunction *MF)
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
void initializeBaseYamlFields(const yaml::X86MachineFunctionInfo &YamlMFI)
unsigned getSlotSize() const
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:391
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
Definition YAMLTraits.h:63
void mappingImpl(yaml::IO &YamlIO) override