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