diff options
Diffstat (limited to 'contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h')
-rw-r--r-- | contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h b/contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h index a093f85..10a9590 100644 --- a/contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h +++ b/contrib/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h @@ -35,7 +35,8 @@ public: HexagonResource(unsigned s) { setUnits(s); }; void setUnits(unsigned s) { - Slots = s & ~(~0U << HEXAGON_PACKET_SIZE); + Slots = s & ((1u << HEXAGON_PACKET_SIZE) - 1); + setWeight(s); }; unsigned setWeight(unsigned s); @@ -86,10 +87,10 @@ public: unsigned s, MCInst const *id); static void SetupTUL(TypeUnitsAndLanes *TUL, StringRef CPU); - bool isValid() const { return (Valid); }; - unsigned getLanes() const { return (Lanes); }; - bool mayLoad() const { return (Load); }; - bool mayStore() const { return (Store); }; + bool isValid() const { return Valid; }; + unsigned getLanes() const { return Lanes; }; + bool mayLoad() const { return Load; }; + bool mayStore() const { return Store; }; }; // Handle to an insn used by the shuffling algorithm. @@ -100,21 +101,17 @@ class HexagonInstr { MCInst const *Extender; HexagonResource Core; HexagonCVIResource CVI; - bool SoloException; public: HexagonInstr(HexagonCVIResource::TypeUnitsAndLanes *T, MCInstrInfo const &MCII, MCInst const *id, - MCInst const *Extender, unsigned s, bool x = false) - : ID(id), Extender(Extender), Core(s), CVI(T, MCII, s, id), - SoloException(x) {}; + MCInst const *Extender, unsigned s) + : ID(id), Extender(Extender), Core(s), CVI(T, MCII, s, id) {}; - MCInst const *getDesc() const { return (ID); }; + MCInst const &getDesc() const { return *ID; }; MCInst const *getExtender() const { return Extender; } - unsigned isSoloException() const { return (SoloException); }; - // Check if the handles are in ascending order for shuffling purposes. bool operator<(const HexagonInstr &B) const { return (HexagonResource::lessWeight(B.Core, Core)); @@ -136,34 +133,23 @@ class HexagonShuffler { // Insn handles in a bundle. HexagonPacket Packet; - - // Shuffling error code. - unsigned Error; + HexagonPacket PacketSave; HexagonCVIResource::TypeUnitsAndLanes TUL; protected: + MCContext &Context; int64_t BundleFlags; MCInstrInfo const &MCII; MCSubtargetInfo const &STI; + SMLoc Loc; + bool ReportErrors; public: typedef HexagonPacket::iterator iterator; - enum { - SHUFFLE_SUCCESS = 0, ///< Successful operation. - SHUFFLE_ERROR_INVALID, ///< Invalid bundle. - SHUFFLE_ERROR_STORES, ///< No free slots for store insns. - SHUFFLE_ERROR_LOADS, ///< No free slots for load insns. - SHUFFLE_ERROR_BRANCHES, ///< No free slots for branch insns. - SHUFFLE_ERROR_NOSLOTS, ///< No free slots for other insns. - SHUFFLE_ERROR_SLOTS, ///< Over-subscribed slots. - SHUFFLE_ERROR_ERRATA2, ///< Errata violation (v60). - SHUFFLE_ERROR_STORE_LOAD_CONFLICT, ///< store/load conflict - SHUFFLE_ERROR_UNKNOWN ///< Unknown error. - }; - - explicit HexagonShuffler(MCInstrInfo const &MCII, MCSubtargetInfo const &STI); + HexagonShuffler(MCContext &Context, bool ReportErrors, + MCInstrInfo const &MCII, MCSubtargetInfo const &STI); // Reset to initial state. void reset(); @@ -178,13 +164,11 @@ public: iterator end() { return (Packet.end()); }; // Add insn handle to the bundle . - void append(MCInst const *ID, MCInst const *Extender, unsigned S, - bool X = false); + void append(MCInst const &ID, MCInst const *Extender, unsigned S); // Return the error code for the last check or shuffling of the bundle. - void setError(unsigned Err) { Error = Err; }; - unsigned getError() const { return (Error); }; + void reportError(llvm::Twine const &Msg); }; -} +} // namespace llvm #endif // HEXAGONSHUFFLER_H |