1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
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 // FIXME: Rename 'DIGlobalVariable' to 'DIGlobalVariableExpression'
12 // once support for LLVM 3.9 is dropped.
14 // This method was changed in this LLVM patch:
15 // https://reviews.llvm.org/D26769
17 use debuginfo::{DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
18 DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
19 DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
20 DINameSpace, DIFlags};
22 use libc::{c_uint, c_int, size_t, c_char};
23 use libc::{c_longlong, c_ulonglong, c_void};
27 pub type Opcode = u32;
28 pub type Bool = c_uint;
30 pub const True: Bool = 1 as Bool;
31 pub const False: Bool = 0 as Bool;
33 #[derive(Copy, Clone, PartialEq)]
35 pub enum LLVMRustResult {
39 // Consts for the LLVM CallConv type, pre-cast to usize.
41 /// LLVM CallingConv::ID. Should we wrap this?
42 #[derive(Copy, Clone, PartialEq, Debug)]
48 X86StdcallCallConv = 64,
49 X86FastcallCallConv = 65,
50 ArmAapcsCallConv = 67,
60 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
64 AvailableExternallyLinkage = 1,
65 LinkOnceAnyLinkage = 2,
66 LinkOnceODRLinkage = 3,
72 ExternalWeakLinkage = 9,
77 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
85 /// LLVMDiagnosticSeverity
86 #[derive(Copy, Clone, Debug)]
88 pub enum DiagnosticSeverity {
95 /// LLVMDLLStorageClass
96 #[derive(Copy, Clone)]
98 pub enum DLLStorageClass {
100 DllImport = 1, // Function to be imported from DLL.
101 DllExport = 2, // Function to be accessible from DLL.
104 /// Matches LLVMRustAttribute in rustllvm.h
105 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
106 /// though it is not ABI compatible (since it's a C++ enum)
108 #[derive(Copy, Clone, Debug)]
123 OptimizeForSize = 13,
131 SanitizeAddress = 21,
136 #[derive(Copy, Clone)]
138 pub enum IntPredicate {
151 /// LLVMRealPredicate
152 #[derive(Copy, Clone)]
154 pub enum RealPredicate {
155 RealPredicateFalse = 0,
170 RealPredicateTrue = 15,
174 #[derive(Copy, Clone, PartialEq, Debug)]
196 /// LLVMAtomicRmwBinOp
197 #[derive(Copy, Clone)]
199 pub enum AtomicRmwBinOp {
213 /// LLVMAtomicOrdering
214 #[derive(Copy, Clone)]
216 pub enum AtomicOrdering {
220 // Consume = 3, // Not specified yet.
224 SequentiallyConsistent = 7,
227 /// LLVMRustSynchronizationScope
228 #[derive(Copy, Clone)]
230 pub enum SynchronizationScope {
237 #[derive(Copy, Clone)]
246 #[derive(Copy, Clone)]
248 pub enum MetadataType {
255 MD_invariant_load = 6,
259 MD_mem_parallel_loop_access = 10,
263 /// LLVMRustAsmDialect
264 #[derive(Copy, Clone)]
266 pub enum AsmDialect {
272 /// LLVMRustCodeGenOptLevel
273 #[derive(Copy, Clone, PartialEq)]
275 pub enum CodeGenOptLevel {
284 #[derive(Copy, Clone, PartialEq)]
293 /// LLVMRustCodeModel
294 #[derive(Copy, Clone)]
306 /// LLVMRustDiagnosticKind
307 #[derive(Copy, Clone)]
309 pub enum DiagnosticKind {
313 DebugMetadataVersion,
316 OptimizationRemarkMissed,
317 OptimizationRemarkAnalysis,
318 OptimizationRemarkAnalysisFPCommute,
319 OptimizationRemarkAnalysisAliasing,
320 OptimizationRemarkOther,
324 /// LLVMRustArchiveKind
325 #[derive(Copy, Clone)]
327 pub enum ArchiveKind {
336 #[derive(Copy, Clone, PartialEq, Debug)]
344 // Opaque pointer types
345 #[allow(missing_copy_implementations)]
346 pub enum Module_opaque {}
347 pub type ModuleRef = *mut Module_opaque;
348 #[allow(missing_copy_implementations)]
349 pub enum Context_opaque {}
350 pub type ContextRef = *mut Context_opaque;
351 #[allow(missing_copy_implementations)]
352 pub enum Type_opaque {}
353 pub type TypeRef = *mut Type_opaque;
354 #[allow(missing_copy_implementations)]
355 pub enum Value_opaque {}
356 pub type ValueRef = *mut Value_opaque;
357 #[allow(missing_copy_implementations)]
358 pub enum Metadata_opaque {}
359 pub type MetadataRef = *mut Metadata_opaque;
360 #[allow(missing_copy_implementations)]
361 pub enum BasicBlock_opaque {}
362 pub type BasicBlockRef = *mut BasicBlock_opaque;
363 #[allow(missing_copy_implementations)]
364 pub enum Builder_opaque {}
365 pub type BuilderRef = *mut Builder_opaque;
366 #[allow(missing_copy_implementations)]
367 pub enum ExecutionEngine_opaque {}
368 pub type ExecutionEngineRef = *mut ExecutionEngine_opaque;
369 #[allow(missing_copy_implementations)]
370 pub enum MemoryBuffer_opaque {}
371 pub type MemoryBufferRef = *mut MemoryBuffer_opaque;
372 #[allow(missing_copy_implementations)]
373 pub enum PassManager_opaque {}
374 pub type PassManagerRef = *mut PassManager_opaque;
375 #[allow(missing_copy_implementations)]
376 pub enum PassManagerBuilder_opaque {}
377 pub type PassManagerBuilderRef = *mut PassManagerBuilder_opaque;
378 #[allow(missing_copy_implementations)]
379 pub enum Use_opaque {}
380 pub type UseRef = *mut Use_opaque;
381 #[allow(missing_copy_implementations)]
382 pub enum TargetData_opaque {}
383 pub type TargetDataRef = *mut TargetData_opaque;
384 #[allow(missing_copy_implementations)]
385 pub enum ObjectFile_opaque {}
386 pub type ObjectFileRef = *mut ObjectFile_opaque;
387 #[allow(missing_copy_implementations)]
388 pub enum SectionIterator_opaque {}
389 pub type SectionIteratorRef = *mut SectionIterator_opaque;
390 #[allow(missing_copy_implementations)]
391 pub enum Pass_opaque {}
392 pub type PassRef = *mut Pass_opaque;
393 #[allow(missing_copy_implementations)]
394 pub enum TargetMachine_opaque {}
395 pub type TargetMachineRef = *mut TargetMachine_opaque;
396 pub enum Archive_opaque {}
397 pub type ArchiveRef = *mut Archive_opaque;
398 pub enum ArchiveIterator_opaque {}
399 pub type ArchiveIteratorRef = *mut ArchiveIterator_opaque;
400 pub enum ArchiveChild_opaque {}
401 pub type ArchiveChildRef = *mut ArchiveChild_opaque;
402 #[allow(missing_copy_implementations)]
403 pub enum Twine_opaque {}
404 pub type TwineRef = *mut Twine_opaque;
405 #[allow(missing_copy_implementations)]
406 pub enum DiagnosticInfo_opaque {}
407 pub type DiagnosticInfoRef = *mut DiagnosticInfo_opaque;
408 #[allow(missing_copy_implementations)]
409 pub enum DebugLoc_opaque {}
410 pub type DebugLocRef = *mut DebugLoc_opaque;
411 #[allow(missing_copy_implementations)]
412 pub enum SMDiagnostic_opaque {}
413 pub type SMDiagnosticRef = *mut SMDiagnostic_opaque;
414 #[allow(missing_copy_implementations)]
415 pub enum RustArchiveMember_opaque {}
416 pub type RustArchiveMemberRef = *mut RustArchiveMember_opaque;
417 #[allow(missing_copy_implementations)]
418 pub enum OperandBundleDef_opaque {}
419 pub type OperandBundleDefRef = *mut OperandBundleDef_opaque;
421 pub type DiagnosticHandler = unsafe extern "C" fn(DiagnosticInfoRef, *mut c_void);
422 pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_void, c_uint);
426 use super::MetadataRef;
428 #[allow(missing_copy_implementations)]
429 pub enum DIBuilder_opaque {}
430 pub type DIBuilderRef = *mut DIBuilder_opaque;
432 pub type DIDescriptor = MetadataRef;
433 pub type DIScope = DIDescriptor;
434 pub type DILocation = DIDescriptor;
435 pub type DIFile = DIScope;
436 pub type DILexicalBlock = DIScope;
437 pub type DISubprogram = DIScope;
438 pub type DINameSpace = DIScope;
439 pub type DIType = DIDescriptor;
440 pub type DIBasicType = DIType;
441 pub type DIDerivedType = DIType;
442 pub type DICompositeType = DIDerivedType;
443 pub type DIVariable = DIDescriptor;
444 pub type DIGlobalVariable = DIDescriptor;
445 pub type DIArray = DIDescriptor;
446 pub type DISubrange = DIDescriptor;
447 pub type DIEnumerator = DIDescriptor;
448 pub type DITemplateTypeParameter = DIDescriptor;
450 // These values **must** match with LLVMRustDIFlags!!
453 #[derive(Debug, Default)]
454 flags DIFlags: ::libc::uint32_t {
456 const FlagPrivate = 1,
457 const FlagProtected = 2,
458 const FlagPublic = 3,
459 const FlagFwdDecl = (1 << 2),
460 const FlagAppleBlock = (1 << 3),
461 const FlagBlockByrefStruct = (1 << 4),
462 const FlagVirtual = (1 << 5),
463 const FlagArtificial = (1 << 6),
464 const FlagExplicit = (1 << 7),
465 const FlagPrototyped = (1 << 8),
466 const FlagObjcClassComplete = (1 << 9),
467 const FlagObjectPointer = (1 << 10),
468 const FlagVector = (1 << 11),
469 const FlagStaticMember = (1 << 12),
470 const FlagLValueReference = (1 << 13),
471 const FlagRValueReference = (1 << 14),
472 const FlagMainSubprogram = (1 << 21),
478 // Link to our native llvm bindings (things that we need to use the C++ api
479 // for) and because llvm is written in C++ we need to link against libstdc++
481 // You'll probably notice that there is an omission of all LLVM libraries
482 // from this location. This is because the set of LLVM libraries that we
483 // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
484 // figure out the exact set of libraries. To do this, the build system
485 // generates an llvmdeps.rs file next to this one which will be
486 // automatically updated whenever LLVM is updated to include an up-to-date
487 // set of the libraries we need to link to LLVM for.
488 #[link(name = "rustllvm", kind = "static")] // not quite true but good enough
490 // Create and destroy contexts.
491 pub fn LLVMContextCreate() -> ContextRef;
492 pub fn LLVMContextDispose(C: ContextRef);
493 pub fn LLVMGetMDKindIDInContext(C: ContextRef, Name: *const c_char, SLen: c_uint) -> c_uint;
495 // Create and destroy modules.
496 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: ContextRef) -> ModuleRef;
497 pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
498 pub fn LLVMCloneModule(M: ModuleRef) -> ModuleRef;
499 pub fn LLVMDisposeModule(M: ModuleRef);
501 /// Data layout. See Module::getDataLayout.
502 pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
503 pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
505 /// See Module::dump.
506 pub fn LLVMDumpModule(M: ModuleRef);
508 /// See Module::setModuleInlineAsm.
509 pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
511 /// See llvm::LLVMTypeKind::getTypeID.
512 pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;
514 /// See llvm::Value::getContext
515 pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef;
517 // Operations on integer types
518 pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
519 pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
520 pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
521 pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
522 pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
523 pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint) -> TypeRef;
525 pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
527 // Operations on real types
528 pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
529 pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
531 // Operations on function types
532 pub fn LLVMFunctionType(ReturnType: TypeRef,
533 ParamTypes: *const TypeRef,
537 pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
538 pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
539 pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *mut TypeRef);
541 // Operations on struct types
542 pub fn LLVMStructTypeInContext(C: ContextRef,
543 ElementTypes: *const TypeRef,
544 ElementCount: c_uint,
547 pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
548 pub fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *mut TypeRef);
549 pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
551 // Operations on array, pointer, and vector types (sequence types)
552 pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
553 pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint) -> TypeRef;
554 pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint) -> TypeRef;
556 pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
557 pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
558 pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
560 // Operations on other types
561 pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
562 pub fn LLVMRustMetadataTypeInContext(C: ContextRef) -> TypeRef;
564 // Operations on all values
565 pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
566 pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
567 pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
568 pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
569 pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
571 // Operations on Uses
572 pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
573 pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
574 pub fn LLVMGetUser(U: UseRef) -> ValueRef;
576 // Operations on Users
577 pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
579 // Operations on constants of any type
580 pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
581 pub fn LLVMConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
582 pub fn LLVMConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
583 // only for isize/vector
584 pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
585 pub fn LLVMIsNull(Val: ValueRef) -> Bool;
586 pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
588 // Operations on metadata
589 pub fn LLVMMDNodeInContext(C: ContextRef, Vals: *const ValueRef, Count: c_uint) -> ValueRef;
591 // Operations on scalar constants
592 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool) -> ValueRef;
593 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: TypeRef, Wn: c_uint, Ws: *const u64) -> ValueRef;
594 pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
595 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
596 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
597 pub fn LLVMRustConstInt128Get(ConstantVal: ValueRef, SExt: bool,
598 high: *mut u64, low: *mut u64) -> bool;
601 // Operations on composite constants
602 pub fn LLVMConstStringInContext(C: ContextRef,
605 DontNullTerminate: Bool)
607 pub fn LLVMConstStructInContext(C: ContextRef,
608 ConstantVals: *const ValueRef,
613 pub fn LLVMConstArray(ElementTy: TypeRef,
614 ConstantVals: *const ValueRef,
617 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint) -> ValueRef;
619 // Constant expressions
620 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
621 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
622 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
623 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
624 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
625 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
626 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
627 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
628 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
629 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
630 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
631 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
632 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
633 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
634 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
635 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
636 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
637 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
638 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
639 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
640 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
641 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
642 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
643 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
644 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
645 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
646 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
647 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
648 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
649 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
650 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
651 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
652 pub fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef, isSigned: Bool) -> ValueRef;
653 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
654 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
655 IdxList: *const c_uint,
658 pub fn LLVMConstInlineAsm(Ty: TypeRef,
659 AsmString: *const c_char,
660 Constraints: *const c_char,
661 HasSideEffects: Bool,
666 // Operations on global variables, functions, and aliases (globals)
667 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
668 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
669 pub fn LLVMRustGetLinkage(Global: ValueRef) -> Linkage;
670 pub fn LLVMRustSetLinkage(Global: ValueRef, RustLinkage: Linkage);
671 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
672 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
673 pub fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
674 pub fn LLVMRustSetVisibility(Global: ValueRef, Viz: Visibility);
675 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
676 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
677 pub fn LLVMSetDLLStorageClass(V: ValueRef, C: DLLStorageClass);
680 // Operations on global variables
681 pub fn LLVMIsAGlobalVariable(GlobalVar: ValueRef) -> ValueRef;
682 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
683 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
684 pub fn LLVMRustGetOrInsertGlobal(M: ModuleRef, Name: *const c_char, T: TypeRef) -> ValueRef;
685 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
686 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
687 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
688 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
689 pub fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef);
690 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
691 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
692 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
693 pub fn LLVMRustGetNamedValue(M: ModuleRef, Name: *const c_char) -> ValueRef;
695 // Operations on functions
696 pub fn LLVMAddFunction(M: ModuleRef, Name: *const c_char, FunctionTy: TypeRef) -> ValueRef;
697 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
698 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
699 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
700 pub fn LLVMRustGetOrInsertFunction(M: ModuleRef,
704 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
705 pub fn LLVMRustAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: u64);
706 pub fn LLVMRustAddFunctionAttribute(Fn: ValueRef, index: c_uint, attr: Attribute);
707 pub fn LLVMRustAddFunctionAttrStringValue(Fn: ValueRef,
710 Value: *const c_char);
711 pub fn LLVMRustRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: Attribute);
713 // Operations on parameters
714 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
715 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
717 // Operations on basic blocks
718 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
719 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
720 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
724 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
726 // Operations on instructions
727 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
728 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
729 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
730 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
732 // Operations on call sites
733 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
734 pub fn LLVMRustAddCallSiteAttribute(Instr: ValueRef, index: c_uint, attr: Attribute);
735 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: ValueRef, index: c_uint, bytes: u64);
737 // Operations on load/store instructions (only)
738 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
740 // Operations on phi nodes
741 pub fn LLVMAddIncoming(PhiNode: ValueRef,
742 IncomingValues: *const ValueRef,
743 IncomingBlocks: *const BasicBlockRef,
746 // Instruction builders
747 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
748 pub fn LLVMPositionBuilder(Builder: BuilderRef, Block: BasicBlockRef, Instr: ValueRef);
749 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef, Instr: ValueRef);
750 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, Block: BasicBlockRef);
751 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
752 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
755 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
756 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
757 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
760 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
761 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
762 pub fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *const ValueRef, N: c_uint) -> ValueRef;
763 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
764 pub fn LLVMBuildCondBr(B: BuilderRef,
769 pub fn LLVMBuildSwitch(B: BuilderRef,
774 pub fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, NumDests: c_uint) -> ValueRef;
775 pub fn LLVMRustBuildInvoke(B: BuilderRef,
777 Args: *const ValueRef,
780 Catch: BasicBlockRef,
781 Bundle: OperandBundleDefRef,
784 pub fn LLVMRustBuildLandingPad(B: BuilderRef,
791 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
792 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
794 pub fn LLVMRustBuildCleanupPad(B: BuilderRef,
797 Args: *const ValueRef,
800 pub fn LLVMRustBuildCleanupRet(B: BuilderRef,
801 CleanupPad: ValueRef,
802 UnwindBB: BasicBlockRef)
804 pub fn LLVMRustBuildCatchPad(B: BuilderRef,
807 Args: *const ValueRef,
810 pub fn LLVMRustBuildCatchRet(B: BuilderRef, Pad: ValueRef, BB: BasicBlockRef) -> ValueRef;
811 pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
817 pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
818 pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
820 // Add a case to the switch instruction
821 pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
823 // Add a clause to the landing pad instruction
824 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
826 // Set the cleanup on a landing pad instruction
827 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
830 pub fn LLVMBuildAdd(B: BuilderRef,
835 pub fn LLVMBuildNSWAdd(B: BuilderRef,
840 pub fn LLVMBuildNUWAdd(B: BuilderRef,
845 pub fn LLVMBuildFAdd(B: BuilderRef,
850 pub fn LLVMBuildSub(B: BuilderRef,
855 pub fn LLVMBuildNSWSub(B: BuilderRef,
860 pub fn LLVMBuildNUWSub(B: BuilderRef,
865 pub fn LLVMBuildFSub(B: BuilderRef,
870 pub fn LLVMBuildMul(B: BuilderRef,
875 pub fn LLVMBuildNSWMul(B: BuilderRef,
880 pub fn LLVMBuildNUWMul(B: BuilderRef,
885 pub fn LLVMBuildFMul(B: BuilderRef,
890 pub fn LLVMBuildUDiv(B: BuilderRef,
895 pub fn LLVMBuildSDiv(B: BuilderRef,
900 pub fn LLVMBuildExactSDiv(B: BuilderRef,
905 pub fn LLVMBuildFDiv(B: BuilderRef,
910 pub fn LLVMBuildURem(B: BuilderRef,
915 pub fn LLVMBuildSRem(B: BuilderRef,
920 pub fn LLVMBuildFRem(B: BuilderRef,
925 pub fn LLVMBuildShl(B: BuilderRef,
930 pub fn LLVMBuildLShr(B: BuilderRef,
935 pub fn LLVMBuildAShr(B: BuilderRef,
940 pub fn LLVMBuildAnd(B: BuilderRef,
945 pub fn LLVMBuildOr(B: BuilderRef,
950 pub fn LLVMBuildXor(B: BuilderRef,
955 pub fn LLVMBuildBinOp(B: BuilderRef,
961 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
962 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
963 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
964 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
965 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
966 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: ValueRef);
969 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
970 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
971 pub fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: *const c_char) -> ValueRef;
973 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) -> ValueRef;
975 pub fn LLVMBuildGEP(B: BuilderRef,
977 Indices: *const ValueRef,
981 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
983 Indices: *const ValueRef,
987 pub fn LLVMBuildStructGEP(B: BuilderRef,
992 pub fn LLVMBuildGlobalString(B: BuilderRef,
996 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1002 pub fn LLVMBuildTrunc(B: BuilderRef,
1005 Name: *const c_char)
1007 pub fn LLVMBuildZExt(B: BuilderRef,
1010 Name: *const c_char)
1012 pub fn LLVMBuildSExt(B: BuilderRef,
1015 Name: *const c_char)
1017 pub fn LLVMBuildFPToUI(B: BuilderRef,
1020 Name: *const c_char)
1022 pub fn LLVMBuildFPToSI(B: BuilderRef,
1025 Name: *const c_char)
1027 pub fn LLVMBuildUIToFP(B: BuilderRef,
1030 Name: *const c_char)
1032 pub fn LLVMBuildSIToFP(B: BuilderRef,
1035 Name: *const c_char)
1037 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1040 Name: *const c_char)
1042 pub fn LLVMBuildFPExt(B: BuilderRef,
1045 Name: *const c_char)
1047 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1050 Name: *const c_char)
1052 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1055 Name: *const c_char)
1057 pub fn LLVMBuildBitCast(B: BuilderRef,
1060 Name: *const c_char)
1062 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1065 Name: *const c_char)
1067 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1070 Name: *const c_char)
1072 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1075 Name: *const c_char)
1077 pub fn LLVMBuildCast(B: BuilderRef,
1081 Name: *const c_char)
1083 pub fn LLVMBuildPointerCast(B: BuilderRef,
1086 Name: *const c_char)
1088 pub fn LLVMRustBuildIntCast(B: BuilderRef,
1093 pub fn LLVMBuildFPCast(B: BuilderRef,
1096 Name: *const c_char)
1100 pub fn LLVMBuildICmp(B: BuilderRef,
1104 Name: *const c_char)
1106 pub fn LLVMBuildFCmp(B: BuilderRef,
1110 Name: *const c_char)
1113 // Miscellaneous instructions
1114 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1115 pub fn LLVMRustBuildCall(B: BuilderRef,
1117 Args: *const ValueRef,
1119 Bundle: OperandBundleDefRef,
1120 Name: *const c_char)
1122 pub fn LLVMBuildSelect(B: BuilderRef,
1126 Name: *const c_char)
1128 pub fn LLVMBuildVAArg(B: BuilderRef,
1131 Name: *const c_char)
1133 pub fn LLVMBuildExtractElement(B: BuilderRef,
1136 Name: *const c_char)
1138 pub fn LLVMBuildInsertElement(B: BuilderRef,
1142 Name: *const c_char)
1144 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1148 Name: *const c_char)
1150 pub fn LLVMBuildExtractValue(B: BuilderRef,
1153 Name: *const c_char)
1155 pub fn LLVMBuildInsertValue(B: BuilderRef,
1159 Name: *const c_char)
1162 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1163 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1164 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1167 Name: *const c_char)
1170 // Atomic Operations
1171 pub fn LLVMRustBuildAtomicLoad(B: BuilderRef,
1172 PointerVal: ValueRef,
1173 Name: *const c_char,
1174 Order: AtomicOrdering,
1178 pub fn LLVMRustBuildAtomicStore(B: BuilderRef,
1181 Order: AtomicOrdering,
1185 pub fn LLVMRustBuildAtomicCmpXchg(B: BuilderRef,
1189 Order: AtomicOrdering,
1190 FailureOrder: AtomicOrdering,
1194 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1198 Order: AtomicOrdering,
1199 SingleThreaded: Bool)
1202 pub fn LLVMRustBuildAtomicFence(B: BuilderRef,
1203 Order: AtomicOrdering,
1204 Scope: SynchronizationScope);
1207 // Selected entries from the downcasts.
1208 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1209 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1211 /// Writes a module to the specified path. Returns 0 on success.
1212 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1214 /// Creates target data from a target layout string.
1215 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1216 /// Number of bytes clobbered when doing a Store to *T.
1217 pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1219 /// Distance between successive elements in an array of T. Includes ABI padding.
1220 pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1222 /// Returns the preferred alignment of a type.
1223 pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1224 /// Returns the minimum alignment of a type.
1225 pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1227 /// Computes the byte offset of the indexed struct element for a
1229 pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1234 /// Disposes target data.
1235 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1237 /// Creates a pass manager.
1238 pub fn LLVMCreatePassManager() -> PassManagerRef;
1240 /// Creates a function-by-function pass manager
1241 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef) -> PassManagerRef;
1243 /// Disposes a pass manager.
1244 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1246 /// Runs a pass manager on a module.
1247 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1249 pub fn LLVMInitializePasses();
1251 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1252 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1253 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef, Value: Bool);
1254 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: PassManagerBuilderRef, Value: Bool);
1255 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: PassManagerBuilderRef,
1257 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: PassManagerBuilderRef,
1258 PM: PassManagerRef);
1260 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: PassManagerBuilderRef,
1261 PM: PassManagerRef);
1262 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: PassManagerBuilderRef,
1267 // Stuff that's in rustllvm/ because it's not upstream yet.
1269 /// Opens an object file.
1270 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1271 /// Closes an object file.
1272 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1274 /// Enumerates the sections in an object file.
1275 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1276 /// Destroys a section iterator.
1277 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1278 /// Returns true if the section iterator is at the end of the section
1280 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, SI: SectionIteratorRef) -> Bool;
1281 /// Moves the section iterator to point to the next section.
1282 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1283 /// Returns the current section size.
1284 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1285 /// Returns the current section contents as a string buffer.
1286 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1288 /// Reads the given file and returns it as a memory buffer. Use
1289 /// LLVMDisposeMemoryBuffer() to get rid of it.
1290 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char) -> MemoryBufferRef;
1292 pub fn LLVMStartMultithreaded() -> Bool;
1294 /// Returns a string describing the last error caused by an LLVMRust* call.
1295 pub fn LLVMRustGetLastError() -> *const c_char;
1297 /// Print the pass timings since static dtors aren't picking them up.
1298 pub fn LLVMRustPrintPassTimings();
1300 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1302 pub fn LLVMStructSetBody(StructTy: TypeRef,
1303 ElementTypes: *const TypeRef,
1304 ElementCount: c_uint,
1307 pub fn LLVMConstNamedStruct(S: TypeRef,
1308 ConstantVals: *const ValueRef,
1312 /// Enables LLVM debug output.
1313 pub fn LLVMRustSetDebug(Enabled: c_int);
1315 /// Prepares inline assembly.
1316 pub fn LLVMRustInlineAsm(Ty: TypeRef,
1317 AsmString: *const c_char,
1318 Constraints: *const c_char,
1321 Dialect: AsmDialect)
1324 pub fn LLVMRustDebugMetadataVersion() -> u32;
1325 pub fn LLVMRustVersionMajor() -> u32;
1326 pub fn LLVMRustVersionMinor() -> u32;
1328 pub fn LLVMRustAddModuleFlag(M: ModuleRef, name: *const c_char, value: u32);
1330 pub fn LLVMRustDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1332 pub fn LLVMRustDIBuilderDispose(Builder: DIBuilderRef);
1334 pub fn LLVMRustDIBuilderFinalize(Builder: DIBuilderRef);
1336 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1339 Producer: *const c_char,
1341 Flags: *const c_char,
1343 SplitName: *const c_char)
1346 pub fn LLVMRustDIBuilderCreateFile(Builder: DIBuilderRef,
1347 Filename: *const c_char,
1348 Directory: *const c_char)
1351 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1353 ParameterTypes: DIArray)
1356 pub fn LLVMRustDIBuilderCreateFunction(Builder: DIBuilderRef,
1357 Scope: DIDescriptor,
1358 Name: *const c_char,
1359 LinkageName: *const c_char,
1363 isLocalToUnit: bool,
1373 pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef,
1374 Name: *const c_char,
1380 pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef,
1384 Name: *const c_char)
1387 pub fn LLVMRustDIBuilderCreateStructType(Builder: DIBuilderRef,
1388 Scope: DIDescriptor,
1389 Name: *const c_char,
1395 DerivedFrom: DIType,
1397 RunTimeLang: c_uint,
1398 VTableHolder: DIType,
1399 UniqueId: *const c_char)
1402 pub fn LLVMRustDIBuilderCreateMemberType(Builder: DIBuilderRef,
1403 Scope: DIDescriptor,
1404 Name: *const c_char,
1414 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1421 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: DIBuilderRef,
1426 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1428 Name: *const c_char,
1429 LinkageName: *const c_char,
1433 isLocalToUnit: bool,
1437 -> DIGlobalVariable;
1439 pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef,
1441 Scope: DIDescriptor,
1442 Name: *const c_char,
1446 AlwaysPreserve: bool,
1452 pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef,
1456 Subscripts: DIArray)
1459 pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef,
1463 Subscripts: DIArray)
1466 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1471 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1472 Ptr: *const DIDescriptor,
1476 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1478 VarInfo: DIVariable,
1479 AddrOps: *const i64,
1480 AddrOpsCount: c_uint,
1482 InsertAtEnd: BasicBlockRef)
1485 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1486 Name: *const c_char,
1490 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1492 Name: *const c_char,
1501 pub fn LLVMRustDIBuilderCreateUnionType(Builder: DIBuilderRef,
1503 Name: *const c_char,
1510 RunTimeLang: c_uint,
1511 UniqueId: *const c_char)
1514 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1516 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1518 Name: *const c_char,
1523 -> DITemplateTypeParameter;
1526 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1528 Name: *const c_char,
1532 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1533 CompositeType: DIType,
1534 TypeArray: DIArray);
1537 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: ContextRef,
1541 InlinedAt: MetadataRef)
1543 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1544 pub fn LLVMRustDIBuilderCreateOpPlus() -> i64;
1546 pub fn LLVMRustWriteTypeToString(Type: TypeRef, s: RustStringRef);
1547 pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef);
1549 pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
1551 pub fn LLVMRustPassKind(Pass: PassRef) -> PassKind;
1552 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef;
1553 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: PassRef);
1555 pub fn LLVMRustHasFeature(T: TargetMachineRef, s: *const c_char) -> bool;
1557 pub fn LLVMRustPrintTargetCPUs(T: TargetMachineRef);
1558 pub fn LLVMRustPrintTargetFeatures(T: TargetMachineRef);
1560 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1562 Features: *const c_char,
1565 Level: CodeGenOptLevel,
1567 PositionIndependentExecutable: bool,
1568 FunctionSections: bool,
1570 -> TargetMachineRef;
1571 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1572 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, M: ModuleRef);
1573 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1575 DisableSimplifyLibCalls: bool);
1576 pub fn LLVMRustConfigurePassManagerBuilder(PMB: PassManagerBuilderRef,
1577 OptLevel: CodeGenOptLevel,
1578 MergeFunctions: bool,
1580 LoopVectorize: bool);
1581 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef,
1583 DisableSimplifyLibCalls: bool);
1584 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1585 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1588 Output: *const c_char,
1591 pub fn LLVMRustPrintModule(PM: PassManagerRef, M: ModuleRef, Output: *const c_char);
1592 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1593 pub fn LLVMRustPrintPasses();
1594 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1595 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
1596 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
1597 pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
1598 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1600 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1601 pub fn LLVMRustArchiveIteratorNew(AR: ArchiveRef) -> ArchiveIteratorRef;
1602 pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
1603 pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1604 pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1605 pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
1606 pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
1607 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1609 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: *mut *const c_char) -> size_t;
1611 pub fn LLVMRustWriteTwineToString(T: TwineRef, s: RustStringRef);
1613 pub fn LLVMContextSetDiagnosticHandler(C: ContextRef,
1614 Handler: DiagnosticHandler,
1615 DiagnosticContext: *mut c_void);
1617 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: DiagnosticInfoRef,
1618 pass_name_out: RustStringRef,
1619 function_out: *mut ValueRef,
1620 debugloc_out: *mut DebugLocRef,
1621 message_out: RustStringRef);
1622 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: DiagnosticInfoRef,
1623 cookie_out: *mut c_uint,
1624 message_out: *mut TwineRef,
1625 instruction_out: *mut ValueRef);
1627 pub fn LLVMRustWriteDiagnosticInfoToString(DI: DiagnosticInfoRef, s: RustStringRef);
1628 pub fn LLVMRustGetDiagInfoKind(DI: DiagnosticInfoRef) -> DiagnosticKind;
1630 pub fn LLVMRustWriteDebugLocToString(C: ContextRef, DL: DebugLocRef, s: RustStringRef);
1632 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: ContextRef,
1633 H: InlineAsmDiagHandler,
1636 pub fn LLVMRustWriteSMDiagnosticToString(d: SMDiagnosticRef, s: RustStringRef);
1638 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1640 Members: *const RustArchiveMemberRef,
1644 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1645 Name: *const c_char,
1646 Child: ArchiveChildRef)
1647 -> RustArchiveMemberRef;
1648 pub fn LLVMRustArchiveMemberFree(Member: RustArchiveMemberRef);
1650 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: ModuleRef, TM: TargetMachineRef);
1651 pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
1653 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1654 Inputs: *const ValueRef,
1656 -> OperandBundleDefRef;
1657 pub fn LLVMRustFreeOperandBundleDef(Bundle: OperandBundleDefRef);
1659 pub fn LLVMRustPositionBuilderAtStart(B: BuilderRef, BB: BasicBlockRef);
1661 pub fn LLVMRustSetComdat(M: ModuleRef, V: ValueRef, Name: *const c_char);
1662 pub fn LLVMRustUnsetComdat(V: ValueRef);
1663 pub fn LLVMRustSetModulePIELevel(M: ModuleRef);