[flang-commits] [flang] [flang][debug] Add support for fixed size arrays. (PR #92568)
Abid Qadeer via flang-commits
flang-commits at lists.llvm.org
Mon May 20 05:12:19 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.)
----------------
abidh wrote:
I can see an `fir.declare` where it is used inside `FuncOp` but not at the point of declaration in `GlobalOp`. Also if we use the info in `fir.declare`, we will have to pass it through all the type generation functions. It will be much cleaner if it could be added to `SequenceType` instead.
https://github.com/llvm/llvm-project/pull/92568
More information about the flang-commits
mailing list