38#define DEBUG_TYPE "tileconfig" 
   47  StringRef getPassName()
 const override { 
return "Tile Register Configure"; }
 
   69char X86TileConfig::ID = 0;
 
   78  if (
Reg.isVirtual()) {
 
   79    unsigned RegClassID = MRI->getRegClass(Reg)->getID();
 
   80    if (RegClassID == X86::TILERegClassID)
 
   82    if (RegClassID == X86::TILEPAIRRegClassID)
 
   85    if (Reg >= X86::TMM0 && Reg <= X86::TMM7)
 
   87    if (Reg >= X86::TMM0_TMM1 && Reg <= X86::TMM6_TMM7)
 
 
  102    unsigned Index = PhysReg - X86::TMM0;
 
  103    if (!Phys2Shapes[Index].
isValid()) {
 
  105      Phys2Shapes[Index] = std::move(Shape);
 
  112    unsigned Index0 = (PhysReg - X86::TMM0_TMM1) * 2;
 
  113    unsigned Index1 = (PhysReg - X86::TMM0_TMM1) * 2 + 1;
 
  118    if (!Phys2Shapes[Index0].
isValid()) {
 
  120      Phys2Shapes[Index0] = std::move(Shape0);
 
  123    if (!Phys2Shapes[Index1].
isValid()) {
 
  125      Phys2Shapes[Index1] = std::move(Shape1);
 
 
  135  X86MachineFunctionInfo *X86FI = MF.
getInfo<X86MachineFunctionInfo>();
 
  141  const TargetRegisterInfo *
TRI = 
ST.getRegisterInfo();
 
  142  const TargetInstrInfo *
TII = 
ST.getInstrInfo();
 
  144  LiveIntervals &LIS = getAnalysis<LiveIntervalsWrapperPass>().getLIS();
 
  145  VirtRegMap &VRM = getAnalysis<VirtRegMapWrapperLegacy>().getVRM();
 
  151  for (MachineBasicBlock &
MBB : MF) {
 
  152    for (MachineInstr &
MI : 
MBB) {
 
  153      if (
MI.getOpcode() == X86::PLDTILECFGV) {
 
  154        SS = 
MI.getOperand(0).getIndex();
 
  167  unsigned ConstPos = 0;
 
  168  MachineInstr *ConstMI = 
nullptr;
 
  169  for (MachineInstr &
MI : MF.front()) {
 
  170    if (
MI.getOpcode() == X86::MOV8mi && SS == 
MI.getOperand(0).getIndex()) {
 
  176  assert(ConstMI && 
"Cannot find an insertion point");
 
  178  unsigned AMXRegNum = 
TRI->getRegClass(X86::TILERegClassID)->getNumRegs();
 
  180  for (
unsigned I = 0, 
E = 
MRI.getNumVirtRegs(); 
I != 
E; ++
I) {
 
  181    Register VirtReg = Register::index2VirtReg(
I);
 
  182    if (
MRI.reg_nodbg_empty(VirtReg))
 
  190  for (
unsigned I = 0; 
I < AMXRegNum; ++
I) {
 
  191    ShapeT Shape = Phys2Shapes[
I];
 
  196    MachineInstr *NewMI = 
nullptr;
 
  215      int Offset = IsRow ? 48 + 
I : 16 + 
I * 2;
 
  216      for (
auto &
DefMI : 
MRI.def_instructions(R)) {
 
  217        MachineBasicBlock &
MBB = *
DefMI.getParent();
 
  218        if (
DefMI.isMoveImmediate()) {
 
  222                   "Cannot initialize with different shapes");
 
  225          if (
DefMI.getOperand(1).isImm()) {
 
  229                   "The opcode is assumed to be MOV32r0 if the operand is not " 
  236                              TII->get(IsRow ? X86::MOV8mi : X86::MOV16mi)),
 
  242          unsigned SubIdx = IsRow ? X86::sub_8bit : X86::sub_16bit;
 
  243          unsigned RegSize = 
TRI->getRegSizeInBits(*
MRI.getRegClass(R));
 
  246          auto Iter = 
DefMI.getIterator();
 
  252                              TII->get(IsRow ? X86::MOV8mr : X86::MOV16mr)),
 
unsigned const MachineRegisterInfo * MRI
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
Promote Memory to Register
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static bool isValid(const char C)
Returns true if C is a valid mangled character: <0-9a-zA-Z_>.
Tile Register false unsigned getAMXRegNum(MachineRegisterInfo *MRI, Register Reg)
static void collectVirtRegShapes(MachineRegisterInfo *MRI, VirtRegMap &VRM, Register VirtReg, SmallVector< ShapeT, 8 > &Phys2Shapes)
static bool isAMXRegClass(MachineRegisterInfo *MRI, Register Reg)
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.
SlotIndex InsertMachineInstrInMaps(MachineInstr &MI)
LiveInterval & getInterval(Register Reg)
LLVM_ABI void extendToIndices(LiveRange &LR, ArrayRef< SlotIndex > Indices, ArrayRef< SlotIndex > Undefs)
Extend the live range LR to reach all points in Indices.
Wrapper class representing physical registers. Should be passed by value.
instr_iterator instr_begin()
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 TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
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.
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.
MachineOperand * getRow(unsigned I=0) const
MachineOperand * getCol(unsigned I=0) const
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.
ShapeT getShape(Register virtReg) const
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
bool isShapeMapEmpty() const
AMXProgModelEnum getAMXProgModel() const
self_iterator getIterator()
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.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...