LLVM 22.0.0git
LoongArchAsmBackend.h
Go to the documentation of this file.
1//===-- LoongArchAsmBackend.h - LoongArch Assembler Backend ---*- C++ -*---===//
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 LoongArchAsmBackend class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHASMBACKEND_H
14#define LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHASMBACKEND_H
15
20#include "llvm/MC/MCExpr.h"
21#include "llvm/MC/MCSection.h"
23
24namespace llvm {
25
27 const MCSubtargetInfo &STI;
28 uint8_t OSABI;
29 bool Is64Bit;
32 // Temporary symbol used to check whether a PC-relative fixup is resolved.
33 MCSymbol *PCRelTemp = nullptr;
34
35 bool isPCRelFixupResolved(const MCSymbol *SymA, const MCFragment &F);
36
37public:
38 LoongArchAsmBackend(const MCSubtargetInfo &STI, uint8_t OSABI, bool Is64Bit,
40
41 bool addReloc(const MCFragment &, const MCFixup &, const MCValue &,
42 uint64_t &FixedValue, bool IsResolved);
43
44 void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target,
45 uint8_t *Data, uint64_t Value, bool IsResolved) override;
46
47 std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
48
49 MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override;
50
51 bool relaxAlign(MCFragment &F, unsigned &Size) override;
52 bool relaxDwarfLineAddr(MCFragment &) const override;
53 bool relaxDwarfCFA(MCFragment &) const override;
54 std::pair<bool, bool> relaxLEB128(MCFragment &F,
55 int64_t &Value) const override;
56
58 const MCSubtargetInfo *STI) const override;
59
60 std::unique_ptr<MCObjectTargetWriter>
61 createObjectTargetWriter() const override;
64 return SecToAlignSym;
65 }
66};
67} // end namespace llvm
68
69#endif // LLVM_LIB_TARGET_LOONGARCH_MCTARGETDESC_LOONGARCHASMBACKEND_H
std::string Name
uint64_t Size
static LVOptions Options
Definition: LVOptions.cpp:25
#define F(x, y, z)
Definition: MD5.cpp:55
raw_pwrite_stream & OS
bool relaxDwarfCFA(MCFragment &) const override
std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const override
bool addReloc(const MCFragment &, const MCFixup &, const MCValue &, uint64_t &FixedValue, bool IsResolved)
std::optional< MCFixupKind > getFixupKind(StringRef Name) const override
Map a relocation name used in .reloc to a fixup kind.
DenseMap< MCSection *, const MCSymbolRefExpr * > & getSecToAlignSym()
bool relaxDwarfLineAddr(MCFragment &) const override
const MCTargetOptions & getTargetOptions() const
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.
void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target, uint8_t *Data, uint64_t Value, bool IsResolved) override
bool relaxAlign(MCFragment &F, unsigned &Size) override
std::pair< bool, bool > relaxLEB128(MCFragment &F, int64_t &Value) const override
MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override
Get information on a fixup kind.
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:55
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:61
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:42
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition: Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Target independent information on a fixup kind.
Definition: MCAsmBackend.h:38