|
1 | 1 | #![allow(non_camel_case_types)] |
2 | 2 | #![expect(dead_code)] |
3 | 3 |
|
4 | | -use libc::{c_char, c_uint, c_void}; |
| 4 | +use libc::{c_char, c_uint}; |
5 | 5 |
|
6 | 6 | use super::ffi::{BasicBlock, Metadata, Module, Type, Value}; |
7 | 7 | use crate::llvm::Bool; |
@@ -36,69 +36,93 @@ pub enum LLVMRustVerifierFailureAction { |
36 | 36 | LLVMReturnStatusAction = 2, |
37 | 37 | } |
38 | 38 |
|
39 | | -#[cfg(not(llvm_enzyme))] |
40 | | -pub fn EnzymeSetCLBool(arg1: *mut ::std::os::raw::c_void, arg2: u8) { |
41 | | - unimplemented!() |
42 | | -} |
43 | | -#[cfg(not(llvm_enzyme))] |
44 | | -pub fn EnzymeSetCLInteger(arg1: *mut ::std::os::raw::c_void, arg2: i64) { |
45 | | - unimplemented!() |
46 | | -} |
47 | | - |
48 | 39 | #[cfg(llvm_enzyme)] |
49 | | -extern "C" { |
50 | | - pub fn EnzymeSetCLBool(arg1: *mut ::std::os::raw::c_void, arg2: u8); |
51 | | - pub fn EnzymeSetCLInteger(arg1: *mut ::std::os::raw::c_void, arg2: i64); |
52 | | -} |
| 40 | +pub use self::Enzyme_AD::*; |
53 | 41 |
|
54 | 42 | #[cfg(llvm_enzyme)] |
55 | | -extern "C" { |
56 | | - static mut EnzymePrintPerf: c_void; |
57 | | - static mut EnzymePrintActivity: c_void; |
58 | | - static mut EnzymePrintType: c_void; |
59 | | - static mut EnzymePrint: c_void; |
60 | | - static mut EnzymeStrictAliasing: c_void; |
61 | | - static mut looseTypeAnalysis: c_void; |
62 | | - static mut EnzymeInline: c_void; |
63 | | - static mut RustTypeRules: c_void; |
64 | | -} |
65 | | -pub fn set_print_perf(print: bool) { |
66 | | - unsafe { |
67 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintPerf), print as u8); |
| 43 | +pub mod Enzyme_AD { |
| 44 | + use libc::c_void; |
| 45 | + extern "C" { |
| 46 | + pub fn EnzymeSetCLBool(arg1: *mut ::std::os::raw::c_void, arg2: u8); |
68 | 47 | } |
69 | | -} |
70 | | -pub fn set_print_activity(print: bool) { |
71 | | - unsafe { |
72 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintActivity), print as u8); |
| 48 | + extern "C" { |
| 49 | + static mut EnzymePrintPerf: c_void; |
| 50 | + static mut EnzymePrintActivity: c_void; |
| 51 | + static mut EnzymePrintType: c_void; |
| 52 | + static mut EnzymePrint: c_void; |
| 53 | + static mut EnzymeStrictAliasing: c_void; |
| 54 | + static mut looseTypeAnalysis: c_void; |
| 55 | + static mut EnzymeInline: c_void; |
| 56 | + static mut RustTypeRules: c_void; |
73 | 57 | } |
74 | | -} |
75 | | -pub fn set_print_type(print: bool) { |
76 | | - unsafe { |
77 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintType), print as u8); |
| 58 | + pub fn set_print_perf(print: bool) { |
| 59 | + unsafe { |
| 60 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintPerf), print as u8); |
| 61 | + } |
78 | 62 | } |
79 | | -} |
80 | | -pub fn set_print(print: bool) { |
81 | | - unsafe { |
82 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrint), print as u8); |
| 63 | + pub fn set_print_activity(print: bool) { |
| 64 | + unsafe { |
| 65 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintActivity), print as u8); |
| 66 | + } |
83 | 67 | } |
84 | | -} |
85 | | -pub fn set_strict_aliasing(strict: bool) { |
86 | | - unsafe { |
87 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymeStrictAliasing), strict as u8); |
| 68 | + pub fn set_print_type(print: bool) { |
| 69 | + unsafe { |
| 70 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintType), print as u8); |
| 71 | + } |
88 | 72 | } |
89 | | -} |
90 | | -pub fn set_loose_types(loose: bool) { |
91 | | - unsafe { |
92 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(looseTypeAnalysis), loose as u8); |
| 73 | + pub fn set_print(print: bool) { |
| 74 | + unsafe { |
| 75 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrint), print as u8); |
| 76 | + } |
93 | 77 | } |
94 | | -} |
95 | | -pub fn set_inline(val: bool) { |
96 | | - unsafe { |
97 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymeInline), val as u8); |
| 78 | + pub fn set_strict_aliasing(strict: bool) { |
| 79 | + unsafe { |
| 80 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymeStrictAliasing), strict as u8); |
| 81 | + } |
| 82 | + } |
| 83 | + pub fn set_loose_types(loose: bool) { |
| 84 | + unsafe { |
| 85 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(looseTypeAnalysis), loose as u8); |
| 86 | + } |
| 87 | + } |
| 88 | + pub fn set_inline(val: bool) { |
| 89 | + unsafe { |
| 90 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymeInline), val as u8); |
| 91 | + } |
| 92 | + } |
| 93 | + pub fn set_rust_rules(val: bool) { |
| 94 | + unsafe { |
| 95 | + EnzymeSetCLBool(std::ptr::addr_of_mut!(RustTypeRules), val as u8); |
| 96 | + } |
98 | 97 | } |
99 | 98 | } |
100 | | -pub fn set_rust_rules(val: bool) { |
101 | | - unsafe { |
102 | | - EnzymeSetCLBool(std::ptr::addr_of_mut!(RustTypeRules), val as u8); |
| 99 | + |
| 100 | +#[cfg(not(llvm_enzyme))] |
| 101 | +pub use self::Fallback_AD::*; |
| 102 | + |
| 103 | +#[cfg(not(llvm_enzyme))] |
| 104 | +pub mod Fallback_AD { |
| 105 | + #![allow(unused_variables)] |
| 106 | + |
| 107 | + pub fn set_inline(val: bool) { |
| 108 | + unimplemented!() |
| 109 | + } |
| 110 | + pub fn set_print_perf(print: bool) { |
| 111 | + unimplemented!() |
| 112 | + } |
| 113 | + pub fn set_print_activity(print: bool) { |
| 114 | + unimplemented!() |
| 115 | + } |
| 116 | + pub fn set_print_type(print: bool) { |
| 117 | + unimplemented!() |
| 118 | + } |
| 119 | + pub fn set_print(print: bool) { |
| 120 | + unimplemented!() |
| 121 | + } |
| 122 | + pub fn set_strict_aliasing(strict: bool) { |
| 123 | + unimplemented!() |
| 124 | + } |
| 125 | + pub fn set_loose_types(loose: bool) { |
| 126 | + unimplemented!() |
103 | 127 | } |
104 | 128 | } |
0 commit comments