1 //=== MipsInstPrinter.h - Convert Mips MCInst to assembly syntax -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This class prints a Mips MCInst to a .s file.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_MIPS_INSTPRINTER_MIPSINSTPRINTER_H
15 #define LLVM_LIB_TARGET_MIPS_INSTPRINTER_MIPSINSTPRINTER_H
16 #include "llvm/MC/MCInstPrinter.h"
19 // These enumeration declarations were originally in MipsInstrInfo.h but
20 // had to be moved here to avoid circular dependencies between
21 // LLVMMipsCodeGen and LLVMMipsAsmPrinter.
32 // Mips Condition Codes
34 // To be used with float branch True
52 // To be used with float branch False
53 // This conditions have the same mnemonic as the
54 // above ones, but are used with a branch False;
73 const char *MipsFCCToString(Mips::CondCode CC);
74 } // end namespace Mips
78 class MipsInstPrinter : public MCInstPrinter {
80 MipsInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
81 const MCRegisterInfo &MRI)
82 : MCInstPrinter(MAI, MII, MRI) {}
84 // Autogenerated by tblgen.
85 void printInstruction(const MCInst *MI, raw_ostream &O);
86 static const char *getRegisterName(unsigned RegNo);
88 void printRegName(raw_ostream &OS, unsigned RegNo) const override;
89 void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
90 const MCSubtargetInfo &STI) override;
92 bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
93 void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
94 unsigned PrintMethodIdx, raw_ostream &O);
97 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
98 void printUnsignedImm(const MCInst *MI, int opNum, raw_ostream &O);
99 void printUnsignedImm8(const MCInst *MI, int opNum, raw_ostream &O);
100 void printMemOperand(const MCInst *MI, int opNum, raw_ostream &O);
101 void printMemOperandEA(const MCInst *MI, int opNum, raw_ostream &O);
102 void printFCCOperand(const MCInst *MI, int opNum, raw_ostream &O);
103 void printRegisterPair(const MCInst *MI, int opNum, raw_ostream &O);
104 void printSHFMask(const MCInst *MI, int opNum, raw_ostream &O);
106 bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo,
108 bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo0,
109 unsigned OpNo1, raw_ostream &OS);
110 bool printAlias(const MCInst &MI, raw_ostream &OS);
111 void printSaveRestore(const MCInst *MI, raw_ostream &O);
112 void printRegisterList(const MCInst *MI, int opNum, raw_ostream &O);
114 } // end namespace llvm