14 #ifndef MLIR_LIB_TARGET_LLVMIR_DEBUGTRANSLATION_H_
15 #define MLIR_LIB_TARGET_LLVMIR_DEBUGTRANSLATION_H_
19 #include "llvm/ADT/SmallString.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/IR/DIBuilder.h"
44 llvm::DIGlobalVariableExpression *
48 void translate(LLVMFuncOp func, llvm::Function &llvmFunc);
54 template <
typename DIAttrT>
57 using LLVMTypeT = std::remove_pointer_t<decltype(translateImpl(attr))>;
65 llvm::DILocation *inlinedAt);
68 llvm::DIFile *translateFile(StringRef fileName);
71 llvm::DIType *translateImpl(DINullTypeAttr attr);
72 llvm::DIBasicType *translateImpl(DIBasicTypeAttr attr);
73 llvm::DICompileUnit *translateImpl(DICompileUnitAttr attr);
74 llvm::DICompositeType *translateImpl(DICompositeTypeAttr attr);
75 llvm::DIDerivedType *translateImpl(DIDerivedTypeAttr attr);
76 llvm::DIStringType *translateImpl(DIStringTypeAttr attr);
77 llvm::DIFile *translateImpl(DIFileAttr attr);
78 llvm::DIImportedEntity *translateImpl(DIImportedEntityAttr attr);
79 llvm::DILabel *translateImpl(DILabelAttr attr);
80 llvm::DILexicalBlock *translateImpl(DILexicalBlockAttr attr);
81 llvm::DILexicalBlockFile *translateImpl(DILexicalBlockFileAttr attr);
83 llvm::DILocalVariable *translateImpl(DILocalVariableAttr attr);
84 llvm::DIGlobalVariable *translateImpl(DIGlobalVariableAttr attr);
86 llvm::DIModule *translateImpl(DIModuleAttr attr);
87 llvm::DINamespace *translateImpl(DINamespaceAttr attr);
89 llvm::DISubprogram *translateImpl(DISubprogramAttr attr);
90 llvm::DIGenericSubrange *translateImpl(DIGenericSubrangeAttr attr);
91 llvm::DISubrange *translateImpl(DISubrangeAttr attr);
92 llvm::DICommonBlock *translateImpl(DICommonBlockAttr attr);
93 llvm::DISubroutineType *translateImpl(DISubroutineTypeAttr attr);
101 llvm::DINode *translateRecursive(DIRecursiveTypeAttrInterface attr);
105 llvm::TempDICompositeType translateTemporaryImpl(DICompositeTypeAttr attr);
106 llvm::TempDISubprogram translateTemporaryImpl(DISubprogramAttr attr);
110 llvm::MDString *getMDStringOrNull(StringAttr stringAttr);
118 llvm::DIExpression *getExpressionAttrOrNull(DIExpressionAttr attr);
131 llvm::MapVector<DistinctAttr, llvm::DINode *> recursiveNodeMap;
141 llvm::StringMap<llvm::DIFile *> fileMap;
147 bool debugEmissionIsEnabled;
150 llvm::Module &llvmModule;
151 llvm::LLVMContext &llvmCtx;
This class represents a LLVM attribute that describes a local debug info scope.
This class represents the base attribute for all debug info attributes.
This class represents a LLVM attribute that describes a debug info scope.
This class represents a LLVM attribute that describes a debug info type.
This class represents a LLVM attribute that describes a debug info variable.
void finalize()
Finalize the translation of debug information.
void translate(LLVMFuncOp func, llvm::Function &llvmFunc)
Translate the debug information for the given function.
llvm::DIExpression * translateExpression(LLVM::DIExpressionAttr attr)
Translates the given DWARF expression metadata to to LLVM.
DebugTranslation(Operation *module, llvm::Module &llvmModule)
auto translate(DIAttrT attr)
Translate the given derived LLVM debug metadata to LLVM.
llvm::DILocation * translateLoc(Location loc, llvm::DILocalScope *scope)
Translate the given location to an llvm debug location.
llvm::DIGlobalVariableExpression * translateGlobalVariableExpression(LLVM::DIGlobalVariableExpressionAttr attr)
Translates the given DWARF global variable expression to LLVM.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Operation is the basic unit of execution within MLIR.
Include the generated interface declarations.