diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 24 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 7 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 23 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfFile.h | 1 |
5 files changed, 8 insertions, 51 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index e14ac5ac7f6..f1ee52da8d4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -556,31 +556,21 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) { DIE &ScopeDIE = updateSubprogramScopeDIE(Sub); - // Collect arguments for current function. - DIE *ObjectPointer = nullptr; - for (DbgVariable *ArgDV : DD->getCurrentFnArguments()) - if (ArgDV) - ScopeDIE.addChild(constructVariableDIE(*ArgDV, *Scope, ObjectPointer)); - // If this is a variadic function, add an unspecified parameter. DITypeArray FnArgs = Sub.getType().getTypeArray(); + + // Collect lexical scope children first. + // ObjectPointer might be a local (non-argument) local variable if it's a + // block's synthetic this pointer. + if (DIE *ObjectPointer = createAndAddScopeChildren(Scope, ScopeDIE)) + addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer); + // If we have a single element of null, it is a function that returns void. // If we have more than one elements and the last one is null, it is a // variadic function. if (FnArgs.getNumElements() > 1 && !FnArgs.getElement(FnArgs.getNumElements() - 1)) ScopeDIE.addChild(make_unique<DIE>(dwarf::DW_TAG_unspecified_parameters)); - - // Collect lexical scope children first. - // ObjectPointer might be a local (non-argument) local variable if it's a - // block's synthetic this pointer. - if (DIE *BlockObjPtr = createAndAddScopeChildren(Scope, ScopeDIE)) { - assert(!ObjectPointer && "multiple object pointers can't be described"); - ObjectPointer = BlockObjPtr; - } - - if (ObjectPointer) - addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer); } DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope, diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 29685abab48..12915d8a48b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1254,8 +1254,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { } void DwarfDebug::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { - if (InfoHolder.addCurrentFnArgument(Var, LS)) - return; InfoHolder.addNonArgumentScopeVariable(LS, Var); } @@ -1297,7 +1295,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { if (TheCU.getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly && LScopes.getAbstractScopesList().empty() && !IsDarwin) { assert(ScopeVariables.empty()); - assert(CurrentFnArguments.empty()); assert(DbgValues.empty()); // FIXME: This wouldn't be true in LTO with a -g (with inlining) CU followed // by a -gmlt CU. Add a test and remove this assertion. @@ -1337,7 +1334,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { // DbgVariables except those that are also in AbstractVariables (since they // can be used cross-function) ScopeVariables.clear(); - CurrentFnArguments.clear(); DbgValues.clear(); LabelsBeforeInsn.clear(); LabelsAfterInsn.clear(); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index d1fae7285f5..927ef76e4bd 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -194,9 +194,6 @@ class DwarfDebug : public AsmPrinterHandler { typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType; SectionMapType SectionMap; - // List of arguments for current function. - SmallVector<DbgVariable *, 8> CurrentFnArguments; - LexicalScopes LScopes; // Collection of abstract subprogram DIEs. @@ -675,10 +672,6 @@ public: SmallPtrSet<const MDNode *, 16> &getProcessedSPNodes() { return ProcessedSPNodes; } - - SmallVector<DbgVariable *, 8> &getCurrentFnArguments() { - return CurrentFnArguments; - } }; } // End of namespace llvm diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp index 6b3d148ee06..0d92169587b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -155,28 +155,6 @@ void DwarfFile::emitStrings(const MCSection *StrSection, StrPool.emit(*Asm, StrSection, OffsetSection); } -// If Var is a current function argument then add it to CurrentFnArguments list. -bool DwarfFile::addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope) { - if (Scope->getParent()) - return false; - DIVariable DV = Var->getVariable(); - if (DV.getTag() != dwarf::DW_TAG_arg_variable) - return false; - unsigned ArgNo = DV.getArgNumber(); - if (ArgNo == 0) - return false; - - auto &CurrentFnArguments = DD.getCurrentFnArguments(); - - // llvm::Function argument size is not good indicator of how many - // arguments does the function have at source level. - if (ArgNo > CurrentFnArguments.size()) - CurrentFnArguments.resize(ArgNo * 2); - assert(!CurrentFnArguments[ArgNo - 1]); - CurrentFnArguments[ArgNo - 1] = Var; - return true; -} - void DwarfFile::addNonArgumentScopeVariable(LexicalScope *LS, DbgVariable *Var) { SmallVectorImpl<DbgVariable *> &Vars = DD.getScopeVariables()[LS]; @@ -200,6 +178,7 @@ void DwarfFile::addNonArgumentScopeVariable(LexicalScope *LS, // A later indexed parameter has been found, insert immediately before it. if (CurNum > ArgNum) break; + assert(CurNum != ArgNum); ++I; } Vars.insert(I, Var); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h index 0ce9072fb1e..011b5de6c6e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h @@ -84,7 +84,6 @@ public: /// \brief Returns the string pool. DwarfStringPool &getStringPool() { return StrPool; } - bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope); void addNonArgumentScopeVariable(LexicalScope *LS, DbgVariable *Var); }; } |