]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_llvm/llvm/ffi.rs
Rollup merge of #53110 - Xanewok:save-analysis-remap-path, r=nrc
[rust.git] / src / librustc_codegen_llvm / llvm / ffi.rs
1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // FIXME: Rename 'DIGlobalVariable' to 'DIGlobalVariableExpression'
12 // once support for LLVM 3.9 is dropped.
13 //
14 // This method was changed in this LLVM patch:
15 // https://reviews.llvm.org/D26769
16
17 use super::debuginfo::{
18     DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
19     DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
20     DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
21     DINameSpace, DIFlags,
22 };
23
24 use libc::{c_uint, c_int, size_t, c_char};
25 use libc::{c_ulonglong, c_void};
26
27 use std::marker::PhantomData;
28
29 use super::RustString;
30
31 pub type Bool = c_uint;
32
33 pub const True: Bool = 1 as Bool;
34 pub const False: Bool = 0 as Bool;
35
36 #[derive(Copy, Clone, PartialEq)]
37 #[repr(C)]
38 #[allow(dead_code)] // Variants constructed by C++.
39 pub enum LLVMRustResult {
40     Success,
41     Failure,
42 }
43 // Consts for the LLVM CallConv type, pre-cast to usize.
44
45 /// LLVM CallingConv::ID. Should we wrap this?
46 #[derive(Copy, Clone, PartialEq, Debug)]
47 #[repr(C)]
48 pub enum CallConv {
49     CCallConv = 0,
50     FastCallConv = 8,
51     ColdCallConv = 9,
52     X86StdcallCallConv = 64,
53     X86FastcallCallConv = 65,
54     ArmAapcsCallConv = 67,
55     Msp430Intr = 69,
56     X86_ThisCall = 70,
57     PtxKernel = 71,
58     X86_64_SysV = 78,
59     X86_64_Win64 = 79,
60     X86_VectorCall = 80,
61     X86_Intr = 83,
62     AmdGpuKernel = 91,
63 }
64
65 /// LLVMRustLinkage
66 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
67 #[repr(C)]
68 pub enum Linkage {
69     ExternalLinkage = 0,
70     AvailableExternallyLinkage = 1,
71     LinkOnceAnyLinkage = 2,
72     LinkOnceODRLinkage = 3,
73     WeakAnyLinkage = 4,
74     WeakODRLinkage = 5,
75     AppendingLinkage = 6,
76     InternalLinkage = 7,
77     PrivateLinkage = 8,
78     ExternalWeakLinkage = 9,
79     CommonLinkage = 10,
80 }
81
82 // LLVMRustVisibility
83 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
84 #[repr(C)]
85 pub enum Visibility {
86     Default = 0,
87     Hidden = 1,
88     Protected = 2,
89 }
90
91 /// LLVMDLLStorageClass
92 #[derive(Copy, Clone)]
93 #[repr(C)]
94 pub enum DLLStorageClass {
95     #[allow(dead_code)]
96     Default = 0,
97     DllImport = 1, // Function to be imported from DLL.
98     #[allow(dead_code)]
99     DllExport = 2, // Function to be accessible from DLL.
100 }
101
102 /// Matches LLVMRustAttribute in rustllvm.h
103 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
104 /// though it is not ABI compatible (since it's a C++ enum)
105 #[repr(C)]
106 #[derive(Copy, Clone, Debug)]
107 pub enum Attribute {
108     AlwaysInline    = 0,
109     ByVal           = 1,
110     Cold            = 2,
111     InlineHint      = 3,
112     MinSize         = 4,
113     Naked           = 5,
114     NoAlias         = 6,
115     NoCapture       = 7,
116     NoInline        = 8,
117     NonNull         = 9,
118     NoRedZone       = 10,
119     NoReturn        = 11,
120     NoUnwind        = 12,
121     OptimizeForSize = 13,
122     ReadOnly        = 14,
123     SExt            = 15,
124     StructRet       = 16,
125     UWTable         = 17,
126     ZExt            = 18,
127     InReg           = 19,
128     SanitizeThread  = 20,
129     SanitizeAddress = 21,
130     SanitizeMemory  = 22,
131 }
132
133 /// LLVMIntPredicate
134 #[derive(Copy, Clone)]
135 #[repr(C)]
136 pub enum IntPredicate {
137     IntEQ = 32,
138     IntNE = 33,
139     IntUGT = 34,
140     IntUGE = 35,
141     IntULT = 36,
142     IntULE = 37,
143     IntSGT = 38,
144     IntSGE = 39,
145     IntSLT = 40,
146     IntSLE = 41,
147 }
148
149 /// LLVMRealPredicate
150 #[derive(Copy, Clone)]
151 #[repr(C)]
152 pub enum RealPredicate {
153     RealPredicateFalse = 0,
154     RealOEQ = 1,
155     RealOGT = 2,
156     RealOGE = 3,
157     RealOLT = 4,
158     RealOLE = 5,
159     RealONE = 6,
160     RealORD = 7,
161     RealUNO = 8,
162     RealUEQ = 9,
163     RealUGT = 10,
164     RealUGE = 11,
165     RealULT = 12,
166     RealULE = 13,
167     RealUNE = 14,
168     RealPredicateTrue = 15,
169 }
170
171 /// LLVMTypeKind
172 #[derive(Copy, Clone, PartialEq, Debug)]
173 #[repr(C)]
174 pub enum TypeKind {
175     Void = 0,
176     Half = 1,
177     Float = 2,
178     Double = 3,
179     X86_FP80 = 4,
180     FP128 = 5,
181     PPC_FP128 = 6,
182     Label = 7,
183     Integer = 8,
184     Function = 9,
185     Struct = 10,
186     Array = 11,
187     Pointer = 12,
188     Vector = 13,
189     Metadata = 14,
190     X86_MMX = 15,
191     Token = 16,
192 }
193
194 /// LLVMAtomicRmwBinOp
195 #[derive(Copy, Clone)]
196 #[repr(C)]
197 pub enum AtomicRmwBinOp {
198     AtomicXchg = 0,
199     AtomicAdd = 1,
200     AtomicSub = 2,
201     AtomicAnd = 3,
202     AtomicNand = 4,
203     AtomicOr = 5,
204     AtomicXor = 6,
205     AtomicMax = 7,
206     AtomicMin = 8,
207     AtomicUMax = 9,
208     AtomicUMin = 10,
209 }
210
211 /// LLVMAtomicOrdering
212 #[derive(Copy, Clone)]
213 #[repr(C)]
214 pub enum AtomicOrdering {
215     #[allow(dead_code)]
216     NotAtomic = 0,
217     Unordered = 1,
218     Monotonic = 2,
219     // Consume = 3,  // Not specified yet.
220     Acquire = 4,
221     Release = 5,
222     AcquireRelease = 6,
223     SequentiallyConsistent = 7,
224 }
225
226 /// LLVMRustSynchronizationScope
227 #[derive(Copy, Clone)]
228 #[repr(C)]
229 pub enum SynchronizationScope {
230     // FIXME: figure out if this variant is needed at all.
231     #[allow(dead_code)]
232     Other,
233     SingleThread,
234     CrossThread,
235 }
236
237 /// LLVMRustFileType
238 #[derive(Copy, Clone)]
239 #[repr(C)]
240 pub enum FileType {
241     // FIXME: figure out if this variant is needed at all.
242     #[allow(dead_code)]
243     Other,
244     AssemblyFile,
245     ObjectFile,
246 }
247
248 /// LLVMMetadataType
249 #[derive(Copy, Clone)]
250 #[repr(C)]
251 pub enum MetadataType {
252     MD_dbg = 0,
253     MD_tbaa = 1,
254     MD_prof = 2,
255     MD_fpmath = 3,
256     MD_range = 4,
257     MD_tbaa_struct = 5,
258     MD_invariant_load = 6,
259     MD_alias_scope = 7,
260     MD_noalias = 8,
261     MD_nontemporal = 9,
262     MD_mem_parallel_loop_access = 10,
263     MD_nonnull = 11,
264 }
265
266 /// LLVMRustAsmDialect
267 #[derive(Copy, Clone)]
268 #[repr(C)]
269 pub enum AsmDialect {
270     // FIXME: figure out if this variant is needed at all.
271     #[allow(dead_code)]
272     Other,
273     Att,
274     Intel,
275 }
276
277 /// LLVMRustCodeGenOptLevel
278 #[derive(Copy, Clone, PartialEq)]
279 #[repr(C)]
280 pub enum CodeGenOptLevel {
281     // FIXME: figure out if this variant is needed at all.
282     #[allow(dead_code)]
283     Other,
284     None,
285     Less,
286     Default,
287     Aggressive,
288 }
289
290 /// LLVMRelocMode
291 #[derive(Copy, Clone, PartialEq)]
292 #[repr(C)]
293 pub enum RelocMode {
294     Default,
295     Static,
296     PIC,
297     DynamicNoPic,
298     ROPI,
299     RWPI,
300     ROPI_RWPI,
301 }
302
303 /// LLVMRustCodeModel
304 #[derive(Copy, Clone)]
305 #[repr(C)]
306 pub enum CodeModel {
307     // FIXME: figure out if this variant is needed at all.
308     #[allow(dead_code)]
309     Other,
310     Small,
311     Kernel,
312     Medium,
313     Large,
314     None,
315 }
316
317 /// LLVMRustDiagnosticKind
318 #[derive(Copy, Clone)]
319 #[repr(C)]
320 #[allow(dead_code)] // Variants constructed by C++.
321 pub enum DiagnosticKind {
322     Other,
323     InlineAsm,
324     StackSize,
325     DebugMetadataVersion,
326     SampleProfile,
327     OptimizationRemark,
328     OptimizationRemarkMissed,
329     OptimizationRemarkAnalysis,
330     OptimizationRemarkAnalysisFPCommute,
331     OptimizationRemarkAnalysisAliasing,
332     OptimizationRemarkOther,
333     OptimizationFailure,
334     PGOProfile,
335     Linker,
336 }
337
338 /// LLVMRustArchiveKind
339 #[derive(Copy, Clone)]
340 #[repr(C)]
341 pub enum ArchiveKind {
342     // FIXME: figure out if this variant is needed at all.
343     #[allow(dead_code)]
344     Other,
345     K_GNU,
346     K_BSD,
347     K_COFF,
348 }
349
350 /// LLVMRustPassKind
351 #[derive(Copy, Clone, PartialEq, Debug)]
352 #[repr(C)]
353 #[allow(dead_code)] // Variants constructed by C++.
354 pub enum PassKind {
355     Other,
356     Function,
357     Module,
358 }
359
360 /// LLVMRustThinLTOData
361 extern { pub type ThinLTOData; }
362
363 /// LLVMRustThinLTOBuffer
364 extern { pub type ThinLTOBuffer; }
365
366 /// LLVMRustThinLTOModule
367 #[repr(C)]
368 pub struct ThinLTOModule {
369     pub identifier: *const c_char,
370     pub data: *const u8,
371     pub len: usize,
372 }
373
374 /// LLVMThreadLocalMode
375 #[derive(Copy, Clone)]
376 #[repr(C)]
377 pub enum ThreadLocalMode {
378   NotThreadLocal,
379   GeneralDynamic,
380   LocalDynamic,
381   InitialExec,
382   LocalExec
383 }
384
385 extern { type Opaque; }
386 #[repr(C)]
387 struct InvariantOpaque<'a> {
388     _marker: PhantomData<&'a mut &'a ()>,
389     _opaque: Opaque,
390 }
391
392 // Opaque pointer types
393 extern { pub type Module; }
394 extern { pub type Context; }
395 extern { pub type Type; }
396 extern { pub type Value; }
397 extern { pub type Metadata; }
398 extern { pub type BasicBlock; }
399 #[repr(C)]
400 pub struct Builder<'a>(InvariantOpaque<'a>);
401 extern { pub type MemoryBuffer; }
402 #[repr(C)]
403 pub struct PassManager<'a>(InvariantOpaque<'a>);
404 extern { pub type PassManagerBuilder; }
405 extern { pub type ObjectFile; }
406 #[repr(C)]
407 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
408 extern { pub type Pass; }
409 extern { pub type TargetMachine; }
410 extern { pub type Archive; }
411 #[repr(C)]
412 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
413 #[repr(C)]
414 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
415 extern { pub type Twine; }
416 extern { pub type DiagnosticInfo; }
417 extern { pub type SMDiagnostic; }
418 #[repr(C)]
419 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
420 #[repr(C)]
421 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
422 #[repr(C)]
423 pub struct Linker<'a>(InvariantOpaque<'a>);
424
425 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
426 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
427
428
429 pub mod debuginfo {
430     use super::{InvariantOpaque, Metadata};
431
432     #[repr(C)]
433     pub struct DIBuilder<'a>(InvariantOpaque<'a>);
434
435     pub type DIDescriptor = Metadata;
436     pub type DIScope = DIDescriptor;
437     pub type DIFile = DIScope;
438     pub type DILexicalBlock = DIScope;
439     pub type DISubprogram = DIScope;
440     pub type DINameSpace = DIScope;
441     pub type DIType = DIDescriptor;
442     pub type DIBasicType = DIType;
443     pub type DIDerivedType = DIType;
444     pub type DICompositeType = DIDerivedType;
445     pub type DIVariable = DIDescriptor;
446     pub type DIGlobalVariable = DIDescriptor;
447     pub type DIArray = DIDescriptor;
448     pub type DISubrange = DIDescriptor;
449     pub type DIEnumerator = DIDescriptor;
450     pub type DITemplateTypeParameter = DIDescriptor;
451
452     // These values **must** match with LLVMRustDIFlags!!
453     bitflags! {
454         #[repr(C)]
455         #[derive(Default)]
456         pub struct DIFlags: ::libc::uint32_t {
457             const FlagZero                = 0;
458             const FlagPrivate             = 1;
459             const FlagProtected           = 2;
460             const FlagPublic              = 3;
461             const FlagFwdDecl             = (1 << 2);
462             const FlagAppleBlock          = (1 << 3);
463             const FlagBlockByrefStruct    = (1 << 4);
464             const FlagVirtual             = (1 << 5);
465             const FlagArtificial          = (1 << 6);
466             const FlagExplicit            = (1 << 7);
467             const FlagPrototyped          = (1 << 8);
468             const FlagObjcClassComplete   = (1 << 9);
469             const FlagObjectPointer       = (1 << 10);
470             const FlagVector              = (1 << 11);
471             const FlagStaticMember        = (1 << 12);
472             const FlagLValueReference     = (1 << 13);
473             const FlagRValueReference     = (1 << 14);
474             const FlagExternalTypeRef     = (1 << 15);
475             const FlagIntroducedVirtual   = (1 << 18);
476             const FlagBitField            = (1 << 19);
477             const FlagNoReturn            = (1 << 20);
478             const FlagMainSubprogram      = (1 << 21);
479         }
480     }
481 }
482
483 extern { pub type ModuleBuffer; }
484
485 extern "C" {
486     // Create and destroy contexts.
487     pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
488     pub fn LLVMContextDispose(C: &'static mut Context);
489     pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
490
491     // Create modules.
492     pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
493     pub fn LLVMGetModuleContext(M: &Module) -> &Context;
494     pub fn LLVMCloneModule(M: &Module) -> &Module;
495
496     /// Data layout. See Module::getDataLayout.
497     pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
498     pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
499
500     /// See Module::setModuleInlineAsm.
501     pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
502     pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
503
504     /// See llvm::LLVMTypeKind::getTypeID.
505     pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
506
507     // Operations on integer types
508     pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
509     pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
510     pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
511     pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
512     pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
513     pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
514
515     pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
516
517     // Operations on real types
518     pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
519     pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
520
521     // Operations on function types
522     pub fn LLVMFunctionType(ReturnType: &'a Type,
523                             ParamTypes: *const &'a Type,
524                             ParamCount: c_uint,
525                             IsVarArg: Bool)
526                             -> &'a Type;
527     pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
528     pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
529
530     // Operations on struct types
531     pub fn LLVMStructTypeInContext(C: &'a Context,
532                                    ElementTypes: *const &'a Type,
533                                    ElementCount: c_uint,
534                                    Packed: Bool)
535                                    -> &'a Type;
536
537     // Operations on array, pointer, and vector types (sequence types)
538     pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
539     pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
540     pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
541
542     pub fn LLVMGetElementType(Ty: &Type) -> &Type;
543     pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
544
545     // Operations on other types
546     pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
547     pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
548     pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
549
550     // Operations on all values
551     pub fn LLVMTypeOf(Val: &Value) -> &Type;
552     pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
553     pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
554     pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
555     pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
556
557     // Operations on constants of any type
558     pub fn LLVMConstNull(Ty: &Type) -> &Value;
559     pub fn LLVMGetUndef(Ty: &Type) -> &Value;
560
561     // Operations on metadata
562     pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
563     pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
564     pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
565
566     // Operations on scalar constants
567     pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
568     pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
569     pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
570     pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
571                                   high: &mut u64, low: &mut u64) -> bool;
572     pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
573
574
575     // Operations on composite constants
576     pub fn LLVMConstStringInContext(C: &Context,
577                                     Str: *const c_char,
578                                     Length: c_uint,
579                                     DontNullTerminate: Bool)
580                                     -> &Value;
581     pub fn LLVMConstStructInContext(C: &'a Context,
582                                     ConstantVals: *const &'a Value,
583                                     Count: c_uint,
584                                     Packed: Bool)
585                                     -> &'a Value;
586
587     pub fn LLVMConstArray(ElementTy: &'a Type,
588                           ConstantVals: *const &'a Value,
589                           Length: c_uint)
590                           -> &'a Value;
591     pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
592
593     // Constant expressions
594     pub fn LLVMConstInBoundsGEP(
595         ConstantVal: &'a Value,
596         ConstantIndices: *const &'a Value,
597         NumIndices: c_uint,
598     ) -> &'a Value;
599     pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
600     pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
601     pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
602     pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
603     pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
604     pub fn LLVMConstExtractValue(AggConstant: &Value,
605                                  IdxList: *const c_uint,
606                                  NumIdx: c_uint)
607                                  -> &Value;
608
609     // Operations on global variables, functions, and aliases (globals)
610     pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
611     pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
612     pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
613     pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
614     pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
615     pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
616     pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
617     pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
618     pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
619
620
621     // Operations on global variables
622     pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
623     pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
624     pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
625     pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
626     pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
627     pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
628     pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
629     pub fn LLVMDeleteGlobal(GlobalVar: &Value);
630     pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
631     pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
632     pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
633     pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
634     pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
635     pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
636     pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
637     pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
638
639     // Operations on functions
640     pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
641                                        Name: *const c_char,
642                                        FunctionTy: &'a Type)
643                                        -> &'a Value;
644     pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
645     pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
646     pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
647     pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
648     pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
649     pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
650                                               index: c_uint,
651                                               Name: *const c_char,
652                                               Value: *const c_char);
653     pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
654
655     // Operations on parameters
656     pub fn LLVMCountParams(Fn: &Value) -> c_uint;
657     pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
658
659     // Operations on basic blocks
660     pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
661     pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
662                                          Fn: &'a Value,
663                                          Name: *const c_char)
664                                          -> &'a BasicBlock;
665     pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
666
667     // Operations on instructions
668     pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
669
670     // Operations on call sites
671     pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
672     pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
673     pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
674     pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
675     pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
676                                                         index: c_uint,
677                                                         bytes: u64);
678
679     // Operations on load/store instructions (only)
680     pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
681
682     // Operations on phi nodes
683     pub fn LLVMAddIncoming(PhiNode: &'a Value,
684                            IncomingValues: *const &'a Value,
685                            IncomingBlocks: *const &'a BasicBlock,
686                            Count: c_uint);
687
688     // Instruction builders
689     pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
690     pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
691     pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
692     pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
693
694     // Metadata
695     pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
696     pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
697     pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
698
699     // Terminators
700     pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
701     pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
702     pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
703     pub fn LLVMBuildCondBr(B: &Builder<'a>,
704                            If: &'a Value,
705                            Then: &'a BasicBlock,
706                            Else: &'a BasicBlock)
707                            -> &'a Value;
708     pub fn LLVMBuildSwitch(B: &Builder<'a>,
709                            V: &'a Value,
710                            Else: &'a BasicBlock,
711                            NumCases: c_uint)
712                            -> &'a Value;
713     pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
714                                Fn: &'a Value,
715                                Args: *const &'a Value,
716                                NumArgs: c_uint,
717                                Then: &'a BasicBlock,
718                                Catch: &'a BasicBlock,
719                                Bundle: Option<&OperandBundleDef<'a>>,
720                                Name: *const c_char)
721                                -> &'a Value;
722     pub fn LLVMBuildLandingPad(B: &Builder<'a>,
723                                Ty: &'a Type,
724                                PersFn: &'a Value,
725                                NumClauses: c_uint,
726                                Name: *const c_char)
727                                -> &'a Value;
728     pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
729     pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
730
731     pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
732                                    ParentPad: Option<&'a Value>,
733                                    ArgCnt: c_uint,
734                                    Args: *const &'a Value,
735                                    Name: *const c_char)
736                                    -> Option<&'a Value>;
737     pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
738                                    CleanupPad: &'a Value,
739                                    UnwindBB: Option<&'a BasicBlock>)
740                                    -> Option<&'a Value>;
741     pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
742                                  ParentPad: &'a Value,
743                                  ArgCnt: c_uint,
744                                  Args: *const &'a Value,
745                                  Name: *const c_char)
746                                  -> Option<&'a Value>;
747     pub fn LLVMRustBuildCatchRet(
748         B: &Builder<'a>,
749         Pad: &'a Value,
750         BB: &'a BasicBlock,
751     ) -> Option<&'a Value>;
752     pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
753                                     ParentPad: Option<&'a Value>,
754                                     BB: Option<&'a BasicBlock>,
755                                     NumHandlers: c_uint,
756                                     Name: *const c_char)
757                                     -> Option<&'a Value>;
758     pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
759     pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
760
761     // Add a case to the switch instruction
762     pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
763
764     // Add a clause to the landing pad instruction
765     pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
766
767     // Set the cleanup on a landing pad instruction
768     pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
769
770     // Arithmetic
771     pub fn LLVMBuildAdd(B: &Builder<'a>,
772                         LHS: &'a Value,
773                         RHS: &'a Value,
774                         Name: *const c_char)
775                         -> &'a Value;
776     pub fn LLVMBuildFAdd(B: &Builder<'a>,
777                          LHS: &'a Value,
778                          RHS: &'a Value,
779                          Name: *const c_char)
780                          -> &'a Value;
781     pub fn LLVMBuildSub(B: &Builder<'a>,
782                         LHS: &'a Value,
783                         RHS: &'a Value,
784                         Name: *const c_char)
785                         -> &'a Value;
786     pub fn LLVMBuildFSub(B: &Builder<'a>,
787                          LHS: &'a Value,
788                          RHS: &'a Value,
789                          Name: *const c_char)
790                          -> &'a Value;
791     pub fn LLVMBuildMul(B: &Builder<'a>,
792                         LHS: &'a Value,
793                         RHS: &'a Value,
794                         Name: *const c_char)
795                         -> &'a Value;
796     pub fn LLVMBuildFMul(B: &Builder<'a>,
797                          LHS: &'a Value,
798                          RHS: &'a Value,
799                          Name: *const c_char)
800                          -> &'a Value;
801     pub fn LLVMBuildUDiv(B: &Builder<'a>,
802                          LHS: &'a Value,
803                          RHS: &'a Value,
804                          Name: *const c_char)
805                          -> &'a Value;
806     pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
807                               LHS: &'a Value,
808                               RHS: &'a Value,
809                               Name: *const c_char)
810                               -> &'a Value;
811     pub fn LLVMBuildSDiv(B: &Builder<'a>,
812                          LHS: &'a Value,
813                          RHS: &'a Value,
814                          Name: *const c_char)
815                          -> &'a Value;
816     pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
817                               LHS: &'a Value,
818                               RHS: &'a Value,
819                               Name: *const c_char)
820                               -> &'a Value;
821     pub fn LLVMBuildFDiv(B: &Builder<'a>,
822                          LHS: &'a Value,
823                          RHS: &'a Value,
824                          Name: *const c_char)
825                          -> &'a Value;
826     pub fn LLVMBuildURem(B: &Builder<'a>,
827                          LHS: &'a Value,
828                          RHS: &'a Value,
829                          Name: *const c_char)
830                          -> &'a Value;
831     pub fn LLVMBuildSRem(B: &Builder<'a>,
832                          LHS: &'a Value,
833                          RHS: &'a Value,
834                          Name: *const c_char)
835                          -> &'a Value;
836     pub fn LLVMBuildFRem(B: &Builder<'a>,
837                          LHS: &'a Value,
838                          RHS: &'a Value,
839                          Name: *const c_char)
840                          -> &'a Value;
841     pub fn LLVMBuildShl(B: &Builder<'a>,
842                         LHS: &'a Value,
843                         RHS: &'a Value,
844                         Name: *const c_char)
845                         -> &'a Value;
846     pub fn LLVMBuildLShr(B: &Builder<'a>,
847                          LHS: &'a Value,
848                          RHS: &'a Value,
849                          Name: *const c_char)
850                          -> &'a Value;
851     pub fn LLVMBuildAShr(B: &Builder<'a>,
852                          LHS: &'a Value,
853                          RHS: &'a Value,
854                          Name: *const c_char)
855                          -> &'a Value;
856     pub fn LLVMBuildAnd(B: &Builder<'a>,
857                         LHS: &'a Value,
858                         RHS: &'a Value,
859                         Name: *const c_char)
860                         -> &'a Value;
861     pub fn LLVMBuildOr(B: &Builder<'a>,
862                        LHS: &'a Value,
863                        RHS: &'a Value,
864                        Name: *const c_char)
865                        -> &'a Value;
866     pub fn LLVMBuildXor(B: &Builder<'a>,
867                         LHS: &'a Value,
868                         RHS: &'a Value,
869                         Name: *const c_char)
870                         -> &'a Value;
871     pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
872     pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
873     pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
874     pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
875
876     // Memory
877     pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
878     pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
879
880     pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
881
882     pub fn LLVMBuildGEP(B: &Builder<'a>,
883                         Pointer: &'a Value,
884                         Indices: *const &'a Value,
885                         NumIndices: c_uint,
886                         Name: *const c_char)
887                         -> &'a Value;
888     pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
889                                 Pointer: &'a Value,
890                                 Indices: *const &'a Value,
891                                 NumIndices: c_uint,
892                                 Name: *const c_char)
893                                 -> &'a Value;
894     pub fn LLVMBuildStructGEP(B: &Builder<'a>,
895                               Pointer: &'a Value,
896                               Idx: c_uint,
897                               Name: *const c_char)
898                               -> &'a Value;
899
900     // Casts
901     pub fn LLVMBuildTrunc(B: &Builder<'a>,
902                           Val: &'a Value,
903                           DestTy: &'a Type,
904                           Name: *const c_char)
905                           -> &'a Value;
906     pub fn LLVMBuildZExt(B: &Builder<'a>,
907                          Val: &'a Value,
908                          DestTy: &'a Type,
909                          Name: *const c_char)
910                          -> &'a Value;
911     pub fn LLVMBuildSExt(B: &Builder<'a>,
912                          Val: &'a Value,
913                          DestTy: &'a Type,
914                          Name: *const c_char)
915                          -> &'a Value;
916     pub fn LLVMBuildFPToUI(B: &Builder<'a>,
917                            Val: &'a Value,
918                            DestTy: &'a Type,
919                            Name: *const c_char)
920                            -> &'a Value;
921     pub fn LLVMBuildFPToSI(B: &Builder<'a>,
922                            Val: &'a Value,
923                            DestTy: &'a Type,
924                            Name: *const c_char)
925                            -> &'a Value;
926     pub fn LLVMBuildUIToFP(B: &Builder<'a>,
927                            Val: &'a Value,
928                            DestTy: &'a Type,
929                            Name: *const c_char)
930                            -> &'a Value;
931     pub fn LLVMBuildSIToFP(B: &Builder<'a>,
932                            Val: &'a Value,
933                            DestTy: &'a Type,
934                            Name: *const c_char)
935                            -> &'a Value;
936     pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
937                             Val: &'a Value,
938                             DestTy: &'a Type,
939                             Name: *const c_char)
940                             -> &'a Value;
941     pub fn LLVMBuildFPExt(B: &Builder<'a>,
942                           Val: &'a Value,
943                           DestTy: &'a Type,
944                           Name: *const c_char)
945                           -> &'a Value;
946     pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
947                              Val: &'a Value,
948                              DestTy: &'a Type,
949                              Name: *const c_char)
950                              -> &'a Value;
951     pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
952                              Val: &'a Value,
953                              DestTy: &'a Type,
954                              Name: *const c_char)
955                              -> &'a Value;
956     pub fn LLVMBuildBitCast(B: &Builder<'a>,
957                             Val: &'a Value,
958                             DestTy: &'a Type,
959                             Name: *const c_char)
960                             -> &'a Value;
961     pub fn LLVMBuildPointerCast(B: &Builder<'a>,
962                                 Val: &'a Value,
963                                 DestTy: &'a Type,
964                                 Name: *const c_char)
965                                 -> &'a Value;
966     pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
967                                 Val: &'a Value,
968                                 DestTy: &'a Type,
969                                 IsSized: bool)
970                                 -> &'a Value;
971
972     // Comparisons
973     pub fn LLVMBuildICmp(B: &Builder<'a>,
974                          Op: c_uint,
975                          LHS: &'a Value,
976                          RHS: &'a Value,
977                          Name: *const c_char)
978                          -> &'a Value;
979     pub fn LLVMBuildFCmp(B: &Builder<'a>,
980                          Op: c_uint,
981                          LHS: &'a Value,
982                          RHS: &'a Value,
983                          Name: *const c_char)
984                          -> &'a Value;
985
986     // Miscellaneous instructions
987     pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
988     pub fn LLVMRustBuildCall(B: &Builder<'a>,
989                              Fn: &'a Value,
990                              Args: *const &'a Value,
991                              NumArgs: c_uint,
992                              Bundle: Option<&OperandBundleDef<'a>>,
993                              Name: *const c_char)
994                              -> &'a Value;
995     pub fn LLVMBuildSelect(B: &Builder<'a>,
996                            If: &'a Value,
997                            Then: &'a Value,
998                            Else: &'a Value,
999                            Name: *const c_char)
1000                            -> &'a Value;
1001     pub fn LLVMBuildVAArg(B: &Builder<'a>,
1002                           list: &'a Value,
1003                           Ty: &'a Type,
1004                           Name: *const c_char)
1005                           -> &'a Value;
1006     pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1007                                    VecVal: &'a Value,
1008                                    Index: &'a Value,
1009                                    Name: *const c_char)
1010                                    -> &'a Value;
1011     pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1012                                   VecVal: &'a Value,
1013                                   EltVal: &'a Value,
1014                                   Index: &'a Value,
1015                                   Name: *const c_char)
1016                                   -> &'a Value;
1017     pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1018                                   V1: &'a Value,
1019                                   V2: &'a Value,
1020                                   Mask: &'a Value,
1021                                   Name: *const c_char)
1022                                   -> &'a Value;
1023     pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1024                                  AggVal: &'a Value,
1025                                  Index: c_uint,
1026                                  Name: *const c_char)
1027                                  -> &'a Value;
1028     pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1029                                 AggVal: &'a Value,
1030                                 EltVal: &'a Value,
1031                                 Index: c_uint,
1032                                 Name: *const c_char)
1033                                 -> &'a Value;
1034
1035     pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1036                                          Acc: &'a Value,
1037                                          Src: &'a Value)
1038                                          -> Option<&'a Value>;
1039     pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1040                                          Acc: &'a Value,
1041                                          Src: &'a Value)
1042                                          -> Option<&'a Value>;
1043     pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1044                                         Src: &'a Value)
1045                                         -> Option<&'a Value>;
1046     pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1047                                         Src: &'a Value)
1048                                         -> Option<&'a Value>;
1049     pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1050                                         Src: &'a Value)
1051                                         -> Option<&'a Value>;
1052     pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1053                                        Src: &'a Value)
1054                                        -> Option<&'a Value>;
1055     pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1056                                         Src: &'a Value)
1057                                         -> Option<&'a Value>;
1058     pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1059                                         Src: &'a Value,
1060                                         IsSigned: bool)
1061                                         -> Option<&'a Value>;
1062     pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1063                                         Src: &'a Value,
1064                                         IsSigned: bool)
1065                                         -> Option<&'a Value>;
1066     pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1067                                          Src: &'a Value,
1068                                          IsNaN: bool)
1069                                          -> Option<&'a Value>;
1070     pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1071                                          Src: &'a Value,
1072                                          IsNaN: bool)
1073                                          -> Option<&'a Value>;
1074
1075     pub fn LLVMRustBuildMinNum(
1076         B: &Builder<'a>,
1077         LHS: &'a Value,
1078         LHS: &'a Value,
1079     ) -> Option<&'a Value>;
1080     pub fn LLVMRustBuildMaxNum(
1081         B: &Builder<'a>,
1082         LHS: &'a Value,
1083         LHS: &'a Value,
1084     ) -> Option<&'a Value>;
1085
1086     // Atomic Operations
1087     pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1088                                    PointerVal: &'a Value,
1089                                    Name: *const c_char,
1090                                    Order: AtomicOrdering)
1091                                    -> &'a Value;
1092
1093     pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1094                                     Val: &'a Value,
1095                                     Ptr: &'a Value,
1096                                     Order: AtomicOrdering)
1097                                     -> &'a Value;
1098
1099     pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1100                                       LHS: &'a Value,
1101                                       CMP: &'a Value,
1102                                       RHS: &'a Value,
1103                                       Order: AtomicOrdering,
1104                                       FailureOrder: AtomicOrdering,
1105                                       Weak: Bool)
1106                                       -> &'a Value;
1107
1108     pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1109                               Op: AtomicRmwBinOp,
1110                               LHS: &'a Value,
1111                               RHS: &'a Value,
1112                               Order: AtomicOrdering,
1113                               SingleThreaded: Bool)
1114                               -> &'a Value;
1115
1116     pub fn LLVMRustBuildAtomicFence(B: &Builder,
1117                                     Order: AtomicOrdering,
1118                                     Scope: SynchronizationScope);
1119
1120     /// Writes a module to the specified path. Returns 0 on success.
1121     pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1122
1123     /// Creates a pass manager.
1124     pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1125
1126     /// Creates a function-by-function pass manager
1127     pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1128
1129     /// Disposes a pass manager.
1130     pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1131
1132     /// Runs a pass manager on a module.
1133     pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1134
1135     pub fn LLVMInitializePasses();
1136
1137     pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1138     pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1139     pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1140     pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1141     pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1142                                                          threshold: c_uint);
1143     pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1144                                                            PM: &PassManager);
1145
1146     pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1147                                                              PM: &PassManager);
1148     pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1149                                                         PM: &PassManager,
1150                                                         Internalize: Bool,
1151                                                         RunInliner: Bool);
1152     pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1153         PMB: &PassManagerBuilder,
1154         PM: &PassManager) -> bool;
1155
1156     // Stuff that's in rustllvm/ because it's not upstream yet.
1157
1158     /// Opens an object file.
1159     pub fn LLVMCreateObjectFile(
1160         MemBuf: &'static mut MemoryBuffer,
1161     ) -> Option<&'static mut ObjectFile>;
1162     /// Closes an object file.
1163     pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1164
1165     /// Enumerates the sections in an object file.
1166     pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1167     /// Destroys a section iterator.
1168     pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1169     /// Returns true if the section iterator is at the end of the section
1170     /// list:
1171     pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1172     /// Moves the section iterator to point to the next section.
1173     pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1174     /// Returns the current section size.
1175     pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1176     /// Returns the current section contents as a string buffer.
1177     pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1178
1179     /// Reads the given file and returns it as a memory buffer. Use
1180     /// LLVMDisposeMemoryBuffer() to get rid of it.
1181     pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1182         Path: *const c_char,
1183     ) -> Option<&'static mut MemoryBuffer>;
1184
1185     pub fn LLVMStartMultithreaded() -> Bool;
1186
1187     /// Returns a string describing the last error caused by an LLVMRust* call.
1188     pub fn LLVMRustGetLastError() -> *const c_char;
1189
1190     /// Print the pass timings since static dtors aren't picking them up.
1191     pub fn LLVMRustPrintPassTimings();
1192
1193     pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1194
1195     pub fn LLVMStructSetBody(StructTy: &'a Type,
1196                              ElementTypes: *const &'a Type,
1197                              ElementCount: c_uint,
1198                              Packed: Bool);
1199
1200     /// Prepares inline assembly.
1201     pub fn LLVMRustInlineAsm(Ty: &Type,
1202                              AsmString: *const c_char,
1203                              Constraints: *const c_char,
1204                              SideEffects: Bool,
1205                              AlignStack: Bool,
1206                              Dialect: AsmDialect)
1207                              -> &Value;
1208
1209     pub fn LLVMRustDebugMetadataVersion() -> u32;
1210     pub fn LLVMRustVersionMajor() -> u32;
1211     pub fn LLVMRustVersionMinor() -> u32;
1212
1213     pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1214
1215     pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1216
1217     pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1218
1219     pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1220
1221     pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1222
1223     pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1224                                               Lang: c_uint,
1225                                               File: &'a DIFile,
1226                                               Producer: *const c_char,
1227                                               isOptimized: bool,
1228                                               Flags: *const c_char,
1229                                               RuntimeVer: c_uint,
1230                                               SplitName: *const c_char)
1231                                               -> &'a DIDescriptor;
1232
1233     pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1234                                        Filename: *const c_char,
1235                                        Directory: *const c_char)
1236                                        -> &'a DIFile;
1237
1238     pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1239                                                  File: &'a DIFile,
1240                                                  ParameterTypes: &'a DIArray)
1241                                                  -> &'a DICompositeType;
1242
1243     pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1244                                            Scope: &'a DIDescriptor,
1245                                            Name: *const c_char,
1246                                            LinkageName: *const c_char,
1247                                            File: &'a DIFile,
1248                                            LineNo: c_uint,
1249                                            Ty: &'a DIType,
1250                                            isLocalToUnit: bool,
1251                                            isDefinition: bool,
1252                                            ScopeLine: c_uint,
1253                                            Flags: DIFlags,
1254                                            isOptimized: bool,
1255                                            Fn: &'a Value,
1256                                            TParam: &'a DIArray,
1257                                            Decl: Option<&'a DIDescriptor>)
1258                                            -> &'a DISubprogram;
1259
1260     pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1261                                             Name: *const c_char,
1262                                             SizeInBits: u64,
1263                                             AlignInBits: u32,
1264                                             Encoding: c_uint)
1265                                             -> &'a DIBasicType;
1266
1267     pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1268                                               PointeeTy: &'a DIType,
1269                                               SizeInBits: u64,
1270                                               AlignInBits: u32,
1271                                               Name: *const c_char)
1272                                               -> &'a DIDerivedType;
1273
1274     pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1275                                              Scope: Option<&'a DIDescriptor>,
1276                                              Name: *const c_char,
1277                                              File: &'a DIFile,
1278                                              LineNumber: c_uint,
1279                                              SizeInBits: u64,
1280                                              AlignInBits: u32,
1281                                              Flags: DIFlags,
1282                                              DerivedFrom: Option<&'a DIType>,
1283                                              Elements: &'a DIArray,
1284                                              RunTimeLang: c_uint,
1285                                              VTableHolder: Option<&'a DIType>,
1286                                              UniqueId: *const c_char)
1287                                              -> &'a DICompositeType;
1288
1289     pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1290                                              Scope: &'a DIDescriptor,
1291                                              Name: *const c_char,
1292                                              File: &'a DIFile,
1293                                              LineNo: c_uint,
1294                                              SizeInBits: u64,
1295                                              AlignInBits: u32,
1296                                              OffsetInBits: u64,
1297                                              Flags: DIFlags,
1298                                              Ty: &'a DIType)
1299                                              -> &'a DIDerivedType;
1300
1301     pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1302                                                Scope: &'a DIScope,
1303                                                File: &'a DIFile,
1304                                                Line: c_uint,
1305                                                Col: c_uint)
1306                                                -> &'a DILexicalBlock;
1307
1308     pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1309                                                    Scope: &'a DIScope,
1310                                                    File: &'a DIFile)
1311                                                    -> &'a DILexicalBlock;
1312
1313     pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1314                                                  Context: Option<&'a DIScope>,
1315                                                  Name: *const c_char,
1316                                                  LinkageName: *const c_char,
1317                                                  File: &'a DIFile,
1318                                                  LineNo: c_uint,
1319                                                  Ty: &'a DIType,
1320                                                  isLocalToUnit: bool,
1321                                                  Val: &'a Value,
1322                                                  Decl: Option<&'a DIDescriptor>,
1323                                                  AlignInBits: u32)
1324                                                  -> &'a DIGlobalVariable;
1325
1326     pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1327                                            Tag: c_uint,
1328                                            Scope: &'a DIDescriptor,
1329                                            Name: *const c_char,
1330                                            File: &'a DIFile,
1331                                            LineNo: c_uint,
1332                                            Ty: &'a DIType,
1333                                            AlwaysPreserve: bool,
1334                                            Flags: DIFlags,
1335                                            ArgNo: c_uint,
1336                                            AlignInBits: u32)
1337                                            -> &'a DIVariable;
1338
1339     pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1340                                             Size: u64,
1341                                             AlignInBits: u32,
1342                                             Ty: &'a DIType,
1343                                             Subscripts: &'a DIArray)
1344                                             -> &'a DIType;
1345
1346     pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1347                                                 Lo: i64,
1348                                                 Count: i64)
1349                                                 -> &'a DISubrange;
1350
1351     pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1352                                              Ptr: *const Option<&'a DIDescriptor>,
1353                                              Count: c_uint)
1354                                              -> &'a DIArray;
1355
1356     pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1357                                                Val: &'a Value,
1358                                                VarInfo: &'a DIVariable,
1359                                                AddrOps: *const i64,
1360                                                AddrOpsCount: c_uint,
1361                                                DL: &'a Value,
1362                                                InsertAtEnd: &'a BasicBlock)
1363                                                -> &'a Value;
1364
1365     pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1366                                              Name: *const c_char,
1367                                              Val: u64)
1368                                              -> &'a DIEnumerator;
1369
1370     pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1371                                                   Scope: &'a DIScope,
1372                                                   Name: *const c_char,
1373                                                   File: &'a DIFile,
1374                                                   LineNumber: c_uint,
1375                                                   SizeInBits: u64,
1376                                                   AlignInBits: u32,
1377                                                   Elements: &'a DIArray,
1378                                                   ClassType: &'a DIType)
1379                                                   -> &'a DIType;
1380
1381     pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1382                                             Scope: &'a DIScope,
1383                                             Name: *const c_char,
1384                                             File: &'a DIFile,
1385                                             LineNumber: c_uint,
1386                                             SizeInBits: u64,
1387                                             AlignInBits: u32,
1388                                             Flags: DIFlags,
1389                                             Elements: Option<&'a DIArray>,
1390                                             RunTimeLang: c_uint,
1391                                             UniqueId: *const c_char)
1392                                             -> &'a DIType;
1393
1394     pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1395
1396     pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1397                                                         Scope: Option<&'a DIScope>,
1398                                                         Name: *const c_char,
1399                                                         Ty: &'a DIType,
1400                                                         File: &'a DIFile,
1401                                                         LineNo: c_uint,
1402                                                         ColumnNo: c_uint)
1403                                                         -> &'a DITemplateTypeParameter;
1404
1405
1406     pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1407                                             Scope: Option<&'a DIScope>,
1408                                             Name: *const c_char,
1409                                             File: &'a DIFile,
1410                                             LineNo: c_uint)
1411                                             -> &'a DINameSpace;
1412
1413     pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>,
1414                                                CompositeType: &'a DIType,
1415                                                TypeArray: &'a DIArray);
1416
1417
1418     pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1419                                                 Line: c_uint,
1420                                                 Column: c_uint,
1421                                                 Scope: &'a DIScope,
1422                                                 InlinedAt: Option<&'a Metadata>)
1423                                                 -> &'a Value;
1424     pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1425     pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1426 }
1427
1428 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1429 extern "C" {
1430     pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1431     pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1432 }
1433
1434 extern "C" {
1435     pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1436     pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1437
1438     pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1439     pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1440     pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1441
1442     pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1443
1444     pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1445     pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1446
1447     pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1448                                        CPU: *const c_char,
1449                                        Features: *const c_char,
1450                                        Model: CodeModel,
1451                                        Reloc: RelocMode,
1452                                        Level: CodeGenOptLevel,
1453                                        UseSoftFP: bool,
1454                                        PositionIndependentExecutable: bool,
1455                                        FunctionSections: bool,
1456                                        DataSections: bool,
1457                                        TrapUnreachable: bool,
1458                                        Singlethread: bool)
1459                                        -> Option<&'static mut TargetMachine>;
1460     pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1461     pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1462     pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1463                                          M: &'a Module,
1464                                          DisableSimplifyLibCalls: bool);
1465     pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1466                                                OptLevel: CodeGenOptLevel,
1467                                                MergeFunctions: bool,
1468                                                SLPVectorize: bool,
1469                                                LoopVectorize: bool,
1470                                                PrepareForThinLTO: bool,
1471                                                PGOGenPath: *const c_char,
1472                                                PGOUsePath: *const c_char);
1473     pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1474                                   M: &'a Module,
1475                                   DisableSimplifyLibCalls: bool);
1476     pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1477     pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1478                                    PM: &PassManager<'a>,
1479                                    M: &'a Module,
1480                                    Output: *const c_char,
1481                                    FileType: FileType)
1482                                    -> LLVMRustResult;
1483     pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1484                                M: &'a Module,
1485                                Output: *const c_char,
1486                                Demangle: extern fn(*const c_char,
1487                                                    size_t,
1488                                                    *mut c_char,
1489                                                    size_t) -> size_t);
1490     pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1491     pub fn LLVMRustPrintPasses();
1492     pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1493     pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1494     pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1495     pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1496
1497     pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1498     pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1499     pub fn LLVMRustArchiveIteratorNext(
1500         AIR: &ArchiveIterator<'a>,
1501     ) -> Option<&'a mut ArchiveChild<'a>>;
1502     pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1503     pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1504     pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1505     pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1506     pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1507
1508     pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1509 }
1510
1511 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1512 extern "C" {
1513     pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1514 }
1515
1516 extern "C" {
1517     pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1518                                            Handler: DiagnosticHandler,
1519                                            DiagnosticContext: *mut c_void);
1520 }
1521
1522 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1523 extern "C" {
1524     pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1525                                                 pass_name_out: &RustString,
1526                                                 function_out: &mut Option<&'a Value>,
1527                                                 loc_line_out: &mut c_uint,
1528                                                 loc_column_out: &mut c_uint,
1529                                                 loc_filename_out: &RustString,
1530                                                 message_out: &RustString);
1531 }
1532
1533 extern "C" {
1534     pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1535                                              cookie_out: &mut c_uint,
1536                                              message_out: &mut Option<&'a Twine>,
1537                                              instruction_out: &mut Option<&'a Value>);
1538 }
1539
1540 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1541 extern "C" {
1542     pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1543 }
1544
1545 extern "C" {
1546     pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1547
1548     pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1549                                                  H: InlineAsmDiagHandler,
1550                                                  CX: *mut c_void);
1551 }
1552
1553 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1554 extern "C" {
1555     pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1556 }
1557
1558 extern "C" {
1559     pub fn LLVMRustWriteArchive(Dst: *const c_char,
1560                                 NumMembers: size_t,
1561                                 Members: *const &RustArchiveMember,
1562                                 WriteSymbtab: bool,
1563                                 Kind: ArchiveKind)
1564                                 -> LLVMRustResult;
1565     pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1566                                     Name: *const c_char,
1567                                     Child: Option<&'a ArchiveChild>)
1568                                     -> &'a mut RustArchiveMember<'a>;
1569     pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1570
1571     pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1572
1573     pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1574                                          Inputs: *const &'a Value,
1575                                          NumInputs: c_uint)
1576                                          -> &'a mut OperandBundleDef<'a>;
1577     pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1578
1579     pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1580
1581     pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1582     pub fn LLVMRustUnsetComdat(V: &Value);
1583     pub fn LLVMRustSetModulePIELevel(M: &Module);
1584     pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1585     pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1586     pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1587     pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1588     pub fn LLVMRustModuleCost(M: &Module) -> u64;
1589
1590     pub fn LLVMRustThinLTOAvailable() -> bool;
1591     pub fn LLVMRustPGOAvailable() -> bool;
1592     pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1593     pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1594     pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1595     pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1596     pub fn LLVMRustCreateThinLTOData(
1597         Modules: *const ThinLTOModule,
1598         NumModules: c_uint,
1599         PreservedSymbols: *const *const c_char,
1600         PreservedSymbolsLen: c_uint,
1601     ) -> Option<&'static mut ThinLTOData>;
1602     pub fn LLVMRustPrepareThinLTORename(
1603         Data: &ThinLTOData,
1604         Module: &Module,
1605     ) -> bool;
1606     pub fn LLVMRustPrepareThinLTOResolveWeak(
1607         Data: &ThinLTOData,
1608         Module: &Module,
1609     ) -> bool;
1610     pub fn LLVMRustPrepareThinLTOInternalize(
1611         Data: &ThinLTOData,
1612         Module: &Module,
1613     ) -> bool;
1614     pub fn LLVMRustPrepareThinLTOImport(
1615         Data: &ThinLTOData,
1616         Module: &Module,
1617     ) -> bool;
1618     pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1619     pub fn LLVMRustParseBitcodeForThinLTO(
1620         Context: &Context,
1621         Data: *const u8,
1622         len: usize,
1623         Identifier: *const c_char,
1624     ) -> Option<&Module>;
1625     pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1626                                            CU1: &mut *mut c_void,
1627                                            CU2: &mut *mut c_void);
1628     pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1629
1630     pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1631     pub fn LLVMRustLinkerAdd(linker: &Linker,
1632                              bytecode: *const c_char,
1633                              bytecode_len: usize) -> bool;
1634     pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);
1635 }