10b57cec5SDimitry Andric //===-- AVRAsmBackend.h - AVR Asm Backend --------------------------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // \file The AVR assembly backend implementation. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric // 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #ifndef LLVM_AVR_ASM_BACKEND_H 150b57cec5SDimitry Andric #define LLVM_AVR_ASM_BACKEND_H 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric #include "MCTargetDesc/AVRFixupKinds.h" 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric #include "llvm/MC/MCAsmBackend.h" 2006c3fb27SDimitry Andric #include "llvm/TargetParser/Triple.h" 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric namespace llvm { 230b57cec5SDimitry Andric 240b57cec5SDimitry Andric class MCAssembler; 25e8d8bef9SDimitry Andric class MCContext; 260b57cec5SDimitry Andric struct MCFixupKindInfo; 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric /// Utilities for manipulating generated AVR machine code. 290b57cec5SDimitry Andric class AVRAsmBackend : public MCAsmBackend { 300b57cec5SDimitry Andric public: AVRAsmBackend(Triple::OSType OSType)310b57cec5SDimitry Andric AVRAsmBackend(Triple::OSType OSType) 32*5f757f3fSDimitry Andric : MCAsmBackend(llvm::endianness::little), OSType(OSType) {} 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, 350b57cec5SDimitry Andric uint64_t &Value, MCContext *Ctx = nullptr) const; 360b57cec5SDimitry Andric 370b57cec5SDimitry Andric std::unique_ptr<MCObjectTargetWriter> 380b57cec5SDimitry Andric createObjectTargetWriter() const override; 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, 410b57cec5SDimitry Andric const MCValue &Target, MutableArrayRef<char> Data, 420b57cec5SDimitry Andric uint64_t Value, bool IsResolved, 430b57cec5SDimitry Andric const MCSubtargetInfo *STI) const override; 440b57cec5SDimitry Andric 45bdd1243dSDimitry Andric std::optional<MCFixupKind> getFixupKind(StringRef Name) const override; 460b57cec5SDimitry Andric const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override; 470b57cec5SDimitry Andric getNumFixupKinds()480b57cec5SDimitry Andric unsigned getNumFixupKinds() const override { 490b57cec5SDimitry Andric return AVR::NumTargetFixupKinds; 500b57cec5SDimitry Andric } 510b57cec5SDimitry Andric 52349cc55cSDimitry Andric bool writeNopData(raw_ostream &OS, uint64_t Count, 53349cc55cSDimitry Andric const MCSubtargetInfo *STI) const override; 540b57cec5SDimitry Andric 550b57cec5SDimitry Andric bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, 56*5f757f3fSDimitry Andric const MCValue &Target, 57*5f757f3fSDimitry Andric const MCSubtargetInfo *STI) override; 580b57cec5SDimitry Andric 590b57cec5SDimitry Andric private: 600b57cec5SDimitry Andric Triple::OSType OSType; 610b57cec5SDimitry Andric }; 620b57cec5SDimitry Andric 630b57cec5SDimitry Andric } // end namespace llvm 640b57cec5SDimitry Andric 650b57cec5SDimitry Andric #endif // LLVM_AVR_ASM_BACKEND_H 66