LLVM 19.0.0git
PPCRegisterBankInfo.h
Go to the documentation of this file.
1//===-- PPCRegisterBankInfo.h -----------------------------------*- C++ -*-===//
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/// \file
10/// This file declares the targeting of the RegisterBankInfo class for PowerPC.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_PPC_GISEL_PPCREGISTERBANKINFO_H
15#define LLVM_LIB_TARGET_PPC_GISEL_PPCREGISTERBANKINFO_H
16
20
21#define GET_REGBANK_DECLARATIONS
22#include "PPCGenRegisterBank.inc"
23
24namespace llvm {
25class TargetRegisterInfo;
26
28protected:
36 PMI_CR = 6,
38 };
39
43
44 /// Get the pointer to the ValueMapping representing the RegisterBank
45 /// at \p RBIdx.
46 ///
47 /// The returned mapping works for instructions with the same kind of
48 /// operands for up to 3 operands.
49 ///
50 /// \pre \p RBIdx != PartialMappingIdx::None
53
54 /// Get the pointer to the ValueMapping of the operands of a copy
55 /// instruction from the \p SrcBankID register bank to the \p DstBankID
56 /// register bank with a size of \p Size.
58 getCopyMapping(unsigned DstBankID, unsigned SrcBankID, unsigned Size);
59
60#define GET_TARGET_REGBANK_CLASS
61#include "PPCGenRegisterBank.inc"
62};
63
65public:
67
69 LLT Ty) const override;
70 const InstructionMapping &
71 getInstrMapping(const MachineInstr &MI) const override;
72
74 getInstrAlternativeMappings(const MachineInstr &MI) const override;
75
76private:
77 /// Maximum recursion depth for hasFPConstraints.
78 const unsigned MaxFPRSearchDepth = 2;
79
80 /// \returns true if \p MI only uses and defines FPRs.
81 bool hasFPConstraints(const MachineInstr &MI, const MachineRegisterInfo &MRI,
83 unsigned Depth = 0) const;
84
85 /// \returns true if \p MI only uses FPRs.
86 bool onlyUsesFP(const MachineInstr &MI, const MachineRegisterInfo &MRI,
87 const TargetRegisterInfo &TRI, unsigned Depth = 0) const;
88
89 /// \returns true if \p MI only defines FPRs.
90 bool onlyDefinesFP(const MachineInstr &MI, const MachineRegisterInfo &MRI,
91 const TargetRegisterInfo &TRI, unsigned Depth = 0) const;
92};
93} // namespace llvm
94
95#endif
unsigned const MachineRegisterInfo * MRI
uint64_t Size
IRTranslator LLVM IR MI
unsigned const TargetRegisterInfo * TRI
Representation of each machine instruction.
Definition: MachineInstr.h:69
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
static const RegisterBankInfo::ValueMapping ValMappings[]
static const RegisterBankInfo::ValueMapping * getCopyMapping(unsigned DstBankID, unsigned SrcBankID, unsigned Size)
Get the pointer to the ValueMapping of the operands of a copy instruction from the SrcBankID register...
static const PartialMappingIdx BankIDToCopyMapIdx[]
static const RegisterBankInfo::PartialMapping PartMappings[]
static const RegisterBankInfo::ValueMapping * getValueMapping(PartialMappingIdx RBIdx)
Get the pointer to the ValueMapping representing the RegisterBank at RBIdx.
const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC, LLT Ty) const override
Get a register bank that covers RC.
InstructionMappings getInstrAlternativeMappings(const MachineInstr &MI) const override
Get the alternative mappings for MI.
const InstructionMapping & getInstrMapping(const MachineInstr &MI) const override
Get the mapping of the different operands of MI on the register bank.
Helper class that represents how the value of an instruction may be mapped and what is the related co...
Holds all the information related to register banks.
This class implements the register bank concept.
Definition: RegisterBank.h:28
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Helper struct that represents how a value is partially mapped into a register.
Helper struct that represents how a value is mapped through different register banks.