37 return Register != Hexagon::NoRegister;
42 : MCII(MCII), BundleCurrent(Inst.
begin() +
44 BundleEnd(Inst.
end()), DuplexCurrent(Inst.
end()), DuplexEnd(Inst.
end()) {}
47 MCInst const &Inst, std::nullptr_t)
48 : MCII(MCII), BundleCurrent(Inst.
end()), BundleEnd(Inst.
end()),
49 DuplexCurrent(Inst.
end()), DuplexEnd(Inst.
end()) {}
52 if (DuplexCurrent != DuplexEnd) {
54 if (DuplexCurrent == DuplexEnd) {
55 DuplexCurrent = BundleEnd;
56 DuplexEnd = BundleEnd;
62 if (BundleCurrent != BundleEnd) {
63 MCInst const &Inst = *BundleCurrent->getInst();
65 DuplexCurrent = Inst.
begin();
66 DuplexEnd = Inst.
end();
73 if (DuplexCurrent != DuplexEnd)
74 return *DuplexCurrent->getInst();
75 return *BundleCurrent->getInst();
79 return BundleCurrent == Other.BundleCurrent && BundleEnd == Other.BundleEnd &&
80 DuplexCurrent == Other.DuplexCurrent && DuplexEnd == Other.DuplexEnd;
129 bool CheckOk = Check ? Check->
check(
false) :
true;
154 CheckOk = Check ? Check->
check(
true) :
true;
181 assert((iClass <= 0xf) &&
"iClass must have range of 0 to 0xf");
183 duplexInst->
setOpcode(Hexagon::DuplexIClass0 + iClass);
231 using namespace Hexagon;
281 const auto &HExpr = cast<HexagonMCExpr>(Expr);
283 return *HExpr.getExpr();
421 for (
unsigned Stage = II[SchedClass].FirstStage + 1;
422 Stage < II[SchedClass].
LastStage; ++Stage) {
490 auto Result = Hexagon::BUNDLE == MCI.
getOpcode();
502 if (isa<HexagonMCExpr>(MO.
getExpr()) &&
518 if (isa<HexagonMCExpr>(MO.
getExpr()) &&
522 if (!MO.
getExpr()->evaluateAsAbsolute(Value))
526 return (MinValue > Value || Value > MaxValue);
562 return ((Reg >= Hexagon::D0 && Reg <= Hexagon::D3) ||
563 (Reg >= Hexagon::D8 && Reg <= Hexagon::D11));
588 const uint64_t V =
getType(MCII, MCI);
593 return MCI.
getOpcode() == Hexagon::A4_ext;
603 return (Reg >= Hexagon::R0 && Reg <= Hexagon::R31);
607 return ((Reg >= Hexagon::R0 && Reg <= Hexagon::R7) ||
608 (Reg >= Hexagon::R16 && Reg <= Hexagon::R23));
620 MCInst const &MCI,
unsigned short O) {
661 return (Reg >= Hexagon::P0 && Reg <= Hexagon::P3_0);
701 case Hexagon::SA1_addi:
702 case Hexagon::SA1_addrx:
703 case Hexagon::SA1_addsp:
704 case Hexagon::SA1_and1:
705 case Hexagon::SA1_clrf:
706 case Hexagon::SA1_clrfnew:
707 case Hexagon::SA1_clrt:
708 case Hexagon::SA1_clrtnew:
709 case Hexagon::SA1_cmpeqi:
710 case Hexagon::SA1_combine0i:
711 case Hexagon::SA1_combine1i:
712 case Hexagon::SA1_combine2i:
713 case Hexagon::SA1_combine3i:
714 case Hexagon::SA1_combinerz:
715 case Hexagon::SA1_combinezr:
716 case Hexagon::SA1_dec:
717 case Hexagon::SA1_inc:
718 case Hexagon::SA1_seti:
719 case Hexagon::SA1_setin1:
720 case Hexagon::SA1_sxtb:
721 case Hexagon::SA1_sxth:
722 case Hexagon::SA1_tfr:
723 case Hexagon::SA1_zxtb:
724 case Hexagon::SA1_zxth:
725 case Hexagon::SL1_loadri_io:
726 case Hexagon::SL1_loadrub_io:
727 case Hexagon::SL2_deallocframe:
728 case Hexagon::SL2_jumpr31:
729 case Hexagon::SL2_jumpr31_f:
730 case Hexagon::SL2_jumpr31_fnew:
731 case Hexagon::SL2_jumpr31_t:
732 case Hexagon::SL2_jumpr31_tnew:
733 case Hexagon::SL2_loadrb_io:
734 case Hexagon::SL2_loadrd_sp:
735 case Hexagon::SL2_loadrh_io:
736 case Hexagon::SL2_loadri_sp:
737 case Hexagon::SL2_loadruh_io:
738 case Hexagon::SL2_return:
739 case Hexagon::SL2_return_f:
740 case Hexagon::SL2_return_fnew:
741 case Hexagon::SL2_return_t:
742 case Hexagon::SL2_return_tnew:
743 case Hexagon::SS1_storeb_io:
744 case Hexagon::SS1_storew_io:
745 case Hexagon::SS2_allocframe:
746 case Hexagon::SS2_storebi0:
747 case Hexagon::SS2_storebi1:
748 case Hexagon::SS2_stored_sp:
749 case Hexagon::SS2_storeh_io:
750 case Hexagon::SS2_storew_sp:
751 case Hexagon::SS2_storewi0:
752 case Hexagon::SS2_storewi1:
773 if (!MCO.
getExpr()->evaluateAsAbsolute(Value))
821 return {0, 0,
false};
826 return {0, 0,
false};
850 assert(Duplex !=
nullptr);
876 unsigned Producer2) {
879 if (Producer >= Hexagon::W0 && Producer <= Hexagon::W15)
880 if (Consumer >= Hexagon::V0 && Consumer <= Hexagon::V31)
881 return (Consumer - Hexagon::V0) & 0x1;
882 if (Producer2 != Hexagon::NoRegister)
883 return Consumer == Producer;
void replaceDuplex(MCContext &Context, MCInst &MCI, DuplexCandidate Candidate)
static bool Check(DecodeStatus &Out, DecodeStatus In)
bool isHVX(MCInstrInfo const &MCII, MCInst const &MCI)
bool isDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
MCInst const & operator*() const
const_iterator end(StringRef path)
Get end iterator over path.
unsigned getAddrMode(MCInstrInfo const &MCII, MCInst const &MCI)
void setMustExtend(bool Val=true)
unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI)
bool hasTmpDst(MCInstrInfo const &MCII, MCInst const &MCI)
return true if instruction has hasTmpDst attribute.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
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)
MCOperand const & getNewValueOperand(MCInstrInfo const &MCII, MCInst const &MCI)
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)
bool isPseudo() const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction...
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 isBranch() const
Returns true if this is a conditional, unconditional, or indirect branch.
void setInnerLoop(MCInst &MCI)
bool isCofRelax1(MCInstrInfo const &MCII, MCInst const &MCI)
bool isImmext(MCInst const &MCI)
PacketIterator & operator++()
static MCOperand createReg(unsigned Reg)
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...
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
const FeatureBitset & getFeatureBits() const
bool isCofMax1(MCInstrInfo const &MCII, MCInst const &MCI)
Base class for the full range of assembler expressions which are needed for parsing.
MCOperand const & getExtendableOperand(MCInstrInfo const &MCII, MCInst const &MCI)
bool isCofRelax2(MCInstrInfo const &MCII, MCInst const &MCI)
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
bool isRestrictNoSlot1Store(MCInstrInfo const &MCII, MCInst const &MCI)
MCInst const * extenderForIndex(MCInst const &MCB, size_t Index)
bool isPredicated() const
bool s27_2_reloc(MCExpr const &Expr)
void padEndloop(MCInst &MCI, MCContext &Context)
StringRef getName(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getReg() const
Returns the register number.
void setMemReorderDisabled(MCInst &MCI)
Context object for machine code objects.
MCInst const & instruction(MCInst const &MCB, size_t Index)
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)
PredicateInfo predicateInfo(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned short getNewValueOp2(MCInstrInfo const &MCII, MCInst const &MCI)
Return the new value or the newly produced value.
const MCInst * getInst() const
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)
const MCExpr * getExpr() const
bool HexagonMCShuffle(MCContext &Context, bool Fatal, MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst &MCB)
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)
unsigned getSchedClass() const
Return the scheduling class for this instruction.
bool isCompound(MCInstrInfo const &MCII, MCInst const &MCI)
int getMinValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return the minimum value of an extendable operand.
bool mustExtend(MCExpr const &Expr)
bool isExtentSigned(MCInstrInfo const &MCII, MCInst const &MCI)
MCOperand const & getNewValueOperand2(MCInstrInfo const &MCII, MCInst const &MCI)
Interface to description of machine instruction set.
int64_t const outerLoopMask
int64_t const memReorderDisabledMask
bool hasDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
cl::opt< bool > HexagonDisableCompound
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
void setOuterLoop(MCInst &MCI)
bool operator==(PacketIterator const &Other) const
StringRef getName(unsigned Opcode) const
Returns the name for the instructions with the given opcode.
static wasm::ValType getType(const TargetRegisterClass *RC)
unsigned SubregisterBit(unsigned Consumer, unsigned Producer, unsigned Producer2)
bool mustNotExtend() const
bool prefersSlot3(MCInstrInfo const &MCII, MCInst const &MCI)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isCanon(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned short getExtendableOp(MCInstrInfo const &MCII, MCInst const &MCI)
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)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
#define HEXAGON_PACKET_INNER_SIZE
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
const MCOperand & getOperand(unsigned i) const
bool isCVINew(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
int64_t minConstant(MCInst const &MCI, size_t Index)
A range adaptor for a pair of iterators.
unsigned const TypeCVI_FIRST
static LLVM_ATTRIBUTE_UNUSED unsigned getMemAccessSizeInBytes(MemAccessSize S)
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)
static MCOperand createInst(const MCInst *Val)
MCInst deriveSubInst(MCInst const &Inst)
bool isSoloAX(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn can be packaged only with A and X-type insns.
#define HEXAGON_PACKET_OUTER_SIZE
MCExpr const & getExpr(MCExpr const &Expr)
bool hasExtenderForIndex(MCInst const &MCB, size_t Index)
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
Generic base class for all target subtargets.
PacketIterator(MCInstrInfo const &MCII, MCInst const &Inst)
const InstrStage HexagonStages[]
uint16_t LastStage
Index of last + 1 stage in itinerary.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void setMustNotExtend(MCExpr const &Expr, bool Val=true)
size_t bundleSize(MCInst const &MCI)
bool check(bool FullCheck=true)
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)
#define HEXAGON_PACKET_SIZE
LLVM Value Representation.
static const unsigned Nop
Instruction opcodes emitted via means other than CodeGen.
bool isPredReg(unsigned Reg)
const MCOperandInfo * OpInfo
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
unsigned getMemAccessSize(MCInstrInfo const &MCII, MCInst const &MCI)
void setS27_2_reloc(MCExpr const &Expr, bool Val=true)
unsigned getOpcode() const
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)
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
bool isRestrictSlot1AOK(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn can be packaged only with an A-type insn in slot #1.
void addConstant(MCInst &MI, uint64_t Value, MCContext &Context)
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI)