MipsAsmPrinter.h revision 234353
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 "MipsMachineFunction.h"
18#include "MipsMCInstLower.h"
19#include "MipsSubtarget.h"
20#include "llvm/CodeGen/AsmPrinter.h"
21#include "llvm/Support/Compiler.h"
22#include "llvm/Target/TargetMachine.h"
23
24namespace llvm {
25class MCStreamer;
26class MachineInstr;
27class MachineBasicBlock;
28class Module;
29class raw_ostream;
30
31class LLVM_LIBRARY_VISIBILITY MipsAsmPrinter : public AsmPrinter {
32
33  void EmitInstrWithMacroNoAT(const MachineInstr *MI);
34
35public:
36
37  const MipsSubtarget *Subtarget;
38  const MipsFunctionInfo *MipsFI;
39  MipsMCInstLower MCInstLowering;
40
41  explicit MipsAsmPrinter(TargetMachine &TM,  MCStreamer &Streamer)
42    : AsmPrinter(TM, Streamer), MCInstLowering(*this) {
43    Subtarget = &TM.getSubtarget<MipsSubtarget>();
44  }
45
46  virtual const char *getPassName() const {
47    return "Mips Assembly Printer";
48  }
49
50  virtual bool runOnMachineFunction(MachineFunction &MF);
51
52  void EmitInstruction(const MachineInstr *MI);
53  void printSavedRegsBitmask(raw_ostream &O);
54  void printHex32(unsigned int Value, raw_ostream &O);
55  void emitFrameDirective();
56  const char *getCurrentABIString() const;
57  virtual void EmitFunctionEntryLabel();
58  virtual void EmitFunctionBodyStart();
59  virtual void EmitFunctionBodyEnd();
60  virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
61                                                 MBB) const;
62  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
63                       unsigned AsmVariant, const char *ExtraCode,
64                       raw_ostream &O);
65  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
66                             unsigned AsmVariant, const char *ExtraCode,
67                             raw_ostream &O);
68  void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
69  void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
70  void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
71  void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
72  void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
73                       const char *Modifier = 0);
74  void EmitStartOfAsmFile(Module &M);
75  virtual MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
76  void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
77};
78}
79
80#endif
81
82