• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- PPCInstPrinter.h - Convert PPC 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 an PPC MCInst to a .s file.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef PPCINSTPRINTER_H
15 #define PPCINSTPRINTER_H
16 
17 #include "llvm/MC/MCInstPrinter.h"
18 
19 namespace llvm {
20 
21 class MCOperand;
22 
23 class PPCInstPrinter : public MCInstPrinter {
24   // 0 -> AIX, 1 -> Darwin.
25   unsigned SyntaxVariant;
26 public:
PPCInstPrinter(const MCAsmInfo & MAI,const MCInstrInfo & MII,const MCRegisterInfo & MRI,unsigned syntaxVariant)27   PPCInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
28                  const MCRegisterInfo &MRI, unsigned syntaxVariant)
29     : MCInstPrinter(MAI, MII, MRI), SyntaxVariant(syntaxVariant) {}
30 
isDarwinSyntax()31   bool isDarwinSyntax() const {
32     return SyntaxVariant == 1;
33   }
34 
35   virtual void printRegName(raw_ostream &OS, unsigned RegNo) const;
36   virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot);
37 
38   // Autogenerated by tblgen.
39   void printInstruction(const MCInst *MI, raw_ostream &O);
40   static const char *getRegisterName(unsigned RegNo);
41 
42 
43   void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
44   void printPredicateOperand(const MCInst *MI, unsigned OpNo,
45                              raw_ostream &O, const char *Modifier = 0);
46 
47 
48   void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
49   void printU5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
50   void printU6ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
51   void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
52   void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
53   void printS16X4ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
54   void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
55   void printAbsAddrOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
56 
57   void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O);
58 
59   void printMemRegImm(const MCInst *MI, unsigned OpNo, raw_ostream &O);
60   void printMemRegImmShifted(const MCInst *MI, unsigned OpNo, raw_ostream &O);
61   void printMemRegReg(const MCInst *MI, unsigned OpNo, raw_ostream &O);
62 
63   // FIXME: Remove
64   void printSymbolLo(const MCInst *MI, unsigned OpNo, raw_ostream &O);
65   void printSymbolHi(const MCInst *MI, unsigned OpNo, raw_ostream &O);
66 };
67 } // end namespace llvm
68 
69 #endif
70