LLVM  8.0.1
MipsAsmBackend.h
Go to the documentation of this file.
1 //===-- MipsAsmBackend.h - Mips 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 // This file defines the MipsAsmBackend class.
11 //
12 //===----------------------------------------------------------------------===//
13 //
14 
15 #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
16 #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
17 
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/MC/MCAsmBackend.h"
21 
22 namespace llvm {
23 
24 class MCAssembler;
25 struct MCFixupKindInfo;
26 class MCObjectWriter;
27 class MCRegisterInfo;
28 class MCSymbolELF;
29 class Target;
30 
31 class MipsAsmBackend : public MCAsmBackend {
32  Triple TheTriple;
33  bool IsN32;
34 
35 public:
36  MipsAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT,
37  StringRef CPU, bool N32)
38  : MCAsmBackend(TT.isLittleEndian() ? support::little : support::big),
39  TheTriple(TT), IsN32(N32) {}
40 
41  std::unique_ptr<MCObjectTargetWriter>
42  createObjectTargetWriter() const override;
43 
44  void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
46  uint64_t Value, bool IsResolved,
47  const MCSubtargetInfo *STI) const override;
48 
50  const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
51 
52  unsigned getNumFixupKinds() const override {
54  }
55 
56  /// @name Target Relaxation Interfaces
57  /// @{
58 
59  /// MayNeedRelaxation - Check whether the given instruction may need
60  /// relaxation.
61  ///
62  /// \param Inst - The instruction to test.
63  bool mayNeedRelaxation(const MCInst &Inst,
64  const MCSubtargetInfo &STI) const override {
65  return false;
66  }
67 
68  /// fixupNeedsRelaxation - Target specific predicate for whether a given
69  /// fixup requires the associated instruction to be relaxed.
70  bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
71  const MCRelaxableFragment *DF,
72  const MCAsmLayout &Layout) const override {
73  // FIXME.
74  llvm_unreachable("RelaxInstruction() unimplemented");
75  return false;
76  }
77 
78  /// RelaxInstruction - Relax the instruction in the given fragment
79  /// to the next wider instruction.
80  ///
81  /// \param Inst - The instruction to relax, which may be the same
82  /// as the output.
83  /// \param [out] Res On return, the relaxed instruction.
84  void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
85  MCInst &Res) const override {}
86 
87  /// @}
88 
89  bool writeNopData(raw_ostream &OS, uint64_t Count) const override;
90 
91  bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
92  const MCValue &Target) override;
93 
94  bool isMicroMips(const MCSymbol *Sym) const override;
95 }; // class MipsAsmBackend
96 
97 } // namespace
98 
99 #endif
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const override
ApplyFixup - Apply the Value for given Fixup into the provided data fragment, at the offset specified...
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const override
MayNeedRelaxation - Check whether the given instruction may need relaxation.
This represents an "assembler immediate".
Definition: MCValue.h:40
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
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
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
MipsAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, bool N32)
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:271
unsigned const MachineRegisterInfo * MRI
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:291
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:23
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const override
fixupNeedsRelaxation - Target specific predicate for whether a given fixup requires the associated in...
bool writeNopData(raw_ostream &OS, uint64_t Count) const override
WriteNopData - Write an (optimal) nop sequence of Count bytes to the given output.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, MCInst &Res) const override
RelaxInstruction - Relax the instruction in the given fragment to the next wider instruction.
bool isMicroMips(const MCSymbol *Sym) const override
Check whether a given symbol has been flagged with MICROMIPS flag.
Generic base class for all target subtargets.
Optional< MCFixupKind > getFixupKind(StringRef Name) const override
Map a relocation name used in .reloc to a fixup kind.
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
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49