2014-03-27 12:38:40 +00:00
|
|
|
//===-- MipsAsmBackend.h - Mips Asm Backend ------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the MipsAsmBackend class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
|
|
|
|
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
|
2014-03-27 12:38:40 +00:00
|
|
|
|
|
|
|
#include "MCTargetDesc/MipsFixupKinds.h"
|
|
|
|
#include "llvm/MC/MCAsmBackend.h"
|
|
|
|
#include "llvm/ADT/Triple.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MCAssembler;
|
2014-03-27 14:10:00 +00:00
|
|
|
struct MCFixupKindInfo;
|
2014-03-27 12:38:40 +00:00
|
|
|
class Target;
|
|
|
|
class MCObjectWriter;
|
|
|
|
|
|
|
|
class MipsAsmBackend : public MCAsmBackend {
|
|
|
|
Triple::OSType OSType;
|
|
|
|
bool IsLittle; // Big or little endian
|
|
|
|
bool Is64Bit; // 32 or 64 bit words
|
|
|
|
|
|
|
|
public:
|
|
|
|
MipsAsmBackend(const Target &T, Triple::OSType _OSType, bool _isLittle,
|
|
|
|
bool _is64Bit)
|
|
|
|
: MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle),
|
|
|
|
Is64Bit(_is64Bit) {}
|
|
|
|
|
2014-04-29 07:58:02 +00:00
|
|
|
MCObjectWriter *createObjectWriter(raw_ostream &OS) const override;
|
2014-03-27 12:38:40 +00:00
|
|
|
|
|
|
|
void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
|
2014-04-29 07:58:02 +00:00
|
|
|
uint64_t Value, bool IsPCRel) const override;
|
2014-03-27 12:38:40 +00:00
|
|
|
|
2014-04-29 07:58:02 +00:00
|
|
|
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
2014-03-27 12:38:40 +00:00
|
|
|
|
2014-04-29 07:58:02 +00:00
|
|
|
unsigned getNumFixupKinds() const override {
|
2014-03-27 12:38:40 +00:00
|
|
|
return Mips::NumTargetFixupKinds;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @name Target Relaxation Interfaces
|
|
|
|
/// @{
|
|
|
|
|
|
|
|
/// MayNeedRelaxation - Check whether the given instruction may need
|
|
|
|
/// relaxation.
|
|
|
|
///
|
|
|
|
/// \param Inst - The instruction to test.
|
2014-04-29 07:58:02 +00:00
|
|
|
bool mayNeedRelaxation(const MCInst &Inst) const override {
|
2014-03-27 12:38:40 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// fixupNeedsRelaxation - Target specific predicate for whether a given
|
|
|
|
/// fixup requires the associated instruction to be relaxed.
|
|
|
|
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
|
|
|
|
const MCRelaxableFragment *DF,
|
2014-04-29 07:58:02 +00:00
|
|
|
const MCAsmLayout &Layout) const override {
|
2014-03-27 12:38:40 +00:00
|
|
|
// FIXME.
|
2014-06-19 06:10:58 +00:00
|
|
|
llvm_unreachable("RelaxInstruction() unimplemented");
|
2014-03-27 12:38:40 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// RelaxInstruction - Relax the instruction in the given fragment
|
|
|
|
/// to the next wider instruction.
|
|
|
|
///
|
|
|
|
/// \param Inst - The instruction to relax, which may be the same
|
|
|
|
/// as the output.
|
|
|
|
/// \param [out] Res On return, the relaxed instruction.
|
2014-04-29 07:58:02 +00:00
|
|
|
void relaxInstruction(const MCInst &Inst, MCInst &Res) const override {}
|
2014-03-27 12:38:40 +00:00
|
|
|
|
|
|
|
/// @}
|
|
|
|
|
2014-04-29 07:58:02 +00:00
|
|
|
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
|
2014-03-27 12:38:40 +00:00
|
|
|
|
|
|
|
void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
|
|
|
const MCFixup &Fixup, const MCFragment *DF,
|
2014-03-28 16:06:09 +00:00
|
|
|
const MCValue &Target, uint64_t &Value,
|
2014-04-29 07:58:02 +00:00
|
|
|
bool &IsResolved) override;
|
2014-03-27 12:38:40 +00:00
|
|
|
|
|
|
|
}; // class MipsAsmBackend
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|