xref: /freebsd/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h (revision 271171e0d97b88ba2a7c3bf750c9672b484c1c13)
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/MCTargetOptions.h"
15 
16 namespace llvm {
17 
18 class CSKYAsmBackend : public MCAsmBackend {
19 
20 public:
21   CSKYAsmBackend(const MCSubtargetInfo &STI, const MCTargetOptions &OP)
22       : MCAsmBackend(support::little) {}
23 
24   unsigned int getNumFixupKinds() const override {
25     return CSKY::NumTargetFixupKinds;
26   }
27 
28   void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
29                   const MCValue &Target, MutableArrayRef<char> Data,
30                   uint64_t Value, bool IsResolved,
31                   const MCSubtargetInfo *STI) const override;
32 
33   const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
34 
35   bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
36                             const MCRelaxableFragment *DF,
37                             const MCAsmLayout &Layout) const override;
38 
39   void relaxInstruction(MCInst &Inst,
40                         const MCSubtargetInfo &STI) const override;
41 
42   bool writeNopData(raw_ostream &OS, uint64_t Count,
43                     const MCSubtargetInfo *STI) const override;
44 
45   std::unique_ptr<MCObjectTargetWriter>
46   createObjectTargetWriter() const override;
47 };
48 } // namespace llvm
49 
50 #endif // LLVM_LIB_TARGET_CSKY_MCTARGETDESC_CSKYASMBACKEND_H
51