#include "llvm/MC/MCDwarf.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Config/config.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <optional>
#include <string>
#include <utility>
#include <vector>
usingnamespacellvm;
MCSymbol *mcdwarf::emitListsTableHeaderStart(MCStreamer &S) { … }
static inline uint64_t ScaleAddrDelta(MCContext &Context, uint64_t AddrDelta) { … }
MCDwarfLineStr::MCDwarfLineStr(MCContext &Ctx) { … }
void MCDwarfLineEntry::make(MCStreamer *MCOS, MCSection *Section) { … }
static inline const MCExpr *makeEndMinusStartExpr(MCContext &Ctx,
const MCSymbol &Start,
const MCSymbol &End,
int IntVal) { … }
static inline const MCExpr *
makeStartPlusIntExpr(MCContext &Ctx, const MCSymbol &Start, int IntVal) { … }
void MCLineSection::addEndEntry(MCSymbol *EndLabel) { … }
void MCDwarfLineTable::emitOne(
MCStreamer *MCOS, MCSection *Section,
const MCLineSection::MCDwarfLineEntryCollection &LineEntries) { … }
void MCDwarfLineTable::endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS,
SMLoc DefLoc,
StringRef Name) { … }
void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) { … }
void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
MCSection *Section) const { … }
std::pair<MCSymbol *, MCSymbol *>
MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
std::optional<MCDwarfLineStr> &LineStr) const { … }
static const MCExpr *forceExpAbs(MCStreamer &OS, const MCExpr* Expr) { … }
static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size) { … }
void MCDwarfLineStr::emitSection(MCStreamer *MCOS) { … }
SmallString<0> MCDwarfLineStr::getFinalizedData() { … }
size_t MCDwarfLineStr::addString(StringRef Path) { … }
void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) { … }
void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const { … }
static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
bool EmitMD5, bool HasAnySource,
std::optional<MCDwarfLineStr> &LineStr) { … }
void MCDwarfLineTableHeader::emitV5FileDirTables(
MCStreamer *MCOS, std::optional<MCDwarfLineStr> &LineStr) const { … }
std::pair<MCSymbol *, MCSymbol *>
MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
ArrayRef<char> StandardOpcodeLengths,
std::optional<MCDwarfLineStr> &LineStr) const { … }
void MCDwarfLineTable::emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
std::optional<MCDwarfLineStr> &LineStr) const { … }
Expected<unsigned>
MCDwarfLineTable::tryGetFile(StringRef &Directory, StringRef &FileName,
std::optional<MD5::MD5Result> Checksum,
std::optional<StringRef> Source,
uint16_t DwarfVersion, unsigned FileNumber) { … }
static bool isRootFile(const MCDwarfFile &RootFile, StringRef &Directory,
StringRef &FileName,
std::optional<MD5::MD5Result> Checksum) { … }
Expected<unsigned>
MCDwarfLineTableHeader::tryGetFile(StringRef &Directory, StringRef &FileName,
std::optional<MD5::MD5Result> Checksum,
std::optional<StringRef> Source,
uint16_t DwarfVersion, unsigned FileNumber) { … }
void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
int64_t LineDelta, uint64_t AddrDelta) { … }
static uint64_t SpecialAddr(MCDwarfLineTableParams Params, uint64_t op) { … }
void MCDwarfLineAddr::encode(MCContext &Context, MCDwarfLineTableParams Params,
int64_t LineDelta, uint64_t AddrDelta,
SmallVectorImpl<char> &Out) { … }
static void EmitAbbrev(MCStreamer *MCOS, uint64_t Name, uint64_t Form) { … }
static void EmitGenDwarfAbbrev(MCStreamer *MCOS) { … }
static void EmitGenDwarfAranges(MCStreamer *MCOS,
const MCSymbol *InfoSectionSymbol) { … }
static void EmitGenDwarfInfo(MCStreamer *MCOS,
const MCSymbol *AbbrevSectionSymbol,
const MCSymbol *LineSectionSymbol,
const MCSymbol *RangesSymbol) { … }
static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) { … }
void MCGenDwarfInfo::Emit(MCStreamer *MCOS) { … }
void MCGenDwarfLabelEntry::Make(MCSymbol *Symbol, MCStreamer *MCOS,
SourceMgr &SrcMgr, SMLoc &Loc) { … }
static int getDataAlignmentFactor(MCStreamer &streamer) { … }
static unsigned getSizeForEncoding(MCStreamer &streamer,
unsigned symbolEncoding) { … }
static void emitFDESymbol(MCObjectStreamer &streamer, const MCSymbol &symbol,
unsigned symbolEncoding, bool isEH) { … }
static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
unsigned symbolEncoding) { … }
namespace {
class FrameEmitterImpl { … };
}
static void emitEncodingByte(MCObjectStreamer &Streamer, unsigned Encoding) { … }
void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) { … }
void FrameEmitterImpl::emitCFIInstructions(ArrayRef<MCCFIInstruction> Instrs,
MCSymbol *BaseLabel) { … }
void FrameEmitterImpl::EmitCompactUnwind(const MCDwarfFrameInfo &Frame) { … }
static unsigned getCIEVersion(bool IsEH, unsigned DwarfVersion) { … }
const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) { … }
void FrameEmitterImpl::EmitFDE(const MCSymbol &cieStart,
const MCDwarfFrameInfo &frame,
bool LastInSection,
const MCSymbol &SectionStart) { … }
namespace {
struct CIEKey { … };
}
void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
bool IsEH) { … }
void MCDwarfFrameEmitter::encodeAdvanceLoc(MCContext &Context,
uint64_t AddrDelta,
SmallVectorImpl<char> &Out) { … }