diff options
author | Tom Tromey <tromey@adacore.com> | 2025-03-25 18:14:07 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-25 17:14:07 -0700 |
commit | f89129af8adfda5d9071210b771787e36ae8cd96 (patch) | |
tree | 7f80c7db5c90b5da0f8a88d5d7b7fad510e99ba8 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 584b24cd6de5fd8bcfefa0b4a57ddbbf58c14af1 (diff) | |
download | llvm-f89129af8adfda5d9071210b771787e36ae8cd96.zip llvm-f89129af8adfda5d9071210b771787e36ae8cd96.tar.gz llvm-f89129af8adfda5d9071210b771787e36ae8cd96.tar.bz2 |
Add bit stride to DICompositeType (#131680)
In Ada, an array can be packed and the elements can take less space than
their natural object size. For example, for this type:
type Packed_Array is array (4 .. 8) of Boolean;
pragma pack (Packed_Array);
... each element of the array occupies a single bit, even though the
"natural" size for a Boolean in memory is a byte.
In DWARF, this is represented by putting a DW_AT_bit_stride onto the
array type itself.
This patch adds a bit stride to DICompositeType so that gnat-llvm can
emit DWARF for these sorts of arrays.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 8f7482d..34ba25d 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1990,6 +1990,7 @@ void ModuleBitcodeWriter::writeDICompositeType( Record.push_back(VE.getMetadataOrNullID(N->getRawSpecification())); Record.push_back( N->getEnumKind().value_or(dwarf::DW_APPLE_ENUM_KIND_invalid)); + Record.push_back(VE.getMetadataOrNullID(N->getRawBitStride())); Stream.EmitRecord(bitc::METADATA_COMPOSITE_TYPE, Record, Abbrev); Record.clear(); |