1//===-- SparcInstPrinter.h - Convert Sparc 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-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This class prints an Sparc MCInst to a .s file.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCINSTPRINTER_H
14#define LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCINSTPRINTER_H
15
16#include "SparcMCTargetDesc.h"
17#include "llvm/MC/MCInstPrinter.h"
18
19namespace llvm {
20
21class SparcInstPrinter : public MCInstPrinter {
22public:
23 SparcInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
24 const MCRegisterInfo &MRI)
25 : MCInstPrinter(MAI, MII, MRI) {}
26
27 void printRegName(raw_ostream &OS, MCRegister Reg) override;
28 void printRegName(raw_ostream &OS, MCRegister Reg, unsigned AltIdx) const;
29 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
30 const MCSubtargetInfo &STI, raw_ostream &O) override;
31 bool printSparcAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
32 raw_ostream &OS);
33 bool isV9(const MCSubtargetInfo &STI) const;
34
35 // Autogenerated by tblgen.
36 std::pair<const char *, uint64_t>
37 getMnemonic(const MCInst &MI) const override;
38 void printInstruction(const MCInst *MI, uint64_t Address,
39 const MCSubtargetInfo &STI, raw_ostream &O);
40 void printCTILabel(const MCInst *MI, uint64_t Address, unsigned OpNum,
41 const MCSubtargetInfo &STI, raw_ostream &O);
42 bool printAliasInstr(const MCInst *MI, uint64_t Address,
43 const MCSubtargetInfo &STI, raw_ostream &O);
44 void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
45 unsigned OpIdx, unsigned PrintMethodIdx,
46 const MCSubtargetInfo &STI, raw_ostream &O);
47 static const char *getRegisterName(MCRegister Reg,
48 unsigned AltIdx = SP::NoRegAltName);
49
50 void printOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
51 raw_ostream &OS);
52 void printMemOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
53 raw_ostream &OS);
54 void printCCOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
55 raw_ostream &OS);
56 bool printGetPCX(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
57 raw_ostream &OS);
58 void printMembarTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
59 raw_ostream &O);
60 void printASITag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
61 raw_ostream &O);
62 void printPrefetchTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
63 raw_ostream &O);
64};
65} // end namespace llvm
66
67#endif
68