LLVM 24.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 "MipsMCTargetDesc.h"
17
18namespace llvm {
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.
22namespace Mips {
23// Mips Branch Codes
31
32// Mips Condition Codes
34 // To be used with float branch True
51
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;
71};
72
73const char *MipsFCCToString(Mips::CondCode CC);
74} // end namespace Mips
75
77public:
81
82 // Autogenerated by tblgen.
83 std::pair<const char *, uint64_t>
84 getMnemonic(const MCInst &MI) const override;
86 const MCSubtargetInfo &STI, raw_ostream &O);
87 static const char *getRegisterName(MCRegister Reg,
88 unsigned AltIdx = Mips::NoRegAltName);
89
90 void printRegName(raw_ostream &OS, MCRegister Reg) override;
91 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
92 const MCSubtargetInfo &STI, raw_ostream &O) override;
93
95 const MCSubtargetInfo &STI, raw_ostream &OS);
97 unsigned OpIdx, unsigned PrintMethodIdx,
98 const MCSubtargetInfo &STI, raw_ostream &O);
99
100private:
101 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
102 raw_ostream &O);
103 void printJumpOperand(const MCInst *MI, unsigned OpNo,
104 const MCSubtargetInfo &STI, raw_ostream &O);
105 void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo,
106 const MCSubtargetInfo &STI, raw_ostream &O);
107 template <unsigned Bits, unsigned Offset = 0>
108 void printUImm(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
109 raw_ostream &O);
110 void printMemOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
111 raw_ostream &O);
112 void printMemOperandEA(const MCInst *MI, int opNum,
113 const MCSubtargetInfo &STI, raw_ostream &O);
114 void printFCCOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI,
115 raw_ostream &O);
116 void printSHFMask(const MCInst *MI, int opNum, raw_ostream &O);
117
118 bool printAlias(const char *Str, const MCInst &MI, uint64_t Address,
119 unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &OS,
120 bool IsBranch = false);
121 bool printAlias(const char *Str, const MCInst &MI, uint64_t Address,
122 unsigned OpNo0, unsigned OpNo1, const MCSubtargetInfo &STI,
123 raw_ostream &OS, bool IsBranch = false);
124 bool printAlias(const MCInst &MI, uint64_t Address,
125 const MCSubtargetInfo &STI, raw_ostream &OS);
126 void printSaveRestore(const MCInst *MI, const MCSubtargetInfo &STI,
127 raw_ostream &O);
128 void printRegisterList(const MCInst *MI, int opNum,
129 const MCSubtargetInfo &STI, raw_ostream &O);
130};
131} // end namespace llvm
132
133#endif
unsigned uint64_t
IRTranslator LLVM IR MI
Register Reg
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:67
const MCInstrInfo & MII
const MCRegisterInfo & MRI
const MCAsmInfo & MAI
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Interface to description of machine instruction set.
Definition MCInstrInfo.h:27
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:41
Generic base class for all target subtargets.
static const char * getRegisterName(MCRegister Reg, unsigned AltIdx=Mips::NoRegAltName)
void printCustomAliasOperand(const MCInst *MI, uint64_t Address, unsigned OpIdx, unsigned PrintMethodIdx, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
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)
std::pair< const char *, uint64_t > getMnemonic(const MCInst &MI) const 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)
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
const char * MipsFCCToString(Mips::CondCode CC)
This is an optimization pass for GlobalISel generic memory operations.