Home | History | Annotate | Download | only in MCTargetDesc
      1 //=-- HexagonMCShuffler.h ---------------------------------------------------=//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This declares the shuffling of insns inside a bundle according to the
     11 // packet formation rules of the Hexagon ISA.
     12 //
     13 //===----------------------------------------------------------------------===//
     14 
     15 #ifndef HEXAGONMCSHUFFLER_H
     16 #define HEXAGONMCSHUFFLER_H
     17 
     18 #include "MCTargetDesc/HexagonShuffler.h"
     19 
     20 namespace llvm {
     21 
     22 class MCInst;
     23 
     24 // Insn bundle shuffler.
     25 class HexagonMCShuffler : public HexagonShuffler {
     26   bool immext_present;
     27   bool duplex_present;
     28 
     29 public:
     30   HexagonMCShuffler(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
     31                     MCInst &MCB)
     32       : HexagonShuffler(MCII, STI) {
     33     init(MCB);
     34   };
     35   HexagonMCShuffler(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
     36                     MCInst &MCB, const MCInst *AddMI,
     37                     bool bInsertAtFront = false)
     38       : HexagonShuffler(MCII, STI) {
     39     init(MCB, AddMI, bInsertAtFront);
     40   };
     41 
     42   // Copy reordered bundle to another.
     43   void copyTo(MCInst &MCB);
     44   // Reorder and copy result to another.
     45   bool reshuffleTo(MCInst &MCB);
     46 
     47   bool immextPresent() const { return immext_present; };
     48   bool duplexPresent() const { return duplex_present; };
     49 
     50 private:
     51   void init(MCInst &MCB);
     52   void init(MCInst &MCB, const MCInst *AddMI, bool bInsertAtFront = false);
     53 };
     54 
     55 // Invocation of the shuffler.
     56 bool HexagonMCShuffle(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
     57                       MCInst &);
     58 bool HexagonMCShuffle(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
     59                       MCInst &, const MCInst *, int);
     60 unsigned HexagonMCShuffle(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
     61                           MCContext &Context, MCInst &,
     62                           SmallVector<DuplexCandidate, 8>);
     63 }
     64 
     65 #endif // HEXAGONMCSHUFFLER_H
     66