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) {}
46 template <
typename DINodeT>
49 using MLIRTypeT = decltype(translateImpl(node));
50 return cast_or_null<MLIRTypeT>(
51 translate(
static_cast<llvm::DINode *
>(node)));
56 DIBasicTypeAttr translateImpl(llvm::DIBasicType *node);
57 DICompileUnitAttr translateImpl(llvm::DICompileUnit *node);
58 DICompositeTypeAttr translateImpl(llvm::DICompositeType *node);
59 DIDerivedTypeAttr translateImpl(llvm::DIDerivedType *node);
60 DIFileAttr translateImpl(llvm::DIFile *node);
61 DILabelAttr translateImpl(llvm::DILabel *node);
62 DILexicalBlockAttr translateImpl(llvm::DILexicalBlock *node);
63 DILexicalBlockFileAttr translateImpl(llvm::DILexicalBlockFile *node);
64 DILocalVariableAttr translateImpl(llvm::DILocalVariable *node);
65 DIModuleAttr translateImpl(llvm::DIModule *node);
66 DINamespaceAttr translateImpl(llvm::DINamespace *node);
68 DISubprogramAttr translateImpl(llvm::DISubprogram *node);
69 DISubrangeAttr translateImpl(llvm::DISubrange *node);
70 DISubroutineTypeAttr translateImpl(llvm::DISubroutineType *node);
75 StringAttr getStringAttrOrNull(llvm::MDString *stringNode);
static MLIRContext * getContext(OpFoldResult val)
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.
auto translate(DINodeT *node)
Infers the metadata type and translates it 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.
This header declares functions that assist transformations in the MemRef dialect.