LLVM 22.0.0git
RISCVELFStreamer.h
Go to the documentation of this file.
1//===-- RISCVELFStreamer.h - RISC-V ELF Target Streamer ---------*- 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#ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H
10#define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H
11
12#include "RISCVTargetStreamer.h"
14
15namespace llvm {
16
18 void reset() override;
19 void emitDataMappingSymbol();
20 void emitInstructionsMappingSymbol();
21 void emitMappingSymbol(StringRef Name);
22
23 enum ElfMappingSymbol { EMS_None, EMS_Instructions, EMS_Data };
24
26 ElfMappingSymbol LastEMS = EMS_None;
27
28public:
29 RISCVELFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> MAB,
30 std::unique_ptr<MCObjectWriter> MOW,
31 std::unique_ptr<MCCodeEmitter> MCE);
32
33 void changeSection(MCSection *Section, uint32_t Subsection) override;
34 void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;
35 void emitBytes(StringRef Data) override;
36 void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) override;
37 void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override;
38};
39
41private:
42 StringRef CurrentVendor;
43
44 MCSection *AttributeSection = nullptr;
45
46 void emitAttribute(unsigned Attribute, unsigned Value) override;
47 void emitTextAttribute(unsigned Attribute, StringRef String) override;
48 void emitIntTextAttribute(unsigned Attribute, unsigned IntValue,
49 StringRef StringValue) override;
50 void finishAttributeSection() override;
51
52 void reset() override;
53
54public:
57
58 void emitDirectiveOptionExact() override;
59 void emitDirectiveOptionNoExact() override;
60 void emitDirectiveOptionPIC() override;
61 void emitDirectiveOptionNoPIC() override;
62 void emitDirectiveOptionPop() override;
63 void emitDirectiveOptionPush() override;
64 void emitDirectiveOptionRelax() override;
65 void emitDirectiveOptionNoRelax() override;
66 void emitDirectiveOptionRVC() override;
67 void emitDirectiveOptionNoRVC() override;
68 void emitDirectiveVariantCC(MCSymbol &Symbol) override;
69
70 void finish() override;
71};
72
74 std::unique_ptr<MCAsmBackend> &&MAB,
75 std::unique_ptr<MCObjectWriter> &&MOW,
76 std::unique_ptr<MCCodeEmitter> &&MCE);
77} // namespace llvm
78
79#endif // LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:69
Context object for machine code objects.
Definition MCContext.h:83
void reset() override
state management
MCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:496
Streaming machine code generation interface.
Definition MCStreamer.h:220
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
void changeSection(MCSection *Section, uint32_t Subsection) override
This is called by popSection and switchSection, if the current section changes.
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
RISCVELFStreamer(MCContext &C, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > MOW, std::unique_ptr< MCCodeEmitter > MCE)
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) override
Emit Size bytes worth of the value specified by FillValue.
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override
Emit the expression Value into the output as a native integer of the given Size bytes.
void emitDirectiveOptionNoExact() override
RISCVTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
void emitDirectiveVariantCC(MCSymbol &Symbol) override
RISCVELFStreamer & getStreamer()
void emitDirectiveOptionNoRelax() override
Represents a location in source code.
Definition SMLoc.h:23
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
LLVM Value Representation.
Definition Value.h:75
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
MCStreamer * createRISCVELFStreamer(const Triple &, MCContext &C, std::unique_ptr< MCAsmBackend > &&MAB, std::unique_ptr< MCObjectWriter > &&MOW, std::unique_ptr< MCCodeEmitter > &&MCE)
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:189