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);
510 pub fn LLVMRustAppendModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
512 /// See llvm::LLVMTypeKind::getTypeID.
513 pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;
515 /// See llvm::Value::getContext
516 pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef;
518 // Operations on integer types
519 pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
520 pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
521 pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
522 pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
523 pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
524 pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint) -> TypeRef;
526 pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
528 // Operations on real types
529 pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
530 pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
532 // Operations on function types
533 pub fn LLVMFunctionType(ReturnType: TypeRef,
534 ParamTypes: *const TypeRef,
538 pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
539 pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
540 pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *mut TypeRef);
542 // Operations on struct types
543 pub fn LLVMStructTypeInContext(C: ContextRef,
544 ElementTypes: *const TypeRef,
545 ElementCount: c_uint,
548 pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
549 pub fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *mut TypeRef);
550 pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
552 // Operations on array, pointer, and vector types (sequence types)
553 pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
554 pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint) -> TypeRef;
555 pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint) -> TypeRef;
557 pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
558 pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
559 pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
561 // Operations on other types
562 pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
563 pub fn LLVMRustMetadataTypeInContext(C: ContextRef) -> TypeRef;
565 // Operations on all values
566 pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
567 pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
568 pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
569 pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
570 pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
572 // Operations on Uses
573 pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
574 pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
575 pub fn LLVMGetUser(U: UseRef) -> ValueRef;
577 // Operations on Users
578 pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
580 // Operations on constants of any type
581 pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
582 pub fn LLVMConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
583 pub fn LLVMConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
584 // only for isize/vector
585 pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
586 pub fn LLVMIsNull(Val: ValueRef) -> Bool;
587 pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
589 // Operations on metadata
590 pub fn LLVMMDNodeInContext(C: ContextRef, Vals: *const ValueRef, Count: c_uint) -> ValueRef;
592 // Operations on scalar constants
593 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool) -> ValueRef;
594 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: TypeRef, Wn: c_uint, Ws: *const u64) -> ValueRef;
595 pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
596 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
597 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
598 pub fn LLVMRustConstInt128Get(ConstantVal: ValueRef, SExt: bool,
599 high: *mut u64, low: *mut u64) -> bool;
602 // Operations on composite constants
603 pub fn LLVMConstStringInContext(C: ContextRef,
606 DontNullTerminate: Bool)
608 pub fn LLVMConstStructInContext(C: ContextRef,
609 ConstantVals: *const ValueRef,
614 pub fn LLVMConstArray(ElementTy: TypeRef,
615 ConstantVals: *const ValueRef,
618 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint) -> ValueRef;
620 // Constant expressions
621 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
622 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
623 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
624 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
625 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
626 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
627 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
628 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
629 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
630 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
631 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
632 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
633 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
634 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
635 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
636 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
637 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
638 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
639 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
640 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
641 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
642 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
643 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
644 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
645 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
646 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
647 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
648 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
649 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
650 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
651 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
652 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
653 pub fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef, isSigned: Bool) -> ValueRef;
654 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
655 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
656 IdxList: *const c_uint,
659 pub fn LLVMConstInlineAsm(Ty: TypeRef,
660 AsmString: *const c_char,
661 Constraints: *const c_char,
662 HasSideEffects: Bool,
667 // Operations on global variables, functions, and aliases (globals)
668 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
669 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
670 pub fn LLVMRustGetLinkage(Global: ValueRef) -> Linkage;
671 pub fn LLVMRustSetLinkage(Global: ValueRef, RustLinkage: Linkage);
672 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
673 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
674 pub fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
675 pub fn LLVMRustSetVisibility(Global: ValueRef, Viz: Visibility);
676 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
677 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
678 pub fn LLVMSetDLLStorageClass(V: ValueRef, C: DLLStorageClass);
681 // Operations on global variables
682 pub fn LLVMIsAGlobalVariable(GlobalVar: ValueRef) -> ValueRef;
683 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
684 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
685 pub fn LLVMRustGetOrInsertGlobal(M: ModuleRef, Name: *const c_char, T: TypeRef) -> ValueRef;
686 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
687 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
688 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
689 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
690 pub fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef);
691 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
692 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
693 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
694 pub fn LLVMRustGetNamedValue(M: ModuleRef, Name: *const c_char) -> ValueRef;
696 // Operations on functions
697 pub fn LLVMAddFunction(M: ModuleRef, Name: *const c_char, FunctionTy: TypeRef) -> ValueRef;
698 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
699 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
700 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
701 pub fn LLVMRustGetOrInsertFunction(M: ModuleRef,
705 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
706 pub fn LLVMRustAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: u64);
707 pub fn LLVMRustAddFunctionAttribute(Fn: ValueRef, index: c_uint, attr: Attribute);
708 pub fn LLVMRustAddFunctionAttrStringValue(Fn: ValueRef,
711 Value: *const c_char);
712 pub fn LLVMRustRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: Attribute);
714 // Operations on parameters
715 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
716 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
718 // Operations on basic blocks
719 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
720 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
721 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
725 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
727 // Operations on instructions
728 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
729 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
730 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
731 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
733 // Operations on call sites
734 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
735 pub fn LLVMRustAddCallSiteAttribute(Instr: ValueRef, index: c_uint, attr: Attribute);
736 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: ValueRef, index: c_uint, bytes: u64);
738 // Operations on load/store instructions (only)
739 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
741 // Operations on phi nodes
742 pub fn LLVMAddIncoming(PhiNode: ValueRef,
743 IncomingValues: *const ValueRef,
744 IncomingBlocks: *const BasicBlockRef,
747 // Instruction builders
748 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
749 pub fn LLVMPositionBuilder(Builder: BuilderRef, Block: BasicBlockRef, Instr: ValueRef);
750 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef, Instr: ValueRef);
751 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, Block: BasicBlockRef);
752 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
753 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
756 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
757 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
758 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
761 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
762 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
763 pub fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *const ValueRef, N: c_uint) -> ValueRef;
764 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
765 pub fn LLVMBuildCondBr(B: BuilderRef,
770 pub fn LLVMBuildSwitch(B: BuilderRef,
775 pub fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, NumDests: c_uint) -> ValueRef;
776 pub fn LLVMRustBuildInvoke(B: BuilderRef,
778 Args: *const ValueRef,
781 Catch: BasicBlockRef,
782 Bundle: OperandBundleDefRef,
785 pub fn LLVMRustBuildLandingPad(B: BuilderRef,
792 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
793 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
795 pub fn LLVMRustBuildCleanupPad(B: BuilderRef,
798 Args: *const ValueRef,
801 pub fn LLVMRustBuildCleanupRet(B: BuilderRef,
802 CleanupPad: ValueRef,
803 UnwindBB: BasicBlockRef)
805 pub fn LLVMRustBuildCatchPad(B: BuilderRef,
808 Args: *const ValueRef,
811 pub fn LLVMRustBuildCatchRet(B: BuilderRef, Pad: ValueRef, BB: BasicBlockRef) -> ValueRef;
812 pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
818 pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
819 pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
821 // Add a case to the switch instruction
822 pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
824 // Add a clause to the landing pad instruction
825 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
827 // Set the cleanup on a landing pad instruction
828 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
831 pub fn LLVMBuildAdd(B: BuilderRef,
836 pub fn LLVMBuildNSWAdd(B: BuilderRef,
841 pub fn LLVMBuildNUWAdd(B: BuilderRef,
846 pub fn LLVMBuildFAdd(B: BuilderRef,
851 pub fn LLVMBuildSub(B: BuilderRef,
856 pub fn LLVMBuildNSWSub(B: BuilderRef,
861 pub fn LLVMBuildNUWSub(B: BuilderRef,
866 pub fn LLVMBuildFSub(B: BuilderRef,
871 pub fn LLVMBuildMul(B: BuilderRef,
876 pub fn LLVMBuildNSWMul(B: BuilderRef,
881 pub fn LLVMBuildNUWMul(B: BuilderRef,
886 pub fn LLVMBuildFMul(B: BuilderRef,
891 pub fn LLVMBuildUDiv(B: BuilderRef,
896 pub fn LLVMBuildSDiv(B: BuilderRef,
901 pub fn LLVMBuildExactSDiv(B: BuilderRef,
906 pub fn LLVMBuildFDiv(B: BuilderRef,
911 pub fn LLVMBuildURem(B: BuilderRef,
916 pub fn LLVMBuildSRem(B: BuilderRef,
921 pub fn LLVMBuildFRem(B: BuilderRef,
926 pub fn LLVMBuildShl(B: BuilderRef,
931 pub fn LLVMBuildLShr(B: BuilderRef,
936 pub fn LLVMBuildAShr(B: BuilderRef,
941 pub fn LLVMBuildAnd(B: BuilderRef,
946 pub fn LLVMBuildOr(B: BuilderRef,
951 pub fn LLVMBuildXor(B: BuilderRef,
956 pub fn LLVMBuildBinOp(B: BuilderRef,
962 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
963 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
964 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
965 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
966 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
967 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: ValueRef);
970 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
971 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
972 pub fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: *const c_char) -> ValueRef;
974 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) -> ValueRef;
976 pub fn LLVMBuildGEP(B: BuilderRef,
978 Indices: *const ValueRef,
982 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
984 Indices: *const ValueRef,
988 pub fn LLVMBuildStructGEP(B: BuilderRef,
993 pub fn LLVMBuildGlobalString(B: BuilderRef,
997 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1003 pub fn LLVMBuildTrunc(B: BuilderRef,
1006 Name: *const c_char)
1008 pub fn LLVMBuildZExt(B: BuilderRef,
1011 Name: *const c_char)
1013 pub fn LLVMBuildSExt(B: BuilderRef,
1016 Name: *const c_char)
1018 pub fn LLVMBuildFPToUI(B: BuilderRef,
1021 Name: *const c_char)
1023 pub fn LLVMBuildFPToSI(B: BuilderRef,
1026 Name: *const c_char)
1028 pub fn LLVMBuildUIToFP(B: BuilderRef,
1031 Name: *const c_char)
1033 pub fn LLVMBuildSIToFP(B: BuilderRef,
1036 Name: *const c_char)
1038 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1041 Name: *const c_char)
1043 pub fn LLVMBuildFPExt(B: BuilderRef,
1046 Name: *const c_char)
1048 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1051 Name: *const c_char)
1053 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1056 Name: *const c_char)
1058 pub fn LLVMBuildBitCast(B: BuilderRef,
1061 Name: *const c_char)
1063 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1066 Name: *const c_char)
1068 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1071 Name: *const c_char)
1073 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1076 Name: *const c_char)
1078 pub fn LLVMBuildCast(B: BuilderRef,
1082 Name: *const c_char)
1084 pub fn LLVMBuildPointerCast(B: BuilderRef,
1087 Name: *const c_char)
1089 pub fn LLVMRustBuildIntCast(B: BuilderRef,
1094 pub fn LLVMBuildFPCast(B: BuilderRef,
1097 Name: *const c_char)
1101 pub fn LLVMBuildICmp(B: BuilderRef,
1105 Name: *const c_char)
1107 pub fn LLVMBuildFCmp(B: BuilderRef,
1111 Name: *const c_char)
1114 // Miscellaneous instructions
1115 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1116 pub fn LLVMRustBuildCall(B: BuilderRef,
1118 Args: *const ValueRef,
1120 Bundle: OperandBundleDefRef,
1121 Name: *const c_char)
1123 pub fn LLVMBuildSelect(B: BuilderRef,
1127 Name: *const c_char)
1129 pub fn LLVMBuildVAArg(B: BuilderRef,
1132 Name: *const c_char)
1134 pub fn LLVMBuildExtractElement(B: BuilderRef,
1137 Name: *const c_char)
1139 pub fn LLVMBuildInsertElement(B: BuilderRef,
1143 Name: *const c_char)
1145 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1149 Name: *const c_char)
1151 pub fn LLVMBuildExtractValue(B: BuilderRef,
1154 Name: *const c_char)
1156 pub fn LLVMBuildInsertValue(B: BuilderRef,
1160 Name: *const c_char)
1163 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1164 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1165 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1168 Name: *const c_char)
1171 // Atomic Operations
1172 pub fn LLVMRustBuildAtomicLoad(B: BuilderRef,
1173 PointerVal: ValueRef,
1174 Name: *const c_char,
1175 Order: AtomicOrdering,
1179 pub fn LLVMRustBuildAtomicStore(B: BuilderRef,
1182 Order: AtomicOrdering,
1186 pub fn LLVMRustBuildAtomicCmpXchg(B: BuilderRef,
1190 Order: AtomicOrdering,
1191 FailureOrder: AtomicOrdering,
1195 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1199 Order: AtomicOrdering,
1200 SingleThreaded: Bool)
1203 pub fn LLVMRustBuildAtomicFence(B: BuilderRef,
1204 Order: AtomicOrdering,
1205 Scope: SynchronizationScope);
1208 // Selected entries from the downcasts.
1209 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1210 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1212 /// Writes a module to the specified path. Returns 0 on success.
1213 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1215 /// Creates target data from a target layout string.
1216 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1217 /// Number of bytes clobbered when doing a Store to *T.
1218 pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1220 /// Distance between successive elements in an array of T. Includes ABI padding.
1221 pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1223 /// Returns the preferred alignment of a type.
1224 pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1225 /// Returns the minimum alignment of a type.
1226 pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1228 /// Computes the byte offset of the indexed struct element for a
1230 pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1235 /// Disposes target data.
1236 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1238 /// Creates a pass manager.
1239 pub fn LLVMCreatePassManager() -> PassManagerRef;
1241 /// Creates a function-by-function pass manager
1242 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef) -> PassManagerRef;
1244 /// Disposes a pass manager.
1245 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1247 /// Runs a pass manager on a module.
1248 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1250 pub fn LLVMInitializePasses();
1252 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1253 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1254 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef, Value: Bool);
1255 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: PassManagerBuilderRef, Value: Bool);
1256 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: PassManagerBuilderRef,
1258 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: PassManagerBuilderRef,
1259 PM: PassManagerRef);
1261 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: PassManagerBuilderRef,
1262 PM: PassManagerRef);
1263 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: PassManagerBuilderRef,
1268 // Stuff that's in rustllvm/ because it's not upstream yet.
1270 /// Opens an object file.
1271 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1272 /// Closes an object file.
1273 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1275 /// Enumerates the sections in an object file.
1276 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1277 /// Destroys a section iterator.
1278 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1279 /// Returns true if the section iterator is at the end of the section
1281 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, SI: SectionIteratorRef) -> Bool;
1282 /// Moves the section iterator to point to the next section.
1283 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1284 /// Returns the current section size.
1285 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1286 /// Returns the current section contents as a string buffer.
1287 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1289 /// Reads the given file and returns it as a memory buffer. Use
1290 /// LLVMDisposeMemoryBuffer() to get rid of it.
1291 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char) -> MemoryBufferRef;
1293 pub fn LLVMStartMultithreaded() -> Bool;
1295 /// Returns a string describing the last error caused by an LLVMRust* call.
1296 pub fn LLVMRustGetLastError() -> *const c_char;
1298 /// Print the pass timings since static dtors aren't picking them up.
1299 pub fn LLVMRustPrintPassTimings();
1301 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1303 pub fn LLVMStructSetBody(StructTy: TypeRef,
1304 ElementTypes: *const TypeRef,
1305 ElementCount: c_uint,
1308 pub fn LLVMConstNamedStruct(S: TypeRef,
1309 ConstantVals: *const ValueRef,
1313 /// Enables LLVM debug output.
1314 pub fn LLVMRustSetDebug(Enabled: c_int);
1316 /// Prepares inline assembly.
1317 pub fn LLVMRustInlineAsm(Ty: TypeRef,
1318 AsmString: *const c_char,
1319 Constraints: *const c_char,
1322 Dialect: AsmDialect)
1325 pub fn LLVMRustDebugMetadataVersion() -> u32;
1326 pub fn LLVMRustVersionMajor() -> u32;
1327 pub fn LLVMRustVersionMinor() -> u32;
1329 pub fn LLVMRustAddModuleFlag(M: ModuleRef, name: *const c_char, value: u32);
1331 pub fn LLVMRustDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1333 pub fn LLVMRustDIBuilderDispose(Builder: DIBuilderRef);
1335 pub fn LLVMRustDIBuilderFinalize(Builder: DIBuilderRef);
1337 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1340 Producer: *const c_char,
1342 Flags: *const c_char,
1344 SplitName: *const c_char)
1347 pub fn LLVMRustDIBuilderCreateFile(Builder: DIBuilderRef,
1348 Filename: *const c_char,
1349 Directory: *const c_char)
1352 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1354 ParameterTypes: DIArray)
1357 pub fn LLVMRustDIBuilderCreateFunction(Builder: DIBuilderRef,
1358 Scope: DIDescriptor,
1359 Name: *const c_char,
1360 LinkageName: *const c_char,
1364 isLocalToUnit: bool,
1374 pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef,
1375 Name: *const c_char,
1381 pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef,
1385 Name: *const c_char)
1388 pub fn LLVMRustDIBuilderCreateStructType(Builder: DIBuilderRef,
1389 Scope: DIDescriptor,
1390 Name: *const c_char,
1396 DerivedFrom: DIType,
1398 RunTimeLang: c_uint,
1399 VTableHolder: DIType,
1400 UniqueId: *const c_char)
1403 pub fn LLVMRustDIBuilderCreateMemberType(Builder: DIBuilderRef,
1404 Scope: DIDescriptor,
1405 Name: *const c_char,
1415 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1422 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: DIBuilderRef,
1427 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1429 Name: *const c_char,
1430 LinkageName: *const c_char,
1434 isLocalToUnit: bool,
1438 -> DIGlobalVariable;
1440 pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef,
1442 Scope: DIDescriptor,
1443 Name: *const c_char,
1447 AlwaysPreserve: bool,
1453 pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef,
1457 Subscripts: DIArray)
1460 pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef,
1464 Subscripts: DIArray)
1467 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1472 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1473 Ptr: *const DIDescriptor,
1477 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1479 VarInfo: DIVariable,
1480 AddrOps: *const i64,
1481 AddrOpsCount: c_uint,
1483 InsertAtEnd: BasicBlockRef)
1486 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1487 Name: *const c_char,
1491 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1493 Name: *const c_char,
1502 pub fn LLVMRustDIBuilderCreateUnionType(Builder: DIBuilderRef,
1504 Name: *const c_char,
1511 RunTimeLang: c_uint,
1512 UniqueId: *const c_char)
1515 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1517 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1519 Name: *const c_char,
1524 -> DITemplateTypeParameter;
1527 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1529 Name: *const c_char,
1533 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1534 CompositeType: DIType,
1535 TypeArray: DIArray);
1538 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: ContextRef,
1542 InlinedAt: MetadataRef)
1544 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1545 pub fn LLVMRustDIBuilderCreateOpPlus() -> i64;
1547 pub fn LLVMRustWriteTypeToString(Type: TypeRef, s: RustStringRef);
1548 pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef);
1550 pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
1552 pub fn LLVMRustPassKind(Pass: PassRef) -> PassKind;
1553 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef;
1554 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: PassRef);
1556 pub fn LLVMRustHasFeature(T: TargetMachineRef, s: *const c_char) -> bool;
1558 pub fn LLVMRustPrintTargetCPUs(T: TargetMachineRef);
1559 pub fn LLVMRustPrintTargetFeatures(T: TargetMachineRef);
1561 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1563 Features: *const c_char,
1566 Level: CodeGenOptLevel,
1568 PositionIndependentExecutable: bool,
1569 FunctionSections: bool,
1571 -> TargetMachineRef;
1572 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1573 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, M: ModuleRef);
1574 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1576 DisableSimplifyLibCalls: bool);
1577 pub fn LLVMRustConfigurePassManagerBuilder(PMB: PassManagerBuilderRef,
1578 OptLevel: CodeGenOptLevel,
1579 MergeFunctions: bool,
1581 LoopVectorize: bool);
1582 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef,
1584 DisableSimplifyLibCalls: bool);
1585 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1586 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1589 Output: *const c_char,
1592 pub fn LLVMRustPrintModule(PM: PassManagerRef, M: ModuleRef, Output: *const c_char);
1593 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1594 pub fn LLVMRustPrintPasses();
1595 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1596 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
1597 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
1598 pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
1599 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1601 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1602 pub fn LLVMRustArchiveIteratorNew(AR: ArchiveRef) -> ArchiveIteratorRef;
1603 pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
1604 pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1605 pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1606 pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
1607 pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
1608 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1610 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: *mut *const c_char) -> size_t;
1612 pub fn LLVMRustWriteTwineToString(T: TwineRef, s: RustStringRef);
1614 pub fn LLVMContextSetDiagnosticHandler(C: ContextRef,
1615 Handler: DiagnosticHandler,
1616 DiagnosticContext: *mut c_void);
1618 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: DiagnosticInfoRef,
1619 pass_name_out: RustStringRef,
1620 function_out: *mut ValueRef,
1621 debugloc_out: *mut DebugLocRef,
1622 message_out: RustStringRef);
1623 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: DiagnosticInfoRef,
1624 cookie_out: *mut c_uint,
1625 message_out: *mut TwineRef,
1626 instruction_out: *mut ValueRef);
1628 pub fn LLVMRustWriteDiagnosticInfoToString(DI: DiagnosticInfoRef, s: RustStringRef);
1629 pub fn LLVMRustGetDiagInfoKind(DI: DiagnosticInfoRef) -> DiagnosticKind;
1631 pub fn LLVMRustWriteDebugLocToString(C: ContextRef, DL: DebugLocRef, s: RustStringRef);
1633 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: ContextRef,
1634 H: InlineAsmDiagHandler,
1637 pub fn LLVMRustWriteSMDiagnosticToString(d: SMDiagnosticRef, s: RustStringRef);
1639 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1641 Members: *const RustArchiveMemberRef,
1645 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1646 Name: *const c_char,
1647 Child: ArchiveChildRef)
1648 -> RustArchiveMemberRef;
1649 pub fn LLVMRustArchiveMemberFree(Member: RustArchiveMemberRef);
1651 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: ModuleRef, TM: TargetMachineRef);
1652 pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
1654 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1655 Inputs: *const ValueRef,
1657 -> OperandBundleDefRef;
1658 pub fn LLVMRustFreeOperandBundleDef(Bundle: OperandBundleDefRef);
1660 pub fn LLVMRustPositionBuilderAtStart(B: BuilderRef, BB: BasicBlockRef);
1662 pub fn LLVMRustSetComdat(M: ModuleRef, V: ValueRef, Name: *const c_char);
1663 pub fn LLVMRustUnsetComdat(V: ValueRef);
1664 pub fn LLVMRustSetModulePIELevel(M: ModuleRef);