1 //===-- AVRAsmBackend.h - AVR Asm Backend --------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // \file The AVR assembly backend implementation.
12 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_AVR_ASM_BACKEND_H
16 #define LLVM_AVR_ASM_BACKEND_H
18 #include "MCTargetDesc/AVRFixupKinds.h"
20 #include "llvm/ADT/Triple.h"
21 #include "llvm/MC/MCAsmBackend.h"
29 struct MCFixupKindInfo;
31 /// Utilities for manipulating generated AVR machine code.
32 class AVRAsmBackend : public MCAsmBackend {
35 AVRAsmBackend(Triple::OSType OSType)
36 : MCAsmBackend(), OSType(OSType) {}
38 void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
39 uint64_t &Value, MCContext *Ctx = nullptr) const;
41 MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override;
43 void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
44 const MCValue &Target, MutableArrayRef<char> Data,
45 uint64_t Value, bool IsPCRel) const override;
47 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
49 unsigned getNumFixupKinds() const override {
50 return AVR::NumTargetFixupKinds;
53 bool mayNeedRelaxation(const MCInst &Inst) const override { return false; }
55 bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
56 const MCRelaxableFragment *DF,
57 const MCAsmLayout &Layout) const override {
58 llvm_unreachable("RelaxInstruction() unimplemented");
62 void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
63 MCInst &Res) const override {}
65 bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
67 bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
68 const MCValue &Target) override;
71 Triple::OSType OSType;
74 } // end namespace llvm
76 #endif // LLVM_AVR_ASM_BACKEND_H