LLVM  13.0.0git
MipsInstPrinter.h
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 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSINSTPRINTER_H
14 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSINSTPRINTER_H
15 #include "llvm/MC/MCInstPrinter.h"
16 
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 };
30 
31 // Mips Condition Codes
32 enum CondCode {
33  // To be used with float branch True
50 
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 };
71 
72 const char *MipsFCCToString(Mips::CondCode CC);
73 } // end namespace Mips
74 
76 public:
78  const MCRegisterInfo &MRI)
79  : MCInstPrinter(MAI, MII, MRI) {}
80 
81  // Autogenerated by tblgen.
82  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
83  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
84  static const char *getRegisterName(unsigned RegNo);
85 
86  void printRegName(raw_ostream &OS, unsigned RegNo) const override;
87  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
88  const MCSubtargetInfo &STI, raw_ostream &O) override;
89 
90  bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
91  void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
92  unsigned OpIdx, unsigned PrintMethodIdx,
93  raw_ostream &O);
94 
95 private:
96  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
97  void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
98  raw_ostream &O) {
99  printOperand(MI, OpNum, O);
100  }
101  template <unsigned Bits, unsigned Offset = 0>
102  void printUImm(const MCInst *MI, int opNum, raw_ostream &O);
103  void printMemOperand(const MCInst *MI, int opNum, raw_ostream &O);
104  void printMemOperandEA(const MCInst *MI, int opNum, raw_ostream &O);
105  void printFCCOperand(const MCInst *MI, int opNum, raw_ostream &O);
106  void printSHFMask(const MCInst *MI, int opNum, raw_ostream &O);
107 
108  bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo,
109  raw_ostream &OS);
110  bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo0,
111  unsigned OpNo1, raw_ostream &OS);
112  bool printAlias(const MCInst &MI, raw_ostream &OS);
113  void printSaveRestore(const MCInst *MI, raw_ostream &O);
114  void printRegisterList(const MCInst *MI, int opNum, raw_ostream &O);
115 };
116 } // end namespace llvm
117 
118 #endif
llvm::Mips::FCOND_OGE
@ FCOND_OGE
Definition: MipsInstPrinter.h:59
llvm::Mips::FCOND_ST
@ FCOND_ST
Definition: MipsInstPrinter.h:62
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:100
llvm
Definition: AllocatorList.h:23
llvm::Mips::FCOND_NLE
@ FCOND_NLE
Definition: MipsInstPrinter.h:68
llvm::Mips::FCOND_UN
@ FCOND_UN
Definition: MipsInstPrinter.h:35
llvm::Mips::FCOND_NGLE
@ FCOND_NGLE
Definition: MipsInstPrinter.h:43
llvm::Mips::FCOND_NGT
@ FCOND_NGT
Definition: MipsInstPrinter.h:49
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::Mips::CondCode
CondCode
Definition: MipsInstPrinter.h:32
llvm::MipsInstPrinter::MipsInstPrinter
MipsInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: MipsInstPrinter.h:77
llvm::Mips::FCOND_NLT
@ FCOND_NLT
Definition: MipsInstPrinter.h:66
llvm::MipsInstPrinter::printAliasInstr
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
llvm::Mips::FCOND_GL
@ FCOND_GL
Definition: MipsInstPrinter.h:65
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::Mips::FCOND_OEQ
@ FCOND_OEQ
Definition: MipsInstPrinter.h:36
llvm::Mips::FCOND_ONE
@ FCOND_ONE
Definition: MipsInstPrinter.h:57
llvm::Mips::FCOND_OLE
@ FCOND_OLE
Definition: MipsInstPrinter.h:40
llvm::Mips::BRANCH_F
@ BRANCH_F
Definition: MipsInstPrinter.h:24
llvm::Mips::FCOND_GT
@ FCOND_GT
Definition: MipsInstPrinter.h:69
llvm::MipsInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
llvm::Mips::FCOND_NGL
@ FCOND_NGL
Definition: MipsInstPrinter.h:45
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::MipsInstPrinter
Definition: MipsInstPrinter.h:75
llvm::Mips::FCOND_UGT
@ FCOND_UGT
Definition: MipsInstPrinter.h:60
llvm::MipsInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
llvm::Mips::FCOND_ULT
@ FCOND_ULT
Definition: MipsInstPrinter.h:39
llvm::Mips::FCOND_LE
@ FCOND_LE
Definition: MipsInstPrinter.h:48
llvm::Mips::FCOND_SEQ
@ FCOND_SEQ
Definition: MipsInstPrinter.h:44
llvm::Mips::FCOND_OR
@ FCOND_OR
Definition: MipsInstPrinter.h:55
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
MCInstPrinter.h
llvm::MipsInstPrinter::printInst
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
Definition: MipsInstPrinter.cpp:78
llvm::MipsInstPrinter::printRegName
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
Definition: MipsInstPrinter.cpp:74
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:179
llvm::Mips::BRANCH_FL
@ BRANCH_FL
Definition: MipsInstPrinter.h:26
llvm::Mips::FCOND_UGE
@ FCOND_UGE
Definition: MipsInstPrinter.h:58
llvm::MipsInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::Mips::FCOND_T
@ FCOND_T
Definition: MipsInstPrinter.h:54
llvm::Mips::FCOND_UEQ
@ FCOND_UEQ
Definition: MipsInstPrinter.h:37
llvm::Mips::FCOND_GE
@ FCOND_GE
Definition: MipsInstPrinter.h:67
llvm::Mips::FCOND_SF
@ FCOND_SF
Definition: MipsInstPrinter.h:42
llvm::Mips::FCOND_ULE
@ FCOND_ULE
Definition: MipsInstPrinter.h:41
llvm::Mips::FCOND_F
@ FCOND_F
Definition: MipsInstPrinter.h:34
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::Mips::FCOND_SNE
@ FCOND_SNE
Definition: MipsInstPrinter.h:64
llvm::Mips::FPBranchCode
FPBranchCode
Definition: MipsInstPrinter.h:23
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::Mips::BRANCH_INVALID
@ BRANCH_INVALID
Definition: MipsInstPrinter.h:28
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:25
llvm::Mips::FCOND_NGE
@ FCOND_NGE
Definition: MipsInstPrinter.h:47
llvm::Mips::BRANCH_TL
@ BRANCH_TL
Definition: MipsInstPrinter.h:27
llvm::Mips::FCOND_OGT
@ FCOND_OGT
Definition: MipsInstPrinter.h:61
llvm::Mips::MipsFCCToString
const char * MipsFCCToString(Mips::CondCode CC)
Definition: MipsInstPrinter.cpp:36
llvm::Mips::BRANCH_T
@ BRANCH_T
Definition: MipsInstPrinter.h:25
llvm::Mips::FCOND_OLT
@ FCOND_OLT
Definition: MipsInstPrinter.h:38
llvm::Mips::FCOND_GLE
@ FCOND_GLE
Definition: MipsInstPrinter.h:63
llvm::Mips::FCOND_UNE
@ FCOND_UNE
Definition: MipsInstPrinter.h:56
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
llvm::MipsInstPrinter::printCustomAliasOperand
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
llvm::Mips::FCOND_LT
@ FCOND_LT
Definition: MipsInstPrinter.h:46
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75