LLVM 19.0.0git
MipsAsmBackend.h
Go to the documentation of this file.
1//===-- MipsAsmBackend.h - Mips 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// This file defines the MipsAsmBackend class.
10//
11//===----------------------------------------------------------------------===//
12//
13
14#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
15#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSASMBACKEND_H
16
20
21namespace llvm {
22
23class MCAssembler;
24struct MCFixupKindInfo;
25class MCRegisterInfo;
26class Target;
27
29 Triple TheTriple;
30 bool IsN32;
31
32public:
33 MipsAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT,
34 StringRef CPU, bool N32)
35 : MCAsmBackend(TT.isLittleEndian() ? llvm::endianness::little
36 : llvm::endianness::big),
37 TheTriple(TT), IsN32(N32) {}
38
39 std::unique_ptr<MCObjectTargetWriter>
40 createObjectTargetWriter() const override;
41
42 void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
44 uint64_t Value, bool IsResolved,
45 const MCSubtargetInfo *STI) const override;
46
47 std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
48 const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
49
50 unsigned getNumFixupKinds() const override {
52 }
53
54 /// @name Target Relaxation Interfaces
55 /// @{
56
57 /// fixupNeedsRelaxation - Target specific predicate for whether a given
58 /// fixup requires the associated instruction to be relaxed.
61 const MCAsmLayout &Layout) const override {
62 // FIXME.
63 llvm_unreachable("RelaxInstruction() unimplemented");
64 return false;
65 }
66
68 const MCSubtargetInfo *STI) const override;
69
70 bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
71 const MCValue &Target,
72 const MCSubtargetInfo *STI) override;
73
74 bool isMicroMips(const MCSymbol *Sym) const override;
75}; // class MipsAsmBackend
76
77} // namespace
78
79#endif
unsigned const MachineRegisterInfo * MRI
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
std::string Name
Symbol * Sym
Definition: ELF_riscv.cpp:479
PowerPC TLS Dynamic Call Fixup
raw_pwrite_stream & OS
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:43
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
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:260
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
This represents an "assembler immediate".
Definition: MCValue.h:36
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, const MCSubtargetInfo *STI) override
Hook to check if a relocation is needed for some target specific reason.
unsigned getNumFixupKinds() const override
Get the number of target specific fixup kinds.
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 MCSubtargetInfo *STI) const override
WriteNopData - Write an (optimal) nop sequence of Count bytes to the given output.
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...
std::optional< MCFixupKind > getFixupKind(StringRef Name) const override
Map a relocation name used in .reloc to a fixup kind.
const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
bool isMicroMips(const MCSymbol *Sym) const override
Check whether a given symbol has been flagged with MICROMIPS flag.
MipsAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, bool N32)
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:307
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
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.
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
endianness
Definition: bit.h:70
Target independent information on a fixup kind.