blob: 8502db2ec3ad3a9fb6bdf439628af80d2a7313e7 [file] [log] [blame]
Jia Liu8f5e8c12012-02-17 01:23:50 +00001//===-- MipsAsmPrinter.h - Mips LLVM Assembly Printer ----------*- C++ -*--===//
Akira Hatanakaaa08ea02011-07-07 20:10:52 +00002//
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 "MipsSubtarget.h"
18#include "llvm/CodeGen/AsmPrinter.h"
19#include "llvm/Support/Compiler.h"
20#include "llvm/Target/TargetMachine.h"
21
22namespace llvm {
23class MCStreamer;
24class MachineInstr;
25class raw_ostream;
26class MachineBasicBlock;
27class Module;
28
29class LLVM_LIBRARY_VISIBILITY MipsAsmPrinter : public AsmPrinter {
Akira Hatanaka421455f2011-11-23 22:19:28 +000030
Akira Hatanakaaa08ea02011-07-07 20:10:52 +000031public:
Akira Hatanaka421455f2011-11-23 22:19:28 +000032
33 const MipsSubtarget *Subtarget;
34
Akira Hatanakaaa08ea02011-07-07 20:10:52 +000035 explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
36 : AsmPrinter(TM, Streamer) {
37 Subtarget = &TM.getSubtarget<MipsSubtarget>();
38 }
39
40 virtual const char *getPassName() const {
41 return "Mips Assembly Printer";
42 }
43
Akira Hatanakaaa08ea02011-07-07 20:10:52 +000044 void EmitInstruction(const MachineInstr *MI);
45 void printSavedRegsBitmask(raw_ostream &O);
46 void printHex32(unsigned int Value, raw_ostream &O);
47 void emitFrameDirective();
48 const char *getCurrentABIString() const;
49 virtual void EmitFunctionEntryLabel();
50 virtual void EmitFunctionBodyStart();
51 virtual void EmitFunctionBodyEnd();
52 virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
53 MBB) const;
54 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
55 unsigned AsmVariant, const char *ExtraCode,
56 raw_ostream &O);
57 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
58 unsigned AsmVariant, const char *ExtraCode,
59 raw_ostream &O);
60 void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
61 void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
Akira Hatanaka03236be2011-07-07 20:54:20 +000062 void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
63 void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
Akira Hatanakaaa08ea02011-07-07 20:10:52 +000064 void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
65 const char *Modifier = 0);
66 void EmitStartOfAsmFile(Module &M);
67 virtual MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
68 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
69};
70}
71
72#endif
73