xref: /llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.h (revision eeb987f6f35aa614ed7a555be33d67c5cb1be230)
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 
19 namespace llvm {
20 
21 class SparcInstPrinter : public MCInstPrinter {
22 public:
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   bool printAliasInstr(const MCInst *MI, uint64_t Address,
41                        const MCSubtargetInfo &STI, raw_ostream &O);
42   void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
43                                unsigned OpIdx, unsigned PrintMethodIdx,
44                                const MCSubtargetInfo &STI, raw_ostream &O);
45   static const char *getRegisterName(MCRegister Reg,
46                                      unsigned AltIdx = SP::NoRegAltName);
47 
48   void printOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
49                     raw_ostream &OS);
50   void printMemOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
51                        raw_ostream &OS);
52   void printCCOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
53                       raw_ostream &OS);
54   bool printGetPCX(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
55                    raw_ostream &OS);
56   void printMembarTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
57                       raw_ostream &O);
58   void printASITag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
59                    raw_ostream &O);
60   void printPrefetchTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
61                         raw_ostream &O);
62 };
63 } // end namespace llvm
64 
65 #endif
66