summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp36
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp32
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.h1
4 files changed, 35 insertions, 35 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 151790ccfe8..29685abab48 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -770,7 +770,7 @@ DbgVariable *DwarfDebug::getExistingAbstractVariable(const DIVariable &DV) {
void DwarfDebug::createAbstractVariable(const DIVariable &Var,
LexicalScope *Scope) {
auto AbsDbgVariable = make_unique<DbgVariable>(Var, DIExpression(), this);
- addNonArgumentScopeVariable(Scope, AbsDbgVariable.get());
+ InfoHolder.addNonArgumentScopeVariable(Scope, AbsDbgVariable.get());
AbstractVariables[Var] = std::move(AbsDbgVariable);
}
@@ -1256,39 +1256,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
void DwarfDebug::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
if (InfoHolder.addCurrentFnArgument(Var, LS))
return;
- addNonArgumentScopeVariable(LS, Var);
-}
-
-void DwarfDebug::addNonArgumentScopeVariable(LexicalScope *LS,
- DbgVariable *Var) {
- SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
- DIVariable DV = Var->getVariable();
- // Variables with positive arg numbers are parameters.
- if (unsigned ArgNum = DV.getArgNumber()) {
- // 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.
- SmallVectorImpl<DbgVariable *>::iterator I = Vars.begin();
- while (I != Vars.end()) {
- unsigned CurNum = (*I)->getVariable().getArgNumber();
- // 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;
- ++I;
- }
- Vars.insert(I, Var);
- return;
- }
-
- Vars.push_back(Var);
+ InfoHolder.addNonArgumentScopeVariable(LS, Var);
}
// Gather and emit post-function debug information.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index ec5618f5da7..d1fae7285f5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -334,7 +334,6 @@ class DwarfDebug : public AsmPrinterHandler {
MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
- void addNonArgumentScopeVariable(LexicalScope *LS, DbgVariable *Var);
const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() {
return InfoHolder.getUnits();
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
index 7ad28225e96..6b3d148ee06 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
@@ -176,4 +176,36 @@ bool DwarfFile::addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope) {
CurrentFnArguments[ArgNo - 1] = Var;
return true;
}
+
+void DwarfFile::addNonArgumentScopeVariable(LexicalScope *LS,
+ DbgVariable *Var) {
+ SmallVectorImpl<DbgVariable *> &Vars = DD.getScopeVariables()[LS];
+ DIVariable DV = Var->getVariable();
+ // Variables with positive arg numbers are parameters.
+ if (unsigned ArgNum = DV.getArgNumber()) {
+ // 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().getArgNumber();
+ // 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;
+ ++I;
+ }
+ Vars.insert(I, Var);
+ return;
+ }
+
+ Vars.push_back(Var);
+}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
index ce12f1246cd..0ce9072fb1e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
@@ -85,6 +85,7 @@ public:
DwarfStringPool &getStringPool() { return StrPool; }
bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);
+ void addNonArgumentScopeVariable(LexicalScope *LS, DbgVariable *Var);
};
}
#endif
OpenPOWER on IntegriCloud