LLVM 19.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
16
17namespace 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.
21namespace Mips {
22// Mips Branch Codes
29};
30
31// Mips Condition Codes
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
73} // end namespace Mips
74
76public:
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;
84 const MCSubtargetInfo &STI, raw_ostream &O);
85 static const char *getRegisterName(MCRegister Reg);
86
87 void printRegName(raw_ostream &OS, MCRegister Reg) const override;
88 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
89 const MCSubtargetInfo &STI, raw_ostream &O) override;
90
92 const MCSubtargetInfo &STI, raw_ostream &OS);
94 unsigned OpIdx, unsigned PrintMethodIdx,
95 const MCSubtargetInfo &STI, raw_ostream &O);
96
97private:
98 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
99 raw_ostream &O);
100 void printJumpOperand(const MCInst *MI, unsigned OpNo,
101 const MCSubtargetInfo &STI, raw_ostream &O);
102 void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo,
103 const MCSubtargetInfo &STI, raw_ostream &O);
104 template <unsigned Bits, unsigned Offset = 0>
105 void printUImm(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
106 raw_ostream &O);
107 void printMemOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
108 raw_ostream &O);
109 void printMemOperandEA(const MCInst *MI, int opNum,
110 const MCSubtargetInfo &STI, raw_ostream &O);
111 void printFCCOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
112 raw_ostream &O);
113 void printSHFMask(const MCInst *MI, int opNum, raw_ostream &O);
114
115 bool printAlias(const char *Str, const MCInst &MI, uint64_t Address,
116 unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &OS,
117 bool IsBranch = false);
118 bool printAlias(const char *Str, const MCInst &MI, uint64_t Address,
119 unsigned OpNo0, unsigned OpNo1, const MCSubtargetInfo &STI,
120 raw_ostream &OS, bool IsBranch = false);
121 bool printAlias(const MCInst &MI, uint64_t Address,
122 const MCSubtargetInfo &STI, raw_ostream &OS);
123 void printSaveRestore(const MCInst *MI, const MCSubtargetInfo &STI,
124 raw_ostream &O);
125 void printRegisterList(const MCInst *MI, int opNum,
126 const MCSubtargetInfo &STI, raw_ostream &O);
127};
128} // end namespace llvm
129
130#endif
IRTranslator LLVM IR MI
unsigned Reg
raw_pwrite_stream & OS
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:45
const MCInstrInfo & MII
Definition: MCInstPrinter.h:52
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:53
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:51
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Generic base class for all target subtargets.
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
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.
MipsInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
void printRegName(raw_ostream &OS, MCRegister Reg) const override
Print the assembler register name.
static const char * getRegisterName(MCRegister Reg)
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...
bool printAliasInstr(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &OS)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
const char * MipsFCCToString(Mips::CondCode CC)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18