xref: /freebsd/contrib/llvm-project/llvm/lib/Target/MSP430/MCTargetDesc/MSP430InstPrinter.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //= MSP430InstPrinter.h - Convert MSP430 MCInst to assembly syntax -*- C++ -*-//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This class prints a MSP430 MCInst to a .s file.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MSP430_MCTARGETDESC_MSP430INSTPRINTER_H
140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MSP430_MCTARGETDESC_MSP430INSTPRINTER_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "llvm/MC/MCInstPrinter.h"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric namespace llvm {
190b57cec5SDimitry Andric   class MSP430InstPrinter : public MCInstPrinter {
200b57cec5SDimitry Andric   public:
MSP430InstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)210b57cec5SDimitry Andric     MSP430InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
220b57cec5SDimitry Andric                       const MCRegisterInfo &MRI)
230b57cec5SDimitry Andric       : MCInstPrinter(MAI, MII, MRI) {}
240b57cec5SDimitry Andric 
25*06c3fb27SDimitry Andric     void printRegName(raw_ostream &O, MCRegister Reg) const override;
26*06c3fb27SDimitry Andric 
27480093f4SDimitry Andric     void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
28480093f4SDimitry Andric                    const MCSubtargetInfo &STI, raw_ostream &O) override;
290b57cec5SDimitry Andric 
300b57cec5SDimitry Andric     // Autogenerated by tblgen.
31e8d8bef9SDimitry Andric     std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
32480093f4SDimitry Andric     void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
335ffd83dbSDimitry Andric     bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &O);
345ffd83dbSDimitry Andric     void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
355ffd83dbSDimitry Andric                                  unsigned OpIdx, unsigned PrintMethodIdx,
365ffd83dbSDimitry Andric                                  raw_ostream &O);
37bdd1243dSDimitry Andric     static const char *getRegisterName(MCRegister Reg);
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric   private:
400b57cec5SDimitry Andric     void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
410b57cec5SDimitry Andric                       const char *Modifier = nullptr);
420b57cec5SDimitry Andric     void printPCRelImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
430b57cec5SDimitry Andric     void printSrcMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
440b57cec5SDimitry Andric                             const char *Modifier = nullptr);
450b57cec5SDimitry Andric     void printIndRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
460b57cec5SDimitry Andric     void printPostIndRegOperand(const MCInst *MI, unsigned OpNo,
470b57cec5SDimitry Andric                                 raw_ostream &O);
480b57cec5SDimitry Andric     void printCCOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric   };
510b57cec5SDimitry Andric }
520b57cec5SDimitry Andric 
530b57cec5SDimitry Andric #endif
54