38#define DEBUG_TYPE "tileconfig"
47 StringRef getPassName()
const override {
return "Tile Register Configure"; }
69char X86TileConfig::ID = 0;
87 LiveIntervals &LIS = getAnalysis<LiveIntervalsWrapperPass>().getLIS();
88 VirtRegMap &VRM = getAnalysis<VirtRegMapWrapperLegacy>().getVRM();
90 if (VRM.isShapeMapEmpty())
96 if (
MI.getOpcode() == X86::PLDTILECFGV) {
97 SS =
MI.getOperand(0).getIndex();
110 unsigned ConstPos = 0;
113 if (MI.getOpcode() == X86::MOV8mi && SS == MI.getOperand(0).getIndex()) {
119 assert(ConstMI &&
"Cannot find an insertion point");
121 unsigned AMXRegNum =
TRI->getRegClass(X86::TILERegClassID)->getNumRegs();
123 for (
unsigned I = 0,
E =
MRI.getNumVirtRegs();
I !=
E; ++
I) {
125 if (
MRI.reg_nodbg_empty(VirtReg))
127 if (!
TRI->isTileRegisterClass(
MRI.getRegClass(VirtReg)))
132 unsigned Index = PhysReg - X86::TMM0;
133 if (!Phys2Virt[Index])
134 Phys2Virt[Index] = VirtReg;
138 for (
unsigned I = 0;
I < AMXRegNum; ++
I) {
144 ShapeT Shape = VRM.getShape(Phys2Virt[
I]);
163 int Offset = IsRow ? 48 +
I : 16 +
I * 2;
164 for (
auto &
DefMI :
MRI.def_instructions(R)) {
166 if (
DefMI.isMoveImmediate()) {
170 "Cannot initialize with different shapes");
176 BuildMI(MF.front(), ++ConstMI->getIterator(),
DL,
177 TII->get(IsRow ? X86::MOV8mi : X86::MOV16mi)),
181 LIS.InsertMachineInstrInMaps(*NewMI);
183 unsigned SubIdx = IsRow ? X86::sub_8bit : X86::sub_16bit;
184 unsigned RegSize =
TRI->getRegSizeInBits(*
MRI.getRegClass(R));
187 auto Iter =
DefMI.getIterator();
188 if (&
MBB == &MF.front() &&
189 (
unsigned)std::distance(
MBB.instr_begin(), Iter) < ConstPos)
190 Iter = ConstMI->getIterator();
193 TII->get(IsRow ? X86::MOV8mr : X86::MOV16mr)),
196 SlotIndex SIdx = LIS.InsertMachineInstrInMaps(*NewMI);
197 LIS.extendToIndices(LIS.getInterval(R), {SIdx.getRegSlot()});
unsigned const MachineRegisterInfo * MRI
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
FunctionPass class - This class is used to implement most global optimizations.
Wrapper class representing physical registers. Should be passed by value.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Properties which a MachineFunction may have at a given point in time.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Representation of each machine instruction.
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.
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
MachineOperand * getRow() const
MachineOperand * getCol() const
SlotIndex - An opaque wrapper around machine indexes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
TargetInstrInfo - Interface to description of machine instruction set.
X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...
AMXProgModelEnum getAMXProgModel() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
static const MachineInstrBuilder & addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset=0, bool mem=true)
addFrameReference - This function is used to add a reference to the base of an abstract object on the...
FunctionPass * createX86TileConfigPass()
Return a pass that config the tile registers.