diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 | 
| commit | eb11fae6d08f479c0799db45860a98af528fa6e7 (patch) | |
| tree | 44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/CodeGen/AsmPrinter/DwarfFile.cpp | |
| parent | b8a2042aa938069e862750553db0e4d82d25822c (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfFile.cpp')
| -rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfFile.cpp | 44 | 
1 files changed, 13 insertions, 31 deletions
| diff --git a/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/lib/CodeGen/AsmPrinter/DwarfFile.cpp index 3c04c969192d..c90bd568162d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -77,42 +77,24 @@ unsigned DwarfFile::computeSizeAndOffset(DIE &Die, unsigned Offset) {  void DwarfFile::emitAbbrevs(MCSection *Section) { Abbrevs.Emit(Asm, Section); }  // Emit strings into a string section. -void DwarfFile::emitStrings(MCSection *StrSection, MCSection *OffsetSection) { -  StrPool.emit(*Asm, StrSection, OffsetSection); +void DwarfFile::emitStrings(MCSection *StrSection, MCSection *OffsetSection, +                            bool UseRelativeOffsets) { +  StrPool.emit(*Asm, StrSection, OffsetSection, UseRelativeOffsets);  }  bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { -  SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS]; +  auto &ScopeVars = ScopeVariables[LS];    const DILocalVariable *DV = Var->getVariable(); -  // Variables with positive arg numbers are parameters.    if (unsigned ArgNum = DV->getArg()) { -    // Keep all parameters in order at the start of the variable list to ensure -    // function types are correct (no out-of-order parameters) -    // -    // This could be improved by only doing it for optimized builds (unoptimized -    // builds have the right order to begin with), searching from the back (this -    // would catch the unoptimized case quickly), or doing a binary search -    // rather than linear search. -    auto I = Vars.begin(); -    while (I != Vars.end()) { -      unsigned CurNum = (*I)->getVariable()->getArg(); -      // A local (non-parameter) variable has been found, insert immediately -      // before it. -      if (CurNum == 0) -        break; -      // A later indexed parameter has been found, insert immediately before it. -      if (CurNum > ArgNum) -        break; -      if (CurNum == ArgNum) { -        (*I)->addMMIEntry(*Var); -        return false; -      } -      ++I; +    auto Cached = ScopeVars.Args.find(ArgNum); +    if (Cached == ScopeVars.Args.end()) +      ScopeVars.Args[ArgNum] = Var; +    else { +      Cached->second->addMMIEntry(*Var); +      return false;      } -    Vars.insert(I, Var); -    return true; -  } - -  Vars.push_back(Var); +  } else { +    ScopeVars.Locals.push_back(Var); +  }        return true;  } | 
