Path: blob/main/contrib/llvm-project/llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.h
96382 views
//===-- PPCRegisterBankInfo.h -----------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file declares the targeting of the RegisterBankInfo class for PowerPC.10///11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_PPC_GISEL_PPCREGISTERBANKINFO_H14#define LLVM_LIB_TARGET_PPC_GISEL_PPCREGISTERBANKINFO_H1516#include "llvm/CodeGen/RegisterBank.h"17#include "llvm/CodeGen/RegisterBankInfo.h"18#include "llvm/CodeGen/TargetRegisterInfo.h"1920#define GET_REGBANK_DECLARATIONS21#include "PPCGenRegisterBank.inc"2223namespace llvm {24class TargetRegisterInfo;2526class PPCGenRegisterBankInfo : public RegisterBankInfo {27protected:28enum PartialMappingIdx {29PMI_None = -1,30PMI_GPR32 = 1,31PMI_GPR64 = 2,32PMI_FPR32 = 3,33PMI_FPR64 = 4,34PMI_VEC128 = 5,35PMI_CR = 6,36PMI_Min = PMI_GPR32,37};3839static const RegisterBankInfo::PartialMapping PartMappings[];40static const RegisterBankInfo::ValueMapping ValMappings[];41static const PartialMappingIdx BankIDToCopyMapIdx[];4243/// Get the pointer to the ValueMapping representing the RegisterBank44/// at \p RBIdx.45///46/// The returned mapping works for instructions with the same kind of47/// operands for up to 3 operands.48///49/// \pre \p RBIdx != PartialMappingIdx::None50static const RegisterBankInfo::ValueMapping *51getValueMapping(PartialMappingIdx RBIdx);5253/// Get the pointer to the ValueMapping of the operands of a copy54/// instruction from the \p SrcBankID register bank to the \p DstBankID55/// register bank with a size of \p Size.56static const RegisterBankInfo::ValueMapping *57getCopyMapping(unsigned DstBankID, unsigned SrcBankID, unsigned Size);5859#define GET_TARGET_REGBANK_CLASS60#include "PPCGenRegisterBank.inc"61};6263class PPCRegisterBankInfo final : public PPCGenRegisterBankInfo {64public:65PPCRegisterBankInfo(const TargetRegisterInfo &TRI);6667const RegisterBank &getRegBankFromRegClass(const TargetRegisterClass &RC,68LLT Ty) const override;69const InstructionMapping &70getInstrMapping(const MachineInstr &MI) const override;7172InstructionMappings73getInstrAlternativeMappings(const MachineInstr &MI) const override;7475private:76/// Maximum recursion depth for hasFPConstraints.77const unsigned MaxFPRSearchDepth = 2;7879/// \returns true if \p MI only uses and defines FPRs.80bool hasFPConstraints(const MachineInstr &MI, const MachineRegisterInfo &MRI,81const TargetRegisterInfo &TRI,82unsigned Depth = 0) const;8384/// \returns true if \p MI only uses FPRs.85bool onlyUsesFP(const MachineInstr &MI, const MachineRegisterInfo &MRI,86const TargetRegisterInfo &TRI, unsigned Depth = 0) const;8788/// \returns true if \p MI only defines FPRs.89bool onlyDefinesFP(const MachineInstr &MI, const MachineRegisterInfo &MRI,90const TargetRegisterInfo &TRI, unsigned Depth = 0) const;91};92} // namespace llvm9394#endif959697