LLVM 19.0.0git
Classes | Namespaces | Functions
MCDwarf.cpp File Reference
#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/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>

Go to the source code of this file.


struct  llvm::DenseMapInfo< CIEKey >


namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.


static uint64_t ScaleAddrDelta (MCContext &Context, uint64_t AddrDelta)
static const MCExprmakeEndMinusStartExpr (MCContext &Ctx, const MCSymbol &Start, const MCSymbol &End, int IntVal)
static const MCExprmakeStartPlusIntExpr (MCContext &Ctx, const MCSymbol &Start, int IntVal)
static const MCExprforceExpAbs (MCStreamer &OS, const MCExpr *Expr)
static void emitAbsValue (MCStreamer &OS, const MCExpr *Value, unsigned Size)
static void emitOneV5FileEntry (MCStreamer *MCOS, const MCDwarfFile &DwarfFile, bool EmitMD5, bool HasAnySource, std::optional< MCDwarfLineStr > &LineStr)
static bool isRootFile (const MCDwarfFile &RootFile, StringRef &Directory, StringRef &FileName, std::optional< MD5::MD5Result > Checksum)
static uint64_t SpecialAddr (MCDwarfLineTableParams Params, uint64_t op)
 Given a special op, return the address skip amount (in units of DWARF2_LINE_MIN_INSN_LENGTH).
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 MCSymbolemitGenDwarfRanges (MCStreamer *MCOS)
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)
static void emitEncodingByte (MCObjectStreamer &Streamer, unsigned Encoding)
static unsigned getCIEVersion (bool IsEH, unsigned DwarfVersion)

Function Documentation

◆ EmitAbbrev()

