]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.h
MFV r339226 (peter): Record merge of serf-1.3.9.
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Mips / MCTargetDesc / MipsAsmBackend.h
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
18 #include "MCTargetDesc/MipsFixupKinds.h"
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 Target;
29
30 class MipsAsmBackend : public MCAsmBackend {
31   Triple TheTriple;
32   bool IsLittle; // Big or little endian
33   bool IsN32;
34
35 public:
36   MipsAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT,
37                  StringRef CPU, bool N32)
38       : TheTriple(TT), IsLittle(TT.isLittleEndian()), IsN32(N32) {}
39
40   std::unique_ptr<MCObjectWriter>
41   createObjectWriter(raw_pwrite_stream &OS) 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) const override;
46
47   Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
48   const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
49
50   unsigned getNumFixupKinds() const override {
51     return Mips::NumTargetFixupKinds;
52   }
53
54   /// @name Target Relaxation Interfaces
55   /// @{
56
57   /// MayNeedRelaxation - Check whether the given instruction may need
58   /// relaxation.
59   ///
60   /// \param Inst - The instruction to test.
61   bool mayNeedRelaxation(const MCInst &Inst) const override {
62     return false;
63   }
64
65   /// fixupNeedsRelaxation - Target specific predicate for whether a given
66   /// fixup requires the associated instruction to be relaxed.
67    bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
68                              const MCRelaxableFragment *DF,
69                              const MCAsmLayout &Layout) const override {
70     // FIXME.
71     llvm_unreachable("RelaxInstruction() unimplemented");
72     return false;
73   }
74
75   /// RelaxInstruction - Relax the instruction in the given fragment
76   /// to the next wider instruction.
77   ///
78   /// \param Inst - The instruction to relax, which may be the same
79   /// as the output.
80   /// \param [out] Res On return, the relaxed instruction.
81   void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
82                         MCInst &Res) const override {}
83
84   /// @}
85
86   bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
87
88 }; // class MipsAsmBackend
89
90 } // namespace
91
92 #endif