diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-10-23 00:16:05 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-10-23 00:16:05 +0000 |
commit | f299947bfaef176300de04c50e6dbbda863c2c96 (patch) | |
tree | efcfad988b8b4811b1fe1983bf24794627828380 /llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | |
parent | 2b22b1e9a26c32cb3ab0499882d352812d91a6f3 (diff) | |
download | bcm5719-llvm-f299947bfaef176300de04c50e6dbbda863c2c96.tar.gz bcm5719-llvm-f299947bfaef176300de04c50e6dbbda863c2c96.zip |
[DebugInfo] Sink DwarfDebug::addCurrentFnArgument down into DwarfFile.
Variable handling will be sunk into DwarfFile so that abstract variables
and the like can be shared across multiple CUs (to handle cross-CU
inlining, for example).
llvm-svn: 220453
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp index d453e8967f9..355bfd64393 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -70,6 +70,7 @@ void DwarfFile::emitUnits(const MCSymbol *ASectionSym) { Asm->OutStreamer.EmitLabel(TheU->getLabelEnd()); } } + // Compute the size and offset for each DIE. void DwarfFile::computeSizeAndOffsets() { // Offset from the first CU in the debug info section is 0 initially. @@ -155,4 +156,26 @@ void DwarfFile::emitStrings(const MCSection *StrSection, const MCSection *OffsetSection) { 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; +} } |