Path: blob/main/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
35294 views
//===-- RISCVELFStreamer.h - RISC-V ELF Target Streamer ---------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H9#define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H1011#include "RISCVTargetStreamer.h"12#include "llvm/MC/MCELFStreamer.h"1314using namespace llvm;1516class RISCVELFStreamer : public MCELFStreamer {17void reset() override;18void emitDataMappingSymbol();19void emitInstructionsMappingSymbol();20void emitMappingSymbol(StringRef Name);2122enum ElfMappingSymbol { EMS_None, EMS_Instructions, EMS_Data };2324DenseMap<const MCSection *, ElfMappingSymbol> LastMappingSymbols;25ElfMappingSymbol LastEMS = EMS_None;2627public:28RISCVELFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> MAB,29std::unique_ptr<MCObjectWriter> MOW,30std::unique_ptr<MCCodeEmitter> MCE)31: MCELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE)) {}3233void changeSection(MCSection *Section, uint32_t Subsection) override;34void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;35void emitBytes(StringRef Data) override;36void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc) override;37void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override;38};3940namespace llvm {4142class RISCVTargetELFStreamer : public RISCVTargetStreamer {43private:44StringRef CurrentVendor;4546MCSection *AttributeSection = nullptr;4748void emitAttribute(unsigned Attribute, unsigned Value) override;49void emitTextAttribute(unsigned Attribute, StringRef String) override;50void emitIntTextAttribute(unsigned Attribute, unsigned IntValue,51StringRef StringValue) override;52void finishAttributeSection() override;5354void reset() override;5556public:57RISCVELFStreamer &getStreamer();58RISCVTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);5960void emitDirectiveOptionPush() override;61void emitDirectiveOptionPop() override;62void emitDirectiveOptionPIC() override;63void emitDirectiveOptionNoPIC() override;64void emitDirectiveOptionRVC() override;65void emitDirectiveOptionNoRVC() override;66void emitDirectiveOptionRelax() override;67void emitDirectiveOptionNoRelax() override;68void emitDirectiveVariantCC(MCSymbol &Symbol) override;6970void finish() override;71};7273MCELFStreamer *createRISCVELFStreamer(MCContext &C,74std::unique_ptr<MCAsmBackend> MAB,75std::unique_ptr<MCObjectWriter> MOW,76std::unique_ptr<MCCodeEmitter> MCE);77}78#endif798081