1 //===-- MipsAsmPrinter.h - Mips LLVM Assembly Printer ----------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Mips Assembly printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSASMPRINTER_H
15 #define MIPSASMPRINTER_H
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"
27 class MachineBasicBlock;
31 class LLVM_LIBRARY_VISIBILITY MipsAsmPrinter : public AsmPrinter {
33 void EmitInstrWithMacroNoAT(const MachineInstr *MI);
36 // tblgen'erated function.
37 bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
38 const MachineInstr *MI);
40 // lowerOperand - Convert a MachineOperand into the equivalent MCOperand.
41 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
45 const MipsSubtarget *Subtarget;
46 const MipsFunctionInfo *MipsFI;
47 MipsMCInstLower MCInstLowering;
49 explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
50 : AsmPrinter(TM, Streamer), MCInstLowering(*this) {
51 Subtarget = &TM.getSubtarget<MipsSubtarget>();
54 virtual const char *getPassName() const {
55 return "Mips Assembly Printer";
58 virtual bool runOnMachineFunction(MachineFunction &MF);
60 void EmitInstruction(const MachineInstr *MI);
61 void printSavedRegsBitmask(raw_ostream &O);
62 void printHex32(unsigned int Value, raw_ostream &O);
63 void emitFrameDirective();
64 const char *getCurrentABIString() const;
65 virtual void EmitFunctionEntryLabel();
66 virtual void EmitFunctionBodyStart();
67 virtual void EmitFunctionBodyEnd();
68 virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
70 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
71 unsigned AsmVariant, const char *ExtraCode,
73 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
74 unsigned AsmVariant, const char *ExtraCode,
76 void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
77 void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
78 void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
79 void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
80 void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
81 const char *Modifier = 0);
82 void EmitStartOfAsmFile(Module &M);
83 void EmitEndOfAsmFile(Module &M);
84 virtual MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
85 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);