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 Module; 29 class raw_ostream; 30 31 class LLVM_LIBRARY_VISIBILITY MipsAsmPrinter : public AsmPrinter { 32 33 void EmitInstrWithMacroNoAT(const MachineInstr *MI); 34 35 private: 36 // tblgen'erated function. 37 bool emitPseudoExpansionLowering(MCStreamer &OutStreamer, 38 const MachineInstr *MI); 39 40 // lowerOperand - Convert a MachineOperand into the equivalent MCOperand. 41 bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp); 42 43 public: 44 45 const MipsSubtarget *Subtarget; 46 const MipsFunctionInfo *MipsFI; 47 MipsMCInstLower MCInstLowering; 48 49 explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) 50 : AsmPrinter(TM, Streamer), MCInstLowering(*this) { 51 Subtarget = &TM.getSubtarget<MipsSubtarget>(); 52 } 53 54 virtual const char *getPassName() const { 55 return "Mips Assembly Printer"; 56 } 57 58 virtual bool runOnMachineFunction(MachineFunction &MF); 59 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* 69 MBB) const; 70 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, 71 unsigned AsmVariant, const char *ExtraCode, 72 raw_ostream &O); 73 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, 74 unsigned AsmVariant, const char *ExtraCode, 75 raw_ostream &O); 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 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS); 85 }; 86 } 87 88 #endif 89 90