34#define DEBUG_TYPE "x86-fast-tile-config"
38class X86FastTileConfigImpl {
59 return "Fast Tile Register Configure";
79char X86FastTileConfigLegacy::ID = 0;
82 "Fast Tile Register Configure",
false,
false)
91 if (
MI.isDebugInstr() ||
MI.isCopy() ||
MI.getNumOperands() < 3 ||
100 if (
Reg.isVirtual()) {
101 if (MRI->getRegClass(
Reg)->getID() == X86::TILERegClassID)
104 if (
Reg >= X86::TMM0 &&
Reg <= X86::TMM7)
112 if (
Reg >= X86::TMM0 &&
Reg <= X86::TMM7)
113 return Reg - X86::TMM0;
123 if (!
isTileDef(MRI,
MI) &&
MI.getOpcode() != X86::PLDTILECFGV)
126 if (
MI.getOpcode() != X86::PLDTILECFGV) {
127 MachineOperand &Row =
MI.getOperand(1);
129 MachineOperand &Col =
MI.getOperand(2);
130 ShapeInfos.
push_back({TMMIdx, ShapeT(&Row, &Col)});
134 int SS =
MI.getOperand(0).getIndex();
135 for (
auto &ShapeInfo : ShapeInfos) {
137 unsigned TMMIdx = ShapeInfo.first;
138 Register RowReg = ShapeInfo.second.getRow()->getReg();
139 Register ColReg = ShapeInfo.second.getCol()->getReg();
156 int RowOffset = 48 + TMMIdx;
157 int ColOffset = 16 + TMMIdx * 2;
159 Register SubRowReg =
TRI->getSubReg(RowReg, X86::sub_8bit);
161 MachineInstrBuilder StoreRow =
165 MachineInstrBuilder StoreCol =
177bool X86FastTileConfigImpl::runOnMachineFunction(MachineFunction &MFunc) {
178 X86FI = MFunc.
getInfo<X86MachineFunctionInfo>();
185 const TargetSubtargetInfo *
ST = &MFunc.
getSubtarget<X86Subtarget>();
186 TRI =
ST->getRegisterInfo();
191 for (MachineBasicBlock &
MBB : MFunc)
192 Change |= configBasicBlock(
MBB);
198 return new X86FastTileConfigLegacy();
201bool X86FastTileConfigLegacy::runOnMachineFunction(
MachineFunction &MF) {
202 X86FastTileConfigImpl Impl;
203 return Impl.runOnMachineFunction(MF);
209 X86FastTileConfigImpl Impl;
210 Impl.runOnMachineFunction(MF);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
Promote Memory to Register
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static bool isTileDef(MachineRegisterInfo *MRI, MachineInstr &MI)
static unsigned getTMMIndex(Register Reg)
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
Represents analyses that only rely on functions' control flow.
FunctionPass class - This class is used to implement most global optimizations.
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 & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Wrapper class representing virtual and physical registers.
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetInstrInfo * getInstrInfo() const
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...
AMXProgModelEnum getAMXProgModel() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createX86FastTileConfigLegacyPass()
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...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
auto reverse(ContainerTy &&C)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...