71 lines · c
1//===- HexagonMCShuffler.h --------------------------------------*- C++ -*-===//2//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-exception6//7//===----------------------------------------------------------------------===//8//9// This declares the shuffling of insns inside a bundle according to the10// packet formation rules of the Hexagon ISA.11//12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCSHUFFLER_H15#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCSHUFFLER_H16 17#include "MCTargetDesc/HexagonMCInstrInfo.h"18#include "MCTargetDesc/HexagonShuffler.h"19#include "llvm/ADT/SmallVector.h"20 21namespace llvm {22 23class MCContext;24class MCInst;25class MCInstrInfo;26class MCSubtargetInfo;27 28// Insn bundle shuffler.29class HexagonMCShuffler : public HexagonShuffler {30public:31 HexagonMCShuffler(MCContext &Context, bool ReportErrors,32 MCInstrInfo const &MCII, MCSubtargetInfo const &STI,33 MCInst &MCB)34 : HexagonShuffler(Context, ReportErrors, MCII, STI) {35 init(MCB);36 }37 38 HexagonMCShuffler(MCContext &Context, bool ReportErrors,39 MCInstrInfo const &MCII, MCSubtargetInfo const &STI,40 MCInst &MCB, MCInst const &AddMI, bool InsertAtFront)41 : HexagonShuffler(Context, ReportErrors, MCII, STI) {42 init(MCB, AddMI, InsertAtFront);43 }44 45 // Copy reordered bundle to another.46 void copyTo(MCInst &MCB);47 48 // Reorder and copy result to another.49 bool reshuffleTo(MCInst &MCB);50 51private:52 void init(MCInst &MCB);53 void init(MCInst &MCB, MCInst const &AddMI, bool InsertAtFront);54};55 56// Invocation of the shuffler. Returns true if the shuffle succeeded. If57// true, MCB will contain the newly-shuffled packet.58bool HexagonMCShuffle(MCContext &Context, bool ReportErrors,59 MCInstrInfo const &MCII, MCSubtargetInfo const &STI,60 MCInst &MCB);61bool HexagonMCShuffle(MCContext &Context, MCInstrInfo const &MCII,62 MCSubtargetInfo const &STI, MCInst &MCB,63 MCInst const &AddMI, int fixupCount);64bool HexagonMCShuffle(MCContext &Context, MCInstrInfo const &MCII,65 MCSubtargetInfo const &STI, MCInst &MCB,66 SmallVector<DuplexCandidate, 8> possibleDuplexes);67 68} // end namespace llvm69 70#endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCSHUFFLER_H71