• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- HexagonInstPrinter.h - Convert Hexagon MCInst to assembly syntax --===//
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 an Hexagon MCInst to a .s file.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef HEXAGONINSTPRINTER_H
15 #define HEXAGONINSTPRINTER_H
16 
17 #include "llvm/MC/MCInstPrinter.h"
18 
19 namespace llvm {
20   class HexagonInstPrinter : public MCInstPrinter {
21   public:
HexagonInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI)22     explicit HexagonInstPrinter(const MCAsmInfo &MAI,
23                                 const MCInstrInfo &MII,
24                                 const MCRegisterInfo &MRI)
25       : MCInstPrinter(MAI, MII, MRI) {}
26 
27     virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot);
28     virtual StringRef getOpcodeName(unsigned Opcode) const;
29     void printInstruction(const MCInst *MI, raw_ostream &O);
30     StringRef getRegName(unsigned RegNo) const;
31     static const char *getRegisterName(unsigned RegNo);
32 
33     void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
34     void printImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
35     void printExtOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
36     void printUnsignedImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
37            const;
38     void printNegImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
39            const;
40     void printNOneImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
41            const;
42     void printMEMriOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
43            const;
44     void printFrameIndexOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
45            const;
46     void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
47            const;
48     void printCallOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
49            const;
50     void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
51            const;
52     void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
53            const;
54     void printGlobalOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
55            const;
56     void printJumpTable(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
57 
58     void printConstantPool(const MCInst *MI, unsigned OpNo, raw_ostream &O) const;
59 
printSymbolHi(const MCInst * MI,unsigned OpNo,raw_ostream & O)60     void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
61       { printSymbol(MI, OpNo, O, true); }
printSymbolLo(const MCInst * MI,unsigned OpNo,raw_ostream & O)62     void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O) const
63       { printSymbol(MI, OpNo, O, false); }
64 
65     bool isConstExtended(const MCInst *MI) const;
66   protected:
67     void printSymbol(const MCInst *MI, unsigned OpNo, raw_ostream &O, bool hi)
68            const;
69   };
70 
71 } // end namespace llvm
72 
73 #endif
74