[flang-commits] [flang] [flang][debug] Add support for fixed size arrays. (PR #92568)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Sat May 18 07:38:37 PDT 2024
================
@@ -37,6 +37,44 @@ static mlir::LLVM::DITypeAttr genPlaceholderType(mlir::MLIRContext *context) {
llvm::dwarf::DW_ATE_signed);
}
+mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
+ fir::SequenceType seqTy, mlir::LLVM::DIFileAttr fileAttr,
+ mlir::LLVM::DIScopeAttr scope, mlir::Location loc) {
+
+ mlir::MLIRContext *context = module.getContext();
+ // FIXME: Only fixed sizes arrays handled at the moment.
+ if (seqTy.hasDynamicExtents())
+ return genPlaceholderType(context);
+
+ llvm::SmallVector<mlir::LLVM::DINodeAttr> elements;
+ auto elemTy = convertType(seqTy.getEleTy(), fileAttr, scope, loc);
+
+ for (auto dim : seqTy.getShape()) {
+ auto intTy = mlir::IntegerType::get(context, 64);
+ // FIXME: Only supporting lower bound of 1 at the moment. The
+ // 'SequenceType' has information about the shape but not the shift. In
+ // cases, where the conversion originated during the processing of
+ // 'DeclareOp', it may be possible to pass on this information. But the
+ // type conversion should ideally be based on what information present in
+ // the type class so that it works from everywhere (e.g. when it is part
+ // of a module or a derived type.)
----------------
kiranchandramohan wrote:
Wouldn't there be a `fir.declare` with a `shapeshift` for module variables as well?
https://github.com/llvm/llvm-project/pull/92568
More information about the flang-commits
mailing list