LLVM  8.0.1
AVRAsmBackend.h
Go to the documentation of this file.
1 //===-- AVRAsmBackend.h - AVR Asm Backend --------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // \file The AVR assembly backend implementation.
11 //
12 //===----------------------------------------------------------------------===//
13 //
14 
15 #ifndef LLVM_AVR_ASM_BACKEND_H
16 #define LLVM_AVR_ASM_BACKEND_H
17 
19 
20 #include "llvm/ADT/Triple.h"
21 #include "llvm/MC/MCAsmBackend.h"
22 
23 namespace llvm {
24 
25 class MCAssembler;
26 class MCObjectWriter;
27 class Target;
28 
29 struct MCFixupKindInfo;
30 
31 /// Utilities for manipulating generated AVR machine code.
32 class AVRAsmBackend : public MCAsmBackend {
33 public:
35  : MCAsmBackend(support::little), OSType(OSType) {}
36 
37  void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
38  uint64_t &Value, MCContext *Ctx = nullptr) const;
39 
40  std::unique_ptr<MCObjectTargetWriter>
41  createObjectTargetWriter() const override;
42 
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;
47 
48  const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
49 
50  unsigned getNumFixupKinds() const override {
52  }
53 
54  bool mayNeedRelaxation(const MCInst &Inst,
55  const MCSubtargetInfo &STI) const override {
56  return false;
57  }
58 
59  bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
60  const MCRelaxableFragment *DF,
61  const MCAsmLayout &Layout) const override {
62  llvm_unreachable("RelaxInstruction() unimplemented");
63  return false;
64  }
65 
66  void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
67  MCInst &Res) const override {}
68 
69  bool writeNopData(raw_ostream &OS, uint64_t Count) const override;
70 
71  bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
72  const MCValue &Target) override;
73 
74 private:
75  Triple::OSType OSType;
76 };
77 
78 } // end namespace llvm
79 
80 #endif // LLVM_AVR_ASM_BACKEND_H
81 
AVRAsmBackend(Triple::OSType OSType)
Definition: AVRAsmBackend.h:34
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
Definition: AVRAsmBackend.h:50
This class represents lattice values for constants.
Definition: AllocatorList.h:24
This represents an "assembler immediate".
Definition: MCValue.h:40
bool writeNopData(raw_ostream &OS, uint64_t Count) const override
Write an (optimal) nop sequence of Count bytes to the given output.
bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const override
Check whether the given instruction may need relaxation.
Definition: AVRAsmBackend.h:54
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:59
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.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, MCInst &Res) const override
Relax the instruction in the given fragment to the next wider instruction.
Definition: AVRAsmBackend.h:66
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
Context object for machine code objects.
Definition: MCContext.h:63
Utilities for manipulating generated AVR machine code.
Definition: AVRAsmBackend.h:32
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:271
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:291
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:23
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
Generic base class for all target subtargets.
Target independent information on a fixup kind.
const unsigned Kind
LLVM Value Representation.
Definition: Value.h:73
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
void adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t &Value, MCContext *Ctx=nullptr) const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
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...