14 #ifndef MLIR_LIB_TARGET_LLVMIR_DEBUGIMPORTER_H_
15 #define MLIR_LIB_TARGET_LLVMIR_DEBUGIMPORTER_H_
20 #include "llvm/IR/DebugInfoMetadata.h"
33 : context(mlirModule.
getContext()), mlirModule(mlirModule) {}
42 DIGlobalVariableExpressionAttr
53 template <
typename DINodeT>
56 using MLIRTypeT = decltype(translateImpl(node));
57 return cast_or_null<MLIRTypeT>(
58 translate(
static_cast<llvm::DINode *
>(node)));
63 DIBasicTypeAttr translateImpl(llvm::DIBasicType *node);
64 DICompileUnitAttr translateImpl(llvm::DICompileUnit *node);
65 DICompositeTypeAttr translateImpl(llvm::DICompositeType *node);
66 DIDerivedTypeAttr translateImpl(llvm::DIDerivedType *node);
67 DIFileAttr translateImpl(llvm::DIFile *node);
68 DILabelAttr translateImpl(llvm::DILabel *node);
69 DILexicalBlockAttr translateImpl(llvm::DILexicalBlock *node);
70 DILexicalBlockFileAttr translateImpl(llvm::DILexicalBlockFile *node);
71 DIGlobalVariableAttr translateImpl(llvm::DIGlobalVariable *node);
72 DILocalVariableAttr translateImpl(llvm::DILocalVariable *node);
73 DIModuleAttr translateImpl(llvm::DIModule *node);
74 DINamespaceAttr translateImpl(llvm::DINamespace *node);
76 DISubprogramAttr translateImpl(llvm::DISubprogram *node);
77 DISubrangeAttr translateImpl(llvm::DISubrange *node);
78 DISubroutineTypeAttr translateImpl(llvm::DISubroutineType *node);
83 StringAttr getStringAttrOrNull(llvm::MDString *stringNode);
92 getRecSelfConstructor(llvm::DINode *node);
104 llvm::MapVector<llvm::DINode *, DistinctAttr> translationStack;
static MLIRContext * getContext(OpFoldResult val)
An attribute that associates a referenced attribute with a unique identifier.
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.
DebugImporter(ModuleOp mlirModule)
DINodeAttr translate(llvm::DINode *node)
Translates the given LLVM debug metadata to MLIR.
DIExpressionAttr translateExpression(llvm::DIExpression *node)
Translates the LLVM DWARF expression metadata to MLIR.
auto translate(DINodeT *node)
Infers the metadata type and translates it to MLIR.
DIGlobalVariableExpressionAttr translateGlobalVariableExpression(llvm::DIGlobalVariableExpression *node)
Translates the LLVM DWARF global variable expression metadata to MLIR.
Location translateLoc(llvm::DILocation *loc)
Translates the given LLVM debug location to an MLIR location.
Location translateFuncLocation(llvm::Function *func)
Translates the debug information for the given function into a Location.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
Include the generated interface declarations.