[mips][msa] Added support for matching ffint_[us].[wd], and ftrunc_[us].[wd] from...
[oota-llvm.git] / lib / Target / Mips / MipsAsmPrinter.h
1 //===-- MipsAsmPrinter.h - Mips LLVM Assembly Printer ----------*- 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 // Mips Assembly printer class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MIPSASMPRINTER_H
15 #define MIPSASMPRINTER_H
16
17 #include "MipsMCInstLower.h"
18 #include "MipsMachineFunction.h"
19 #include "MipsSubtarget.h"
20 #include "llvm/CodeGen/AsmPrinter.h"
21 #include "llvm/Support/Compiler.h"
22 #include "llvm/Target/TargetMachine.h"
23
24 namespace llvm {
25 class MCStreamer;
26 class MachineInstr;
27 class MachineBasicBlock;
28 class MipsTargetStreamer;
29 class Module;
30 class raw_ostream;
31
32 class LLVM_LIBRARY_VISIBILITY MipsAsmPrinter : public AsmPrinter {
33   MipsTargetStreamer &getTargetStreamer();
34
35   void EmitInstrWithMacroNoAT(const MachineInstr *MI);
36
37 private:
38   // tblgen'erated function.
39   bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
40                                    const MachineInstr *MI);
41
42   // lowerOperand - Convert a MachineOperand into the equivalent MCOperand.
43   bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
44
45 public:
46
47   const MipsSubtarget *Subtarget;
48   const MipsFunctionInfo *MipsFI;
49   MipsMCInstLower MCInstLowering;
50
51   explicit MipsAsmPrinter(TargetMachine &TM,  MCStreamer &Streamer)
52     : AsmPrinter(TM, Streamer), MCInstLowering(*this) {
53     Subtarget = &TM.getSubtarget<MipsSubtarget>();
54   }
55
56   virtual const char *getPassName() const {
57     return "Mips Assembly Printer";
58   }
59
60   virtual bool runOnMachineFunction(MachineFunction &MF);
61
62   void EmitInstruction(const MachineInstr *MI);
63   void printSavedRegsBitmask(raw_ostream &O);
64   void printHex32(unsigned int Value, raw_ostream &O);
65   void emitFrameDirective();
66   const char *getCurrentABIString() const;
67   virtual void EmitFunctionEntryLabel();
68   virtual void EmitFunctionBodyStart();
69   virtual void EmitFunctionBodyEnd();
70   virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
71                                                  MBB) const;
72   bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
73                        unsigned AsmVariant, const char *ExtraCode,
74                        raw_ostream &O);
75   bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
76                              unsigned AsmVariant, const char *ExtraCode,
77                              raw_ostream &O);
78   void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
79   void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
80   void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
81   void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
82   void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
83                        const char *Modifier = 0);
84   void EmitStartOfAsmFile(Module &M);
85   void EmitEndOfAsmFile(Module &M);
86   void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
87 };
88 }
89
90 #endif
91