blob: 71b267c8e37b864be996f071a5d25cc7ef14da9b [file] [log] [blame]
Akira Hatanakaaa08ea02011-07-07 20:10:52 +00001//===-- MipsAsmPrinter.h - Mips LLVM assembly writer ----------------------===//
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 "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 {
30 const MipsSubtarget *Subtarget;
31
32public:
33 explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
34 : AsmPrinter(TM, Streamer) {
35 Subtarget = &TM.getSubtarget<MipsSubtarget>();
36 }
37
38 virtual const char *getPassName() const {
39 return "Mips Assembly Printer";
40 }
41
42 // These two methods are autogen'd by tablegen.
43 void printInstruction(const MachineInstr *MI, raw_ostream &O);
44 static const char *getRegisterName(unsigned RegNo);
45
46 void EmitInstruction(const MachineInstr *MI);
47 void printSavedRegsBitmask(raw_ostream &O);
48 void printHex32(unsigned int Value, raw_ostream &O);
49 void emitFrameDirective();
50 const char *getCurrentABIString() const;
51 virtual void EmitFunctionEntryLabel();
52 virtual void EmitFunctionBodyStart();
53 virtual void EmitFunctionBodyEnd();
54 virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
55 MBB) const;
56 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
57 unsigned AsmVariant, const char *ExtraCode,
58 raw_ostream &O);
59 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
60 unsigned AsmVariant, const char *ExtraCode,
61 raw_ostream &O);
62 void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
63 void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
64 void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
65 const char *Modifier = 0);
66 void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
67 const char *Modifier = 0);
68 void EmitStartOfAsmFile(Module &M);
69 virtual MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
70 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
71};
72}
73
74#endif
75