#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H
#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCINSTRINFO_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/MC/MCInst.h"
#include "llvm/Support/MathExtras.h"
#include <cstddef>
#include <cstdint>
namespace llvm {
class HexagonMCChecker;
class MCContext;
class MCExpr;
class MCInstrDesc;
class MCInstrInfo;
class MCRegisterInfo;
class MCSubtargetInfo;
class DuplexCandidate { … };
namespace Hexagon {
class PacketIterator
: public llvm::iterator_facade_base<
PacketIterator, std::forward_iterator_tag, const MCInst> { … };
}
namespace HexagonMCInstrInfo {
constexpr size_t innerLoopOffset = …;
constexpr int64_t innerLoopMask = …;
constexpr size_t outerLoopOffset = …;
constexpr int64_t outerLoopMask = …;
constexpr size_t memReorderDisabledOffset = …;
constexpr int64_t memReorderDisabledMask = …;
constexpr size_t splitNoMemOrderOffset = …;
constexpr int64_t splitNoMemorderMask = …;
constexpr size_t noShuffleOffset = …;
constexpr int64_t noShuffleMask = …;
constexpr size_t bundleInstructionsOffset = …;
void addConstant(MCInst &MI, uint64_t Value, MCContext &Context);
void addConstExtender(MCContext &Context, MCInstrInfo const &MCII, MCInst &MCB,
MCInst const &MCI);
iterator_range<Hexagon::PacketIterator>
bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI);
iterator_range<MCInst::const_iterator> bundleInstructions(MCInst const &MCI);
size_t bundleSize(MCInst const &MCI);
bool canonicalizePacket(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
MCContext &Context, MCInst &MCB,
HexagonMCChecker *Checker,
bool AttemptCompatibility = false);
bool IsABranchingInst(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
MCInst const &I);
MCInst *deriveDuplex(MCContext &Context, unsigned iClass, MCInst const &inst0,
MCInst const &inst1);
MCInst deriveExtender(MCInstrInfo const &MCII, MCInst const &Inst,
MCOperand const &MO);
MCInst deriveSubInst(MCInst const &Inst);
MCInst const *extenderForIndex(MCInst const &MCB, size_t Index);
void extendIfNeeded(MCContext &Context, MCInstrInfo const &MCII, MCInst &MCB,
MCInst const &MCI);
unsigned getMemAccessSize(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned getAddrMode(MCInstrInfo const &MCII, MCInst const &MCI);
MCInstrDesc const &getDesc(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned getDuplexCandidateGroup(MCInst const &MI);
SmallVector<DuplexCandidate, 8>
getDuplexPossibilties(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
MCInst const &MCB);
unsigned getDuplexRegisterNumbering(MCRegister Reg);
MCExpr const &getExpr(MCExpr const &Expr);
unsigned short getExtendableOp(MCInstrInfo const &MCII, MCInst const &MCI);
MCOperand const &getExtendableOperand(MCInstrInfo const &MCII,
MCInst const &MCI);
unsigned getExtentAlignment(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI);
bool isExtentSigned(MCInstrInfo const &MCII, MCInst const &MCI);
int getMaxValue(MCInstrInfo const &MCII, MCInst const &MCI);
int getMinValue(MCInstrInfo const &MCII, MCInst const &MCI);
StringRef getName(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI);
MCOperand const &getNewValueOperand(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned short getNewValueOp2(MCInstrInfo const &MCII, MCInst const &MCI);
MCOperand const &getNewValueOperand2(MCInstrInfo const &MCII,
MCInst const &MCI);
unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned getCVIResources(MCInstrInfo const &MCII,
MCSubtargetInfo const &STI,
MCInst const &MCI);
unsigned getUnits(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
MCInst const &MCI);
unsigned getOtherReservedSlots(MCInstrInfo const &MCII,
MCSubtargetInfo const &STI, MCInst const &MCI);
bool hasDuplex(MCInstrInfo const &MCII, MCInst const &MCI);
bool hasExtenderForIndex(MCInst const &MCB, size_t Index);
bool hasImmExt(MCInst const &MCI);
bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
bool hasNewValue2(MCInstrInfo const &MCII, MCInst const &MCI);
bool hasTmpDst(MCInstrInfo const &MCII, MCInst const &MCI);
bool hasHvxTmp(MCInstrInfo const &MCII, MCInst const &MCI);
unsigned iClassOfDuplexPair(unsigned Ga, unsigned Gb);
int64_t minConstant(MCInst const &MCI, size_t Index);
template <unsigned N, unsigned S>
bool inRange(MCInst const &MCI, size_t Index) { … }
template <unsigned N, unsigned S>
bool inSRange(MCInst const &MCI, size_t Index) { … }
template <unsigned N> bool inRange(MCInst const &MCI, size_t Index) { … }
MCInst const &instruction(MCInst const &MCB, size_t Index);
bool isAccumulator(MCInstrInfo const &MCII, MCInst const &MCI);
bool isBundle(MCInst const &MCI);
bool isCanon(MCInstrInfo const &MCII, MCInst const &MCI);
bool isCofMax1(MCInstrInfo const &MCII, MCInst const &MCI);
bool isCofRelax1(MCInstrInfo const &MCII, MCInst const &MCI);
bool isCofRelax2(MCInstrInfo const &MCII, MCInst const &MCI);
bool isCompound(MCInstrInfo const &MCII, MCInst const &MCI);
bool isConstExtended(MCInstrInfo const &MCII, MCInst const &MCI);
bool isCVINew(MCInstrInfo const &MCII, MCInst const &MCI);
bool isDblRegForSubInst(MCRegister Reg);
bool isDuplex(MCInstrInfo const &MCII, MCInst const &MCI);
bool isDuplexPair(MCInst const &MIa, MCInst const &MIb);
bool isDuplexPairMatch(unsigned Ga, unsigned Gb);
bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI);
bool isExtended(MCInstrInfo const &MCII, MCInst const &MCI);
bool isFloat(MCInstrInfo const &MCII, MCInst const &MCI);
bool isHVX(MCInstrInfo const &MCII, MCInst const &MCI);
bool isImmext(MCInst const &MCI);
bool isInnerLoop(MCInst const &MCI);
bool isIntReg(MCRegister Reg);
bool isIntRegForSubInst(MCRegister Reg);
bool isMemReorderDisabled(MCInst const &MCI);
bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI);
bool isNewValueStore(MCInstrInfo const &MCII, MCInst const &MCI);
bool isOpExtendable(MCInstrInfo const &MCII, MCInst const &MCI, unsigned short);
bool isOrderedDuplexPair(MCInstrInfo const &MCII, MCInst const &MIa,
bool ExtendedA, MCInst const &MIb, bool ExtendedB,
bool bisReversable, MCSubtargetInfo const &STI);
bool isOuterLoop(MCInst const &MCI);
bool isPredicated(MCInstrInfo const &MCII, MCInst const &MCI);
bool isPredicateLate(MCInstrInfo const &MCII, MCInst const &MCI);
bool isPredicatedNew(MCInstrInfo const &MCII, MCInst const &MCI);
bool isPredicatedTrue(MCInstrInfo const &MCII, MCInst const &MCI);
bool isPredReg(MCRegisterInfo const &MRI, MCRegister Reg);
bool isPredRegister(MCInstrInfo const &MCII, MCInst const &Inst, unsigned I);
bool isPrefix(MCInstrInfo const &MCII, MCInst const &MCI);
bool isSolo(MCInstrInfo const &MCII, MCInst const &MCI);
bool isSoloAX(MCInstrInfo const &MCII, MCInst const &MCI);
bool isRestrictSlot1AOK(MCInstrInfo const &MCII, MCInst const &MCI);
bool isRestrictNoSlot1Store(MCInstrInfo const &MCII, MCInst const &MCI);
bool isSubInstruction(MCInst const &MCI);
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI);
bool mustExtend(MCExpr const &Expr);
bool mustNotExtend(MCExpr const &Expr);
bool requiresSlot(MCSubtargetInfo const &STI, MCInst const &MCI);
bool LoopNeedsPadding(MCInst const &MCB);
unsigned packetSize(StringRef CPU);
unsigned packetSizeSlots(MCSubtargetInfo const &STI);
unsigned slotsConsumed(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
MCInst const &MCI);
void padEndloop(MCInst &MCI, MCContext &Context);
class PredicateInfo { … };
PredicateInfo predicateInfo(MCInstrInfo const &MCII, MCInst const &MCI);
bool prefersSlot3(MCInstrInfo const &MCII, MCInst const &MCI);
void replaceDuplex(MCContext &Context, MCInst &MCI, DuplexCandidate Candidate);
bool s27_2_reloc(MCExpr const &Expr);
void setInnerLoop(MCInst &MCI);
void setMemReorderDisabled(MCInst &MCI);
void setMustExtend(MCExpr const &Expr, bool Val = true);
void setMustNotExtend(MCExpr const &Expr, bool Val = true);
void setS27_2_reloc(MCExpr const &Expr, bool Val = true);
void setOuterLoop(MCInst &MCI);
bool subInstWouldBeExtended(MCInst const &potentialDuplex);
unsigned SubregisterBit(MCRegister Consumer, MCRegister Producer,
MCRegister Producer2);
bool IsVecRegSingle(MCRegister VecReg);
bool IsVecRegPair(MCRegister VecReg);
bool IsReverseVecRegPair(MCRegister VecReg);
bool IsSingleConsumerRefPairProducer(MCRegister Producer, MCRegister Consumer);
std::pair<unsigned, unsigned> GetVecRegPairIndices(MCRegister VecRegPair);
void tryCompound(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
MCContext &Context, MCInst &MCI);
}
}
#endif