55 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H10#define LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H11 12#include "MCTargetDesc/CSKYFixupKinds.h"13#include "llvm/MC/MCAsmBackend.h"14#include "llvm/MC/MCSubtargetInfo.h"15#include "llvm/MC/MCTargetOptions.h"16 17namespace llvm {18 19class CSKYAsmBackend : public MCAsmBackend {20 21public:22 CSKYAsmBackend(const MCSubtargetInfo &STI, const MCTargetOptions &OP)23 : MCAsmBackend(llvm::endianness::little) {}24 25 std::optional<bool> evaluateFixup(const MCFragment &, MCFixup &, MCValue &,26 uint64_t &) override;27 void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target,28 uint8_t *Data, uint64_t Value, bool IsResolved) override;29 30 MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override;31 32 bool fixupNeedsRelaxation(const MCFixup &Fixup,33 uint64_t Value) const override;34 35 bool mayNeedRelaxation(unsigned Opcode, ArrayRef<MCOperand> Operands,36 const MCSubtargetInfo &STI) const override;37 void relaxInstruction(MCInst &Inst,38 const MCSubtargetInfo &STI) const override;39 40 bool fixupNeedsRelaxationAdvanced(const MCFragment &, const MCFixup &,41 const MCValue &, uint64_t,42 bool) const override;43 44 bool writeNopData(raw_ostream &OS, uint64_t Count,45 const MCSubtargetInfo *STI) const override;46 47 bool shouldForceRelocation(const MCFixup &Fixup, const MCValue &Target);48 49 std::unique_ptr<MCObjectTargetWriter>50 createObjectTargetWriter() const override;51};52} // namespace llvm53 54#endif // LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H55