28 : MCII(MCII), BundleCurrent(Inst.
begin() +
30 BundleEnd(Inst.
end()), DuplexCurrent(Inst.
end()), DuplexEnd(Inst.
end()) {}
33 MCInst const &Inst, std::nullptr_t)
34 : MCII(MCII), BundleCurrent(Inst.
end()), BundleEnd(Inst.
end()),
35 DuplexCurrent(Inst.
end()), DuplexEnd(Inst.
end()) {}
38 if (DuplexCurrent != DuplexEnd) {
40 if (DuplexCurrent == DuplexEnd) {
41 DuplexCurrent = BundleEnd;
42 DuplexEnd = BundleEnd;
47 if (BundleCurrent != BundleEnd) {
48 MCInst const &Inst = *BundleCurrent->getInst();
50 DuplexCurrent = Inst.
begin();
51 DuplexEnd = Inst.
end();
58 if (DuplexCurrent != DuplexEnd)
59 return *DuplexCurrent->getInst();
60 return *BundleCurrent->getInst();
64 return BundleCurrent == Other.BundleCurrent && BundleEnd == Other.BundleEnd &&
65 DuplexCurrent == Other.DuplexCurrent && DuplexEnd == Other.DuplexEnd;
113 bool CheckOk = Check ? Check->
check(
false) :
true;
138 CheckOk = Check ? Check->
check(
true) :
true;
155 if (exOp.
getExpr()->evaluateAsAbsolute(Value)) {
189 assert((iClass <= 0xf) &&
"iClass must have range of 0 to 0xf");
191 duplexInst->
setOpcode(Hexagon::DuplexIClass0 + iClass);
233 using namespace Hexagon;
282 const auto &HExpr = cast<HexagonMCExpr>(Expr);
284 return *HExpr.getExpr();
415 for (
unsigned Stage = II[SchedClass].FirstStage + 1;
416 Stage < II[SchedClass].
LastStage; ++Stage) {
484 auto Result = Hexagon::BUNDLE == MCI.
getOpcode();
496 if (isa<HexagonMCExpr>(MO.
getExpr()) &&
512 if (isa<HexagonMCExpr>(MO.
getExpr()) &&
516 if (!MO.
getExpr()->evaluateAsAbsolute(Value))
520 return (MinValue > Value || Value > MaxValue);
544 return ((Reg >= Hexagon::D0 && Reg <= Hexagon::D3) ||
545 (Reg >= Hexagon::D8 && Reg <= Hexagon::D11));
570 return MCI.
getOpcode() == Hexagon::A4_ext;
580 return (Reg >= Hexagon::R0 && Reg <= Hexagon::R31);
584 return ((Reg >= Hexagon::R0 && Reg <= Hexagon::R7) ||
585 (Reg >= Hexagon::R16 && Reg <= Hexagon::R23));
597 MCInst const &MCI,
unsigned short O) {
638 return (Reg >= Hexagon::P0 && Reg <= Hexagon::P3_0);
676 case Hexagon::SA1_addi:
677 case Hexagon::SA1_addrx:
678 case Hexagon::SA1_addsp:
679 case Hexagon::SA1_and1:
680 case Hexagon::SA1_clrf:
681 case Hexagon::SA1_clrfnew:
682 case Hexagon::SA1_clrt:
683 case Hexagon::SA1_clrtnew:
684 case Hexagon::SA1_cmpeqi:
685 case Hexagon::SA1_combine0i:
686 case Hexagon::SA1_combine1i:
687 case Hexagon::SA1_combine2i:
688 case Hexagon::SA1_combine3i:
689 case Hexagon::SA1_combinerz:
690 case Hexagon::SA1_combinezr:
691 case Hexagon::SA1_dec:
692 case Hexagon::SA1_inc:
693 case Hexagon::SA1_seti:
694 case Hexagon::SA1_setin1:
695 case Hexagon::SA1_sxtb:
696 case Hexagon::SA1_sxth:
697 case Hexagon::SA1_tfr:
698 case Hexagon::SA1_zxtb:
699 case Hexagon::SA1_zxth:
700 case Hexagon::SL1_loadri_io:
701 case Hexagon::SL1_loadrub_io:
702 case Hexagon::SL2_deallocframe:
703 case Hexagon::SL2_jumpr31:
704 case Hexagon::SL2_jumpr31_f:
705 case Hexagon::SL2_jumpr31_fnew:
706 case Hexagon::SL2_jumpr31_t:
707 case Hexagon::SL2_jumpr31_tnew:
708 case Hexagon::SL2_loadrb_io:
709 case Hexagon::SL2_loadrd_sp:
710 case Hexagon::SL2_loadrh_io:
711 case Hexagon::SL2_loadri_sp:
712 case Hexagon::SL2_loadruh_io:
713 case Hexagon::SL2_return:
714 case Hexagon::SL2_return_f:
715 case Hexagon::SL2_return_fnew:
716 case Hexagon::SL2_return_t:
717 case Hexagon::SL2_return_tnew:
718 case Hexagon::SS1_storeb_io:
719 case Hexagon::SS1_storew_io:
720 case Hexagon::SS2_allocframe:
721 case Hexagon::SS2_storebi0:
722 case Hexagon::SS2_storebi1:
723 case Hexagon::SS2_stored_sp:
724 case Hexagon::SS2_storeh_io:
725 case Hexagon::SS2_storew_sp:
726 case Hexagon::SS2_storewi0:
727 case Hexagon::SS2_storewi1:
742 if (MCI.
size() <= Index)
748 if (!MCO.
getExpr()->evaluateAsAbsolute(Value))
772 const_cast<HexagonMCExpr &
>(*llvm::cast<HexagonMCExpr>(&Expr));
808 assert(Duplex !=
nullptr);
841 unsigned Producer2) {
844 if (Producer >= Hexagon::W0 && Producer <= Hexagon::W15)
845 if (Consumer >= Hexagon::V0 && Consumer <= Hexagon::V31)
846 return (Consumer - Hexagon::V0) & 0x1;
847 if (Consumer == Producer2)
bool isSoloAin1(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn can be packaged only with an A-type insn in slot #1.
#define HEXAGON_PACKET_INNER_SIZE
void replaceDuplex(MCContext &Context, MCInst &MCI, DuplexCandidate Candidate)
static bool Check(DecodeStatus &Out, DecodeStatus In)
bool isDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
const_iterator end(StringRef path)
Get end iterator over path.
void setMustExtend(bool Val=true)
unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
MCInst const * extenderForIndex(MCInst const &MCB, size_t Index)
unsigned getOtherReservedSlots(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const &MCI)
Return the slots this instruction consumes in addition to the slot(s) it can execute out of...
static MCOperand createExpr(const MCExpr *Val)
void setInst(const MCInst *Val)
void setMustNotExtend(bool Val=true)
Describe properties that are true of each instruction in the target description file.
bool isIntRegForSubInst(unsigned Reg)
bool isBundle(MCInst const &MCI)
unsigned HexagonGetLastSlot()
bool isSolo(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn is solo, i.e., cannot be in a packet.
bool isPredicatedNew(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn is newly predicated.
bool isSubInstruction(MCInst const &MCI)
bool isDblRegForSubInst(unsigned Reg)
MCInst deriveExtender(MCInstrInfo const &MCII, MCInst const &Inst, MCOperand const &MO)
bool isOuterLoop(MCInst const &MCI)
bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn expects newly produced value.
bool isMemStoreReorderEnabled(MCInst const &MCI)
void setInnerLoop(MCInst &MCI)
PacketIterator(MCInstrInfo const &MCII, MCInst const &Inst)
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...
MCOperand const & getNewValueOperand2(MCInstrInfo const &MCII, MCInst const &MCI)
MCInst const & instruction(MCInst const &MCB, size_t Index)
#define HEXAGON_PACKET_SIZE
bool isBranch() const
Returns true if this is a conditional, unconditional, or indirect branch.
bool isCofMax1(MCInstrInfo const &MCII, MCInst const &MCI)
StringRef getName(unsigned Opcode) const
Returns the name for the instructions with the given opcode.
Base class for the full range of assembler expressions which are needed for parsing.
Reg
All possible values of the reg field in the ModR/M byte.
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
bool s27_2_reloc(MCExpr const &Expr)
void padEndloop(MCInst &MCI, MCContext &Context)
StringRef getName(MCInstrInfo const &MCII, MCInst const &MCI)
void setMemReorderDisabled(MCInst &MCI)
Context object for machine code objects.
int getMaxValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return the maximum value of an extendable operand.
bool canonicalizePacket(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCContext &Context, MCInst &MCB, HexagonMCChecker *Checker)
unsigned short getNewValueOp2(MCInstrInfo const &MCII, MCInst const &MCI)
Return the new value or the newly produced value.
bool hasNewValue2(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a second value.
void extendIfNeeded(MCContext &Context, MCInstrInfo const &MCII, MCInst &MCB, MCInst const &MCI)
void setMustExtend(MCExpr const &Expr, bool Val=true)
bool isAccumulator(MCInstrInfo const &MCII, MCInst const &MCI)
Return where the instruction is an accumulator.
const InstrItinerary * InstrItineraries
Instances of this class represent a single low-level machine instruction.
void setS27_2_reloc(bool Val=true)
bool isPrefix(MCInstrInfo const &MCII, MCInst const &MCI)
const MCExpr * getExpr() const
void setMemStoreReorderEnabled(MCInst &MCI)
bool isCompound(MCInstrInfo const &MCII, MCInst const &MCI)
int getMinValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return the minimum value of an extendable operand.
static HexagonMCExpr * create(MCExpr const *Expr, MCContext &Ctx)
bool mustExtend(MCExpr const &Expr)
Interface to description of machine instruction set.
PacketIterator & operator++()
int64_t const outerLoopMask
int64_t const memReorderDisabledMask
bool hasDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
cl::opt< bool > HexagonDisableCompound
void setOuterLoop(MCInst &MCI)
MCExpr const & getExpr(MCExpr const &Expr)
bool isPseudo() const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction...
static wasm::ValType getType(const TargetRegisterClass *RC)
unsigned SubregisterBit(unsigned Consumer, unsigned Producer, unsigned Producer2)
void clampExtended(MCInstrInfo const &MCII, MCContext &Context, MCInst &MCI)
bool prefersSlot3(MCInstrInfo const &MCII, MCInst const &MCI)
bool isCanon(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned short getExtendableOp(MCInstrInfo const &MCII, MCInst const &MCI)
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
int64_t const memStoreReorderEnabledMask
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void setOpcode(unsigned Op)
size_t const bundleInstructionsOffset
bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI)
MCInst const & operator*() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned LastStage
Index of last + 1 stage in itinerary.
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
bool isCVINew(MCInstrInfo const &MCII, MCInst const &MCI)
HexagonII::MemAccessSize getAccessSize(MCInstrInfo const &MCII, MCInst const &MCI)
int64_t minConstant(MCInst const &MCI, size_t Index)
bool HexagonMCShuffle(MCContext &Context, bool Fatal, MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst &)
A range adaptor for a pair of iterators.
unsigned getOpcode() const
unsigned const TypeCVI_FIRST
bool isMemReorderDisabled(MCInst const &MCI)
bool isPredicated(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned const TypeCVI_LAST
bool isExtended(MCInstrInfo const &MCII, MCInst const &MCI)
#define HEXAGON_PACKET_OUTER_SIZE
static MCOperand createInst(const MCInst *Val)
MCInst deriveSubInst(MCInst const &Inst)
llvm_unreachable("Unknown RegBank!")
bool isSoloAX(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn can be packaged only with A and X-type insns.
static std::vector< std::string > Flags
unsigned getSchedClass() const
Return the scheduling class for this instruction.
bool hasExtenderForIndex(MCInst const &MCB, size_t Index)
MCSubtargetInfo - Generic base class for all target subtargets.
const InstrStage HexagonStages[]
const MCInst * getInst() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
void setMustNotExtend(MCExpr const &Expr, bool Val=true)
size_t bundleSize(MCInst const &MCI)
bool check(bool FullCheck=true)
bool mustNotExtend() const
bool hasImmExt(MCInst const &MCI)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isInnerLoop(MCInst const &MCI)
bool isFloat(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether it is a floating-point insn.
An itinerary represents the scheduling information for an instruction.
bool isPredicateLate(MCInstrInfo const &MCII, MCInst const &MCI)
LLVM Value Representation.
static const unsigned Nop
Instruction opcodes emitted via means other than CodeGen.
bool isPredReg(unsigned Reg)
SmallVector< DuplexCandidate, 8 > getDuplexPossibilties(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const &MCB)
Check for a valid bundle.
void addConstExtender(MCContext &Context, MCInstrInfo const &MCII, MCInst &MCB, MCInst const &MCI)
unsigned getUnits(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const &MCI)
Return the slots used by the insn.
bool isConstExtended(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getDuplexRegisterNumbering(unsigned Reg)
bool isOpExtendable(MCInstrInfo const &MCII, MCInst const &MCI, unsigned short)
Return whether the operand is extendable.
bool isIntReg(unsigned Reg)
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
MCInst * deriveDuplex(MCContext &Context, unsigned iClass, MCInst const &inst0, MCInst const &inst1)
bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a value.
unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI)
Return the Hexagon ISA class for the insn.
int64_t const innerLoopMask
void setS27_2_reloc(MCExpr const &Expr, bool Val=true)
unsigned getExtentAlignment(MCInstrInfo const &MCII, MCInst const &MCI)
Instances of this class represent operands of the MCInst class.
bool mustNotExtend(MCExpr const &Expr)
bool isPredicatedTrue(MCInstrInfo const &MCII, MCInst const &MCI)
static MCOperand createImm(int64_t Val)
MCOperand const & getExtendableOperand(MCInstrInfo const &MCII, MCInst const &MCI)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
const MCOperand & getOperand(unsigned i) const
cl::opt< bool > HexagonDisableDuplex
void addConstant(MCInst &MI, uint64_t Value, MCContext &Context)
MCOperand const & getNewValueOperand(MCInstrInfo const &MCII, MCInst const &MCI)
void setExpr(const MCExpr *Val)
bool operator==(PacketIterator const &Other) const
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI)