diff options
author | Alok Kumar Sharma <AlokKumar.Sharma@amd.com> | 2020-10-28 19:54:39 +0530 |
---|---|---|
committer | Alok Kumar Sharma <AlokKumar.Sharma@amd.com> | 2020-10-29 01:34:15 +0530 |
commit | a6dd01afa3d5902203d04a72e0b478078f796a35 (patch) | |
tree | 9233c88a46e1d1f7d57f70734a57a0fc802d0f9a /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 3b2256a41b062ff5e9dcf52a99b945cadf2388d1 (diff) | |
download | llvm-a6dd01afa3d5902203d04a72e0b478078f796a35.zip llvm-a6dd01afa3d5902203d04a72e0b478078f796a35.tar.gz llvm-a6dd01afa3d5902203d04a72e0b478078f796a35.tar.bz2 |
[DebugInfo] Support for DW_TAG_generic_subrange
This is needed to support fortran assumed rank arrays which
have runtime rank.
Summary:
Fortran assumed rank arrays have dynamic rank. DWARF TAG
DW_TAG_generic_subrange is needed to support that.
Testing:
unit test cases added (hand-written)
check llvm
check debug-info
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D89218
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 7cfa458..02fa1ed 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -300,6 +300,9 @@ private: SmallVectorImpl<uint64_t> &Record, unsigned &Abbrev); void writeDISubrange(const DISubrange *N, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev); + void writeDIGenericSubrange(const DIGenericSubrange *N, + SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev); void writeDIEnumerator(const DIEnumerator *N, SmallVectorImpl<uint64_t> &Record, unsigned Abbrev); void writeDIBasicType(const DIBasicType *N, SmallVectorImpl<uint64_t> &Record, @@ -1553,6 +1556,19 @@ void ModuleBitcodeWriter::writeDISubrange(const DISubrange *N, Record.clear(); } +void ModuleBitcodeWriter::writeDIGenericSubrange( + const DIGenericSubrange *N, SmallVectorImpl<uint64_t> &Record, + unsigned Abbrev) { + Record.push_back((uint64_t)N->isDistinct()); + Record.push_back(VE.getMetadataOrNullID(N->getRawCountNode())); + Record.push_back(VE.getMetadataOrNullID(N->getRawLowerBound())); + Record.push_back(VE.getMetadataOrNullID(N->getRawUpperBound())); + Record.push_back(VE.getMetadataOrNullID(N->getRawStride())); + + Stream.EmitRecord(bitc::METADATA_GENERIC_SUBRANGE, Record, Abbrev); + Record.clear(); +} + static void emitSignedInt64(SmallVectorImpl<uint64_t> &Vals, uint64_t V) { if ((int64_t)V >= 0) Vals.push_back(V << 1); |