1 //=== MipsInstPrinter.h - Convert Mips MCInst to assembly syntax -*- C++ -*-==//
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
7 //===----------------------------------------------------------------------===//
9 // This class prints a Mips MCInst to a .s file.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSINSTPRINTER_H
14 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSINSTPRINTER_H
15 #include "llvm/MC/MCInstPrinter.h"
18 // These enumeration declarations were originally in MipsInstrInfo.h but
19 // had to be moved here to avoid circular dependencies between
20 // LLVMMipsCodeGen and LLVMMipsAsmPrinter.
31 // Mips Condition Codes
33 // To be used with float branch True
51 // To be used with float branch False
52 // This conditions have the same mnemonic as the
53 // above ones, but are used with a branch False;
72 const char *MipsFCCToString(Mips::CondCode CC
);
73 } // end namespace Mips
75 class MipsInstPrinter
: public MCInstPrinter
{
77 MipsInstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
78 const MCRegisterInfo
&MRI
)
79 : MCInstPrinter(MAI
, MII
, MRI
) {}
81 // Autogenerated by tblgen.
82 void printInstruction(const MCInst
*MI
, raw_ostream
&O
);
83 static const char *getRegisterName(unsigned RegNo
);
85 void printRegName(raw_ostream
&OS
, unsigned RegNo
) const override
;
86 void printInst(const MCInst
*MI
, raw_ostream
&O
, StringRef Annot
,
87 const MCSubtargetInfo
&STI
) override
;
89 bool printAliasInstr(const MCInst
*MI
, raw_ostream
&OS
);
90 void printCustomAliasOperand(const MCInst
*MI
, unsigned OpIdx
,
91 unsigned PrintMethodIdx
, raw_ostream
&O
);
94 void printOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
95 template <unsigned Bits
, unsigned Offset
= 0>
96 void printUImm(const MCInst
*MI
, int opNum
, raw_ostream
&O
);
97 void printMemOperand(const MCInst
*MI
, int opNum
, raw_ostream
&O
);
98 void printMemOperandEA(const MCInst
*MI
, int opNum
, raw_ostream
&O
);
99 void printFCCOperand(const MCInst
*MI
, int opNum
, raw_ostream
&O
);
100 void printSHFMask(const MCInst
*MI
, int opNum
, raw_ostream
&O
);
102 bool printAlias(const char *Str
, const MCInst
&MI
, unsigned OpNo
,
104 bool printAlias(const char *Str
, const MCInst
&MI
, unsigned OpNo0
,
105 unsigned OpNo1
, raw_ostream
&OS
);
106 bool printAlias(const MCInst
&MI
, raw_ostream
&OS
);
107 void printSaveRestore(const MCInst
*MI
, raw_ostream
&O
);
108 void printRegisterList(const MCInst
*MI
, int opNum
, raw_ostream
&O
);
110 } // end namespace llvm