25 using namespace Hexagon;
27 #define DEBUG_TYPE "hexagon-mccompound" 41 J4_tstbit0_fp0_jump_nt, J4_tstbit0_fp0_jump_t, J4_tstbit0_fp1_jump_nt,
42 J4_tstbit0_fp1_jump_t, J4_tstbit0_tp0_jump_nt, J4_tstbit0_tp0_jump_t,
43 J4_tstbit0_tp1_jump_nt, J4_tstbit0_tp1_jump_t};
45 J4_cmpeq_fp0_jump_nt, J4_cmpeq_fp0_jump_t, J4_cmpeq_fp1_jump_nt,
46 J4_cmpeq_fp1_jump_t, J4_cmpeq_tp0_jump_nt, J4_cmpeq_tp0_jump_t,
47 J4_cmpeq_tp1_jump_nt, J4_cmpeq_tp1_jump_t};
49 J4_cmpgt_fp0_jump_nt, J4_cmpgt_fp0_jump_t, J4_cmpgt_fp1_jump_nt,
50 J4_cmpgt_fp1_jump_t, J4_cmpgt_tp0_jump_nt, J4_cmpgt_tp0_jump_t,
51 J4_cmpgt_tp1_jump_nt, J4_cmpgt_tp1_jump_t};
53 J4_cmpgtu_fp0_jump_nt, J4_cmpgtu_fp0_jump_t, J4_cmpgtu_fp1_jump_nt,
54 J4_cmpgtu_fp1_jump_t, J4_cmpgtu_tp0_jump_nt, J4_cmpgtu_tp0_jump_t,
55 J4_cmpgtu_tp1_jump_nt, J4_cmpgtu_tp1_jump_t};
57 J4_cmpeqi_fp0_jump_nt, J4_cmpeqi_fp0_jump_t, J4_cmpeqi_fp1_jump_nt,
58 J4_cmpeqi_fp1_jump_t, J4_cmpeqi_tp0_jump_nt, J4_cmpeqi_tp0_jump_t,
59 J4_cmpeqi_tp1_jump_nt, J4_cmpeqi_tp1_jump_t};
61 J4_cmpgti_fp0_jump_nt, J4_cmpgti_fp0_jump_t, J4_cmpgti_fp1_jump_nt,
62 J4_cmpgti_fp1_jump_t, J4_cmpgti_tp0_jump_nt, J4_cmpgti_tp0_jump_t,
63 J4_cmpgti_tp1_jump_nt, J4_cmpgti_tp1_jump_t};
65 J4_cmpgtui_fp0_jump_nt, J4_cmpgtui_fp0_jump_t, J4_cmpgtui_fp1_jump_nt,
66 J4_cmpgtui_fp1_jump_t, J4_cmpgtui_tp0_jump_nt, J4_cmpgtui_tp0_jump_t,
67 J4_cmpgtui_tp1_jump_nt, J4_cmpgtui_tp1_jump_t};
69 J4_cmpeqn1_fp0_jump_nt, J4_cmpeqn1_fp0_jump_t, J4_cmpeqn1_fp1_jump_nt,
70 J4_cmpeqn1_fp1_jump_t, J4_cmpeqn1_tp0_jump_nt, J4_cmpeqn1_tp0_jump_t,
71 J4_cmpeqn1_tp1_jump_nt, J4_cmpeqn1_tp1_jump_t};
73 J4_cmpgtn1_fp0_jump_nt, J4_cmpgtn1_fp0_jump_t, J4_cmpgtn1_fp1_jump_nt,
74 J4_cmpgtn1_fp1_jump_t, J4_cmpgtn1_tp0_jump_nt, J4_cmpgtn1_tp0_jump_t,
75 J4_cmpgtn1_tp1_jump_nt, J4_cmpgtn1_tp1_jump_t,
80 unsigned DstReg, SrcReg, Src1Reg, Src2Reg;
91 case Hexagon::C2_cmpeq:
92 case Hexagon::C2_cmpgt:
93 case Hexagon::C2_cmpgtu:
99 if ((Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
104 case Hexagon::C2_cmpeqi:
105 case Hexagon::C2_cmpgti:
106 case Hexagon::C2_cmpgtui:
112 if ((Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
114 (HexagonMCInstrInfo::inRange<5>(MI, 2) ||
118 case Hexagon::A2_tfr:
128 case Hexagon::A2_tfrsi:
138 case Hexagon::S2_tstbit_i:
143 if ((Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) &&
152 case Hexagon::J2_jumptnew:
153 case Hexagon::J2_jumpfnew:
154 case Hexagon::J2_jumptnewpt:
155 case Hexagon::J2_jumpfnewpt:
157 if (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg)
164 case Hexagon::J2_jump:
165 case Hexagon::RESTORE_DEALLOC_RET_JMP_V4:
176 unsigned PredReg = Predicate.
getReg();
178 assert((PredReg == Hexagon::P0) || (PredReg == Hexagon::P1) ||
179 (PredReg == Hexagon::P2) || (PredReg == Hexagon::P3));
185 case Hexagon::J2_jumpfnew:
187 case Hexagon::J2_jumpfnewpt:
189 case Hexagon::J2_jumptnew:
191 case Hexagon::J2_jumptnewpt:
198 MCInst *CompoundInsn =
nullptr;
199 unsigned compoundOpcode;
209 case Hexagon::A2_tfrsi:
211 compoundOpcode = J4_jumpseti;
220 case Hexagon::A2_tfr:
224 compoundOpcode = J4_jumpsetr;
233 case Hexagon::C2_cmpeq:
246 case Hexagon::C2_cmpgt:
259 case Hexagon::C2_cmpgtu:
272 case Hexagon::C2_cmpeqi:
290 case Hexagon::C2_cmpgti:
308 case Hexagon::C2_cmpgtui:
319 case Hexagon::S2_tstbit_i:
335 MCInst const &MIb,
bool IsExtendedB) {
342 (Opca == Hexagon::A2_tfr || Opca == Hexagon::A2_tfrsi))
351 bool JExtended =
false;
354 J != MCI.
end(); ++J) {
355 MCInst const *JumpInst = J->getInst();
362 bool BExtended =
false;
365 B != MCI.
end(); ++
B) {
366 MCInst const *Inst =
B->getInst();
367 if (JumpInst == Inst)
379 << JumpInst->
getOpcode() <<
" Compounds to " 381 J->setInst(CompoundInsn);
401 "Non-Bundle where Bundle expected");
416 MCInst OriginalBundle(MCI);
424 MCI = OriginalBundle;
This class represents lattice values for constants.
bool isIntRegForSubInst(unsigned Reg)
bool isBundle(MCInst const &MCI)
static const unsigned tstBitOpcode[8]
bool isImmext(MCInst const &MCI)
void tryCompound(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCContext &Context, MCInst &MCI)
tryCompound - Given a bundle check for compound insns when one is found update the contents fo the bu...
static const unsigned cmpeqBitOpcode[8]
unsigned getReg() const
Returns the register number.
Context object for machine code objects.
const MCExpr * getExpr() const
bool HexagonMCShuffle(MCContext &Context, bool Fatal, MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst &MCB)
Instances of this class represent a single low-level machine instruction.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static const unsigned cmpgtuBitOpcode[8]
static unsigned getCompoundOp(MCInst const &HMCI)
getCompoundOp - Return the index from 0-7 into the above opcode lists.
static const unsigned cmpeqiBitOpcode[8]
Interface to description of machine instruction set.
static MCInst * getCompoundInsn(MCContext &Context, MCInst const &L, MCInst const &R)
SmallVectorImpl< MCOperand >::iterator iterator
static bool isOrderedCompoundPair(MCInst const &MIa, bool IsExtendedA, MCInst const &MIb, bool IsExtendedB)
Non-Symmetrical. See if these two instructions are fit for compound pair.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setOpcode(unsigned Op)
size_t const bundleInstructionsOffset
static unsigned getCompoundCandidateGroup(MCInst const &MI, bool IsExtended)
const MCOperand & getOperand(unsigned i) const
static const unsigned cmpgtn1BitOpcode[8]
int64_t minConstant(MCInst const &MCI, size_t Index)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static const unsigned cmpeqn1BitOpcode[8]
Generic base class for all target subtargets.
static const unsigned cmpgtiBitOpcode[8]
static const unsigned cmpgtuiBitOpcode[8]
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const unsigned cmpgtBitOpcode[8]
void addOperand(const MCOperand &Op)
unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI)
Return the Hexagon ISA class for the insn.
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.
static bool lookForCompound(MCInstrInfo const &MCII, MCContext &Context, MCInst &MCI)