xref: /aosp_15_r20/external/llvm/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //= LanaiInstPrinter.h - Convert Lanai MCInst to asm syntax -------*- C++ -*--//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This class prints a Lanai MCInst to a .s file.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_LANAI_INSTPRINTER_LANAIINSTPRINTER_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_LANAI_INSTPRINTER_LANAIINSTPRINTER_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCInstPrinter.h"
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker namespace llvm {
20*9880d681SAndroid Build Coastguard Worker class MCOperand;
21*9880d681SAndroid Build Coastguard Worker 
22*9880d681SAndroid Build Coastguard Worker class LanaiInstPrinter : public MCInstPrinter {
23*9880d681SAndroid Build Coastguard Worker public:
LanaiInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)24*9880d681SAndroid Build Coastguard Worker   LanaiInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
25*9880d681SAndroid Build Coastguard Worker                    const MCRegisterInfo &MRI)
26*9880d681SAndroid Build Coastguard Worker       : MCInstPrinter(MAI, MII, MRI) {}
27*9880d681SAndroid Build Coastguard Worker 
28*9880d681SAndroid Build Coastguard Worker   void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
29*9880d681SAndroid Build Coastguard Worker                  const MCSubtargetInfo &STI) override;
30*9880d681SAndroid Build Coastguard Worker   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
31*9880d681SAndroid Build Coastguard Worker                     const char *Modifier = 0);
32*9880d681SAndroid Build Coastguard Worker   void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
33*9880d681SAndroid Build Coastguard Worker   void printMemRiOperand(const MCInst *MI, int OpNo, raw_ostream &O,
34*9880d681SAndroid Build Coastguard Worker                          const char *Modifier = 0);
35*9880d681SAndroid Build Coastguard Worker   void printMemRrOperand(const MCInst *MI, int OpNo, raw_ostream &O,
36*9880d681SAndroid Build Coastguard Worker                          const char *Modifier = 0);
37*9880d681SAndroid Build Coastguard Worker   void printMemSplsOperand(const MCInst *MI, int OpNo, raw_ostream &O,
38*9880d681SAndroid Build Coastguard Worker                            const char *Modifier = 0);
39*9880d681SAndroid Build Coastguard Worker   void printCCOperand(const MCInst *MI, int OpNo, raw_ostream &O);
40*9880d681SAndroid Build Coastguard Worker   void printAluOperand(const MCInst *MI, int OpNo, raw_ostream &O);
41*9880d681SAndroid Build Coastguard Worker   void printHi16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
42*9880d681SAndroid Build Coastguard Worker   void printHi16AndImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
43*9880d681SAndroid Build Coastguard Worker   void printLo16AndImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
44*9880d681SAndroid Build Coastguard Worker   void printMemImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
45*9880d681SAndroid Build Coastguard Worker 
46*9880d681SAndroid Build Coastguard Worker   // Autogenerated by tblgen.
47*9880d681SAndroid Build Coastguard Worker   void printInstruction(const MCInst *MI, raw_ostream &O);
48*9880d681SAndroid Build Coastguard Worker   bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
49*9880d681SAndroid Build Coastguard Worker   void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
50*9880d681SAndroid Build Coastguard Worker                                unsigned PrintMethodIdx, raw_ostream &O);
51*9880d681SAndroid Build Coastguard Worker   static const char *getRegisterName(unsigned RegNo);
52*9880d681SAndroid Build Coastguard Worker   void printRegName(raw_ostream &OS, unsigned RegNo) const override;
53*9880d681SAndroid Build Coastguard Worker 
54*9880d681SAndroid Build Coastguard Worker private:
55*9880d681SAndroid Build Coastguard Worker   bool printAlias(const MCInst *MI, raw_ostream &Ostream);
56*9880d681SAndroid Build Coastguard Worker   bool printInst(const MCInst *MI, raw_ostream &Ostream, StringRef Alias,
57*9880d681SAndroid Build Coastguard Worker                  unsigned OpNo0, unsigned OpnNo1);
58*9880d681SAndroid Build Coastguard Worker   bool printMemoryLoadIncrement(const MCInst *MI, raw_ostream &Ostream,
59*9880d681SAndroid Build Coastguard Worker                                 StringRef Opcode, int AddOffset);
60*9880d681SAndroid Build Coastguard Worker   bool printMemoryStoreIncrement(const MCInst *MI, raw_ostream &Ostream,
61*9880d681SAndroid Build Coastguard Worker                                  StringRef Opcode, int AddOffset);
62*9880d681SAndroid Build Coastguard Worker };
63*9880d681SAndroid Build Coastguard Worker } // namespace llvm
64*9880d681SAndroid Build Coastguard Worker 
65*9880d681SAndroid Build Coastguard Worker #endif // LLVM_LIB_TARGET_LANAI_INSTPRINTER_LANAIINSTPRINTER_H
66