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"
41 void translate(LLVMFuncOp func, llvm::Function &llvmFunc);
47 template <
typename DIAttrT>
50 using LLVMTypeT = std::remove_pointer_t<decltype(translateImpl(attr))>;
58 llvm::DILocation *inlinedAt);
61 llvm::DIFile *translateFile(StringRef fileName);
64 llvm::DIType *translateImpl(DINullTypeAttr attr);
65 llvm::DIBasicType *translateImpl(DIBasicTypeAttr attr);
66 llvm::DICompileUnit *translateImpl(DICompileUnitAttr attr);
67 llvm::DICompositeType *translateImpl(DICompositeTypeAttr attr);
68 llvm::DIDerivedType *translateImpl(DIDerivedTypeAttr attr);
69 llvm::DIFile *translateImpl(DIFileAttr attr);
70 llvm::DILabel *translateImpl(DILabelAttr attr);
71 llvm::DILexicalBlock *translateImpl(DILexicalBlockAttr attr);
72 llvm::DILexicalBlockFile *translateImpl(DILexicalBlockFileAttr attr);
74 llvm::DILocalVariable *translateImpl(DILocalVariableAttr attr);
75 llvm::DIModule *translateImpl(DIModuleAttr attr);
76 llvm::DINamespace *translateImpl(DINamespaceAttr attr);
78 llvm::DISubprogram *translateImpl(DISubprogramAttr attr);
79 llvm::DISubrange *translateImpl(DISubrangeAttr attr);
80 llvm::DISubroutineType *translateImpl(DISubroutineTypeAttr attr);
85 llvm::MDString *getMDStringOrNull(StringAttr stringAttr);
100 llvm::StringMap<llvm::DIFile *> fileMap;
106 bool debugEmissionIsEnabled;
109 llvm::Module &llvmModule;
110 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.
void finalize()
Finalize the translation of debug information.
void translate(LLVMFuncOp func, llvm::Function &llvmFunc)
Translate the debug information for the given function.
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.
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.