]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | #![allow(non_camel_case_types)] |
2 | #![allow(non_upper_case_globals)] | |
3 | ||
3dfed10e XL |
4 | use rustc_codegen_ssa::coverageinfo::map as coverage_map; |
5 | ||
b7449926 | 6 | use super::debuginfo::{ |
dfeec247 | 7 | DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator, |
29967ef6 XL |
8 | DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace, |
9 | DISPFlags, DIScope, DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable, | |
10 | DebugEmissionKind, | |
b7449926 XL |
11 | }; |
12 | ||
dfeec247 | 13 | use libc::{c_char, c_int, c_uint, size_t}; |
b7449926 XL |
14 | use libc::{c_ulonglong, c_void}; |
15 | ||
16 | use std::marker::PhantomData; | |
17 | ||
18 | use super::RustString; | |
19 | ||
20 | pub type Bool = c_uint; | |
21 | ||
22 | pub const True: Bool = 1 as Bool; | |
23 | pub const False: Bool = 0 as Bool; | |
24 | ||
25 | #[derive(Copy, Clone, PartialEq)] | |
26 | #[repr(C)] | |
27 | #[allow(dead_code)] // Variants constructed by C++. | |
28 | pub enum LLVMRustResult { | |
29 | Success, | |
30 | Failure, | |
31 | } | |
17df50a5 XL |
32 | |
33 | // Rust version of the C struct with the same name in rustc_llvm/llvm-wrapper/RustWrapper.cpp. | |
34 | #[repr(C)] | |
35 | pub struct LLVMRustCOFFShortExport { | |
36 | pub name: *const c_char, | |
c295e0f8 | 37 | pub ordinal_present: bool, |
487cf647 | 38 | /// value of `ordinal` only important when `ordinal_present` is true |
c295e0f8 | 39 | pub ordinal: u16, |
17df50a5 XL |
40 | } |
41 | ||
42 | impl LLVMRustCOFFShortExport { | |
c295e0f8 XL |
43 | pub fn new(name: *const c_char, ordinal: Option<u16>) -> LLVMRustCOFFShortExport { |
44 | LLVMRustCOFFShortExport { | |
45 | name, | |
46 | ordinal_present: ordinal.is_some(), | |
47 | ordinal: ordinal.unwrap_or(0), | |
48 | } | |
17df50a5 XL |
49 | } |
50 | } | |
51 | ||
52 | /// Translation of LLVM's MachineTypes enum, defined in llvm\include\llvm\BinaryFormat\COFF.h. | |
53 | /// | |
54 | /// We include only architectures supported on Windows. | |
55 | #[derive(Copy, Clone, PartialEq)] | |
56 | #[repr(C)] | |
57 | pub enum LLVMMachineType { | |
58 | AMD64 = 0x8664, | |
59 | I386 = 0x14c, | |
60 | ARM64 = 0xaa64, | |
61 | ARM = 0x01c0, | |
62 | } | |
63 | ||
5099ac24 FG |
64 | /// LLVM's Module::ModFlagBehavior, defined in llvm/include/llvm/IR/Module.h. |
65 | /// | |
66 | /// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are | |
67 | /// resolved according to the merge behaviors specified here. Flags differing only in merge | |
68 | /// behavior are still considered to be in conflict. | |
69 | /// | |
70 | /// In order for Rust-C LTO to work, we must specify behaviors compatible with Clang. Notably, | |
71 | /// 'Error' and 'Warning' cannot be mixed for a given flag. | |
72 | #[derive(Copy, Clone, PartialEq)] | |
73 | #[repr(C)] | |
74 | pub enum LLVMModFlagBehavior { | |
75 | Error = 1, | |
76 | Warning = 2, | |
77 | Require = 3, | |
78 | Override = 4, | |
79 | Append = 5, | |
80 | AppendUnique = 6, | |
81 | Max = 7, | |
82 | } | |
83 | ||
b7449926 XL |
84 | // Consts for the LLVM CallConv type, pre-cast to usize. |
85 | ||
86 | /// LLVM CallingConv::ID. Should we wrap this? | |
87 | #[derive(Copy, Clone, PartialEq, Debug)] | |
88 | #[repr(C)] | |
89 | pub enum CallConv { | |
90 | CCallConv = 0, | |
91 | FastCallConv = 8, | |
92 | ColdCallConv = 9, | |
93 | X86StdcallCallConv = 64, | |
94 | X86FastcallCallConv = 65, | |
95 | ArmAapcsCallConv = 67, | |
96 | Msp430Intr = 69, | |
97 | X86_ThisCall = 70, | |
98 | PtxKernel = 71, | |
99 | X86_64_SysV = 78, | |
100 | X86_64_Win64 = 79, | |
101 | X86_VectorCall = 80, | |
102 | X86_Intr = 83, | |
f035d41b XL |
103 | AvrNonBlockingInterrupt = 84, |
104 | AvrInterrupt = 85, | |
b7449926 XL |
105 | AmdGpuKernel = 91, |
106 | } | |
107 | ||
108 | /// LLVMRustLinkage | |
17df50a5 | 109 | #[derive(Copy, Clone, PartialEq)] |
b7449926 XL |
110 | #[repr(C)] |
111 | pub enum Linkage { | |
112 | ExternalLinkage = 0, | |
113 | AvailableExternallyLinkage = 1, | |
114 | LinkOnceAnyLinkage = 2, | |
115 | LinkOnceODRLinkage = 3, | |
116 | WeakAnyLinkage = 4, | |
117 | WeakODRLinkage = 5, | |
118 | AppendingLinkage = 6, | |
119 | InternalLinkage = 7, | |
120 | PrivateLinkage = 8, | |
121 | ExternalWeakLinkage = 9, | |
122 | CommonLinkage = 10, | |
123 | } | |
124 | ||
125 | // LLVMRustVisibility | |
b7449926 | 126 | #[repr(C)] |
17df50a5 | 127 | #[derive(Copy, Clone, PartialEq)] |
b7449926 XL |
128 | pub enum Visibility { |
129 | Default = 0, | |
130 | Hidden = 1, | |
131 | Protected = 2, | |
132 | } | |
133 | ||
ba9703b0 XL |
134 | /// LLVMUnnamedAddr |
135 | #[repr(C)] | |
136 | pub enum UnnamedAddr { | |
137 | No, | |
138 | Local, | |
139 | Global, | |
140 | } | |
141 | ||
b7449926 XL |
142 | /// LLVMDLLStorageClass |
143 | #[derive(Copy, Clone)] | |
144 | #[repr(C)] | |
145 | pub enum DLLStorageClass { | |
146 | #[allow(dead_code)] | |
147 | Default = 0, | |
148 | DllImport = 1, // Function to be imported from DLL. | |
149 | #[allow(dead_code)] | |
150 | DllExport = 2, // Function to be accessible from DLL. | |
151 | } | |
152 | ||
1b1a35ee | 153 | /// Matches LLVMRustAttribute in LLVMWrapper.h |
b7449926 XL |
154 | /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind, |
155 | /// though it is not ABI compatible (since it's a C++ enum) | |
156 | #[repr(C)] | |
157 | #[derive(Copy, Clone, Debug)] | |
5e7ed085 | 158 | pub enum AttributeKind { |
dfeec247 XL |
159 | AlwaysInline = 0, |
160 | ByVal = 1, | |
161 | Cold = 2, | |
162 | InlineHint = 3, | |
163 | MinSize = 4, | |
164 | Naked = 5, | |
165 | NoAlias = 6, | |
166 | NoCapture = 7, | |
167 | NoInline = 8, | |
168 | NonNull = 9, | |
169 | NoRedZone = 10, | |
170 | NoReturn = 11, | |
171 | NoUnwind = 12, | |
b7449926 | 172 | OptimizeForSize = 13, |
dfeec247 XL |
173 | ReadOnly = 14, |
174 | SExt = 15, | |
175 | StructRet = 16, | |
176 | UWTable = 17, | |
177 | ZExt = 18, | |
178 | InReg = 19, | |
179 | SanitizeThread = 20, | |
b7449926 | 180 | SanitizeAddress = 21, |
dfeec247 XL |
181 | SanitizeMemory = 22, |
182 | NonLazyBind = 23, | |
183 | OptimizeNone = 24, | |
184 | ReturnsTwice = 25, | |
f9f354fc | 185 | ReadNone = 26, |
6a06907d XL |
186 | SanitizeHWAddress = 28, |
187 | WillReturn = 29, | |
3c0e092e XL |
188 | StackProtectReq = 30, |
189 | StackProtectStrong = 31, | |
190 | StackProtect = 32, | |
5099ac24 FG |
191 | NoUndef = 33, |
192 | SanitizeMemTag = 34, | |
064997fb FG |
193 | NoCfCheck = 35, |
194 | ShadowCallStack = 36, | |
195 | AllocSize = 37, | |
196 | AllocatedPointer = 38, | |
197 | AllocAlign = 39, | |
b7449926 XL |
198 | } |
199 | ||
200 | /// LLVMIntPredicate | |
201 | #[derive(Copy, Clone)] | |
202 | #[repr(C)] | |
203 | pub enum IntPredicate { | |
204 | IntEQ = 32, | |
205 | IntNE = 33, | |
206 | IntUGT = 34, | |
207 | IntUGE = 35, | |
208 | IntULT = 36, | |
209 | IntULE = 37, | |
210 | IntSGT = 38, | |
211 | IntSGE = 39, | |
212 | IntSLT = 40, | |
213 | IntSLE = 41, | |
214 | } | |
215 | ||
a1dfa0c6 XL |
216 | impl IntPredicate { |
217 | pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self { | |
218 | match intpre { | |
219 | rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ, | |
220 | rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE, | |
221 | rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT, | |
222 | rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE, | |
223 | rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT, | |
224 | rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE, | |
225 | rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT, | |
226 | rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE, | |
227 | rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT, | |
228 | rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE, | |
229 | } | |
230 | } | |
231 | } | |
232 | ||
b7449926 XL |
233 | /// LLVMRealPredicate |
234 | #[derive(Copy, Clone)] | |
235 | #[repr(C)] | |
236 | pub enum RealPredicate { | |
237 | RealPredicateFalse = 0, | |
238 | RealOEQ = 1, | |
239 | RealOGT = 2, | |
240 | RealOGE = 3, | |
241 | RealOLT = 4, | |
242 | RealOLE = 5, | |
243 | RealONE = 6, | |
244 | RealORD = 7, | |
245 | RealUNO = 8, | |
246 | RealUEQ = 9, | |
247 | RealUGT = 10, | |
248 | RealUGE = 11, | |
249 | RealULT = 12, | |
250 | RealULE = 13, | |
251 | RealUNE = 14, | |
252 | RealPredicateTrue = 15, | |
253 | } | |
254 | ||
c295e0f8 XL |
255 | impl RealPredicate { |
256 | pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self { | |
257 | match realp { | |
258 | rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => { | |
259 | RealPredicate::RealPredicateFalse | |
260 | } | |
261 | rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ, | |
262 | rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT, | |
263 | rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE, | |
264 | rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT, | |
265 | rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE, | |
266 | rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE, | |
267 | rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD, | |
268 | rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO, | |
269 | rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ, | |
270 | rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT, | |
271 | rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE, | |
272 | rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT, | |
273 | rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE, | |
274 | rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE, | |
275 | rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => { | |
276 | RealPredicate::RealPredicateTrue | |
277 | } | |
278 | } | |
279 | } | |
280 | } | |
281 | ||
b7449926 XL |
282 | /// LLVMTypeKind |
283 | #[derive(Copy, Clone, PartialEq, Debug)] | |
284 | #[repr(C)] | |
285 | pub enum TypeKind { | |
286 | Void = 0, | |
287 | Half = 1, | |
288 | Float = 2, | |
289 | Double = 3, | |
290 | X86_FP80 = 4, | |
291 | FP128 = 5, | |
292 | PPC_FP128 = 6, | |
293 | Label = 7, | |
294 | Integer = 8, | |
295 | Function = 9, | |
296 | Struct = 10, | |
297 | Array = 11, | |
298 | Pointer = 12, | |
299 | Vector = 13, | |
300 | Metadata = 14, | |
301 | X86_MMX = 15, | |
302 | Token = 16, | |
f035d41b XL |
303 | ScalableVector = 17, |
304 | BFloat = 18, | |
6a06907d | 305 | X86_AMX = 19, |
b7449926 XL |
306 | } |
307 | ||
a1dfa0c6 XL |
308 | impl TypeKind { |
309 | pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind { | |
310 | match self { | |
311 | TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void, | |
312 | TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half, | |
313 | TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float, | |
314 | TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double, | |
315 | TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80, | |
316 | TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128, | |
317 | TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128, | |
318 | TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label, | |
319 | TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer, | |
320 | TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function, | |
321 | TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct, | |
322 | TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array, | |
323 | TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer, | |
324 | TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector, | |
325 | TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata, | |
326 | TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX, | |
327 | TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token, | |
f035d41b XL |
328 | TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector, |
329 | TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat, | |
6a06907d | 330 | TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX, |
a1dfa0c6 XL |
331 | } |
332 | } | |
333 | } | |
334 | ||
b7449926 XL |
335 | /// LLVMAtomicRmwBinOp |
336 | #[derive(Copy, Clone)] | |
337 | #[repr(C)] | |
338 | pub enum AtomicRmwBinOp { | |
339 | AtomicXchg = 0, | |
340 | AtomicAdd = 1, | |
341 | AtomicSub = 2, | |
342 | AtomicAnd = 3, | |
343 | AtomicNand = 4, | |
344 | AtomicOr = 5, | |
345 | AtomicXor = 6, | |
346 | AtomicMax = 7, | |
347 | AtomicMin = 8, | |
348 | AtomicUMax = 9, | |
349 | AtomicUMin = 10, | |
350 | } | |
351 | ||
a1dfa0c6 XL |
352 | impl AtomicRmwBinOp { |
353 | pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self { | |
354 | match op { | |
355 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg, | |
356 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd, | |
357 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub, | |
358 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd, | |
359 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand, | |
360 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr, | |
361 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor, | |
362 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax, | |
363 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin, | |
364 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax, | |
dfeec247 | 365 | rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin, |
a1dfa0c6 XL |
366 | } |
367 | } | |
368 | } | |
369 | ||
b7449926 XL |
370 | /// LLVMAtomicOrdering |
371 | #[derive(Copy, Clone)] | |
372 | #[repr(C)] | |
373 | pub enum AtomicOrdering { | |
374 | #[allow(dead_code)] | |
375 | NotAtomic = 0, | |
376 | Unordered = 1, | |
377 | Monotonic = 2, | |
378 | // Consume = 3, // Not specified yet. | |
379 | Acquire = 4, | |
380 | Release = 5, | |
381 | AcquireRelease = 6, | |
382 | SequentiallyConsistent = 7, | |
383 | } | |
384 | ||
a1dfa0c6 XL |
385 | impl AtomicOrdering { |
386 | pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self { | |
387 | match ao { | |
a1dfa0c6 | 388 | rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered, |
923072b8 | 389 | rustc_codegen_ssa::common::AtomicOrdering::Relaxed => AtomicOrdering::Monotonic, |
a1dfa0c6 XL |
390 | rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire, |
391 | rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release, | |
dfeec247 XL |
392 | rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => { |
393 | AtomicOrdering::AcquireRelease | |
394 | } | |
395 | rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => { | |
a1dfa0c6 | 396 | AtomicOrdering::SequentiallyConsistent |
dfeec247 | 397 | } |
a1dfa0c6 XL |
398 | } |
399 | } | |
400 | } | |
401 | ||
b7449926 XL |
402 | /// LLVMRustFileType |
403 | #[derive(Copy, Clone)] | |
404 | #[repr(C)] | |
405 | pub enum FileType { | |
b7449926 XL |
406 | AssemblyFile, |
407 | ObjectFile, | |
408 | } | |
409 | ||
410 | /// LLVMMetadataType | |
411 | #[derive(Copy, Clone)] | |
412 | #[repr(C)] | |
413 | pub enum MetadataType { | |
414 | MD_dbg = 0, | |
415 | MD_tbaa = 1, | |
416 | MD_prof = 2, | |
417 | MD_fpmath = 3, | |
418 | MD_range = 4, | |
419 | MD_tbaa_struct = 5, | |
420 | MD_invariant_load = 6, | |
421 | MD_alias_scope = 7, | |
422 | MD_noalias = 8, | |
423 | MD_nontemporal = 9, | |
424 | MD_mem_parallel_loop_access = 10, | |
425 | MD_nonnull = 11, | |
5e7ed085 | 426 | MD_align = 17, |
3c0e092e | 427 | MD_type = 19, |
923072b8 | 428 | MD_vcall_visibility = 28, |
5e7ed085 | 429 | MD_noundef = 29, |
b7449926 XL |
430 | } |
431 | ||
432 | /// LLVMRustAsmDialect | |
5099ac24 | 433 | #[derive(Copy, Clone, PartialEq)] |
b7449926 XL |
434 | #[repr(C)] |
435 | pub enum AsmDialect { | |
b7449926 XL |
436 | Att, |
437 | Intel, | |
438 | } | |
439 | ||
440 | /// LLVMRustCodeGenOptLevel | |
441 | #[derive(Copy, Clone, PartialEq)] | |
442 | #[repr(C)] | |
443 | pub enum CodeGenOptLevel { | |
b7449926 XL |
444 | None, |
445 | Less, | |
446 | Default, | |
447 | Aggressive, | |
448 | } | |
449 | ||
74b04a01 XL |
450 | /// LLVMRustPassBuilderOptLevel |
451 | #[repr(C)] | |
452 | pub enum PassBuilderOptLevel { | |
453 | O0, | |
454 | O1, | |
455 | O2, | |
456 | O3, | |
457 | Os, | |
458 | Oz, | |
459 | } | |
460 | ||
461 | /// LLVMRustOptStage | |
462 | #[derive(PartialEq)] | |
463 | #[repr(C)] | |
464 | pub enum OptStage { | |
465 | PreLinkNoLTO, | |
466 | PreLinkThinLTO, | |
467 | PreLinkFatLTO, | |
468 | ThinLTO, | |
469 | FatLTO, | |
470 | } | |
471 | ||
472 | /// LLVMRustSanitizerOptions | |
473 | #[repr(C)] | |
474 | pub struct SanitizerOptions { | |
74b04a01 | 475 | pub sanitize_address: bool, |
f035d41b XL |
476 | pub sanitize_address_recover: bool, |
477 | pub sanitize_memory: bool, | |
478 | pub sanitize_memory_recover: bool, | |
74b04a01 | 479 | pub sanitize_memory_track_origins: c_int, |
f035d41b | 480 | pub sanitize_thread: bool, |
6a06907d XL |
481 | pub sanitize_hwaddress: bool, |
482 | pub sanitize_hwaddress_recover: bool, | |
74b04a01 XL |
483 | } |
484 | ||
b7449926 XL |
485 | /// LLVMRelocMode |
486 | #[derive(Copy, Clone, PartialEq)] | |
487 | #[repr(C)] | |
f9f354fc | 488 | pub enum RelocModel { |
b7449926 XL |
489 | Static, |
490 | PIC, | |
491 | DynamicNoPic, | |
492 | ROPI, | |
493 | RWPI, | |
494 | ROPI_RWPI, | |
495 | } | |
496 | ||
497 | /// LLVMRustCodeModel | |
498 | #[derive(Copy, Clone)] | |
499 | #[repr(C)] | |
500 | pub enum CodeModel { | |
f9f354fc | 501 | Tiny, |
b7449926 XL |
502 | Small, |
503 | Kernel, | |
504 | Medium, | |
505 | Large, | |
506 | None, | |
507 | } | |
508 | ||
509 | /// LLVMRustDiagnosticKind | |
510 | #[derive(Copy, Clone)] | |
511 | #[repr(C)] | |
512 | #[allow(dead_code)] // Variants constructed by C++. | |
513 | pub enum DiagnosticKind { | |
514 | Other, | |
515 | InlineAsm, | |
516 | StackSize, | |
517 | DebugMetadataVersion, | |
518 | SampleProfile, | |
519 | OptimizationRemark, | |
520 | OptimizationRemarkMissed, | |
521 | OptimizationRemarkAnalysis, | |
522 | OptimizationRemarkAnalysisFPCommute, | |
523 | OptimizationRemarkAnalysisAliasing, | |
524 | OptimizationRemarkOther, | |
525 | OptimizationFailure, | |
526 | PGOProfile, | |
527 | Linker, | |
1b1a35ee | 528 | Unsupported, |
94222f64 | 529 | SrcMgr, |
b7449926 XL |
530 | } |
531 | ||
f035d41b XL |
532 | /// LLVMRustDiagnosticLevel |
533 | #[derive(Copy, Clone)] | |
534 | #[repr(C)] | |
535 | #[allow(dead_code)] // Variants constructed by C++. | |
536 | pub enum DiagnosticLevel { | |
537 | Error, | |
538 | Warning, | |
539 | Note, | |
540 | Remark, | |
541 | } | |
542 | ||
b7449926 XL |
543 | /// LLVMRustArchiveKind |
544 | #[derive(Copy, Clone)] | |
545 | #[repr(C)] | |
546 | pub enum ArchiveKind { | |
b7449926 XL |
547 | K_GNU, |
548 | K_BSD, | |
74b04a01 | 549 | K_DARWIN, |
b7449926 XL |
550 | K_COFF, |
551 | } | |
552 | ||
5e7ed085 | 553 | // LLVMRustThinLTOData |
dfeec247 XL |
554 | extern "C" { |
555 | pub type ThinLTOData; | |
556 | } | |
b7449926 | 557 | |
5e7ed085 | 558 | // LLVMRustThinLTOBuffer |
dfeec247 XL |
559 | extern "C" { |
560 | pub type ThinLTOBuffer; | |
561 | } | |
b7449926 | 562 | |
b7449926 XL |
563 | /// LLVMRustThinLTOModule |
564 | #[repr(C)] | |
565 | pub struct ThinLTOModule { | |
566 | pub identifier: *const c_char, | |
567 | pub data: *const u8, | |
568 | pub len: usize, | |
569 | } | |
570 | ||
571 | /// LLVMThreadLocalMode | |
572 | #[derive(Copy, Clone)] | |
573 | #[repr(C)] | |
574 | pub enum ThreadLocalMode { | |
dfeec247 XL |
575 | NotThreadLocal, |
576 | GeneralDynamic, | |
577 | LocalDynamic, | |
578 | InitialExec, | |
579 | LocalExec, | |
b7449926 XL |
580 | } |
581 | ||
ba9703b0 XL |
582 | /// LLVMRustChecksumKind |
583 | #[derive(Copy, Clone)] | |
584 | #[repr(C)] | |
585 | pub enum ChecksumKind { | |
586 | None, | |
587 | MD5, | |
588 | SHA1, | |
29967ef6 | 589 | SHA256, |
ba9703b0 XL |
590 | } |
591 | ||
487cf647 FG |
592 | /// LLVMRustMemoryEffects |
593 | #[derive(Copy, Clone)] | |
594 | #[repr(C)] | |
595 | pub enum MemoryEffects { | |
596 | None, | |
597 | ReadOnly, | |
598 | InaccessibleMemOnly, | |
599 | } | |
600 | ||
dfeec247 XL |
601 | extern "C" { |
602 | type Opaque; | |
603 | } | |
b7449926 XL |
604 | #[repr(C)] |
605 | struct InvariantOpaque<'a> { | |
606 | _marker: PhantomData<&'a mut &'a ()>, | |
607 | _opaque: Opaque, | |
608 | } | |
609 | ||
610 | // Opaque pointer types | |
dfeec247 XL |
611 | extern "C" { |
612 | pub type Module; | |
613 | } | |
614 | extern "C" { | |
615 | pub type Context; | |
616 | } | |
617 | extern "C" { | |
618 | pub type Type; | |
619 | } | |
620 | extern "C" { | |
621 | pub type Value; | |
622 | } | |
623 | extern "C" { | |
624 | pub type ConstantInt; | |
625 | } | |
5e7ed085 FG |
626 | extern "C" { |
627 | pub type Attribute; | |
628 | } | |
dfeec247 XL |
629 | extern "C" { |
630 | pub type Metadata; | |
631 | } | |
632 | extern "C" { | |
633 | pub type BasicBlock; | |
634 | } | |
b7449926 XL |
635 | #[repr(C)] |
636 | pub struct Builder<'a>(InvariantOpaque<'a>); | |
b7449926 XL |
637 | #[repr(C)] |
638 | pub struct PassManager<'a>(InvariantOpaque<'a>); | |
dfeec247 XL |
639 | extern "C" { |
640 | pub type PassManagerBuilder; | |
641 | } | |
dfeec247 XL |
642 | extern "C" { |
643 | pub type Pass; | |
644 | } | |
645 | extern "C" { | |
646 | pub type TargetMachine; | |
647 | } | |
648 | extern "C" { | |
649 | pub type Archive; | |
650 | } | |
b7449926 XL |
651 | #[repr(C)] |
652 | pub struct ArchiveIterator<'a>(InvariantOpaque<'a>); | |
653 | #[repr(C)] | |
654 | pub struct ArchiveChild<'a>(InvariantOpaque<'a>); | |
dfeec247 XL |
655 | extern "C" { |
656 | pub type Twine; | |
657 | } | |
658 | extern "C" { | |
659 | pub type DiagnosticInfo; | |
660 | } | |
661 | extern "C" { | |
662 | pub type SMDiagnostic; | |
663 | } | |
b7449926 XL |
664 | #[repr(C)] |
665 | pub struct RustArchiveMember<'a>(InvariantOpaque<'a>); | |
666 | #[repr(C)] | |
667 | pub struct OperandBundleDef<'a>(InvariantOpaque<'a>); | |
668 | #[repr(C)] | |
669 | pub struct Linker<'a>(InvariantOpaque<'a>); | |
670 | ||
a2a8927a XL |
671 | extern "C" { |
672 | pub type DiagnosticHandler; | |
673 | } | |
674 | ||
675 | pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void); | |
676 | pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint); | |
b7449926 | 677 | |
3dfed10e XL |
678 | pub mod coverageinfo { |
679 | use super::coverage_map; | |
680 | ||
a2a8927a | 681 | /// Aligns with [llvm::coverage::CounterMappingRegion::RegionKind](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L209-L230) |
3dfed10e XL |
682 | #[derive(Copy, Clone, Debug)] |
683 | #[repr(C)] | |
684 | pub enum RegionKind { | |
685 | /// A CodeRegion associates some code with a counter | |
686 | CodeRegion = 0, | |
687 | ||
688 | /// An ExpansionRegion represents a file expansion region that associates | |
689 | /// a source range with the expansion of a virtual source file, such as | |
690 | /// for a macro instantiation or #include file. | |
691 | ExpansionRegion = 1, | |
692 | ||
693 | /// A SkippedRegion represents a source range with code that was skipped | |
694 | /// by a preprocessor or similar means. | |
695 | SkippedRegion = 2, | |
696 | ||
697 | /// A GapRegion is like a CodeRegion, but its count is only set as the | |
698 | /// line execution count when its the only region in the line. | |
699 | GapRegion = 3, | |
a2a8927a XL |
700 | |
701 | /// A BranchRegion represents leaf-level boolean expressions and is | |
702 | /// associated with two counters, each representing the number of times the | |
703 | /// expression evaluates to true or false. | |
704 | BranchRegion = 4, | |
3dfed10e XL |
705 | } |
706 | ||
707 | /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the | |
708 | /// coverage map, in accordance with the | |
a2a8927a | 709 | /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format). |
3dfed10e XL |
710 | /// The struct composes fields representing the `Counter` type and value(s) (injected counter |
711 | /// ID, or expression type and operands), the source file (an indirect index into a "filenames | |
712 | /// array", encoded separately), and source location (start and end positions of the represented | |
713 | /// code region). | |
714 | /// | |
6a06907d | 715 | /// Matches LLVMRustCounterMappingRegion. |
3dfed10e XL |
716 | #[derive(Copy, Clone, Debug)] |
717 | #[repr(C)] | |
718 | pub struct CounterMappingRegion { | |
719 | /// The counter type and type-dependent counter data, if any. | |
720 | counter: coverage_map::Counter, | |
721 | ||
a2a8927a XL |
722 | /// If the `RegionKind` is a `BranchRegion`, this represents the counter |
723 | /// for the false branch of the region. | |
724 | false_counter: coverage_map::Counter, | |
725 | ||
3dfed10e XL |
726 | /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the |
727 | /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes | |
728 | /// that, in turn, are used to look up the filename for this region. | |
729 | file_id: u32, | |
730 | ||
731 | /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find | |
732 | /// the mapping regions created as a result of macro expansion, by checking if their file id | |
733 | /// matches the expanded file id. | |
734 | expanded_file_id: u32, | |
735 | ||
736 | /// 1-based starting line of the mapping region. | |
737 | start_line: u32, | |
738 | ||
739 | /// 1-based starting column of the mapping region. | |
740 | start_col: u32, | |
741 | ||
742 | /// 1-based ending line of the mapping region. | |
743 | end_line: u32, | |
744 | ||
745 | /// 1-based ending column of the mapping region. If the high bit is set, the current | |
746 | /// mapping region is a gap area. | |
747 | end_col: u32, | |
748 | ||
749 | kind: RegionKind, | |
750 | } | |
751 | ||
752 | impl CounterMappingRegion { | |
923072b8 | 753 | pub(crate) fn code_region( |
3dfed10e XL |
754 | counter: coverage_map::Counter, |
755 | file_id: u32, | |
756 | start_line: u32, | |
757 | start_col: u32, | |
758 | end_line: u32, | |
759 | end_col: u32, | |
760 | ) -> Self { | |
761 | Self { | |
762 | counter, | |
a2a8927a | 763 | false_counter: coverage_map::Counter::zero(), |
3dfed10e XL |
764 | file_id, |
765 | expanded_file_id: 0, | |
766 | start_line, | |
767 | start_col, | |
768 | end_line, | |
769 | end_col, | |
770 | kind: RegionKind::CodeRegion, | |
771 | } | |
772 | } | |
773 | ||
a2a8927a XL |
774 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
775 | // support. | |
776 | #[allow(dead_code)] | |
923072b8 | 777 | pub(crate) fn branch_region( |
a2a8927a XL |
778 | counter: coverage_map::Counter, |
779 | false_counter: coverage_map::Counter, | |
780 | file_id: u32, | |
781 | start_line: u32, | |
782 | start_col: u32, | |
783 | end_line: u32, | |
784 | end_col: u32, | |
785 | ) -> Self { | |
786 | Self { | |
787 | counter, | |
788 | false_counter, | |
789 | file_id, | |
790 | expanded_file_id: 0, | |
791 | start_line, | |
792 | start_col, | |
793 | end_line, | |
794 | end_col, | |
795 | kind: RegionKind::BranchRegion, | |
796 | } | |
797 | } | |
798 | ||
cdc7bbd5 XL |
799 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
800 | // support. | |
801 | #[allow(dead_code)] | |
923072b8 | 802 | pub(crate) fn expansion_region( |
3dfed10e XL |
803 | file_id: u32, |
804 | expanded_file_id: u32, | |
805 | start_line: u32, | |
806 | start_col: u32, | |
807 | end_line: u32, | |
808 | end_col: u32, | |
809 | ) -> Self { | |
810 | Self { | |
811 | counter: coverage_map::Counter::zero(), | |
a2a8927a | 812 | false_counter: coverage_map::Counter::zero(), |
3dfed10e XL |
813 | file_id, |
814 | expanded_file_id, | |
815 | start_line, | |
816 | start_col, | |
817 | end_line, | |
818 | end_col, | |
819 | kind: RegionKind::ExpansionRegion, | |
820 | } | |
821 | } | |
822 | ||
cdc7bbd5 XL |
823 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
824 | // support. | |
825 | #[allow(dead_code)] | |
923072b8 | 826 | pub(crate) fn skipped_region( |
3dfed10e XL |
827 | file_id: u32, |
828 | start_line: u32, | |
829 | start_col: u32, | |
830 | end_line: u32, | |
831 | end_col: u32, | |
832 | ) -> Self { | |
833 | Self { | |
834 | counter: coverage_map::Counter::zero(), | |
a2a8927a | 835 | false_counter: coverage_map::Counter::zero(), |
3dfed10e XL |
836 | file_id, |
837 | expanded_file_id: 0, | |
838 | start_line, | |
839 | start_col, | |
840 | end_line, | |
841 | end_col, | |
842 | kind: RegionKind::SkippedRegion, | |
843 | } | |
844 | } | |
845 | ||
cdc7bbd5 XL |
846 | // This function might be used in the future; the LLVM API is still evolving, as is coverage |
847 | // support. | |
848 | #[allow(dead_code)] | |
923072b8 | 849 | pub(crate) fn gap_region( |
3dfed10e XL |
850 | counter: coverage_map::Counter, |
851 | file_id: u32, | |
852 | start_line: u32, | |
853 | start_col: u32, | |
854 | end_line: u32, | |
855 | end_col: u32, | |
856 | ) -> Self { | |
857 | Self { | |
858 | counter, | |
a2a8927a | 859 | false_counter: coverage_map::Counter::zero(), |
3dfed10e XL |
860 | file_id, |
861 | expanded_file_id: 0, | |
862 | start_line, | |
863 | start_col, | |
864 | end_line, | |
c295e0f8 | 865 | end_col: (1_u32 << 31) | end_col, |
3dfed10e XL |
866 | kind: RegionKind::GapRegion, |
867 | } | |
868 | } | |
869 | } | |
870 | } | |
871 | ||
b7449926 XL |
872 | pub mod debuginfo { |
873 | use super::{InvariantOpaque, Metadata}; | |
60c5eb7d | 874 | use bitflags::bitflags; |
b7449926 XL |
875 | |
876 | #[repr(C)] | |
877 | pub struct DIBuilder<'a>(InvariantOpaque<'a>); | |
878 | ||
879 | pub type DIDescriptor = Metadata; | |
29967ef6 | 880 | pub type DILocation = Metadata; |
b7449926 XL |
881 | pub type DIScope = DIDescriptor; |
882 | pub type DIFile = DIScope; | |
883 | pub type DILexicalBlock = DIScope; | |
884 | pub type DISubprogram = DIScope; | |
885 | pub type DINameSpace = DIScope; | |
886 | pub type DIType = DIDescriptor; | |
887 | pub type DIBasicType = DIType; | |
888 | pub type DIDerivedType = DIType; | |
889 | pub type DICompositeType = DIDerivedType; | |
890 | pub type DIVariable = DIDescriptor; | |
0bf4aa26 | 891 | pub type DIGlobalVariableExpression = DIDescriptor; |
b7449926 XL |
892 | pub type DIArray = DIDescriptor; |
893 | pub type DISubrange = DIDescriptor; | |
894 | pub type DIEnumerator = DIDescriptor; | |
895 | pub type DITemplateTypeParameter = DIDescriptor; | |
896 | ||
897 | // These values **must** match with LLVMRustDIFlags!! | |
898 | bitflags! { | |
dc9dc135 | 899 | #[repr(transparent)] |
b7449926 | 900 | #[derive(Default)] |
416331ca | 901 | pub struct DIFlags: u32 { |
b7449926 XL |
902 | const FlagZero = 0; |
903 | const FlagPrivate = 1; | |
904 | const FlagProtected = 2; | |
905 | const FlagPublic = 3; | |
906 | const FlagFwdDecl = (1 << 2); | |
907 | const FlagAppleBlock = (1 << 3); | |
908 | const FlagBlockByrefStruct = (1 << 4); | |
909 | const FlagVirtual = (1 << 5); | |
910 | const FlagArtificial = (1 << 6); | |
911 | const FlagExplicit = (1 << 7); | |
912 | const FlagPrototyped = (1 << 8); | |
913 | const FlagObjcClassComplete = (1 << 9); | |
914 | const FlagObjectPointer = (1 << 10); | |
915 | const FlagVector = (1 << 11); | |
916 | const FlagStaticMember = (1 << 12); | |
917 | const FlagLValueReference = (1 << 13); | |
918 | const FlagRValueReference = (1 << 14); | |
919 | const FlagExternalTypeRef = (1 << 15); | |
920 | const FlagIntroducedVirtual = (1 << 18); | |
921 | const FlagBitField = (1 << 19); | |
922 | const FlagNoReturn = (1 << 20); | |
b7449926 XL |
923 | } |
924 | } | |
9fa01778 XL |
925 | |
926 | // These values **must** match with LLVMRustDISPFlags!! | |
927 | bitflags! { | |
dc9dc135 | 928 | #[repr(transparent)] |
9fa01778 | 929 | #[derive(Default)] |
416331ca | 930 | pub struct DISPFlags: u32 { |
9fa01778 XL |
931 | const SPFlagZero = 0; |
932 | const SPFlagVirtual = 1; | |
933 | const SPFlagPureVirtual = 2; | |
934 | const SPFlagLocalToUnit = (1 << 2); | |
935 | const SPFlagDefinition = (1 << 3); | |
936 | const SPFlagOptimized = (1 << 4); | |
532ac7d7 | 937 | const SPFlagMainSubprogram = (1 << 5); |
9fa01778 XL |
938 | } |
939 | } | |
940 | ||
941 | /// LLVMRustDebugEmissionKind | |
942 | #[derive(Copy, Clone)] | |
943 | #[repr(C)] | |
944 | pub enum DebugEmissionKind { | |
945 | NoDebug, | |
946 | FullDebug, | |
947 | LineTablesOnly, | |
948 | } | |
949 | ||
950 | impl DebugEmissionKind { | |
ba9703b0 XL |
951 | pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self { |
952 | use rustc_session::config::DebugInfo; | |
9fa01778 XL |
953 | match kind { |
954 | DebugInfo::None => DebugEmissionKind::NoDebug, | |
955 | DebugInfo::Limited => DebugEmissionKind::LineTablesOnly, | |
956 | DebugInfo::Full => DebugEmissionKind::FullDebug, | |
957 | } | |
958 | } | |
959 | } | |
b7449926 XL |
960 | } |
961 | ||
064997fb FG |
962 | use bitflags::bitflags; |
963 | // These values **must** match with LLVMRustAllocKindFlags | |
964 | bitflags! { | |
965 | #[repr(transparent)] | |
966 | #[derive(Default)] | |
967 | pub struct AllocKindFlags : u64 { | |
968 | const Unknown = 0; | |
969 | const Alloc = 1; | |
970 | const Realloc = 1 << 1; | |
971 | const Free = 1 << 2; | |
972 | const Uninitialized = 1 << 3; | |
973 | const Zeroed = 1 << 4; | |
974 | const Aligned = 1 << 5; | |
975 | } | |
976 | } | |
977 | ||
dfeec247 XL |
978 | extern "C" { |
979 | pub type ModuleBuffer; | |
980 | } | |
b7449926 | 981 | |
74b04a01 XL |
982 | pub type SelfProfileBeforePassCallback = |
983 | unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char); | |
984 | pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void); | |
985 | ||
487cf647 FG |
986 | pub type GetSymbolsCallback = unsafe extern "C" fn(*mut c_void, *const c_char) -> *mut c_void; |
987 | pub type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) -> *mut c_void; | |
988 | ||
b7449926 | 989 | extern "C" { |
0bf4aa26 | 990 | pub fn LLVMRustInstallFatalErrorHandler(); |
5099ac24 | 991 | pub fn LLVMRustDisableSystemDialogsOnCrash(); |
0bf4aa26 | 992 | |
b7449926 XL |
993 | // Create and destroy contexts. |
994 | pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context; | |
995 | pub fn LLVMContextDispose(C: &'static mut Context); | |
996 | pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint; | |
997 | ||
998 | // Create modules. | |
999 | pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module; | |
1000 | pub fn LLVMGetModuleContext(M: &Module) -> &Context; | |
1001 | pub fn LLVMCloneModule(M: &Module) -> &Module; | |
1002 | ||
1003 | /// Data layout. See Module::getDataLayout. | |
ba9703b0 | 1004 | pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char; |
b7449926 XL |
1005 | pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char); |
1006 | ||
1007 | /// See Module::setModuleInlineAsm. | |
ba9703b0 | 1008 | pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t); |
b7449926 XL |
1009 | |
1010 | /// See llvm::LLVMTypeKind::getTypeID. | |
1011 | pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind; | |
1012 | ||
1013 | // Operations on integer types | |
1014 | pub fn LLVMInt1TypeInContext(C: &Context) -> &Type; | |
1015 | pub fn LLVMInt8TypeInContext(C: &Context) -> &Type; | |
1016 | pub fn LLVMInt16TypeInContext(C: &Context) -> &Type; | |
1017 | pub fn LLVMInt32TypeInContext(C: &Context) -> &Type; | |
1018 | pub fn LLVMInt64TypeInContext(C: &Context) -> &Type; | |
1019 | pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type; | |
1020 | ||
1021 | pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint; | |
1022 | ||
1023 | // Operations on real types | |
1024 | pub fn LLVMFloatTypeInContext(C: &Context) -> &Type; | |
1025 | pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type; | |
1026 | ||
1027 | // Operations on function types | |
a2a8927a | 1028 | pub fn LLVMFunctionType<'a>( |
dfeec247 XL |
1029 | ReturnType: &'a Type, |
1030 | ParamTypes: *const &'a Type, | |
1031 | ParamCount: c_uint, | |
1032 | IsVarArg: Bool, | |
1033 | ) -> &'a Type; | |
b7449926 | 1034 | pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint; |
a2a8927a | 1035 | pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type); |
b7449926 XL |
1036 | |
1037 | // Operations on struct types | |
a2a8927a | 1038 | pub fn LLVMStructTypeInContext<'a>( |
dfeec247 XL |
1039 | C: &'a Context, |
1040 | ElementTypes: *const &'a Type, | |
1041 | ElementCount: c_uint, | |
1042 | Packed: Bool, | |
1043 | ) -> &'a Type; | |
b7449926 XL |
1044 | |
1045 | // Operations on array, pointer, and vector types (sequence types) | |
1046 | pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type; | |
1047 | pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type; | |
1048 | pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type; | |
1049 | ||
1050 | pub fn LLVMGetElementType(Ty: &Type) -> &Type; | |
1051 | pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint; | |
1052 | ||
1053 | // Operations on other types | |
1054 | pub fn LLVMVoidTypeInContext(C: &Context) -> &Type; | |
b7449926 XL |
1055 | pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type; |
1056 | ||
1057 | // Operations on all values | |
1058 | pub fn LLVMTypeOf(Val: &Value) -> &Type; | |
60c5eb7d XL |
1059 | pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char; |
1060 | pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t); | |
a2a8927a XL |
1061 | pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value); |
1062 | pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value); | |
1063 | pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata); | |
923072b8 | 1064 | pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata); |
a2a8927a | 1065 | pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata; |
b7449926 XL |
1066 | |
1067 | // Operations on constants of any type | |
1068 | pub fn LLVMConstNull(Ty: &Type) -> &Value; | |
1069 | pub fn LLVMGetUndef(Ty: &Type) -> &Value; | |
1070 | ||
1071 | // Operations on metadata | |
1072 | pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value; | |
a2a8927a XL |
1073 | pub fn LLVMMDNodeInContext<'a>( |
1074 | C: &'a Context, | |
1075 | Vals: *const &'a Value, | |
1076 | Count: c_uint, | |
1077 | ) -> &'a Value; | |
923072b8 FG |
1078 | pub fn LLVMMDNodeInContext2<'a>( |
1079 | C: &'a Context, | |
1080 | Vals: *const &'a Metadata, | |
1081 | Count: size_t, | |
1082 | ) -> &'a Metadata; | |
a2a8927a | 1083 | pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value); |
b7449926 XL |
1084 | |
1085 | // Operations on scalar constants | |
1086 | pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value; | |
1087 | pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value; | |
416331ca | 1088 | pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value; |
f2b60f7d | 1089 | pub fn LLVMRustConstIntGetZExtValue(ConstantVal: &ConstantInt, Value: &mut u64) -> bool; |
dfeec247 XL |
1090 | pub fn LLVMRustConstInt128Get( |
1091 | ConstantVal: &ConstantInt, | |
1092 | SExt: bool, | |
1093 | high: &mut u64, | |
1094 | low: &mut u64, | |
1095 | ) -> bool; | |
b7449926 XL |
1096 | |
1097 | // Operations on composite constants | |
dfeec247 XL |
1098 | pub fn LLVMConstStringInContext( |
1099 | C: &Context, | |
1100 | Str: *const c_char, | |
1101 | Length: c_uint, | |
1102 | DontNullTerminate: Bool, | |
1103 | ) -> &Value; | |
a2a8927a | 1104 | pub fn LLVMConstStructInContext<'a>( |
dfeec247 XL |
1105 | C: &'a Context, |
1106 | ConstantVals: *const &'a Value, | |
1107 | Count: c_uint, | |
1108 | Packed: Bool, | |
1109 | ) -> &'a Value; | |
1110 | ||
a2a8927a | 1111 | pub fn LLVMConstArray<'a>( |
dfeec247 XL |
1112 | ElementTy: &'a Type, |
1113 | ConstantVals: *const &'a Value, | |
1114 | Length: c_uint, | |
1115 | ) -> &'a Value; | |
b7449926 XL |
1116 | pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value; |
1117 | ||
1118 | // Constant expressions | |
a2a8927a | 1119 | pub fn LLVMRustConstInBoundsGEP2<'a>( |
94222f64 | 1120 | ty: &'a Type, |
b7449926 XL |
1121 | ConstantVal: &'a Value, |
1122 | ConstantIndices: *const &'a Value, | |
1123 | NumIndices: c_uint, | |
1124 | ) -> &'a Value; | |
a2a8927a XL |
1125 | pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; |
1126 | pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; | |
1127 | pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; | |
1128 | pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; | |
1129 | pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; | |
064997fb | 1130 | pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>; |
b7449926 XL |
1131 | |
1132 | // Operations on global variables, functions, and aliases (globals) | |
1133 | pub fn LLVMIsDeclaration(Global: &Value) -> Bool; | |
1134 | pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage; | |
1135 | pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage); | |
1136 | pub fn LLVMSetSection(Global: &Value, Section: *const c_char); | |
1137 | pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility; | |
1138 | pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility); | |
cdc7bbd5 | 1139 | pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool); |
b7449926 XL |
1140 | pub fn LLVMGetAlignment(Global: &Value) -> c_uint; |
1141 | pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint); | |
1142 | pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass); | |
1143 | ||
b7449926 XL |
1144 | // Operations on global variables |
1145 | pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>; | |
a2a8927a | 1146 | pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value; |
b7449926 | 1147 | pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>; |
a2a8927a | 1148 | pub fn LLVMRustGetOrInsertGlobal<'a>( |
dfeec247 XL |
1149 | M: &'a Module, |
1150 | Name: *const c_char, | |
1151 | NameLen: size_t, | |
1152 | T: &'a Type, | |
1153 | ) -> &'a Value; | |
a2a8927a | 1154 | pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value; |
b7449926 XL |
1155 | pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>; |
1156 | pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>; | |
1157 | pub fn LLVMDeleteGlobal(GlobalVar: &Value); | |
1158 | pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>; | |
a2a8927a | 1159 | pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value); |
17df50a5 | 1160 | pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool; |
b7449926 XL |
1161 | pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode); |
1162 | pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool; | |
1163 | pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool); | |
ba9703b0 XL |
1164 | pub fn LLVMRustGetNamedValue( |
1165 | M: &Module, | |
1166 | Name: *const c_char, | |
1167 | NameLen: size_t, | |
1168 | ) -> Option<&Value>; | |
b7449926 XL |
1169 | pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool); |
1170 | ||
5e7ed085 FG |
1171 | // Operations on attributes |
1172 | pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute; | |
1173 | pub fn LLVMCreateStringAttribute( | |
1174 | C: &Context, | |
1175 | Name: *const c_char, | |
1176 | NameLen: c_uint, | |
1177 | Value: *const c_char, | |
1178 | ValueLen: c_uint, | |
1179 | ) -> &Attribute; | |
1180 | pub fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute; | |
1181 | pub fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute; | |
1182 | pub fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute; | |
1183 | pub fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute; | |
1184 | pub fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute; | |
064997fb | 1185 | pub fn LLVMRustCreateElementTypeAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute; |
5e7ed085 | 1186 | pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute; |
064997fb FG |
1187 | pub fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute; |
1188 | pub fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute; | |
487cf647 | 1189 | pub fn LLVMRustCreateMemoryEffectsAttr(C: &Context, effects: MemoryEffects) -> &Attribute; |
5e7ed085 | 1190 | |
b7449926 | 1191 | // Operations on functions |
a2a8927a | 1192 | pub fn LLVMRustGetOrInsertFunction<'a>( |
dfeec247 XL |
1193 | M: &'a Module, |
1194 | Name: *const c_char, | |
ba9703b0 | 1195 | NameLen: size_t, |
dfeec247 XL |
1196 | FunctionTy: &'a Type, |
1197 | ) -> &'a Value; | |
b7449926 | 1198 | pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint); |
5e7ed085 FG |
1199 | pub fn LLVMRustAddFunctionAttributes<'a>( |
1200 | Fn: &'a Value, | |
dfeec247 | 1201 | index: c_uint, |
5e7ed085 FG |
1202 | Attrs: *const &'a Attribute, |
1203 | AttrsLen: size_t, | |
dfeec247 | 1204 | ); |
b7449926 XL |
1205 | |
1206 | // Operations on parameters | |
e1599b0c | 1207 | pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>; |
b7449926 XL |
1208 | pub fn LLVMCountParams(Fn: &Value) -> c_uint; |
1209 | pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value; | |
1210 | ||
1211 | // Operations on basic blocks | |
1212 | pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value; | |
a2a8927a | 1213 | pub fn LLVMAppendBasicBlockInContext<'a>( |
dfeec247 XL |
1214 | C: &'a Context, |
1215 | Fn: &'a Value, | |
1216 | Name: *const c_char, | |
1217 | ) -> &'a BasicBlock; | |
b7449926 XL |
1218 | |
1219 | // Operations on instructions | |
e1599b0c | 1220 | pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>; |
b7449926 XL |
1221 | pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock; |
1222 | ||
1223 | // Operations on call sites | |
1224 | pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint); | |
5e7ed085 FG |
1225 | pub fn LLVMRustAddCallSiteAttributes<'a>( |
1226 | Instr: &'a Value, | |
1227 | index: c_uint, | |
1228 | Attrs: *const &'a Attribute, | |
1229 | AttrsLen: size_t, | |
1230 | ); | |
b7449926 XL |
1231 | |
1232 | // Operations on load/store instructions (only) | |
1233 | pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool); | |
1234 | ||
1235 | // Operations on phi nodes | |
a2a8927a | 1236 | pub fn LLVMAddIncoming<'a>( |
dfeec247 XL |
1237 | PhiNode: &'a Value, |
1238 | IncomingValues: *const &'a Value, | |
1239 | IncomingBlocks: *const &'a BasicBlock, | |
1240 | Count: c_uint, | |
1241 | ); | |
b7449926 XL |
1242 | |
1243 | // Instruction builders | |
a2a8927a XL |
1244 | pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>; |
1245 | pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock); | |
1246 | pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock; | |
1247 | pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>); | |
b7449926 XL |
1248 | |
1249 | // Metadata | |
a2a8927a | 1250 | pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value); |
b7449926 XL |
1251 | |
1252 | // Terminators | |
a2a8927a XL |
1253 | pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value; |
1254 | pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value; | |
1255 | pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value; | |
1256 | pub fn LLVMBuildCondBr<'a>( | |
dfeec247 XL |
1257 | B: &Builder<'a>, |
1258 | If: &'a Value, | |
1259 | Then: &'a BasicBlock, | |
1260 | Else: &'a BasicBlock, | |
1261 | ) -> &'a Value; | |
a2a8927a | 1262 | pub fn LLVMBuildSwitch<'a>( |
dfeec247 XL |
1263 | B: &Builder<'a>, |
1264 | V: &'a Value, | |
1265 | Else: &'a BasicBlock, | |
1266 | NumCases: c_uint, | |
1267 | ) -> &'a Value; | |
a2a8927a | 1268 | pub fn LLVMRustBuildInvoke<'a>( |
dfeec247 | 1269 | B: &Builder<'a>, |
94222f64 | 1270 | Ty: &'a Type, |
dfeec247 XL |
1271 | Fn: &'a Value, |
1272 | Args: *const &'a Value, | |
1273 | NumArgs: c_uint, | |
1274 | Then: &'a BasicBlock, | |
1275 | Catch: &'a BasicBlock, | |
1276 | Bundle: Option<&OperandBundleDef<'a>>, | |
1277 | Name: *const c_char, | |
1278 | ) -> &'a Value; | |
a2a8927a | 1279 | pub fn LLVMBuildLandingPad<'a>( |
dfeec247 XL |
1280 | B: &Builder<'a>, |
1281 | Ty: &'a Type, | |
136023e0 | 1282 | PersFn: Option<&'a Value>, |
dfeec247 XL |
1283 | NumClauses: c_uint, |
1284 | Name: *const c_char, | |
1285 | ) -> &'a Value; | |
a2a8927a XL |
1286 | pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value; |
1287 | pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value; | |
b7449926 | 1288 | |
a2a8927a | 1289 | pub fn LLVMRustBuildCleanupPad<'a>( |
dfeec247 XL |
1290 | B: &Builder<'a>, |
1291 | ParentPad: Option<&'a Value>, | |
1292 | ArgCnt: c_uint, | |
1293 | Args: *const &'a Value, | |
1294 | Name: *const c_char, | |
1295 | ) -> Option<&'a Value>; | |
a2a8927a | 1296 | pub fn LLVMRustBuildCleanupRet<'a>( |
dfeec247 XL |
1297 | B: &Builder<'a>, |
1298 | CleanupPad: &'a Value, | |
1299 | UnwindBB: Option<&'a BasicBlock>, | |
1300 | ) -> Option<&'a Value>; | |
a2a8927a | 1301 | pub fn LLVMRustBuildCatchPad<'a>( |
dfeec247 XL |
1302 | B: &Builder<'a>, |
1303 | ParentPad: &'a Value, | |
1304 | ArgCnt: c_uint, | |
1305 | Args: *const &'a Value, | |
1306 | Name: *const c_char, | |
1307 | ) -> Option<&'a Value>; | |
a2a8927a | 1308 | pub fn LLVMRustBuildCatchRet<'a>( |
b7449926 XL |
1309 | B: &Builder<'a>, |
1310 | Pad: &'a Value, | |
1311 | BB: &'a BasicBlock, | |
1312 | ) -> Option<&'a Value>; | |
a2a8927a | 1313 | pub fn LLVMRustBuildCatchSwitch<'a>( |
dfeec247 XL |
1314 | Builder: &Builder<'a>, |
1315 | ParentPad: Option<&'a Value>, | |
1316 | BB: Option<&'a BasicBlock>, | |
1317 | NumHandlers: c_uint, | |
1318 | Name: *const c_char, | |
1319 | ) -> Option<&'a Value>; | |
a2a8927a XL |
1320 | pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock); |
1321 | pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value); | |
b7449926 XL |
1322 | |
1323 | // Add a case to the switch instruction | |
a2a8927a | 1324 | pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock); |
b7449926 XL |
1325 | |
1326 | // Add a clause to the landing pad instruction | |
a2a8927a | 1327 | pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value); |
b7449926 XL |
1328 | |
1329 | // Set the cleanup on a landing pad instruction | |
1330 | pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool); | |
1331 | ||
1332 | // Arithmetic | |
a2a8927a | 1333 | pub fn LLVMBuildAdd<'a>( |
dfeec247 XL |
1334 | B: &Builder<'a>, |
1335 | LHS: &'a Value, | |
1336 | RHS: &'a Value, | |
1337 | Name: *const c_char, | |
1338 | ) -> &'a Value; | |
a2a8927a | 1339 | pub fn LLVMBuildFAdd<'a>( |
dfeec247 XL |
1340 | B: &Builder<'a>, |
1341 | LHS: &'a Value, | |
1342 | RHS: &'a Value, | |
1343 | Name: *const c_char, | |
1344 | ) -> &'a Value; | |
a2a8927a | 1345 | pub fn LLVMBuildSub<'a>( |
dfeec247 XL |
1346 | B: &Builder<'a>, |
1347 | LHS: &'a Value, | |
1348 | RHS: &'a Value, | |
1349 | Name: *const c_char, | |
1350 | ) -> &'a Value; | |
a2a8927a | 1351 | pub fn LLVMBuildFSub<'a>( |
dfeec247 XL |
1352 | B: &Builder<'a>, |
1353 | LHS: &'a Value, | |
1354 | RHS: &'a Value, | |
1355 | Name: *const c_char, | |
1356 | ) -> &'a Value; | |
a2a8927a | 1357 | pub fn LLVMBuildMul<'a>( |
dfeec247 XL |
1358 | B: &Builder<'a>, |
1359 | LHS: &'a Value, | |
1360 | RHS: &'a Value, | |
1361 | Name: *const c_char, | |
1362 | ) -> &'a Value; | |
a2a8927a | 1363 | pub fn LLVMBuildFMul<'a>( |
dfeec247 XL |
1364 | B: &Builder<'a>, |
1365 | LHS: &'a Value, | |
1366 | RHS: &'a Value, | |
1367 | Name: *const c_char, | |
1368 | ) -> &'a Value; | |
a2a8927a | 1369 | pub fn LLVMBuildUDiv<'a>( |
dfeec247 XL |
1370 | B: &Builder<'a>, |
1371 | LHS: &'a Value, | |
1372 | RHS: &'a Value, | |
1373 | Name: *const c_char, | |
1374 | ) -> &'a Value; | |
a2a8927a | 1375 | pub fn LLVMBuildExactUDiv<'a>( |
dfeec247 XL |
1376 | B: &Builder<'a>, |
1377 | LHS: &'a Value, | |
1378 | RHS: &'a Value, | |
1379 | Name: *const c_char, | |
1380 | ) -> &'a Value; | |
a2a8927a | 1381 | pub fn LLVMBuildSDiv<'a>( |
dfeec247 XL |
1382 | B: &Builder<'a>, |
1383 | LHS: &'a Value, | |
1384 | RHS: &'a Value, | |
1385 | Name: *const c_char, | |
1386 | ) -> &'a Value; | |
a2a8927a | 1387 | pub fn LLVMBuildExactSDiv<'a>( |
dfeec247 XL |
1388 | B: &Builder<'a>, |
1389 | LHS: &'a Value, | |
1390 | RHS: &'a Value, | |
1391 | Name: *const c_char, | |
1392 | ) -> &'a Value; | |
a2a8927a | 1393 | pub fn LLVMBuildFDiv<'a>( |
dfeec247 XL |
1394 | B: &Builder<'a>, |
1395 | LHS: &'a Value, | |
1396 | RHS: &'a Value, | |
1397 | Name: *const c_char, | |
1398 | ) -> &'a Value; | |
a2a8927a | 1399 | pub fn LLVMBuildURem<'a>( |
dfeec247 XL |
1400 | B: &Builder<'a>, |
1401 | LHS: &'a Value, | |
1402 | RHS: &'a Value, | |
1403 | Name: *const c_char, | |
1404 | ) -> &'a Value; | |
a2a8927a | 1405 | pub fn LLVMBuildSRem<'a>( |
dfeec247 XL |
1406 | B: &Builder<'a>, |
1407 | LHS: &'a Value, | |
1408 | RHS: &'a Value, | |
1409 | Name: *const c_char, | |
1410 | ) -> &'a Value; | |
a2a8927a | 1411 | pub fn LLVMBuildFRem<'a>( |
dfeec247 XL |
1412 | B: &Builder<'a>, |
1413 | LHS: &'a Value, | |
1414 | RHS: &'a Value, | |
1415 | Name: *const c_char, | |
1416 | ) -> &'a Value; | |
a2a8927a | 1417 | pub fn LLVMBuildShl<'a>( |
dfeec247 XL |
1418 | B: &Builder<'a>, |
1419 | LHS: &'a Value, | |
1420 | RHS: &'a Value, | |
1421 | Name: *const c_char, | |
1422 | ) -> &'a Value; | |
a2a8927a | 1423 | pub fn LLVMBuildLShr<'a>( |
dfeec247 XL |
1424 | B: &Builder<'a>, |
1425 | LHS: &'a Value, | |
1426 | RHS: &'a Value, | |
1427 | Name: *const c_char, | |
1428 | ) -> &'a Value; | |
a2a8927a | 1429 | pub fn LLVMBuildAShr<'a>( |
dfeec247 XL |
1430 | B: &Builder<'a>, |
1431 | LHS: &'a Value, | |
1432 | RHS: &'a Value, | |
1433 | Name: *const c_char, | |
1434 | ) -> &'a Value; | |
a2a8927a | 1435 | pub fn LLVMBuildNSWAdd<'a>( |
dfeec247 XL |
1436 | B: &Builder<'a>, |
1437 | LHS: &'a Value, | |
1438 | RHS: &'a Value, | |
1439 | Name: *const c_char, | |
1440 | ) -> &'a Value; | |
a2a8927a | 1441 | pub fn LLVMBuildNUWAdd<'a>( |
dfeec247 XL |
1442 | B: &Builder<'a>, |
1443 | LHS: &'a Value, | |
1444 | RHS: &'a Value, | |
1445 | Name: *const c_char, | |
1446 | ) -> &'a Value; | |
a2a8927a | 1447 | pub fn LLVMBuildNSWSub<'a>( |
dfeec247 XL |
1448 | B: &Builder<'a>, |
1449 | LHS: &'a Value, | |
1450 | RHS: &'a Value, | |
1451 | Name: *const c_char, | |
1452 | ) -> &'a Value; | |
a2a8927a | 1453 | pub fn LLVMBuildNUWSub<'a>( |
dfeec247 XL |
1454 | B: &Builder<'a>, |
1455 | LHS: &'a Value, | |
1456 | RHS: &'a Value, | |
1457 | Name: *const c_char, | |
1458 | ) -> &'a Value; | |
a2a8927a | 1459 | pub fn LLVMBuildNSWMul<'a>( |
dfeec247 XL |
1460 | B: &Builder<'a>, |
1461 | LHS: &'a Value, | |
1462 | RHS: &'a Value, | |
1463 | Name: *const c_char, | |
1464 | ) -> &'a Value; | |
a2a8927a | 1465 | pub fn LLVMBuildNUWMul<'a>( |
dfeec247 XL |
1466 | B: &Builder<'a>, |
1467 | LHS: &'a Value, | |
1468 | RHS: &'a Value, | |
1469 | Name: *const c_char, | |
1470 | ) -> &'a Value; | |
a2a8927a | 1471 | pub fn LLVMBuildAnd<'a>( |
dfeec247 XL |
1472 | B: &Builder<'a>, |
1473 | LHS: &'a Value, | |
1474 | RHS: &'a Value, | |
1475 | Name: *const c_char, | |
1476 | ) -> &'a Value; | |
a2a8927a | 1477 | pub fn LLVMBuildOr<'a>( |
dfeec247 XL |
1478 | B: &Builder<'a>, |
1479 | LHS: &'a Value, | |
1480 | RHS: &'a Value, | |
1481 | Name: *const c_char, | |
1482 | ) -> &'a Value; | |
a2a8927a | 1483 | pub fn LLVMBuildXor<'a>( |
dfeec247 XL |
1484 | B: &Builder<'a>, |
1485 | LHS: &'a Value, | |
1486 | RHS: &'a Value, | |
1487 | Name: *const c_char, | |
1488 | ) -> &'a Value; | |
a2a8927a XL |
1489 | pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value; |
1490 | pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value; | |
1491 | pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value; | |
cdc7bbd5 | 1492 | pub fn LLVMRustSetFastMath(Instr: &Value); |
b7449926 XL |
1493 | |
1494 | // Memory | |
a2a8927a XL |
1495 | pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value; |
1496 | pub fn LLVMBuildArrayAlloca<'a>( | |
dfeec247 XL |
1497 | B: &Builder<'a>, |
1498 | Ty: &'a Type, | |
1499 | Val: &'a Value, | |
1500 | Name: *const c_char, | |
1501 | ) -> &'a Value; | |
a2a8927a | 1502 | pub fn LLVMBuildLoad2<'a>( |
136023e0 XL |
1503 | B: &Builder<'a>, |
1504 | Ty: &'a Type, | |
1505 | PointerVal: &'a Value, | |
1506 | Name: *const c_char, | |
1507 | ) -> &'a Value; | |
b7449926 | 1508 | |
a2a8927a | 1509 | pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value; |
b7449926 | 1510 | |
a2a8927a | 1511 | pub fn LLVMBuildGEP2<'a>( |
dfeec247 | 1512 | B: &Builder<'a>, |
94222f64 | 1513 | Ty: &'a Type, |
dfeec247 XL |
1514 | Pointer: &'a Value, |
1515 | Indices: *const &'a Value, | |
1516 | NumIndices: c_uint, | |
1517 | Name: *const c_char, | |
1518 | ) -> &'a Value; | |
a2a8927a | 1519 | pub fn LLVMBuildInBoundsGEP2<'a>( |
dfeec247 | 1520 | B: &Builder<'a>, |
94222f64 | 1521 | Ty: &'a Type, |
dfeec247 XL |
1522 | Pointer: &'a Value, |
1523 | Indices: *const &'a Value, | |
1524 | NumIndices: c_uint, | |
1525 | Name: *const c_char, | |
1526 | ) -> &'a Value; | |
a2a8927a | 1527 | pub fn LLVMBuildStructGEP2<'a>( |
dfeec247 | 1528 | B: &Builder<'a>, |
94222f64 | 1529 | Ty: &'a Type, |
dfeec247 XL |
1530 | Pointer: &'a Value, |
1531 | Idx: c_uint, | |
1532 | Name: *const c_char, | |
1533 | ) -> &'a Value; | |
b7449926 XL |
1534 | |
1535 | // Casts | |
a2a8927a | 1536 | pub fn LLVMBuildTrunc<'a>( |
dfeec247 XL |
1537 | B: &Builder<'a>, |
1538 | Val: &'a Value, | |
1539 | DestTy: &'a Type, | |
1540 | Name: *const c_char, | |
1541 | ) -> &'a Value; | |
a2a8927a | 1542 | pub fn LLVMBuildZExt<'a>( |
dfeec247 XL |
1543 | B: &Builder<'a>, |
1544 | Val: &'a Value, | |
1545 | DestTy: &'a Type, | |
1546 | Name: *const c_char, | |
1547 | ) -> &'a Value; | |
a2a8927a | 1548 | pub fn LLVMBuildSExt<'a>( |
dfeec247 XL |
1549 | B: &Builder<'a>, |
1550 | Val: &'a Value, | |
1551 | DestTy: &'a Type, | |
1552 | Name: *const c_char, | |
1553 | ) -> &'a Value; | |
a2a8927a | 1554 | pub fn LLVMBuildFPToUI<'a>( |
dfeec247 XL |
1555 | B: &Builder<'a>, |
1556 | Val: &'a Value, | |
1557 | DestTy: &'a Type, | |
1558 | Name: *const c_char, | |
1559 | ) -> &'a Value; | |
a2a8927a | 1560 | pub fn LLVMBuildFPToSI<'a>( |
dfeec247 XL |
1561 | B: &Builder<'a>, |
1562 | Val: &'a Value, | |
1563 | DestTy: &'a Type, | |
1564 | Name: *const c_char, | |
1565 | ) -> &'a Value; | |
a2a8927a | 1566 | pub fn LLVMBuildUIToFP<'a>( |
dfeec247 XL |
1567 | B: &Builder<'a>, |
1568 | Val: &'a Value, | |
1569 | DestTy: &'a Type, | |
1570 | Name: *const c_char, | |
1571 | ) -> &'a Value; | |
a2a8927a | 1572 | pub fn LLVMBuildSIToFP<'a>( |
dfeec247 XL |
1573 | B: &Builder<'a>, |
1574 | Val: &'a Value, | |
1575 | DestTy: &'a Type, | |
1576 | Name: *const c_char, | |
1577 | ) -> &'a Value; | |
a2a8927a | 1578 | pub fn LLVMBuildFPTrunc<'a>( |
dfeec247 XL |
1579 | B: &Builder<'a>, |
1580 | Val: &'a Value, | |
1581 | DestTy: &'a Type, | |
1582 | Name: *const c_char, | |
1583 | ) -> &'a Value; | |
a2a8927a | 1584 | pub fn LLVMBuildFPExt<'a>( |
dfeec247 XL |
1585 | B: &Builder<'a>, |
1586 | Val: &'a Value, | |
1587 | DestTy: &'a Type, | |
1588 | Name: *const c_char, | |
1589 | ) -> &'a Value; | |
a2a8927a | 1590 | pub fn LLVMBuildPtrToInt<'a>( |
dfeec247 XL |
1591 | B: &Builder<'a>, |
1592 | Val: &'a Value, | |
1593 | DestTy: &'a Type, | |
1594 | Name: *const c_char, | |
1595 | ) -> &'a Value; | |
a2a8927a | 1596 | pub fn LLVMBuildIntToPtr<'a>( |
dfeec247 XL |
1597 | B: &Builder<'a>, |
1598 | Val: &'a Value, | |
1599 | DestTy: &'a Type, | |
1600 | Name: *const c_char, | |
1601 | ) -> &'a Value; | |
a2a8927a | 1602 | pub fn LLVMBuildBitCast<'a>( |
dfeec247 XL |
1603 | B: &Builder<'a>, |
1604 | Val: &'a Value, | |
1605 | DestTy: &'a Type, | |
1606 | Name: *const c_char, | |
1607 | ) -> &'a Value; | |
a2a8927a | 1608 | pub fn LLVMBuildPointerCast<'a>( |
dfeec247 XL |
1609 | B: &Builder<'a>, |
1610 | Val: &'a Value, | |
1611 | DestTy: &'a Type, | |
1612 | Name: *const c_char, | |
1613 | ) -> &'a Value; | |
a2a8927a | 1614 | pub fn LLVMRustBuildIntCast<'a>( |
dfeec247 XL |
1615 | B: &Builder<'a>, |
1616 | Val: &'a Value, | |
1617 | DestTy: &'a Type, | |
064997fb | 1618 | IsSigned: bool, |
dfeec247 | 1619 | ) -> &'a Value; |
b7449926 XL |
1620 | |
1621 | // Comparisons | |
a2a8927a | 1622 | pub fn LLVMBuildICmp<'a>( |
dfeec247 XL |
1623 | B: &Builder<'a>, |
1624 | Op: c_uint, | |
1625 | LHS: &'a Value, | |
1626 | RHS: &'a Value, | |
1627 | Name: *const c_char, | |
1628 | ) -> &'a Value; | |
a2a8927a | 1629 | pub fn LLVMBuildFCmp<'a>( |
dfeec247 XL |
1630 | B: &Builder<'a>, |
1631 | Op: c_uint, | |
1632 | LHS: &'a Value, | |
1633 | RHS: &'a Value, | |
1634 | Name: *const c_char, | |
1635 | ) -> &'a Value; | |
b7449926 XL |
1636 | |
1637 | // Miscellaneous instructions | |
a2a8927a XL |
1638 | pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value; |
1639 | pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value; | |
1640 | pub fn LLVMRustBuildCall<'a>( | |
b7449926 | 1641 | B: &Builder<'a>, |
94222f64 | 1642 | Ty: &'a Type, |
dfeec247 XL |
1643 | Fn: &'a Value, |
1644 | Args: *const &'a Value, | |
1645 | NumArgs: c_uint, | |
1646 | Bundle: Option<&OperandBundleDef<'a>>, | |
dfeec247 | 1647 | ) -> &'a Value; |
a2a8927a | 1648 | pub fn LLVMRustBuildMemCpy<'a>( |
dfeec247 XL |
1649 | B: &Builder<'a>, |
1650 | Dst: &'a Value, | |
1651 | DstAlign: c_uint, | |
1652 | Src: &'a Value, | |
1653 | SrcAlign: c_uint, | |
1654 | Size: &'a Value, | |
1655 | IsVolatile: bool, | |
1656 | ) -> &'a Value; | |
a2a8927a | 1657 | pub fn LLVMRustBuildMemMove<'a>( |
dfeec247 XL |
1658 | B: &Builder<'a>, |
1659 | Dst: &'a Value, | |
1660 | DstAlign: c_uint, | |
1661 | Src: &'a Value, | |
1662 | SrcAlign: c_uint, | |
1663 | Size: &'a Value, | |
1664 | IsVolatile: bool, | |
1665 | ) -> &'a Value; | |
a2a8927a | 1666 | pub fn LLVMRustBuildMemSet<'a>( |
74b04a01 XL |
1667 | B: &Builder<'a>, |
1668 | Dst: &'a Value, | |
1669 | DstAlign: c_uint, | |
1670 | Val: &'a Value, | |
1671 | Size: &'a Value, | |
1672 | IsVolatile: bool, | |
1673 | ) -> &'a Value; | |
a2a8927a | 1674 | pub fn LLVMBuildSelect<'a>( |
dfeec247 XL |
1675 | B: &Builder<'a>, |
1676 | If: &'a Value, | |
1677 | Then: &'a Value, | |
1678 | Else: &'a Value, | |
1679 | Name: *const c_char, | |
0731742a | 1680 | ) -> &'a Value; |
a2a8927a | 1681 | pub fn LLVMBuildVAArg<'a>( |
dfeec247 XL |
1682 | B: &Builder<'a>, |
1683 | list: &'a Value, | |
1684 | Ty: &'a Type, | |
1685 | Name: *const c_char, | |
1686 | ) -> &'a Value; | |
a2a8927a | 1687 | pub fn LLVMBuildExtractElement<'a>( |
dfeec247 XL |
1688 | B: &Builder<'a>, |
1689 | VecVal: &'a Value, | |
1690 | Index: &'a Value, | |
1691 | Name: *const c_char, | |
1692 | ) -> &'a Value; | |
a2a8927a | 1693 | pub fn LLVMBuildInsertElement<'a>( |
dfeec247 XL |
1694 | B: &Builder<'a>, |
1695 | VecVal: &'a Value, | |
1696 | EltVal: &'a Value, | |
1697 | Index: &'a Value, | |
1698 | Name: *const c_char, | |
1699 | ) -> &'a Value; | |
a2a8927a | 1700 | pub fn LLVMBuildShuffleVector<'a>( |
dfeec247 XL |
1701 | B: &Builder<'a>, |
1702 | V1: &'a Value, | |
1703 | V2: &'a Value, | |
1704 | Mask: &'a Value, | |
1705 | Name: *const c_char, | |
1706 | ) -> &'a Value; | |
a2a8927a | 1707 | pub fn LLVMBuildExtractValue<'a>( |
dfeec247 XL |
1708 | B: &Builder<'a>, |
1709 | AggVal: &'a Value, | |
1710 | Index: c_uint, | |
1711 | Name: *const c_char, | |
1712 | ) -> &'a Value; | |
a2a8927a | 1713 | pub fn LLVMBuildInsertValue<'a>( |
dfeec247 XL |
1714 | B: &Builder<'a>, |
1715 | AggVal: &'a Value, | |
1716 | EltVal: &'a Value, | |
1717 | Index: c_uint, | |
1718 | Name: *const c_char, | |
1719 | ) -> &'a Value; | |
1720 | ||
a2a8927a | 1721 | pub fn LLVMRustBuildVectorReduceFAdd<'a>( |
dfeec247 XL |
1722 | B: &Builder<'a>, |
1723 | Acc: &'a Value, | |
1724 | Src: &'a Value, | |
1725 | ) -> &'a Value; | |
a2a8927a | 1726 | pub fn LLVMRustBuildVectorReduceFMul<'a>( |
dfeec247 XL |
1727 | B: &Builder<'a>, |
1728 | Acc: &'a Value, | |
1729 | Src: &'a Value, | |
1730 | ) -> &'a Value; | |
a2a8927a XL |
1731 | pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; |
1732 | pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; | |
1733 | pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; | |
1734 | pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; | |
1735 | pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value; | |
1736 | pub fn LLVMRustBuildVectorReduceMin<'a>( | |
dfeec247 XL |
1737 | B: &Builder<'a>, |
1738 | Src: &'a Value, | |
1739 | IsSigned: bool, | |
1740 | ) -> &'a Value; | |
a2a8927a | 1741 | pub fn LLVMRustBuildVectorReduceMax<'a>( |
dfeec247 XL |
1742 | B: &Builder<'a>, |
1743 | Src: &'a Value, | |
1744 | IsSigned: bool, | |
1745 | ) -> &'a Value; | |
a2a8927a XL |
1746 | pub fn LLVMRustBuildVectorReduceFMin<'a>( |
1747 | B: &Builder<'a>, | |
1748 | Src: &'a Value, | |
1749 | IsNaN: bool, | |
1750 | ) -> &'a Value; | |
1751 | pub fn LLVMRustBuildVectorReduceFMax<'a>( | |
1752 | B: &Builder<'a>, | |
1753 | Src: &'a Value, | |
1754 | IsNaN: bool, | |
1755 | ) -> &'a Value; | |
dfeec247 | 1756 | |
a2a8927a XL |
1757 | pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value; |
1758 | pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value; | |
dfeec247 XL |
1759 | |
1760 | // Atomic Operations | |
a2a8927a | 1761 | pub fn LLVMRustBuildAtomicLoad<'a>( |
dfeec247 | 1762 | B: &Builder<'a>, |
136023e0 | 1763 | ElementType: &'a Type, |
dfeec247 XL |
1764 | PointerVal: &'a Value, |
1765 | Name: *const c_char, | |
1766 | Order: AtomicOrdering, | |
1767 | ) -> &'a Value; | |
1768 | ||
a2a8927a | 1769 | pub fn LLVMRustBuildAtomicStore<'a>( |
dfeec247 XL |
1770 | B: &Builder<'a>, |
1771 | Val: &'a Value, | |
1772 | Ptr: &'a Value, | |
1773 | Order: AtomicOrdering, | |
1774 | ) -> &'a Value; | |
1775 | ||
2b03887a | 1776 | pub fn LLVMBuildAtomicCmpXchg<'a>( |
b7449926 XL |
1777 | B: &Builder<'a>, |
1778 | LHS: &'a Value, | |
dfeec247 XL |
1779 | CMP: &'a Value, |
1780 | RHS: &'a Value, | |
1781 | Order: AtomicOrdering, | |
1782 | FailureOrder: AtomicOrdering, | |
2b03887a | 1783 | SingleThreaded: Bool, |
dfeec247 XL |
1784 | ) -> &'a Value; |
1785 | ||
2b03887a FG |
1786 | pub fn LLVMSetWeak(CmpXchgInst: &Value, IsWeak: Bool); |
1787 | ||
a2a8927a | 1788 | pub fn LLVMBuildAtomicRMW<'a>( |
dfeec247 XL |
1789 | B: &Builder<'a>, |
1790 | Op: AtomicRmwBinOp, | |
b7449926 | 1791 | LHS: &'a Value, |
dfeec247 XL |
1792 | RHS: &'a Value, |
1793 | Order: AtomicOrdering, | |
1794 | SingleThreaded: Bool, | |
0731742a | 1795 | ) -> &'a Value; |
b7449926 | 1796 | |
2b03887a FG |
1797 | pub fn LLVMBuildFence<'a>( |
1798 | B: &Builder<'a>, | |
dfeec247 | 1799 | Order: AtomicOrdering, |
2b03887a FG |
1800 | SingleThreaded: Bool, |
1801 | Name: *const c_char, | |
1802 | ) -> &'a Value; | |
b7449926 XL |
1803 | |
1804 | /// Writes a module to the specified path. Returns 0 on success. | |
1805 | pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int; | |
1806 | ||
2b03887a | 1807 | /// Creates a legacy pass manager -- only used for final codegen. |
a2a8927a | 1808 | pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>; |
b7449926 | 1809 | |
b7449926 XL |
1810 | pub fn LLVMInitializePasses(); |
1811 | ||
74b04a01 XL |
1812 | pub fn LLVMTimeTraceProfilerInitialize(); |
1813 | ||
3c0e092e XL |
1814 | pub fn LLVMTimeTraceProfilerFinishThread(); |
1815 | ||
74b04a01 XL |
1816 | pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char); |
1817 | ||
a2a8927a | 1818 | pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>); |
60c5eb7d | 1819 | |
5869c6ff XL |
1820 | pub fn LLVMGetHostCPUFeatures() -> *mut c_char; |
1821 | ||
1822 | pub fn LLVMDisposeMessage(message: *mut c_char); | |
1823 | ||
3c0e092e | 1824 | pub fn LLVMIsMultithreaded() -> Bool; |
b7449926 XL |
1825 | |
1826 | /// Returns a string describing the last error caused by an LLVMRust* call. | |
1827 | pub fn LLVMRustGetLastError() -> *const c_char; | |
1828 | ||
1829 | /// Print the pass timings since static dtors aren't picking them up. | |
1830 | pub fn LLVMRustPrintPassTimings(); | |
1831 | ||
1832 | pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type; | |
1833 | ||
a2a8927a | 1834 | pub fn LLVMStructSetBody<'a>( |
dfeec247 XL |
1835 | StructTy: &'a Type, |
1836 | ElementTypes: *const &'a Type, | |
1837 | ElementCount: c_uint, | |
1838 | Packed: Bool, | |
1839 | ); | |
b7449926 XL |
1840 | |
1841 | /// Prepares inline assembly. | |
dfeec247 XL |
1842 | pub fn LLVMRustInlineAsm( |
1843 | Ty: &Type, | |
1844 | AsmString: *const c_char, | |
ba9703b0 | 1845 | AsmStringLen: size_t, |
dfeec247 | 1846 | Constraints: *const c_char, |
ba9703b0 | 1847 | ConstraintsLen: size_t, |
dfeec247 XL |
1848 | SideEffects: Bool, |
1849 | AlignStack: Bool, | |
1850 | Dialect: AsmDialect, | |
a2a8927a | 1851 | CanThrow: Bool, |
dfeec247 | 1852 | ) -> &Value; |
ba9703b0 XL |
1853 | pub fn LLVMRustInlineAsmVerify( |
1854 | Ty: &Type, | |
1855 | Constraints: *const c_char, | |
1856 | ConstraintsLen: size_t, | |
1857 | ) -> bool; | |
b7449926 | 1858 | |
3dfed10e XL |
1859 | #[allow(improper_ctypes)] |
1860 | pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer( | |
1861 | Filenames: *const *const c_char, | |
1862 | FilenamesLen: size_t, | |
1863 | BufferOut: &RustString, | |
1864 | ); | |
1865 | ||
1866 | #[allow(improper_ctypes)] | |
1867 | pub fn LLVMRustCoverageWriteMappingToBuffer( | |
1868 | VirtualFileMappingIDs: *const c_uint, | |
1869 | NumVirtualFileMappingIDs: c_uint, | |
1870 | Expressions: *const coverage_map::CounterExpression, | |
1871 | NumExpressions: c_uint, | |
6a06907d | 1872 | MappingRegions: *const coverageinfo::CounterMappingRegion, |
3dfed10e XL |
1873 | NumMappingRegions: c_uint, |
1874 | BufferOut: &RustString, | |
1875 | ); | |
1876 | ||
a2a8927a | 1877 | pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value; |
fc512014 XL |
1878 | pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64; |
1879 | pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64; | |
3dfed10e XL |
1880 | |
1881 | #[allow(improper_ctypes)] | |
fc512014 XL |
1882 | pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString); |
1883 | ||
1884 | #[allow(improper_ctypes)] | |
1885 | pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString); | |
3dfed10e XL |
1886 | |
1887 | #[allow(improper_ctypes)] | |
1888 | pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString); | |
1889 | ||
1890 | pub fn LLVMRustCoverageMappingVersion() -> u32; | |
b7449926 XL |
1891 | pub fn LLVMRustDebugMetadataVersion() -> u32; |
1892 | pub fn LLVMRustVersionMajor() -> u32; | |
1893 | pub fn LLVMRustVersionMinor() -> u32; | |
5869c6ff | 1894 | pub fn LLVMRustVersionPatch() -> u32; |
b7449926 | 1895 | |
5099ac24 FG |
1896 | /// Add LLVM module flags. |
1897 | /// | |
1898 | /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What | |
1899 | /// "compatible" means depends on the merge behaviors involved. | |
1900 | pub fn LLVMRustAddModuleFlag( | |
1901 | M: &Module, | |
1902 | merge_behavior: LLVMModFlagBehavior, | |
1903 | name: *const c_char, | |
1904 | value: u32, | |
1905 | ); | |
923072b8 | 1906 | pub fn LLVMRustHasModuleFlag(M: &Module, name: *const c_char, len: size_t) -> bool; |
b7449926 | 1907 | |
a2a8927a | 1908 | pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value; |
b7449926 | 1909 | |
a2a8927a | 1910 | pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>; |
b7449926 | 1911 | |
a2a8927a | 1912 | pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>); |
b7449926 | 1913 | |
9fa01778 | 1914 | pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>); |
b7449926 | 1915 | |
a2a8927a | 1916 | pub fn LLVMRustDIBuilderCreateCompileUnit<'a>( |
dfeec247 XL |
1917 | Builder: &DIBuilder<'a>, |
1918 | Lang: c_uint, | |
1919 | File: &'a DIFile, | |
1920 | Producer: *const c_char, | |
74b04a01 | 1921 | ProducerLen: size_t, |
dfeec247 XL |
1922 | isOptimized: bool, |
1923 | Flags: *const c_char, | |
1924 | RuntimeVer: c_uint, | |
1925 | SplitName: *const c_char, | |
74b04a01 | 1926 | SplitNameLen: size_t, |
dfeec247 | 1927 | kind: DebugEmissionKind, |
fc512014 XL |
1928 | DWOId: u64, |
1929 | SplitDebugInlining: bool, | |
dfeec247 XL |
1930 | ) -> &'a DIDescriptor; |
1931 | ||
a2a8927a | 1932 | pub fn LLVMRustDIBuilderCreateFile<'a>( |
dfeec247 XL |
1933 | Builder: &DIBuilder<'a>, |
1934 | Filename: *const c_char, | |
74b04a01 | 1935 | FilenameLen: size_t, |
dfeec247 | 1936 | Directory: *const c_char, |
74b04a01 | 1937 | DirectoryLen: size_t, |
ba9703b0 XL |
1938 | CSKind: ChecksumKind, |
1939 | Checksum: *const c_char, | |
1940 | ChecksumLen: size_t, | |
dfeec247 XL |
1941 | ) -> &'a DIFile; |
1942 | ||
a2a8927a | 1943 | pub fn LLVMRustDIBuilderCreateSubroutineType<'a>( |
dfeec247 | 1944 | Builder: &DIBuilder<'a>, |
dfeec247 XL |
1945 | ParameterTypes: &'a DIArray, |
1946 | ) -> &'a DICompositeType; | |
1947 | ||
a2a8927a | 1948 | pub fn LLVMRustDIBuilderCreateFunction<'a>( |
dfeec247 XL |
1949 | Builder: &DIBuilder<'a>, |
1950 | Scope: &'a DIDescriptor, | |
1951 | Name: *const c_char, | |
74b04a01 | 1952 | NameLen: size_t, |
dfeec247 | 1953 | LinkageName: *const c_char, |
74b04a01 | 1954 | LinkageNameLen: size_t, |
dfeec247 XL |
1955 | File: &'a DIFile, |
1956 | LineNo: c_uint, | |
1957 | Ty: &'a DIType, | |
1958 | ScopeLine: c_uint, | |
1959 | Flags: DIFlags, | |
1960 | SPFlags: DISPFlags, | |
29967ef6 | 1961 | MaybeFn: Option<&'a Value>, |
dfeec247 XL |
1962 | TParam: &'a DIArray, |
1963 | Decl: Option<&'a DIDescriptor>, | |
1964 | ) -> &'a DISubprogram; | |
1965 | ||
a2a8927a | 1966 | pub fn LLVMRustDIBuilderCreateBasicType<'a>( |
dfeec247 XL |
1967 | Builder: &DIBuilder<'a>, |
1968 | Name: *const c_char, | |
74b04a01 | 1969 | NameLen: size_t, |
dfeec247 | 1970 | SizeInBits: u64, |
dfeec247 XL |
1971 | Encoding: c_uint, |
1972 | ) -> &'a DIBasicType; | |
1973 | ||
a2a8927a | 1974 | pub fn LLVMRustDIBuilderCreateTypedef<'a>( |
f035d41b XL |
1975 | Builder: &DIBuilder<'a>, |
1976 | Type: &'a DIBasicType, | |
1977 | Name: *const c_char, | |
1978 | NameLen: size_t, | |
1979 | File: &'a DIFile, | |
1980 | LineNo: c_uint, | |
1981 | Scope: Option<&'a DIScope>, | |
1982 | ) -> &'a DIDerivedType; | |
1983 | ||
a2a8927a | 1984 | pub fn LLVMRustDIBuilderCreatePointerType<'a>( |
dfeec247 XL |
1985 | Builder: &DIBuilder<'a>, |
1986 | PointeeTy: &'a DIType, | |
1987 | SizeInBits: u64, | |
1988 | AlignInBits: u32, | |
74b04a01 | 1989 | AddressSpace: c_uint, |
dfeec247 | 1990 | Name: *const c_char, |
74b04a01 | 1991 | NameLen: size_t, |
dfeec247 XL |
1992 | ) -> &'a DIDerivedType; |
1993 | ||
a2a8927a | 1994 | pub fn LLVMRustDIBuilderCreateStructType<'a>( |
dfeec247 XL |
1995 | Builder: &DIBuilder<'a>, |
1996 | Scope: Option<&'a DIDescriptor>, | |
1997 | Name: *const c_char, | |
74b04a01 | 1998 | NameLen: size_t, |
dfeec247 XL |
1999 | File: &'a DIFile, |
2000 | LineNumber: c_uint, | |
2001 | SizeInBits: u64, | |
2002 | AlignInBits: u32, | |
2003 | Flags: DIFlags, | |
2004 | DerivedFrom: Option<&'a DIType>, | |
2005 | Elements: &'a DIArray, | |
2006 | RunTimeLang: c_uint, | |
2007 | VTableHolder: Option<&'a DIType>, | |
2008 | UniqueId: *const c_char, | |
74b04a01 | 2009 | UniqueIdLen: size_t, |
dfeec247 XL |
2010 | ) -> &'a DICompositeType; |
2011 | ||
a2a8927a | 2012 | pub fn LLVMRustDIBuilderCreateMemberType<'a>( |
dfeec247 XL |
2013 | Builder: &DIBuilder<'a>, |
2014 | Scope: &'a DIDescriptor, | |
2015 | Name: *const c_char, | |
74b04a01 | 2016 | NameLen: size_t, |
dfeec247 XL |
2017 | File: &'a DIFile, |
2018 | LineNo: c_uint, | |
2019 | SizeInBits: u64, | |
2020 | AlignInBits: u32, | |
2021 | OffsetInBits: u64, | |
2022 | Flags: DIFlags, | |
2023 | Ty: &'a DIType, | |
2024 | ) -> &'a DIDerivedType; | |
2025 | ||
a2a8927a | 2026 | pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>( |
dfeec247 XL |
2027 | Builder: &DIBuilder<'a>, |
2028 | Scope: &'a DIScope, | |
2029 | Name: *const c_char, | |
74b04a01 | 2030 | NameLen: size_t, |
dfeec247 XL |
2031 | File: &'a DIFile, |
2032 | LineNumber: c_uint, | |
2033 | SizeInBits: u64, | |
2034 | AlignInBits: u32, | |
2035 | OffsetInBits: u64, | |
2036 | Discriminant: Option<&'a Value>, | |
2037 | Flags: DIFlags, | |
2038 | Ty: &'a DIType, | |
2039 | ) -> &'a DIType; | |
2040 | ||
f2b60f7d FG |
2041 | pub fn LLVMRustDIBuilderCreateStaticMemberType<'a>( |
2042 | Builder: &DIBuilder<'a>, | |
2043 | Scope: &'a DIDescriptor, | |
2044 | Name: *const c_char, | |
2045 | NameLen: size_t, | |
2046 | File: &'a DIFile, | |
2047 | LineNo: c_uint, | |
2048 | Ty: &'a DIType, | |
2049 | Flags: DIFlags, | |
2050 | val: Option<&'a Value>, | |
2051 | AlignInBits: u32, | |
2052 | ) -> &'a DIDerivedType; | |
2053 | ||
a2a8927a | 2054 | pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>( |
dfeec247 XL |
2055 | Builder: &DIBuilder<'a>, |
2056 | Scope: &'a DIScope, | |
2057 | File: &'a DIFile, | |
2058 | Line: c_uint, | |
2059 | Col: c_uint, | |
2060 | ) -> &'a DILexicalBlock; | |
2061 | ||
a2a8927a | 2062 | pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>( |
dfeec247 XL |
2063 | Builder: &DIBuilder<'a>, |
2064 | Scope: &'a DIScope, | |
2065 | File: &'a DIFile, | |
2066 | ) -> &'a DILexicalBlock; | |
2067 | ||
a2a8927a | 2068 | pub fn LLVMRustDIBuilderCreateStaticVariable<'a>( |
dfeec247 XL |
2069 | Builder: &DIBuilder<'a>, |
2070 | Context: Option<&'a DIScope>, | |
2071 | Name: *const c_char, | |
74b04a01 | 2072 | NameLen: size_t, |
dfeec247 | 2073 | LinkageName: *const c_char, |
74b04a01 | 2074 | LinkageNameLen: size_t, |
dfeec247 XL |
2075 | File: &'a DIFile, |
2076 | LineNo: c_uint, | |
2077 | Ty: &'a DIType, | |
2078 | isLocalToUnit: bool, | |
2079 | Val: &'a Value, | |
2080 | Decl: Option<&'a DIDescriptor>, | |
2081 | AlignInBits: u32, | |
2082 | ) -> &'a DIGlobalVariableExpression; | |
2083 | ||
a2a8927a | 2084 | pub fn LLVMRustDIBuilderCreateVariable<'a>( |
dfeec247 XL |
2085 | Builder: &DIBuilder<'a>, |
2086 | Tag: c_uint, | |
2087 | Scope: &'a DIDescriptor, | |
2088 | Name: *const c_char, | |
74b04a01 | 2089 | NameLen: size_t, |
dfeec247 XL |
2090 | File: &'a DIFile, |
2091 | LineNo: c_uint, | |
2092 | Ty: &'a DIType, | |
2093 | AlwaysPreserve: bool, | |
2094 | Flags: DIFlags, | |
2095 | ArgNo: c_uint, | |
2096 | AlignInBits: u32, | |
2097 | ) -> &'a DIVariable; | |
2098 | ||
a2a8927a | 2099 | pub fn LLVMRustDIBuilderCreateArrayType<'a>( |
dfeec247 XL |
2100 | Builder: &DIBuilder<'a>, |
2101 | Size: u64, | |
2102 | AlignInBits: u32, | |
2103 | Ty: &'a DIType, | |
2104 | Subscripts: &'a DIArray, | |
2105 | ) -> &'a DIType; | |
2106 | ||
a2a8927a | 2107 | pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>( |
dfeec247 XL |
2108 | Builder: &DIBuilder<'a>, |
2109 | Lo: i64, | |
2110 | Count: i64, | |
2111 | ) -> &'a DISubrange; | |
2112 | ||
a2a8927a | 2113 | pub fn LLVMRustDIBuilderGetOrCreateArray<'a>( |
dfeec247 XL |
2114 | Builder: &DIBuilder<'a>, |
2115 | Ptr: *const Option<&'a DIDescriptor>, | |
2116 | Count: c_uint, | |
2117 | ) -> &'a DIArray; | |
2118 | ||
a2a8927a | 2119 | pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>( |
dfeec247 XL |
2120 | Builder: &DIBuilder<'a>, |
2121 | Val: &'a Value, | |
2122 | VarInfo: &'a DIVariable, | |
a2a8927a | 2123 | AddrOps: *const u64, |
dfeec247 | 2124 | AddrOpsCount: c_uint, |
29967ef6 | 2125 | DL: &'a DILocation, |
dfeec247 XL |
2126 | InsertAtEnd: &'a BasicBlock, |
2127 | ) -> &'a Value; | |
2128 | ||
a2a8927a | 2129 | pub fn LLVMRustDIBuilderCreateEnumerator<'a>( |
dfeec247 XL |
2130 | Builder: &DIBuilder<'a>, |
2131 | Name: *const c_char, | |
74b04a01 | 2132 | NameLen: size_t, |
487cf647 FG |
2133 | Value: *const u64, |
2134 | SizeInBits: c_uint, | |
74b04a01 | 2135 | IsUnsigned: bool, |
dfeec247 XL |
2136 | ) -> &'a DIEnumerator; |
2137 | ||
a2a8927a | 2138 | pub fn LLVMRustDIBuilderCreateEnumerationType<'a>( |
dfeec247 XL |
2139 | Builder: &DIBuilder<'a>, |
2140 | Scope: &'a DIScope, | |
2141 | Name: *const c_char, | |
74b04a01 | 2142 | NameLen: size_t, |
dfeec247 XL |
2143 | File: &'a DIFile, |
2144 | LineNumber: c_uint, | |
2145 | SizeInBits: u64, | |
2146 | AlignInBits: u32, | |
2147 | Elements: &'a DIArray, | |
2148 | ClassType: &'a DIType, | |
2149 | IsScoped: bool, | |
2150 | ) -> &'a DIType; | |
2151 | ||
a2a8927a | 2152 | pub fn LLVMRustDIBuilderCreateUnionType<'a>( |
dfeec247 | 2153 | Builder: &DIBuilder<'a>, |
17df50a5 | 2154 | Scope: Option<&'a DIScope>, |
dfeec247 | 2155 | Name: *const c_char, |
74b04a01 | 2156 | NameLen: size_t, |
dfeec247 XL |
2157 | File: &'a DIFile, |
2158 | LineNumber: c_uint, | |
2159 | SizeInBits: u64, | |
2160 | AlignInBits: u32, | |
2161 | Flags: DIFlags, | |
2162 | Elements: Option<&'a DIArray>, | |
2163 | RunTimeLang: c_uint, | |
2164 | UniqueId: *const c_char, | |
74b04a01 | 2165 | UniqueIdLen: size_t, |
dfeec247 XL |
2166 | ) -> &'a DIType; |
2167 | ||
a2a8927a | 2168 | pub fn LLVMRustDIBuilderCreateVariantPart<'a>( |
dfeec247 XL |
2169 | Builder: &DIBuilder<'a>, |
2170 | Scope: &'a DIScope, | |
2171 | Name: *const c_char, | |
74b04a01 | 2172 | NameLen: size_t, |
dfeec247 XL |
2173 | File: &'a DIFile, |
2174 | LineNo: c_uint, | |
2175 | SizeInBits: u64, | |
2176 | AlignInBits: u32, | |
2177 | Flags: DIFlags, | |
2178 | Discriminator: Option<&'a DIDerivedType>, | |
2179 | Elements: &'a DIArray, | |
2180 | UniqueId: *const c_char, | |
74b04a01 | 2181 | UniqueIdLen: size_t, |
dfeec247 | 2182 | ) -> &'a DIDerivedType; |
a1dfa0c6 | 2183 | |
ba9703b0 | 2184 | pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr); |
b7449926 | 2185 | |
a2a8927a | 2186 | pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>( |
dfeec247 XL |
2187 | Builder: &DIBuilder<'a>, |
2188 | Scope: Option<&'a DIScope>, | |
2189 | Name: *const c_char, | |
74b04a01 | 2190 | NameLen: size_t, |
dfeec247 | 2191 | Ty: &'a DIType, |
dfeec247 XL |
2192 | ) -> &'a DITemplateTypeParameter; |
2193 | ||
a2a8927a | 2194 | pub fn LLVMRustDIBuilderCreateNameSpace<'a>( |
dfeec247 XL |
2195 | Builder: &DIBuilder<'a>, |
2196 | Scope: Option<&'a DIScope>, | |
2197 | Name: *const c_char, | |
74b04a01 XL |
2198 | NameLen: size_t, |
2199 | ExportSymbols: bool, | |
dfeec247 XL |
2200 | ) -> &'a DINameSpace; |
2201 | ||
a2a8927a | 2202 | pub fn LLVMRustDICompositeTypeReplaceArrays<'a>( |
dfeec247 XL |
2203 | Builder: &DIBuilder<'a>, |
2204 | CompositeType: &'a DIType, | |
2205 | Elements: Option<&'a DIArray>, | |
2206 | Params: Option<&'a DIArray>, | |
2207 | ); | |
2208 | ||
a2a8927a | 2209 | pub fn LLVMRustDIBuilderCreateDebugLocation<'a>( |
dfeec247 XL |
2210 | Line: c_uint, |
2211 | Column: c_uint, | |
2212 | Scope: &'a DIScope, | |
29967ef6 XL |
2213 | InlinedAt: Option<&'a DILocation>, |
2214 | ) -> &'a DILocation; | |
a2a8927a XL |
2215 | pub fn LLVMRustDIBuilderCreateOpDeref() -> u64; |
2216 | pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64; | |
487cf647 | 2217 | pub fn LLVMRustDIBuilderCreateOpLLVMFragment() -> u64; |
b7449926 | 2218 | |
0731742a | 2219 | #[allow(improper_ctypes)] |
b7449926 | 2220 | pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString); |
0731742a | 2221 | #[allow(improper_ctypes)] |
b7449926 | 2222 | pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString); |
b7449926 | 2223 | |
e74abb32 | 2224 | pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>; |
b7449926 | 2225 | |
b7449926 XL |
2226 | pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool; |
2227 | ||
2228 | pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine); | |
cdc7bbd5 XL |
2229 | pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t; |
2230 | pub fn LLVMRustGetTargetFeature( | |
2231 | T: &TargetMachine, | |
2232 | Index: size_t, | |
2233 | Feature: &mut *const c_char, | |
2234 | Desc: &mut *const c_char, | |
2235 | ); | |
b7449926 XL |
2236 | |
2237 | pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char; | |
dfeec247 XL |
2238 | pub fn LLVMRustCreateTargetMachine( |
2239 | Triple: *const c_char, | |
2240 | CPU: *const c_char, | |
2241 | Features: *const c_char, | |
2242 | Abi: *const c_char, | |
2243 | Model: CodeModel, | |
f9f354fc | 2244 | Reloc: RelocModel, |
dfeec247 XL |
2245 | Level: CodeGenOptLevel, |
2246 | UseSoftFP: bool, | |
dfeec247 XL |
2247 | FunctionSections: bool, |
2248 | DataSections: bool, | |
3c0e092e | 2249 | UniqueSectionNames: bool, |
dfeec247 XL |
2250 | TrapUnreachable: bool, |
2251 | Singlethread: bool, | |
2252 | AsmComments: bool, | |
2253 | EmitStackSizeSection: bool, | |
2254 | RelaxELFRelocations: bool, | |
f9f354fc | 2255 | UseInitArray: bool, |
fc512014 | 2256 | SplitDwarfFile: *const c_char, |
dfeec247 | 2257 | ) -> Option<&'static mut TargetMachine>; |
b7449926 | 2258 | pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine); |
a2a8927a | 2259 | pub fn LLVMRustAddLibraryInfo<'a>( |
dfeec247 XL |
2260 | PM: &PassManager<'a>, |
2261 | M: &'a Module, | |
2262 | DisableSimplifyLibCalls: bool, | |
2263 | ); | |
a2a8927a | 2264 | pub fn LLVMRustWriteOutputFile<'a>( |
dfeec247 XL |
2265 | T: &'a TargetMachine, |
2266 | PM: &PassManager<'a>, | |
2267 | M: &'a Module, | |
2268 | Output: *const c_char, | |
fc512014 | 2269 | DwoOutput: *const c_char, |
dfeec247 XL |
2270 | FileType: FileType, |
2271 | ) -> LLVMRustResult; | |
2b03887a | 2272 | pub fn LLVMRustOptimize<'a>( |
74b04a01 XL |
2273 | M: &'a Module, |
2274 | TM: &'a TargetMachine, | |
2275 | OptLevel: PassBuilderOptLevel, | |
2276 | OptStage: OptStage, | |
2277 | NoPrepopulatePasses: bool, | |
2278 | VerifyIR: bool, | |
2279 | UseThinLTOBuffers: bool, | |
2280 | MergeFunctions: bool, | |
2281 | UnrollLoops: bool, | |
2282 | SLPVectorize: bool, | |
2283 | LoopVectorize: bool, | |
2284 | DisableSimplifyLibCalls: bool, | |
f9f354fc | 2285 | EmitLifetimeMarkers: bool, |
74b04a01 XL |
2286 | SanitizerOptions: Option<&SanitizerOptions>, |
2287 | PGOGenPath: *const c_char, | |
2288 | PGOUsePath: *const c_char, | |
17df50a5 | 2289 | InstrumentCoverage: bool, |
f2b60f7d | 2290 | InstrProfileOutput: *const c_char, |
17df50a5 | 2291 | InstrumentGCOV: bool, |
c295e0f8 XL |
2292 | PGOSampleUsePath: *const c_char, |
2293 | DebugInfoForProfiling: bool, | |
74b04a01 XL |
2294 | llvm_selfprofiler: *mut c_void, |
2295 | begin_callback: SelfProfileBeforePassCallback, | |
2296 | end_callback: SelfProfileAfterPassCallback, | |
17df50a5 XL |
2297 | ExtraPasses: *const c_char, |
2298 | ExtraPassesLen: size_t, | |
a2a8927a XL |
2299 | LLVMPlugins: *const c_char, |
2300 | LLVMPluginsLen: size_t, | |
17df50a5 | 2301 | ) -> LLVMRustResult; |
dfeec247 | 2302 | pub fn LLVMRustPrintModule( |
a2a8927a | 2303 | M: &Module, |
dfeec247 XL |
2304 | Output: *const c_char, |
2305 | Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t, | |
2306 | ) -> LLVMRustResult; | |
b7449926 XL |
2307 | pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char); |
2308 | pub fn LLVMRustPrintPasses(); | |
2309 | pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char); | |
b7449926 | 2310 | pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t); |
b7449926 XL |
2311 | |
2312 | pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>; | |
a2a8927a XL |
2313 | pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>; |
2314 | pub fn LLVMRustArchiveIteratorNext<'a>( | |
b7449926 XL |
2315 | AIR: &ArchiveIterator<'a>, |
2316 | ) -> Option<&'a mut ArchiveChild<'a>>; | |
9fa01778 | 2317 | pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char; |
a2a8927a XL |
2318 | pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>); |
2319 | pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>); | |
b7449926 XL |
2320 | pub fn LLVMRustDestroyArchive(AR: &'static mut Archive); |
2321 | ||
0731742a | 2322 | #[allow(improper_ctypes)] |
b7449926 | 2323 | pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString); |
b7449926 | 2324 | |
0731742a | 2325 | #[allow(improper_ctypes)] |
a2a8927a | 2326 | pub fn LLVMRustUnpackOptimizationDiagnostic<'a>( |
dfeec247 XL |
2327 | DI: &'a DiagnosticInfo, |
2328 | pass_name_out: &RustString, | |
2329 | function_out: &mut Option<&'a Value>, | |
2330 | loc_line_out: &mut c_uint, | |
2331 | loc_column_out: &mut c_uint, | |
2332 | loc_filename_out: &RustString, | |
2333 | message_out: &RustString, | |
2334 | ); | |
2335 | ||
a2a8927a | 2336 | pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>( |
dfeec247 | 2337 | DI: &'a DiagnosticInfo, |
f035d41b | 2338 | level_out: &mut DiagnosticLevel, |
dfeec247 XL |
2339 | cookie_out: &mut c_uint, |
2340 | message_out: &mut Option<&'a Twine>, | |
dfeec247 | 2341 | ); |
b7449926 | 2342 | |
0731742a | 2343 | #[allow(improper_ctypes)] |
b7449926 | 2344 | pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString); |
b7449926 XL |
2345 | pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind; |
2346 | ||
a2a8927a | 2347 | pub fn LLVMRustGetSMDiagnostic<'a>( |
94222f64 XL |
2348 | DI: &'a DiagnosticInfo, |
2349 | cookie_out: &mut c_uint, | |
2350 | ) -> &'a SMDiagnostic; | |
2351 | ||
0731742a | 2352 | #[allow(improper_ctypes)] |
f9f354fc XL |
2353 | pub fn LLVMRustUnpackSMDiagnostic( |
2354 | d: &SMDiagnostic, | |
2355 | message_out: &RustString, | |
2356 | buffer_out: &RustString, | |
f035d41b | 2357 | level_out: &mut DiagnosticLevel, |
f9f354fc XL |
2358 | loc_out: &mut c_uint, |
2359 | ranges_out: *mut c_uint, | |
2360 | num_ranges: &mut usize, | |
2361 | ) -> bool; | |
b7449926 | 2362 | |
dfeec247 XL |
2363 | pub fn LLVMRustWriteArchive( |
2364 | Dst: *const c_char, | |
2365 | NumMembers: size_t, | |
2366 | Members: *const &RustArchiveMember<'_>, | |
2367 | WriteSymbtab: bool, | |
2368 | Kind: ArchiveKind, | |
2369 | ) -> LLVMRustResult; | |
a2a8927a | 2370 | pub fn LLVMRustArchiveMemberNew<'a>( |
dfeec247 XL |
2371 | Filename: *const c_char, |
2372 | Name: *const c_char, | |
2373 | Child: Option<&ArchiveChild<'a>>, | |
2374 | ) -> &'a mut RustArchiveMember<'a>; | |
a2a8927a | 2375 | pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>); |
b7449926 | 2376 | |
17df50a5 XL |
2377 | pub fn LLVMRustWriteImportLibrary( |
2378 | ImportName: *const c_char, | |
2379 | Path: *const c_char, | |
2380 | Exports: *const LLVMRustCOFFShortExport, | |
2381 | NumExports: usize, | |
2382 | Machine: u16, | |
2383 | MinGW: bool, | |
2384 | ) -> LLVMRustResult; | |
2385 | ||
a2a8927a | 2386 | pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine); |
b7449926 | 2387 | |
a2a8927a | 2388 | pub fn LLVMRustBuildOperandBundleDef<'a>( |
dfeec247 XL |
2389 | Name: *const c_char, |
2390 | Inputs: *const &'a Value, | |
2391 | NumInputs: c_uint, | |
2392 | ) -> &'a mut OperandBundleDef<'a>; | |
a2a8927a | 2393 | pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>); |
b7449926 | 2394 | |
a2a8927a | 2395 | pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock); |
b7449926 | 2396 | |
a2a8927a | 2397 | pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t); |
60c5eb7d | 2398 | pub fn LLVMRustSetModulePICLevel(M: &Module); |
b7449926 | 2399 | pub fn LLVMRustSetModulePIELevel(M: &Module); |
6a06907d | 2400 | pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel); |
b7449926 XL |
2401 | pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer; |
2402 | pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8; | |
2403 | pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize; | |
2404 | pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer); | |
2405 | pub fn LLVMRustModuleCost(M: &Module) -> u64; | |
2406 | ||
064997fb | 2407 | pub fn LLVMRustThinLTOBufferCreate(M: &Module, is_thin: bool) -> &'static mut ThinLTOBuffer; |
b7449926 XL |
2408 | pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer); |
2409 | pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char; | |
2410 | pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t; | |
2411 | pub fn LLVMRustCreateThinLTOData( | |
2412 | Modules: *const ThinLTOModule, | |
2413 | NumModules: c_uint, | |
2414 | PreservedSymbols: *const *const c_char, | |
2415 | PreservedSymbolsLen: c_uint, | |
2416 | ) -> Option<&'static mut ThinLTOData>; | |
f035d41b XL |
2417 | pub fn LLVMRustPrepareThinLTORename( |
2418 | Data: &ThinLTOData, | |
2419 | Module: &Module, | |
2420 | Target: &TargetMachine, | |
2421 | ) -> bool; | |
dfeec247 XL |
2422 | pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool; |
2423 | pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool; | |
f035d41b XL |
2424 | pub fn LLVMRustPrepareThinLTOImport( |
2425 | Data: &ThinLTOData, | |
2426 | Module: &Module, | |
2427 | Target: &TargetMachine, | |
2428 | ) -> bool; | |
b7449926 | 2429 | pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData); |
9fa01778 | 2430 | pub fn LLVMRustParseBitcodeForLTO( |
b7449926 XL |
2431 | Context: &Context, |
2432 | Data: *const u8, | |
2433 | len: usize, | |
2434 | Identifier: *const c_char, | |
2435 | ) -> Option<&Module>; | |
f9f354fc XL |
2436 | pub fn LLVMRustGetBitcodeSliceFromObjectData( |
2437 | Data: *const u8, | |
2438 | len: usize, | |
2439 | out_len: &mut usize, | |
2440 | ) -> *const u8; | |
064997fb FG |
2441 | pub fn LLVMRustThinLTOGetDICompileUnit( |
2442 | M: &Module, | |
2443 | CU1: &mut *mut c_void, | |
2444 | CU2: &mut *mut c_void, | |
2445 | ); | |
2446 | pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void); | |
b7449926 | 2447 | |
a2a8927a | 2448 | pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>; |
dfeec247 XL |
2449 | pub fn LLVMRustLinkerAdd( |
2450 | linker: &Linker<'_>, | |
2451 | bytecode: *const c_char, | |
2452 | bytecode_len: usize, | |
2453 | ) -> bool; | |
a2a8927a | 2454 | pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>); |
29967ef6 XL |
2455 | #[allow(improper_ctypes)] |
2456 | pub fn LLVMRustComputeLTOCacheKey( | |
2457 | key_out: &RustString, | |
2458 | mod_id: *const c_char, | |
2459 | data: &ThinLTOData, | |
2460 | ); | |
a2a8927a XL |
2461 | |
2462 | pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>; | |
2463 | pub fn LLVMRustContextSetDiagnosticHandler( | |
2464 | context: &Context, | |
2465 | diagnostic_handler: Option<&DiagnosticHandler>, | |
2466 | ); | |
2467 | pub fn LLVMRustContextConfigureDiagnosticHandler( | |
2468 | context: &Context, | |
2469 | diagnostic_handler_callback: DiagnosticHandlerTy, | |
2470 | diagnostic_handler_context: *mut c_void, | |
2471 | remark_all_passes: bool, | |
2472 | remark_passes: *const *const c_char, | |
2473 | remark_passes_len: usize, | |
2474 | ); | |
2475 | ||
04454e1e FG |
2476 | #[allow(improper_ctypes)] |
2477 | pub fn LLVMRustGetMangledName(V: &Value, out: &RustString); | |
064997fb FG |
2478 | |
2479 | pub fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32; | |
487cf647 FG |
2480 | |
2481 | pub fn LLVMRustIsBitcode(ptr: *const u8, len: usize) -> bool; | |
2482 | ||
2483 | pub fn LLVMRustGetSymbols( | |
2484 | buf_ptr: *const u8, | |
2485 | buf_len: usize, | |
2486 | state: *mut c_void, | |
2487 | callback: GetSymbolsCallback, | |
2488 | error_callback: GetSymbolsErrorCallback, | |
2489 | ) -> *mut c_void; | |
b7449926 | 2490 | } |