xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10b57cec5SDimitry Andric //===- ARCInstPrinter.h - Convert ARC 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 /// \file
100b57cec5SDimitry Andric /// This file contains the declaration of the ARCInstPrinter class,
110b57cec5SDimitry Andric /// which is used to print ARC MCInst to a .s file.
120b57cec5SDimitry Andric ///
130b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_ARC_INSTPRINTER_ARCINSTPRINTER_H
160b57cec5SDimitry Andric #define LLVM_LIB_TARGET_ARC_INSTPRINTER_ARCINSTPRINTER_H
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric #include "llvm/MC/MCInstPrinter.h"
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric namespace llvm {
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric class ARCInstPrinter : public MCInstPrinter {
230b57cec5SDimitry Andric public:
ARCInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)240b57cec5SDimitry Andric   ARCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
250b57cec5SDimitry Andric                  const MCRegisterInfo &MRI)
260b57cec5SDimitry Andric       : MCInstPrinter(MAI, MII, MRI) {}
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric   // Autogenerated by tblgen.
29e8d8bef9SDimitry Andric   std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
30480093f4SDimitry Andric   void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
31*bdd1243dSDimitry Andric   static const char *getRegisterName(MCRegister Reg);
320b57cec5SDimitry Andric 
33*bdd1243dSDimitry Andric   void printRegName(raw_ostream &OS, MCRegister Reg) const override;
34480093f4SDimitry Andric   void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
35480093f4SDimitry Andric                  const MCSubtargetInfo &STI, raw_ostream &O) override;
36fe6060f1SDimitry Andric   void printCCOperand(const MCInst *MI, int OpNum, raw_ostream &O);
37fe6060f1SDimitry Andric   void printU6(const MCInst *MI, int OpNum, raw_ostream &O);
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric private:
400b57cec5SDimitry Andric   void printMemOperandRI(const MCInst *MI, unsigned OpNum, raw_ostream &O);
410b57cec5SDimitry Andric   void printOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
printOperand(const MCInst * MI,uint64_t,unsigned OpNum,raw_ostream & O)425ffd83dbSDimitry Andric   void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
435ffd83dbSDimitry Andric                     raw_ostream &O) {
445ffd83dbSDimitry Andric     printOperand(MI, OpNum, O);
455ffd83dbSDimitry Andric   }
460b57cec5SDimitry Andric   void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
470b57cec5SDimitry Andric   void printBRCCPredicateOperand(const MCInst *MI, unsigned OpNum,
480b57cec5SDimitry Andric                                  raw_ostream &O);
49fe6060f1SDimitry Andric   void printU6ShiftedBy(unsigned ShiftBy, const MCInst *MI, int OpNum,
50fe6060f1SDimitry Andric                         raw_ostream &O);
510b57cec5SDimitry Andric };
520b57cec5SDimitry Andric } // end namespace llvm
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric #endif // LLVM_LIB_TARGET_ARC_INSTPRINTER_ARCINSTPRINTER_H
55