1 //===-- CSKYAsmBackend.h - CSKY Assembler Backend -------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H 10 #define LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H 11 12 #include "MCTargetDesc/CSKYFixupKinds.h" 13 #include "llvm/MC/MCAsmBackend.h" 14 #include "llvm/MC/MCSubtargetInfo.h" 15 #include "llvm/MC/MCTargetOptions.h" 16 17 namespace llvm { 18 19 class CSKYAsmBackend : public MCAsmBackend { 20 21 public: CSKYAsmBackend(const MCSubtargetInfo & STI,const MCTargetOptions & OP)22 CSKYAsmBackend(const MCSubtargetInfo &STI, const MCTargetOptions &OP) 23 : MCAsmBackend(llvm::endianness::little) {} 24 getNumFixupKinds()25 unsigned int getNumFixupKinds() const override { 26 return CSKY::NumTargetFixupKinds; 27 } 28 29 void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, 30 const MCValue &Target, MutableArrayRef<char> Data, 31 uint64_t Value, bool IsResolved, 32 const MCSubtargetInfo *STI) const override; 33 34 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override; 35 36 bool fixupNeedsRelaxation(const MCFixup &Fixup, 37 uint64_t Value) const override; 38 39 void relaxInstruction(MCInst &Inst, 40 const MCSubtargetInfo &STI) const override; 41 42 bool mayNeedRelaxation(const MCInst &Inst, 43 const MCSubtargetInfo &STI) const override; 44 45 bool fixupNeedsRelaxationAdvanced(const MCAssembler &Asm, 46 const MCFixup &Fixup, bool Resolved, 47 uint64_t Value, 48 const MCRelaxableFragment *DF, 49 const bool WasForced) const override; 50 51 bool writeNopData(raw_ostream &OS, uint64_t Count, 52 const MCSubtargetInfo *STI) const override; 53 54 bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, 55 const MCValue &Target, 56 const MCSubtargetInfo *STI) override; 57 58 std::unique_ptr<MCObjectTargetWriter> 59 createObjectTargetWriter() const override; 60 }; 61 } // namespace llvm 62 63 #endif // LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H 64