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
{
34 AVRAsmBackend(Triple::OSType OSType
)
35 : MCAsmBackend(support::little
), OSType(OSType
) {}
37 void adjustFixupValue(const MCFixup
&Fixup
, const MCValue
&Target
,
38 uint64_t &Value
, MCContext
*Ctx
= nullptr) const;
40 std::unique_ptr
<MCObjectTargetWriter
>
41 createObjectTargetWriter() const override
;
43 void applyFixup(const MCAssembler
&Asm
, const MCFixup
&Fixup
,
44 const MCValue
&Target
, MutableArrayRef
<char> Data
,
45 uint64_t Value
, bool IsResolved
,
46 const MCSubtargetInfo
*STI
) const override
;
48 const MCFixupKindInfo
&getFixupKindInfo(MCFixupKind Kind
) const override
;
50 unsigned getNumFixupKinds() const override
{
51 return AVR::NumTargetFixupKinds
;
54 bool mayNeedRelaxation(const MCInst
&Inst
,
55 const MCSubtargetInfo
&STI
) const override
{
59 bool fixupNeedsRelaxation(const MCFixup
&Fixup
, uint64_t Value
,
60 const MCRelaxableFragment
*DF
,
61 const MCAsmLayout
&Layout
) const override
{
62 llvm_unreachable("RelaxInstruction() unimplemented");
66 void relaxInstruction(const MCInst
&Inst
, const MCSubtargetInfo
&STI
,
67 MCInst
&Res
) const override
{}
69 bool writeNopData(raw_ostream
&OS
, uint64_t Count
) const override
;
71 bool shouldForceRelocation(const MCAssembler
&Asm
, const MCFixup
&Fixup
,
72 const MCValue
&Target
) override
;
75 Triple::OSType OSType
;
78 } // end namespace llvm
80 #endif // LLVM_AVR_ASM_BACKEND_H