35 return Register != Hexagon::NoRegister;
40 : MCII(MCII), BundleCurrent(Inst.
begin() +
42 BundleEnd(Inst.
end()), DuplexCurrent(Inst.
end()), DuplexEnd(Inst.
end()) {}
45 MCInst const &Inst, std::nullptr_t)
46 : MCII(MCII), BundleCurrent(Inst.
end()), BundleEnd(Inst.
end()),
47 DuplexCurrent(Inst.
end()), DuplexEnd(Inst.
end()) {}
50 if (DuplexCurrent != DuplexEnd) {
52 if (DuplexCurrent == DuplexEnd) {
53 DuplexCurrent = BundleEnd;
54 DuplexEnd = BundleEnd;
60 if (BundleCurrent != BundleEnd) {
61 MCInst const &Inst = *BundleCurrent->getInst();
63 DuplexCurrent = Inst.
begin();
64 DuplexEnd = Inst.
end();
71 if (DuplexCurrent != DuplexEnd)
72 return *DuplexCurrent->getInst();
73 return *BundleCurrent->getInst();
77 return BundleCurrent == Other.BundleCurrent && BundleEnd == Other.BundleEnd &&
78 DuplexCurrent == Other.DuplexCurrent && DuplexEnd == Other.DuplexEnd;
127 bool CheckOk = Check ? Check->
check(
false) :
true;
152 CheckOk = Check ? Check->
check(
true) :
true;
179 assert((iClass <= 0xf) &&
"iClass must have range of 0 to 0xf");
181 duplexInst->
setOpcode(Hexagon::DuplexIClass0 + iClass);
229 using namespace Hexagon;
279 const auto &HExpr = cast<HexagonMCExpr>(Expr);
281 return *HExpr.getExpr();
419 for (
unsigned Stage = II[SchedClass].FirstStage + 1;
420 Stage < II[SchedClass].
LastStage; ++Stage) {
488 auto Result = Hexagon::BUNDLE == MCI.
getOpcode();
500 if (isa<HexagonMCExpr>(MO.
getExpr()) &&
516 if (isa<HexagonMCExpr>(MO.
getExpr()) &&
520 if (!MO.
getExpr()->evaluateAsAbsolute(Value))
524 return (MinValue > Value || Value > MaxValue);
560 return ((Reg >= Hexagon::D0 && Reg <= Hexagon::D3) ||
561 (Reg >= Hexagon::D8 && Reg <= Hexagon::D11));
586 const uint64_t V =
getType(MCII, MCI);
591 return MCI.
getOpcode() == Hexagon::A4_ext;
601 return (Reg >= Hexagon::R0 && Reg <= Hexagon::R31);
605 return ((Reg >= Hexagon::R0 && Reg <= Hexagon::R7) ||
606 (Reg >= Hexagon::R16 && Reg <= Hexagon::R23));
618 MCInst const &MCI,
unsigned short O) {
659 return (Reg >= Hexagon::P0 && Reg <= Hexagon::P3_0);
699 case Hexagon::SA1_addi:
700 case Hexagon::SA1_addrx:
701 case Hexagon::SA1_addsp:
702 case Hexagon::SA1_and1:
703 case Hexagon::SA1_clrf:
704 case Hexagon::SA1_clrfnew:
705 case Hexagon::SA1_clrt:
706 case Hexagon::SA1_clrtnew:
707 case Hexagon::SA1_cmpeqi:
708 case Hexagon::SA1_combine0i:
709 case Hexagon::SA1_combine1i:
710 case Hexagon::SA1_combine2i:
711 case Hexagon::SA1_combine3i:
712 case Hexagon::SA1_combinerz:
713 case Hexagon::SA1_combinezr:
714 case Hexagon::SA1_dec:
715 case Hexagon::SA1_inc:
716 case Hexagon::SA1_seti:
717 case Hexagon::SA1_setin1:
718 case Hexagon::SA1_sxtb:
719 case Hexagon::SA1_sxth:
720 case Hexagon::SA1_tfr:
721 case Hexagon::SA1_zxtb:
722 case Hexagon::SA1_zxth:
723 case Hexagon::SL1_loadri_io:
724 case Hexagon::SL1_loadrub_io:
725 case Hexagon::SL2_deallocframe:
726 case Hexagon::SL2_jumpr31:
727 case Hexagon::SL2_jumpr31_f:
728 case Hexagon::SL2_jumpr31_fnew:
729 case Hexagon::SL2_jumpr31_t:
730 case Hexagon::SL2_jumpr31_tnew:
731 case Hexagon::SL2_loadrb_io:
732 case Hexagon::SL2_loadrd_sp:
733 case Hexagon::SL2_loadrh_io:
734 case Hexagon::SL2_loadri_sp:
735 case Hexagon::SL2_loadruh_io:
736 case Hexagon::SL2_return:
737 case Hexagon::SL2_return_f:
738 case Hexagon::SL2_return_fnew:
739 case Hexagon::SL2_return_t:
740 case Hexagon::SL2_return_tnew:
741 case Hexagon::SS1_storeb_io:
742 case Hexagon::SS1_storew_io:
743 case Hexagon::SS2_allocframe:
744 case Hexagon::SS2_storebi0:
745 case Hexagon::SS2_storebi1:
746 case Hexagon::SS2_stored_sp:
747 case Hexagon::SS2_storeh_io:
748 case Hexagon::SS2_storew_sp:
749 case Hexagon::SS2_storewi0:
750 case Hexagon::SS2_storewi1:
771 if (!MCO.
getExpr()->evaluateAsAbsolute(Value))
819 return {0, 0,
false};
824 return {0, 0,
false};
848 assert(Duplex !=
nullptr);
874 unsigned Producer2) {
877 if (Producer >= Hexagon::W0 && Producer <= Hexagon::W15)
878 if (Consumer >= Hexagon::V0 && Consumer <= Hexagon::V31)
879 return (Consumer - Hexagon::V0) & 0x1;
880 if (Producer2 != Hexagon::NoRegister)
881 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.
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.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false)
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)
Align max(MaybeAlign Lhs, Align Rhs)
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.
bool isRestrictSlot1AOK(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn can be packaged only with an A-type insn in slot #1.
Wrapper class representing virtual and physical registers.
void addConstant(MCInst &MI, uint64_t Value, MCContext &Context)
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI)