LLVM API Documentation
00001 //===-- MipsAsmBackend.h - Mips Asm Backend ------------------------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the MipsAsmBackend class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 // 00014 00015 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H 00016 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H 00017 00018 #include "MCTargetDesc/MipsFixupKinds.h" 00019 #include "llvm/MC/MCAsmBackend.h" 00020 #include "llvm/ADT/Triple.h" 00021 00022 namespace llvm { 00023 00024 class MCAssembler; 00025 struct MCFixupKindInfo; 00026 class Target; 00027 class MCObjectWriter; 00028 00029 class MipsAsmBackend : public MCAsmBackend { 00030 Triple::OSType OSType; 00031 bool IsLittle; // Big or little endian 00032 bool Is64Bit; // 32 or 64 bit words 00033 00034 public: 00035 MipsAsmBackend(const Target &T, Triple::OSType _OSType, bool _isLittle, 00036 bool _is64Bit) 00037 : MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle), 00038 Is64Bit(_is64Bit) {} 00039 00040 MCObjectWriter *createObjectWriter(raw_ostream &OS) const override; 00041 00042 void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, 00043 uint64_t Value, bool IsPCRel) const override; 00044 00045 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override; 00046 00047 unsigned getNumFixupKinds() const override { 00048 return Mips::NumTargetFixupKinds; 00049 } 00050 00051 /// @name Target Relaxation Interfaces 00052 /// @{ 00053 00054 /// MayNeedRelaxation - Check whether the given instruction may need 00055 /// relaxation. 00056 /// 00057 /// \param Inst - The instruction to test. 00058 bool mayNeedRelaxation(const MCInst &Inst) const override { 00059 return false; 00060 } 00061 00062 /// fixupNeedsRelaxation - Target specific predicate for whether a given 00063 /// fixup requires the associated instruction to be relaxed. 00064 bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, 00065 const MCRelaxableFragment *DF, 00066 const MCAsmLayout &Layout) const override { 00067 // FIXME. 00068 llvm_unreachable("RelaxInstruction() unimplemented"); 00069 return false; 00070 } 00071 00072 /// RelaxInstruction - Relax the instruction in the given fragment 00073 /// to the next wider instruction. 00074 /// 00075 /// \param Inst - The instruction to relax, which may be the same 00076 /// as the output. 00077 /// \param [out] Res On return, the relaxed instruction. 00078 void relaxInstruction(const MCInst &Inst, MCInst &Res) const override {} 00079 00080 /// @} 00081 00082 bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override; 00083 00084 void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout, 00085 const MCFixup &Fixup, const MCFragment *DF, 00086 const MCValue &Target, uint64_t &Value, 00087 bool &IsResolved) override; 00088 00089 }; // class MipsAsmBackend 00090 00091 } // namespace 00092 00093 #endif