47 #define GET_INSTRINFO_CTOR_DTOR 48 #include "R600GenDFAPacketizer.inc" 50 #define GET_INSTRINFO_CTOR_DTOR 51 #define GET_INSTRMAP_INFO 52 #define GET_INSTRINFO_NAMED_OPS 53 #include "R600GenInstrInfo.inc" 64 const DebugLoc &DL,
unsigned DestReg,
65 unsigned SrcReg,
bool KillSrc)
const {
66 unsigned VectorComponents = 0;
67 if ((R600::R600_Reg128RegClass.
contains(DestReg) ||
68 R600::R600_Reg128VerticalRegClass.
contains(DestReg)) &&
69 (R600::R600_Reg128RegClass.
contains(SrcReg) ||
70 R600::R600_Reg128VerticalRegClass.
contains(SrcReg))) {
72 }
else if((R600::R600_Reg64RegClass.
contains(DestReg) ||
73 R600::R600_Reg64VerticalRegClass.
contains(DestReg)) &&
74 (R600::R600_Reg64RegClass.
contains(SrcReg) ||
75 R600::R600_Reg64VerticalRegClass.
contains(SrcReg))) {
79 if (VectorComponents > 0) {
80 for (
unsigned I = 0;
I < VectorComponents;
I++) {
83 RI.getSubReg(DestReg, SubRegIndex),
84 RI.getSubReg(SrcReg, SubRegIndex))
100 E = MBBI->operands_end();
I !=
E; ++
I) {
113 case R600::MOV_IMM_F32:
114 case R600::MOV_IMM_I32:
125 default:
return false;
126 case R600::CUBE_r600_pseudo:
127 case R600::CUBE_r600_real:
128 case R600::CUBE_eg_pseudo:
129 case R600::CUBE_eg_real:
167 case R600::INTERP_PAIR_XY:
168 case R600::INTERP_PAIR_ZW:
169 case R600::INTERP_VEC_LOAD:
181 return (
get(Opcode).getSchedClass() == R600::Sched::TransALU);
189 return (
get(Opcode).getSchedClass() == R600::Sched::VecALU);
224 case R600::GROUP_BARRIER:
246 if (!
I->isReg() || !
I->isUse() ||
250 if (R600::R600_LDS_SRC_REGRegClass.
contains(
I->getReg()))
257 static const unsigned SrcSelTable[][2] = {
258 {R600::OpName::src0, R600::OpName::src0_sel},
259 {R600::OpName::src1, R600::OpName::src1_sel},
260 {R600::OpName::src2, R600::OpName::src2_sel},
261 {R600::OpName::src0_X, R600::OpName::src0_sel_X},
262 {R600::OpName::src0_Y, R600::OpName::src0_sel_Y},
263 {R600::OpName::src0_Z, R600::OpName::src0_sel_Z},
264 {R600::OpName::src0_W, R600::OpName::src0_sel_W},
265 {R600::OpName::src1_X, R600::OpName::src1_sel_X},
266 {R600::OpName::src1_Y, R600::OpName::src1_sel_Y},
267 {R600::OpName::src1_Z, R600::OpName::src1_sel_Z},
268 {R600::OpName::src1_W, R600::OpName::src1_sel_W}
271 for (
const auto &Row : SrcSelTable) {
284 static const unsigned OpTable[8][2] = {
285 {R600::OpName::src0_X, R600::OpName::src0_sel_X},
286 {R600::OpName::src0_Y, R600::OpName::src0_sel_Y},
287 {R600::OpName::src0_Z, R600::OpName::src0_sel_Z},
288 {R600::OpName::src0_W, R600::OpName::src0_sel_W},
289 {R600::OpName::src1_X, R600::OpName::src1_sel_X},
290 {R600::OpName::src1_Y, R600::OpName::src1_sel_Y},
291 {R600::OpName::src1_Z, R600::OpName::src1_sel_Z},
292 {R600::OpName::src1_W, R600::OpName::src1_sel_W},
295 for (
unsigned j = 0; j < 8; j++) {
299 if (Reg == R600::ALU_CONST) {
310 static const unsigned OpTable[3][2] = {
311 {R600::OpName::src0, R600::OpName::src0_sel},
312 {R600::OpName::src1, R600::OpName::src1_sel},
313 {R600::OpName::src2, R600::OpName::src2_sel},
316 for (
unsigned j = 0; j < 3; j++) {
322 if (Reg == R600::ALU_CONST) {
328 if (Reg == R600::ALU_LITERAL_X) {
331 if (Operand.
isImm()) {
337 Result.
push_back(std::make_pair(&MO, 0));
342 std::vector<std::pair<int, unsigned>>
345 unsigned &ConstCount)
const {
347 const std::pair<int, unsigned> DummyPair(-1, 0);
348 std::vector<std::pair<int, unsigned>> Result;
350 for (
const auto &Src :
getSrcs(MI)) {
352 unsigned Reg = Src.first->getReg();
353 int Index = RI.getEncodingValue(Reg) & 0xff;
354 if (Reg == R600::OQAP) {
355 Result.push_back(std::make_pair(Index, 0U));
357 if (PV.
find(Reg) != PV.
end()) {
359 Result.push_back(std::make_pair(255, 0U));
364 Result.push_back(DummyPair);
368 Result.push_back(std::make_pair(Index, Chan));
371 Result.push_back(DummyPair);
375 static std::vector<std::pair<int, unsigned>>
376 Swizzle(std::vector<std::pair<int, unsigned>> Src,
378 if (Src[0] == Src[1])
407 unsigned Cycles[3] = { 2, 1, 0};
411 unsigned Cycles[3] = { 1, 2, 2};
415 unsigned Cycles[3] = { 2, 1, 2};
419 unsigned Cycles[3] = { 2, 2, 1};
431 const std::vector<std::vector<std::pair<int, unsigned>>> &IGSrcs,
432 const std::vector<R600InstrInfo::BankSwizzle> &Swz,
433 const std::vector<std::pair<int, unsigned>> &TransSrcs,
436 memset(Vector, -1,
sizeof(Vector));
437 for (
unsigned i = 0, e = IGSrcs.size(); i < e; i++) {
438 const std::vector<std::pair<int, unsigned>> &Srcs =
440 for (
unsigned j = 0; j < 3; j++) {
441 const std::pair<int, unsigned> &Src = Srcs[j];
442 if (Src.first < 0 || Src.first == 255)
444 if (Src.first ==
GET_REG_INDEX(RI.getEncodingValue(R600::OQAP))) {
454 if (Vector[Src.second][j] < 0)
455 Vector[Src.second][j] = Src.first;
456 if (Vector[Src.second][j] != Src.first)
461 for (
unsigned i = 0, e = TransSrcs.size(); i < e; ++i) {
462 const std::pair<int, unsigned> &Src = TransSrcs[i];
466 if (Src.first == 255)
468 if (Vector[Src.second][Cycle] < 0)
469 Vector[Src.second][Cycle] = Src.first;
470 if (Vector[Src.second][Cycle] != Src.first)
471 return IGSrcs.size() - 1;
473 return IGSrcs.size();
481 std::vector<R600InstrInfo::BankSwizzle> &SwzCandidate,
483 assert(Idx < SwzCandidate.size());
487 for (
unsigned i = ResetIdx + 1, e = SwzCandidate.size(); i < e; i++) {
492 int NextSwizzle = SwzCandidate[ResetIdx] + 1;
500 const std::vector<std::vector<std::pair<int, unsigned>>> &IGSrcs,
501 std::vector<R600InstrInfo::BankSwizzle> &SwzCandidate,
502 const std::vector<std::pair<int, unsigned>> &TransSrcs,
504 unsigned ValidUpTo = 0;
506 ValidUpTo =
isLegalUpTo(IGSrcs, SwzCandidate, TransSrcs, TransSwz);
507 if (ValidUpTo == IGSrcs.size())
517 const std::vector<std::pair<int, unsigned>> &TransOps,
518 unsigned ConstCount) {
522 for (
unsigned i = 0, e = TransOps.size(); i < e; ++i) {
523 const std::pair<int, unsigned> &Src = TransOps[i];
527 if (ConstCount > 0 && Cycle == 0)
529 if (ConstCount > 1 && Cycle == 1)
538 std::vector<BankSwizzle> &ValidSwizzle,
543 std::vector<std::vector<std::pair<int, unsigned>>> IGSrcs;
544 ValidSwizzle.clear();
547 for (
unsigned i = 0, e = IG.size(); i < e; ++i) {
548 IGSrcs.push_back(ExtractSrcs(*IG[i], PV, ConstCount));
550 R600::OpName::bank_swizzle);
552 IG[i]->getOperand(Op).getImm());
554 std::vector<std::pair<int, unsigned>> TransOps;
558 TransOps = std::move(IGSrcs.back());
560 ValidSwizzle.pop_back();
568 for (
unsigned i = 0; i < 4; i++) {
569 TransBS = TransSwz[i];
575 ValidSwizzle.push_back(TransBS);
586 assert (Consts.size() <= 12 &&
"Too many operands in instructions group");
587 unsigned Pair1 = 0, Pair2 = 0;
588 for (
unsigned i = 0, n = Consts.size(); i < n; ++i) {
589 unsigned ReadConstHalf = Consts[i] & 2;
590 unsigned ReadConstIndex = Consts[i] & (~3);
591 unsigned ReadHalfConst = ReadConstIndex | ReadConstHalf;
593 Pair1 = ReadHalfConst;
596 if (Pair1 == ReadHalfConst)
599 Pair2 = ReadHalfConst;
602 if (Pair2 != ReadHalfConst)
611 std::vector<unsigned> Consts;
613 for (
unsigned i = 0, n = MIs.size(); i < n; i++) {
618 for (
const auto &Src :
getSrcs(MI)) {
619 if (Src.first->getReg() == R600::ALU_LITERAL_X)
620 Literals.
insert(Src.second);
621 if (Literals.
size() > 4)
623 if (Src.first->getReg() == R600::ALU_CONST)
624 Consts.push_back(Src.second);
625 if (R600::R600_KC0RegClass.
contains(Src.first->getReg()) ||
626 R600::R600_KC1RegClass.
contains(Src.first->getReg())) {
627 unsigned Index = RI.getEncodingValue(Src.first->getReg()) & 0xff;
629 Consts.push_back((Index << 2) | Chan);
639 return static_cast<const R600Subtarget &
>(STI).createDFAPacketizer(II);
655 while (I != MBB.
begin()) {
667 return Opcode == R600::JUMP || Opcode == R600::JUMP_COND;
671 return Opcode == R600::BRANCH || Opcode == R600::BRANCH_COND_i32 ||
672 Opcode == R600::BRANCH_COND_f32;
679 bool AllowModify)
const {
691 if (!
isJump(I->getOpcode())) {
696 while (I != MBB.
begin() && std::prev(I)->getOpcode() == R600::JUMP) {
699 I->removeFromParent();
707 if (LastOpc == R600::JUMP) {
710 }
else if (LastOpc == R600::JUMP_COND) {
726 unsigned SecondLastOpc = SecondLastInst.
getOpcode();
729 if (SecondLastOpc == R600::JUMP_COND && LastOpc == R600::JUMP) {
750 if (It->getOpcode() == R600::CF_ALU ||
751 It->getOpcode() == R600::CF_ALU_PUSH_BEFORE)
762 int *BytesAdded)
const {
763 assert(TBB &&
"insertBranch must not be told to insert a fallthrough");
764 assert(!BytesAdded &&
"code size not handled");
772 assert(PredSet &&
"No previous predicate !");
776 BuildMI(&MBB, DL,
get(R600::JUMP_COND))
780 if (CfAlu == MBB.
end())
782 assert (CfAlu->getOpcode() == R600::CF_ALU);
783 CfAlu->setDesc(
get(R600::CF_ALU_PUSH_BEFORE));
788 assert(PredSet &&
"No previous predicate !");
791 BuildMI(&MBB, DL,
get(R600::JUMP_COND))
796 if (CfAlu == MBB.
end())
798 assert (CfAlu->getOpcode() == R600::CF_ALU);
799 CfAlu->setDesc(
get(R600::CF_ALU_PUSH_BEFORE));
805 int *BytesRemoved)
const {
806 assert(!BytesRemoved &&
"code size not handled");
813 if (I == MBB.
begin()) {
817 switch (I->getOpcode()) {
820 case R600::JUMP_COND: {
823 I->eraseFromParent();
825 if (CfAlu == MBB.
end())
827 assert (CfAlu->getOpcode() == R600::CF_ALU_PUSH_BEFORE);
828 CfAlu->setDesc(
get(R600::CF_ALU));
832 I->eraseFromParent();
837 if (I == MBB.
begin()) {
841 switch (I->getOpcode()) {
845 case R600::JUMP_COND: {
848 I->eraseFromParent();
850 if (CfAlu == MBB.
end())
852 assert (CfAlu->getOpcode() == R600::CF_ALU_PUSH_BEFORE);
853 CfAlu->setDesc(
get(R600::CF_ALU));
857 I->eraseFromParent();
870 default:
return false;
871 case R600::PRED_SEL_ONE:
872 case R600::PRED_SEL_ZERO:
873 case R600::PREDICATE_BIT:
886 }
else if (MI.
getOpcode() == R600::CF_ALU) {
903 unsigned ExtraPredCycles,
911 unsigned ExtraTCycles,
914 unsigned ExtraFCycles,
937 case R600::PRED_SETE_INT:
938 MO.
setImm(R600::PRED_SETNE_INT);
940 case R600::PRED_SETNE_INT:
941 MO.
setImm(R600::PRED_SETE_INT);
943 case R600::PRED_SETE:
944 MO.
setImm(R600::PRED_SETNE);
946 case R600::PRED_SETNE:
947 MO.
setImm(R600::PRED_SETE);
955 case R600::PRED_SEL_ZERO:
956 MO2.
setReg(R600::PRED_SEL_ONE);
958 case R600::PRED_SEL_ONE:
959 MO2.
setReg(R600::PRED_SEL_ZERO);
968 std::vector<MachineOperand> &Pred)
const {
1012 unsigned *PredCost)
const {
1019 unsigned Channel)
const {
1032 int RegOpIdx = OffsetOpIdx + 1;
1042 if (OffsetReg == R600::INDIRECT_BASE_ADDR) {
1056 if (OffsetReg == R600::INDIRECT_BASE_ADDR) {
1071 case R600::R600_EXTRACT_ELT_V2:
1072 case R600::R600_EXTRACT_ELT_V4:
1078 case R600::R600_INSERT_ELT_V2:
1079 case R600::R600_INSERT_ELT_V4:
1103 for (
unsigned Chan = 0; Chan < StackWidth; ++Chan) {
1104 unsigned Reg = R600::R600_TReg32RegClass.getRegister((4 *
Index) + Chan);
1111 return &R600::R600_TReg32_XRegClass;
1116 unsigned ValueReg,
unsigned Address,
1117 unsigned OffsetReg)
const {
1118 return buildIndirectWrite(MBB, I, ValueReg, Address, OffsetReg, 0);
1123 unsigned ValueReg,
unsigned Address,
1125 unsigned AddrChan)
const {
1129 case 0: AddrReg = R600::R600_AddrRegClass.getRegister(Address);
break;
1130 case 1: AddrReg = R600::R600_Addr_YRegClass.getRegister(Address);
break;
1131 case 2: AddrReg = R600::R600_Addr_ZRegClass.getRegister(Address);
break;
1132 case 3: AddrReg = R600::R600_Addr_WRegClass.getRegister(Address);
break;
1135 R600::AR_X, OffsetReg);
1148 unsigned ValueReg,
unsigned Address,
1149 unsigned OffsetReg)
const {
1150 return buildIndirectRead(MBB, I, ValueReg, Address, OffsetReg, 0);
1155 unsigned ValueReg,
unsigned Address,
1157 unsigned AddrChan)
const {
1161 case 0: AddrReg = R600::R600_AddrRegClass.getRegister(Address);
break;
1162 case 1: AddrReg = R600::R600_Addr_YRegClass.getRegister(Address);
break;
1163 case 2: AddrReg = R600::R600_Addr_ZRegClass.getRegister(Address);
break;
1164 case 3: AddrReg = R600::R600_Addr_WRegClass.getRegister(Address);
break;
1194 for (std::pair<unsigned, unsigned> LI : MRI.
liveins()) {
1195 unsigned Reg = LI.first;
1202 for (RegIndex = 0, RegEnd = IndirectRC->
getNumRegs(); RegIndex != RegEnd;
1207 Offset =
std::max(Offset, (
int)RegIndex);
1229 unsigned IgnoredFrameReg;
1244 unsigned Src1Reg)
const {
1273 .
addReg(R600::PRED_SEL_OFF)
1280 #define OPERAND_CASE(Label) \ 1282 static const unsigned Ops[] = \ 1324 Opcode = R600::DOT4_r600;
1326 Opcode = R600::DOT4_eg;
1334 static const unsigned Operands[14] = {
1335 R600::OpName::update_exec_mask,
1336 R600::OpName::update_pred,
1339 R600::OpName::dst_rel,
1340 R600::OpName::clamp,
1341 R600::OpName::src0_neg,
1342 R600::OpName::src0_rel,
1343 R600::OpName::src0_abs,
1344 R600::OpName::src0_sel,
1345 R600::OpName::src1_neg,
1346 R600::OpName::src1_rel,
1347 R600::OpName::src1_abs,
1348 R600::OpName::src1_sel,
1356 for (
unsigned i = 0; i < 14; i++) {
1369 uint64_t Imm)
const {
1371 R600::ALU_LITERAL_X);
1378 unsigned DstReg,
unsigned SrcReg)
const {
1391 int64_t Imm)
const {
1393 assert(Idx != -1 &&
"Operand not supported for this instruction.");
1403 unsigned Flag)
const {
1438 assert(!IsOP3 &&
"Cannot set absolute value modifier for OP3 " 1455 assert(FlagIndex != -1 &&
"Flag not supported for this instruction");
1459 "Instruction flags not supported for this instruction");
1468 unsigned Flag)
const {
1489 unsigned Flag)
const {
1496 unsigned InstFlags = FlagOp.
getImm();
1498 FlagOp.
setImm(InstFlags);
1503 unsigned Kind)
const {
bool isMov(unsigned Opcode) const
bool usesAddressRegister(MachineInstr &MI) const
mop_iterator operands_end()
static unsigned getSubRegFromChannel(unsigned Channel)
unsigned int getPredicationCost(const MachineInstr &) const override
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
bool contains(unsigned Reg) const
Return true if the specified register is included in this register class.
int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate...
AMDGPU specific subclass of TargetSubtarget.
MachineBasicBlock * getMBB() const
bool livein_empty() const
This class represents lattice values for constants.
unsigned getNumRegs() const
Return the number of registers in this class.
unsigned getNumObjects() const
Return the number of objects.
Interface definition for R600InstrInfo.
void addFlag(MachineInstr &MI, unsigned Operand, unsigned Flag) const
Add one of the MO_FLAG* flags to the specified Operand.
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
unsigned getRegister(unsigned i) const
Return the specified register in the class.
void push_back(const T &Elt)
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
unsigned getReg() const
getReg - Returns the register number.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
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...
Address space for private memory.
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)
void clearFlag(MachineInstr &MI, unsigned Operand, unsigned Flag) const
Clear the specified flag on the instruction.
bool expandPostRAPseudo(MachineInstr &MI) const override
unsigned const TargetRegisterInfo * TRI
MachineInstr * buildSlotOfVectorInstruction(MachineBasicBlock &MBB, MachineInstr *MI, unsigned Slot, unsigned DstReg) const
MachineInstrBundleIterator< const MachineInstr > const_iterator
Interface definition for R600RegisterInfo.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Generation getGeneration() const
return AArch64::GPR64RegClass contains(Reg)
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, bool isRenamable=false)
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
unsigned int getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
static MachineBasicBlock::iterator FindLastAluClause(MachineBasicBlock &MBB)
Address space for constant memory (VTX2)
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
static unsigned getTransSwizzle(R600InstrInfo::BankSwizzle Swz, unsigned Op)
R600InstrInfo(const R600Subtarget &)
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const override
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
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.
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
MachineOperand & getFlagOp(MachineInstr &MI, unsigned SrcIdx=0, unsigned Flag=0) const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
int getSelIdx(unsigned Opcode, unsigned SrcIdx) const
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
void setImmOperand(MachineInstr &MI, unsigned Op, int64_t Imm) const
Helper function for setting instruction flag values.
bool isRegisterLoad(const MachineInstr &MI) const
#define HAS_NATIVE_OPERANDS(Flags)
static bool isJump(unsigned Opcode)
bool hasInstrModifiers(unsigned Opcode) const
unsigned getMaxAlusPerClause() const
bool isRegisterStore(const MachineInstr &MI) const
bool usesVertexCache(unsigned Opcode) const
unsigned getAddressSpaceForPseudoSourceKind(unsigned Kind) const override
bool mustBeLastInClause(unsigned Opcode) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
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().
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...
const TargetRegisterClass * getIndirectAddrRegClass() const
reverse_iterator rbegin()
bool isPredicable(const MachineInstr &MI) const override
virtual const InstrItineraryData * getInstrItineraryData() const
getInstrItineraryData - Returns instruction itinerary data for the target or specific subtarget...
bool isExport(unsigned Opcode) const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
iterator find(const_arg_type_t< KeyT > Val)
unsigned getHWRegIndex(unsigned Reg) 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)
unsigned const MachineRegisterInfo * MRI
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.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE and DBG_LABEL instructions...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
bool isLDSInstr(unsigned Opcode) const
void setImm(int64_t immVal)
int getOperandIdx(const MachineInstr &MI, unsigned Op) const
Get the index of Op in the MachineInstr.
bool isVectorOnly(unsigned Opcode) const
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.
static void write(bool isBE, void *P, T V)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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 hasVertexCache() const
void setIsKill(bool Val=true)
bool isTransOnly(unsigned Opcode) const
bool isVector(const MachineInstr &MI) const
Vector instructions are instructions that must fill all instruction slots within an instruction group...
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...
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
bool isPhysRegLiveAcrossClauses(unsigned Reg) const
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
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
unsigned calculateIndirectAddress(unsigned RegIndex, unsigned Channel) const
Calculate the "Indirect Address" for the given RegIndex and Channel.
#define OPERAND_CASE(Label)
bool hasCaymanISA() const
unsigned getHWRegChan(unsigned reg) const
get the HW encoding for a register's channel.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool isALUInstr(unsigned Opcode) const
static bool isPredicateSetter(unsigned Opcode)
virtual bool isPredicable(const MachineInstr &MI) const
Return true if the specified instruction can be predicated.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
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...
ArrayRef< std::pair< unsigned, unsigned > > liveins() const
bool readsLDSSrcReg(const MachineInstr &MI) const
bool isLDSRetInstr(unsigned Opcode) const
void reserveRegisterTuples(BitVector &Reserved, unsigned Reg) const
const MachineBasicBlock * getParent() const
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 ...
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool isReductionOp(unsigned opcode) const
#define GET_FLAG_OPERAND_IDX(Flags)
Helper for getting the operand index for the instruction flags operand.
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 ...
void setReg(unsigned Reg)
Change the register this operand corresponds to.
int getIndirectIndexBegin(const MachineFunction &MF) const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
SmallVector< std::pair< MachineOperand *, int64_t >, 3 > getSrcs(MachineInstr &MI) const
bool isProfitableToUnpredicate(MachineBasicBlock &TMBB, MachineBasicBlock &FMBB) const override
int getIndirectIndexEnd(const MachineFunction &MF) const
DFAPacketizer * CreateTargetScheduleState(const TargetSubtargetInfo &) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool canBeConsideredALU(const MachineInstr &MI) const
static bool isBranch(unsigned Opcode)
mop_iterator operands_begin()
#define GET_REG_INDEX(reg)
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
MachineInstr * buildMovInstr(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, unsigned DstReg, unsigned SrcReg) const
const MachineOperand & getOperand(unsigned i) const
bool usesTextureCache(unsigned Opcode) const
void reserveIndirectRegisters(BitVector &Reserved, const MachineFunction &MF, const R600RegisterInfo &TRI) const
Reserve the registers that may be accesed using indirect addressing.
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...
MachineInstr * buildMovImm(MachineBasicBlock &BB, MachineBasicBlock::iterator I, unsigned DstReg, uint64_t Imm) const
bool definesAddressRegister(MachineInstr &MI) const
bool empty() const
empty - Check if the array is empty.
bool isCubeOp(unsigned opcode) const
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const override
unsigned getStackWidth(const MachineFunction &MF) const