[llvm-branch-commits] [llvm-branch] r71265 - /llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Bill Wendling
isanbard at gmail.com
Fri May 8 14:04:14 PDT 2009
Author: void
Date: Fri May 8 16:04:14 2009
New Revision: 71265
URL: http://llvm.org/viewvc/llvm-project?rev=71265&view=rev
Log:
--- Merging r71263 into '.':
U lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Compute the offsets of the compile units. We need this so that when we emit a
concrete instance of an inlined function, we can get the actual address of the
abstract instance inside of the compile unit.
This isn't currently used, but will be by a future check-in.
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=71265&r1=71264&r2=71265&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Fri May 8 16:04:14 2009
@@ -1289,6 +1289,11 @@
/// variables.
DenseMap<const MachineInstr *, DbgScope *> InlinedVariableScopes;
+ /// CompileUnitOffsets - A vector of the offsets of the compile units. This is
+ /// used when calculating the "origin" of a concrete instance of an inlined
+ /// function.
+ DenseMap<CompileUnit *, unsigned> CompileUnitOffsets;
+
/// DebugTimer - Timer for the Dwarf debug writer.
Timer *DebugTimer;
@@ -2360,24 +2365,28 @@
/// SizeAndOffsets - Compute the size and offset of all the DIEs.
///
void SizeAndOffsets() {
+ // Compute size of compile unit header.
+ static unsigned Offset =
+ sizeof(int32_t) + // Length of Compilation Unit Info
+ sizeof(int16_t) + // DWARF version number
+ sizeof(int32_t) + // Offset Into Abbrev. Section
+ sizeof(int8_t); // Pointer Size (in bytes)
+
// Process base compile unit.
if (MainCU) {
- // Compute size of compile unit header
- unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info
- sizeof(int16_t) + // DWARF version number
- sizeof(int32_t) + // Offset Into Abbrev. Section
- sizeof(int8_t); // Pointer Size (in bytes)
SizeAndOffsetDie(MainCU->getDie(), Offset, true);
+ CompileUnitOffsets[MainCU] = 0;
return;
}
+
+ // Process all compile units.
+ unsigned PrevOffset = 0;
+
for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) {
CompileUnit *Unit = CompileUnits[i];
- // Compute size of compile unit header
- unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info
- sizeof(int16_t) + // DWARF version number
- sizeof(int32_t) + // Offset Into Abbrev. Section
- sizeof(int8_t); // Pointer Size (in bytes)
- SizeAndOffsetDie(Unit->getDie(), Offset, true);
+ CompileUnitOffsets[Unit] = PrevOffset;
+ PrevOffset += SizeAndOffsetDie(Unit->getDie(), Offset, true)
+ + sizeof(int32_t); // FIXME - extra pad for gdb bug.
}
}
More information about the llvm-branch-commits
mailing list