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: 22 CSKYAsmBackend(const MCSubtargetInfo &STI, const MCTargetOptions &OP) 23 : MCAsmBackend(support::little) {} 24 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, uint64_t Value, 37 const MCRelaxableFragment *DF, 38 const MCAsmLayout &Layout) const override; 39 40 void relaxInstruction(MCInst &Inst, 41 const MCSubtargetInfo &STI) const override; 42 43 bool mayNeedRelaxation(const MCInst &Inst, 44 const MCSubtargetInfo &STI) const override; 45 46 bool fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, bool Resolved, 47 uint64_t Value, 48 const MCRelaxableFragment *DF, 49 const MCAsmLayout &Layout, 50 const bool WasForced) const override; 51 52 bool writeNopData(raw_ostream &OS, uint64_t Count, 53 const MCSubtargetInfo *STI) const override; 54 55 bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, 56 const MCValue &Target) 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