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 LLVMMDStringInContext(C: ContextRef, Str: *const c_char, SLen: c_uint) -> ValueRef;
591 pub fn LLVMMDNodeInContext(C: ContextRef, Vals: *const ValueRef, Count: c_uint) -> ValueRef;
592 pub fn LLVMAddNamedMetadataOperand(M: ModuleRef, Name: *const c_char, Val: ValueRef);
594 // Operations on scalar constants
595 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool) -> ValueRef;
596 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: TypeRef, Wn: c_uint, Ws: *const u64) -> ValueRef;
597 pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
598 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
599 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
600 pub fn LLVMRustConstInt128Get(ConstantVal: ValueRef, SExt: bool,
601 high: *mut u64, low: *mut u64) -> bool;
604 // Operations on composite constants
605 pub fn LLVMConstStringInContext(C: ContextRef,
608 DontNullTerminate: Bool)
610 pub fn LLVMConstStructInContext(C: ContextRef,
611 ConstantVals: *const ValueRef,
616 pub fn LLVMConstArray(ElementTy: TypeRef,
617 ConstantVals: *const ValueRef,
620 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint) -> ValueRef;
622 // Constant expressions
623 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
624 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
625 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
626 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
627 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
628 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
629 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
630 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
631 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
632 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
633 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
634 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
635 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
636 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
637 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
638 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
639 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
640 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
641 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
642 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
643 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
644 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
645 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
646 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
647 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
648 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
649 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
650 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
651 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
652 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
653 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
654 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
655 pub fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef, isSigned: Bool) -> ValueRef;
656 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
657 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
658 IdxList: *const c_uint,
661 pub fn LLVMConstInlineAsm(Ty: TypeRef,
662 AsmString: *const c_char,
663 Constraints: *const c_char,
664 HasSideEffects: Bool,
669 // Operations on global variables, functions, and aliases (globals)
670 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
671 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
672 pub fn LLVMRustGetLinkage(Global: ValueRef) -> Linkage;
673 pub fn LLVMRustSetLinkage(Global: ValueRef, RustLinkage: Linkage);
674 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
675 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
676 pub fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
677 pub fn LLVMRustSetVisibility(Global: ValueRef, Viz: Visibility);
678 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
679 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
680 pub fn LLVMSetDLLStorageClass(V: ValueRef, C: DLLStorageClass);
683 // Operations on global variables
684 pub fn LLVMIsAGlobalVariable(GlobalVar: ValueRef) -> ValueRef;
685 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
686 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
687 pub fn LLVMRustGetOrInsertGlobal(M: ModuleRef, Name: *const c_char, T: TypeRef) -> ValueRef;
688 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
689 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
690 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
691 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
692 pub fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef);
693 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
694 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
695 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
696 pub fn LLVMRustGetNamedValue(M: ModuleRef, Name: *const c_char) -> ValueRef;
698 // Operations on functions
699 pub fn LLVMAddFunction(M: ModuleRef, Name: *const c_char, FunctionTy: TypeRef) -> ValueRef;
700 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
701 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
702 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
703 pub fn LLVMRustGetOrInsertFunction(M: ModuleRef,
707 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
708 pub fn LLVMRustAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: u64);
709 pub fn LLVMRustAddFunctionAttribute(Fn: ValueRef, index: c_uint, attr: Attribute);
710 pub fn LLVMRustAddFunctionAttrStringValue(Fn: ValueRef,
713 Value: *const c_char);
714 pub fn LLVMRustRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: Attribute);
716 // Operations on parameters
717 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
718 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
720 // Operations on basic blocks
721 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
722 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
723 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
727 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
729 // Operations on instructions
730 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
731 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
732 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
733 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
735 // Operations on call sites
736 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
737 pub fn LLVMRustAddCallSiteAttribute(Instr: ValueRef, index: c_uint, attr: Attribute);
738 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: ValueRef, index: c_uint, bytes: u64);
740 // Operations on load/store instructions (only)
741 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
743 // Operations on phi nodes
744 pub fn LLVMAddIncoming(PhiNode: ValueRef,
745 IncomingValues: *const ValueRef,
746 IncomingBlocks: *const BasicBlockRef,
749 // Instruction builders
750 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
751 pub fn LLVMPositionBuilder(Builder: BuilderRef, Block: BasicBlockRef, Instr: ValueRef);
752 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef, Instr: ValueRef);
753 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, Block: BasicBlockRef);
754 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
755 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
758 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
759 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
760 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
763 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
764 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
765 pub fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *const ValueRef, N: c_uint) -> ValueRef;
766 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
767 pub fn LLVMBuildCondBr(B: BuilderRef,
772 pub fn LLVMBuildSwitch(B: BuilderRef,
777 pub fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, NumDests: c_uint) -> ValueRef;
778 pub fn LLVMRustBuildInvoke(B: BuilderRef,
780 Args: *const ValueRef,
783 Catch: BasicBlockRef,
784 Bundle: OperandBundleDefRef,
787 pub fn LLVMRustBuildLandingPad(B: BuilderRef,
794 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
795 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
797 pub fn LLVMRustBuildCleanupPad(B: BuilderRef,
800 Args: *const ValueRef,
803 pub fn LLVMRustBuildCleanupRet(B: BuilderRef,
804 CleanupPad: ValueRef,
805 UnwindBB: BasicBlockRef)
807 pub fn LLVMRustBuildCatchPad(B: BuilderRef,
810 Args: *const ValueRef,
813 pub fn LLVMRustBuildCatchRet(B: BuilderRef, Pad: ValueRef, BB: BasicBlockRef) -> ValueRef;
814 pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
820 pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
821 pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
823 // Add a case to the switch instruction
824 pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
826 // Add a clause to the landing pad instruction
827 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
829 // Set the cleanup on a landing pad instruction
830 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
833 pub fn LLVMBuildAdd(B: BuilderRef,
838 pub fn LLVMBuildNSWAdd(B: BuilderRef,
843 pub fn LLVMBuildNUWAdd(B: BuilderRef,
848 pub fn LLVMBuildFAdd(B: BuilderRef,
853 pub fn LLVMBuildSub(B: BuilderRef,
858 pub fn LLVMBuildNSWSub(B: BuilderRef,
863 pub fn LLVMBuildNUWSub(B: BuilderRef,
868 pub fn LLVMBuildFSub(B: BuilderRef,
873 pub fn LLVMBuildMul(B: BuilderRef,
878 pub fn LLVMBuildNSWMul(B: BuilderRef,
883 pub fn LLVMBuildNUWMul(B: BuilderRef,
888 pub fn LLVMBuildFMul(B: BuilderRef,
893 pub fn LLVMBuildUDiv(B: BuilderRef,
898 pub fn LLVMBuildSDiv(B: BuilderRef,
903 pub fn LLVMBuildExactSDiv(B: BuilderRef,
908 pub fn LLVMBuildFDiv(B: BuilderRef,
913 pub fn LLVMBuildURem(B: BuilderRef,
918 pub fn LLVMBuildSRem(B: BuilderRef,
923 pub fn LLVMBuildFRem(B: BuilderRef,
928 pub fn LLVMBuildShl(B: BuilderRef,
933 pub fn LLVMBuildLShr(B: BuilderRef,
938 pub fn LLVMBuildAShr(B: BuilderRef,
943 pub fn LLVMBuildAnd(B: BuilderRef,
948 pub fn LLVMBuildOr(B: BuilderRef,
953 pub fn LLVMBuildXor(B: BuilderRef,
958 pub fn LLVMBuildBinOp(B: BuilderRef,
964 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
965 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
966 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
967 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
968 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
969 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: ValueRef);
972 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
973 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
974 pub fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: *const c_char) -> ValueRef;
976 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) -> ValueRef;
978 pub fn LLVMBuildGEP(B: BuilderRef,
980 Indices: *const ValueRef,
984 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
986 Indices: *const ValueRef,
990 pub fn LLVMBuildStructGEP(B: BuilderRef,
995 pub fn LLVMBuildGlobalString(B: BuilderRef,
999 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1001 Name: *const c_char)
1005 pub fn LLVMBuildTrunc(B: BuilderRef,
1008 Name: *const c_char)
1010 pub fn LLVMBuildZExt(B: BuilderRef,
1013 Name: *const c_char)
1015 pub fn LLVMBuildSExt(B: BuilderRef,
1018 Name: *const c_char)
1020 pub fn LLVMBuildFPToUI(B: BuilderRef,
1023 Name: *const c_char)
1025 pub fn LLVMBuildFPToSI(B: BuilderRef,
1028 Name: *const c_char)
1030 pub fn LLVMBuildUIToFP(B: BuilderRef,
1033 Name: *const c_char)
1035 pub fn LLVMBuildSIToFP(B: BuilderRef,
1038 Name: *const c_char)
1040 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1043 Name: *const c_char)
1045 pub fn LLVMBuildFPExt(B: BuilderRef,
1048 Name: *const c_char)
1050 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1053 Name: *const c_char)
1055 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1058 Name: *const c_char)
1060 pub fn LLVMBuildBitCast(B: BuilderRef,
1063 Name: *const c_char)
1065 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1068 Name: *const c_char)
1070 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1073 Name: *const c_char)
1075 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1078 Name: *const c_char)
1080 pub fn LLVMBuildCast(B: BuilderRef,
1084 Name: *const c_char)
1086 pub fn LLVMBuildPointerCast(B: BuilderRef,
1089 Name: *const c_char)
1091 pub fn LLVMRustBuildIntCast(B: BuilderRef,
1096 pub fn LLVMBuildFPCast(B: BuilderRef,
1099 Name: *const c_char)
1103 pub fn LLVMBuildICmp(B: BuilderRef,
1107 Name: *const c_char)
1109 pub fn LLVMBuildFCmp(B: BuilderRef,
1113 Name: *const c_char)
1116 // Miscellaneous instructions
1117 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1118 pub fn LLVMRustBuildCall(B: BuilderRef,
1120 Args: *const ValueRef,
1122 Bundle: OperandBundleDefRef,
1123 Name: *const c_char)
1125 pub fn LLVMBuildSelect(B: BuilderRef,
1129 Name: *const c_char)
1131 pub fn LLVMBuildVAArg(B: BuilderRef,
1134 Name: *const c_char)
1136 pub fn LLVMBuildExtractElement(B: BuilderRef,
1139 Name: *const c_char)
1141 pub fn LLVMBuildInsertElement(B: BuilderRef,
1145 Name: *const c_char)
1147 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1151 Name: *const c_char)
1153 pub fn LLVMBuildExtractValue(B: BuilderRef,
1156 Name: *const c_char)
1158 pub fn LLVMBuildInsertValue(B: BuilderRef,
1162 Name: *const c_char)
1165 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1166 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1167 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1170 Name: *const c_char)
1173 // Atomic Operations
1174 pub fn LLVMRustBuildAtomicLoad(B: BuilderRef,
1175 PointerVal: ValueRef,
1176 Name: *const c_char,
1177 Order: AtomicOrdering,
1181 pub fn LLVMRustBuildAtomicStore(B: BuilderRef,
1184 Order: AtomicOrdering,
1188 pub fn LLVMRustBuildAtomicCmpXchg(B: BuilderRef,
1192 Order: AtomicOrdering,
1193 FailureOrder: AtomicOrdering,
1197 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1201 Order: AtomicOrdering,
1202 SingleThreaded: Bool)
1205 pub fn LLVMRustBuildAtomicFence(B: BuilderRef,
1206 Order: AtomicOrdering,
1207 Scope: SynchronizationScope);
1210 // Selected entries from the downcasts.
1211 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1212 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1214 /// Writes a module to the specified path. Returns 0 on success.
1215 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1217 /// Creates target data from a target layout string.
1218 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1219 /// Number of bytes clobbered when doing a Store to *T.
1220 pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1222 /// Distance between successive elements in an array of T. Includes ABI padding.
1223 pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1225 /// Returns the preferred alignment of a type.
1226 pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1227 /// Returns the minimum alignment of a type.
1228 pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1230 /// Computes the byte offset of the indexed struct element for a
1232 pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1237 /// Disposes target data.
1238 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1240 /// Creates a pass manager.
1241 pub fn LLVMCreatePassManager() -> PassManagerRef;
1243 /// Creates a function-by-function pass manager
1244 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef) -> PassManagerRef;
1246 /// Disposes a pass manager.
1247 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1249 /// Runs a pass manager on a module.
1250 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1252 pub fn LLVMInitializePasses();
1254 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1255 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1256 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef, Value: Bool);
1257 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: PassManagerBuilderRef, Value: Bool);
1258 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: PassManagerBuilderRef,
1260 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: PassManagerBuilderRef,
1261 PM: PassManagerRef);
1263 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: PassManagerBuilderRef,
1264 PM: PassManagerRef);
1265 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: PassManagerBuilderRef,
1270 // Stuff that's in rustllvm/ because it's not upstream yet.
1272 /// Opens an object file.
1273 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1274 /// Closes an object file.
1275 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1277 /// Enumerates the sections in an object file.
1278 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1279 /// Destroys a section iterator.
1280 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1281 /// Returns true if the section iterator is at the end of the section
1283 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, SI: SectionIteratorRef) -> Bool;
1284 /// Moves the section iterator to point to the next section.
1285 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1286 /// Returns the current section size.
1287 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1288 /// Returns the current section contents as a string buffer.
1289 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1291 /// Reads the given file and returns it as a memory buffer. Use
1292 /// LLVMDisposeMemoryBuffer() to get rid of it.
1293 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char) -> MemoryBufferRef;
1295 pub fn LLVMStartMultithreaded() -> Bool;
1297 /// Returns a string describing the last error caused by an LLVMRust* call.
1298 pub fn LLVMRustGetLastError() -> *const c_char;
1300 /// Print the pass timings since static dtors aren't picking them up.
1301 pub fn LLVMRustPrintPassTimings();
1303 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1305 pub fn LLVMStructSetBody(StructTy: TypeRef,
1306 ElementTypes: *const TypeRef,
1307 ElementCount: c_uint,
1310 pub fn LLVMConstNamedStruct(S: TypeRef,
1311 ConstantVals: *const ValueRef,
1315 /// Enables LLVM debug output.
1316 pub fn LLVMRustSetDebug(Enabled: c_int);
1318 /// Prepares inline assembly.
1319 pub fn LLVMRustInlineAsm(Ty: TypeRef,
1320 AsmString: *const c_char,
1321 Constraints: *const c_char,
1324 Dialect: AsmDialect)
1327 pub fn LLVMRustDebugMetadataVersion() -> u32;
1328 pub fn LLVMRustVersionMajor() -> u32;
1329 pub fn LLVMRustVersionMinor() -> u32;
1331 pub fn LLVMRustAddModuleFlag(M: ModuleRef, name: *const c_char, value: u32);
1333 pub fn LLVMRustMetadataAsValue(C: ContextRef, MD: MetadataRef) -> ValueRef;
1335 pub fn LLVMRustDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1337 pub fn LLVMRustDIBuilderDispose(Builder: DIBuilderRef);
1339 pub fn LLVMRustDIBuilderFinalize(Builder: DIBuilderRef);
1341 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1344 Producer: *const c_char,
1346 Flags: *const c_char,
1348 SplitName: *const c_char)
1351 pub fn LLVMRustDIBuilderCreateFile(Builder: DIBuilderRef,
1352 Filename: *const c_char,
1353 Directory: *const c_char)
1356 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1358 ParameterTypes: DIArray)
1361 pub fn LLVMRustDIBuilderCreateFunction(Builder: DIBuilderRef,
1362 Scope: DIDescriptor,
1363 Name: *const c_char,
1364 LinkageName: *const c_char,
1368 isLocalToUnit: bool,
1378 pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef,
1379 Name: *const c_char,
1385 pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef,
1389 Name: *const c_char)
1392 pub fn LLVMRustDIBuilderCreateStructType(Builder: DIBuilderRef,
1393 Scope: DIDescriptor,
1394 Name: *const c_char,
1400 DerivedFrom: DIType,
1402 RunTimeLang: c_uint,
1403 VTableHolder: DIType,
1404 UniqueId: *const c_char)
1407 pub fn LLVMRustDIBuilderCreateMemberType(Builder: DIBuilderRef,
1408 Scope: DIDescriptor,
1409 Name: *const c_char,
1419 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1426 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: DIBuilderRef,
1431 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1433 Name: *const c_char,
1434 LinkageName: *const c_char,
1438 isLocalToUnit: bool,
1442 -> DIGlobalVariable;
1444 pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef,
1446 Scope: DIDescriptor,
1447 Name: *const c_char,
1451 AlwaysPreserve: bool,
1457 pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef,
1461 Subscripts: DIArray)
1464 pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef,
1468 Subscripts: DIArray)
1471 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1476 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1477 Ptr: *const DIDescriptor,
1481 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1483 VarInfo: DIVariable,
1484 AddrOps: *const i64,
1485 AddrOpsCount: c_uint,
1487 InsertAtEnd: BasicBlockRef)
1490 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1491 Name: *const c_char,
1495 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1497 Name: *const c_char,
1506 pub fn LLVMRustDIBuilderCreateUnionType(Builder: DIBuilderRef,
1508 Name: *const c_char,
1515 RunTimeLang: c_uint,
1516 UniqueId: *const c_char)
1519 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1521 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1523 Name: *const c_char,
1528 -> DITemplateTypeParameter;
1531 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1533 Name: *const c_char,
1537 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1538 CompositeType: DIType,
1539 TypeArray: DIArray);
1542 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: ContextRef,
1546 InlinedAt: MetadataRef)
1548 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1549 pub fn LLVMRustDIBuilderCreateOpPlus() -> i64;
1551 pub fn LLVMRustWriteTypeToString(Type: TypeRef, s: RustStringRef);
1552 pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef);
1554 pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
1556 pub fn LLVMRustPassKind(Pass: PassRef) -> PassKind;
1557 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef;
1558 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: PassRef);
1560 pub fn LLVMRustHasFeature(T: TargetMachineRef, s: *const c_char) -> bool;
1562 pub fn LLVMRustPrintTargetCPUs(T: TargetMachineRef);
1563 pub fn LLVMRustPrintTargetFeatures(T: TargetMachineRef);
1565 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1567 Features: *const c_char,
1570 Level: CodeGenOptLevel,
1572 PositionIndependentExecutable: bool,
1573 FunctionSections: bool,
1575 -> TargetMachineRef;
1576 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1577 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, M: ModuleRef);
1578 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1580 DisableSimplifyLibCalls: bool);
1581 pub fn LLVMRustConfigurePassManagerBuilder(PMB: PassManagerBuilderRef,
1582 OptLevel: CodeGenOptLevel,
1583 MergeFunctions: bool,
1585 LoopVectorize: bool);
1586 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef,
1588 DisableSimplifyLibCalls: bool);
1589 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1590 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1593 Output: *const c_char,
1596 pub fn LLVMRustPrintModule(PM: PassManagerRef, M: ModuleRef, Output: *const c_char);
1597 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1598 pub fn LLVMRustPrintPasses();
1599 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1600 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
1601 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
1602 pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
1603 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1605 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1606 pub fn LLVMRustArchiveIteratorNew(AR: ArchiveRef) -> ArchiveIteratorRef;
1607 pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
1608 pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1609 pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1610 pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
1611 pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
1612 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1614 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: *mut *const c_char) -> size_t;
1616 pub fn LLVMRustWriteTwineToString(T: TwineRef, s: RustStringRef);
1618 pub fn LLVMContextSetDiagnosticHandler(C: ContextRef,
1619 Handler: DiagnosticHandler,
1620 DiagnosticContext: *mut c_void);
1622 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: DiagnosticInfoRef,
1623 pass_name_out: RustStringRef,
1624 function_out: *mut ValueRef,
1625 debugloc_out: *mut DebugLocRef,
1626 message_out: RustStringRef);
1627 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: DiagnosticInfoRef,
1628 cookie_out: *mut c_uint,
1629 message_out: *mut TwineRef,
1630 instruction_out: *mut ValueRef);
1632 pub fn LLVMRustWriteDiagnosticInfoToString(DI: DiagnosticInfoRef, s: RustStringRef);
1633 pub fn LLVMRustGetDiagInfoKind(DI: DiagnosticInfoRef) -> DiagnosticKind;
1635 pub fn LLVMRustWriteDebugLocToString(C: ContextRef, DL: DebugLocRef, s: RustStringRef);
1637 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: ContextRef,
1638 H: InlineAsmDiagHandler,
1641 pub fn LLVMRustWriteSMDiagnosticToString(d: SMDiagnosticRef, s: RustStringRef);
1643 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1645 Members: *const RustArchiveMemberRef,
1649 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1650 Name: *const c_char,
1651 Child: ArchiveChildRef)
1652 -> RustArchiveMemberRef;
1653 pub fn LLVMRustArchiveMemberFree(Member: RustArchiveMemberRef);
1655 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: ModuleRef, TM: TargetMachineRef);
1656 pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
1658 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1659 Inputs: *const ValueRef,
1661 -> OperandBundleDefRef;
1662 pub fn LLVMRustFreeOperandBundleDef(Bundle: OperandBundleDefRef);
1664 pub fn LLVMRustPositionBuilderAtStart(B: BuilderRef, BB: BasicBlockRef);
1666 pub fn LLVMRustSetComdat(M: ModuleRef, V: ValueRef, Name: *const c_char);
1667 pub fn LLVMRustUnsetComdat(V: ValueRef);
1668 pub fn LLVMRustSetModulePIELevel(M: ModuleRef);