@@ -401,6 +401,31 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
401401 /* associated=*/ nullptr );
402402}
403403
404+ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertVectorType (
405+ fir::VectorType vecTy, mlir::LLVM::DIFileAttr fileAttr,
406+ mlir::LLVM::DIScopeAttr scope, fir::cg::XDeclareOp declOp) {
407+ mlir::MLIRContext *context = module .getContext ();
408+
409+ llvm::SmallVector<mlir::LLVM::DINodeAttr> elements;
410+ mlir::LLVM::DITypeAttr elemTy =
411+ convertType (vecTy.getEleTy (), fileAttr, scope, declOp);
412+ auto intTy = mlir::IntegerType::get (context, 64 );
413+ auto countAttr =
414+ mlir::IntegerAttr::get (intTy, llvm::APInt (64 , vecTy.getLen ()));
415+ auto subrangeTy = mlir::LLVM::DISubrangeAttr::get (
416+ context, countAttr, /* lowerBound=*/ nullptr , /* upperBound=*/ nullptr ,
417+ /* stride=*/ nullptr );
418+ elements.push_back (subrangeTy);
419+ mlir::Type llvmTy = llvmTypeConverter.convertType (vecTy.getEleTy ());
420+ uint64_t sizeInBits = dataLayout->getTypeSize (llvmTy) * vecTy.getLen () * 8 ;
421+ return mlir::LLVM::DICompositeTypeAttr::get (
422+ context, llvm::dwarf::DW_TAG_array_type, /* name=*/ nullptr ,
423+ /* file=*/ nullptr , /* line=*/ 0 , /* scope=*/ nullptr , elemTy,
424+ mlir::LLVM::DIFlags::Vector, sizeInBits, /* alignInBits=*/ 0 , elements,
425+ /* dataLocation=*/ nullptr , /* rank=*/ nullptr , /* allocated=*/ nullptr ,
426+ /* associated=*/ nullptr );
427+ }
428+
404429mlir::LLVM::DITypeAttr DebugTypeGenerator::convertCharacterType (
405430 fir::CharacterType charTy, mlir::LLVM::DIFileAttr fileAttr,
406431 mlir::LLVM::DIScopeAttr scope, fir::cg::XDeclareOp declOp,
@@ -511,6 +536,8 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
511536 /* hasDescriptor=*/ false );
512537 } else if (auto recTy = mlir::dyn_cast_or_null<fir::RecordType>(Ty)) {
513538 return convertRecordType (recTy, fileAttr, scope, declOp);
539+ } else if (auto vecTy = mlir::dyn_cast_or_null<fir::VectorType>(Ty)) {
540+ return convertVectorType (vecTy, fileAttr, scope, declOp);
514541 } else if (auto boxTy = mlir::dyn_cast_or_null<fir::BoxType>(Ty)) {
515542 auto elTy = boxTy.getElementType ();
516543 if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(elTy))
0 commit comments