19#ifndef LLVM_CODEGEN_TILESHAPEINFO_H
20#define LLVM_CODEGEN_TILESHAPEINFO_H
33 : Row(Row), Col(Col) {
47 : Row(nullptr), Col(nullptr), RowImm(InvalidImmShape),
48 ColImm(InvalidImmShape) {
49 assert(ShapesOperands.
size() % 2 == 0 &&
"Miss row or col!");
51 for (
auto *Shape : ShapesOperands)
52 Shapes.push_back(Shape);
58 : Row(nullptr), Col(nullptr), RowImm(InvalidImmShape),
59 ColImm(InvalidImmShape) {}
69 if (Row->
getReg() == R->getReg() && Col->
getReg() ==
C->getReg())
71 if ((RowImm != InvalidImmShape) && (ColImm != InvalidImmShape))
81 assert(Shapes.size() / 2 >=
I &&
"Get invalid row from id!");
88 assert(Shapes.size() / 2 >=
I &&
"Get invalid col from id!");
89 return Shapes[
I * 2 + 1];
93 if (ImmShapes.
empty())
95 assert(ImmShapes.
size() / 2 >=
I &&
"Get invalid imm row from id!");
96 return ImmShapes[
I * 2];
100 if (ImmShapes.
empty())
102 assert(ImmShapes.
size() / 2 >=
I &&
"Get invalid imm col from id!");
103 return ImmShapes[
I * 2 + 1];
110 return Shapes.size() / 2;
113 bool isValid() {
return (Row !=
nullptr) && (Col !=
nullptr); }
120 int64_t Imm = InvalidImmShape;
122 const auto *
MI = DefMO.getParent();
123 if (
MI->isMoveImmediate()) {
125 "Unsupported number of operands in instruction for setting "
127 if (
MI->getOperand(1).isImm()) {
128 Imm =
MI->getOperand(1).getImm();
130 assert(
MI->getOperand(1).isImplicit() &&
131 "Operand 1 is assumed to be implicit.");
139 if (Shapes.empty()) {
148 for (
auto *Shape : Shapes) {
149 int64_t ImmShape =
GetImm(Shape->getReg());
156 static constexpr int64_t InvalidImmShape = -1;
unsigned const MachineRegisterInfo * MRI
static bool GetImm(MachineInstr *MI, unsigned Op, int64_t &Imm)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
int64_t getColImm(unsigned I=0) const
void deduceImm(const MachineRegisterInfo *MRI)
ShapeT(ArrayRef< MachineOperand * > ShapesOperands, const MachineRegisterInfo *MRI=nullptr)
int64_t getRowImm(unsigned I=0) const
ShapeT(MachineOperand *Row, MachineOperand *Col, const MachineRegisterInfo *MRI=nullptr)
bool operator!=(const ShapeT &Shape) const
MachineOperand * getRow(unsigned I=0) const
bool operator==(const ShapeT &Shape) const
MachineOperand * getCol(unsigned I=0) const
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.