2012-02-17 09:23:50 +08:00
|
|
|
//===-- MipsAsmPrinter.h - Mips LLVM Assembly Printer ----------*- C++ -*--===//
|
2011-07-08 04:10:52 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Mips Assembly printer class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef MIPSASMPRINTER_H
|
|
|
|
#define MIPSASMPRINTER_H
|
|
|
|
|
2012-03-28 08:22:50 +08:00
|
|
|
#include "MipsMCInstLower.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "MipsMachineFunction.h"
|
2011-07-08 04:10:52 +08:00
|
|
|
#include "MipsSubtarget.h"
|
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
|
|
|
#include "llvm/Support/Compiler.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class MCStreamer;
|
|
|
|
class MachineInstr;
|
|
|
|
class MachineBasicBlock;
|
|
|
|
class Module;
|
2012-03-18 02:46:09 +08:00
|
|
|
class raw_ostream;
|
2011-07-08 04:10:52 +08:00
|
|
|
|
|
|
|
class LLVM_LIBRARY_VISIBILITY MipsAsmPrinter : public AsmPrinter {
|
2011-11-24 06:19:28 +08:00
|
|
|
|
2012-03-28 08:22:50 +08:00
|
|
|
void EmitInstrWithMacroNoAT(const MachineInstr *MI);
|
|
|
|
|
2012-09-27 09:59:07 +08:00
|
|
|
private:
|
|
|
|
// tblgen'erated function.
|
|
|
|
bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
|
|
|
|
const MachineInstr *MI);
|
|
|
|
|
|
|
|
// lowerOperand - Convert a MachineOperand into the equivalent MCOperand.
|
|
|
|
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
|
|
|
|
|
2011-07-08 04:10:52 +08:00
|
|
|
public:
|
2011-11-24 06:19:28 +08:00
|
|
|
|
|
|
|
const MipsSubtarget *Subtarget;
|
2012-03-28 08:22:50 +08:00
|
|
|
const MipsFunctionInfo *MipsFI;
|
|
|
|
MipsMCInstLower MCInstLowering;
|
2011-11-24 06:19:28 +08:00
|
|
|
|
2011-07-08 04:10:52 +08:00
|
|
|
explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
|
2012-03-28 08:22:50 +08:00
|
|
|
: AsmPrinter(TM, Streamer), MCInstLowering(*this) {
|
2011-07-08 04:10:52 +08:00
|
|
|
Subtarget = &TM.getSubtarget<MipsSubtarget>();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual const char *getPassName() const {
|
|
|
|
return "Mips Assembly Printer";
|
|
|
|
}
|
|
|
|
|
2012-03-28 08:22:50 +08:00
|
|
|
virtual bool runOnMachineFunction(MachineFunction &MF);
|
|
|
|
|
2011-07-08 04:10:52 +08:00
|
|
|
void EmitInstruction(const MachineInstr *MI);
|
|
|
|
void printSavedRegsBitmask(raw_ostream &O);
|
|
|
|
void printHex32(unsigned int Value, raw_ostream &O);
|
|
|
|
void emitFrameDirective();
|
|
|
|
const char *getCurrentABIString() const;
|
|
|
|
virtual void EmitFunctionEntryLabel();
|
|
|
|
virtual void EmitFunctionBodyStart();
|
|
|
|
virtual void EmitFunctionBodyEnd();
|
|
|
|
virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock*
|
|
|
|
MBB) const;
|
|
|
|
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
|
|
|
unsigned AsmVariant, const char *ExtraCode,
|
|
|
|
raw_ostream &O);
|
|
|
|
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
|
|
|
|
unsigned AsmVariant, const char *ExtraCode,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
|
|
|
void printUnsignedImm(const MachineInstr *MI, int opNum, raw_ostream &O);
|
2011-07-08 04:54:20 +08:00
|
|
|
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
|
|
|
void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
|
2011-07-08 04:10:52 +08:00
|
|
|
void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
|
|
|
const char *Modifier = 0);
|
|
|
|
void EmitStartOfAsmFile(Module &M);
|
2013-01-19 05:20:38 +08:00
|
|
|
void EmitEndOfAsmFile(Module &M);
|
2011-07-08 04:10:52 +08:00
|
|
|
void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|