LLVM  14.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"
20 #include "llvm/MC/MCAsmBackend.h"
21 
22 namespace llvm {
23 
24 class MCAssembler;
25 class MCContext;
26 struct MCFixupKindInfo;
27 
28 /// Utilities for manipulating generated AVR machine code.
29 class AVRAsmBackend : public MCAsmBackend {
30 public:
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  const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
46 
47  unsigned getNumFixupKinds() const override {
49  }
50 
52  const MCRelaxableFragment *DF,
53  const MCAsmLayout &Layout) const override {
54  llvm_unreachable("RelaxInstruction() unimplemented");
55  return false;
56  }
57 
58  bool writeNopData(raw_ostream &OS, uint64_t Count,
59  const MCSubtargetInfo *STI) const override;
60 
61  bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
62  const MCValue &Target) override;
63 
64 private:
65  Triple::OSType OSType;
66 };
67 
68 } // end namespace llvm
69 
70 #endif // LLVM_AVR_ASM_BACKEND_H
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCRelaxableFragment
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:271
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
llvm::AVRAsmBackend::adjustFixupValue
void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx=nullptr) const
Definition: AVRAsmBackend.cpp:242
llvm::AVRAsmBackend::shouldForceRelocation
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.
Definition: AVRAsmBackend.cpp:472
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::MCAsmBackend
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:36
MCAsmBackend.h
llvm::MutableArrayRef< char >
llvm::support::little
@ little
Definition: Endian.h:27
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
DF
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
llvm::AVRAsmBackend
Utilities for manipulating generated AVR machine code.
Definition: AVRAsmBackend.h:29
llvm::MCAssembler
Definition: MCAssembler.h:60
uint64_t
llvm::AVRAsmBackend::getFixupKindInfo
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
Definition: AVRAsmBackend.cpp:393
llvm::AVRAsmBackend::createObjectTargetWriter
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
Definition: AVRAsmBackend.cpp:360
llvm::MCFixupKindInfo
Target independent information on a fixup kind.
Definition: MCFixupKindInfo.h:15
Triple.h
llvm::AVRAsmBackend::fixupNeedsRelaxation
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:51
AVRFixupKinds.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::Triple::OSType
OSType
Definition: Triple.h:167
llvm::MCAsmLayout
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
llvm::AVRAsmBackend::getNumFixupKinds
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
Definition: AVRAsmBackend.h:47
llvm::AVRAsmBackend::writeNopData
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.
Definition: AVRAsmBackend.cpp:461
llvm::MCFixupKind
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:21
llvm::AVRAsmBackend::applyFixup
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...
Definition: AVRAsmBackend.cpp:364
llvm::AVR::NumTargetFixupKinds
@ NumTargetFixupKinds
Definition: AVRFixupKinds.h:130
support
Reimplement select in terms of SEL *We would really like to support but we need to prove that the add doesn t need to overflow between the two bit chunks *Implement pre post increment support(e.g. PR935) *Implement smarter const ant generation for binops with large immediates. A few ARMv6T2 ops should be pattern matched
Definition: README.txt:10
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::AVRAsmBackend::AVRAsmBackend
AVRAsmBackend(Triple::OSType OSType)
Definition: AVRAsmBackend.h:31
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
llvm::Value
LLVM Value Representation.
Definition: Value.h:74