#include "DwarfUnit.h"
#include "AddressPool.h"
#include "DwarfCompileUnit.h"
#include "DwarfExpression.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Metadata.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Support/Casting.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include <cassert>
#include <cstdint>
#include <limits>
#include <string>
#include <utility>
usingnamespacellvm;
#define DEBUG_TYPE …
DIEDwarfExpression::DIEDwarfExpression(const AsmPrinter &AP,
DwarfCompileUnit &CU, DIELoc &DIE)
: … { … }
void DIEDwarfExpression::emitOp(uint8_t Op, const char* Comment) { … }
void DIEDwarfExpression::emitSigned(int64_t Value) { … }
void DIEDwarfExpression::emitUnsigned(uint64_t Value) { … }
void DIEDwarfExpression::emitData1(uint8_t Value) { … }
void DIEDwarfExpression::emitBaseTypeRef(uint64_t Idx) { … }
void DIEDwarfExpression::enableTemporaryBuffer() { … }
void DIEDwarfExpression::disableTemporaryBuffer() { … }
unsigned DIEDwarfExpression::getTemporaryBufferSize() { … }
void DIEDwarfExpression::commitTemporaryBuffer() { … }
bool DIEDwarfExpression::isFrameRegister(const TargetRegisterInfo &TRI,
llvm::Register MachineReg) { … }
DwarfUnit::DwarfUnit(dwarf::Tag UnitTag, const DICompileUnit *Node,
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU,
unsigned UniqueID)
: … { … }
DwarfTypeUnit::DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID,
MCDwarfDwoLineTable *SplitLineTable)
: … { … }
DwarfUnit::~DwarfUnit() { … }
int64_t DwarfUnit::getDefaultLowerBound() const { … }
bool DwarfUnit::isShareableAcrossCUs(const DINode *D) const { … }
DIE *DwarfUnit::getDIE(const DINode *D) const { … }
void DwarfUnit::insertDIE(const DINode *Desc, DIE *D) { … }
void DwarfUnit::insertDIE(DIE *D) { … }
void DwarfUnit::addFlag(DIE &Die, dwarf::Attribute Attribute) { … }
void DwarfUnit::addUInt(DIEValueList &Die, dwarf::Attribute Attribute,
std::optional<dwarf::Form> Form, uint64_t Integer) { … }
void DwarfUnit::addUInt(DIEValueList &Block, dwarf::Form Form,
uint64_t Integer) { … }
void DwarfUnit::addSInt(DIEValueList &Die, dwarf::Attribute Attribute,
std::optional<dwarf::Form> Form, int64_t Integer) { … }
void DwarfUnit::addSInt(DIELoc &Die, std::optional<dwarf::Form> Form,
int64_t Integer) { … }
void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute,
StringRef String) { … }
void DwarfUnit::addLabel(DIEValueList &Die, dwarf::Attribute Attribute,
dwarf::Form Form, const MCSymbol *Label) { … }
void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) { … }
void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute,
uint64_t Integer) { … }
unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) { … }
void DwarfUnit::addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label) { … }
void DwarfUnit::addOpAddress(DIELoc &Die, const MCSymbol *Sym) { … }
void DwarfUnit::addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute,
const MCSymbol *Hi, const MCSymbol *Lo) { … }
void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry) { … }
void DwarfUnit::addDIETypeSignature(DIE &Die, uint64_t Signature) { … }
void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
DIEEntry Entry) { … }
DIE &DwarfUnit::createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N) { … }
void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc) { … }
void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,
DIEBlock *Block) { … }
void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute,
DIEBlock *Block) { … }
void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, const DIFile *File) { … }
void DwarfUnit::addSourceLine(DIE &Die, const DILocalVariable *V) { … }
void DwarfUnit::addSourceLine(DIE &Die, const DIGlobalVariable *G) { … }
void DwarfUnit::addSourceLine(DIE &Die, const DISubprogram *SP) { … }
void DwarfUnit::addSourceLine(DIE &Die, const DILabel *L) { … }
void DwarfUnit::addSourceLine(DIE &Die, const DIType *Ty) { … }
void DwarfUnit::addSourceLine(DIE &Die, const DIObjCProperty *Ty) { … }
void DwarfUnit::addConstantFPValue(DIE &Die, const ConstantFP *CFP) { … }
void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI,
const DIType *Ty) { … }
void DwarfUnit::addConstantValue(DIE &Die, uint64_t Val, const DIType *Ty) { … }
void DwarfUnit::addConstantValue(DIE &Die, bool Unsigned, uint64_t Val) { … }
void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty) { … }
void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, bool Unsigned) { … }
void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) { … }
void DwarfUnit::addTemplateParams(DIE &Buffer, DINodeArray TParams) { … }
void DwarfUnit::addThrownTypes(DIE &Die, DINodeArray ThrownTypes) { … }
void DwarfUnit::addAccess(DIE &Die, DINode::DIFlags Flags) { … }
DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) { … }
DIE *DwarfUnit::createTypeDIE(const DICompositeType *Ty) { … }
DIE *DwarfUnit::createTypeDIE(const DIScope *Context, DIE &ContextDIE,
const DIType *Ty) { … }
DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { … }
void DwarfUnit::updateAcceleratorTables(const DIScope *Context,
const DIType *Ty, const DIE &TyDIE) { … }
void DwarfUnit::addGlobalType(const DIType *Ty, const DIE &TyDIE,
const DIScope *Context) { … }
void DwarfUnit::addType(DIE &Entity, const DIType *Ty,
dwarf::Attribute Attribute) { … }
std::string DwarfUnit::getParentContextString(const DIScope *Context) const { … }
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIBasicType *BTy) { … }
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIStringType *STy) { … }
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) { … }
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args) { … }
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy) { … }
void DwarfUnit::addAnnotation(DIE &Buffer, DINodeArray Annotations) { … }
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) { … }
void DwarfUnit::constructTemplateTypeParameterDIE(
DIE &Buffer, const DITemplateTypeParameter *TP) { … }
void DwarfUnit::constructTemplateValueParameterDIE(
DIE &Buffer, const DITemplateValueParameter *VP) { … }
DIE *DwarfUnit::getOrCreateNameSpace(const DINamespace *NS) { … }
DIE *DwarfUnit::getOrCreateModule(const DIModule *M) { … }
DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) { … }
bool DwarfUnit::applySubprogramDefinitionAttributes(const DISubprogram *SP,
DIE &SPDie, bool Minimal) { … }
void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
bool SkipSPAttributes) { … }
void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR,
DIE *IndexTy) { … }
void DwarfUnit::constructGenericSubrangeDIE(DIE &Buffer,
const DIGenericSubrange *GSR,
DIE *IndexTy) { … }
DIE *DwarfUnit::getIndexTyDie() { … }
static bool hasVectorBeenPadded(const DICompositeType *CTy) { … }
void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) { … }
void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) { … }
void DwarfUnit::constructContainingTypeDIEs() { … }
DIE &DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) { … }
DIE *DwarfUnit::getOrCreateStaticMemberDIE(const DIDerivedType *DT) { … }
void DwarfUnit::emitCommonHeader(bool UseOffsets, dwarf::UnitType UT) { … }
void DwarfTypeUnit::emitHeader(bool UseOffsets) { … }
void DwarfUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Hi, const MCSymbol *Lo) { … }
void DwarfUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Label, const MCSymbol *Sec) { … }
bool DwarfTypeUnit::isDwoUnit() const { … }
void DwarfTypeUnit::addGlobalName(StringRef Name, const DIE &Die,
const DIScope *Context) { … }
void DwarfTypeUnit::addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
const DIScope *Context) { … }
const MCSymbol *DwarfUnit::getCrossSectionRelativeBaseAddress() const { … }
void DwarfUnit::addStringOffsetsStart() { … }
void DwarfUnit::addRnglistsBase() { … }
void DwarfTypeUnit::finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) { … }
bool DwarfUnit::isCompatibleWithVersion(uint16_t Version) const { … }