#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SourceMgr.h"
usingnamespacellvm;
MCObjectStreamer::MCObjectStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
std::unique_ptr<MCObjectWriter> OW,
std::unique_ptr<MCCodeEmitter> Emitter)
: … { … }
MCObjectStreamer::~MCObjectStreamer() = default;
MCAssembler *MCObjectStreamer::getAssemblerPtr() { … }
void MCObjectStreamer::resolvePendingFixups() { … }
static std::optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
const MCSymbol *Lo) { … }
void MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi,
const MCSymbol *Lo,
unsigned Size) { … }
void MCObjectStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi,
const MCSymbol *Lo) { … }
void MCObjectStreamer::reset() { … }
void MCObjectStreamer::emitFrames(MCAsmBackend *MAB) { … }
static bool canReuseDataFragment(const MCDataFragment &F,
const MCAssembler &Assembler,
const MCSubtargetInfo *STI) { … }
MCDataFragment *
MCObjectStreamer::getOrCreateDataFragment(const MCSubtargetInfo *STI) { … }
void MCObjectStreamer::visitUsedSymbol(const MCSymbol &Sym) { … }
void MCObjectStreamer::emitCFISections(bool EH, bool Debug) { … }
void MCObjectStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
SMLoc Loc) { … }
MCSymbol *MCObjectStreamer::emitCFILabel() { … }
void MCObjectStreamer::emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) { … }
void MCObjectStreamer::emitCFIEndProcImpl(MCDwarfFrameInfo &Frame) { … }
void MCObjectStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) { … }
void MCObjectStreamer::emitPendingAssignments(MCSymbol *Symbol) { … }
void MCObjectStreamer::emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc,
MCDataFragment &F, uint64_t Offset) { … }
void MCObjectStreamer::emitULEB128Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitSLEB128Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitWeakReference(MCSymbol *Alias,
const MCSymbol *Symbol) { … }
void MCObjectStreamer::changeSection(MCSection *Section, uint32_t Subsection) { … }
bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
uint32_t Subsection) { … }
void MCObjectStreamer::switchSectionNoPrint(MCSection *Section) { … }
void MCObjectStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) { … }
void MCObjectStreamer::emitConditionalAssignment(MCSymbol *Symbol,
const MCExpr *Value) { … }
bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const { … }
void MCObjectStreamer::emitInstruction(const MCInst &Inst,
const MCSubtargetInfo &STI) { … }
void MCObjectStreamer::emitInstructionImpl(const MCInst &Inst,
const MCSubtargetInfo &STI) { … }
void MCObjectStreamer::emitInstToFragment(const MCInst &Inst,
const MCSubtargetInfo &STI) { … }
#ifndef NDEBUG
static const char *const BundlingNotImplementedMsg =
"Aligned bundling is not implemented for this object format";
#endif
void MCObjectStreamer::emitBundleAlignMode(Align Alignment) { … }
void MCObjectStreamer::emitBundleLock(bool AlignToEnd) { … }
void MCObjectStreamer::emitBundleUnlock() { … }
void MCObjectStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
unsigned Column, unsigned Flags,
unsigned Isa,
unsigned Discriminator,
StringRef FileName) { … }
static const MCExpr *buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A,
const MCSymbol *B, SMLoc Loc) { … }
static void emitDwarfSetLineAddr(MCObjectStreamer &OS,
MCDwarfLineTableParams Params,
int64_t LineDelta, const MCSymbol *Label,
int PointerSize) { … }
void MCObjectStreamer::emitDwarfAdvanceLineAddr(int64_t LineDelta,
const MCSymbol *LastLabel,
const MCSymbol *Label,
unsigned PointerSize) { … }
void MCObjectStreamer::emitDwarfLineEndEntry(MCSection *Section,
MCSymbol *LastLabel,
MCSymbol *EndLabel) { … }
void MCObjectStreamer::emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
const MCSymbol *Label,
SMLoc Loc) { … }
void MCObjectStreamer::emitCVLocDirective(unsigned FunctionId, unsigned FileNo,
unsigned Line, unsigned Column,
bool PrologueEnd, bool IsStmt,
StringRef FileName, SMLoc Loc) { … }
void MCObjectStreamer::emitCVLinetableDirective(unsigned FunctionId,
const MCSymbol *Begin,
const MCSymbol *End) { … }
void MCObjectStreamer::emitCVInlineLinetableDirective(
unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum,
const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) { … }
void MCObjectStreamer::emitCVDefRangeDirective(
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
StringRef FixedSizePortion) { … }
void MCObjectStreamer::emitCVStringTableDirective() { … }
void MCObjectStreamer::emitCVFileChecksumsDirective() { … }
void MCObjectStreamer::emitCVFileChecksumOffsetDirective(unsigned FileNo) { … }
void MCObjectStreamer::emitBytes(StringRef Data) { … }
void MCObjectStreamer::emitValueToAlignment(Align Alignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) { … }
void MCObjectStreamer::emitCodeAlignment(Align Alignment,
const MCSubtargetInfo *STI,
unsigned MaxBytesToEmit) { … }
void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset,
unsigned char Value,
SMLoc Loc) { … }
void MCObjectStreamer::emitDTPRel32Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitDTPRel64Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitTPRel32Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitTPRel64Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitGPRel32Value(const MCExpr *Value) { … }
void MCObjectStreamer::emitGPRel64Value(const MCExpr *Value) { … }
static std::optional<std::pair<bool, std::string>>
getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
MCDataFragment *&DF) { … }
std::optional<std::pair<bool, std::string>>
MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
const MCExpr *Expr, SMLoc Loc,
const MCSubtargetInfo &STI) { … }
void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc) { … }
void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
int64_t Expr, SMLoc Loc) { … }
void MCObjectStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLength,
SMLoc Loc, const MCSubtargetInfo &STI) { … }
void MCObjectStreamer::emitFileDirective(StringRef Filename) { … }
void MCObjectStreamer::emitFileDirective(StringRef Filename,
StringRef CompilerVersion,
StringRef TimeStamp,
StringRef Description) { … }
void MCObjectStreamer::emitAddrsig() { … }
void MCObjectStreamer::emitAddrsigSym(const MCSymbol *Sym) { … }
void MCObjectStreamer::finishImpl() { … }