2014-03-27 20:38:40 +08: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-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
|
|
|
|
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
#include "MCTargetDesc/MipsFixupKinds.h"
|
2015-09-16 00:17:27 +08:00
|
|
|
#include "llvm/ADT/Triple.h"
|
2015-01-14 19:23:27 +08:00
|
|
|
#include "llvm/MC/MCAsmBackend.h"
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MCAssembler;
|
2014-03-27 22:10:00 +08:00
|
|
|
struct MCFixupKindInfo;
|
2014-03-27 20:38:40 +08:00
|
|
|
class MCObjectWriter;
|
2017-09-07 20:54:26 +08:00
|
|
|
class MCRegisterInfo;
|
|
|
|
class Target;
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
class MipsAsmBackend : public MCAsmBackend {
|
2017-09-07 20:54:26 +08:00
|
|
|
Triple TheTriple;
|
2014-03-27 20:38:40 +08:00
|
|
|
bool IsLittle; // Big or little endian
|
2017-09-21 18:44:26 +08:00
|
|
|
bool IsN32;
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
public:
|
2017-09-07 20:54:26 +08:00
|
|
|
MipsAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT,
|
2017-09-21 18:44:26 +08:00
|
|
|
StringRef CPU, bool N32)
|
|
|
|
: TheTriple(TT), IsLittle(TT.isLittleEndian()), IsN32(N32) {}
|
2014-03-27 20:38:40 +08:00
|
|
|
|
2017-10-11 00:28:07 +08:00
|
|
|
std::unique_ptr<MCObjectWriter>
|
|
|
|
createObjectWriter(raw_pwrite_stream &OS) const override;
|
2014-03-27 20:38:40 +08:00
|
|
|
|
2017-06-24 06:52:36 +08:00
|
|
|
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
|
|
|
const MCValue &Target, MutableArrayRef<char> Data,
|
2017-07-12 07:18:25 +08:00
|
|
|
uint64_t Value, bool IsResolved) const override;
|
2014-03-27 20:38:40 +08:00
|
|
|
|
2016-01-20 07:05:27 +08:00
|
|
|
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
2014-04-29 15:58:02 +08:00
|
|
|
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
2014-03-27 20:38:40 +08:00
|
|
|
|
2014-04-29 15:58:02 +08:00
|
|
|
unsigned getNumFixupKinds() const override {
|
2014-03-27 20:38:40 +08: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 15:58:02 +08:00
|
|
|
bool mayNeedRelaxation(const MCInst &Inst) const override {
|
2014-03-27 20:38:40 +08: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 15:58:02 +08:00
|
|
|
const MCAsmLayout &Layout) const override {
|
2014-03-27 20:38:40 +08:00
|
|
|
// FIXME.
|
2014-06-19 14:10:58 +08:00
|
|
|
llvm_unreachable("RelaxInstruction() unimplemented");
|
2014-03-27 20:38:40 +08: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.
|
2016-07-11 22:23:53 +08:00
|
|
|
void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
|
|
|
|
MCInst &Res) const override {}
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
/// @}
|
|
|
|
|
2014-04-29 15:58:02 +08:00
|
|
|
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
}; // class MipsAsmBackend
|
|
|
|
|
2015-06-23 17:49:53 +08:00
|
|
|
} // namespace
|
2014-03-27 20:38:40 +08:00
|
|
|
|
|
|
|
#endif
|