From fdf40917d946e3b36fd67afb2aac4063af9fc85d Mon Sep 17 00:00:00 2001 From: Sander de Smalen Date: Wed, 24 Jan 2018 09:56:07 +0000 Subject: [Metadata] Extend 'count' field of DISubrange to take a metadata node Summary: This patch extends the DISubrange 'count' field to take either a (signed) constant integer value or a reference to a DILocalVariable or DIGlobalVariable. This is patch [1/3] in a series to extend LLVM's DISubrange Metadata node to support debugging of C99 variable length arrays and vectors with runtime length like the Scalable Vector Extension for AArch64. It is also a first step towards representing more complex cases like arrays in Fortran. Reviewers: echristo, pcc, aprantl, dexonsmith, clayborg, kristof.beyls, dblaikie Reviewed By: aprantl Subscribers: rnk, probinson, fhahn, aemerson, rengolin, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D41695 llvm-svn: 323313 --- llvm/lib/IR/DebugInfoMetadata.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp') diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 75ddd47b259..b6eda6a2921 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -249,8 +249,17 @@ void GenericDINode::recalculateHash() { DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo, StorageType Storage, bool ShouldCreate) { - DEFINE_GETIMPL_LOOKUP(DISubrange, (Count, Lo)); - DEFINE_GETIMPL_STORE_NO_OPS(DISubrange, (Count, Lo)); + auto *CountNode = ConstantAsMetadata::get( + ConstantInt::getSigned(Type::getInt64Ty(Context), Count)); + return getImpl(Context, CountNode, Lo, Storage, ShouldCreate); +} + +DISubrange *DISubrange::getImpl(LLVMContext &Context, Metadata *CountNode, + int64_t Lo, StorageType Storage, + bool ShouldCreate) { + DEFINE_GETIMPL_LOOKUP(DISubrange, (CountNode, Lo)); + Metadata *Ops[] = { CountNode }; + DEFINE_GETIMPL_STORE(DISubrange, (CountNode, Lo), Ops); } DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value, -- cgit v1.2.3