21 #define GET_TARGET_REGBANK_IMPL
22 #include "X86GenRegisterBank.inc"
26 #define GET_TARGET_REGBANK_INFO_IMPL
27 #include "X86GenRegisterBankInfo.def"
29 #ifndef LLVM_BUILD_GLOBAL_ISEL
30 #error "You shouldn't build this"
39 assert(&X86::GPRRegBank == &RBGPR &&
"Incorrect RegBanks inizalization.");
44 "Subclass not added?");
45 assert(RBGPR.
getSize() == 64 &&
"GPRs should hold up to 64-bit");
51 if (X86::GR8RegClass.hasSubClassEq(&RC) ||
52 X86::GR16RegClass.hasSubClassEq(&RC) ||
53 X86::GR32RegClass.hasSubClassEq(&RC) ||
54 X86::GR64RegClass.hasSubClassEq(&RC))
57 if (X86::FR32XRegClass.hasSubClassEq(&RC) ||
58 X86::FR64XRegClass.hasSubClassEq(&RC) ||
59 X86::VR128XRegClass.hasSubClassEq(&RC) ||
60 X86::VR256XRegClass.hasSubClassEq(&RC) ||
61 X86::VR512RegClass.hasSubClassEq(&RC))
109 void X86RegisterBankInfo::getInstrPartialMappingIdxs(
114 for (
unsigned Idx = 0; Idx < NumOperands; ++Idx) {
123 bool X86RegisterBankInfo::getInstrValueMapping(
129 for (
unsigned Idx = 0; Idx < NumOperands; ++Idx) {
134 if (!Mapping->isValid())
137 OpdsMapping[Idx] = Mapping;
143 X86RegisterBankInfo::getSameOperandsMapping(
const MachineInstr &MI,
174 case TargetOpcode::G_ADD:
175 case TargetOpcode::G_SUB:
176 return getSameOperandsMapping(MI,
false);
178 case TargetOpcode::G_FADD:
179 case TargetOpcode::G_FSUB:
180 case TargetOpcode::G_FMUL:
181 case TargetOpcode::G_FDIV:
182 return getSameOperandsMapping(MI,
true);
192 getInstrPartialMappingIdxs(MI, MRI,
false, OpRegBankIdx);
196 if (!getInstrValueMapping(MI, OpRegBankIdx, OpdsMapping))
217 case TargetOpcode::G_LOAD:
218 case TargetOpcode::G_STORE: {
221 if (Size != 32 && Size != 64)
228 getInstrPartialMappingIdxs(MI, MRI,
true, OpRegBankIdx);
232 if (!getInstrValueMapping(MI, OpRegBankIdx, OpdsMapping))
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
InstructionMappings getInstrAlternativeMappings(const MachineInstr &MI) const override
Get the alternative mappings for MI.
const InstructionMapping & getInvalidInstructionMapping() const
Method to get a uniquely generated invalid InstructionMapping.
const InstructionMapping & getInstructionMapping(unsigned ID, unsigned Cost, const ValueMapping *OperandsMapping, unsigned NumOperands) const
Method to get a uniquely generated InstructionMapping.
LLT getType(unsigned VReg) const
Get the low-level type of VReg or LLT{} if VReg is not a generic (target independent) virtual registe...
Helper class that represents how the value of an instruction may be mapped and what is the related co...
X86RegisterBankInfo(const TargetRegisterInfo &TRI)
Helper class used to get/create the virtual registers that will be used to replace the MachineOperand...
const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC) const override
Get a register bank that covers RC.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
static PartialMappingIdx getPartialMappingIdx(const LLT &Ty, bool isFP)
unsigned getNumOperands() const
Access to explicit operands of the instruction.
virtual InstructionMappings getInstrAlternativeMappings(const MachineInstr &MI) const
Get the alternative mappings for MI.
const ValueMapping * getOperandsMapping(Iterator Begin, Iterator End) const
Get the uniquely generated array of ValueMapping for the elements of between Begin and End...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
static const RegisterBankInfo::ValueMapping * getValueMapping(PartialMappingIdx Idx, unsigned NumOperands)
unsigned const MachineRegisterInfo * MRI
static unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI)
Get the size in bits of Reg.
const MachineOperand & getOperand(unsigned i) const
static const unsigned DefaultMappingID
Identifier used when the related instruction mapping instance is generated by target independent code...
void applyMappingImpl(const OperandsMapper &OpdMapper) const override
See RegisterBankInfo::applyMapping.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This file declares the targeting of the RegisterBankInfo class for X86.
RegisterBank & getRegBank(unsigned ID)
Get the register bank identified by ID.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static void applyDefaultMapping(const OperandsMapper &OpdMapper)
Helper method to apply something that is like the default mapping.
This class implements the register bank concept.
static bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel...
bool isValid() const
Check whether this object is valid.
const InstructionMapping & getInstrMapping(const MachineInstr &MI) const override
Get the mapping of the different operands of MI on the register bank.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
TargetSubtargetInfo - Generic base class for all target subtargets.
Representation of each machine instruction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
unsigned getSize() const
Get the maximal size in bits that fits in this register bank.
bool covers(const TargetRegisterClass &RC) const
Check whether this register bank covers RC.
unsigned getReg() const
getReg - Returns the register number.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const InstructionMapping & getInstrMappingImpl(const MachineInstr &MI) const
Try to get the mapping of MI.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.