54 lines · c
1//===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//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//10//===----------------------------------------------------------------------===//11 12#ifndef LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H13#define LLVM_LIB_TARGET_HEXAGON_INSTPRINTER_HEXAGONINSTPRINTER_H14 15#include "llvm/MC/MCInstPrinter.h"16 17namespace llvm {18/// Prints bundles as a newline separated list of individual instructions19/// Duplexes are separated by a vertical tab \v character20/// A trailing line includes bundle properties such as endloop0/121///22/// r0 = add(r1, r2)23/// r0 = #0 \v jump 0x024/// :endloop0 :endloop125class HexagonInstPrinter : public MCInstPrinter {26public:27 explicit HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII,28 MCRegisterInfo const &MRI)29 : MCInstPrinter(MAI, MII, MRI), MII(MII) {}30 31 void printInst(MCInst const *MI, uint64_t Address, StringRef Annot,32 const MCSubtargetInfo &STI, raw_ostream &O) override;33 void printRegName(raw_ostream &O, MCRegister Reg) override;34 35 static char const *getRegisterName(MCRegister Reg);36 37 std::pair<const char *, uint64_t>38 getMnemonic(const MCInst &MI) const override;39 void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);40 void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;41 void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;42 43 MCAsmInfo const &getMAI() const { return MAI; }44 MCInstrInfo const &getMII() const { return MII; }45 46private:47 MCInstrInfo const &MII;48 bool HasExtender = false;49};50 51} // end namespace llvm52 53#endif54