LLVM 17.0.0git
AVRAsmBackend.h
Go to the documentation of this file.
1//===-- AVRAsmBackend.h - AVR Asm Backend --------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// \file The AVR assembly backend implementation.
10//
11//===----------------------------------------------------------------------===//
12//
13
14#ifndef LLVM_AVR_ASM_BACKEND_H
15#define LLVM_AVR_ASM_BACKEND_H
16
18
19#include "llvm/ADT/Triple.h"
21
22namespace llvm {
23
24class MCAssembler;
25class MCContext;
26struct MCFixupKindInfo;
27
28/// Utilities for manipulating generated AVR machine code.
30public:
32 : MCAsmBackend(support::little), OSType(OSType) {}
33
34 void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
35 uint64_t &Value, MCContext *Ctx = nullptr) const;
36
37 std::unique_ptr<MCObjectTargetWriter>
38 createObjectTargetWriter() const override;
39
40 void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
42 uint64_t Value, bool IsResolved,
43 const MCSubtargetInfo *STI) const override;
44
45 std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
46 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
47
48 unsigned getNumFixupKinds() const override {
50 }
51
54 const MCAsmLayout &Layout) const override {
55 llvm_unreachable("RelaxInstruction() unimplemented");
56 return false;
57 }
58
59 bool writeNopData(raw_ostream &OS, uint64_t Count,
60 const MCSubtargetInfo *STI) const override;
61
62 bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
63 const MCValue &Target) override;
64
65private:
66 Triple::OSType OSType;
67};
68
69} // end namespace llvm
70
71#endif // LLVM_AVR_ASM_BACKEND_H
This header is deprecated in favour of llvm/TargetParser/Triple.h.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
std::string Name
PowerPC TLS Dynamic Call Fixup
Utilities for manipulating generated AVR machine code.
Definition: AVRAsmBackend.h:29
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const override
Simple predicate for targets where !Resolved implies requiring relaxation.
Definition: AVRAsmBackend.h:52
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target) override
Hook to check if a relocation is needed for some target specific reason.
AVRAsmBackend(Triple::OSType OSType)
Definition: AVRAsmBackend.h:31
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx=nullptr) const
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const override
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
std::optional< MCFixupKind > getFixupKind(StringRef Name) const override
Map a relocation name used in .reloc to a fixup kind.
bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const override
Write an (optimal) nop sequence of Count bytes to the given output.
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
Definition: AVRAsmBackend.h:48
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:41
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Context object for machine code objects.
Definition: MCContext.h:76
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:270
Generic base class for all target subtargets.
This represents an "assembler immediate".
Definition: MCValue.h:36
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:305
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition: Value.h:74
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ NumTargetFixupKinds
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
Target independent information on a fixup kind.