diff --git a/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h b/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h --- a/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h +++ b/llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h @@ -18,6 +18,7 @@ #include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include #include +#include #include namespace llvm { @@ -37,7 +38,7 @@ // bottom-up scheduler, then the scoreboard cycles are the inverse of the // scheduler's cycles. class Scoreboard { - unsigned *Data = nullptr; + uint64_t *Data = nullptr; // The maximum number of cycles monitored by the Scoreboard. This // value is determined based on the target itineraries to ensure @@ -56,7 +57,7 @@ size_t getDepth() const { return Depth; } - unsigned& operator[](size_t idx) const { + uint64_t& operator[](size_t idx) const { // Depth is expected to be a power-of-2. assert(Depth && !(Depth & (Depth - 1)) && "Scoreboard was not initialized properly!"); @@ -67,7 +68,7 @@ void reset(size_t d = 1) { if (!Data) { Depth = d; - Data = new unsigned[Depth]; + Data = new uint64_t[Depth]; } memset(Data, 0, Depth * sizeof(Data[0])); diff --git a/llvm/include/llvm/MC/MCInstrItineraries.h b/llvm/include/llvm/MC/MCInstrItineraries.h --- a/llvm/include/llvm/MC/MCInstrItineraries.h +++ b/llvm/include/llvm/MC/MCInstrItineraries.h @@ -62,7 +62,7 @@ }; unsigned Cycles_; ///< Length of stage in machine cycles - unsigned Units_; ///< Choice of functional units + uint64_t Units_; ///< Choice of functional units int NextCycles_; ///< Number of machine cycles to next stage ReservationKinds Kind_; ///< Kind of the FU reservation @@ -72,7 +72,7 @@ } /// Returns the choice of FUs. - unsigned getUnits() const { + uint64_t getUnits() const { return Units_; } diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -905,7 +905,7 @@ struct FuncUnitSorter { const InstrItineraryData *InstrItins; const MCSubtargetInfo *STI; - DenseMap Resources; + DenseMap Resources; FuncUnitSorter(const TargetSubtargetInfo &TSI) : InstrItins(TSI.getInstrItineraryData()), STI(&TSI) {} @@ -913,14 +913,14 @@ // Compute the number of functional unit alternatives needed // at each stage, and take the minimum value. We prioritize the // instructions by the least number of choices first. - unsigned minFuncUnits(const MachineInstr *Inst, unsigned &F) const { + unsigned minFuncUnits(const MachineInstr *Inst, uint64_t &F) const { unsigned SchedClass = Inst->getDesc().getSchedClass(); unsigned min = UINT_MAX; if (InstrItins && !InstrItins->isEmpty()) { for (const InstrStage &IS : make_range(InstrItins->beginStage(SchedClass), InstrItins->endStage(SchedClass))) { - unsigned funcUnits = IS.getUnits(); + uint64_t funcUnits = IS.getUnits(); unsigned numAlternatives = countPopulation(funcUnits); if (numAlternatives < min) { min = numAlternatives; @@ -966,7 +966,7 @@ for (const InstrStage &IS : make_range(InstrItins->beginStage(SchedClass), InstrItins->endStage(SchedClass))) { - unsigned FuncUnits = IS.getUnits(); + uint64_t FuncUnits = IS.getUnits(); if (countPopulation(FuncUnits) == 1) Resources[FuncUnits]++; } @@ -994,7 +994,7 @@ /// Return true if IS1 has less priority than IS2. bool operator()(const MachineInstr *IS1, const MachineInstr *IS2) const { - unsigned F1 = 0, F2 = 0; + uint64_t F1 = 0, F2 = 0; unsigned MFUs1 = minFuncUnits(IS1, F1); unsigned MFUs2 = minFuncUnits(IS2, F2); if (MFUs1 == MFUs2) diff --git a/llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp b/llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp --- a/llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp +++ b/llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp @@ -92,9 +92,9 @@ last--; for (unsigned i = 0; i <= last; i++) { - unsigned FUs = (*this)[i]; + uint64_t FUs = (*this)[i]; dbgs() << "\t"; - for (int j = 31; j >= 0; j--) + for (int j = 63; j >= 0; j--) dbgs() << ((FUs & (1 << j)) ? '1' : '0'); dbgs() << '\n'; } @@ -142,7 +142,7 @@ break; } - unsigned freeUnits = IS->getUnits(); + uint64_t freeUnits = IS->getUnits(); switch (IS->getReservationKind()) { case InstrStage::Required: // Required FUs conflict with both reserved and required ones @@ -193,7 +193,7 @@ assert(((cycle + i) < RequiredScoreboard.getDepth()) && "Scoreboard depth exceeded!"); - unsigned freeUnits = IS->getUnits(); + uint64_t freeUnits = IS->getUnits(); switch (IS->getReservationKind()) { case InstrStage::Required: // Required FUs conflict with both reserved and required ones @@ -206,7 +206,7 @@ } // reduce to a single unit - unsigned freeUnit = 0; + uint64_t freeUnit = 0; do { freeUnit = freeUnits; freeUnits = freeUnit & (freeUnit - 1); diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.h b/llvm/lib/Target/Hexagon/HexagonInstrInfo.h --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.h +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.h @@ -461,7 +461,7 @@ short getRegForm(const MachineInstr &MI) const; unsigned getSize(const MachineInstr &MI) const; uint64_t getType(const MachineInstr &MI) const; - unsigned getUnits(const MachineInstr &MI) const; + uint64_t getUnits(const MachineInstr &MI) const; MachineBasicBlock::instr_iterator expandVGatherPseudo(MachineInstr &MI) const; diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -4331,7 +4331,7 @@ return (F >> HexagonII::TypePos) & HexagonII::TypeMask; } -unsigned HexagonInstrInfo::getUnits(const MachineInstr &MI) const { +uint64_t HexagonInstrInfo::getUnits(const MachineInstr &MI) const { const InstrItineraryData &II = *Subtarget.getInstrItineraryData(); const InstrStage &IS = *II.beginStage(MI.getDesc().getSchedClass()); diff --git a/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp b/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp --- a/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp @@ -1052,7 +1052,7 @@ // we ignore the instruction. const MCInstrDesc& TID = MI.getDesc(); auto *IS = ResourceTracker->getInstrItins()->beginStage(TID.getSchedClass()); - unsigned FuncUnits = IS->getUnits(); + uint64_t FuncUnits = IS->getUnits(); return !FuncUnits; } diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp --- a/llvm/utils/TableGen/SubtargetEmitter.cpp +++ b/llvm/utils/TableGen/SubtargetEmitter.cpp @@ -396,8 +396,8 @@ << "namespace " << Name << "FU {\n"; for (unsigned j = 0, FUN = FUs.size(); j < FUN; ++j) - OS << " const unsigned " << FUs[j]->getName() - << " = 1 << " << j << ";\n"; + OS << " const uint64_t " << FUs[j]->getName() + << " = 1ULL << " << j << ";\n"; OS << "} // end namespace " << Name << "FU\n";