LLVM  4.0.0
MipsInstPrinter.h
Go to the documentation of this file.
1 //=== MipsInstPrinter.h - Convert Mips MCInst to assembly syntax -*- C++ -*-==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class prints a Mips MCInst to a .s file.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_MIPS_INSTPRINTER_MIPSINSTPRINTER_H
15 #define LLVM_LIB_TARGET_MIPS_INSTPRINTER_MIPSINSTPRINTER_H
16 #include "llvm/MC/MCInstPrinter.h"
17 
18 namespace 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.
22 namespace Mips {
23 // Mips Branch Codes
30 };
31 
32 // Mips Condition Codes
33 enum CondCode {
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 
73 const char *MipsFCCToString(Mips::CondCode CC);
74 } // end namespace Mips
75 
77 public:
79  const MCRegisterInfo &MRI)
80  : MCInstPrinter(MAI, MII, MRI) {}
81 
82  // Autogenerated by tblgen.
83  void printInstruction(const MCInst *MI, 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, raw_ostream &O, StringRef Annot,
88  const MCSubtargetInfo &STI) override;
89 
90  bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
91  void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
92  unsigned PrintMethodIdx, raw_ostream &O);
93 
94 private:
95  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
96  template <unsigned Bits, unsigned Offset = 0>
97  void printUImm(const MCInst *MI, int opNum, raw_ostream &O);
98  void printMemOperand(const MCInst *MI, int opNum, raw_ostream &O);
99  void printMemOperandEA(const MCInst *MI, int opNum, raw_ostream &O);
100  void printFCCOperand(const MCInst *MI, int opNum, raw_ostream &O);
101  void printRegisterPair(const MCInst *MI, int opNum, raw_ostream &O);
102  void printSHFMask(const MCInst *MI, int opNum, raw_ostream &O);
103 
104  bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo,
105  raw_ostream &OS);
106  bool printAlias(const char *Str, const MCInst &MI, unsigned OpNo0,
107  unsigned OpNo1, raw_ostream &OS);
108  bool printAlias(const MCInst &MI, raw_ostream &OS);
109  void printSaveRestore(const MCInst *MI, raw_ostream &O);
110  void printRegisterList(const MCInst *MI, int opNum, raw_ostream &O);
111 };
112 } // end namespace llvm
113 
114 #endif
bool printAliasInstr(const MCInst *MI, raw_ostream &OS)
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
MipsInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:150
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:57
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx, unsigned PrintMethodIdx, raw_ostream &O)
const char * MipsFCCToString(Mips::CondCode CC)
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:47
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:41
MCSubtargetInfo - Generic base class for all target subtargets.
const MCInstrInfo & MII
Definition: MCInstPrinter.h:48
static const char * getRegisterName(unsigned RegNo)
void printInstruction(const MCInst *MI, raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:49