1 //===-- Nios2AsmBackend.h - Nios2 Asm Backend ----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the Nios2AsmBackend class.
12 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_NIOS2_MCTARGETDESC_NIOS2ASMBACKEND_H
16 #define LLVM_LIB_TARGET_NIOS2_MCTARGETDESC_NIOS2ASMBACKEND_H
18 #include "MCTargetDesc/Nios2FixupKinds.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/MC/MCAsmBackend.h"
25 struct MCFixupKindInfo;
29 class Nios2AsmBackend : public MCAsmBackend {
30 Triple::OSType OSType;
33 Nios2AsmBackend(const Target &T, Triple::OSType OSType)
34 : MCAsmBackend(support::little), OSType(OSType) {}
36 std::unique_ptr<MCObjectTargetWriter>
37 createObjectTargetWriter() const override;
39 bool writeNopData(raw_ostream &OS, uint64_t Count) const override;
41 void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
42 const MCValue &Target, MutableArrayRef<char> Data,
43 uint64_t Value, bool IsResolved) const override;
45 Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
46 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
48 unsigned getNumFixupKinds() const override {
49 return Nios2::NumTargetFixupKinds;
52 /// MayNeedRelaxation - Check whether the given instruction may need
55 /// \param Inst - The instruction to test.
56 bool mayNeedRelaxation(const MCInst &Inst) const override { return false; }
58 /// fixupNeedsRelaxation - Target specific predicate for whether a given
59 /// fixup requires the associated instruction to be relaxed.
60 bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
61 const MCRelaxableFragment *DF,
62 const MCAsmLayout &Layout) const override {
64 llvm_unreachable("RelaxInstruction() unimplemented");
68 /// RelaxInstruction - Relax the instruction in the given fragment
69 /// to the next wider instruction.
71 /// \param Inst - The instruction to relax, which may be the same
73 /// \param [out] Res On return, the relaxed instruction.
74 void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
75 MCInst &Res) const override {}
77 }; // class Nios2AsmBackend