static void EmitAbbrev ( MCStreamer MCOS,
uint64_t  Name,
uint64_t  Form 

Definition at line 772 of file MCDwarf.cpp.

References llvm::MCStreamer::emitULEB128IntValue(), and Name.

Referenced by EmitGenDwarfAbbrev().

◆ emitAbsValue()

static void emitAbsValue ( MCStreamer OS,
const MCExpr Value,
unsigned  Size 

Definition at line 330 of file MCDwarf.cpp.

References forceExpAbs(), OS, and Size.

Referenced by emitFDESymbol(), EmitGenDwarfAranges(), EmitGenDwarfInfo(), and emitGenDwarfRanges().

◆ emitEncodingByte()

static void emitEncodingByte ( MCObjectStreamer Streamer,
unsigned  Encoding 

Definition at line 1323 of file MCDwarf.cpp.

References llvm::MCStreamer::emitInt8().

◆ emitFDESymbol()

static void emitFDESymbol ( MCObjectStreamer streamer,
const MCSymbol symbol,
unsigned  symbolEncoding,
bool  isEH 

◆ EmitGenDwarfAbbrev()

static void EmitGenDwarfAbbrev ( MCStreamer MCOS)

◆ EmitGenDwarfAranges()

static void EmitGenDwarfAranges ( MCStreamer MCOS,
const MCSymbol InfoSectionSymbol 

◆ EmitGenDwarfInfo()

static void EmitGenDwarfInfo ( MCStreamer MCOS,
const MCSymbol AbbrevSectionSymbol,
const MCSymbol LineSectionSymbol,
const MCSymbol RangesSymbol 

Definition at line 907 of file MCDwarf.cpp.

References assert(), llvm::MCSymbolRefExpr::create(), llvm::MCContext::createTempSymbol(), llvm::dwarf::DW_LENGTH_DWARF64, llvm::dwarf::DWARF64, emitAbsValue(), llvm::MCStreamer::emitBytes(), llvm::MCStreamer::emitInt16(), llvm::MCStreamer::emitInt32(), llvm::MCStreamer::emitInt8(), llvm::MCStreamer::emitIntValue(), llvm::MCStreamer::emitLabel(), llvm::MCStreamer::emitSymbolValue(), llvm::MCStreamer::emitULEB128IntValue(), llvm::MCStreamer::emitValue(), llvm::SmallVectorBase< Size_T >::empty(), llvm::StringRef::empty(), End, llvm::sys::path::get_separator(), llvm::MCContext::getAsmInfo(), llvm::MCAsmInfo::getCodePointerSize(), llvm::MCContext::getCompilationDir(), llvm::MCStreamer::getContext(), llvm::MCContext::getDwarfDebugFlags(), llvm::MCContext::getDwarfDebugProducer(), llvm::MCContext::getDwarfFormat(), llvm::MCObjectFileInfo::getDwarfInfoSection(), llvm::dwarf::getDwarfOffsetByteSize(), llvm::MCContext::getDwarfVersion(), llvm::MCContext::getGenDwarfSectionSyms(), llvm::MCContext::getMCDwarfDirs(), llvm::MCContext::getMCDwarfFiles(), llvm::MCContext::getMCDwarfLineTable(), llvm::MCContext::getMCGenDwarfLabelEntries(), llvm::MCContext::getObjectFileInfo(), llvm::MCDwarfLineTable::getRootFile(), llvm::dwarf::getUnitLengthFieldByteSize(), llvm::Length, makeEndMinusStartExpr(), llvm::MCDwarfFile::Name, llvm::MCAsmInfo::needsDwarfSectionOffsetDirective(), llvm::SmallVectorBase< Size_T >::size(), llvm::MCStreamer::switchSection(), and llvm::MCSymbolRefExpr::VK_None.

Referenced by llvm::MCGenDwarfInfo::Emit().

◆ emitGenDwarfRanges()

static MCSymbol * emitGenDwarfRanges ( MCStreamer MCOS)

◆ emitOneV5FileEntry()

static void emitOneV5FileEntry ( MCStreamer MCOS,
const MCDwarfFile DwarfFile,
bool  EmitMD5,
bool  HasAnySource,
std::optional< MCDwarfLineStr > &  LineStr 

◆ EmitPersonality()

static void EmitPersonality ( MCStreamer streamer,
const MCSymbol symbol,
unsigned  symbolEncoding 

◆ forceExpAbs()

static const MCExpr * forceExpAbs ( MCStreamer OS,
const MCExpr Expr 

Definition at line 319 of file MCDwarf.cpp.

References assert(), Context, llvm::MCSymbolRefExpr::create(), and OS.

Referenced by emitAbsValue().

◆ getCIEVersion()

static unsigned getCIEVersion ( bool  IsEH,
unsigned  DwarfVersion 

Definition at line 1556 of file MCDwarf.cpp.

References llvm_unreachable.

◆ getDataAlignmentFactor()

static int getDataAlignmentFactor ( MCStreamer streamer)

◆ getSizeForEncoding()

static unsigned getSizeForEncoding ( MCStreamer streamer,
unsigned  symbolEncoding 

◆ isRootFile()

static bool isRootFile ( const MCDwarfFile RootFile,
StringRef Directory,
StringRef FileName,
std::optional< MD5::MD5Result Checksum 

◆ makeEndMinusStartExpr()

static const MCExpr * makeEndMinusStartExpr ( MCContext Ctx,
const MCSymbol Start,
const MCSymbol End,
int  IntVal 

◆ makeStartPlusIntExpr()

static const MCExpr * makeStartPlusIntExpr ( MCContext Ctx,
const MCSymbol Start,
int  IntVal 

◆ ScaleAddrDelta()

static uint64_t ScaleAddrDelta ( MCContext Context,
uint64_t  AddrDelta 

Definition at line 68 of file MCDwarf.cpp.

References Context.

Referenced by llvm::MCDwarfLineAddr::encode(), and llvm::MCDwarfFrameEmitter::encodeAdvanceLoc().

◆ SpecialAddr()

static uint64_t SpecialAddr ( MCDwarfLineTableParams  Params,
uint64_t  op 

Given a special op, return the address skip amount (in units of DWARF2_LINE_MIN_INSN_LENGTH).

Definition at line 683 of file MCDwarf.cpp.

References llvm::MCDwarfLineTableParams::DWARF2LineOpcodeBase, llvm::MCDwarfLineTableParams::DWARF2LineRange, and op.

Referenced by llvm::MCDwarfLineAddr::encode().