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!");
57 : Row(nullptr), Col(nullptr), RowImm(InvalidImmShape),
58 ColImm(InvalidImmShape) {}
68 if (Row->
getReg() == R->getReg() && Col->
getReg() ==
C->getReg())
70 if ((RowImm != InvalidImmShape) && (ColImm != InvalidImmShape))
80 assert(Shapes.size() / 2 >=
I &&
"Get invalid row from id!");
87 assert(Shapes.size() / 2 >=
I &&
"Get invalid col from id!");
88 return Shapes[
I * 2 + 1];
92 if (ImmShapes.
empty())
94 assert(ImmShapes.
size() / 2 >=
I &&
"Get invalid imm row from id!");
95 return ImmShapes[
I * 2];
99 if (ImmShapes.
empty())
101 assert(ImmShapes.
size() / 2 >=
I &&
"Get invalid imm col from id!");
102 return ImmShapes[
I * 2 + 1];
109 return Shapes.size() / 2;
112 bool isValid() {
return (Row !=
nullptr) && (Col !=
nullptr); }
119 int64_t Imm = InvalidImmShape;
121 const auto *
MI = DefMO.getParent();
122 if (
MI->isMoveImmediate()) {
124 "Unsupported number of operands in instruction for setting "
126 if (
MI->getOperand(1).isImm()) {
127 Imm =
MI->getOperand(1).getImm();
129 assert(
MI->getOperand(1).isImplicit() &&
130 "Operand 1 is assumed to be implicit.");
138 if (Shapes.empty()) {
147 for (
auto *Shape : Shapes) {
148 int64_t ImmShape =
GetImm(Shape->getReg());
155 static constexpr int64_t InvalidImmShape = -1;
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool GetImm(MachineInstr *MI, unsigned Op, int64_t &Imm)
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.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.