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 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};
40 pub type Opcode = u32;
41 pub type Bool = c_uint;
43 pub static True: Bool = 1 as Bool;
44 pub static False: Bool = 0 as Bool;
46 // Consts for the LLVM CallConv type, pre-cast to uint.
48 #[deriving(PartialEq)]
53 X86StdcallCallConv = 64,
54 X86FastcallCallConv = 65,
59 LLVMDefaultVisibility = 0,
61 ProtectedVisibility = 2,
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.
70 AvailableExternallyLinkage = 1,
71 LinkOnceAnyLinkage = 2,
72 LinkOnceODRLinkage = 3,
78 ExternalWeakLinkage = 12,
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,
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,
133 pub enum SpecialAttribute {
134 DereferenceableAttribute(u64)
138 pub enum AttributeSet {
144 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef);
145 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef);
148 impl AttrHelper for Attribute {
149 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
151 LLVMAddFunctionAttribute(llfn, idx, *self as uint64_t);
155 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
157 LLVMAddCallSiteAttribute(callsite, idx, *self as uint64_t);
162 impl AttrHelper for OtherAttribute {
163 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
165 LLVMAddFunctionAttribute(llfn, idx, *self as uint64_t);
169 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
171 LLVMAddCallSiteAttribute(callsite, idx, *self as uint64_t);
176 impl AttrHelper for SpecialAttribute {
177 fn apply_llfn(&self, idx: c_uint, llfn: ValueRef) {
179 DereferenceableAttribute(bytes) => unsafe {
180 LLVMAddDereferenceableAttr(llfn, idx, bytes as uint64_t);
185 fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
187 DereferenceableAttribute(bytes) => unsafe {
188 LLVMAddDereferenceableCallSiteAttr(callsite, idx, bytes as uint64_t);
194 pub struct AttrBuilder {
195 attrs: Vec<(uint, Box<AttrHelper+'static>)>
199 pub fn new() -> AttrBuilder {
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>));
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>));
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);
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);
228 // enum for the LLVM IntPredicate type
229 pub enum IntPredicate {
242 // enum for the LLVM RealPredicate type
243 pub enum RealPredicate {
244 RealPredicateFalse = 0,
259 RealPredicateTrue = 15,
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)]
286 pub enum AtomicBinOp {
301 pub enum AtomicOrdering {
305 // Consume = 3, // Not specified yet.
309 SequentiallyConsistent = 7
312 // Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
328 // Inline Asm Dialect
329 pub enum AsmDialect {
334 #[deriving(PartialEq, Clone)]
336 pub enum CodeGenOptLevel {
337 CodeGenLevelNone = 0,
338 CodeGenLevelLess = 1,
339 CodeGenLevelDefault = 2,
340 CodeGenLevelAggressive = 3,
348 RelocDynamicNoPic = 3,
352 pub enum CodeGenModel {
353 CodeModelDefault = 0,
354 CodeModelJITDefault = 1,
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;
398 use super::{ValueRef};
400 pub enum DIBuilder_opaque {}
401 pub type DIBuilderRef = *mut DIBuilder_opaque;
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;
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 FlagIndirectVariable = 1 << 13,
433 FlagLValueReference = 1 << 14,
434 FlagRValueReference = 1 << 15
439 // Link to our native llvm bindings (things that we need to use the C++ api
440 // for) and because llvm is written in C++ we need to link against libstdc++
442 // You'll probably notice that there is an omission of all LLVM libraries
443 // from this location. This is because the set of LLVM libraries that we
444 // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
445 // figure out the exact set of libraries. To do this, the build system
446 // generates an llvmdeps.rs file next to this one which will be
447 // automatically updated whenever LLVM is updated to include an up-to-date
448 // set of the libraries we need to link to LLVM for.
449 #[link(name = "rustllvm", kind = "static")]
451 /* Create and destroy contexts. */
452 pub fn LLVMContextCreate() -> ContextRef;
453 pub fn LLVMContextDispose(C: ContextRef);
454 pub fn LLVMGetMDKindIDInContext(C: ContextRef,
459 /* Create and destroy modules. */
460 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char,
463 pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
464 pub fn LLVMDisposeModule(M: ModuleRef);
466 /** Data layout. See Module::getDataLayout. */
467 pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
468 pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
470 /** Target triple. See Module::getTargetTriple. */
471 pub fn LLVMGetTarget(M: ModuleRef) -> *const c_char;
472 pub fn LLVMSetTarget(M: ModuleRef, Triple: *const c_char);
474 /** See Module::dump. */
475 pub fn LLVMDumpModule(M: ModuleRef);
477 /** See Module::setModuleInlineAsm. */
478 pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
480 /** See llvm::LLVMTypeKind::getTypeID. */
481 pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
483 /** See llvm::LLVMType::getContext. */
484 pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
486 /* Operations on integer types */
487 pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
488 pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
489 pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
490 pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
491 pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
492 pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
495 pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
497 /* Operations on real types */
498 pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
499 pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
500 pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
501 pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
502 pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
504 /* Operations on function types */
505 pub fn LLVMFunctionType(ReturnType: TypeRef,
506 ParamTypes: *const TypeRef,
510 pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
511 pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
512 pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
513 pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *const TypeRef);
515 /* Operations on struct types */
516 pub fn LLVMStructTypeInContext(C: ContextRef,
517 ElementTypes: *const TypeRef,
518 ElementCount: c_uint,
521 pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
522 pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
524 pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
526 /* Operations on array, pointer, and vector types (sequence types) */
527 pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
528 pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
530 pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
533 pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
534 pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
535 pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
536 pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
538 pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
540 /* Operations on other types */
541 pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
542 pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
543 pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
545 /* Operations on all values */
546 pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
547 pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
548 pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
549 pub fn LLVMDumpValue(Val: ValueRef);
550 pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
551 pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
552 pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
553 pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
555 /* Operations on Uses */
556 pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
557 pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
558 pub fn LLVMGetUser(U: UseRef) -> ValueRef;
559 pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
561 /* Operations on Users */
562 pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
563 pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
564 pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
566 /* Operations on constants of any type */
567 pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
569 pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
570 pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
572 pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
574 /* only for int/vector */
575 pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
576 pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
577 pub fn LLVMIsNull(Val: ValueRef) -> Bool;
578 pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
579 pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
581 /* Operations on metadata */
582 pub fn LLVMMDStringInContext(C: ContextRef,
586 pub fn LLVMMDNodeInContext(C: ContextRef,
587 Vals: *const ValueRef,
590 pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
594 /* Operations on scalar constants */
595 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
597 pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *const c_char, Radix: u8)
599 pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
604 pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
605 pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *const c_char)
607 pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
611 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
612 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
615 /* Operations on composite constants */
616 pub fn LLVMConstStringInContext(C: ContextRef,
619 DontNullTerminate: Bool)
621 pub fn LLVMConstStructInContext(C: ContextRef,
622 ConstantVals: *const ValueRef,
627 pub fn LLVMConstArray(ElementTy: TypeRef,
628 ConstantVals: *const ValueRef,
631 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint)
634 /* Constant expressions */
635 pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
636 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
637 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
638 pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
639 pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
640 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
641 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
642 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
644 pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
646 pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
648 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
650 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
652 pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
654 pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
656 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
658 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
660 pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
662 pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
664 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
666 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
668 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
670 pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
671 RHSConstant: ValueRef)
673 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
675 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
677 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
679 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
681 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef)
683 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
685 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef)
687 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
689 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
691 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
693 pub fn LLVMConstGEP(ConstantVal: ValueRef,
694 ConstantIndices: *const ValueRef,
697 pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
698 ConstantIndices: *const ValueRef,
701 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
703 pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
705 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef)
707 pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
709 pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef)
711 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
713 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef)
715 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
717 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef)
719 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
721 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef)
723 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
725 pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
727 pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
729 pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
731 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
733 pub fn LLVMConstIntCast(ConstantVal: ValueRef,
737 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
739 pub fn LLVMConstSelect(ConstantCondition: ValueRef,
740 ConstantIfTrue: ValueRef,
741 ConstantIfFalse: ValueRef)
743 pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
744 IndexConstant: ValueRef)
746 pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
747 ElementValueConstant: ValueRef,
748 IndexConstant: ValueRef)
750 pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
751 VectorBConstant: ValueRef,
752 MaskConstant: ValueRef)
754 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
755 IdxList: *const c_uint,
758 pub fn LLVMConstInsertValue(AggConstant: ValueRef,
759 ElementValueConstant: ValueRef,
760 IdxList: *const c_uint,
763 pub fn LLVMConstInlineAsm(Ty: TypeRef,
764 AsmString: *const c_char,
765 Constraints: *const c_char,
766 HasSideEffects: Bool,
769 pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
773 /* Operations on global variables, functions, and aliases (globals) */
774 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
775 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
776 pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
777 pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
778 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
779 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
780 pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
781 pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
782 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
783 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
786 /* Operations on global variables */
787 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char)
789 pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
792 AddressSpace: c_uint)
794 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
795 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
796 pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
797 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
798 pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
799 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
800 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
801 pub fn LLVMSetInitializer(GlobalVar: ValueRef,
802 ConstantVal: ValueRef);
803 pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
804 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
805 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
806 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
808 /* Operations on aliases */
809 pub fn LLVMAddAlias(M: ModuleRef,
815 /* Operations on functions */
816 pub fn LLVMAddFunction(M: ModuleRef,
820 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
821 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
822 pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
823 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
824 pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
825 pub fn LLVMDeleteFunction(Fn: ValueRef);
826 pub fn LLVMGetOrInsertFunction(M: ModuleRef,
830 pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
831 pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
832 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
833 pub fn LLVMGetGC(Fn: ValueRef) -> *const c_char;
834 pub fn LLVMSetGC(Fn: ValueRef, Name: *const c_char);
835 pub fn LLVMAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: uint64_t);
836 pub fn LLVMAddFunctionAttribute(Fn: ValueRef, index: c_uint, PA: uint64_t);
837 pub fn LLVMAddFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
838 pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
839 pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
841 /* Operations on parameters */
842 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
843 pub fn LLVMGetParams(Fn: ValueRef, Params: *const ValueRef);
844 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
845 pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
846 pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
847 pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
848 pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
849 pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
850 pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
851 pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
852 pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
853 pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
855 /* Operations on basic blocks */
856 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
857 pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
858 pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
859 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
860 pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
861 pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *const ValueRef);
862 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
863 pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
864 pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
865 pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
866 pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
868 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
872 pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
876 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
878 pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
879 MoveAfter: BasicBlockRef);
881 pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef,
882 MoveBefore: BasicBlockRef);
884 /* Operations on instructions */
885 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
886 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
887 pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
888 pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
889 pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
890 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
892 /* Operations on call sites */
893 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
894 pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
895 pub fn LLVMAddInstrAttribute(Instr: ValueRef,
898 pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
901 pub fn LLVMSetInstrParamAlignment(Instr: ValueRef,
904 pub fn LLVMAddCallSiteAttribute(Instr: ValueRef,
907 pub fn LLVMAddDereferenceableCallSiteAttr(Instr: ValueRef,
911 /* Operations on call instructions (only) */
912 pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
913 pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
915 /* Operations on load/store instructions (only) */
916 pub fn LLVMGetVolatile(MemoryAccessInst: ValueRef) -> Bool;
917 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
919 /* Operations on phi nodes */
920 pub fn LLVMAddIncoming(PhiNode: ValueRef,
921 IncomingValues: *const ValueRef,
922 IncomingBlocks: *const BasicBlockRef,
924 pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
925 pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
927 pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint)
930 /* Instruction builders */
931 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
932 pub fn LLVMPositionBuilder(Builder: BuilderRef,
933 Block: BasicBlockRef,
935 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
937 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
938 Block: BasicBlockRef);
939 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
940 pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
941 pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
942 pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
944 Name: *const c_char);
945 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
946 pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
949 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
950 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
951 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
954 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
955 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
956 pub fn LLVMBuildAggregateRet(B: BuilderRef,
957 RetVals: *const ValueRef,
960 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
961 pub fn LLVMBuildCondBr(B: BuilderRef,
966 pub fn LLVMBuildSwitch(B: BuilderRef,
971 pub fn LLVMBuildIndirectBr(B: BuilderRef,
975 pub fn LLVMBuildInvoke(B: BuilderRef,
977 Args: *const ValueRef,
980 Catch: BasicBlockRef,
983 pub fn LLVMBuildLandingPad(B: BuilderRef,
989 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
990 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
992 /* Add a case to the switch instruction */
993 pub fn LLVMAddCase(Switch: ValueRef,
995 Dest: BasicBlockRef);
997 /* Add a destination to the indirectbr instruction */
998 pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
1000 /* Add a clause to the landing pad instruction */
1001 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
1003 /* Set the cleanup on a landing pad instruction */
1004 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
1007 pub fn LLVMBuildAdd(B: BuilderRef,
1010 Name: *const c_char)
1012 pub fn LLVMBuildNSWAdd(B: BuilderRef,
1015 Name: *const c_char)
1017 pub fn LLVMBuildNUWAdd(B: BuilderRef,
1020 Name: *const c_char)
1022 pub fn LLVMBuildFAdd(B: BuilderRef,
1025 Name: *const c_char)
1027 pub fn LLVMBuildSub(B: BuilderRef,
1030 Name: *const c_char)
1032 pub fn LLVMBuildNSWSub(B: BuilderRef,
1035 Name: *const c_char)
1037 pub fn LLVMBuildNUWSub(B: BuilderRef,
1040 Name: *const c_char)
1042 pub fn LLVMBuildFSub(B: BuilderRef,
1045 Name: *const c_char)
1047 pub fn LLVMBuildMul(B: BuilderRef,
1050 Name: *const c_char)
1052 pub fn LLVMBuildNSWMul(B: BuilderRef,
1055 Name: *const c_char)
1057 pub fn LLVMBuildNUWMul(B: BuilderRef,
1060 Name: *const c_char)
1062 pub fn LLVMBuildFMul(B: BuilderRef,
1065 Name: *const c_char)
1067 pub fn LLVMBuildUDiv(B: BuilderRef,
1070 Name: *const c_char)
1072 pub fn LLVMBuildSDiv(B: BuilderRef,
1075 Name: *const c_char)
1077 pub fn LLVMBuildExactSDiv(B: BuilderRef,
1080 Name: *const c_char)
1082 pub fn LLVMBuildFDiv(B: BuilderRef,
1085 Name: *const c_char)
1087 pub fn LLVMBuildURem(B: BuilderRef,
1090 Name: *const c_char)
1092 pub fn LLVMBuildSRem(B: BuilderRef,
1095 Name: *const c_char)
1097 pub fn LLVMBuildFRem(B: BuilderRef,
1100 Name: *const c_char)
1102 pub fn LLVMBuildShl(B: BuilderRef,
1105 Name: *const c_char)
1107 pub fn LLVMBuildLShr(B: BuilderRef,
1110 Name: *const c_char)
1112 pub fn LLVMBuildAShr(B: BuilderRef,
1115 Name: *const c_char)
1117 pub fn LLVMBuildAnd(B: BuilderRef,
1120 Name: *const c_char)
1122 pub fn LLVMBuildOr(B: BuilderRef,
1125 Name: *const c_char)
1127 pub fn LLVMBuildXor(B: BuilderRef,
1130 Name: *const c_char)
1132 pub fn LLVMBuildBinOp(B: BuilderRef,
1136 Name: *const c_char)
1138 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1140 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1142 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1144 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char)
1146 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char)
1150 pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1152 pub fn LLVMBuildArrayMalloc(B: BuilderRef,
1155 Name: *const c_char)
1157 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1159 pub fn LLVMBuildArrayAlloca(B: BuilderRef,
1162 Name: *const c_char)
1164 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
1165 pub fn LLVMBuildLoad(B: BuilderRef,
1166 PointerVal: ValueRef,
1167 Name: *const c_char)
1170 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
1173 pub fn LLVMBuildGEP(B: BuilderRef,
1175 Indices: *const ValueRef,
1177 Name: *const c_char)
1179 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
1181 Indices: *const ValueRef,
1183 Name: *const c_char)
1185 pub fn LLVMBuildStructGEP(B: BuilderRef,
1188 Name: *const c_char)
1190 pub fn LLVMBuildGlobalString(B: BuilderRef,
1192 Name: *const c_char)
1194 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1196 Name: *const c_char)
1200 pub fn LLVMBuildTrunc(B: BuilderRef,
1203 Name: *const c_char)
1205 pub fn LLVMBuildZExt(B: BuilderRef,
1208 Name: *const c_char)
1210 pub fn LLVMBuildSExt(B: BuilderRef,
1213 Name: *const c_char)
1215 pub fn LLVMBuildFPToUI(B: BuilderRef,
1218 Name: *const c_char)
1220 pub fn LLVMBuildFPToSI(B: BuilderRef,
1223 Name: *const c_char)
1225 pub fn LLVMBuildUIToFP(B: BuilderRef,
1228 Name: *const c_char)
1230 pub fn LLVMBuildSIToFP(B: BuilderRef,
1233 Name: *const c_char)
1235 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1238 Name: *const c_char)
1240 pub fn LLVMBuildFPExt(B: BuilderRef,
1243 Name: *const c_char)
1245 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1248 Name: *const c_char)
1250 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1253 Name: *const c_char)
1255 pub fn LLVMBuildBitCast(B: BuilderRef,
1258 Name: *const c_char)
1260 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1263 Name: *const c_char)
1265 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1268 Name: *const c_char)
1270 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1273 Name: *const c_char)
1275 pub fn LLVMBuildCast(B: BuilderRef,
1279 Name: *const c_char) -> ValueRef;
1280 pub fn LLVMBuildPointerCast(B: BuilderRef,
1283 Name: *const c_char)
1285 pub fn LLVMBuildIntCast(B: BuilderRef,
1288 Name: *const c_char)
1290 pub fn LLVMBuildFPCast(B: BuilderRef,
1293 Name: *const c_char)
1297 pub fn LLVMBuildICmp(B: BuilderRef,
1301 Name: *const c_char)
1303 pub fn LLVMBuildFCmp(B: BuilderRef,
1307 Name: *const c_char)
1310 /* Miscellaneous instructions */
1311 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
1313 pub fn LLVMBuildCall(B: BuilderRef,
1315 Args: *const ValueRef,
1317 Name: *const c_char)
1319 pub fn LLVMBuildSelect(B: BuilderRef,
1323 Name: *const c_char)
1325 pub fn LLVMBuildVAArg(B: BuilderRef,
1328 Name: *const c_char)
1330 pub fn LLVMBuildExtractElement(B: BuilderRef,
1333 Name: *const c_char)
1335 pub fn LLVMBuildInsertElement(B: BuilderRef,
1339 Name: *const c_char)
1341 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1345 Name: *const c_char)
1347 pub fn LLVMBuildExtractValue(B: BuilderRef,
1350 Name: *const c_char)
1352 pub fn LLVMBuildInsertValue(B: BuilderRef,
1356 Name: *const c_char)
1359 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
1361 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char)
1363 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1366 Name: *const c_char)
1369 /* Atomic Operations */
1370 pub fn LLVMBuildAtomicLoad(B: BuilderRef,
1371 PointerVal: ValueRef,
1372 Name: *const c_char,
1373 Order: AtomicOrdering,
1377 pub fn LLVMBuildAtomicStore(B: BuilderRef,
1380 Order: AtomicOrdering,
1384 pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
1388 Order: AtomicOrdering,
1389 FailureOrder: AtomicOrdering)
1391 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1395 Order: AtomicOrdering,
1396 SingleThreaded: Bool)
1399 pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
1402 /* Selected entries from the downcasts. */
1403 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1404 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1406 /** Writes a module to the specified path. Returns 0 on success. */
1407 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1409 /** Creates target data from a target layout string. */
1410 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1411 /// Adds the target data to the given pass manager. The pass manager
1412 /// references the target data only weakly.
1413 pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
1414 /** Number of bytes clobbered when doing a Store to *T. */
1415 pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
1418 /** Number of bytes clobbered when doing a Store to *T. */
1419 pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
1422 /** Distance between successive elements in an array of T.
1423 Includes ABI padding. */
1424 pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1426 /** Returns the preferred alignment of a type. */
1427 pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1429 /** Returns the minimum alignment of a type. */
1430 pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1433 /// Computes the byte offset of the indexed struct element for a
1435 pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1441 * Returns the minimum alignment of a type when part of a call frame.
1443 pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
1446 /** Disposes target data. */
1447 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1449 /** Creates a pass manager. */
1450 pub fn LLVMCreatePassManager() -> PassManagerRef;
1452 /** Creates a function-by-function pass manager */
1453 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef)
1456 /** Disposes a pass manager. */
1457 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1459 /** Runs a pass manager on a module. */
1460 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1462 /** Runs the function passes on the provided function. */
1463 pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef)
1466 /** Initializes all the function passes scheduled in the manager */
1467 pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool;
1469 /** Finalizes all the function passes scheduled in the manager */
1470 pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
1472 pub fn LLVMInitializePasses();
1474 /** Adds a verification pass. */
1475 pub fn LLVMAddVerifierPass(PM: PassManagerRef);
1477 pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
1478 pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
1479 pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
1480 pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
1481 pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
1482 pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
1483 pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
1484 pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
1485 pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
1486 pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
1487 pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
1488 pub fn LLVMAddReassociatePass(PM: PassManagerRef);
1489 pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
1490 pub fn LLVMAddLICMPass(PM: PassManagerRef);
1491 pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
1492 pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
1493 pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
1494 pub fn LLVMAddGVNPass(PM: PassManagerRef);
1495 pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
1496 pub fn LLVMAddSCCPPass(PM: PassManagerRef);
1497 pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
1498 pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
1499 pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
1500 pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
1501 pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
1502 pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
1503 pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
1504 pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
1505 pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
1506 pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
1507 pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
1508 pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
1509 pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
1510 pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
1511 pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
1513 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1514 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1515 pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
1516 OptimizationLevel: c_uint);
1517 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
1519 pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
1520 PMB: PassManagerBuilderRef,
1522 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
1523 PMB: PassManagerBuilderRef,
1525 pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
1526 PMB: PassManagerBuilderRef,
1528 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1529 PMB: PassManagerBuilderRef,
1531 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1532 PMB: PassManagerBuilderRef,
1533 PM: PassManagerRef);
1535 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1536 PMB: PassManagerBuilderRef,
1537 PM: PassManagerRef);
1538 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1539 PMB: PassManagerBuilderRef,
1544 /** Destroys a memory buffer. */
1545 pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
1548 /* Stuff that's in rustllvm/ because it's not upstream yet. */
1550 /** Opens an object file. */
1551 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1552 /** Closes an object file. */
1553 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1555 /** Enumerates the sections in an object file. */
1556 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1557 /** Destroys a section iterator. */
1558 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1559 /** Returns true if the section iterator is at the end of the section
1561 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
1562 SI: SectionIteratorRef)
1564 /** Moves the section iterator to point to the next section. */
1565 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1566 /** Returns the current section size. */
1567 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1568 /** Returns the current section contents as a string buffer. */
1569 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1571 /** Reads the given file and returns it as a memory buffer. Use
1572 LLVMDisposeMemoryBuffer() to get rid of it. */
1573 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char)
1575 /** Borrows the contents of the memory buffer (doesn't copy it) */
1576 pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const c_char,
1577 InputDataLength: size_t,
1578 BufferName: *const c_char,
1581 pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const c_char,
1582 InputDataLength: size_t,
1583 BufferName: *const c_char)
1586 pub fn LLVMIsMultithreaded() -> Bool;
1587 pub fn LLVMStartMultithreaded() -> Bool;
1589 /** Returns a string describing the last error caused by an LLVMRust*
1591 pub fn LLVMRustGetLastError() -> *const c_char;
1593 /// Print the pass timings since static dtors aren't picking them up.
1594 pub fn LLVMRustPrintPassTimings();
1596 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1598 pub fn LLVMStructSetBody(StructTy: TypeRef,
1599 ElementTypes: *const TypeRef,
1600 ElementCount: c_uint,
1603 pub fn LLVMConstNamedStruct(S: TypeRef,
1604 ConstantVals: *const ValueRef,
1608 /** Enables LLVM debug output. */
1609 pub fn LLVMSetDebug(Enabled: c_int);
1611 /** Prepares inline assembly. */
1612 pub fn LLVMInlineAsm(Ty: TypeRef,
1613 AsmString: *const c_char,
1614 Constraints: *const c_char,
1620 pub static LLVMRustDebugMetadataVersion: u32;
1622 pub fn LLVMRustAddModuleFlag(M: ModuleRef,
1623 name: *const c_char,
1626 pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1628 pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
1630 pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef);
1632 pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1634 File: *const c_char,
1636 Producer: *const c_char,
1638 Flags: *const c_char,
1640 SplitName: *const c_char);
1642 pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
1643 Filename: *const c_char,
1644 Directory: *const c_char)
1647 pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1649 ParameterTypes: DIArray)
1652 pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
1653 Scope: DIDescriptor,
1654 Name: *const c_char,
1655 LinkageName: *const c_char,
1659 isLocalToUnit: bool,
1669 pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
1670 Name: *const c_char,
1671 SizeInBits: c_ulonglong,
1672 AlignInBits: c_ulonglong,
1676 pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
1678 SizeInBits: c_ulonglong,
1679 AlignInBits: c_ulonglong,
1680 Name: *const c_char)
1683 pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
1684 Scope: DIDescriptor,
1685 Name: *const c_char,
1688 SizeInBits: c_ulonglong,
1689 AlignInBits: c_ulonglong,
1691 DerivedFrom: DIType,
1693 RunTimeLang: c_uint,
1694 VTableHolder: ValueRef,
1695 UniqueId: *const c_char)
1698 pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
1699 Scope: DIDescriptor,
1700 Name: *const c_char,
1703 SizeInBits: c_ulonglong,
1704 AlignInBits: c_ulonglong,
1705 OffsetInBits: c_ulonglong,
1710 pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1711 Scope: DIDescriptor,
1715 Discriminator: c_uint)
1718 pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1719 Context: DIDescriptor,
1720 Name: *const c_char,
1721 LinkageName: *const c_char,
1725 isLocalToUnit: bool,
1728 -> DIGlobalVariable;
1730 pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
1732 Scope: DIDescriptor,
1733 Name: *const c_char,
1737 AlwaysPreserve: bool,
1742 pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
1744 AlignInBits: c_ulonglong,
1746 Subscripts: DIArray)
1749 pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
1751 AlignInBits: c_ulonglong,
1753 Subscripts: DIArray)
1756 pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1761 pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1762 Ptr: *const DIDescriptor,
1766 pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1768 VarInfo: DIVariable,
1769 InsertAtEnd: BasicBlockRef)
1772 pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
1774 VarInfo: DIVariable,
1775 InsertBefore: ValueRef)
1778 pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1779 Name: *const c_char,
1783 pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1785 Name: *const c_char,
1788 SizeInBits: c_ulonglong,
1789 AlignInBits: c_ulonglong,
1791 ClassType: ValueRef)
1794 pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
1796 Name: *const c_char,
1799 SizeInBits: c_ulonglong,
1800 AlignInBits: c_ulonglong,
1803 RunTimeLang: c_uint,
1804 UniqueId: *const c_char)
1807 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1809 pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1811 Name: *const c_char,
1818 pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
1820 pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
1822 pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
1825 Name: *const c_char,
1829 AddrOps: *const ValueRef,
1830 AddrOpsCount: c_uint,
1834 pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1836 Name: *const c_char,
1841 pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
1842 pub fn LLVMTypeToString(Type: TypeRef) -> *const c_char;
1843 pub fn LLVMValueToString(value_ref: ValueRef) -> *const c_char;
1845 pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
1847 pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
1849 pub fn LLVMInitializeX86TargetInfo();
1850 pub fn LLVMInitializeX86Target();
1851 pub fn LLVMInitializeX86TargetMC();
1852 pub fn LLVMInitializeX86AsmPrinter();
1853 pub fn LLVMInitializeX86AsmParser();
1854 pub fn LLVMInitializeARMTargetInfo();
1855 pub fn LLVMInitializeARMTarget();
1856 pub fn LLVMInitializeARMTargetMC();
1857 pub fn LLVMInitializeARMAsmPrinter();
1858 pub fn LLVMInitializeARMAsmParser();
1859 pub fn LLVMInitializeMipsTargetInfo();
1860 pub fn LLVMInitializeMipsTarget();
1861 pub fn LLVMInitializeMipsTargetMC();
1862 pub fn LLVMInitializeMipsAsmPrinter();
1863 pub fn LLVMInitializeMipsAsmParser();
1865 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
1866 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1868 Features: *const c_char,
1869 Model: CodeGenModel,
1871 Level: CodeGenOptLevel,
1874 NoFramePointerElim: bool,
1875 FunctionSections: bool,
1876 DataSections: bool) -> TargetMachineRef;
1877 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1878 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
1881 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1883 DisableSimplifyLibCalls: bool);
1884 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef,
1885 DisableSimplifyLibCalls: bool);
1886 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1887 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1890 Output: *const c_char,
1891 FileType: FileType) -> bool;
1892 pub fn LLVMRustPrintModule(PM: PassManagerRef,
1894 Output: *const c_char);
1895 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1896 pub fn LLVMRustPrintPasses();
1897 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1898 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
1899 AddLifetimes: bool);
1900 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef,
1902 len: size_t) -> bool;
1903 pub fn LLVMRustRunRestrictionPass(M: ModuleRef,
1904 syms: *const *const c_char,
1906 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1908 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1909 pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *const c_char,
1910 out_len: *mut size_t) -> *const c_char;
1911 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1913 pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
1914 pub fn LLVMVersionMajor() -> c_int;
1915 pub fn LLVMVersionMinor() -> c_int;
1917 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
1918 data: *mut *const c_char) -> c_int;
1921 pub fn SetInstructionCallConv(instr: ValueRef, cc: CallConv) {
1923 LLVMSetInstructionCallConv(instr, cc as c_uint);
1926 pub fn SetFunctionCallConv(fn_: ValueRef, cc: CallConv) {
1928 LLVMSetFunctionCallConv(fn_, cc as c_uint);
1931 pub fn SetLinkage(global: ValueRef, link: Linkage) {
1933 LLVMSetLinkage(global, link as c_uint);
1937 pub fn SetUnnamedAddr(global: ValueRef, unnamed: bool) {
1939 LLVMSetUnnamedAddr(global, unnamed as Bool);
1943 pub fn set_thread_local(global: ValueRef, is_thread_local: bool) {
1945 LLVMSetThreadLocal(global, is_thread_local as Bool);
1949 pub fn ConstICmp(pred: IntPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
1951 LLVMConstICmp(pred as c_ushort, v1, v2)
1954 pub fn ConstFCmp(pred: RealPredicate, v1: ValueRef, v2: ValueRef) -> ValueRef {
1956 LLVMConstFCmp(pred as c_ushort, v1, v2)
1960 pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
1962 LLVMAddFunctionAttribute(fn_, FunctionIndex as c_uint, attr as uint64_t)
1966 /* Memory-managed interface to target data. */
1968 pub struct TargetData {
1969 pub lltd: TargetDataRef
1972 impl Drop for TargetData {
1973 fn drop(&mut self) {
1975 LLVMDisposeTargetData(self.lltd);
1980 pub fn mk_target_data(string_rep: &str) -> TargetData {
1982 lltd: string_rep.with_c_str(|buf| {
1983 unsafe { LLVMCreateTargetData(buf) }
1988 /* Memory-managed interface to object files. */
1990 pub struct ObjectFile {
1991 pub llof: ObjectFileRef,
1995 // This will take ownership of llmb
1996 pub fn new(llmb: MemoryBufferRef) -> Option<ObjectFile> {
1998 let llof = LLVMCreateObjectFile(llmb);
1999 if llof as int == 0 {
2000 // LLVMCreateObjectFile took ownership of llmb
2011 impl Drop for ObjectFile {
2012 fn drop(&mut self) {
2014 LLVMDisposeObjectFile(self.llof);
2019 /* Memory-managed interface to section iterators. */
2021 pub struct SectionIter {
2022 pub llsi: SectionIteratorRef
2025 impl Drop for SectionIter {
2026 fn drop(&mut self) {
2028 LLVMDisposeSectionIterator(self.llsi);
2033 pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
2036 llsi: LLVMGetSections(llof)
2041 /// Safe wrapper around `LLVMGetParam`, because segfaults are no fun.
2042 pub fn get_param(llfn: ValueRef, index: c_uint) -> ValueRef {
2044 assert!(index < LLVMCountParams(llfn));
2045 LLVMGetParam(llfn, index)
2049 // FIXME #15460 - create a public function that actually calls our
2050 // static LLVM symbols. Otherwise the linker will just throw llvm
2051 // away. We're just calling lots of stuff until we transitively get
2052 // all of LLVM. This is worse than anything.
2053 pub unsafe fn static_link_hack_this_sucks() {
2054 LLVMInitializePasses();
2056 LLVMInitializeX86TargetInfo();
2057 LLVMInitializeX86Target();
2058 LLVMInitializeX86TargetMC();
2059 LLVMInitializeX86AsmPrinter();
2060 LLVMInitializeX86AsmParser();
2062 LLVMInitializeARMTargetInfo();
2063 LLVMInitializeARMTarget();
2064 LLVMInitializeARMTargetMC();
2065 LLVMInitializeARMAsmPrinter();
2066 LLVMInitializeARMAsmParser();
2068 LLVMInitializeMipsTargetInfo();
2069 LLVMInitializeMipsTarget();
2070 LLVMInitializeMipsTargetMC();
2071 LLVMInitializeMipsAsmPrinter();
2072 LLVMInitializeMipsAsmParser();
2074 LLVMRustSetLLVMOptions(0 as c_int,
2077 LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
2078 LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
2079 LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
2080 LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
2081 LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
2082 LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
2083 LLVMPassManagerBuilderCreate();
2084 LLVMPassManagerBuilderDispose(0 as *mut _);
2086 LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
2090 LLVMLinkInInterpreter();
2094 fn LLVMLinkInMCJIT();
2095 fn LLVMLinkInInterpreter();
2099 // The module containing the native LLVM dependencies, generated by the build system
2100 // Note that this must come after the rustllvm extern declaration so that
2101 // parts of LLVM that rustllvm depends on aren't thrown away by the linker.
2102 // Works to the above fix for #15460 to ensure LLVM dependencies that
2103 // are only used by rustllvm don't get stripped by the linker.