46 #define GET_INSTRINFO_CTOR_DTOR
47 #include "AMDGPUGenDFAPacketizer.inc"
59 unsigned SrcReg,
bool KillSrc)
const {
60 unsigned VectorComponents = 0;
61 if ((AMDGPU::R600_Reg128RegClass.
contains(DestReg) ||
62 AMDGPU::R600_Reg128VerticalRegClass.
contains(DestReg)) &&
63 (AMDGPU::R600_Reg128RegClass.
contains(SrcReg) ||
64 AMDGPU::R600_Reg128VerticalRegClass.
contains(SrcReg))) {
66 }
else if((AMDGPU::R600_Reg64RegClass.
contains(DestReg) ||
67 AMDGPU::R600_Reg64VerticalRegClass.
contains(DestReg)) &&
68 (AMDGPU::R600_Reg64RegClass.
contains(SrcReg) ||
69 AMDGPU::R600_Reg64VerticalRegClass.
contains(SrcReg))) {
73 if (VectorComponents > 0) {
74 for (
unsigned I = 0;
I < VectorComponents;
I++) {
77 RI.getSubReg(DestReg, SubRegIndex),
78 RI.getSubReg(SrcReg, SubRegIndex))
94 E = MBBI->operands_end();
I !=
E; ++
I) {
107 case AMDGPU::MOV_IMM_F32:
108 case AMDGPU::MOV_IMM_I32:
119 default:
return false;
120 case AMDGPU::CUBE_r600_pseudo:
121 case AMDGPU::CUBE_r600_real:
122 case AMDGPU::CUBE_eg_pseudo:
123 case AMDGPU::CUBE_eg_real:
161 case AMDGPU::INTERP_PAIR_XY:
162 case AMDGPU::INTERP_PAIR_ZW:
163 case AMDGPU::INTERP_VEC_LOAD:
175 return (
get(Opcode).getSchedClass() == AMDGPU::Sched::TransALU);
183 return (
get(Opcode).getSchedClass() == AMDGPU::Sched::VecALU);
218 case AMDGPU::GROUP_BARRIER:
240 if (!
I->isReg() || !
I->isUse() ||
244 if (AMDGPU::R600_LDS_SRC_REGRegClass.
contains(
I->getReg()))
251 static const unsigned SrcSelTable[][2] = {
252 {AMDGPU::OpName::src0, AMDGPU::OpName::src0_sel},
253 {AMDGPU::OpName::src1, AMDGPU::OpName::src1_sel},
254 {AMDGPU::OpName::src2, AMDGPU::OpName::src2_sel},
255 {AMDGPU::OpName::src0_X, AMDGPU::OpName::src0_sel_X},
256 {AMDGPU::OpName::src0_Y, AMDGPU::OpName::src0_sel_Y},
257 {AMDGPU::OpName::src0_Z, AMDGPU::OpName::src0_sel_Z},
258 {AMDGPU::OpName::src0_W, AMDGPU::OpName::src0_sel_W},
259 {AMDGPU::OpName::src1_X, AMDGPU::OpName::src1_sel_X},
260 {AMDGPU::OpName::src1_Y, AMDGPU::OpName::src1_sel_Y},
261 {AMDGPU::OpName::src1_Z, AMDGPU::OpName::src1_sel_Z},
262 {AMDGPU::OpName::src1_W, AMDGPU::OpName::src1_sel_W}
265 for (
const auto &Row : SrcSelTable) {
278 static const unsigned OpTable[8][2] = {
279 {AMDGPU::OpName::src0_X, AMDGPU::OpName::src0_sel_X},
280 {AMDGPU::OpName::src0_Y, AMDGPU::OpName::src0_sel_Y},
281 {AMDGPU::OpName::src0_Z, AMDGPU::OpName::src0_sel_Z},
282 {AMDGPU::OpName::src0_W, AMDGPU::OpName::src0_sel_W},
283 {AMDGPU::OpName::src1_X, AMDGPU::OpName::src1_sel_X},
284 {AMDGPU::OpName::src1_Y, AMDGPU::OpName::src1_sel_Y},
285 {AMDGPU::OpName::src1_Z, AMDGPU::OpName::src1_sel_Z},
286 {AMDGPU::OpName::src1_W, AMDGPU::OpName::src1_sel_W},
289 for (
unsigned j = 0; j < 8; j++) {
293 if (Reg == AMDGPU::ALU_CONST) {
304 static const unsigned OpTable[3][2] = {
305 {AMDGPU::OpName::src0, AMDGPU::OpName::src0_sel},
306 {AMDGPU::OpName::src1, AMDGPU::OpName::src1_sel},
307 {AMDGPU::OpName::src2, AMDGPU::OpName::src2_sel},
310 for (
unsigned j = 0; j < 3; j++) {
316 if (Reg == AMDGPU::ALU_CONST) {
322 if (Reg == AMDGPU::ALU_LITERAL_X) {
325 if (Operand.
isImm()) {
331 Result.
push_back(std::make_pair(&MO, 0));
336 std::vector<std::pair<int, unsigned>>
339 unsigned &ConstCount)
const {
341 const std::pair<int, unsigned> DummyPair(-1, 0);
342 std::vector<std::pair<int, unsigned>> Result;
344 for (
const auto &Src :
getSrcs(MI)) {
346 unsigned Reg = Src.first->getReg();
347 int Index = RI.getEncodingValue(Reg) & 0xff;
348 if (Reg == AMDGPU::OQAP) {
349 Result.push_back(std::make_pair(Index, 0U));
351 if (PV.
find(Reg) != PV.
end()) {
353 Result.push_back(std::make_pair(255, 0U));
358 Result.push_back(DummyPair);
362 Result.push_back(std::make_pair(Index, Chan));
365 Result.push_back(DummyPair);
369 static std::vector<std::pair<int, unsigned>>
370 Swizzle(std::vector<std::pair<int, unsigned>> Src,
372 if (Src[0] == Src[1])
401 unsigned Cycles[3] = { 2, 1, 0};
405 unsigned Cycles[3] = { 1, 2, 2};
409 unsigned Cycles[3] = { 2, 1, 2};
413 unsigned Cycles[3] = { 2, 2, 1};
425 const std::vector<std::vector<std::pair<int, unsigned>>> &IGSrcs,
426 const std::vector<R600InstrInfo::BankSwizzle> &Swz,
427 const std::vector<std::pair<int, unsigned>> &TransSrcs,
430 memset(Vector, -1,
sizeof(Vector));
431 for (
unsigned i = 0, e = IGSrcs.size(); i < e; i++) {
432 const std::vector<std::pair<int, unsigned>> &Srcs =
434 for (
unsigned j = 0; j < 3; j++) {
435 const std::pair<int, unsigned> &Src = Srcs[j];
436 if (Src.first < 0 || Src.first == 255)
438 if (Src.first ==
GET_REG_INDEX(RI.getEncodingValue(AMDGPU::OQAP))) {
448 if (Vector[Src.second][j] < 0)
449 Vector[Src.second][j] = Src.first;
450 if (Vector[Src.second][j] != Src.first)
455 for (
unsigned i = 0, e = TransSrcs.size(); i < e; ++i) {
456 const std::pair<int, unsigned> &Src = TransSrcs[i];
460 if (Src.first == 255)
462 if (Vector[Src.second][Cycle] < 0)
463 Vector[Src.second][Cycle] = Src.first;
464 if (Vector[Src.second][Cycle] != Src.first)
465 return IGSrcs.size() - 1;
467 return IGSrcs.size();
475 std::vector<R600InstrInfo::BankSwizzle> &SwzCandidate,
477 assert(Idx < SwzCandidate.size());
481 for (
unsigned i = ResetIdx + 1, e = SwzCandidate.size(); i < e; i++) {
486 int NextSwizzle = SwzCandidate[ResetIdx] + 1;
494 const std::vector<std::vector<std::pair<int, unsigned>>> &IGSrcs,
495 std::vector<R600InstrInfo::BankSwizzle> &SwzCandidate,
496 const std::vector<std::pair<int, unsigned>> &TransSrcs,
498 unsigned ValidUpTo = 0;
500 ValidUpTo =
isLegalUpTo(IGSrcs, SwzCandidate, TransSrcs, TransSwz);
501 if (ValidUpTo == IGSrcs.size())
511 const std::vector<std::pair<int, unsigned>> &TransOps,
512 unsigned ConstCount) {
516 for (
unsigned i = 0, e = TransOps.size(); i < e; ++i) {
517 const std::pair<int, unsigned> &Src = TransOps[i];
521 if (ConstCount > 0 && Cycle == 0)
523 if (ConstCount > 1 && Cycle == 1)
532 std::vector<BankSwizzle> &ValidSwizzle,
537 std::vector<std::vector<std::pair<int, unsigned>>> IGSrcs;
538 ValidSwizzle.clear();
541 for (
unsigned i = 0, e = IG.size(); i < e; ++i) {
542 IGSrcs.push_back(ExtractSrcs(*IG[i], PV, ConstCount));
544 AMDGPU::OpName::bank_swizzle);
546 IG[i]->getOperand(Op).getImm());
548 std::vector<std::pair<int, unsigned>> TransOps;
552 TransOps = std::move(IGSrcs.back());
554 ValidSwizzle.pop_back();
562 for (
unsigned i = 0; i < 4; i++) {
563 TransBS = TransSwz[i];
569 ValidSwizzle.push_back(TransBS);
580 assert (Consts.size() <= 12 &&
"Too many operands in instructions group");
581 unsigned Pair1 = 0, Pair2 = 0;
582 for (
unsigned i = 0, n = Consts.size(); i < n; ++i) {
583 unsigned ReadConstHalf = Consts[i] & 2;
584 unsigned ReadConstIndex = Consts[i] & (~3);
585 unsigned ReadHalfConst = ReadConstIndex | ReadConstHalf;
587 Pair1 = ReadHalfConst;
590 if (Pair1 == ReadHalfConst)
593 Pair2 = ReadHalfConst;
596 if (Pair2 != ReadHalfConst)
605 std::vector<unsigned> Consts;
607 for (
unsigned i = 0, n = MIs.size(); i < n; i++) {
612 for (
const auto &Src :
getSrcs(MI)) {
613 if (Src.first->getReg() == AMDGPU::ALU_LITERAL_X)
614 Literals.
insert(Src.second);
615 if (Literals.
size() > 4)
617 if (Src.first->getReg() == AMDGPU::ALU_CONST)
618 Consts.push_back(Src.second);
619 if (AMDGPU::R600_KC0RegClass.
contains(Src.first->getReg()) ||
620 AMDGPU::R600_KC1RegClass.
contains(Src.first->getReg())) {
621 unsigned Index = RI.getEncodingValue(Src.first->getReg()) & 0xff;
623 Consts.push_back((Index << 2) | Chan);
633 return static_cast<const R600Subtarget &
>(STI).createDFAPacketizer(II);
649 while (I != MBB.
begin()) {
661 return Opcode == AMDGPU::JUMP || Opcode == AMDGPU::JUMP_COND;
665 return Opcode == AMDGPU::BRANCH || Opcode == AMDGPU::BRANCH_COND_i32 ||
666 Opcode == AMDGPU::BRANCH_COND_f32;
673 bool AllowModify)
const {
685 if (!
isJump(I->getOpcode())) {
690 while (I != MBB.
begin() && std::prev(I)->getOpcode() == AMDGPU::JUMP) {
693 I->removeFromParent();
700 if (I == MBB.
begin() || !
isJump((--I)->getOpcode())) {
701 if (LastOpc == AMDGPU::JUMP) {
704 }
else if (LastOpc == AMDGPU::JUMP_COND) {
720 unsigned SecondLastOpc = SecondLastInst.
getOpcode();
723 if (SecondLastOpc == AMDGPU::JUMP_COND && LastOpc == AMDGPU::JUMP) {
744 if (It->getOpcode() == AMDGPU::CF_ALU ||
745 It->getOpcode() == AMDGPU::CF_ALU_PUSH_BEFORE)
756 int *BytesAdded)
const {
757 assert(TBB &&
"insertBranch must not be told to insert a fallthrough");
758 assert(!BytesAdded &&
"code size not handled");
766 assert(PredSet &&
"No previous predicate !");
770 BuildMI(&MBB, DL,
get(AMDGPU::JUMP_COND))
774 if (CfAlu == MBB.
end())
776 assert (CfAlu->getOpcode() == AMDGPU::CF_ALU);
777 CfAlu->setDesc(
get(AMDGPU::CF_ALU_PUSH_BEFORE));
782 assert(PredSet &&
"No previous predicate !");
785 BuildMI(&MBB, DL,
get(AMDGPU::JUMP_COND))
790 if (CfAlu == MBB.
end())
792 assert (CfAlu->getOpcode() == AMDGPU::CF_ALU);
793 CfAlu->setDesc(
get(AMDGPU::CF_ALU_PUSH_BEFORE));
799 int *BytesRemoved)
const {
800 assert(!BytesRemoved &&
"code size not handled");
807 if (I == MBB.
begin()) {
811 switch (I->getOpcode()) {
814 case AMDGPU::JUMP_COND: {
817 I->eraseFromParent();
819 if (CfAlu == MBB.
end())
821 assert (CfAlu->getOpcode() == AMDGPU::CF_ALU_PUSH_BEFORE);
822 CfAlu->setDesc(
get(AMDGPU::CF_ALU));
826 I->eraseFromParent();
831 if (I == MBB.
begin()) {
835 switch (I->getOpcode()) {
839 case AMDGPU::JUMP_COND: {
842 I->eraseFromParent();
844 if (CfAlu == MBB.
end())
846 assert (CfAlu->getOpcode() == AMDGPU::CF_ALU_PUSH_BEFORE);
847 CfAlu->setDesc(
get(AMDGPU::CF_ALU));
851 I->eraseFromParent();
864 default:
return false;
865 case AMDGPU::PRED_SEL_ONE:
866 case AMDGPU::PRED_SEL_ZERO:
867 case AMDGPU::PREDICATE_BIT:
880 }
else if (MI.
getOpcode() == AMDGPU::CF_ALU) {
890 return AMDGPUInstrInfo::isPredicable(MI);
897 unsigned ExtraPredCycles,
905 unsigned ExtraTCycles,
908 unsigned ExtraFCycles,
931 case AMDGPU::PRED_SETE_INT:
932 MO.
setImm(AMDGPU::PRED_SETNE_INT);
934 case AMDGPU::PRED_SETNE_INT:
935 MO.
setImm(AMDGPU::PRED_SETE_INT);
937 case AMDGPU::PRED_SETE:
938 MO.
setImm(AMDGPU::PRED_SETNE);
940 case AMDGPU::PRED_SETNE:
941 MO.
setImm(AMDGPU::PRED_SETE);
949 case AMDGPU::PRED_SEL_ZERO:
950 MO2.
setReg(AMDGPU::PRED_SEL_ONE);
952 case AMDGPU::PRED_SEL_ONE:
953 MO2.
setReg(AMDGPU::PRED_SEL_ZERO);
962 std::vector<MachineOperand> &Pred)
const {
1006 unsigned *PredCost)
const {
1013 unsigned Channel)
const {
1026 int RegOpIdx = OffsetOpIdx + 1;
1036 if (OffsetReg == AMDGPU::INDIRECT_BASE_ADDR) {
1050 if (OffsetReg == AMDGPU::INDIRECT_BASE_ADDR) {
1065 case AMDGPU::R600_EXTRACT_ELT_V2:
1066 case AMDGPU::R600_EXTRACT_ELT_V4:
1072 case AMDGPU::R600_INSERT_ELT_V2:
1073 case AMDGPU::R600_INSERT_ELT_V4:
1096 unsigned SuperReg = AMDGPU::R600_Reg128RegClass.getRegister(Index);
1097 Reserved.
set(SuperReg);
1098 for (
unsigned Chan = 0; Chan < StackWidth; ++Chan) {
1099 unsigned Reg = AMDGPU::R600_TReg32RegClass.getRegister((4 * Index) + Chan);
1106 return &AMDGPU::R600_TReg32_XRegClass;
1111 unsigned ValueReg,
unsigned Address,
1112 unsigned OffsetReg)
const {
1113 return buildIndirectWrite(MBB, I, ValueReg, Address, OffsetReg, 0);
1118 unsigned ValueReg,
unsigned Address,
1120 unsigned AddrChan)
const {
1124 case 0: AddrReg = AMDGPU::R600_AddrRegClass.getRegister(Address);
break;
1125 case 1: AddrReg = AMDGPU::R600_Addr_YRegClass.getRegister(Address);
break;
1126 case 2: AddrReg = AMDGPU::R600_Addr_ZRegClass.getRegister(Address);
break;
1127 case 3: AddrReg = AMDGPU::R600_Addr_WRegClass.getRegister(Address);
break;
1130 AMDGPU::AR_X, OffsetReg);
1143 unsigned ValueReg,
unsigned Address,
1144 unsigned OffsetReg)
const {
1145 return buildIndirectRead(MBB, I, ValueReg, Address, OffsetReg, 0);
1150 unsigned ValueReg,
unsigned Address,
1152 unsigned AddrChan)
const {
1156 case 0: AddrReg = AMDGPU::R600_AddrRegClass.getRegister(Address);
break;
1157 case 1: AddrReg = AMDGPU::R600_Addr_YRegClass.getRegister(Address);
break;
1158 case 2: AddrReg = AMDGPU::R600_Addr_ZRegClass.getRegister(Address);
break;
1159 case 3: AddrReg = AMDGPU::R600_Addr_WRegClass.getRegister(Address);
break;
1192 unsigned Reg = LI->first;
1199 for (RegIndex = 0, RegEnd = IndirectRC->
getNumRegs(); RegIndex != RegEnd;
1204 Offset =
std::max(Offset, (
int)RegIndex);
1226 unsigned IgnoredFrameReg;
1241 unsigned Src1Reg)
const {
1270 .
addReg(AMDGPU::PRED_SEL_OFF)
1277 #define OPERAND_CASE(Label) \
1279 static const unsigned Ops[] = \
1321 Opcode = AMDGPU::DOT4_r600;
1323 Opcode = AMDGPU::DOT4_eg;
1331 static const unsigned Operands[14] = {
1332 AMDGPU::OpName::update_exec_mask,
1333 AMDGPU::OpName::update_pred,
1335 AMDGPU::OpName::omod,
1336 AMDGPU::OpName::dst_rel,
1337 AMDGPU::OpName::clamp,
1338 AMDGPU::OpName::src0_neg,
1339 AMDGPU::OpName::src0_rel,
1340 AMDGPU::OpName::src0_abs,
1341 AMDGPU::OpName::src0_sel,
1342 AMDGPU::OpName::src1_neg,
1343 AMDGPU::OpName::src1_rel,
1344 AMDGPU::OpName::src1_abs,
1345 AMDGPU::OpName::src1_sel,
1353 for (
unsigned i = 0; i < 14; i++) {
1366 uint64_t Imm)
const {
1368 AMDGPU::ALU_LITERAL_X);
1375 unsigned DstReg,
unsigned SrcReg)
const {
1388 int64_t Imm)
const {
1390 assert(Idx != -1 &&
"Operand not supported for this instruction.");
1400 unsigned Flag)
const {
1435 assert(!IsOP3 &&
"Cannot set absolute value modifier for OP3 "
1452 assert(FlagIndex != -1 &&
"Flag not supported for this instruction");
1456 "Instruction flags not supported for this instruction");
1465 unsigned Flag)
const {
1486 unsigned Flag)
const {
1493 unsigned InstFlags = FlagOp.
getImm();
1495 FlagOp.
setImm(InstFlags);
SmallVector< std::pair< MachineOperand *, int64_t >, 3 > getSrcs(MachineInstr &MI) const
MachineInstr * buildSlotOfVectorInstruction(MachineBasicBlock &MBB, MachineInstr *MI, unsigned Slot, unsigned DstReg) const
int getIndirectIndexEnd(const MachineFunction &MF) const
bool hasCaymanISA() const
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
mop_iterator operands_end()
void addFlag(MachineInstr &MI, unsigned Operand, unsigned Flag) const
Add one of the MO_FLAG* flags to the specified Operand.
unsigned int getPredicationCost(const MachineInstr &) const override
bool isLDSInstr(unsigned Opcode) const
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
AMDGPU specific subclass of TargetSubtarget.
bool hasVertexCache() const
unsigned getRegister(unsigned i) const
Return the specified register in the class.
livein_iterator livein_end() const
Interface definition for R600InstrInfo.
MachineBasicBlock * getMBB() const
unsigned getHWRegChan(unsigned reg) const
get the HW encoding for a register's channel.
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
bool isVector(const MachineInstr &MI) const
Vector instructions are instructions that must fill all instruction slots within an instruction group...
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
unsigned calculateIndirectAddress(unsigned RegIndex, unsigned Channel) const
Calculate the "Indirect Address" for the given RegIndex and Channel.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
unsigned getNumObjects() const
Return the number of objects.
bool fitsReadPortLimitations(const std::vector< MachineInstr * > &MIs, const DenseMap< unsigned, unsigned > &PV, std::vector< BankSwizzle > &BS, bool isLastAluTrans) const
Given the order VEC_012 < VEC_021 < VEC_120 < VEC_102 < VEC_201 < VEC_210 returns true and the first ...
static std::vector< std::pair< int, unsigned > > Swizzle(std::vector< std::pair< int, unsigned >> Src, R600InstrInfo::BankSwizzle Swz)
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
bool isPredicated(const MachineInstr &MI) const override
static unsigned getSlotedOps(unsigned Op, unsigned Slot)
bool expandPostRAPseudo(MachineInstr &MI) const override
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
MachineInstrBundleIterator< const MachineInstr > const_iterator
Interface definition for R600RegisterInfo.
bool isVectorOnly(unsigned Opcode) const
return AArch64::GPR64RegClass contains(Reg)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
bool isCubeOp(unsigned opcode) const
unsigned int getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
static MachineBasicBlock::iterator FindLastAluClause(MachineBasicBlock &MBB)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
static unsigned getTransSwizzle(R600InstrInfo::BankSwizzle Swz, unsigned Op)
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false)
R600InstrInfo(const R600Subtarget &)
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
Reg
All possible values of the reg field in the ModR/M byte.
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
MachineInstr * buildMovImm(MachineBasicBlock &BB, MachineBasicBlock::iterator I, unsigned DstReg, uint64_t Imm) const
virtual const InstrItineraryData * getInstrItineraryData() const
getInstrItineraryData - Returns instruction itinerary data for the target or specific subtarget...
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
#define HAS_NATIVE_OPERANDS(Flags)
bool hasInstrModifiers(unsigned Opcode) const
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
MachineInstr * buildMovInstr(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, unsigned DstReg, unsigned SrcReg) const
static bool isJump(unsigned Opcode)
bool usesVertexCache(unsigned Opcode) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Itinerary data supplied by a subtarget to be used by a target.
bool DefinesPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred) const override
iterator getLastNonDebugInstr()
Returns an iterator to the last non-debug instruction in the basic block, or end().
bool usesTextureCache(unsigned Opcode) const
Generation getGeneration() const
reverse_iterator rbegin()
bool isPredicable(const MachineInstr &MI) const override
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
const MachineBasicBlock * getParent() const
iterator find(const_arg_type_t< KeyT > Val)
bool isExport(unsigned Opcode) const
const R600FrameLowering * getFrameLowering() const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemvoed=nullptr) const override
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool isCompute(CallingConv::ID cc)
void setImmOperand(MachineInstr &MI, unsigned Op, int64_t Imm) const
Helper function for setting instruction flag values.
unsigned const MachineRegisterInfo * MRI
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
bool FindSwizzleForVectorSlot(const std::vector< std::vector< std::pair< int, unsigned > > > &IGSrcs, std::vector< R600InstrInfo::BankSwizzle > &SwzCandidate, const std::vector< std::pair< int, unsigned > > &TransSrcs, R600InstrInfo::BankSwizzle TransSwz) const
Enumerate all possible Swizzle sequence to find one that can meet all read port requirements.
int findRegisterDefOperandIdx(unsigned Reg, bool isDead=false, bool Overlap=false, const TargetRegisterInfo *TRI=nullptr) const
Returns the operand index that is a def of the specified register or -1 if it is not found...
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE instructions.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
const MachineOperand & getOperand(unsigned i) const
unsigned getSubRegFromChannel(unsigned Channel) const
const TargetRegisterClass * getIndirectAddrRegClass() const
std::vector< std::pair< unsigned, unsigned >>::const_iterator livein_iterator
static const unsigned End
void setImm(int64_t immVal)
int getOperandIdx(const MachineInstr &MI, unsigned Op) const
Get the index of Op in the MachineInstr.
static MachineInstr * findFirstPredicateSetterFrom(MachineBasicBlock &MBB, MachineBasicBlock::iterator I)
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
bool empty() const
empty - Check if the array is empty.
static void write(bool isBE, void *P, T V)
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
unsigned getHWRegIndex(unsigned Reg) const
void setIsKill(bool Val=true)
bool readsLDSSrcReg(const MachineInstr &MI) const
static bool NextPossibleSolution(std::vector< R600InstrInfo::BankSwizzle > &SwzCandidate, unsigned Idx)
Given a swizzle sequence SwzCandidate and an index Idx, returns the next (in lexicographic term) swiz...
MachineOperand & getFlagOp(MachineInstr &MI, unsigned SrcIdx=0, unsigned Flag=0) const
int findRegisterUseOperandIdx(unsigned Reg, bool isKill=false, const TargetRegisterInfo *TRI=nullptr) const
Returns the operand index that is a use of the specific register or -1 if it is not found...
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Pred) const override
void clearFlag(MachineInstr &MI, unsigned Operand, unsigned Flag) const
Clear the specified flag on the instruction.
bool isPhysRegLiveAcrossClauses(unsigned Reg) const
#define OPERAND_CASE(Label)
livein_iterator livein_begin() const
unsigned getStackWidth(const MachineFunction &MF) const
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool canBeConsideredALU(const MachineInstr &MI) const
bool mustBeLastInClause(unsigned Opcode) const
static bool isPredicateSetter(unsigned Opcode)
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
unsigned getNumRegs() const
Return the number of registers in this class.
int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate...
int getSelIdx(unsigned Opcode, unsigned SrcIdx) const
llvm_unreachable("Unknown RegBank!")
Contains the definition of a TargetInstrInfo class that is common to all AMD GPUs.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
TargetSubtargetInfo - Generic base class for all target subtargets.
static bool isConstCompatible(R600InstrInfo::BankSwizzle TransSwz, const std::vector< std::pair< int, unsigned >> &TransOps, unsigned ConstCount)
Instructions in Trans slot can't read gpr at cycle 0 if they also read a const, and can't read a gpr ...
Representation of each machine instruction.
void reserveIndirectRegisters(BitVector &Reserved, const MachineFunction &MF) const
Reserve the registers that may be accesed using indirect addressing.
MachineInstrBuilder buildDefaultInstruction(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned Opcode, unsigned DstReg, unsigned Src0Reg, unsigned Src1Reg=0) const
buildDefaultInstruction - This function returns a MachineInstr with all the instruction modifiers ini...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool definesAddressRegister(MachineInstr &MI) const
#define GET_FLAG_OPERAND_IDX(Flags)
Helper for getting the operand index for the instruction flags operand.
void setReg(unsigned Reg)
Change the register this operand corresponds to.
unsigned isLegalUpTo(const std::vector< std::vector< std::pair< int, unsigned > > > &IGSrcs, const std::vector< R600InstrInfo::BankSwizzle > &Swz, const std::vector< std::pair< int, unsigned > > &TransSrcs, R600InstrInfo::BankSwizzle TransSwz) const
returns how many MIs (whose inputs are represented by IGSrcs) can be packed in the same Instruction G...
bool isProfitableToUnpredicate(MachineBasicBlock &TMBB, MachineBasicBlock &FMBB) const override
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
bool isRegisterLoad(const MachineInstr &MI) const
bool usesAddressRegister(MachineInstr &MI) const
unsigned getMaxAlusPerClause() const
bool isReductionOp(unsigned opcode) const
unsigned getReg() const
getReg - Returns the register number.
DFAPacketizer * CreateTargetScheduleState(const TargetSubtargetInfo &) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isBranch(unsigned Opcode)
mop_iterator operands_begin()
bool livein_empty() const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
#define GET_REG_INDEX(reg)
bool isMov(unsigned Opcode) const
int getIndirectIndexBegin(const MachineFunction &MF) const
bool isRegisterStore(const MachineInstr &MI) const
bool fitsConstReadLimitations(const std::vector< MachineInstr * > &) const
An instruction group can only access 2 channel pair (either [XY] or [ZW]) from KCache bank on R700+...
bool isLDSRetInstr(unsigned Opcode) const
bool isALUInstr(unsigned Opcode) const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
bool isTransOnly(unsigned Opcode) const
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const override
bool contains(unsigned Reg) const
Return true if the specified register is included in this register class.