[Mlir-commits] [mlir] [MLIR][LLVM] Support Recursive DITypes (PR #80251)
Tobias Gysi
llvmlistbot at llvm.org
Sun Mar 10 08:48:03 PDT 2024
================
@@ -82,12 +82,28 @@ class DebugImporter {
/// null attribute otherwise.
StringAttr getStringAttrOrNull(llvm::MDString *stringNode);
+ /// Get the DistinctAttr used to represent `node` if one was already created
+ /// for it, or create a new one if not.
+ DistinctAttr getOrCreateDistinctID(llvm::DINode *node);
+
+ /// Get the `getRecSelf` constructor for the translated type of `node` if its
+ /// translated DITypeAttr supports recursion. Otherwise, returns nullptr.
+ llvm::function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>
+ getRecSelfConstructor(llvm::DINode *node);
+
/// A mapping between LLVM debug metadata and the corresponding attribute.
DenseMap<llvm::DINode *, DINodeAttr> nodeToAttr;
+ /// A mapping between distinct LLVM debug metadata nodes and the corresponding
+ /// distinct id attribute.
+ DenseMap<llvm::DINode *, DistinctAttr> nodeToDistinctAttr;
/// A stack that stores the metadata nodes that are being traversed. The stack
/// is used to detect cyclic dependencies during the metadata translation.
- SetVector<llvm::DINode *> translationStack;
+ /// Nodes are pushed with a null value. If it is ever seen twice, it is given
+ /// a DistinctAttr ID, indicating that it is a recursive node.
----------------
gysit wrote:
```suggestion
/// A node is pushed with a null value. If it is ever seen twice, it is given
/// a recursive id attribute, indicating that it is a recursive node.
```
ultra nit:
https://github.com/llvm/llvm-project/pull/80251
More information about the Mlir-commits
mailing list