10b57cec5SDimitry Andric //===- AVRInstPrinter.h - Convert AVR 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 an AVR MCInst to a .s file. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_AVR_INST_PRINTER_H 140b57cec5SDimitry Andric #define LLVM_AVR_INST_PRINTER_H 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #include "llvm/MC/MCInstPrinter.h" 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric #include "MCTargetDesc/AVRMCTargetDesc.h" 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric namespace llvm { 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric /// Prints AVR instructions to a textual stream. 230b57cec5SDimitry Andric class AVRInstPrinter : public MCInstPrinter { 240b57cec5SDimitry Andric public: AVRInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)250b57cec5SDimitry Andric AVRInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, 260b57cec5SDimitry Andric const MCRegisterInfo &MRI) 270b57cec5SDimitry Andric : MCInstPrinter(MAI, MII, MRI) {} 280b57cec5SDimitry Andric 290b57cec5SDimitry Andric static const char *getPrettyRegisterName(unsigned RegNo, 300b57cec5SDimitry Andric MCRegisterInfo const &MRI); 310b57cec5SDimitry Andric 32480093f4SDimitry Andric void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, 33480093f4SDimitry Andric const MCSubtargetInfo &STI, raw_ostream &O) override; 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric private: 36*bdd1243dSDimitry Andric static const char *getRegisterName(MCRegister Reg, 370b57cec5SDimitry Andric unsigned AltIdx = AVR::NoRegAltName); 380b57cec5SDimitry Andric 390b57cec5SDimitry Andric void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); 400b57cec5SDimitry Andric void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &O); printPCRelImm(const MCInst * MI,uint64_t,unsigned OpNo,raw_ostream & O)415ffd83dbSDimitry Andric void printPCRelImm(const MCInst *MI, uint64_t /*Address*/, unsigned OpNo, 425ffd83dbSDimitry Andric raw_ostream &O) { 435ffd83dbSDimitry Andric printPCRelImm(MI, OpNo, O); 445ffd83dbSDimitry Andric } 450b57cec5SDimitry Andric void printMemri(const MCInst *MI, unsigned OpNo, raw_ostream &O); printMemspi(const MCInst * MI,unsigned OpNo,raw_ostream & O)4681ad6265SDimitry Andric void printMemspi(const MCInst *MI, unsigned OpNo, raw_ostream &O) { 4781ad6265SDimitry Andric printMemri(MI, OpNo, O); 4881ad6265SDimitry Andric } 490b57cec5SDimitry Andric 500b57cec5SDimitry Andric // Autogenerated by TableGen. 51e8d8bef9SDimitry Andric std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override; 52480093f4SDimitry Andric void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O); 535ffd83dbSDimitry Andric bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &O); 545ffd83dbSDimitry Andric void printCustomAliasOperand(const MCInst *MI, uint64_t Address, 555ffd83dbSDimitry Andric unsigned OpIdx, unsigned PrintMethodIdx, 565ffd83dbSDimitry Andric raw_ostream &O); 570b57cec5SDimitry Andric }; 580b57cec5SDimitry Andric 590b57cec5SDimitry Andric } // end namespace llvm 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric #endif // LLVM_AVR_INST_PRINTER_H 62