@@ -679,26 +679,37 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertPointerLikeType(
679679 /* optional<address space>=*/ std::nullopt , /* extra data=*/ nullptr );
680680}
681681
682+ static mlir::StringAttr getBasicTypeName (mlir::MLIRContext *context,
683+ llvm::StringRef baseName,
684+ unsigned bitSize) {
685+ std::string name (baseName.str ());
686+ if (bitSize != 32 )
687+ name += " *" + std::to_string (bitSize / 8 );
688+ return mlir::StringAttr::get (context, name);
689+ }
690+
682691mlir::LLVM::DITypeAttr
683692DebugTypeGenerator::convertType (mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
684693 mlir::LLVM::DIScopeAttr scope,
685694 fir::cg::XDeclareOp declOp) {
686695 mlir::MLIRContext *context = module .getContext ();
687696 if (Ty.isInteger ()) {
688- return genBasicType (context, mlir::StringAttr::get (context, " integer" ),
689- Ty.getIntOrFloatBitWidth (), llvm::dwarf::DW_ATE_signed);
697+ unsigned bitWidth = Ty.getIntOrFloatBitWidth ();
698+ return genBasicType (context, getBasicTypeName (context, " integer" , bitWidth),
699+ bitWidth, llvm::dwarf::DW_ATE_signed);
690700 } else if (mlir::isa<mlir::FloatType>(Ty)) {
691- return genBasicType (context, mlir::StringAttr::get (context, " real" ),
692- Ty.getIntOrFloatBitWidth (), llvm::dwarf::DW_ATE_float);
701+ unsigned bitWidth = Ty.getIntOrFloatBitWidth ();
702+ return genBasicType (context, getBasicTypeName (context, " real" , bitWidth),
703+ bitWidth, llvm::dwarf::DW_ATE_float);
693704 } else if (auto logTy = mlir::dyn_cast_if_present<fir::LogicalType>(Ty)) {
694- return genBasicType (context,
695- mlir::StringAttr::get (context, logTy. getMnemonic ()),
696- kindMapping. getLogicalBitsize ( logTy.getFKind () ),
697- llvm::dwarf::DW_ATE_boolean);
705+ unsigned bitWidth = kindMapping. getLogicalBitsize (logTy. getFKind ());
706+ return genBasicType (
707+ context, getBasicTypeName (context, logTy.getMnemonic (), bitWidth ),
708+ bitWidth, llvm::dwarf::DW_ATE_boolean);
698709 } else if (auto cplxTy = mlir::dyn_cast_if_present<mlir::ComplexType>(Ty)) {
699710 auto floatTy = mlir::cast<mlir::FloatType>(cplxTy.getElementType ());
700711 unsigned bitWidth = floatTy.getWidth ();
701- return genBasicType (context, mlir::StringAttr::get (context, " complex" ),
712+ return genBasicType (context, getBasicTypeName (context, " complex" , bitWidth ),
702713 bitWidth * 2 , llvm::dwarf::DW_ATE_complex_float);
703714 } else if (auto seqTy = mlir::dyn_cast_if_present<fir::SequenceType>(Ty)) {
704715 return convertSequenceType (seqTy, fileAttr, scope, declOp);
0 commit comments