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