1#![allow(non_upper_case_globals)]
7#![allow(non_camel_case_types)]
8
9extern crate libc;
10
11use self::prelude::*;
12
13#[derive(Debug)]
14pub enum LLVMMemoryBuffer {}
15
16#[derive(Debug)]
17pub enum LLVMContext {}
18
19#[derive(Debug)]
20pub enum LLVMModule {}
21
22#[derive(Debug)]
23pub enum LLVMType {}
24
25#[derive(Debug)]
26pub enum LLVMValue {}
27
28#[derive(Debug)]
29pub enum LLVMBasicBlock {}
30
31#[derive(Debug)]
32pub enum LLVMOpaqueMetadata {}
33
34#[derive(Debug)]
35pub enum LLVMOpaqueNamedMDNode {}
36
37#[derive(Debug)]
38pub enum LLVMOpaqueValueMetadataEntry {}
39
40#[derive(Debug)]
41pub enum LLVMBuilder {}
42
43#[derive(Debug)]
44pub enum LLVMOpaqueDIBuilder {}
45
46#[derive(Debug)]
47pub enum LLVMModuleProvider {}
48
49#[derive(Debug)]
50pub enum LLVMPassManager {}
51
52#[derive(Debug)]
53pub enum LLVMUse {}
54
55#[derive(Debug)]
56pub enum LLVMOpaqueOperandBundle {}
57
58#[derive(Debug)]
59pub enum LLVMDiagnosticInfo {}
60
61#[derive(Debug)]
62pub enum LLVMComdat {}
63
64#[derive(Debug)]
65pub enum LLVMOpaqueModuleFlagEntry {}
66
67#[derive(Debug)]
68pub enum LLVMOpaqueJITEventListener {}
69
70#[derive(Debug)]
71pub enum LLVMOpaqueAttributeRef {}
72
73#[derive(Debug)]
74pub enum LLVMOpaqueDbgRecord {}
75
76pub mod prelude {
80 pub type LLVMBool = ::libc::c_int;
81 pub type LLVMMemoryBufferRef = *mut super::LLVMMemoryBuffer;
82 pub type LLVMContextRef = *mut super::LLVMContext;
83 pub type LLVMModuleRef = *mut super::LLVMModule;
84 pub type LLVMTypeRef = *mut super::LLVMType;
85 pub type LLVMValueRef = *mut super::LLVMValue;
86 pub type LLVMBasicBlockRef = *mut super::LLVMBasicBlock;
87 pub type LLVMMetadataRef = *mut super::LLVMOpaqueMetadata;
88 pub type LLVMNamedMDNodeRef = *mut super::LLVMOpaqueNamedMDNode;
89 pub type LLVMValueMetadataEntry = *mut super::LLVMOpaqueValueMetadataEntry;
90 pub type LLVMBuilderRef = *mut super::LLVMBuilder;
91 pub type LLVMDIBuilderRef = *mut super::LLVMOpaqueDIBuilder;
92 pub type LLVMModuleProviderRef = *mut super::LLVMModuleProvider;
93 pub type LLVMPassManagerRef = *mut super::LLVMPassManager;
94 pub type LLVMUseRef = *mut super::LLVMUse;
95 pub type LLVMOperandBundleRef = *mut super::LLVMOpaqueOperandBundle;
96 pub type LLVMDiagnosticInfoRef = *mut super::LLVMDiagnosticInfo;
97 pub type LLVMComdatRef = *mut super::LLVMComdat;
98 pub type LLVMModuleFlagEntry = *mut super::LLVMOpaqueModuleFlagEntry;
99 pub type LLVMJITEventListenerRef = *mut super::LLVMOpaqueJITEventListener;
100 pub type LLVMAttributeRef = *mut super::LLVMOpaqueAttributeRef;
101 pub type LLVMDbgRecordRef = *mut super::LLVMOpaqueDbgRecord;
102}
103
104pub mod analysis;
105pub mod bit_reader;
106pub mod bit_writer;
107pub mod blake3;
108pub mod comdat;
109pub mod core;
110pub mod debuginfo;
111pub mod disassembler;
112pub mod error;
113pub mod error_handling;
114pub mod execution_engine;
115pub mod ir_reader;
116pub mod linker;
117pub mod lto;
118pub mod object;
119pub mod orc2;
120pub mod remarks;
121pub mod support;
122pub mod target;
123pub mod target_machine;
124
125pub mod transforms {
126 pub mod pass_builder;
127}
128
129#[repr(C)]
130#[derive(Clone, Copy, Debug, PartialEq)]
131pub enum LLVMOpcode {
132 LLVMRet = 1,
133 LLVMBr = 2,
134 LLVMSwitch = 3,
135 LLVMIndirectBr = 4,
136 LLVMInvoke = 5,
137 LLVMUnreachable = 7,
138 LLVMCallBr = 67,
139 LLVMFNeg = 66,
140 LLVMAdd = 8,
141 LLVMFAdd = 9,
142 LLVMSub = 10,
143 LLVMFSub = 11,
144 LLVMMul = 12,
145 LLVMFMul = 13,
146 LLVMUDiv = 14,
147 LLVMSDiv = 15,
148 LLVMFDiv = 16,
149 LLVMURem = 17,
150 LLVMSRem = 18,
151 LLVMFRem = 19,
152 LLVMShl = 20,
153 LLVMLShr = 21,
154 LLVMAShr = 22,
155 LLVMAnd = 23,
156 LLVMOr = 24,
157 LLVMXor = 25,
158 LLVMAlloca = 26,
159 LLVMLoad = 27,
160 LLVMStore = 28,
161 LLVMGetElementPtr = 29,
162 LLVMTrunc = 30,
163 LLVMZExt = 31,
164 LLVMSExt = 32,
165 LLVMFPToUI = 33,
166 LLVMFPToSI = 34,
167 LLVMUIToFP = 35,
168 LLVMSIToFP = 36,
169 LLVMFPTrunc = 37,
170 LLVMFPExt = 38,
171 LLVMPtrToInt = 39,
172 LLVMIntToPtr = 40,
173 LLVMBitCast = 41,
174 LLVMAddrSpaceCast = 60,
175 LLVMICmp = 42,
176 LLVMFCmp = 43,
177 LLVMPHI = 44,
178 LLVMCall = 45,
179 LLVMSelect = 46,
180 LLVMUserOp1 = 47,
181 LLVMUserOp2 = 48,
182 LLVMVAArg = 49,
183 LLVMExtractElement = 50,
184 LLVMInsertElement = 51,
185 LLVMShuffleVector = 52,
186 LLVMExtractValue = 53,
187 LLVMInsertValue = 54,
188 LLVMFreeze = 68,
189 LLVMFence = 55,
190 LLVMAtomicCmpXchg = 56,
191 LLVMAtomicRMW = 57,
192 LLVMResume = 58,
193 LLVMLandingPad = 59,
194 LLVMCleanupRet = 61,
195 LLVMCatchRet = 62,
196 LLVMCatchPad = 63,
197 LLVMCleanupPad = 64,
198 LLVMCatchSwitch = 65,
199}
200
201#[repr(C)]
202#[derive(Clone, Copy, Debug, PartialEq)]
203pub enum LLVMTypeKind {
204 LLVMVoidTypeKind = 0,
205 LLVMHalfTypeKind = 1,
206 LLVMFloatTypeKind = 2,
207 LLVMDoubleTypeKind = 3,
208 LLVMX86_FP80TypeKind = 4,
209 LLVMFP128TypeKind = 5,
210 LLVMPPC_FP128TypeKind = 6,
211 LLVMLabelTypeKind = 7,
212 LLVMIntegerTypeKind = 8,
213 LLVMFunctionTypeKind = 9,
214 LLVMStructTypeKind = 10,
215 LLVMArrayTypeKind = 11,
216 LLVMPointerTypeKind = 12,
217 LLVMVectorTypeKind = 13,
218 LLVMMetadataTypeKind = 14,
219 LLVMX86_MMXTypeKind = 15,
220 LLVMTokenTypeKind = 16,
221 LLVMScalableVectorTypeKind = 17,
222 LLVMBFloatTypeKind = 18,
223 LLVMX86_AMXTypeKind = 19,
224 LLVMTargetExtTypeKind = 20,
225}
226
227#[repr(C)]
228#[derive(Clone, Copy, Debug, PartialEq)]
229pub enum LLVMLinkage {
230 LLVMExternalLinkage = 0,
231 LLVMAvailableExternallyLinkage = 1,
232 LLVMLinkOnceAnyLinkage = 2,
233 LLVMLinkOnceODRLinkage = 3,
234 LLVMLinkOnceODRAutoHideLinkage = 4,
235 LLVMWeakAnyLinkage = 5,
236 LLVMWeakODRLinkage = 6,
237 LLVMAppendingLinkage = 7,
238 LLVMInternalLinkage = 8,
239 LLVMPrivateLinkage = 9,
240 LLVMDLLImportLinkage = 10,
241 LLVMDLLExportLinkage = 11,
242 LLVMExternalWeakLinkage = 12,
243 LLVMGhostLinkage = 13,
244 LLVMCommonLinkage = 14,
245 LLVMLinkerPrivateLinkage = 15,
246 LLVMLinkerPrivateWeakLinkage = 16,
247}
248
249#[repr(C)]
250#[derive(Clone, Copy, Debug, PartialEq)]
251pub enum LLVMVisibility {
252 LLVMDefaultVisibility = 0,
253 LLVMHiddenVisibility = 1,
254 LLVMProtectedVisibility = 2,
255}
256
257#[repr(C)]
258#[derive(Clone, Copy, Debug, PartialEq)]
259pub enum LLVMUnnamedAddr {
260 LLVMNoUnnamedAddr,
262 LLVMLocalUnnamedAddr,
264 LLVMGlobalUnnamedAddr,
266}
267
268#[repr(C)]
269#[derive(Clone, Copy, Debug, PartialEq)]
270pub enum LLVMDLLStorageClass {
271 LLVMDefaultStorageClass = 0,
272 LLVMDLLImportStorageClass = 1,
273 LLVMDLLExportStorageClass = 2,
274}
275
276#[repr(C)]
277#[derive(Clone, Copy, Debug, PartialEq)]
278pub enum LLVMCallConv {
279 LLVMCCallConv = 0,
280 LLVMFastCallConv = 8,
281 LLVMColdCallConv = 9,
282 LLVMGHCCallConv = 10,
283 LLVMHiPECallConv = 11,
284 LLVMAnyRegCallConv = 13,
285 LLVMPreserveMostCallConv = 14,
286 LLVMPreserveAllCallConv = 15,
287 LLVMSwiftCallConv = 16,
288 LLVMCXXFASTTLSCallConv = 17,
289 LLVMX86StdcallCallConv = 64,
290 LLVMX86FastcallCallConv = 65,
291 LLVMARMAPCSCallConv = 66,
292 LLVMARMAAPCSCallConv = 67,
293 LLVMARMAAPCSVFPCallConv = 68,
294 LLVMMSP430INTRCallConv = 69,
295 LLVMX86ThisCallCallConv = 70,
296 LLVMPTXKernelCallConv = 71,
297 LLVMPTXDeviceCallConv = 72,
298 LLVMSPIRFUNCCallConv = 75,
299 LLVMSPIRKERNELCallConv = 76,
300 LLVMIntelOCLBICallConv = 77,
301 LLVMX8664SysVCallConv = 78,
302 LLVMWin64CallConv = 79,
303 LLVMX86VectorCallCallConv = 80,
304 LLVMHHVMCallConv = 81,
305 LLVMHHVMCCallConv = 82,
306 LLVMX86INTRCallConv = 83,
307 LLVMAVRINTRCallConv = 84,
308 LLVMAVRSIGNALCallConv = 85,
309 LLVMAVRBUILTINCallConv = 86,
310 LLVMAMDGPUVSCallConv = 87,
311 LLVMAMDGPUGSCallConv = 88,
312 LLVMAMDGPUPSCallConv = 89,
313 LLVMAMDGPUCSCallConv = 90,
314 LLVMAMDGPUKERNELCallConv = 91,
315 LLVMX86RegCallCallConv = 92,
316 LLVMAMDGPUHSCallConv = 93,
317 LLVMMSP430BUILTINCallConv = 94,
318 LLVMAMDGPULSCallConv = 95,
319 LLVMAMDGPUESCallConv = 96,
320}
321
322#[repr(C)]
323#[derive(Clone, Copy, Debug, PartialEq)]
324pub enum LLVMValueKind {
325 LLVMArgumentValueKind,
326 LLVMBasicBlockValueKind,
327 LLVMMemoryUseValueKind,
328 LLVMMemoryDefValueKind,
329 LLVMMemoryPhiValueKind,
330
331 LLVMFunctionValueKind,
332 LLVMGlobalAliasValueKind,
333 LLVMGlobalIFuncValueKind,
334 LLVMGlobalVariableValueKind,
335 LLVMBlockAddressValueKind,
336 LLVMConstantExprValueKind,
337 LLVMConstantArrayValueKind,
338 LLVMConstantStructValueKind,
339 LLVMConstantVectorValueKind,
340 LLVMUndefValueValueKind,
341 LLVMConstantAggregateZeroValueKind,
342 LLVMConstantDataArrayValueKind,
343 LLVMConstantDataVectorValueKind,
344 LLVMConstantIntValueKind,
345 LLVMConstantFPValueKind,
346 LLVMConstantPointerNullValueKind,
347 LLVMConstantTokenNoneValueKind,
348
349 LLVMMetadataAsValueValueKind,
350 LLVMInlineAsmValueKind,
351
352 LLVMInstructionValueKind,
353 LLVMPoisonValueKind,
354 LLVMConstantTargetNoneValueKind,
355 LLVMConstantPtrAuthValueKind,
356}
357
358#[repr(C)]
359#[derive(Clone, Copy, Debug, PartialEq)]
360pub enum LLVMIntPredicate {
361 LLVMIntEQ = 32,
362 LLVMIntNE = 33,
363 LLVMIntUGT = 34,
364 LLVMIntUGE = 35,
365 LLVMIntULT = 36,
366 LLVMIntULE = 37,
367 LLVMIntSGT = 38,
368 LLVMIntSGE = 39,
369 LLVMIntSLT = 40,
370 LLVMIntSLE = 41,
371}
372
373#[repr(C)]
374#[derive(Clone, Copy, Debug, PartialEq)]
375pub enum LLVMRealPredicate {
376 LLVMRealPredicateFalse = 0,
377 LLVMRealOEQ = 1,
378 LLVMRealOGT = 2,
379 LLVMRealOGE = 3,
380 LLVMRealOLT = 4,
381 LLVMRealOLE = 5,
382 LLVMRealONE = 6,
383 LLVMRealORD = 7,
384 LLVMRealUNO = 8,
385 LLVMRealUEQ = 9,
386 LLVMRealUGT = 10,
387 LLVMRealUGE = 11,
388 LLVMRealULT = 12,
389 LLVMRealULE = 13,
390 LLVMRealUNE = 14,
391 LLVMRealPredicateTrue = 15,
392}
393
394#[repr(C)]
395#[derive(Clone, Copy, Debug, PartialEq)]
396pub enum LLVMLandingPadClauseTy {
397 LLVMLandingPadCatch = 0,
398 LLVMLandingPadFilter = 1,
399}
400
401#[repr(C)]
402#[derive(Clone, Copy, Debug, PartialEq)]
403pub enum LLVMThreadLocalMode {
404 LLVMNotThreadLocal = 0,
405 LLVMGeneralDynamicTLSModel = 1,
406 LLVMLocalDynamicTLSModel = 2,
407 LLVMInitialExecTLSModel = 3,
408 LLVMLocalExecTLSModel = 4,
409}
410
411#[repr(C)]
412#[derive(Clone, Copy, Debug, PartialEq)]
413pub enum LLVMAtomicOrdering {
414 LLVMAtomicOrderingNotAtomic = 0,
415 LLVMAtomicOrderingUnordered = 1,
416 LLVMAtomicOrderingMonotonic = 2,
417 LLVMAtomicOrderingAcquire = 4,
418 LLVMAtomicOrderingRelease = 5,
419 LLVMAtomicOrderingAcquireRelease = 6,
420 LLVMAtomicOrderingSequentiallyConsistent = 7,
421}
422
423#[repr(C)]
424#[derive(Clone, Copy, Debug, PartialEq)]
425pub enum LLVMAtomicRMWBinOp {
426 LLVMAtomicRMWBinOpXchg = 0,
427 LLVMAtomicRMWBinOpAdd = 1,
428 LLVMAtomicRMWBinOpSub = 2,
429 LLVMAtomicRMWBinOpAnd = 3,
430 LLVMAtomicRMWBinOpNand = 4,
431 LLVMAtomicRMWBinOpOr = 5,
432 LLVMAtomicRMWBinOpXor = 6,
433 LLVMAtomicRMWBinOpMax = 7,
434 LLVMAtomicRMWBinOpMin = 8,
435 LLVMAtomicRMWBinOpUMax = 9,
436 LLVMAtomicRMWBinOpUMin = 10,
437 LLVMAtomicRMWBinOpFAdd = 11,
438 LLVMAtomicRMWBinOpFSub = 12,
439 LLVMAtomicRMWBinOpFMax = 13,
440 LLVMAtomicRMWBinOpFMin = 14,
441 LLVMAtomicRMWBinOpUIncWrap = 15,
442 LLVMAtomicRMWBinOpUDecWrap = 16,
443}
444
445#[repr(C)]
446#[derive(Clone, Copy, Debug, PartialEq)]
447pub enum LLVMDiagnosticSeverity {
448 LLVMDSError = 0,
449 LLVMDSWarning = 1,
450 LLVMDSRemark = 2,
451 LLVMDSNote = 3,
452}
453
454#[repr(C)]
455#[derive(Clone, Copy, Debug, PartialEq)]
456pub enum LLVMInlineAsmDialect {
457 LLVMInlineAsmDialectATT,
458 LLVMInlineAsmDialectIntel,
459}
460
461#[repr(C)]
462#[derive(Clone, Copy, Debug, PartialEq)]
463pub enum LLVMModuleFlagBehavior {
464 LLVMModuleFlagBehaviorError,
466 LLVMModuleFlagBehaviorWarning,
468 LLVMModuleFlagBehaviorRequire,
470 LLVMModuleFlagBehaviorOverride,
472 LLVMModuleFlagBehaviorAppend,
474 LLVMModuleFlagBehaviorAppendUnique,
476}
477
478pub const LLVMAttributeReturnIndex: ::libc::c_uint = 0;
479pub const LLVMAttributeFunctionIndex: ::libc::c_uint = !0; pub type LLVMAttributeIndex = ::libc::c_uint;
483
484#[repr(C)]
488#[derive(Clone, Copy, Debug, PartialEq)]
489pub enum LLVMTailCallKind {
490 LLVMTailCallKindNone = 0,
491 LLVMTailCallKindTail = 1,
492 LLVMTailCallKindMustTail = 2,
493 LLVMTailCallKindNoTail = 3,
494}
495
496pub const LLVMFastMathAllowReassoc: ::libc::c_uint = 1 << 0;
497pub const LLVMFastMathNoNaNs: ::libc::c_uint = 1 << 1;
498pub const LLVMFastMathNoInfs: ::libc::c_uint = 1 << 2;
499pub const LLVMFastMathNoSignedZeros: ::libc::c_uint = 1 << 3;
500pub const LLVMFastMathAllowReciprocal: ::libc::c_uint = 1 << 4;
501pub const LLVMFastMathAllowContract: ::libc::c_uint = 1 << 5;
502pub const LLVMFastMathApproxFunc: ::libc::c_uint = 1 << 6;
503pub const LLVMFastMathNone: ::libc::c_uint = 0;
504pub const LLVMFastMathAll: ::libc::c_uint = LLVMFastMathAllowReassoc
505 | LLVMFastMathNoNaNs
506 | LLVMFastMathNoInfs
507 | LLVMFastMathNoSignedZeros
508 | LLVMFastMathAllowReciprocal
509 | LLVMFastMathAllowContract
510 | LLVMFastMathApproxFunc;
511
512pub type LLVMFastMathFlags = ::libc::c_uint;
516
517pub type LLVMGEPNoWrapFlags = ::libc::c_uint;
519
520pub const LLVMGEPFlagInBounds: LLVMGEPNoWrapFlags = 1;
521pub const LLVMGEPFlagNUSW: LLVMGEPNoWrapFlags = 1 << 1;
522pub const LLVMGEPFlagNUW: LLVMGEPNoWrapFlags = 1 << 2;
523
524pub type LLVMDiagnosticHandler =
525 Option<extern "C" fn(arg1: LLVMDiagnosticInfoRef, arg2: *mut ::libc::c_void)>;
526pub type LLVMYieldCallback = Option<extern "C" fn(arg1: LLVMContextRef, arg2: *mut ::libc::c_void)>;
527
528#[cfg(all(not(doc), not(feature = "no-llvm-linking"), LLVM_SYS_NOT_FOUND))]
529std::compile_error!(concat!(
530 "No suitable version of LLVM was found system-wide or pointed
531 to by LLVM_SYS_",
532 env!("CARGO_PKG_VERSION_MAJOR"),
533 "_PREFIX.
534
535 Consider using `llvmenv` to compile an appropriate copy of LLVM, and
536 refer to the llvm-sys documentation for more information.
537
538 llvm-sys: https://crates.io/crates/llvm-sys
539 llvmenv: https://crates.io/crates/llvmenv"
540));