13#ifndef FORTRAN_OPTIMIZER_TRANSFORMS_DEBUGTYPEGENERATOR_H
14#define FORTRAN_OPTIMIZER_TRANSFORMS_DEBUGTYPEGENERATOR_H
16#include "flang/Optimizer/CodeGen/TypeConverter.h"
17#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
18#include "flang/Optimizer/Dialect/FIRType.h"
19#include "flang/Optimizer/Dialect/Support/FIRContext.h"
20#include "flang/Optimizer/Dialect/Support/KindMapping.h"
21#include "flang/Optimizer/Support/DataLayout.h"
22#include "llvm/Support/Debug.h"
67 mlir::LLVM::DITypeAttr lookup(mlir::Type);
69 mlir::LLVM::DITypeAttr placeHolder =
nullptr);
70 void finalize(mlir::Type, mlir::LLVM::DITypeAttr,
ActiveLevels &&);
71 void preComponentVisitUpdate();
75 void insertCacheCleanUp(mlir::Type type, int32_t depth);
76 void cleanUpCache(int32_t depth);
78 int32_t derivedTypeDepth = 0;
86 llvm::DenseMap<mlir::Type, std::pair<mlir::LLVM::DITypeAttr, ActiveLevels>>
101 const mlir::DataLayout &dl);
103 mlir::LLVM::DITypeAttr convertType(mlir::Type Ty,
104 mlir::LLVM::DIFileAttr fileAttr,
105 mlir::LLVM::DIScopeAttr scope,
106 fir::cg::XDeclareOp declOp);
109 mlir::LLVM::DITypeAttr convertRecordType(fir::RecordType Ty,
110 mlir::LLVM::DIFileAttr fileAttr,
111 mlir::LLVM::DIScopeAttr scope,
112 fir::cg::XDeclareOp declOp);
113 mlir::LLVM::DITypeAttr convertTupleType(mlir::TupleType Ty,
114 mlir::LLVM::DIFileAttr fileAttr,
115 mlir::LLVM::DIScopeAttr scope,
116 fir::cg::XDeclareOp declOp);
117 mlir::LLVM::DITypeAttr convertSequenceType(fir::SequenceType seqTy,
118 mlir::LLVM::DIFileAttr fileAttr,
119 mlir::LLVM::DIScopeAttr scope,
120 fir::cg::XDeclareOp declOp);
121 mlir::LLVM::DITypeAttr convertVectorType(fir::VectorType vecTy,
122 mlir::LLVM::DIFileAttr fileAttr,
123 mlir::LLVM::DIScopeAttr scope,
124 fir::cg::XDeclareOp declOp);
130 mlir::LLVM::DITypeAttr convertBoxedSequenceType(
131 fir::SequenceType seqTy, mlir::LLVM::DIFileAttr fileAttr,
132 mlir::LLVM::DIScopeAttr scope, fir::cg::XDeclareOp declOp,
133 bool genAllocated,
bool genAssociated);
134 mlir::LLVM::DITypeAttr convertCharacterType(fir::CharacterType charTy,
135 mlir::LLVM::DIFileAttr fileAttr,
136 mlir::LLVM::DIScopeAttr scope,
137 fir::cg::XDeclareOp declOp,
140 mlir::LLVM::DITypeAttr convertPointerLikeType(mlir::Type elTy,
141 mlir::LLVM::DIFileAttr fileAttr,
142 mlir::LLVM::DIScopeAttr scope,
143 fir::cg::XDeclareOp declOp,
146 mlir::LLVM::DILocalVariableAttr
147 generateArtificialVariable(mlir::MLIRContext *context, mlir::Value Val,
148 mlir::LLVM::DIFileAttr fileAttr,
149 mlir::LLVM::DIScopeAttr scope,
150 fir::cg::XDeclareOp declOp);
151 std::pair<std::uint64_t, unsigned short>
152 getFieldSizeAndAlign(mlir::Type fieldTy);
154 mlir::ModuleOp module;
155 mlir::SymbolTable *symbolTable;
156 const mlir::DataLayout *dataLayout;
159 std::uint64_t dimsSize;
160 std::uint64_t dimsOffset;
161 std::uint64_t ptrSize;
162 std::uint64_t lenOffset;
163 std::uint64_t rankOffset;
164 std::uint64_t rankSize;
170static uint32_t getLineFromLoc(mlir::Location loc) {
172 if (
auto fileLoc = mlir::dyn_cast<mlir::FileLineColLoc>(loc))
173 line = fileLoc.getLine();
This converts FIR/mlir type to DITypeAttr.
Definition: DebugTypeGenerator.h:98
Definition: DebugTypeGenerator.h:34
Definition: KindMapping.h:48
Definition: TypeConverter.h:50
Definition: AbstractConverter.h:34