[llvm] r290931 - On a 64-bit system, the DWARFDebugLine::Row struct is 32 bytes. Each field has the following byte offsets:

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 18:34:29 PST 2017


Author: echristo
Date: Tue Jan  3 20:34:29 2017
New Revision: 290931

URL: http://llvm.org/viewvc/llvm-project?rev=290931&view=rev
Log:
On a 64-bit system, the DWARFDebugLine::Row struct is 32 bytes. Each field has the following byte offsets:

0-7: Address
8-11: Line
12-13: Column
14-15: File
16-19: Isa
20-23: Discriminator
24+: bit fields

The packing is fine until the "Isa" field, which is an 8-bit int that occupies 4 bytes. We can instead move Discriminator into the 16-19 slot, and pack Isa into the 20-23 range along with the bit fields:

0-7: Address
8-11: Line
12-13: Column
14-15: File
16-19: Discriminator
20-23: Isa + bit fields

This layout is only 24 bytes. This 25% reduction in size may seem small but a large binary can have line tables with thousands of rows stored in a vector.

Patch by Simon Que!

Differential Revision: https://reviews.llvm.org/D27961

Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h?rev=290931&r1=290930&r2=290931&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h Tue Jan  3 20:34:29 2017
@@ -116,12 +116,12 @@ public:
     // An unsigned integer indicating the identity of the source file
     // corresponding to a machine instruction.
     uint16_t File;
-    // An unsigned integer whose value encodes the applicable instruction set
-    // architecture for the current instruction.
-    uint8_t Isa;
     // An unsigned integer representing the DWARF path discriminator value
     // for this location.
     uint32_t Discriminator;
+    // An unsigned integer whose value encodes the applicable instruction set
+    // architecture for the current instruction.
+    uint8_t Isa;
     // A boolean indicating that the current instruction is the beginning of a
     // statement.
     uint8_t IsStmt:1,




More information about the llvm-commits mailing list