]> git.lizzy.rs Git - rust.git/blob - src/librustc_llvm/lib.rs
auto merge of #16767 : SiegeLord/rust/reexported_methods, r=cmr
[rust.git] / src / librustc_llvm / lib.rs
1 // Copyright 2012-2014 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 #![allow(non_uppercase_pattern_statics)]
12 #![allow(non_camel_case_types)]
13 #![allow(non_snake_case_functions)]
14 #![allow(dead_code)]
15
16 #![crate_name = "rustc_llvm"]
17 #![experimental]
18 #![license = "MIT/ASL2"]
19 #![crate_type = "dylib"]
20 #![crate_type = "rlib"]
21 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
23        html_root_url = "http://doc.rust-lang.org/")]
24
25 #![feature(globs)]
26 #![feature(link_args)]
27
28 extern crate libc;
29
30 use std::c_str::ToCStr;
31 use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
32 use libc::{c_longlong, c_ulonglong};
33 use debuginfo::{DIBuilderRef, DIDescriptor,
34                 DIFile, DILexicalBlock, DISubprogram, DIType,
35                 DIBasicType, DIDerivedType, DICompositeType,
36                 DIVariable, DIGlobalVariable, DIArray, DISubrange};
37
38 pub mod archive_ro;
39
40 pub type Opcode = u32;
41 pub type Bool = c_uint;
42
43 pub static True: Bool = 1 as Bool;
44 pub static False: Bool = 0 as Bool;
45
46 // Consts for the LLVM CallConv type, pre-cast to uint.
47
48 #[deriving(PartialEq)]
49 pub enum CallConv {
50     CCallConv = 0,
51     FastCallConv = 8,
52     ColdCallConv = 9,
53     X86StdcallCallConv = 64,
54     X86FastcallCallConv = 65,
55     X86_64_Win64 = 79,
56 }
57
58 pub enum Visibility {
59     LLVMDefaultVisibility = 0,
60     HiddenVisibility = 1,
61     ProtectedVisibility = 2,
62 }
63
64 // This enum omits the obsolete (and no-op) linkage types DLLImportLinkage,
65 // DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
66 // LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
67 // they've been removed in upstream LLVM commit r203866.
68 pub enum Linkage {
69     ExternalLinkage = 0,
70     AvailableExternallyLinkage = 1,
71     LinkOnceAnyLinkage = 2,
72     LinkOnceODRLinkage = 3,
73     WeakAnyLinkage = 5,
74     WeakODRLinkage = 6,
75     AppendingLinkage = 7,
76     InternalLinkage = 8,
77     PrivateLinkage = 9,
78     ExternalWeakLinkage = 12,
79     CommonLinkage = 14,
80 }
81
82 #[deriving(Clone)]
83 pub enum Attribute {
84     ZExtAttribute = 1 << 0,
85     SExtAttribute = 1 << 1,
86     NoReturnAttribute = 1 << 2,
87     InRegAttribute = 1 << 3,
88     StructRetAttribute = 1 << 4,
89     NoUnwindAttribute = 1 << 5,
90     NoAliasAttribute = 1 << 6,
91     ByValAttribute = 1 << 7,
92     NestAttribute = 1 << 8,
93     ReadNoneAttribute = 1 << 9,
94     ReadOnlyAttribute = 1 << 10,
95     NoInlineAttribute = 1 << 11,
96     AlwaysInlineAttribute = 1 << 12,
97     OptimizeForSizeAttribute = 1 << 13,
98     StackProtectAttribute = 1 << 14,
99     StackProtectReqAttribute = 1 << 15,
100     AlignmentAttribute = 31 << 16,
101     NoCaptureAttribute = 1 << 21,
102     NoRedZoneAttribute = 1 << 22,
103     NoImplicitFloatAttribute = 1 << 23,
104     NakedAttribute = 1 << 24,
105     InlineHintAttribute = 1 << 25,
106     StackAttribute = 7 << 26,
107     ReturnsTwiceAttribute = 1 << 29,
108     UWTableAttribute = 1 << 30,
109     NonLazyBindAttribute = 1 << 31,
110 }
111
112 #[repr(u64)]
113 pub enum OtherAttribute {
114     // The following are not really exposed in
115     // the LLVM c api so instead to add these
116     // we call a wrapper function in RustWrapper
117     // that uses the C++ api.
118     SanitizeAddressAttribute = 1 << 32,
119     MinSizeAttribute = 1 << 33,
120     NoDuplicateAttribute = 1 << 34,
121     StackProtectStrongAttribute = 1 << 35,
122     SanitizeThreadAttribute = 1 << 36,
123     SanitizeMemoryAttribute = 1 << 37,
124     NoBuiltinAttribute = 1 << 38,
125     ReturnedAttribute = 1 << 39,
126     ColdAttribute = 1 << 40,
127     BuiltinAttribute = 1 << 41,
128     OptimizeNoneAttribute = 1 << 42,
129     InAllocaAttribute = 1 << 43,
130     NonNullAttribute = 1 << 44,
131 }
132
133 pub enum SpecialAttribute {
134     DereferenceableAttribute(u64)
135 }
136
137 #[repr(C)]
138 pub enum AttributeSet {
139     ReturnIndex = 0,
140     FunctionIndex = !0
141 }
142
143 trait AttrHelper {
144     fn apply_llfn(&self, idx: c_uint, llfn: ValueRef);
145     fn apply_callsite(&self, idx: c_uint, callsite: ValueRef);
146 }
147
148 impl AttrHelper for Attribute {
149     fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
150         unsafe {
151             LLVMAddFunctionAttribute(llfn, idx, *self as uint64_t);
152         }
153     }
154
155     fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
156         unsafe {
157             LLVMAddCallSiteAttribute(callsite, idx, *self as uint64_t);
158         }
159     }
160 }
161
162 impl AttrHelper for OtherAttribute {
163     fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
164         unsafe {
165             LLVMAddFunctionAttribute(llfn, idx, *self as uint64_t);
166         }
167     }
168
169     fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
170         unsafe {
171             LLVMAddCallSiteAttribute(callsite, idx, *self as uint64_t);
172         }
173     }
174 }
175
176 impl AttrHelper for SpecialAttribute {
177     fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
178         match *self {
179             DereferenceableAttribute(bytes) => unsafe {
180                 LLVMAddDereferenceableAttr(llfn, idx, bytes as uint64_t);
181             }
182         }
183     }
184
185     fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
186         match *self {
187             DereferenceableAttribute(bytes) => unsafe {
188                 LLVMAddDereferenceableCallSiteAttr(callsite, idx, bytes as uint64_t);
189             }
190         }
191     }
192 }
193
194 pub struct AttrBuilder {
195     attrs: Vec<(uint, Box<AttrHelper+'static>)>
196 }
197
198 impl AttrBuilder {
199     pub fn new() -> AttrBuilder {
200         AttrBuilder {
201             attrs: Vec::new()
202         }
203     }
204
205     pub fn arg<'a, T: AttrHelper + 'static>(&'a mut self, idx: uint, a: T) -> &'a mut AttrBuilder {
206         self.attrs.push((idx, box a as Box<AttrHelper+'static>));
207         self
208     }
209
210     pub fn ret<'a, T: AttrHelper + 'static>(&'a mut self, a: T) -> &'a mut AttrBuilder {
211         self.attrs.push((ReturnIndex as uint, box a as Box<AttrHelper+'static>));
212         self
213     }
214
215     pub fn apply_llfn(&self, llfn: ValueRef) {
216         for &(idx, ref attr) in self.attrs.iter() {
217             attr.apply_llfn(idx as c_uint, llfn);
218         }
219     }
220
221     pub fn apply_callsite(&self, callsite: ValueRef) {
222         for &(idx, ref attr) in self.attrs.iter() {
223             attr.apply_callsite(idx as c_uint, callsite);
224         }
225     }
226 }
227
228 // enum for the LLVM IntPredicate type
229 pub enum IntPredicate {
230     IntEQ = 32,
231     IntNE = 33,
232     IntUGT = 34,
233     IntUGE = 35,
234     IntULT = 36,
235     IntULE = 37,
236     IntSGT = 38,
237     IntSGE = 39,
238     IntSLT = 40,
239     IntSLE = 41,
240 }
241
242 // enum for the LLVM RealPredicate type
243 pub enum RealPredicate {
244     RealPredicateFalse = 0,
245     RealOEQ = 1,
246     RealOGT = 2,
247     RealOGE = 3,
248     RealOLT = 4,
249     RealOLE = 5,
250     RealONE = 6,
251     RealORD = 7,
252     RealUNO = 8,
253     RealUEQ = 9,
254     RealUGT = 10,
255     RealUGE = 11,
256     RealULT = 12,
257     RealULE = 13,
258     RealUNE = 14,
259     RealPredicateTrue = 15,
260 }
261
262 // The LLVM TypeKind type - must stay in sync with the def of
263 // LLVMTypeKind in llvm/include/llvm-c/Core.h
264 #[deriving(PartialEq)]
265 #[repr(C)]
266 pub enum TypeKind {
267     Void      = 0,
268     Half      = 1,
269     Float     = 2,
270     Double    = 3,
271     X86_FP80  = 4,
272     FP128     = 5,
273     PPC_FP128 = 6,
274     Label     = 7,
275     Integer   = 8,
276     Function  = 9,
277     Struct    = 10,
278     Array     = 11,
279     Pointer   = 12,
280     Vector    = 13,
281     Metadata  = 14,
282     X86_MMX   = 15,
283 }
284
285 #[repr(C)]
286 pub enum AtomicBinOp {
287     Xchg = 0,
288     Add  = 1,
289     Sub  = 2,
290     And  = 3,
291     Nand = 4,
292     Or   = 5,
293     Xor  = 6,
294     Max  = 7,
295     Min  = 8,
296     UMax = 9,
297     UMin = 10,
298 }
299
300 #[repr(C)]
301 pub enum AtomicOrdering {
302     NotAtomic = 0,
303     Unordered = 1,
304     Monotonic = 2,
305     // Consume = 3,  // Not specified yet.
306     Acquire = 4,
307     Release = 5,
308     AcquireRelease = 6,
309     SequentiallyConsistent = 7
310 }
311
312 // Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
313 #[repr(C)]
314 pub enum FileType {
315     AssemblyFile = 0,
316     ObjectFile = 1
317 }
318
319 pub enum Metadata {
320     MD_dbg = 0,
321     MD_tbaa = 1,
322     MD_prof = 2,
323     MD_fpmath = 3,
324     MD_range = 4,
325     MD_tbaa_struct = 5
326 }
327
328 // Inline Asm Dialect
329 pub enum AsmDialect {
330     AD_ATT   = 0,
331     AD_Intel = 1
332 }
333
334 #[deriving(PartialEq)]
335 #[repr(C)]
336 pub enum CodeGenOptLevel {
337     CodeGenLevelNone = 0,
338     CodeGenLevelLess = 1,
339     CodeGenLevelDefault = 2,
340     CodeGenLevelAggressive = 3,
341 }
342
343 #[repr(C)]
344 pub enum RelocMode {
345     RelocDefault = 0,
346     RelocStatic = 1,
347     RelocPIC = 2,
348     RelocDynamicNoPic = 3,
349 }
350
351 #[repr(C)]
352 pub enum CodeGenModel {
353     CodeModelDefault = 0,
354     CodeModelJITDefault = 1,
355     CodeModelSmall = 2,
356     CodeModelKernel = 3,
357     CodeModelMedium = 4,
358     CodeModelLarge = 5,
359 }
360
361 // Opaque pointer types
362 pub enum Module_opaque {}
363 pub type ModuleRef = *mut Module_opaque;
364 pub enum Context_opaque {}
365 pub type ContextRef = *mut Context_opaque;
366 pub enum Type_opaque {}
367 pub type TypeRef = *mut Type_opaque;
368 pub enum Value_opaque {}
369 pub type ValueRef = *mut Value_opaque;
370 pub enum BasicBlock_opaque {}
371 pub type BasicBlockRef = *mut BasicBlock_opaque;
372 pub enum Builder_opaque {}
373 pub type BuilderRef = *mut Builder_opaque;
374 pub enum ExecutionEngine_opaque {}
375 pub type ExecutionEngineRef = *mut ExecutionEngine_opaque;
376 pub enum MemoryBuffer_opaque {}
377 pub type MemoryBufferRef = *mut MemoryBuffer_opaque;
378 pub enum PassManager_opaque {}
379 pub type PassManagerRef = *mut PassManager_opaque;
380 pub enum PassManagerBuilder_opaque {}
381 pub type PassManagerBuilderRef = *mut PassManagerBuilder_opaque;
382 pub enum Use_opaque {}
383 pub type UseRef = *mut Use_opaque;
384 pub enum TargetData_opaque {}
385 pub type TargetDataRef = *mut TargetData_opaque;
386 pub enum ObjectFile_opaque {}
387 pub type ObjectFileRef = *mut ObjectFile_opaque;
388 pub enum SectionIterator_opaque {}
389 pub type SectionIteratorRef = *mut SectionIterator_opaque;
390 pub enum Pass_opaque {}
391 pub type PassRef = *mut Pass_opaque;
392 pub enum TargetMachine_opaque {}
393 pub type TargetMachineRef = *mut TargetMachine_opaque;
394 pub enum Archive_opaque {}
395 pub type ArchiveRef = *mut Archive_opaque;
396
397 pub mod debuginfo {
398     use super::{ValueRef};
399
400     pub enum DIBuilder_opaque {}
401     pub type DIBuilderRef = *mut DIBuilder_opaque;
402
403     pub type DIDescriptor = ValueRef;
404     pub type DIScope = DIDescriptor;
405     pub type DILocation = DIDescriptor;
406     pub type DIFile = DIScope;
407     pub type DILexicalBlock = DIScope;
408     pub type DISubprogram = DIScope;
409     pub type DIType = DIDescriptor;
410     pub type DIBasicType = DIType;
411     pub type DIDerivedType = DIType;
412     pub type DICompositeType = DIDerivedType;
413     pub type DIVariable = DIDescriptor;
414     pub type DIGlobalVariable = DIDescriptor;
415     pub type DIArray = DIDescriptor;
416     pub type DISubrange = DIDescriptor;
417
418     pub enum DIDescriptorFlags {
419       FlagPrivate            = 1 << 0,
420       FlagProtected          = 1 << 1,
421       FlagFwdDecl            = 1 << 2,
422       FlagAppleBlock         = 1 << 3,
423       FlagBlockByrefStruct   = 1 << 4,
424       FlagVirtual            = 1 << 5,
425       FlagArtificial         = 1 << 6,
426       FlagExplicit           = 1 << 7,
427       FlagPrototyped         = 1 << 8,
428       FlagObjcClassComplete  = 1 << 9,
429       FlagObjectPointer      = 1 << 10,
430       FlagVector             = 1 << 11,
431       FlagStaticMember       = 1 << 12
432     }
433 }
434
435
436 // Link to our native llvm bindings (things that we need to use the C++ api
437 // for) and because llvm is written in C++ we need to link against libstdc++
438 //
439 // You'll probably notice that there is an omission of all LLVM libraries
440 // from this location. This is because the set of LLVM libraries that we
441 // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
442 // figure out the exact set of libraries. To do this, the build system
443 // generates an llvmdeps.rs file next to this one which will be
444 // automatically updated whenever LLVM is updated to include an up-to-date
445 // set of the libraries we need to link to LLVM for.
446 #[link(name = "rustllvm", kind = "static")]
447 extern {
448     /* Create and destroy contexts. */
449     pub fn LLVMContextCreate() -> ContextRef;
450     pub fn LLVMContextDispose(C: ContextRef);
451     pub fn LLVMGetMDKindIDInContext(C: ContextRef,
452                                     Name: *const c_char,
453                                     SLen: c_uint)
454                                     -> c_uint;
455
456     /* Create and destroy modules. */
457     pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char,
458                                              C: ContextRef)
459                                              -> ModuleRef;
460     pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
461     pub fn LLVMDisposeModule(M: ModuleRef);
462
463     /** Data layout. See Module::getDataLayout. */
464     pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
465     pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
466
467     /** Target triple. See Module::getTargetTriple. */
468     pub fn LLVMGetTarget(M: ModuleRef) -> *const c_char;
469     pub fn LLVMSetTarget(M: ModuleRef, Triple: *const c_char);
470
471     /** See Module::dump. */
472     pub fn LLVMDumpModule(M: ModuleRef);
473
474     /** See Module::setModuleInlineAsm. */
475     pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
476
477     /** See llvm::LLVMTypeKind::getTypeID. */
478     pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
479
480     /** See llvm::LLVMType::getContext. */
481     pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
482
483     /* Operations on integer types */
484     pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
485     pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
486     pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
487     pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
488     pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
489     pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
490                                 -> TypeRef;
491
492     pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
493
494     /* Operations on real types */
495     pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
496     pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
497     pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
498     pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
499     pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
500
501     /* Operations on function types */
502     pub fn LLVMFunctionType(ReturnType: TypeRef,
503                             ParamTypes: *const TypeRef,
504                             ParamCount: c_uint,
505                             IsVarArg: Bool)
506                             -> TypeRef;
507     pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
508     pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
509     pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
510     pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *const TypeRef);
511
512     /* Operations on struct types */
513     pub fn LLVMStructTypeInContext(C: ContextRef,
514                                    ElementTypes: *const TypeRef,
515                                    ElementCount: c_uint,
516                                    Packed: Bool)
517                                    -> TypeRef;
518     pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
519     pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
520                                      Dest: *mut TypeRef);
521     pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
522
523     /* Operations on array, pointer, and vector types (sequence types) */
524     pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
525     pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
526                            -> TypeRef;
527     pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
528                           -> TypeRef;
529
530     pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
531     pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
532     pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
533     pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
534                                   -> *const ();
535     pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
536
537     /* Operations on other types */
538     pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
539     pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
540     pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
541
542     /* Operations on all values */
543     pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
544     pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
545     pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
546     pub fn LLVMDumpValue(Val: ValueRef);
547     pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
548     pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
549     pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
550     pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
551
552     /* Operations on Uses */
553     pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
554     pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
555     pub fn LLVMGetUser(U: UseRef) -> ValueRef;
556     pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
557
558     /* Operations on Users */
559     pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
560     pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
561     pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
562
563     /* Operations on constants of any type */
564     pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
565     /* all zeroes */
566     pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
567     pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
568                          -> ValueRef;
569     pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
570                          -> ValueRef;
571     /* only for int/vector */
572     pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
573     pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
574     pub fn LLVMIsNull(Val: ValueRef) -> Bool;
575     pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
576     pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
577
578     /* Operations on metadata */
579     pub fn LLVMMDStringInContext(C: ContextRef,
580                                  Str: *const c_char,
581                                  SLen: c_uint)
582                                  -> ValueRef;
583     pub fn LLVMMDNodeInContext(C: ContextRef,
584                                Vals: *const ValueRef,
585                                Count: c_uint)
586                                -> ValueRef;
587     pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
588                                        Str: *const c_char,
589                                        Val: ValueRef);
590
591     /* Operations on scalar constants */
592     pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
593                         -> ValueRef;
594     pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *const c_char, Radix: u8)
595                                 -> ValueRef;
596     pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
597                                        Text: *const c_char,
598                                        SLen: c_uint,
599                                        Radix: u8)
600                                        -> ValueRef;
601     pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
602     pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *const c_char)
603                                  -> ValueRef;
604     pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
605                                         Text: *const c_char,
606                                         SLen: c_uint)
607                                         -> ValueRef;
608     pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
609     pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
610
611
612     /* Operations on composite constants */
613     pub fn LLVMConstStringInContext(C: ContextRef,
614                                     Str: *const c_char,
615                                     Length: c_uint,
616                                     DontNullTerminate: Bool)
617                                     -> ValueRef;
618     pub fn LLVMConstStructInContext(C: ContextRef,
619                                     ConstantVals: *const ValueRef,
620                                     Count: c_uint,
621                                     Packed: Bool)
622                                     -> ValueRef;
623
624     pub fn LLVMConstArray(ElementTy: TypeRef,
625                           ConstantVals: *const ValueRef,
626                           Length: c_uint)
627                           -> ValueRef;
628     pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint)
629                            -> ValueRef;
630
631     /* Constant expressions */
632     pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
633     pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
634     pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
635     pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
636     pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
637     pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
638     pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
639     pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
640                         -> ValueRef;
641     pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
642                            -> ValueRef;
643     pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
644                            -> ValueRef;
645     pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
646                          -> ValueRef;
647     pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
648                         -> ValueRef;
649     pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
650                            -> ValueRef;
651     pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
652                            -> ValueRef;
653     pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
654                          -> ValueRef;
655     pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
656                         -> ValueRef;
657     pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
658                            -> ValueRef;
659     pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
660                            -> ValueRef;
661     pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
662                          -> ValueRef;
663     pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
664                          -> ValueRef;
665     pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
666                          -> ValueRef;
667     pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
668                               RHSConstant: ValueRef)
669                               -> ValueRef;
670     pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
671                          -> ValueRef;
672     pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
673                          -> ValueRef;
674     pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
675                          -> ValueRef;
676     pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
677                          -> ValueRef;
678     pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef)
679                         -> ValueRef;
680     pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
681                        -> ValueRef;
682     pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef)
683                         -> ValueRef;
684     pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
685                         -> ValueRef;
686     pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
687                          -> ValueRef;
688     pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
689                          -> ValueRef;
690     pub fn LLVMConstGEP(ConstantVal: ValueRef,
691                         ConstantIndices: *const ValueRef,
692                         NumIndices: c_uint)
693                         -> ValueRef;
694     pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
695                                 ConstantIndices: *const ValueRef,
696                                 NumIndices: c_uint)
697                                 -> ValueRef;
698     pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
699                           -> ValueRef;
700     pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
701                          -> ValueRef;
702     pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef)
703                          -> ValueRef;
704     pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
705                             -> ValueRef;
706     pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef)
707                           -> ValueRef;
708     pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
709                            -> ValueRef;
710     pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef)
711                            -> ValueRef;
712     pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
713                            -> ValueRef;
714     pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef)
715                            -> ValueRef;
716     pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
717                              -> ValueRef;
718     pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef)
719                              -> ValueRef;
720     pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
721                             -> ValueRef;
722     pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
723                                   -> ValueRef;
724     pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
725                                   -> ValueRef;
726     pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
727                                    -> ValueRef;
728     pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
729                                 -> ValueRef;
730     pub fn LLVMConstIntCast(ConstantVal: ValueRef,
731                             ToType: TypeRef,
732                             isSigned: Bool)
733                             -> ValueRef;
734     pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
735                            -> ValueRef;
736     pub fn LLVMConstSelect(ConstantCondition: ValueRef,
737                            ConstantIfTrue: ValueRef,
738                            ConstantIfFalse: ValueRef)
739                            -> ValueRef;
740     pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
741                                    IndexConstant: ValueRef)
742                                    -> ValueRef;
743     pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
744                                   ElementValueConstant: ValueRef,
745                                   IndexConstant: ValueRef)
746                                   -> ValueRef;
747     pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
748                                   VectorBConstant: ValueRef,
749                                   MaskConstant: ValueRef)
750                                   -> ValueRef;
751     pub fn LLVMConstExtractValue(AggConstant: ValueRef,
752                                  IdxList: *const c_uint,
753                                  NumIdx: c_uint)
754                                  -> ValueRef;
755     pub fn LLVMConstInsertValue(AggConstant: ValueRef,
756                                 ElementValueConstant: ValueRef,
757                                 IdxList: *const c_uint,
758                                 NumIdx: c_uint)
759                                 -> ValueRef;
760     pub fn LLVMConstInlineAsm(Ty: TypeRef,
761                               AsmString: *const c_char,
762                               Constraints: *const c_char,
763                               HasSideEffects: Bool,
764                               IsAlignStack: Bool)
765                               -> ValueRef;
766     pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
767
768
769
770     /* Operations on global variables, functions, and aliases (globals) */
771     pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
772     pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
773     pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
774     pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
775     pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
776     pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
777     pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
778     pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
779     pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
780     pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
781
782
783     /* Operations on global variables */
784     pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char)
785                          -> ValueRef;
786     pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
787                                        Ty: TypeRef,
788                                        Name: *const c_char,
789                                        AddressSpace: c_uint)
790                                        -> ValueRef;
791     pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
792     pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
793     pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
794     pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
795     pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
796     pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
797     pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
798     pub fn LLVMSetInitializer(GlobalVar: ValueRef,
799                               ConstantVal: ValueRef);
800     pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
801     pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
802     pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
803     pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
804
805     /* Operations on aliases */
806     pub fn LLVMAddAlias(M: ModuleRef,
807                         Ty: TypeRef,
808                         Aliasee: ValueRef,
809                         Name: *const c_char)
810                         -> ValueRef;
811
812     /* Operations on functions */
813     pub fn LLVMAddFunction(M: ModuleRef,
814                            Name: *const c_char,
815                            FunctionTy: TypeRef)
816                            -> ValueRef;
817     pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
818     pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
819     pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
820     pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
821     pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
822     pub fn LLVMDeleteFunction(Fn: ValueRef);
823     pub fn LLVMGetOrInsertFunction(M: ModuleRef,
824                                    Name: *const c_char,
825                                    FunctionTy: TypeRef)
826                                    -> ValueRef;
827     pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
828     pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
829     pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
830     pub fn LLVMGetGC(Fn: ValueRef) -> *const c_char;
831     pub fn LLVMSetGC(Fn: ValueRef, Name: *const c_char);
832     pub fn LLVMAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: uint64_t);
833     pub fn LLVMAddFunctionAttribute(Fn: ValueRef, index: c_uint, PA: uint64_t);
834     pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
835     pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
836     pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
837
838     /* Operations on parameters */
839     pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
840     pub fn LLVMGetParams(Fn: ValueRef, Params: *const ValueRef);
841     pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
842     pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
843     pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
844     pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
845     pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
846     pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
847     pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
848     pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
849     pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
850     pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
851
852     /* Operations on basic blocks */
853     pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
854     pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
855     pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
856     pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
857     pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
858     pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *const ValueRef);
859     pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
860     pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
861     pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
862     pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
863     pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
864
865     pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
866                                          Fn: ValueRef,
867                                          Name: *const c_char)
868                                          -> BasicBlockRef;
869     pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
870                                          BB: BasicBlockRef,
871                                          Name: *const c_char)
872                                          -> BasicBlockRef;
873     pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
874
875     pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
876                                    MoveAfter: BasicBlockRef);
877
878     pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef,
879                                     MoveBefore: BasicBlockRef);
880
881     /* Operations on instructions */
882     pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
883     pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
884     pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
885     pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
886     pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
887     pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
888
889     /* Operations on call sites */
890     pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
891     pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
892     pub fn LLVMAddInstrAttribute(Instr: ValueRef,
893                                  index: c_uint,
894                                  IA: c_uint);
895     pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
896                                     index: c_uint,
897                                     IA: c_uint);
898     pub fn LLVMSetInstrParamAlignment(Instr: ValueRef,
899                                       index: c_uint,
900                                       align: c_uint);
901     pub fn LLVMAddCallSiteAttribute(Instr: ValueRef,
902                                     index: c_uint,
903                                     Val: uint64_t);
904     pub fn LLVMAddDereferenceableCallSiteAttr(Instr: ValueRef,
905                                               index: c_uint,
906                                               bytes: uint64_t);
907
908     /* Operations on call instructions (only) */
909     pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
910     pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
911
912     /* Operations on load/store instructions (only) */
913     pub fn LLVMGetVolatile(MemoryAccessInst: ValueRef) -> Bool;
914     pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
915
916     /* Operations on phi nodes */
917     pub fn LLVMAddIncoming(PhiNode: ValueRef,
918                            IncomingValues: *const ValueRef,
919                            IncomingBlocks: *const BasicBlockRef,
920                            Count: c_uint);
921     pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
922     pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
923                                 -> ValueRef;
924     pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint)
925                                 -> BasicBlockRef;
926
927     /* Instruction builders */
928     pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
929     pub fn LLVMPositionBuilder(Builder: BuilderRef,
930                                Block: BasicBlockRef,
931                                Instr: ValueRef);
932     pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
933                                      Instr: ValueRef);
934     pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
935                                     Block: BasicBlockRef);
936     pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
937     pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
938     pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
939     pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
940                                          Instr: ValueRef,
941                                          Name: *const c_char);
942     pub fn LLVMDisposeBuilder(Builder: BuilderRef);
943     pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
944
945     /* Metadata */
946     pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
947     pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
948     pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
949
950     /* Terminators */
951     pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
952     pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
953     pub fn LLVMBuildAggregateRet(B: BuilderRef,
954                                  RetVals: *const ValueRef,
955                                  N: c_uint)
956                                  -> ValueRef;
957     pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
958     pub fn LLVMBuildCondBr(B: BuilderRef,
959                            If: ValueRef,
960                            Then: BasicBlockRef,
961                            Else: BasicBlockRef)
962                            -> ValueRef;
963     pub fn LLVMBuildSwitch(B: BuilderRef,
964                            V: ValueRef,
965                            Else: BasicBlockRef,
966                            NumCases: c_uint)
967                            -> ValueRef;
968     pub fn LLVMBuildIndirectBr(B: BuilderRef,
969                                Addr: ValueRef,
970                                NumDests: c_uint)
971                                -> ValueRef;
972     pub fn LLVMBuildInvoke(B: BuilderRef,
973                            Fn: ValueRef,
974                            Args: *const ValueRef,
975                            NumArgs: c_uint,
976                            Then: BasicBlockRef,
977                            Catch: BasicBlockRef,
978                            Name: *const c_char)
979                            -> ValueRef;
980     pub fn LLVMBuildLandingPad(B: BuilderRef,
981                                Ty: TypeRef,
982                                PersFn: ValueRef,
983                                NumClauses: c_uint,
984                                Name: *const c_char)
985                                -> ValueRef;
986     pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
987     pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
988
989     /* Add a case to the switch instruction */
990     pub fn LLVMAddCase(Switch: ValueRef,
991                        OnVal: ValueRef,
992                        Dest: BasicBlockRef);
993
994     /* Add a destination to the indirectbr instruction */
995     pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
996
997     /* Add a clause to the landing pad instruction */
998     pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
999
1000     /* Set the cleanup on a landing pad instruction */
1001     pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
1002
1003     /* Arithmetic */
1004     pub fn LLVMBuildAdd(B: BuilderRef,
1005                         LHS: ValueRef,
1006                         RHS: ValueRef,
1007                         Name: *const c_char)
1008                         -> ValueRef;
1009     pub fn LLVMBuildNSWAdd(B: BuilderRef,
1010                            LHS: ValueRef,
1011                            RHS: ValueRef,
1012                            Name: *const c_char)
1013                            -> ValueRef;
1014     pub fn LLVMBuildNUWAdd(B: BuilderRef,
1015                            LHS: ValueRef,
1016                            RHS: ValueRef,
1017                            Name: *const c_char)
1018                            -> ValueRef;
1019     pub fn LLVMBuildFAdd(B: BuilderRef,
1020                          LHS: ValueRef,
1021                          RHS: ValueRef,
1022                          Name: *const c_char)
1023                          -> ValueRef;
1024     pub fn LLVMBuildSub(B: BuilderRef,
1025                         LHS: ValueRef,
1026                         RHS: ValueRef,
1027                         Name: *const c_char)
1028                         -> ValueRef;
1029     pub fn LLVMBuildNSWSub(B: BuilderRef,
1030                            LHS: ValueRef,
1031                            RHS: ValueRef,
1032                            Name: *const c_char)
1033                            -> ValueRef;
1034     pub fn LLVMBuildNUWSub(B: BuilderRef,
1035                            LHS: ValueRef,
1036                            RHS: ValueRef,
1037                            Name: *const c_char)
1038                            -> ValueRef;
1039     pub fn LLVMBuildFSub(B: BuilderRef,
1040                          LHS: ValueRef,
1041                          RHS: ValueRef,
1042                          Name: *const c_char)
1043                          -> ValueRef;
1044     pub fn LLVMBuildMul(B: BuilderRef,
1045                         LHS: ValueRef,
1046                         RHS: ValueRef,
1047                         Name: *const c_char)
1048                         -> ValueRef;
1049     pub fn LLVMBuildNSWMul(B: BuilderRef,
1050                            LHS: ValueRef,
1051                            RHS: ValueRef,
1052                            Name: *const c_char)
1053                            -> ValueRef;
1054     pub fn LLVMBuildNUWMul(B: BuilderRef,
1055                            LHS: ValueRef,
1056                            RHS: ValueRef,
1057                            Name: *const c_char)
1058                            -> ValueRef;
1059     pub fn LLVMBuildFMul(B: BuilderRef,
1060                          LHS: ValueRef,
1061                          RHS: ValueRef,
1062                          Name: *const c_char)
1063                          -> ValueRef;
1064     pub fn LLVMBuildUDiv(B: BuilderRef,
1065                          LHS: ValueRef,
1066                          RHS: ValueRef,
1067                          Name: *const c_char)
1068                          -> ValueRef;
1069     pub fn LLVMBuildSDiv(B: BuilderRef,
1070                          LHS: ValueRef,
1071                          RHS: ValueRef,
1072                          Name: *const c_char)
1073                          -> ValueRef;
1074     pub fn LLVMBuildExactSDiv(B: BuilderRef,
1075                               LHS: ValueRef,
1076                               RHS: ValueRef,
1077                               Name: *const c_char)
1078                               -> ValueRef;
1079     pub fn LLVMBuildFDiv(B: BuilderRef,
1080                          LHS: ValueRef,
1081                          RHS: ValueRef,
1082                          Name: *const c_char)
1083                          -> ValueRef;
1084     pub fn LLVMBuildURem(B: BuilderRef,
1085                          LHS: ValueRef,
1086                          RHS: ValueRef,
1087                          Name: *const c_char)
1088                          -> ValueRef;
1089     pub fn LLVMBuildSRem(B: BuilderRef,
1090                          LHS: ValueRef,
1091                          RHS: ValueRef,
1092                          Name: *const c_char)
1093                          -> ValueRef;
1094     pub fn LLVMBuildFRem(B: BuilderRef,
1095                          LHS: ValueRef,
1096                          RHS: ValueRef,
1097                          Name: *const c_char)
1098                          -> ValueRef;
1099     pub fn LLVMBuildShl(B: BuilderRef,
1100                         LHS: ValueRef,
1101                         RHS: ValueRef,
1102                         Name: *const c_char)
1103                         -> ValueRef;
1104     pub fn LLVMBuildLShr(B: BuilderRef,
1105                          LHS: ValueRef,
1106                          RHS: ValueRef,
1107                          Name: *const c_char)
1108                          -> ValueRef;
1109     pub fn LLVMBuildAShr(B: BuilderRef,
1110                          LHS: ValueRef,
1111                          RHS: ValueRef,
1112                          Name: *const c_char)
1113                          -> ValueRef;
1114     pub fn LLVMBuildAnd(B: BuilderRef,
1115                         LHS: ValueRef,
1116                         RHS: ValueRef,
1117                         Name: *const c_char)
1118                         -> ValueRef;
1119     pub fn LLVMBuildOr(B: BuilderRef,
1120                        LHS: ValueRef,
1121                        RHS: ValueRef,
1122                        Name: *const c_char)
1123                            -> ValueRef;
1124     pub fn LLVMBuildXor(B: BuilderRef,
1125                         LHS: ValueRef,
1126                         RHS: ValueRef,
1127                         Name: *const c_char)
1128                         -> ValueRef;
1129     pub fn LLVMBuildBinOp(B: BuilderRef,
1130                           Op: Opcode,
1131                           LHS: ValueRef,
1132                           RHS: ValueRef,
1133                           Name: *const c_char)
1134                           -> ValueRef;
1135     pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1136                         -> ValueRef;
1137     pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1138                            -> ValueRef;
1139     pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1140                            -> ValueRef;
1141     pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1142                          -> ValueRef;
1143     pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char)
1144                         -> ValueRef;
1145
1146     /* Memory */
1147     pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1148                            -> ValueRef;
1149     pub fn LLVMBuildArrayMalloc(B: BuilderRef,
1150                                 Ty: TypeRef,
1151                                 Val: ValueRef,
1152                                 Name: *const c_char)
1153                                 -> ValueRef;
1154     pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1155                            -> ValueRef;
1156     pub fn LLVMBuildArrayAlloca(B: BuilderRef,
1157                                 Ty: TypeRef,
1158                                 Val: ValueRef,
1159                                 Name: *const c_char)
1160                                 -> ValueRef;
1161     pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
1162     pub fn LLVMBuildLoad(B: BuilderRef,
1163                          PointerVal: ValueRef,
1164                          Name: *const c_char)
1165                          -> ValueRef;
1166
1167     pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
1168                           -> ValueRef;
1169
1170     pub fn LLVMBuildGEP(B: BuilderRef,
1171                         Pointer: ValueRef,
1172                         Indices: *const ValueRef,
1173                         NumIndices: c_uint,
1174                         Name: *const c_char)
1175                         -> ValueRef;
1176     pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
1177                                 Pointer: ValueRef,
1178                                 Indices: *const ValueRef,
1179                                 NumIndices: c_uint,
1180                                 Name: *const c_char)
1181                                 -> ValueRef;
1182     pub fn LLVMBuildStructGEP(B: BuilderRef,
1183                               Pointer: ValueRef,
1184                               Idx: c_uint,
1185                               Name: *const c_char)
1186                               -> ValueRef;
1187     pub fn LLVMBuildGlobalString(B: BuilderRef,
1188                                  Str: *const c_char,
1189                                  Name: *const c_char)
1190                                  -> ValueRef;
1191     pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1192                                     Str: *const c_char,
1193                                     Name: *const c_char)
1194                                     -> ValueRef;
1195
1196     /* Casts */
1197     pub fn LLVMBuildTrunc(B: BuilderRef,
1198                           Val: ValueRef,
1199                           DestTy: TypeRef,
1200                           Name: *const c_char)
1201                           -> ValueRef;
1202     pub fn LLVMBuildZExt(B: BuilderRef,
1203                          Val: ValueRef,
1204                          DestTy: TypeRef,
1205                          Name: *const c_char)
1206                          -> ValueRef;
1207     pub fn LLVMBuildSExt(B: BuilderRef,
1208                          Val: ValueRef,
1209                          DestTy: TypeRef,
1210                          Name: *const c_char)
1211                          -> ValueRef;
1212     pub fn LLVMBuildFPToUI(B: BuilderRef,
1213                            Val: ValueRef,
1214                            DestTy: TypeRef,
1215                            Name: *const c_char)
1216                            -> ValueRef;
1217     pub fn LLVMBuildFPToSI(B: BuilderRef,
1218                            Val: ValueRef,
1219                            DestTy: TypeRef,
1220                            Name: *const c_char)
1221                            -> ValueRef;
1222     pub fn LLVMBuildUIToFP(B: BuilderRef,
1223                            Val: ValueRef,
1224                            DestTy: TypeRef,
1225                            Name: *const c_char)
1226                            -> ValueRef;
1227     pub fn LLVMBuildSIToFP(B: BuilderRef,
1228                            Val: ValueRef,
1229                            DestTy: TypeRef,
1230                            Name: *const c_char)
1231                            -> ValueRef;
1232     pub fn LLVMBuildFPTrunc(B: BuilderRef,
1233                             Val: ValueRef,
1234                             DestTy: TypeRef,
1235                             Name: *const c_char)
1236                             -> ValueRef;
1237     pub fn LLVMBuildFPExt(B: BuilderRef,
1238                           Val: ValueRef,
1239                           DestTy: TypeRef,
1240                           Name: *const c_char)
1241                           -> ValueRef;
1242     pub fn LLVMBuildPtrToInt(B: BuilderRef,
1243                              Val: ValueRef,
1244                              DestTy: TypeRef,
1245                              Name: *const c_char)
1246                              -> ValueRef;
1247     pub fn LLVMBuildIntToPtr(B: BuilderRef,
1248                              Val: ValueRef,
1249                              DestTy: TypeRef,
1250                              Name: *const c_char)
1251                              -> ValueRef;
1252     pub fn LLVMBuildBitCast(B: BuilderRef,
1253                             Val: ValueRef,
1254                             DestTy: TypeRef,
1255                             Name: *const c_char)
1256                             -> ValueRef;
1257     pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1258                                   Val: ValueRef,
1259                                   DestTy: TypeRef,
1260                                   Name: *const c_char)
1261                                   -> ValueRef;
1262     pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1263                                   Val: ValueRef,
1264                                   DestTy: TypeRef,
1265                                   Name: *const c_char)
1266                                   -> ValueRef;
1267     pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1268                                    Val: ValueRef,
1269                                    DestTy: TypeRef,
1270                                    Name: *const c_char)
1271                                    -> ValueRef;
1272     pub fn LLVMBuildCast(B: BuilderRef,
1273                          Op: Opcode,
1274                          Val: ValueRef,
1275                          DestTy: TypeRef,
1276                          Name: *const c_char) -> ValueRef;
1277     pub fn LLVMBuildPointerCast(B: BuilderRef,
1278                                 Val: ValueRef,
1279                                 DestTy: TypeRef,
1280                                 Name: *const c_char)
1281                                 -> ValueRef;
1282     pub fn LLVMBuildIntCast(B: BuilderRef,
1283                             Val: ValueRef,
1284                             DestTy: TypeRef,
1285                             Name: *const c_char)
1286                             -> ValueRef;
1287     pub fn LLVMBuildFPCast(B: BuilderRef,
1288                            Val: ValueRef,
1289                            DestTy: TypeRef,
1290                            Name: *const c_char)
1291                            -> ValueRef;
1292
1293     /* Comparisons */
1294     pub fn LLVMBuildICmp(B: BuilderRef,
1295                          Op: c_uint,
1296                          LHS: ValueRef,
1297                          RHS: ValueRef,
1298                          Name: *const c_char)
1299                          -> ValueRef;
1300     pub fn LLVMBuildFCmp(B: BuilderRef,
1301                          Op: c_uint,
1302                          LHS: ValueRef,
1303                          RHS: ValueRef,
1304                          Name: *const c_char)
1305                          -> ValueRef;
1306
1307     /* Miscellaneous instructions */
1308     pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1309                         -> ValueRef;
1310     pub fn LLVMBuildCall(B: BuilderRef,
1311                          Fn: ValueRef,
1312                          Args: *const ValueRef,
1313                          NumArgs: c_uint,
1314                          Name: *const c_char)
1315                          -> ValueRef;
1316     pub fn LLVMBuildSelect(B: BuilderRef,
1317                            If: ValueRef,
1318                            Then: ValueRef,
1319                            Else: ValueRef,
1320                            Name: *const c_char)
1321                            -> ValueRef;
1322     pub fn LLVMBuildVAArg(B: BuilderRef,
1323                           list: ValueRef,
1324                           Ty: TypeRef,
1325                           Name: *const c_char)
1326                           -> ValueRef;
1327     pub fn LLVMBuildExtractElement(B: BuilderRef,
1328                                    VecVal: ValueRef,
1329                                    Index: ValueRef,
1330                                    Name: *const c_char)
1331                                    -> ValueRef;
1332     pub fn LLVMBuildInsertElement(B: BuilderRef,
1333                                   VecVal: ValueRef,
1334                                   EltVal: ValueRef,
1335                                   Index: ValueRef,
1336                                   Name: *const c_char)
1337                                   -> ValueRef;
1338     pub fn LLVMBuildShuffleVector(B: BuilderRef,
1339                                   V1: ValueRef,
1340                                   V2: ValueRef,
1341                                   Mask: ValueRef,
1342                                   Name: *const c_char)
1343                                   -> ValueRef;
1344     pub fn LLVMBuildExtractValue(B: BuilderRef,
1345                                  AggVal: ValueRef,
1346                                  Index: c_uint,
1347                                  Name: *const c_char)
1348                                  -> ValueRef;
1349     pub fn LLVMBuildInsertValue(B: BuilderRef,
1350                                 AggVal: ValueRef,
1351                                 EltVal: ValueRef,
1352                                 Index: c_uint,
1353                                 Name: *const c_char)
1354                                 -> ValueRef;
1355
1356     pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
1357                            -> ValueRef;
1358     pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
1359                               -> ValueRef;
1360     pub fn LLVMBuildPtrDiff(B: BuilderRef,
1361                             LHS: ValueRef,
1362                             RHS: ValueRef,
1363                             Name: *const c_char)
1364                             -> ValueRef;
1365
1366     /* Atomic Operations */
1367     pub fn LLVMBuildAtomicLoad(B: BuilderRef,
1368                                PointerVal: ValueRef,
1369                                Name: *const c_char,
1370                                Order: AtomicOrdering,
1371                                Alignment: c_uint)
1372                                -> ValueRef;
1373
1374     pub fn LLVMBuildAtomicStore(B: BuilderRef,
1375                                 Val: ValueRef,
1376                                 Ptr: ValueRef,
1377                                 Order: AtomicOrdering,
1378                                 Alignment: c_uint)
1379                                 -> ValueRef;
1380
1381     pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
1382                                   LHS: ValueRef,
1383                                   CMP: ValueRef,
1384                                   RHS: ValueRef,
1385                                   Order: AtomicOrdering,
1386                                   FailureOrder: AtomicOrdering)
1387                                   -> ValueRef;
1388     pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1389                               Op: AtomicBinOp,
1390                               LHS: ValueRef,
1391                               RHS: ValueRef,
1392                               Order: AtomicOrdering,
1393                               SingleThreaded: Bool)
1394                               -> ValueRef;
1395
1396     pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
1397
1398
1399     /* Selected entries from the downcasts. */
1400     pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1401     pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1402
1403     /** Writes a module to the specified path. Returns 0 on success. */
1404     pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1405
1406     /** Creates target data from a target layout string. */
1407     pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1408     /// Adds the target data to the given pass manager. The pass manager
1409     /// references the target data only weakly.
1410     pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
1411     /** Number of bytes clobbered when doing a Store to *T. */
1412     pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
1413                                -> c_ulonglong;
1414
1415     /** Number of bytes clobbered when doing a Store to *T. */
1416     pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
1417                                 -> c_ulonglong;
1418
1419     /** Distance between successive elements in an array of T.
1420     Includes ABI padding. */
1421     pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1422
1423     /** Returns the preferred alignment of a type. */
1424     pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1425                                         -> c_uint;
1426     /** Returns the minimum alignment of a type. */
1427     pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1428                                   -> c_uint;
1429
1430     /// Computes the byte offset of the indexed struct element for a
1431     /// target.
1432     pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1433                                StructTy: TypeRef,
1434                                Element: c_uint)
1435                                -> c_ulonglong;
1436
1437     /**
1438      * Returns the minimum alignment of a type when part of a call frame.
1439      */
1440     pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1441                                         -> c_uint;
1442
1443     /** Disposes target data. */
1444     pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1445
1446     /** Creates a pass manager. */
1447     pub fn LLVMCreatePassManager() -> PassManagerRef;
1448
1449     /** Creates a function-by-function pass manager */
1450     pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef)
1451                                                   -> PassManagerRef;
1452
1453     /** Disposes a pass manager. */
1454     pub fn LLVMDisposePassManager(PM: PassManagerRef);
1455
1456     /** Runs a pass manager on a module. */
1457     pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1458
1459     /** Runs the function passes on the provided function. */
1460     pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef)
1461                                       -> Bool;
1462
1463     /** Initializes all the function passes scheduled in the manager */
1464     pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool;
1465
1466     /** Finalizes all the function passes scheduled in the manager */
1467     pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
1468
1469     pub fn LLVMInitializePasses();
1470
1471     /** Adds a verification pass. */
1472     pub fn LLVMAddVerifierPass(PM: PassManagerRef);
1473
1474     pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
1475     pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
1476     pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
1477     pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
1478     pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
1479     pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
1480     pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
1481     pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
1482     pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
1483     pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
1484     pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
1485     pub fn LLVMAddReassociatePass(PM: PassManagerRef);
1486     pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
1487     pub fn LLVMAddLICMPass(PM: PassManagerRef);
1488     pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
1489     pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
1490     pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
1491     pub fn LLVMAddGVNPass(PM: PassManagerRef);
1492     pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
1493     pub fn LLVMAddSCCPPass(PM: PassManagerRef);
1494     pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
1495     pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
1496     pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
1497     pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
1498     pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
1499     pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
1500     pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
1501     pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
1502     pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
1503     pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
1504     pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
1505     pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
1506     pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
1507     pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
1508     pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
1509
1510     pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1511     pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1512     pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
1513                                              OptimizationLevel: c_uint);
1514     pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
1515                                               Value: Bool);
1516     pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
1517         PMB: PassManagerBuilderRef,
1518         Value: Bool);
1519     pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
1520         PMB: PassManagerBuilderRef,
1521         Value: Bool);
1522     pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
1523         PMB: PassManagerBuilderRef,
1524         Value: Bool);
1525     pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1526         PMB: PassManagerBuilderRef,
1527         threshold: c_uint);
1528     pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1529         PMB: PassManagerBuilderRef,
1530         PM: PassManagerRef);
1531
1532     pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1533         PMB: PassManagerBuilderRef,
1534         PM: PassManagerRef);
1535     pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1536         PMB: PassManagerBuilderRef,
1537         PM: PassManagerRef,
1538         Internalize: Bool,
1539         RunInliner: Bool);
1540
1541     /** Destroys a memory buffer. */
1542     pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
1543
1544
1545     /* Stuff that's in rustllvm/ because it's not upstream yet. */
1546
1547     /** Opens an object file. */
1548     pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1549     /** Closes an object file. */
1550     pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1551
1552     /** Enumerates the sections in an object file. */
1553     pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1554     /** Destroys a section iterator. */
1555     pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1556     /** Returns true if the section iterator is at the end of the section
1557     list: */
1558     pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
1559                                       SI: SectionIteratorRef)
1560                                       -> Bool;
1561     /** Moves the section iterator to point to the next section. */
1562     pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1563     /** Returns the current section size. */
1564     pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1565     /** Returns the current section contents as a string buffer. */
1566     pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1567
1568     /** Reads the given file and returns it as a memory buffer. Use
1569     LLVMDisposeMemoryBuffer() to get rid of it. */
1570     pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char)
1571                                                         -> MemoryBufferRef;
1572     /** Borrows the contents of the memory buffer (doesn't copy it) */
1573     pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const c_char,
1574                                                  InputDataLength: size_t,
1575                                                  BufferName: *const c_char,
1576                                                  RequiresNull: Bool)
1577                                                  -> MemoryBufferRef;
1578     pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const c_char,
1579                                                      InputDataLength: size_t,
1580                                                      BufferName: *const c_char)
1581                                                      -> MemoryBufferRef;
1582
1583     pub fn LLVMIsMultithreaded() -> Bool;
1584     pub fn LLVMStartMultithreaded() -> Bool;
1585
1586     /** Returns a string describing the last error caused by an LLVMRust*
1587     call. */
1588     pub fn LLVMRustGetLastError() -> *const c_char;
1589
1590     /// Print the pass timings since static dtors aren't picking them up.
1591     pub fn LLVMRustPrintPassTimings();
1592
1593     pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1594
1595     pub fn LLVMStructSetBody(StructTy: TypeRef,
1596                              ElementTypes: *const TypeRef,
1597                              ElementCount: c_uint,
1598                              Packed: Bool);
1599
1600     pub fn LLVMConstNamedStruct(S: TypeRef,
1601                                 ConstantVals: *const ValueRef,
1602                                 Count: c_uint)
1603                                 -> ValueRef;
1604
1605     /** Enables LLVM debug output. */
1606     pub fn LLVMSetDebug(Enabled: c_int);
1607
1608     /** Prepares inline assembly. */
1609     pub fn LLVMInlineAsm(Ty: TypeRef,
1610                          AsmString: *const c_char,
1611                          Constraints: *const c_char,
1612                          SideEffects: Bool,
1613                          AlignStack: Bool,
1614                          Dialect: c_uint)
1615                          -> ValueRef;
1616
1617     pub static LLVMRustDebugMetadataVersion: u32;
1618
1619     pub fn LLVMRustAddModuleFlag(M: ModuleRef,
1620                                  name: *const c_char,
1621                                  value: u32);
1622
1623     pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1624
1625     pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
1626
1627     pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef);
1628
1629     pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1630                                           Lang: c_uint,
1631                                           File: *const c_char,
1632                                           Dir: *const c_char,
1633                                           Producer: *const c_char,
1634                                           isOptimized: bool,
1635                                           Flags: *const c_char,
1636                                           RuntimeVer: c_uint,
1637                                           SplitName: *const c_char);
1638
1639     pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
1640                                    Filename: *const c_char,
1641                                    Directory: *const c_char)
1642                                    -> DIFile;
1643
1644     pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1645                                              File: DIFile,
1646                                              ParameterTypes: DIArray)
1647                                              -> DICompositeType;
1648
1649     pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
1650                                        Scope: DIDescriptor,
1651                                        Name: *const c_char,
1652                                        LinkageName: *const c_char,
1653                                        File: DIFile,
1654                                        LineNo: c_uint,
1655                                        Ty: DIType,
1656                                        isLocalToUnit: bool,
1657                                        isDefinition: bool,
1658                                        ScopeLine: c_uint,
1659                                        Flags: c_uint,
1660                                        isOptimized: bool,
1661                                        Fn: ValueRef,
1662                                        TParam: ValueRef,
1663                                        Decl: ValueRef)
1664                                        -> DISubprogram;
1665
1666     pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
1667                                         Name: *const c_char,
1668                                         SizeInBits: c_ulonglong,
1669                                         AlignInBits: c_ulonglong,
1670                                         Encoding: c_uint)
1671                                         -> DIBasicType;
1672
1673     pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
1674                                           PointeeTy: DIType,
1675                                           SizeInBits: c_ulonglong,
1676                                           AlignInBits: c_ulonglong,
1677                                           Name: *const c_char)
1678                                           -> DIDerivedType;
1679
1680     pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
1681                                          Scope: DIDescriptor,
1682                                          Name: *const c_char,
1683                                          File: DIFile,
1684                                          LineNumber: c_uint,
1685                                          SizeInBits: c_ulonglong,
1686                                          AlignInBits: c_ulonglong,
1687                                          Flags: c_uint,
1688                                          DerivedFrom: DIType,
1689                                          Elements: DIArray,
1690                                          RunTimeLang: c_uint,
1691                                          VTableHolder: ValueRef,
1692                                          UniqueId: *const c_char)
1693                                          -> DICompositeType;
1694
1695     pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
1696                                          Scope: DIDescriptor,
1697                                          Name: *const c_char,
1698                                          File: DIFile,
1699                                          LineNo: c_uint,
1700                                          SizeInBits: c_ulonglong,
1701                                          AlignInBits: c_ulonglong,
1702                                          OffsetInBits: c_ulonglong,
1703                                          Flags: c_uint,
1704                                          Ty: DIType)
1705                                          -> DIDerivedType;
1706
1707     pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1708                                            Scope: DIDescriptor,
1709                                            File: DIFile,
1710                                            Line: c_uint,
1711                                            Col: c_uint,
1712                                            Discriminator: c_uint)
1713                                            -> DILexicalBlock;
1714
1715     pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1716                                              Context: DIDescriptor,
1717                                              Name: *const c_char,
1718                                              LinkageName: *const c_char,
1719                                              File: DIFile,
1720                                              LineNo: c_uint,
1721                                              Ty: DIType,
1722                                              isLocalToUnit: bool,
1723                                              Val: ValueRef,
1724                                              Decl: ValueRef)
1725                                              -> DIGlobalVariable;
1726
1727     pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
1728                                             Tag: c_uint,
1729                                             Scope: DIDescriptor,
1730                                             Name: *const c_char,
1731                                             File: DIFile,
1732                                             LineNo: c_uint,
1733                                             Ty: DIType,
1734                                             AlwaysPreserve: bool,
1735                                             Flags: c_uint,
1736                                             ArgNo: c_uint)
1737                                             -> DIVariable;
1738
1739     pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
1740                                         Size: c_ulonglong,
1741                                         AlignInBits: c_ulonglong,
1742                                         Ty: DIType,
1743                                         Subscripts: DIArray)
1744                                         -> DIType;
1745
1746     pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
1747                                          Size: c_ulonglong,
1748                                          AlignInBits: c_ulonglong,
1749                                          Ty: DIType,
1750                                          Subscripts: DIArray)
1751                                          -> DIType;
1752
1753     pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1754                                             Lo: c_longlong,
1755                                             Count: c_longlong)
1756                                             -> DISubrange;
1757
1758     pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1759                                          Ptr: *const DIDescriptor,
1760                                          Count: c_uint)
1761                                          -> DIArray;
1762
1763     pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1764                                            Val: ValueRef,
1765                                            VarInfo: DIVariable,
1766                                            InsertAtEnd: BasicBlockRef)
1767                                            -> ValueRef;
1768
1769     pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
1770                                             Val: ValueRef,
1771                                             VarInfo: DIVariable,
1772                                             InsertBefore: ValueRef)
1773                                             -> ValueRef;
1774
1775     pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1776                                          Name: *const c_char,
1777                                          Val: c_ulonglong)
1778                                          -> ValueRef;
1779
1780     pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1781                                               Scope: ValueRef,
1782                                               Name: *const c_char,
1783                                               File: ValueRef,
1784                                               LineNumber: c_uint,
1785                                               SizeInBits: c_ulonglong,
1786                                               AlignInBits: c_ulonglong,
1787                                               Elements: ValueRef,
1788                                               ClassType: ValueRef)
1789                                               -> ValueRef;
1790
1791     pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
1792                                         Scope: ValueRef,
1793                                         Name: *const c_char,
1794                                         File: ValueRef,
1795                                         LineNumber: c_uint,
1796                                         SizeInBits: c_ulonglong,
1797                                         AlignInBits: c_ulonglong,
1798                                         Flags: c_uint,
1799                                         Elements: ValueRef,
1800                                         RunTimeLang: c_uint,
1801                                         UniqueId: *const c_char)
1802                                         -> ValueRef;
1803
1804     pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1805
1806     pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1807                                                     Scope: ValueRef,
1808                                                     Name: *const c_char,
1809                                                     Ty: ValueRef,
1810                                                     File: ValueRef,
1811                                                     LineNo: c_uint,
1812                                                     ColumnNo: c_uint)
1813                                                     -> ValueRef;
1814
1815     pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
1816
1817     pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
1818
1819     pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
1820                                               Tag: c_uint,
1821                                               Scope: ValueRef,
1822                                               Name: *const c_char,
1823                                               File: ValueRef,
1824                                               LineNo: c_uint,
1825                                               Ty: ValueRef,
1826                                               AddrOps: *const ValueRef,
1827                                               AddrOpsCount: c_uint,
1828                                               ArgNo: c_uint)
1829                                               -> ValueRef;
1830
1831     pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1832                                         Scope: ValueRef,
1833                                         Name: *const c_char,
1834                                         File: ValueRef,
1835                                         LineNo: c_uint)
1836                                         -> ValueRef;
1837
1838     pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
1839     pub fn LLVMTypeToString(Type: TypeRef) -> *const c_char;
1840     pub fn LLVMValueToString(value_ref: ValueRef) -> *const c_char;
1841
1842     pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
1843
1844     pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
1845
1846     pub fn LLVMInitializeX86TargetInfo();
1847     pub fn LLVMInitializeX86Target();
1848     pub fn LLVMInitializeX86TargetMC();
1849     pub fn LLVMInitializeX86AsmPrinter();
1850     pub fn LLVMInitializeX86AsmParser();
1851     pub fn LLVMInitializeARMTargetInfo();
1852     pub fn LLVMInitializeARMTarget();
1853     pub fn LLVMInitializeARMTargetMC();
1854     pub fn LLVMInitializeARMAsmPrinter();
1855     pub fn LLVMInitializeARMAsmParser();
1856     pub fn LLVMInitializeMipsTargetInfo();
1857     pub fn LLVMInitializeMipsTarget();
1858     pub fn LLVMInitializeMipsTargetMC();
1859     pub fn LLVMInitializeMipsAsmPrinter();
1860     pub fn LLVMInitializeMipsAsmParser();
1861
1862     pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
1863     pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1864                                        CPU: *const c_char,
1865                                        Features: *const c_char,
1866                                        Model: CodeGenModel,
1867                                        Reloc: RelocMode,
1868                                        Level: CodeGenOptLevel,
1869                                        EnableSegstk: bool,
1870                                        UseSoftFP: bool,
1871                                        NoFramePointerElim: bool,
1872                                        FunctionSections: bool,
1873                                        DataSections: bool) -> TargetMachineRef;
1874     pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1875     pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
1876                                      PM: PassManagerRef,
1877                                      M: ModuleRef);
1878     pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1879                                          M: ModuleRef,
1880                                          DisableSimplifyLibCalls: bool);
1881     pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef,
1882                                   DisableSimplifyLibCalls: bool);
1883     pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1884     pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1885                                    PM: PassManagerRef,
1886                                    M: ModuleRef,
1887                                    Output: *const c_char,
1888                                    FileType: FileType) -> bool;
1889     pub fn LLVMRustPrintModule(PM: PassManagerRef,
1890                                M: ModuleRef,
1891                                Output: *const c_char);
1892     pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1893     pub fn LLVMRustPrintPasses();
1894     pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1895     pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
1896                                        AddLifetimes: bool);
1897     pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef,
1898                                          bc: *const c_char,
1899                                          len: size_t) -> bool;
1900     pub fn LLVMRustRunRestrictionPass(M: ModuleRef,
1901                                       syms: *const *const c_char,
1902                                       len: size_t);
1903     pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1904
1905     pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1906     pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *const c_char,
1907                                       out_len: *mut size_t) -> *const c_char;
1908     pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1909
1910     pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
1911     pub fn LLVMVersionMajor() -> c_int;
1912     pub fn LLVMVersionMinor() -> c_int;
1913
1914     pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
1915                                   data: *mut *const c_char) -> c_int;
1916 }
1917
1918 pub fn SetInstructionCallConv(instr: ValueRef, cc: CallConv) {
1919     unsafe {
1920         LLVMSetInstructionCallConv(instr, cc as c_uint);
1921     }
1922 }
1923 pub fn SetFunctionCallConv(fn_: ValueRef, cc: CallConv) {
1924     unsafe {
1925         LLVMSetFunctionCallConv(fn_, cc as c_uint);
1926     }
1927 }
1928 pub fn SetLinkage(global: ValueRef, link: Linkage) {
1929     unsafe {
1930         LLVMSetLinkage(global, link as c_uint);
1931     }
1932 }
1933
1934 pub fn SetUnnamedAddr(global: ValueRef, unnamed: bool) {
1935     unsafe {
1936         LLVMSetUnnamedAddr(global, unnamed as Bool);
1937     }
1938 }
1939
1940 pub fn set_thread_local(global: ValueRef, is_thread_local: bool) {
1941     unsafe {
1942         LLVMSetThreadLocal(global, is_thread_local as Bool);
1943     }
1944 }
1945
1946 pub fn ConstICmp(pred: IntPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
1947     unsafe {
1948         LLVMConstICmp(pred as c_ushort, v1, v2)
1949     }
1950 }
1951 pub fn ConstFCmp(pred: RealPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
1952     unsafe {
1953         LLVMConstFCmp(pred as c_ushort, v1, v2)
1954     }
1955 }
1956
1957 pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
1958     unsafe {
1959         LLVMAddFunctionAttribute(fn_, FunctionIndex as c_uint, attr as uint64_t)
1960     }
1961 }
1962
1963 /* Memory-managed interface to target data. */
1964
1965 pub struct TargetData {
1966     pub lltd: TargetDataRef
1967 }
1968
1969 impl Drop for TargetData {
1970     fn drop(&mut self) {
1971         unsafe {
1972             LLVMDisposeTargetData(self.lltd);
1973         }
1974     }
1975 }
1976
1977 pub fn mk_target_data(string_rep: &str) -> TargetData {
1978     TargetData {
1979         lltd: string_rep.with_c_str(|buf| {
1980             unsafe { LLVMCreateTargetData(buf) }
1981         })
1982     }
1983 }
1984
1985 /* Memory-managed interface to object files. */
1986
1987 pub struct ObjectFile {
1988     pub llof: ObjectFileRef,
1989 }
1990
1991 impl ObjectFile {
1992     // This will take ownership of llmb
1993     pub fn new(llmb: MemoryBufferRef) -> Option<ObjectFile> {
1994         unsafe {
1995             let llof = LLVMCreateObjectFile(llmb);
1996             if llof as int == 0 {
1997                 // LLVMCreateObjectFile took ownership of llmb
1998                 return None
1999             }
2000
2001             Some(ObjectFile {
2002                 llof: llof,
2003             })
2004         }
2005     }
2006 }
2007
2008 impl Drop for ObjectFile {
2009     fn drop(&mut self) {
2010         unsafe {
2011             LLVMDisposeObjectFile(self.llof);
2012         }
2013     }
2014 }
2015
2016 /* Memory-managed interface to section iterators. */
2017
2018 pub struct SectionIter {
2019     pub llsi: SectionIteratorRef
2020 }
2021
2022 impl Drop for SectionIter {
2023     fn drop(&mut self) {
2024         unsafe {
2025             LLVMDisposeSectionIterator(self.llsi);
2026         }
2027     }
2028 }
2029
2030 pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
2031     unsafe {
2032         SectionIter {
2033             llsi: LLVMGetSections(llof)
2034         }
2035     }
2036 }
2037
2038 /// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
2039 pub fn get_param(llfn: ValueRef, index: c_uint) -> ValueRef {
2040     unsafe {
2041         assert!(index < LLVMCountParams(llfn));
2042         LLVMGetParam(llfn, index)
2043     }
2044 }
2045
2046 // FIXME #15460 - create a public function that actually calls our
2047 // static LLVM symbols. Otherwise the linker will just throw llvm
2048 // away.  We're just calling lots of stuff until we transitively get
2049 // all of LLVM. This is worse than anything.
2050 pub unsafe fn static_link_hack_this_sucks() {
2051     LLVMInitializePasses();
2052
2053     LLVMInitializeX86TargetInfo();
2054     LLVMInitializeX86Target();
2055     LLVMInitializeX86TargetMC();
2056     LLVMInitializeX86AsmPrinter();
2057     LLVMInitializeX86AsmParser();
2058
2059     LLVMInitializeARMTargetInfo();
2060     LLVMInitializeARMTarget();
2061     LLVMInitializeARMTargetMC();
2062     LLVMInitializeARMAsmPrinter();
2063     LLVMInitializeARMAsmParser();
2064
2065     LLVMInitializeMipsTargetInfo();
2066     LLVMInitializeMipsTarget();
2067     LLVMInitializeMipsTargetMC();
2068     LLVMInitializeMipsAsmPrinter();
2069     LLVMInitializeMipsAsmParser();
2070
2071     LLVMRustSetLLVMOptions(0 as c_int,
2072                                        0 as *const _);
2073
2074     LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
2075     LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
2076     LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
2077     LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
2078     LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
2079     LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
2080     LLVMPassManagerBuilderCreate();
2081     LLVMPassManagerBuilderDispose(0 as *mut _);
2082
2083     LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
2084
2085     LLVMLinkInJIT();
2086     LLVMLinkInMCJIT();
2087     LLVMLinkInInterpreter();
2088
2089     extern {
2090         fn LLVMLinkInJIT();
2091         fn LLVMLinkInMCJIT();
2092         fn LLVMLinkInInterpreter();
2093     }
2094 }
2095
2096 // The module containing the native LLVM dependencies, generated by the build system
2097 // Note that this must come after the rustllvm extern declaration so that
2098 // parts of LLVM that rustllvm depends on aren't thrown away by the linker.
2099 // Works to the above fix for #15460 to ensure LLVM dependencies that
2100 // are only used by rustllvm don't get stripped by the linker.
2101 mod llvmdeps;
2102