1 //===-- AVRAsmBackend.h - AVR Asm Backend --------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // \file The AVR assembly backend implementation.
11 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_AVR_ASM_BACKEND_H
15 #define LLVM_AVR_ASM_BACKEND_H
17 #include "MCTargetDesc/AVRFixupKinds.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/MC/MCAsmBackend.h"
28 struct MCFixupKindInfo
;
30 /// Utilities for manipulating generated AVR machine code.
31 class AVRAsmBackend
: public MCAsmBackend
{
33 AVRAsmBackend(Triple::OSType OSType
)
34 : MCAsmBackend(support::little
), OSType(OSType
) {}
36 void adjustFixupValue(const MCFixup
&Fixup
, const MCValue
&Target
,
37 uint64_t &Value
, MCContext
*Ctx
= nullptr) const;
39 std::unique_ptr
<MCObjectTargetWriter
>
40 createObjectTargetWriter() const override
;
42 void applyFixup(const MCAssembler
&Asm
, const MCFixup
&Fixup
,
43 const MCValue
&Target
, MutableArrayRef
<char> Data
,
44 uint64_t Value
, bool IsResolved
,
45 const MCSubtargetInfo
*STI
) 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
,
54 const MCSubtargetInfo
&STI
) const override
{
58 bool fixupNeedsRelaxation(const MCFixup
&Fixup
, uint64_t Value
,
59 const MCRelaxableFragment
*DF
,
60 const MCAsmLayout
&Layout
) const override
{
61 llvm_unreachable("RelaxInstruction() unimplemented");
65 void relaxInstruction(const MCInst
&Inst
, const MCSubtargetInfo
&STI
,
66 MCInst
&Res
) const override
{}
68 bool writeNopData(raw_ostream
&OS
, uint64_t Count
) const override
;
70 bool shouldForceRelocation(const MCAssembler
&Asm
, const MCFixup
&Fixup
,
71 const MCValue
&Target
) override
;
74 Triple::OSType OSType
;
77 } // end namespace llvm
79 #endif // LLVM_AVR_ASM_BACKEND_H