Path: blob/main/contrib/llvm-project/llvm/lib/Target/X86/GISel/X86RegisterBankInfo.h
96385 views
//===- X86RegisterBankInfo ---------------------------------------*- 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/// \file8/// This file declares the targeting of the RegisterBankInfo class for X86.9/// \todo This should be generated by TableGen.10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_X86_X86REGISTERBANKINFO_H13#define LLVM_LIB_TARGET_X86_X86REGISTERBANKINFO_H1415#include "llvm/CodeGen/RegisterBankInfo.h"1617#define GET_REGBANK_DECLARATIONS18#include "X86GenRegisterBank.inc"1920namespace llvm {2122class LLT;2324class X86GenRegisterBankInfo : public RegisterBankInfo {25protected:26#define GET_TARGET_REGBANK_CLASS27#include "X86GenRegisterBank.inc"28#define GET_TARGET_REGBANK_INFO_CLASS29#include "X86GenRegisterBankInfo.def"3031static RegisterBankInfo::PartialMapping PartMappings[];32static RegisterBankInfo::ValueMapping ValMappings[];3334static PartialMappingIdx getPartialMappingIdx(const MachineInstr &MI,35const LLT &Ty, bool isFP);36static const RegisterBankInfo::ValueMapping *37getValueMapping(PartialMappingIdx Idx, unsigned NumOperands);38};3940class TargetRegisterInfo;4142/// This class provides the information for the target register banks.43class X86RegisterBankInfo final : public X86GenRegisterBankInfo {44private:45/// Get an instruction mapping.46/// \return An InstructionMappings with a statically allocated47/// OperandsMapping.48const InstructionMapping &getSameOperandsMapping(const MachineInstr &MI,49bool isFP) const;5051/// Track the bank of each instruction operand(register)52static void53getInstrPartialMappingIdxs(const MachineInstr &MI,54const MachineRegisterInfo &MRI, const bool isFP,55SmallVectorImpl<PartialMappingIdx> &OpRegBankIdx);5657/// Construct the instruction ValueMapping from PartialMappingIdxs58/// \return true if mapping succeeded.59static bool60getInstrValueMapping(const MachineInstr &MI,61const SmallVectorImpl<PartialMappingIdx> &OpRegBankIdx,62SmallVectorImpl<const ValueMapping *> &OpdsMapping);6364// Maximum recursion depth for hasFPConstraints.65const unsigned MaxFPRSearchDepth = 2;6667/// \returns true if \p MI only uses and defines FPRs.68bool hasFPConstraints(const MachineInstr &MI, const MachineRegisterInfo &MRI,69const TargetRegisterInfo &TRI,70unsigned Depth = 0) const;7172/// \returns true if \p MI only uses FPRs.73bool onlyUsesFP(const MachineInstr &MI, const MachineRegisterInfo &MRI,74const TargetRegisterInfo &TRI, unsigned Depth = 0) const;7576/// \returns true if \p MI only defines FPRs.77bool onlyDefinesFP(const MachineInstr &MI, const MachineRegisterInfo &MRI,78const TargetRegisterInfo &TRI, unsigned Depth = 0) const;7980public:81X86RegisterBankInfo(const TargetRegisterInfo &TRI);8283const RegisterBank &getRegBankFromRegClass(const TargetRegisterClass &RC,84LLT) const override;8586InstructionMappings87getInstrAlternativeMappings(const MachineInstr &MI) const override;8889/// See RegisterBankInfo::applyMapping.90void applyMappingImpl(MachineIRBuilder &Builder,91const OperandsMapper &OpdMapper) const override;9293const InstructionMapping &94getInstrMapping(const MachineInstr &MI) const override;95};9697} // namespace llvm98#endif99100101