24 #define GET_TARGET_REGBANK_IMPL
25 #include "AMDGPUGenRegisterBank.inc"
28 #include "AMDGPUGenRegisterBankInfo.def"
32 #ifndef LLVM_BUILD_GLOBAL_ISEL
33 #error "You shouldn't build this"
41 static bool AlreadyInit =
false;
49 assert(&RBSGPR == &AMDGPU::SGPRRegBank);
53 assert(&RBVGPR == &AMDGPU::VGPRRegBank);
59 unsigned Size)
const {
83 case TargetOpcode::G_LOAD: {
90 AltMappings.push_back(&SSMapping);
97 AltMappings.push_back(&VVMapping);
106 AltMappings.push_back(&VSMapping);
117 void AMDGPURegisterBankInfo::applyMappingImpl(
131 AMDGPURegisterBankInfo::getInstrMappingForLoad(
const MachineInstr &
MI)
const {
152 OpdsMapping[0] = ValMapping;
153 OpdsMapping[1] = PtrMapping;
173 bool IsComplete =
true;
178 case AMDGPU::G_CONSTANT: {
183 case AMDGPU::G_GEP: {
193 case AMDGPU::G_STORE: {
206 OpdsMapping[0] = ValMapping;
207 OpdsMapping[1] = PtrMapping;
212 return getInstrMappingForLoad(MI);
const InstructionMapping & getInstrMapping(const MachineInstr &MI) const override
Get the mapping of the different operands of MI on the register bank.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
virtual unsigned copyCost(const RegisterBank &A, const RegisterBank &B, unsigned Size) const
Get the cost of a copy from B to A, or put differently, get the cost of A = COPY B.
Interface definition for SIRegisterInfo.
const InstructionMapping & getInstructionMapping(unsigned ID, unsigned Cost, const ValueMapping *OperandsMapping, unsigned NumOperands) const
Method to get a uniquely generated InstructionMapping.
This file declares the targeting of the RegisterBankInfo class for AMDGPU.
LLT getType(unsigned VReg) const
Get the low-level type of VReg or LLT{} if VReg is not a generic (target independent) virtual registe...
const ValueMapping & getValueMapping(unsigned StartIdx, unsigned Length, const RegisterBank &RegBank) const
The most common ValueMapping consists of a single PartialMapping.
Helper class that represents how the value of an instruction may be mapped and what is the related co...
bool isSGPRClass(const TargetRegisterClass *RC) const
unsigned copyCost(const RegisterBank &A, const RegisterBank &B, unsigned Size) const override
Get the cost of a copy from B to A, or put differently, get the cost of A = COPY B.
A description of a memory reference used in the backend.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
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 bool isInstrUniform(const MachineInstr &MI)
unsigned const MachineRegisterInfo * MRI
static unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI)
Get the size in bits of Reg.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MachineOperand & getOperand(unsigned i) const
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Helper class used to get/create the virtual registers that will be used to replace the MachineOperand...
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.
Helper struct that represents how a value is mapped through different register banks.
AMDGPURegisterBankInfo(const TargetRegisterInfo &TRI)
bool isValid() const
Check whether this object is valid.
InstructionMappings getInstrAlternativeMappings(const MachineInstr &MI) const override
Get the alternative mappings for MI.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Contains the definition of a TargetInstrInfo class that is common to all AMD GPUs.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC) const override
Get a register bank that covers RC.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool isUniformMMO(const MachineMemOperand *MMO)
This class provides the information for the target register banks.
Helper struct that represents how a value is mapped through different register banks.
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.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.