]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
MFV r329502: 7614 zfs device evacuation/removal
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / AVR / MCTargetDesc / AVRAsmBackend.h
1 //===-- AVRAsmBackend.h - AVR Asm Backend  --------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // \file The AVR assembly backend implementation.
11 //
12 //===----------------------------------------------------------------------===//
13 //
14
15 #ifndef LLVM_AVR_ASM_BACKEND_H
16 #define LLVM_AVR_ASM_BACKEND_H
17
18 #include "MCTargetDesc/AVRFixupKinds.h"
19
20 #include "llvm/ADT/Triple.h"
21 #include "llvm/MC/MCAsmBackend.h"
22
23 namespace llvm {
24
25 class MCAssembler;
26 class MCObjectWriter;
27 class Target;
28
29 struct MCFixupKindInfo;
30
31 /// Utilities for manipulating generated AVR machine code.
32 class AVRAsmBackend : public MCAsmBackend {
33 public:
34
35   AVRAsmBackend(Triple::OSType OSType)
36       : MCAsmBackend(), OSType(OSType) {}
37
38   void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
39                         uint64_t &Value, MCContext *Ctx = nullptr) const;
40
41   std::unique_ptr<MCObjectWriter> createObjectWriter(raw_pwrite_stream &OS) const override;
42
43   void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
44                   const MCValue &Target, MutableArrayRef<char> Data,
45                   uint64_t Value, bool IsPCRel) const override;
46
47   const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
48
49   unsigned getNumFixupKinds() const override {
50     return AVR::NumTargetFixupKinds;
51   }
52
53   bool mayNeedRelaxation(const MCInst &Inst) const override { return false; }
54
55   bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
56                             const MCRelaxableFragment *DF,
57                             const MCAsmLayout &Layout) const override {
58     llvm_unreachable("RelaxInstruction() unimplemented");
59     return false;
60   }
61
62   void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
63                         MCInst &Res) const override {}
64
65   bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
66
67   bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
68                              const MCValue &Target) override;
69
70 private:
71   Triple::OSType OSType;
72 };
73
74 } // end namespace llvm
75
76 #endif // LLVM_AVR_ASM_BACKEND_H
77