1 //===- HexagonMCShuffler.h --------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This declares the shuffling of insns inside a bundle according to the
10 // packet formation rules of the Hexagon ISA.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCSHUFFLER_H
15 #define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCSHUFFLER_H
17 #include "MCTargetDesc/HexagonMCInstrInfo.h"
18 #include "MCTargetDesc/HexagonShuffler.h"
19 #include "llvm/ADT/SmallVector.h"
26 class MCSubtargetInfo
;
28 // Insn bundle shuffler.
29 class HexagonMCShuffler
: public HexagonShuffler
{
31 HexagonMCShuffler(MCContext
&Context
, bool Fatal
, MCInstrInfo
const &MCII
,
32 MCSubtargetInfo
const &STI
, MCInst
&MCB
)
33 : HexagonShuffler(Context
, Fatal
, MCII
, STI
) {
37 HexagonMCShuffler(MCContext
&Context
, bool Fatal
, MCInstrInfo
const &MCII
,
38 MCSubtargetInfo
const &STI
, MCInst
&MCB
,
39 MCInst
const &AddMI
, bool InsertAtFront
)
40 : HexagonShuffler(Context
, Fatal
, MCII
, STI
) {
41 init(MCB
, AddMI
, InsertAtFront
);
44 // Copy reordered bundle to another.
45 void copyTo(MCInst
&MCB
);
47 // Reorder and copy result to another.
48 bool reshuffleTo(MCInst
&MCB
);
51 void init(MCInst
&MCB
);
52 void init(MCInst
&MCB
, MCInst
const &AddMI
, bool InsertAtFront
);
55 // Invocation of the shuffler.
56 bool HexagonMCShuffle(MCContext
&Context
, bool Fatal
, MCInstrInfo
const &MCII
,
57 MCSubtargetInfo
const &STI
, MCInst
&MCB
);
58 bool HexagonMCShuffle(MCContext
&Context
, MCInstrInfo
const &MCII
,
59 MCSubtargetInfo
const &STI
, MCInst
&MCB
,
60 MCInst
const &AddMI
, int fixupCount
);
61 bool HexagonMCShuffle(MCContext
&Context
, MCInstrInfo
const &MCII
,
62 MCSubtargetInfo
const &STI
, MCInst
&MCB
,
63 SmallVector
<DuplexCandidate
, 8> possibleDuplexes
);
65 } // end namespace llvm
67 #endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCSHUFFLER_H