From: Manman Ren Date: Fri, 11 Oct 2013 23:58:05 +0000 (+0000) Subject: Debug Info: remove form from function addDIEEntry. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=87b110ac24063a7a48a9d1273e6db596baab78a0;p=oota-llvm.git Debug Info: remove form from function addDIEEntry. The form must be a reference form in addDIEEntry. Which reference form to use will be decided by the callee. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192517 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index f91f54e773c..b43b98820de 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -226,9 +226,9 @@ void CompileUnit::addDelta(DIE *Die, uint16_t Attribute, uint16_t Form, /// addDIEEntry - Add a DIE attribute data and value. /// -void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form, - DIE *Entry) { - Die->addValue(Attribute, Form, createDIEEntry(Entry)); +void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, DIE *Entry) { + // We currently only use ref4. + Die->addValue(Attribute, dwarf::DW_FORM_ref4, createDIEEntry(Entry)); } /// addBlock - Add block data. @@ -982,7 +982,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) { addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size); if (Tag == dwarf::DW_TAG_ptr_to_member_type) - addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, + addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, getOrCreateTypeDIE(resolve(DTy.getClassType()))); // Add source line info if available and TyDesc is not a forward declaration. if (!DTy.isForwardDecl()) @@ -1162,7 +1162,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) { DICompositeType ContainingType(resolve(CTy.getContainingType())); if (DIDescriptor(ContainingType).isCompositeType()) - addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, + addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, getOrCreateTypeDIE(DIType(ContainingType))); if (CTy.isObjcClassComplete()) @@ -1329,8 +1329,7 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) { // then there is no need to add other attributes. if (DeclDie) { // Refer function declaration directly. - addDIEEntry(SPDie, dwarf::DW_AT_specification, dwarf::DW_FORM_ref4, - DeclDie); + addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie); return SPDie; } @@ -1523,8 +1522,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) { !GVContext.isFile() && !DD->isSubprogramContext(GVContext)) { // Create specification DIE. VariableSpecDIE = new DIE(dwarf::DW_TAG_variable); - addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, - dwarf::DW_FORM_ref4, VariableDIE); + addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE); addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block); // A static member's declaration is already flagged as such. if (!SDMDecl.Verify()) @@ -1578,7 +1576,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) { void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) { DIE *DW_Subrange = new DIE(dwarf::DW_TAG_subrange_type); - addDIEEntry(DW_Subrange, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IndexTy); + addDIEEntry(DW_Subrange, dwarf::DW_AT_type, IndexTy); // The LowerBound value defines the lower bounds which is typically zero for // C/C++. The Count value is the number of elements. Values are 64 bit. If @@ -1654,7 +1652,7 @@ void CompileUnit::constructContainingTypeDIEs() { if (!N) continue; DIE *NDie = getDIE(N); if (!NDie) continue; - addDIEEntry(SPDie, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, NDie); + addDIEEntry(SPDie, dwarf::DW_AT_containing_type, NDie); } } @@ -1668,8 +1666,7 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable *DV, DbgVariable *AbsVar = DV->getAbstractVariable(); DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL; if (AbsDIE) - addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, - dwarf::DW_FORM_ref4, AbsDIE); + addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE); else { if (!Name.empty()) addString(VariableDie, dwarf::DW_AT_name, Name); diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index b9ccf95bb12..43b24f720eb 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -207,7 +207,7 @@ public: /// addDIEEntry - Add a DIE attribute data and value. /// - void addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form, DIE *Entry); + void addDIEEntry(DIE *Die, uint16_t Attribute, DIE *Entry); /// addBlock - Add block data. /// diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f400eb99219..4bebecd8070 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -382,8 +382,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) { // Pick up abstract subprogram DIE. SPDie = new DIE(dwarf::DW_TAG_subprogram); - SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, - dwarf::DW_FORM_ref4, AbsSPDIE); + SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE); SPCU->addDie(SPDie); } else { DISubprogram SPDecl = SP.getFunctionDeclaration(); @@ -411,14 +410,12 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, if (ATy.isArtificial()) SPCU->addFlag(Arg, dwarf::DW_AT_artificial); if (ATy.isObjectPointer()) - SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, - dwarf::DW_FORM_ref4, Arg); + SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg); SPDie->addChild(Arg); } DIE *SPDeclDie = SPDie; SPDie = new DIE(dwarf::DW_TAG_subprogram); - SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, - dwarf::DW_FORM_ref4, SPDeclDie); + SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie); SPCU->addDie(SPDie); } } @@ -528,8 +525,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU, } DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine); - TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, - dwarf::DW_FORM_ref4, OriginDIE); + TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE); if (Ranges.size() > 1) { // .debug_range section has not been laid out yet. Emit offset in @@ -674,8 +670,7 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) { ScopeDIE->addChild(*I); if (DS.isSubprogram() && ObjectPointer != NULL) - TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, - dwarf::DW_FORM_ref4, ObjectPointer); + TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, ObjectPointer); if (DS.isSubprogram()) TheCU->addPubTypes(DISubprogram(DS)); @@ -893,8 +888,7 @@ void DwarfDebug::constructImportedEntityDIE(CompileUnit *TheCU, TheCU->getUniqueID()); TheCU->addUInt(IMDie, dwarf::DW_AT_decl_file, 0, FileID); TheCU->addUInt(IMDie, dwarf::DW_AT_decl_line, 0, Module.getLineNumber()); - TheCU->addDIEEntry(IMDie, dwarf::DW_AT_import, dwarf::DW_FORM_ref4, - EntityDie); + TheCU->addDIEEntry(IMDie, dwarf::DW_AT_import, EntityDie); StringRef Name = Module.getName(); if (!Name.empty()) TheCU->addString(IMDie, dwarf::DW_AT_name, Name);