diff options
author | Chen Zheng <czhengsz@cn.ibm.com> | 2021-05-07 07:00:11 +0000 |
---|---|---|
committer | Chen Zheng <czhengsz@cn.ibm.com> | 2021-05-07 07:24:09 +0000 |
commit | 9deb7eeaf76c3285b72ce75d30fcade63b96e2dc (patch) | |
tree | c13792bd816eb2e0460f7dd5792184e2dc217270 /llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | |
parent | 1ccebb18ef9f4110e555209261d73dbec393e364 (diff) | |
download | llvm-9deb7eeaf76c3285b72ce75d30fcade63b96e2dc.zip llvm-9deb7eeaf76c3285b72ce75d30fcade63b96e2dc.tar.gz llvm-9deb7eeaf76c3285b72ce75d30fcade63b96e2dc.tar.bz2 |
[Debug-Info][NFC] add a wrapper for Die.addValue
Add a new wrapper function addAttribute() for Die.addValue() function,
so we can do some attributes control in one single interface.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D101125
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 40d290e..2b171ae 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -219,11 +219,9 @@ void DwarfUnit::insertDIE(DIE *D) { void DwarfUnit::addFlag(DIE &Die, dwarf::Attribute Attribute) { if (DD->getDwarfVersion() >= 4) - Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_flag_present, - DIEInteger(1)); + addAttribute(Die, Attribute, dwarf::DW_FORM_flag_present, DIEInteger(1)); else - Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_flag, - DIEInteger(1)); + addAttribute(Die, Attribute, dwarf::DW_FORM_flag, DIEInteger(1)); } void DwarfUnit::addUInt(DIEValueList &Die, dwarf::Attribute Attribute, @@ -232,7 +230,7 @@ void DwarfUnit::addUInt(DIEValueList &Die, dwarf::Attribute Attribute, Form = DIEInteger::BestForm(false, Integer); assert(Form != dwarf::DW_FORM_implicit_const && "DW_FORM_implicit_const is used only for signed integers"); - Die.addValue(DIEValueAllocator, Attribute, *Form, DIEInteger(Integer)); + addAttribute(Die, Attribute, *Form, DIEInteger(Integer)); } void DwarfUnit::addUInt(DIEValueList &Block, dwarf::Form Form, @@ -244,7 +242,7 @@ void DwarfUnit::addSInt(DIEValueList &Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form, int64_t Integer) { if (!Form) Form = DIEInteger::BestForm(true, Integer); - Die.addValue(DIEValueAllocator, Attribute, *Form, DIEInteger(Integer)); + addAttribute(Die, Attribute, *Form, DIEInteger(Integer)); } void DwarfUnit::addSInt(DIELoc &Die, Optional<dwarf::Form> Form, @@ -258,7 +256,7 @@ void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute, return; if (DD->useInlineStrings()) { - Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_string, + addAttribute(Die, Attribute, dwarf::DW_FORM_string, new (DIEValueAllocator) DIEInlineString(String, DIEValueAllocator)); return; @@ -282,13 +280,12 @@ void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute, else if (Index > 0xff) IxForm = dwarf::DW_FORM_strx2; } - Die.addValue(DIEValueAllocator, Attribute, IxForm, - DIEString(StringPoolEntry)); + addAttribute(Die, Attribute, IxForm, DIEString(StringPoolEntry)); } void DwarfUnit::addLabel(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label) { - Die.addValue(DIEValueAllocator, Attribute, Form, DIELabel(Label)); + addAttribute(Die, Attribute, Form, DIELabel(Label)); } void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) { @@ -355,7 +352,7 @@ void DwarfUnit::addOpAddress(DIELoc &Die, const MCSymbol *Sym) { void DwarfUnit::addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo) { - Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_data4, + addAttribute(Die, Attribute, dwarf::DW_FORM_data4, new (DIEValueAllocator) DIEDelta(Hi, Lo)); } @@ -370,8 +367,8 @@ void DwarfUnit::addDIETypeSignature(DIE &Die, uint64_t Signature) { // and think this is a full definition. addFlag(Die, dwarf::DW_AT_declaration); - Die.addValue(DIEValueAllocator, dwarf::DW_AT_signature, - dwarf::DW_FORM_ref_sig8, DIEInteger(Signature)); + addAttribute(Die, dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8, + DIEInteger(Signature)); } void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, @@ -383,7 +380,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, CU = getUnitDie().getUnit(); if (!EntryCU) EntryCU = getUnitDie().getUnit(); - Die.addValue(DIEValueAllocator, Attribute, + addAttribute(Die, Attribute, EntryCU == CU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr, Entry); } @@ -398,15 +395,14 @@ DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) { void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc) { Loc->ComputeSize(Asm); DIELocs.push_back(Loc); // Memoize so we can call the destructor later on. - Die.addValue(DIEValueAllocator, Attribute, - Loc->BestForm(DD->getDwarfVersion()), Loc); + addAttribute(Die, Attribute, Loc->BestForm(DD->getDwarfVersion()), Loc); } void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form, DIEBlock *Block) { Block->ComputeSize(Asm); DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on. - Die.addValue(DIEValueAllocator, Attribute, Form, Block); + addAttribute(Die, Attribute, Form, Block); } void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, @@ -1639,8 +1635,8 @@ DIE &DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) { // Objective-C properties. if (DINode *PNode = DT->getObjCProperty()) if (DIE *PDie = getDIE(PNode)) - MemberDie.addValue(DIEValueAllocator, dwarf::DW_AT_APPLE_property, - dwarf::DW_FORM_ref4, DIEEntry(*PDie)); + addAttribute(MemberDie, dwarf::DW_AT_APPLE_property, + dwarf::DW_FORM_ref4, DIEEntry(*PDie)); if (DT->isArtificial()) addFlag(MemberDie, dwarf::DW_AT_artificial); @@ -1746,7 +1742,7 @@ void DwarfTypeUnit::emitHeader(bool UseOffsets) { void DwarfUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo) { - Die.addValue(DIEValueAllocator, Attribute, DD->getDwarfSectionOffsetForm(), + addAttribute(Die, Attribute, DD->getDwarfSectionOffsetForm(), new (DIEValueAllocator) DIEDelta(Hi, Lo)); } |