about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
diff options
context:
space:
mode:
authorKaran Janthe <karanjanthe@gmail.com>2025-09-12 06:11:18 +0000
committerKaran Janthe <karanjanthe@gmail.com>2025-09-19 05:42:27 +0000
commit3ba5f19182bf7144c54cbbd0b7af3d4fe76b5317 (patch)
tree68eff90e616c4a68d470c5d38668b14d5bd2095d /compiler/rustc_llvm/llvm-wrapper
parent4520926bb527bd43edbf0de84c2b0c6a9c5fc5ce (diff)
downloadrust-3ba5f19182bf7144c54cbbd0b7af3d4fe76b5317.tar.gz
rust-3ba5f19182bf7144c54cbbd0b7af3d4fe76b5317.zip
autodiff: typetree recursive depth query from enzyme with fallback
Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 64151962321..c1a924a87e4 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1847,3 +1847,15 @@ extern "C" void LLVMRustSetNoSanitizeHWAddress(LLVMValueRef Global) {
   MD.NoHWAddress = true;
   GV.setSanitizerMetadata(MD);
 }
+
+#ifdef ENZYME
+extern "C" {
+extern llvm::cl::opt<unsigned> EnzymeMaxTypeDepth;
+}
+
+extern "C" size_t LLVMRustEnzymeGetMaxTypeDepth() { return EnzymeMaxTypeDepth; }
+#else
+extern "C" size_t LLVMRustEnzymeGetMaxTypeDepth() {
+  return 6; // Default fallback depth
+}
+#endif