LLVM  11.0.0git
Go to the documentation of this file.
1 //=== MipsInstPrinter.h - Convert Mips MCInst to assembly syntax -*- C++ -*-==//
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 a Mips MCInst to a .s file.
10 //
11 //===----------------------------------------------------------------------===//
15 #include "llvm/MC/MCInstPrinter.h"
17 namespace llvm {
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.
21 namespace Mips {
22 // Mips Branch Codes
29 };
31 // Mips Condition Codes
32 enum CondCode {
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;
70 };
72 const char *MipsFCCToString(Mips::CondCode CC);
73 } // end namespace Mips
76 public:
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, uint64_t Address, 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, uint64_t Address, StringRef Annot,
87  const MCSubtargetInfo &STI, raw_ostream &O) override;
89  bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
90  void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
91  unsigned OpIdx, unsigned PrintMethodIdx,
92  raw_ostream &O);
94 private:
95  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
96  void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
97  raw_ostream &O) {
98  printOperand(MI, OpNum, O);
99  }
100  template <unsigned Bits, unsigned Offset = 0>
101  void printUImm(const MCInst *MI, int opNum, raw_ostream &O);
102  void printMemOperand(const MCInst *MI, int opNum, raw_ostream &O);
103  void printMemOperandEA(const MCInst *MI, int opNum, raw_ostream &O);
104  void printFCCOperand(const MCInst *MI, int opNum, raw_ostream &O);
105  void printSHFMask(const MCInst *MI, int opNum, raw_ostream &O);
107  bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo,
108  raw_ostream &OS);
109  bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo0,
110  unsigned OpNo1, raw_ostream &OS);
111  bool printAlias(const MCInst &MI, raw_ostream &OS);
112  void printSaveRestore(const MCInst *MI, raw_ostream &O);
113  void printRegisterList(const MCInst *MI, int opNum, raw_ostream &O);
114 };
115 } // end namespace llvm
117 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MipsInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
unsigned const MachineRegisterInfo * MRI
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
static void printMemOperand(raw_ostream &OS, const MachineMemOperand &MMO, const MachineFunction *MF, const Module *M, const MachineFrameInfo *MFI, const TargetInstrInfo *TII, LLVMContext &Ctx)
const char * MipsFCCToString(Mips::CondCode CC)
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:42
Generic base class for all target subtargets.
static std::string getRegisterName(const TargetRegisterInfo *TRI, Register Reg)
Definition: MIParser.cpp:1163
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57