#include "MCTargetDesc/HexagonShuffler.h"
#include "MCTargetDesc/HexagonBaseInfo.h"
#include "MCTargetDesc/HexagonMCInstrInfo.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <optional>
#include <utility>
#define DEBUG_TYPE …
usingnamespacellvm;
namespace {
class HexagonBid { … };
class HexagonUnitAuction { … };
}
unsigned HexagonResource::setWeight(unsigned s) { … }
HexagonCVIResource::HexagonCVIResource(MCInstrInfo const &MCII,
MCSubtargetInfo const &STI,
unsigned s,
MCInst const *id)
: … { … }
struct CVIUnits { … };
HVXInstsT;
static unsigned makeAllBits(unsigned startBit, unsigned Lanes)
{ … }
static bool checkHVXPipes(const HVXInstsT &hvxInsts, unsigned startIdx,
unsigned usedUnits) { … }
HexagonShuffler::HexagonShuffler(MCContext &Context, bool ReportErrors,
MCInstrInfo const &MCII,
MCSubtargetInfo const &STI)
: … { … }
void HexagonShuffler::reset() { … }
void HexagonShuffler::append(MCInst const &ID, MCInst const *Extender,
unsigned S) { … }
static const unsigned Slot0Mask = …;
static const unsigned Slot1Mask = …;
static const unsigned Slot3Mask = …;
static const unsigned slotSingleLoad = …;
static const unsigned slotSingleStore = …;
void HexagonShuffler::restrictSlot1AOK(HexagonPacketSummary const &Summary) { … }
void HexagonShuffler::restrictNoSlot1Store(
HexagonPacketSummary const &Summary) { … }
bool HexagonShuffler::applySlotRestrictions(HexagonPacketSummary const &Summary,
const bool DoShuffle) { … }
void HexagonShuffler::restrictBranchOrder(HexagonPacketSummary const &Summary) { … }
void HexagonShuffler::permitNonSlot() { … }
bool HexagonShuffler::ValidResourceUsage(HexagonPacketSummary const &Summary) { … }
bool HexagonShuffler::restrictStoreLoadOrder(
HexagonPacketSummary const &Summary) { … }
static std::string SlotMaskToText(unsigned SlotMask) { … }
HexagonShuffler::HexagonPacketSummary HexagonShuffler::GetPacketSummary() { … }
bool HexagonShuffler::ValidPacketMemoryOps(
HexagonPacketSummary const &Summary) const { … }
void HexagonShuffler::restrictPreferSlot3(HexagonPacketSummary const &Summary,
const bool DoShuffle) { … }
bool HexagonShuffler::check(const bool RequireShuffle) { … }
std::optional<HexagonShuffler::HexagonPacket>
HexagonShuffler::tryAuction(HexagonPacketSummary const &Summary) { … }
bool HexagonShuffler::shuffle() { … }
void HexagonShuffler::reportResourceError(HexagonPacketSummary const &Summary, StringRef Err) { … }
void HexagonShuffler::reportResourceUsage(HexagonPacketSummary const &Summary) { … }
void HexagonShuffler::reportError(Twine const &Msg) { … }