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.
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.
11 #![allow(non_uppercase_statics)]
12 #![allow(non_camel_case_types)]
13 #![allow(non_snake_case)]
16 #![crate_name = "rustc_llvm"]
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/")]
26 #![feature(link_args)]
30 use std::c_str::ToCStr;
31 use std::cell::RefCell;
33 use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
34 use libc::{c_longlong, c_ulonglong};
35 use debuginfo::{DIBuilderRef, DIDescriptor,
36 DIFile, DILexicalBlock, DISubprogram, DIType,
37 DIBasicType, DIDerivedType, DICompositeType,
38 DIVariable, DIGlobalVariable, DIArray, DISubrange};
42 pub type Opcode = u32;
43 pub type Bool = c_uint;
45 pub static True: Bool = 1 as Bool;
46 pub static False: Bool = 0 as Bool;
48 // Consts for the LLVM CallConv type, pre-cast to uint.
50 #[deriving(PartialEq)]
55 X86StdcallCallConv = 64,
56 X86FastcallCallConv = 65,
61 LLVMDefaultVisibility = 0,
63 ProtectedVisibility = 2,
66 // This enum omits the obsolete (and no-op) linkage types DLLImportLinkage,
67 // DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
68 // LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
69 // they've been removed in upstream LLVM commit r203866.
72 AvailableExternallyLinkage = 1,
73 LinkOnceAnyLinkage = 2,
74 LinkOnceODRLinkage = 3,
80 ExternalWeakLinkage = 12,
86 ZExtAttribute = 1 << 0,
87 SExtAttribute = 1 << 1,
88 NoReturnAttribute = 1 << 2,
89 InRegAttribute = 1 << 3,
90 StructRetAttribute = 1 << 4,
91 NoUnwindAttribute = 1 << 5,
92 NoAliasAttribute = 1 << 6,
93 ByValAttribute = 1 << 7,
94 NestAttribute = 1 << 8,
95 ReadNoneAttribute = 1 << 9,
96 ReadOnlyAttribute = 1 << 10,
97 NoInlineAttribute = 1 << 11,
98 AlwaysInlineAttribute = 1 << 12,
99 OptimizeForSizeAttribute = 1 << 13,
100 StackProtectAttribute = 1 << 14,
101 StackProtectReqAttribute = 1 << 15,
102 AlignmentAttribute = 31 << 16,
103 NoCaptureAttribute = 1 << 21,
104 NoRedZoneAttribute = 1 << 22,
105 NoImplicitFloatAttribute = 1 << 23,
106 NakedAttribute = 1 << 24,
107 InlineHintAttribute = 1 << 25,
108 StackAttribute = 7 << 26,
109 ReturnsTwiceAttribute = 1 << 29,
110 UWTableAttribute = 1 << 30,
111 NonLazyBindAttribute = 1 << 31,
115 pub enum OtherAttribute {
116 // The following are not really exposed in
117 // the LLVM c api so instead to add these
118 // we call a wrapper function in RustWrapper
119 // that uses the C++ api.
120 SanitizeAddressAttribute = 1 << 32,
121 MinSizeAttribute = 1 << 33,
122 NoDuplicateAttribute = 1 << 34,
123 StackProtectStrongAttribute = 1 << 35,
124 SanitizeThreadAttribute = 1 << 36,
125 SanitizeMemoryAttribute = 1 << 37,
126 NoBuiltinAttribute = 1 << 38,
127 ReturnedAttribute = 1 << 39,
128 ColdAttribute = 1 << 40,
129 BuiltinAttribute = 1 << 41,
130 OptimizeNoneAttribute = 1 << 42,
131 InAllocaAttribute = 1 << 43,
132 NonNullAttribute = 1 << 44,
135 pub enum SpecialAttribute {
136 DereferenceableAttribute(u64)
140 pub enum AttributeSet {
146 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef);
147 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef);
150 impl AttrHelper for Attribute {
151 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
153 LLVMAddFunctionAttribute(llfn, idx, *self as uint64_t);
157 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
159 LLVMAddCallSiteAttribute(callsite, idx, *self as uint64_t);
164 impl AttrHelper for OtherAttribute {
165 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
167 LLVMAddFunctionAttribute(llfn, idx, *self as uint64_t);
171 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
173 LLVMAddCallSiteAttribute(callsite, idx, *self as uint64_t);
178 impl AttrHelper for SpecialAttribute {
179 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
181 DereferenceableAttribute(bytes) => unsafe {
182 LLVMAddDereferenceableAttr(llfn, idx, bytes as uint64_t);
187 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
189 DereferenceableAttribute(bytes) => unsafe {
190 LLVMAddDereferenceableCallSiteAttr(callsite, idx, bytes as uint64_t);
196 pub struct AttrBuilder {
197 attrs: Vec<(uint, Box<AttrHelper+'static>)>
201 pub fn new() -> AttrBuilder {
207 pub fn arg<'a, T: AttrHelper + 'static>(&'a mut self, idx: uint, a: T) -> &'a mut AttrBuilder {
208 self.attrs.push((idx, box a as Box<AttrHelper+'static>));
212 pub fn ret<'a, T: AttrHelper + 'static>(&'a mut self, a: T) -> &'a mut AttrBuilder {
213 self.attrs.push((ReturnIndex as uint, box a as Box<AttrHelper+'static>));
217 pub fn apply_llfn(&self, llfn: ValueRef) {
218 for &(idx, ref attr) in self.attrs.iter() {
219 attr.apply_llfn(idx as c_uint, llfn);
223 pub fn apply_callsite(&self, callsite: ValueRef) {
224 for &(idx, ref attr) in self.attrs.iter() {
225 attr.apply_callsite(idx as c_uint, callsite);
230 // enum for the LLVM IntPredicate type
231 pub enum IntPredicate {
244 // enum for the LLVM RealPredicate type
245 pub enum RealPredicate {
246 RealPredicateFalse = 0,
261 RealPredicateTrue = 15,
264 // The LLVM TypeKind type - must stay in sync with the def of
265 // LLVMTypeKind in llvm/include/llvm-c/Core.h
266 #[deriving(PartialEq)]
288 pub enum AtomicBinOp {
303 pub enum AtomicOrdering {
307 // Consume = 3, // Not specified yet.
311 SequentiallyConsistent = 7
314 // Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
330 // Inline Asm Dialect
331 pub enum AsmDialect {
336 #[deriving(PartialEq, Clone)]
338 pub enum CodeGenOptLevel {
339 CodeGenLevelNone = 0,
340 CodeGenLevelLess = 1,
341 CodeGenLevelDefault = 2,
342 CodeGenLevelAggressive = 3,
350 RelocDynamicNoPic = 3,
354 pub enum CodeGenModel {
355 CodeModelDefault = 0,
356 CodeModelJITDefault = 1,
363 // Opaque pointer types
364 pub enum Module_opaque {}
365 pub type ModuleRef = *mut Module_opaque;
366 pub enum Context_opaque {}
367 pub type ContextRef = *mut Context_opaque;
368 pub enum Type_opaque {}
369 pub type TypeRef = *mut Type_opaque;
370 pub enum Value_opaque {}
371 pub type ValueRef = *mut Value_opaque;
372 pub enum BasicBlock_opaque {}
373 pub type BasicBlockRef = *mut BasicBlock_opaque;
374 pub enum Builder_opaque {}
375 pub type BuilderRef = *mut Builder_opaque;
376 pub enum ExecutionEngine_opaque {}
377 pub type ExecutionEngineRef = *mut ExecutionEngine_opaque;
378 pub enum MemoryBuffer_opaque {}
379 pub type MemoryBufferRef = *mut MemoryBuffer_opaque;
380 pub enum PassManager_opaque {}
381 pub type PassManagerRef = *mut PassManager_opaque;
382 pub enum PassManagerBuilder_opaque {}
383 pub type PassManagerBuilderRef = *mut PassManagerBuilder_opaque;
384 pub enum Use_opaque {}
385 pub type UseRef = *mut Use_opaque;
386 pub enum TargetData_opaque {}
387 pub type TargetDataRef = *mut TargetData_opaque;
388 pub enum ObjectFile_opaque {}
389 pub type ObjectFileRef = *mut ObjectFile_opaque;
390 pub enum SectionIterator_opaque {}
391 pub type SectionIteratorRef = *mut SectionIterator_opaque;
392 pub enum Pass_opaque {}
393 pub type PassRef = *mut Pass_opaque;
394 pub enum TargetMachine_opaque {}
395 pub type TargetMachineRef = *mut TargetMachine_opaque;
396 pub enum Archive_opaque {}
397 pub type ArchiveRef = *mut Archive_opaque;
400 use super::{ValueRef};
402 pub enum DIBuilder_opaque {}
403 pub type DIBuilderRef = *mut DIBuilder_opaque;
405 pub type DIDescriptor = ValueRef;
406 pub type DIScope = DIDescriptor;
407 pub type DILocation = DIDescriptor;
408 pub type DIFile = DIScope;
409 pub type DILexicalBlock = DIScope;
410 pub type DISubprogram = DIScope;
411 pub type DIType = DIDescriptor;
412 pub type DIBasicType = DIType;
413 pub type DIDerivedType = DIType;
414 pub type DICompositeType = DIDerivedType;
415 pub type DIVariable = DIDescriptor;
416 pub type DIGlobalVariable = DIDescriptor;
417 pub type DIArray = DIDescriptor;
418 pub type DISubrange = DIDescriptor;
420 pub enum DIDescriptorFlags {
421 FlagPrivate = 1 << 0,
422 FlagProtected = 1 << 1,
423 FlagFwdDecl = 1 << 2,
424 FlagAppleBlock = 1 << 3,
425 FlagBlockByrefStruct = 1 << 4,
426 FlagVirtual = 1 << 5,
427 FlagArtificial = 1 << 6,
428 FlagExplicit = 1 << 7,
429 FlagPrototyped = 1 << 8,
430 FlagObjcClassComplete = 1 << 9,
431 FlagObjectPointer = 1 << 10,
432 FlagVector = 1 << 11,
433 FlagStaticMember = 1 << 12,
434 FlagIndirectVariable = 1 << 13,
435 FlagLValueReference = 1 << 14,
436 FlagRValueReference = 1 << 15
441 // Link to our native llvm bindings (things that we need to use the C++ api
442 // for) and because llvm is written in C++ we need to link against libstdc++
444 // You'll probably notice that there is an omission of all LLVM libraries
445 // from this location. This is because the set of LLVM libraries that we
446 // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
447 // figure out the exact set of libraries. To do this, the build system
448 // generates an llvmdeps.rs file next to this one which will be
449 // automatically updated whenever LLVM is updated to include an up-to-date
450 // set of the libraries we need to link to LLVM for.
451 #[link(name = "rustllvm", kind = "static")]
453 /* Create and destroy contexts. */
454 pub fn LLVMContextCreate() -> ContextRef;
455 pub fn LLVMContextDispose(C: ContextRef);
456 pub fn LLVMGetMDKindIDInContext(C: ContextRef,
461 /* Create and destroy modules. */
462 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char,
465 pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
466 pub fn LLVMDisposeModule(M: ModuleRef);
468 /** Data layout. See Module::getDataLayout. */
469 pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
470 pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
472 /** Target triple. See Module::getTargetTriple. */
473 pub fn LLVMGetTarget(M: ModuleRef) -> *const c_char;
474 pub fn LLVMSetTarget(M: ModuleRef, Triple: *const c_char);
476 /** See Module::dump. */
477 pub fn LLVMDumpModule(M: ModuleRef);
479 /** See Module::setModuleInlineAsm. */
480 pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
482 /** See llvm::LLVMTypeKind::getTypeID. */
483 pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
485 /** See llvm::LLVMType::getContext. */
486 pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
488 /* Operations on integer types */
489 pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
490 pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
491 pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
492 pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
493 pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
494 pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
497 pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
499 /* Operations on real types */
500 pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
501 pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
502 pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
503 pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
504 pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
506 /* Operations on function types */
507 pub fn LLVMFunctionType(ReturnType: TypeRef,
508 ParamTypes: *const TypeRef,
512 pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
513 pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
514 pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
515 pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *const TypeRef);
517 /* Operations on struct types */
518 pub fn LLVMStructTypeInContext(C: ContextRef,
519 ElementTypes: *const TypeRef,
520 ElementCount: c_uint,
523 pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
524 pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
526 pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
528 /* Operations on array, pointer, and vector types (sequence types) */
529 pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
530 pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
532 pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
535 pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
536 pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
537 pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
538 pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
540 pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
542 /* Operations on other types */
543 pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
544 pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
545 pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
547 /* Operations on all values */
548 pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
549 pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
550 pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
551 pub fn LLVMDumpValue(Val: ValueRef);
552 pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
553 pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
554 pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
555 pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
557 /* Operations on Uses */
558 pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
559 pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
560 pub fn LLVMGetUser(U: UseRef) -> ValueRef;
561 pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
563 /* Operations on Users */
564 pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
565 pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
566 pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
568 /* Operations on constants of any type */
569 pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
571 pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
572 pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
574 pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
576 /* only for int/vector */
577 pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
578 pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
579 pub fn LLVMIsNull(Val: ValueRef) -> Bool;
580 pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
581 pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
583 /* Operations on metadata */
584 pub fn LLVMMDStringInContext(C: ContextRef,
588 pub fn LLVMMDNodeInContext(C: ContextRef,
589 Vals: *const ValueRef,
592 pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
596 /* Operations on scalar constants */
597 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
599 pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *const c_char, Radix: u8)
601 pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
606 pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
607 pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *const c_char)
609 pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
613 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
614 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
617 /* Operations on composite constants */
618 pub fn LLVMConstStringInContext(C: ContextRef,
621 DontNullTerminate: Bool)
623 pub fn LLVMConstStructInContext(C: ContextRef,
624 ConstantVals: *const ValueRef,
629 pub fn LLVMConstArray(ElementTy: TypeRef,
630 ConstantVals: *const ValueRef,
633 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint)
636 /* Constant expressions */
637 pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
638 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
639 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
640 pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
641 pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
642 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
643 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
644 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
646 pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
648 pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
650 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
652 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
654 pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
656 pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
658 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
660 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
662 pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
664 pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
666 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
668 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
670 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
672 pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
673 RHSConstant: ValueRef)
675 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
677 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
679 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
681 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
683 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef)
685 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
687 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef)
689 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
691 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
693 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
695 pub fn LLVMConstGEP(ConstantVal: ValueRef,
696 ConstantIndices: *const ValueRef,
699 pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
700 ConstantIndices: *const ValueRef,
703 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
705 pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
707 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef)
709 pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
711 pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef)
713 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
715 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef)
717 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
719 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef)
721 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
723 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef)
725 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
727 pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
729 pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
731 pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
733 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
735 pub fn LLVMConstIntCast(ConstantVal: ValueRef,
739 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
741 pub fn LLVMConstSelect(ConstantCondition: ValueRef,
742 ConstantIfTrue: ValueRef,
743 ConstantIfFalse: ValueRef)
745 pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
746 IndexConstant: ValueRef)
748 pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
749 ElementValueConstant: ValueRef,
750 IndexConstant: ValueRef)
752 pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
753 VectorBConstant: ValueRef,
754 MaskConstant: ValueRef)
756 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
757 IdxList: *const c_uint,
760 pub fn LLVMConstInsertValue(AggConstant: ValueRef,
761 ElementValueConstant: ValueRef,
762 IdxList: *const c_uint,
765 pub fn LLVMConstInlineAsm(Ty: TypeRef,
766 AsmString: *const c_char,
767 Constraints: *const c_char,
768 HasSideEffects: Bool,
771 pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
775 /* Operations on global variables, functions, and aliases (globals) */
776 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
777 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
778 pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
779 pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
780 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
781 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
782 pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
783 pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
784 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
785 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
788 /* Operations on global variables */
789 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char)
791 pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
794 AddressSpace: c_uint)
796 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
797 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
798 pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
799 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
800 pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
801 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
802 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
803 pub fn LLVMSetInitializer(GlobalVar: ValueRef,
804 ConstantVal: ValueRef);
805 pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
806 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
807 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
808 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
810 /* Operations on aliases */
811 pub fn LLVMAddAlias(M: ModuleRef,
817 /* Operations on functions */
818 pub fn LLVMAddFunction(M: ModuleRef,
822 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
823 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
824 pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
825 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
826 pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
827 pub fn LLVMDeleteFunction(Fn: ValueRef);
828 pub fn LLVMGetOrInsertFunction(M: ModuleRef,
832 pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
833 pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
834 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
835 pub fn LLVMGetGC(Fn: ValueRef) -> *const c_char;
836 pub fn LLVMSetGC(Fn: ValueRef, Name: *const c_char);
837 pub fn LLVMAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: uint64_t);
838 pub fn LLVMAddFunctionAttribute(Fn: ValueRef, index: c_uint, PA: uint64_t);
839 pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
840 pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
841 pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
843 /* Operations on parameters */
844 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
845 pub fn LLVMGetParams(Fn: ValueRef, Params: *const ValueRef);
846 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
847 pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
848 pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
849 pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
850 pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
851 pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
852 pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
853 pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
854 pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
855 pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
857 /* Operations on basic blocks */
858 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
859 pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
860 pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
861 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
862 pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
863 pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *const ValueRef);
864 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
865 pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
866 pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
867 pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
868 pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
870 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
874 pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
878 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
880 pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
881 MoveAfter: BasicBlockRef);
883 pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef,
884 MoveBefore: BasicBlockRef);
886 /* Operations on instructions */
887 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
888 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
889 pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
890 pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
891 pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
892 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
894 /* Operations on call sites */
895 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
896 pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
897 pub fn LLVMAddInstrAttribute(Instr: ValueRef,
900 pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
903 pub fn LLVMSetInstrParamAlignment(Instr: ValueRef,
906 pub fn LLVMAddCallSiteAttribute(Instr: ValueRef,
909 pub fn LLVMAddDereferenceableCallSiteAttr(Instr: ValueRef,
913 /* Operations on call instructions (only) */
914 pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
915 pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
917 /* Operations on load/store instructions (only) */
918 pub fn LLVMGetVolatile(MemoryAccessInst: ValueRef) -> Bool;
919 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
921 /* Operations on phi nodes */
922 pub fn LLVMAddIncoming(PhiNode: ValueRef,
923 IncomingValues: *const ValueRef,
924 IncomingBlocks: *const BasicBlockRef,
926 pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
927 pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
929 pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint)
932 /* Instruction builders */
933 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
934 pub fn LLVMPositionBuilder(Builder: BuilderRef,
935 Block: BasicBlockRef,
937 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
939 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
940 Block: BasicBlockRef);
941 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
942 pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
943 pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
944 pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
946 Name: *const c_char);
947 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
948 pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
951 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
952 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
953 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
956 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
957 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
958 pub fn LLVMBuildAggregateRet(B: BuilderRef,
959 RetVals: *const ValueRef,
962 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
963 pub fn LLVMBuildCondBr(B: BuilderRef,
968 pub fn LLVMBuildSwitch(B: BuilderRef,
973 pub fn LLVMBuildIndirectBr(B: BuilderRef,
977 pub fn LLVMBuildInvoke(B: BuilderRef,
979 Args: *const ValueRef,
982 Catch: BasicBlockRef,
985 pub fn LLVMBuildLandingPad(B: BuilderRef,
991 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
992 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
994 /* Add a case to the switch instruction */
995 pub fn LLVMAddCase(Switch: ValueRef,
997 Dest: BasicBlockRef);
999 /* Add a destination to the indirectbr instruction */
1000 pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
1002 /* Add a clause to the landing pad instruction */
1003 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
1005 /* Set the cleanup on a landing pad instruction */
1006 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
1009 pub fn LLVMBuildAdd(B: BuilderRef,
1012 Name: *const c_char)
1014 pub fn LLVMBuildNSWAdd(B: BuilderRef,
1017 Name: *const c_char)
1019 pub fn LLVMBuildNUWAdd(B: BuilderRef,
1022 Name: *const c_char)
1024 pub fn LLVMBuildFAdd(B: BuilderRef,
1027 Name: *const c_char)
1029 pub fn LLVMBuildSub(B: BuilderRef,
1032 Name: *const c_char)
1034 pub fn LLVMBuildNSWSub(B: BuilderRef,
1037 Name: *const c_char)
1039 pub fn LLVMBuildNUWSub(B: BuilderRef,
1042 Name: *const c_char)
1044 pub fn LLVMBuildFSub(B: BuilderRef,
1047 Name: *const c_char)
1049 pub fn LLVMBuildMul(B: BuilderRef,
1052 Name: *const c_char)
1054 pub fn LLVMBuildNSWMul(B: BuilderRef,
1057 Name: *const c_char)
1059 pub fn LLVMBuildNUWMul(B: BuilderRef,
1062 Name: *const c_char)
1064 pub fn LLVMBuildFMul(B: BuilderRef,
1067 Name: *const c_char)
1069 pub fn LLVMBuildUDiv(B: BuilderRef,
1072 Name: *const c_char)
1074 pub fn LLVMBuildSDiv(B: BuilderRef,
1077 Name: *const c_char)
1079 pub fn LLVMBuildExactSDiv(B: BuilderRef,
1082 Name: *const c_char)
1084 pub fn LLVMBuildFDiv(B: BuilderRef,
1087 Name: *const c_char)
1089 pub fn LLVMBuildURem(B: BuilderRef,
1092 Name: *const c_char)
1094 pub fn LLVMBuildSRem(B: BuilderRef,
1097 Name: *const c_char)
1099 pub fn LLVMBuildFRem(B: BuilderRef,
1102 Name: *const c_char)
1104 pub fn LLVMBuildShl(B: BuilderRef,
1107 Name: *const c_char)
1109 pub fn LLVMBuildLShr(B: BuilderRef,
1112 Name: *const c_char)
1114 pub fn LLVMBuildAShr(B: BuilderRef,
1117 Name: *const c_char)
1119 pub fn LLVMBuildAnd(B: BuilderRef,
1122 Name: *const c_char)
1124 pub fn LLVMBuildOr(B: BuilderRef,
1127 Name: *const c_char)
1129 pub fn LLVMBuildXor(B: BuilderRef,
1132 Name: *const c_char)
1134 pub fn LLVMBuildBinOp(B: BuilderRef,
1138 Name: *const c_char)
1140 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1142 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1144 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1146 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1148 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char)
1152 pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1154 pub fn LLVMBuildArrayMalloc(B: BuilderRef,
1157 Name: *const c_char)
1159 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1161 pub fn LLVMBuildArrayAlloca(B: BuilderRef,
1164 Name: *const c_char)
1166 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
1167 pub fn LLVMBuildLoad(B: BuilderRef,
1168 PointerVal: ValueRef,
1169 Name: *const c_char)
1172 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
1175 pub fn LLVMBuildGEP(B: BuilderRef,
1177 Indices: *const ValueRef,
1179 Name: *const c_char)
1181 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
1183 Indices: *const ValueRef,
1185 Name: *const c_char)
1187 pub fn LLVMBuildStructGEP(B: BuilderRef,
1190 Name: *const c_char)
1192 pub fn LLVMBuildGlobalString(B: BuilderRef,
1194 Name: *const c_char)
1196 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1198 Name: *const c_char)
1202 pub fn LLVMBuildTrunc(B: BuilderRef,
1205 Name: *const c_char)
1207 pub fn LLVMBuildZExt(B: BuilderRef,
1210 Name: *const c_char)
1212 pub fn LLVMBuildSExt(B: BuilderRef,
1215 Name: *const c_char)
1217 pub fn LLVMBuildFPToUI(B: BuilderRef,
1220 Name: *const c_char)
1222 pub fn LLVMBuildFPToSI(B: BuilderRef,
1225 Name: *const c_char)
1227 pub fn LLVMBuildUIToFP(B: BuilderRef,
1230 Name: *const c_char)
1232 pub fn LLVMBuildSIToFP(B: BuilderRef,
1235 Name: *const c_char)
1237 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1240 Name: *const c_char)
1242 pub fn LLVMBuildFPExt(B: BuilderRef,
1245 Name: *const c_char)
1247 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1250 Name: *const c_char)
1252 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1255 Name: *const c_char)
1257 pub fn LLVMBuildBitCast(B: BuilderRef,
1260 Name: *const c_char)
1262 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1265 Name: *const c_char)
1267 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1270 Name: *const c_char)
1272 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1275 Name: *const c_char)
1277 pub fn LLVMBuildCast(B: BuilderRef,
1281 Name: *const c_char) -> ValueRef;
1282 pub fn LLVMBuildPointerCast(B: BuilderRef,
1285 Name: *const c_char)
1287 pub fn LLVMBuildIntCast(B: BuilderRef,
1290 Name: *const c_char)
1292 pub fn LLVMBuildFPCast(B: BuilderRef,
1295 Name: *const c_char)
1299 pub fn LLVMBuildICmp(B: BuilderRef,
1303 Name: *const c_char)
1305 pub fn LLVMBuildFCmp(B: BuilderRef,
1309 Name: *const c_char)
1312 /* Miscellaneous instructions */
1313 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1315 pub fn LLVMBuildCall(B: BuilderRef,
1317 Args: *const ValueRef,
1319 Name: *const c_char)
1321 pub fn LLVMBuildSelect(B: BuilderRef,
1325 Name: *const c_char)
1327 pub fn LLVMBuildVAArg(B: BuilderRef,
1330 Name: *const c_char)
1332 pub fn LLVMBuildExtractElement(B: BuilderRef,
1335 Name: *const c_char)
1337 pub fn LLVMBuildInsertElement(B: BuilderRef,
1341 Name: *const c_char)
1343 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1347 Name: *const c_char)
1349 pub fn LLVMBuildExtractValue(B: BuilderRef,
1352 Name: *const c_char)
1354 pub fn LLVMBuildInsertValue(B: BuilderRef,
1358 Name: *const c_char)
1361 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
1363 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
1365 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1368 Name: *const c_char)
1371 /* Atomic Operations */
1372 pub fn LLVMBuildAtomicLoad(B: BuilderRef,
1373 PointerVal: ValueRef,
1374 Name: *const c_char,
1375 Order: AtomicOrdering,
1379 pub fn LLVMBuildAtomicStore(B: BuilderRef,
1382 Order: AtomicOrdering,
1386 pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
1390 Order: AtomicOrdering,
1391 FailureOrder: AtomicOrdering)
1393 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1397 Order: AtomicOrdering,
1398 SingleThreaded: Bool)
1401 pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
1404 /* Selected entries from the downcasts. */
1405 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1406 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1408 /** Writes a module to the specified path. Returns 0 on success. */
1409 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1411 /** Creates target data from a target layout string. */
1412 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1413 /// Adds the target data to the given pass manager. The pass manager
1414 /// references the target data only weakly.
1415 pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
1416 /** Number of bytes clobbered when doing a Store to *T. */
1417 pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
1420 /** Number of bytes clobbered when doing a Store to *T. */
1421 pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
1424 /** Distance between successive elements in an array of T.
1425 Includes ABI padding. */
1426 pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1428 /** Returns the preferred alignment of a type. */
1429 pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1431 /** Returns the minimum alignment of a type. */
1432 pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1435 /// Computes the byte offset of the indexed struct element for a
1437 pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1443 * Returns the minimum alignment of a type when part of a call frame.
1445 pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1448 /** Disposes target data. */
1449 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1451 /** Creates a pass manager. */
1452 pub fn LLVMCreatePassManager() -> PassManagerRef;
1454 /** Creates a function-by-function pass manager */
1455 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef)
1458 /** Disposes a pass manager. */
1459 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1461 /** Runs a pass manager on a module. */
1462 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1464 /** Runs the function passes on the provided function. */
1465 pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef)
1468 /** Initializes all the function passes scheduled in the manager */
1469 pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool;
1471 /** Finalizes all the function passes scheduled in the manager */
1472 pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
1474 pub fn LLVMInitializePasses();
1476 /** Adds a verification pass. */
1477 pub fn LLVMAddVerifierPass(PM: PassManagerRef);
1479 pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
1480 pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
1481 pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
1482 pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
1483 pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
1484 pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
1485 pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
1486 pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
1487 pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
1488 pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
1489 pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
1490 pub fn LLVMAddReassociatePass(PM: PassManagerRef);
1491 pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
1492 pub fn LLVMAddLICMPass(PM: PassManagerRef);
1493 pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
1494 pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
1495 pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
1496 pub fn LLVMAddGVNPass(PM: PassManagerRef);
1497 pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
1498 pub fn LLVMAddSCCPPass(PM: PassManagerRef);
1499 pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
1500 pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
1501 pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
1502 pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
1503 pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
1504 pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
1505 pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
1506 pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
1507 pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
1508 pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
1509 pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
1510 pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
1511 pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
1512 pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
1513 pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
1515 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1516 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1517 pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
1518 OptimizationLevel: c_uint);
1519 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
1521 pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
1522 PMB: PassManagerBuilderRef,
1524 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
1525 PMB: PassManagerBuilderRef,
1527 pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
1528 PMB: PassManagerBuilderRef,
1530 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1531 PMB: PassManagerBuilderRef,
1533 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1534 PMB: PassManagerBuilderRef,
1535 PM: PassManagerRef);
1537 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1538 PMB: PassManagerBuilderRef,
1539 PM: PassManagerRef);
1540 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1541 PMB: PassManagerBuilderRef,
1546 /** Destroys a memory buffer. */
1547 pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
1550 /* Stuff that's in rustllvm/ because it's not upstream yet. */
1552 /** Opens an object file. */
1553 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1554 /** Closes an object file. */
1555 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1557 /** Enumerates the sections in an object file. */
1558 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1559 /** Destroys a section iterator. */
1560 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1561 /** Returns true if the section iterator is at the end of the section
1563 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
1564 SI: SectionIteratorRef)
1566 /** Moves the section iterator to point to the next section. */
1567 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1568 /** Returns the current section size. */
1569 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1570 /** Returns the current section contents as a string buffer. */
1571 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1573 /** Reads the given file and returns it as a memory buffer. Use
1574 LLVMDisposeMemoryBuffer() to get rid of it. */
1575 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char)
1577 /** Borrows the contents of the memory buffer (doesn't copy it) */
1578 pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const c_char,
1579 InputDataLength: size_t,
1580 BufferName: *const c_char,
1583 pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const c_char,
1584 InputDataLength: size_t,
1585 BufferName: *const c_char)
1588 pub fn LLVMIsMultithreaded() -> Bool;
1589 pub fn LLVMStartMultithreaded() -> Bool;
1591 /** Returns a string describing the last error caused by an LLVMRust*
1593 pub fn LLVMRustGetLastError() -> *const c_char;
1595 /// Print the pass timings since static dtors aren't picking them up.
1596 pub fn LLVMRustPrintPassTimings();
1598 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1600 pub fn LLVMStructSetBody(StructTy: TypeRef,
1601 ElementTypes: *const TypeRef,
1602 ElementCount: c_uint,
1605 pub fn LLVMConstNamedStruct(S: TypeRef,
1606 ConstantVals: *const ValueRef,
1610 /** Enables LLVM debug output. */
1611 pub fn LLVMSetDebug(Enabled: c_int);
1613 /** Prepares inline assembly. */
1614 pub fn LLVMInlineAsm(Ty: TypeRef,
1615 AsmString: *const c_char,
1616 Constraints: *const c_char,
1622 pub static LLVMRustDebugMetadataVersion: u32;
1624 pub fn LLVMRustAddModuleFlag(M: ModuleRef,
1625 name: *const c_char,
1628 pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1630 pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
1632 pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef);
1634 pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1636 File: *const c_char,
1638 Producer: *const c_char,
1640 Flags: *const c_char,
1642 SplitName: *const c_char);
1644 pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
1645 Filename: *const c_char,
1646 Directory: *const c_char)
1649 pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1651 ParameterTypes: DIArray)
1654 pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
1655 Scope: DIDescriptor,
1656 Name: *const c_char,
1657 LinkageName: *const c_char,
1661 isLocalToUnit: bool,
1671 pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
1672 Name: *const c_char,
1673 SizeInBits: c_ulonglong,
1674 AlignInBits: c_ulonglong,
1678 pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
1680 SizeInBits: c_ulonglong,
1681 AlignInBits: c_ulonglong,
1682 Name: *const c_char)
1685 pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
1686 Scope: DIDescriptor,
1687 Name: *const c_char,
1690 SizeInBits: c_ulonglong,
1691 AlignInBits: c_ulonglong,
1693 DerivedFrom: DIType,
1695 RunTimeLang: c_uint,
1696 VTableHolder: ValueRef,
1697 UniqueId: *const c_char)
1700 pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
1701 Scope: DIDescriptor,
1702 Name: *const c_char,
1705 SizeInBits: c_ulonglong,
1706 AlignInBits: c_ulonglong,
1707 OffsetInBits: c_ulonglong,
1712 pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1713 Scope: DIDescriptor,
1717 Discriminator: c_uint)
1720 pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1721 Context: DIDescriptor,
1722 Name: *const c_char,
1723 LinkageName: *const c_char,
1727 isLocalToUnit: bool,
1730 -> DIGlobalVariable;
1732 pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
1734 Scope: DIDescriptor,
1735 Name: *const c_char,
1739 AlwaysPreserve: bool,
1744 pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
1746 AlignInBits: c_ulonglong,
1748 Subscripts: DIArray)
1751 pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
1753 AlignInBits: c_ulonglong,
1755 Subscripts: DIArray)
1758 pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1763 pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1764 Ptr: *const DIDescriptor,
1768 pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1770 VarInfo: DIVariable,
1771 InsertAtEnd: BasicBlockRef)
1774 pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
1776 VarInfo: DIVariable,
1777 InsertBefore: ValueRef)
1780 pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1781 Name: *const c_char,
1785 pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1787 Name: *const c_char,
1790 SizeInBits: c_ulonglong,
1791 AlignInBits: c_ulonglong,
1793 ClassType: ValueRef)
1796 pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
1798 Name: *const c_char,
1801 SizeInBits: c_ulonglong,
1802 AlignInBits: c_ulonglong,
1805 RunTimeLang: c_uint,
1806 UniqueId: *const c_char)
1809 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1811 pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1813 Name: *const c_char,
1820 pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
1822 pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
1824 pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
1827 Name: *const c_char,
1831 AddrOps: *const ValueRef,
1832 AddrOpsCount: c_uint,
1836 pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1838 Name: *const c_char,
1843 pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
1844 pub fn LLVMWriteTypeToString(Type: TypeRef, s: RustStringRef);
1845 pub fn LLVMWriteValueToString(value_ref: ValueRef, s: RustStringRef);
1847 pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
1849 pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
1851 pub fn LLVMInitializeX86TargetInfo();
1852 pub fn LLVMInitializeX86Target();
1853 pub fn LLVMInitializeX86TargetMC();
1854 pub fn LLVMInitializeX86AsmPrinter();
1855 pub fn LLVMInitializeX86AsmParser();
1856 pub fn LLVMInitializeARMTargetInfo();
1857 pub fn LLVMInitializeARMTarget();
1858 pub fn LLVMInitializeARMTargetMC();
1859 pub fn LLVMInitializeARMAsmPrinter();
1860 pub fn LLVMInitializeARMAsmParser();
1861 pub fn LLVMInitializeMipsTargetInfo();
1862 pub fn LLVMInitializeMipsTarget();
1863 pub fn LLVMInitializeMipsTargetMC();
1864 pub fn LLVMInitializeMipsAsmPrinter();
1865 pub fn LLVMInitializeMipsAsmParser();
1867 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
1868 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1870 Features: *const c_char,
1871 Model: CodeGenModel,
1873 Level: CodeGenOptLevel,
1876 NoFramePointerElim: bool,
1877 FunctionSections: bool,
1878 DataSections: bool) -> TargetMachineRef;
1879 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1880 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
1883 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1885 DisableSimplifyLibCalls: bool);
1886 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef,
1887 DisableSimplifyLibCalls: bool);
1888 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1889 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1892 Output: *const c_char,
1893 FileType: FileType) -> bool;
1894 pub fn LLVMRustPrintModule(PM: PassManagerRef,
1896 Output: *const c_char);
1897 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1898 pub fn LLVMRustPrintPasses();
1899 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1900 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
1901 AddLifetimes: bool);
1902 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef,
1904 len: size_t) -> bool;
1905 pub fn LLVMRustRunRestrictionPass(M: ModuleRef,
1906 syms: *const *const c_char,
1908 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1910 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1911 pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *const c_char,
1912 out_len: *mut size_t) -> *const c_char;
1913 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1915 pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
1916 pub fn LLVMVersionMajor() -> c_int;
1917 pub fn LLVMVersionMinor() -> c_int;
1919 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
1920 data: *mut *const c_char) -> c_int;
1923 pub fn SetInstructionCallConv(instr: ValueRef, cc: CallConv) {
1925 LLVMSetInstructionCallConv(instr, cc as c_uint);
1928 pub fn SetFunctionCallConv(fn_: ValueRef, cc: CallConv) {
1930 LLVMSetFunctionCallConv(fn_, cc as c_uint);
1933 pub fn SetLinkage(global: ValueRef, link: Linkage) {
1935 LLVMSetLinkage(global, link as c_uint);
1939 pub fn SetUnnamedAddr(global: ValueRef, unnamed: bool) {
1941 LLVMSetUnnamedAddr(global, unnamed as Bool);
1945 pub fn set_thread_local(global: ValueRef, is_thread_local: bool) {
1947 LLVMSetThreadLocal(global, is_thread_local as Bool);
1951 pub fn ConstICmp(pred: IntPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
1953 LLVMConstICmp(pred as c_ushort, v1, v2)
1956 pub fn ConstFCmp(pred: RealPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
1958 LLVMConstFCmp(pred as c_ushort, v1, v2)
1962 pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
1964 LLVMAddFunctionAttribute(fn_, FunctionIndex as c_uint, attr as uint64_t)
1968 /* Memory-managed interface to target data. */
1970 pub struct TargetData {
1971 pub lltd: TargetDataRef
1974 impl Drop for TargetData {
1975 fn drop(&mut self) {
1977 LLVMDisposeTargetData(self.lltd);
1982 pub fn mk_target_data(string_rep: &str) -> TargetData {
1984 lltd: string_rep.with_c_str(|buf| {
1985 unsafe { LLVMCreateTargetData(buf) }
1990 /* Memory-managed interface to object files. */
1992 pub struct ObjectFile {
1993 pub llof: ObjectFileRef,
1997 // This will take ownership of llmb
1998 pub fn new(llmb: MemoryBufferRef) -> Option<ObjectFile> {
2000 let llof = LLVMCreateObjectFile(llmb);
2001 if llof as int == 0 {
2002 // LLVMCreateObjectFile took ownership of llmb
2013 impl Drop for ObjectFile {
2014 fn drop(&mut self) {
2016 LLVMDisposeObjectFile(self.llof);
2021 /* Memory-managed interface to section iterators. */
2023 pub struct SectionIter {
2024 pub llsi: SectionIteratorRef
2027 impl Drop for SectionIter {
2028 fn drop(&mut self) {
2030 LLVMDisposeSectionIterator(self.llsi);
2035 pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
2038 llsi: LLVMGetSections(llof)
2043 /// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
2044 pub fn get_param(llfn: ValueRef, index: c_uint) -> ValueRef {
2046 assert!(index < LLVMCountParams(llfn));
2047 LLVMGetParam(llfn, index)
2051 pub enum RustString_opaque {}
2052 pub type RustStringRef = *mut RustString_opaque;
2053 type RustStringRepr = *mut RefCell<Vec<u8>>;
2055 /// Appending to a Rust string -- used by raw_rust_string_ostream.
2057 pub unsafe extern "C" fn rust_llvm_string_write_impl(sr: RustStringRef,
2060 let slice: &[u8] = mem::transmute(raw::Slice {
2061 data: ptr as *const u8,
2065 let sr: RustStringRepr = mem::transmute(sr);
2066 (*sr).borrow_mut().push_all(slice);
2069 pub fn build_string(f: |RustStringRef|) -> Option<String> {
2070 let mut buf = RefCell::new(Vec::new());
2071 f(&mut buf as RustStringRepr as RustStringRef);
2072 String::from_utf8(buf.unwrap()).ok()
2075 // FIXME #15460 - create a public function that actually calls our
2076 // static LLVM symbols. Otherwise the linker will just throw llvm
2077 // away. We're just calling lots of stuff until we transitively get
2078 // all of LLVM. This is worse than anything.
2079 pub unsafe fn static_link_hack_this_sucks() {
2080 LLVMInitializePasses();
2082 LLVMInitializeX86TargetInfo();
2083 LLVMInitializeX86Target();
2084 LLVMInitializeX86TargetMC();
2085 LLVMInitializeX86AsmPrinter();
2086 LLVMInitializeX86AsmParser();
2088 LLVMInitializeARMTargetInfo();
2089 LLVMInitializeARMTarget();
2090 LLVMInitializeARMTargetMC();
2091 LLVMInitializeARMAsmPrinter();
2092 LLVMInitializeARMAsmParser();
2094 LLVMInitializeMipsTargetInfo();
2095 LLVMInitializeMipsTarget();
2096 LLVMInitializeMipsTargetMC();
2097 LLVMInitializeMipsAsmPrinter();
2098 LLVMInitializeMipsAsmParser();
2100 LLVMRustSetLLVMOptions(0 as c_int,
2103 LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
2104 LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
2105 LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
2106 LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
2107 LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
2108 LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
2109 LLVMPassManagerBuilderCreate();
2110 LLVMPassManagerBuilderDispose(0 as *mut _);
2112 LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
2116 LLVMLinkInInterpreter();
2120 fn LLVMLinkInMCJIT();
2121 fn LLVMLinkInInterpreter();
2125 // The module containing the native LLVM dependencies, generated by the build system
2126 // Note that this must come after the rustllvm extern declaration so that
2127 // parts of LLVM that rustllvm depends on aren't thrown away by the linker.
2128 // Works to the above fix for #15460 to ensure LLVM dependencies that
2129 // are only used by rustllvm don't get stripped by the linker.