1 use super::debuginfo::{
2 DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
3 DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
4 DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
5 DINameSpace, DIFlags, DISPFlags, DebugEmissionKind,
8 use libc::{c_uint, c_int, size_t, c_char};
9 use libc::{c_ulonglong, c_void};
11 use std::marker::PhantomData;
13 use rustc_codegen_ssa;
15 use super::RustString;
17 pub type Bool = c_uint;
19 pub const True: Bool = 1 as Bool;
20 pub const False: Bool = 0 as Bool;
22 #[derive(Copy, Clone, PartialEq)]
24 #[allow(dead_code)] // Variants constructed by C++.
25 pub enum LLVMRustResult {
29 // Consts for the LLVM CallConv type, pre-cast to usize.
31 /// LLVM CallingConv::ID. Should we wrap this?
32 #[derive(Copy, Clone, PartialEq, Debug)]
38 X86StdcallCallConv = 64,
39 X86FastcallCallConv = 65,
40 ArmAapcsCallConv = 67,
52 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
56 AvailableExternallyLinkage = 1,
57 LinkOnceAnyLinkage = 2,
58 LinkOnceODRLinkage = 3,
64 ExternalWeakLinkage = 9,
69 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
77 /// LLVMDLLStorageClass
78 #[derive(Copy, Clone)]
80 pub enum DLLStorageClass {
83 DllImport = 1, // Function to be imported from DLL.
85 DllExport = 2, // Function to be accessible from DLL.
88 /// Matches LLVMRustAttribute in rustllvm.h
89 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
90 /// though it is not ABI compatible (since it's a C++ enum)
92 #[derive(Copy, Clone, Debug)]
107 OptimizeForSize = 13,
115 SanitizeAddress = 21,
122 #[derive(Copy, Clone)]
124 pub enum IntPredicate {
138 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
140 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
141 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
142 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
143 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
144 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
145 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
146 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
147 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
148 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
149 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
154 /// LLVMRealPredicate
155 #[derive(Copy, Clone)]
157 pub enum RealPredicate {
158 RealPredicateFalse = 0,
173 RealPredicateTrue = 15,
177 pub fn from_generic(realpred: rustc_codegen_ssa::common::RealPredicate) -> Self {
179 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse =>
180 RealPredicate::RealPredicateFalse,
181 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
182 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
183 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
184 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
185 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
186 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
187 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
188 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
189 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
190 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
191 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
192 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
193 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
194 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
195 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue =>
196 RealPredicate::RealPredicateTrue
202 #[derive(Copy, Clone, PartialEq, Debug)]
225 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
227 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
228 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
229 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
230 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
231 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
232 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
233 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
234 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
235 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
236 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
237 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
238 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
239 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
240 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
241 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
242 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
243 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
248 /// LLVMAtomicRmwBinOp
249 #[derive(Copy, Clone)]
251 pub enum AtomicRmwBinOp {
265 impl AtomicRmwBinOp {
266 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
268 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
269 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
270 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
271 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
272 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
273 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
274 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
275 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
276 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
277 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
278 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin
283 /// LLVMAtomicOrdering
284 #[derive(Copy, Clone)]
286 pub enum AtomicOrdering {
291 // Consume = 3, // Not specified yet.
295 SequentiallyConsistent = 7,
298 impl AtomicOrdering {
299 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
301 rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
302 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
303 rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
304 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
305 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
306 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease =>
307 AtomicOrdering::AcquireRelease,
308 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent =>
309 AtomicOrdering::SequentiallyConsistent
315 /// LLVMRustSynchronizationScope
316 #[derive(Copy, Clone)]
318 pub enum SynchronizationScope {
319 // FIXME: figure out if this variant is needed at all.
326 impl SynchronizationScope {
327 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
329 rustc_codegen_ssa::common::SynchronizationScope::Other => SynchronizationScope::Other,
330 rustc_codegen_ssa::common::SynchronizationScope::SingleThread =>
331 SynchronizationScope::SingleThread,
332 rustc_codegen_ssa::common::SynchronizationScope::CrossThread =>
333 SynchronizationScope::CrossThread,
339 #[derive(Copy, Clone)]
342 // FIXME: figure out if this variant is needed at all.
350 #[derive(Copy, Clone)]
352 pub enum MetadataType {
359 MD_invariant_load = 6,
363 MD_mem_parallel_loop_access = 10,
367 /// LLVMRustAsmDialect
368 #[derive(Copy, Clone)]
370 pub enum AsmDialect {
371 // FIXME: figure out if this variant is needed at all.
379 pub fn from_generic(asm: syntax::ast::AsmDialect) -> Self {
381 syntax::ast::AsmDialect::Att => AsmDialect::Att,
382 syntax::ast::AsmDialect::Intel => AsmDialect::Intel
387 /// LLVMRustCodeGenOptLevel
388 #[derive(Copy, Clone, PartialEq)]
390 pub enum CodeGenOptLevel {
391 // FIXME: figure out if this variant is needed at all.
401 #[derive(Copy, Clone, PartialEq)]
413 /// LLVMRustCodeModel
414 #[derive(Copy, Clone)]
417 // FIXME: figure out if this variant is needed at all.
427 /// LLVMRustDiagnosticKind
428 #[derive(Copy, Clone)]
430 #[allow(dead_code)] // Variants constructed by C++.
431 pub enum DiagnosticKind {
435 DebugMetadataVersion,
438 OptimizationRemarkMissed,
439 OptimizationRemarkAnalysis,
440 OptimizationRemarkAnalysisFPCommute,
441 OptimizationRemarkAnalysisAliasing,
442 OptimizationRemarkOther,
448 /// LLVMRustArchiveKind
449 #[derive(Copy, Clone)]
451 pub enum ArchiveKind {
452 // FIXME: figure out if this variant is needed at all.
461 #[derive(Copy, Clone, PartialEq, Debug)]
463 #[allow(dead_code)] // Variants constructed by C++.
470 /// LLVMRustThinLTOData
471 extern { pub type ThinLTOData; }
473 /// LLVMRustThinLTOBuffer
474 extern { pub type ThinLTOBuffer; }
476 // LLVMRustModuleNameCallback
477 pub type ThinLTOModuleNameCallback =
478 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
480 /// LLVMRustThinLTOModule
482 pub struct ThinLTOModule {
483 pub identifier: *const c_char,
488 /// LLVMThreadLocalMode
489 #[derive(Copy, Clone)]
491 pub enum ThreadLocalMode {
499 extern { type Opaque; }
501 struct InvariantOpaque<'a> {
502 _marker: PhantomData<&'a mut &'a ()>,
506 // Opaque pointer types
507 extern { pub type Module; }
508 extern { pub type Context; }
509 extern { pub type Type; }
510 extern { pub type Value; }
511 extern { pub type Metadata; }
512 extern { pub type BasicBlock; }
514 pub struct Builder<'a>(InvariantOpaque<'a>);
515 extern { pub type MemoryBuffer; }
517 pub struct PassManager<'a>(InvariantOpaque<'a>);
518 extern { pub type PassManagerBuilder; }
519 extern { pub type ObjectFile; }
521 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
522 extern { pub type Pass; }
523 extern { pub type TargetMachine; }
524 extern { pub type Archive; }
526 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
528 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
529 extern { pub type Twine; }
530 extern { pub type DiagnosticInfo; }
531 extern { pub type SMDiagnostic; }
533 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
535 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
537 pub struct Linker<'a>(InvariantOpaque<'a>);
539 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
540 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
544 use super::{InvariantOpaque, Metadata};
547 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
549 pub type DIDescriptor = Metadata;
550 pub type DIScope = DIDescriptor;
551 pub type DIFile = DIScope;
552 pub type DILexicalBlock = DIScope;
553 pub type DISubprogram = DIScope;
554 pub type DINameSpace = DIScope;
555 pub type DIType = DIDescriptor;
556 pub type DIBasicType = DIType;
557 pub type DIDerivedType = DIType;
558 pub type DICompositeType = DIDerivedType;
559 pub type DIVariable = DIDescriptor;
560 pub type DIGlobalVariableExpression = DIDescriptor;
561 pub type DIArray = DIDescriptor;
562 pub type DISubrange = DIDescriptor;
563 pub type DIEnumerator = DIDescriptor;
564 pub type DITemplateTypeParameter = DIDescriptor;
566 // These values **must** match with LLVMRustDIFlags!!
570 pub struct DIFlags: ::libc::uint32_t {
572 const FlagPrivate = 1;
573 const FlagProtected = 2;
574 const FlagPublic = 3;
575 const FlagFwdDecl = (1 << 2);
576 const FlagAppleBlock = (1 << 3);
577 const FlagBlockByrefStruct = (1 << 4);
578 const FlagVirtual = (1 << 5);
579 const FlagArtificial = (1 << 6);
580 const FlagExplicit = (1 << 7);
581 const FlagPrototyped = (1 << 8);
582 const FlagObjcClassComplete = (1 << 9);
583 const FlagObjectPointer = (1 << 10);
584 const FlagVector = (1 << 11);
585 const FlagStaticMember = (1 << 12);
586 const FlagLValueReference = (1 << 13);
587 const FlagRValueReference = (1 << 14);
588 const FlagExternalTypeRef = (1 << 15);
589 const FlagIntroducedVirtual = (1 << 18);
590 const FlagBitField = (1 << 19);
591 const FlagNoReturn = (1 << 20);
592 const FlagMainSubprogram = (1 << 21);
596 // These values **must** match with LLVMRustDISPFlags!!
600 pub struct DISPFlags: ::libc::uint32_t {
601 const SPFlagZero = 0;
602 const SPFlagVirtual = 1;
603 const SPFlagPureVirtual = 2;
604 const SPFlagLocalToUnit = (1 << 2);
605 const SPFlagDefinition = (1 << 3);
606 const SPFlagOptimized = (1 << 4);
610 /// LLVMRustDebugEmissionKind
611 #[derive(Copy, Clone)]
613 pub enum DebugEmissionKind {
619 impl DebugEmissionKind {
620 pub fn from_generic(kind: rustc::session::config::DebugInfo) -> Self {
621 use rustc::session::config::DebugInfo;
623 DebugInfo::None => DebugEmissionKind::NoDebug,
624 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
625 DebugInfo::Full => DebugEmissionKind::FullDebug,
631 extern { pub type ModuleBuffer; }
634 pub fn LLVMRustInstallFatalErrorHandler();
636 // Create and destroy contexts.
637 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
638 pub fn LLVMContextDispose(C: &'static mut Context);
639 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
642 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
643 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
644 pub fn LLVMCloneModule(M: &Module) -> &Module;
646 /// Data layout. See Module::getDataLayout.
647 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
648 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
650 /// See Module::setModuleInlineAsm.
651 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
652 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
654 /// See llvm::LLVMTypeKind::getTypeID.
655 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
657 // Operations on integer types
658 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
659 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
660 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
661 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
662 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
663 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
665 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
667 // Operations on real types
668 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
669 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
671 // Operations on function types
672 pub fn LLVMFunctionType(ReturnType: &'a Type,
673 ParamTypes: *const &'a Type,
677 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
678 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
680 // Operations on struct types
681 pub fn LLVMStructTypeInContext(C: &'a Context,
682 ElementTypes: *const &'a Type,
683 ElementCount: c_uint,
687 // Operations on array, pointer, and vector types (sequence types)
688 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
689 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
690 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
692 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
693 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
695 // Operations on other types
696 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
697 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
698 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
700 // Operations on all values
701 pub fn LLVMTypeOf(Val: &Value) -> &Type;
702 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
703 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
704 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
705 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
707 // Operations on constants of any type
708 pub fn LLVMConstNull(Ty: &Type) -> &Value;
709 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
711 // Operations on metadata
712 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
713 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
714 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
716 // Operations on scalar constants
717 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
718 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
719 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
720 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
721 high: &mut u64, low: &mut u64) -> bool;
722 pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
725 // Operations on composite constants
726 pub fn LLVMConstStringInContext(C: &Context,
729 DontNullTerminate: Bool)
731 pub fn LLVMConstStructInContext(C: &'a Context,
732 ConstantVals: *const &'a Value,
737 pub fn LLVMConstArray(ElementTy: &'a Type,
738 ConstantVals: *const &'a Value,
741 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
743 // Constant expressions
744 pub fn LLVMConstInBoundsGEP(
745 ConstantVal: &'a Value,
746 ConstantIndices: *const &'a Value,
749 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
750 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
751 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
752 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
753 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
754 pub fn LLVMConstExtractValue(AggConstant: &Value,
755 IdxList: *const c_uint,
759 // Operations on global variables, functions, and aliases (globals)
760 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
761 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
762 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
763 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
764 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
765 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
766 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
767 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
768 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
771 // Operations on global variables
772 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
773 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
774 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
775 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
776 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
777 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
778 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
779 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
780 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
781 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
782 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
783 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
784 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
785 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
786 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
787 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
789 // Operations on functions
790 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
792 FunctionTy: &'a Type)
794 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
795 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
796 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
797 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
798 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
799 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
802 Value: *const c_char);
803 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
805 // Operations on parameters
806 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
807 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
809 // Operations on basic blocks
810 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
811 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
815 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
817 // Operations on instructions
818 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
820 // Operations on call sites
821 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
822 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
823 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
824 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
825 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
829 // Operations on load/store instructions (only)
830 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
832 // Operations on phi nodes
833 pub fn LLVMAddIncoming(PhiNode: &'a Value,
834 IncomingValues: *const &'a Value,
835 IncomingBlocks: *const &'a BasicBlock,
838 // Instruction builders
839 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
840 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
841 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
842 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
845 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
846 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
847 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
850 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
851 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
852 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
853 pub fn LLVMBuildCondBr(B: &Builder<'a>,
855 Then: &'a BasicBlock,
856 Else: &'a BasicBlock)
858 pub fn LLVMBuildSwitch(B: &Builder<'a>,
860 Else: &'a BasicBlock,
863 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
865 Args: *const &'a Value,
867 Then: &'a BasicBlock,
868 Catch: &'a BasicBlock,
869 Bundle: Option<&OperandBundleDef<'a>>,
872 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
878 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
879 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
881 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
882 ParentPad: Option<&'a Value>,
884 Args: *const &'a Value,
886 -> Option<&'a Value>;
887 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
888 CleanupPad: &'a Value,
889 UnwindBB: Option<&'a BasicBlock>)
890 -> Option<&'a Value>;
891 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
892 ParentPad: &'a Value,
894 Args: *const &'a Value,
896 -> Option<&'a Value>;
897 pub fn LLVMRustBuildCatchRet(
901 ) -> Option<&'a Value>;
902 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
903 ParentPad: Option<&'a Value>,
904 BB: Option<&'a BasicBlock>,
907 -> Option<&'a Value>;
908 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
909 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
911 // Add a case to the switch instruction
912 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
914 // Add a clause to the landing pad instruction
915 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
917 // Set the cleanup on a landing pad instruction
918 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
921 pub fn LLVMBuildAdd(B: &Builder<'a>,
926 pub fn LLVMBuildFAdd(B: &Builder<'a>,
931 pub fn LLVMBuildSub(B: &Builder<'a>,
936 pub fn LLVMBuildFSub(B: &Builder<'a>,
941 pub fn LLVMBuildMul(B: &Builder<'a>,
946 pub fn LLVMBuildFMul(B: &Builder<'a>,
951 pub fn LLVMBuildUDiv(B: &Builder<'a>,
956 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
961 pub fn LLVMBuildSDiv(B: &Builder<'a>,
966 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
971 pub fn LLVMBuildFDiv(B: &Builder<'a>,
976 pub fn LLVMBuildURem(B: &Builder<'a>,
981 pub fn LLVMBuildSRem(B: &Builder<'a>,
986 pub fn LLVMBuildFRem(B: &Builder<'a>,
991 pub fn LLVMBuildShl(B: &Builder<'a>,
996 pub fn LLVMBuildLShr(B: &Builder<'a>,
1001 pub fn LLVMBuildAShr(B: &Builder<'a>,
1004 Name: *const c_char)
1006 pub fn LLVMBuildAnd(B: &Builder<'a>,
1009 Name: *const c_char)
1011 pub fn LLVMBuildOr(B: &Builder<'a>,
1014 Name: *const c_char)
1016 pub fn LLVMBuildXor(B: &Builder<'a>,
1019 Name: *const c_char)
1021 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1022 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1023 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1024 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
1027 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1028 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
1031 Name: *const c_char)
1033 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
1035 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1037 pub fn LLVMBuildGEP(B: &Builder<'a>,
1039 Indices: *const &'a Value,
1041 Name: *const c_char)
1043 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
1045 Indices: *const &'a Value,
1047 Name: *const c_char)
1049 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
1052 Name: *const c_char)
1056 pub fn LLVMBuildTrunc(B: &Builder<'a>,
1059 Name: *const c_char)
1061 pub fn LLVMBuildZExt(B: &Builder<'a>,
1064 Name: *const c_char)
1066 pub fn LLVMBuildSExt(B: &Builder<'a>,
1069 Name: *const c_char)
1071 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
1074 Name: *const c_char)
1076 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
1079 Name: *const c_char)
1081 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
1084 Name: *const c_char)
1086 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
1089 Name: *const c_char)
1091 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
1094 Name: *const c_char)
1096 pub fn LLVMBuildFPExt(B: &Builder<'a>,
1099 Name: *const c_char)
1101 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
1104 Name: *const c_char)
1106 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
1109 Name: *const c_char)
1111 pub fn LLVMBuildBitCast(B: &Builder<'a>,
1114 Name: *const c_char)
1116 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
1119 Name: *const c_char)
1121 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
1128 pub fn LLVMBuildICmp(B: &Builder<'a>,
1132 Name: *const c_char)
1134 pub fn LLVMBuildFCmp(B: &Builder<'a>,
1138 Name: *const c_char)
1141 // Miscellaneous instructions
1142 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1143 pub fn LLVMRustBuildCall(B: &Builder<'a>,
1145 Args: *const &'a Value,
1147 Bundle: Option<&OperandBundleDef<'a>>,
1148 Name: *const c_char)
1150 pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
1158 pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
1166 pub fn LLVMBuildSelect(B: &Builder<'a>,
1170 Name: *const c_char)
1172 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1175 Name: *const c_char)
1177 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1180 Name: *const c_char)
1182 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1186 Name: *const c_char)
1188 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1192 Name: *const c_char)
1194 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1197 Name: *const c_char)
1199 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1203 Name: *const c_char)
1206 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1210 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1214 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1217 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1220 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1223 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1226 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1229 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1233 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1237 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1241 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1246 pub fn LLVMRustBuildMinNum(
1251 pub fn LLVMRustBuildMaxNum(
1257 // Atomic Operations
1258 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1259 PointerVal: &'a Value,
1260 Name: *const c_char,
1261 Order: AtomicOrdering)
1264 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1267 Order: AtomicOrdering)
1270 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1274 Order: AtomicOrdering,
1275 FailureOrder: AtomicOrdering,
1279 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1283 Order: AtomicOrdering,
1284 SingleThreaded: Bool)
1287 pub fn LLVMRustBuildAtomicFence(B: &Builder,
1288 Order: AtomicOrdering,
1289 Scope: SynchronizationScope);
1291 /// Writes a module to the specified path. Returns 0 on success.
1292 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1294 /// Creates a pass manager.
1295 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1297 /// Creates a function-by-function pass manager
1298 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1300 /// Disposes a pass manager.
1301 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1303 /// Runs a pass manager on a module.
1304 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1306 pub fn LLVMInitializePasses();
1308 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1309 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1310 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1311 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1312 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1314 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1317 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1319 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1323 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1324 PMB: &PassManagerBuilder,
1327 // Stuff that's in rustllvm/ because it's not upstream yet.
1329 /// Opens an object file.
1330 pub fn LLVMCreateObjectFile(
1331 MemBuf: &'static mut MemoryBuffer,
1332 ) -> Option<&'static mut ObjectFile>;
1333 /// Closes an object file.
1334 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1336 /// Enumerates the sections in an object file.
1337 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1338 /// Destroys a section iterator.
1339 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1340 /// Returns `true` if the section iterator is at the end of the section
1342 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1343 /// Moves the section iterator to point to the next section.
1344 pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1345 /// Returns the current section size.
1346 pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1347 /// Returns the current section contents as a string buffer.
1348 pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1350 /// Reads the given file and returns it as a memory buffer. Use
1351 /// LLVMDisposeMemoryBuffer() to get rid of it.
1352 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1353 Path: *const c_char,
1354 ) -> Option<&'static mut MemoryBuffer>;
1356 pub fn LLVMStartMultithreaded() -> Bool;
1358 /// Returns a string describing the last error caused by an LLVMRust* call.
1359 pub fn LLVMRustGetLastError() -> *const c_char;
1361 /// Print the pass timings since static dtors aren't picking them up.
1362 pub fn LLVMRustPrintPassTimings();
1364 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1366 pub fn LLVMStructSetBody(StructTy: &'a Type,
1367 ElementTypes: *const &'a Type,
1368 ElementCount: c_uint,
1371 /// Prepares inline assembly.
1372 pub fn LLVMRustInlineAsm(Ty: &Type,
1373 AsmString: *const c_char,
1374 Constraints: *const c_char,
1377 Dialect: AsmDialect)
1379 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1380 Constraints: *const c_char)
1383 pub fn LLVMRustDebugMetadataVersion() -> u32;
1384 pub fn LLVMRustVersionMajor() -> u32;
1385 pub fn LLVMRustVersionMinor() -> u32;
1386 pub fn LLVMRustIsRustLLVM() -> bool;
1388 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1390 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1392 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1394 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1396 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1398 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1401 Producer: *const c_char,
1403 Flags: *const c_char,
1405 SplitName: *const c_char,
1406 kind: DebugEmissionKind)
1407 -> &'a DIDescriptor;
1409 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1410 Filename: *const c_char,
1411 Directory: *const c_char)
1414 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1416 ParameterTypes: &'a DIArray)
1417 -> &'a DICompositeType;
1419 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1420 Scope: &'a DIDescriptor,
1421 Name: *const c_char,
1422 LinkageName: *const c_char,
1430 TParam: &'a DIArray,
1431 Decl: Option<&'a DIDescriptor>)
1432 -> &'a DISubprogram;
1434 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1435 Name: *const c_char,
1441 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1442 PointeeTy: &'a DIType,
1445 Name: *const c_char)
1446 -> &'a DIDerivedType;
1448 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1449 Scope: Option<&'a DIDescriptor>,
1450 Name: *const c_char,
1456 DerivedFrom: Option<&'a DIType>,
1457 Elements: &'a DIArray,
1458 RunTimeLang: c_uint,
1459 VTableHolder: Option<&'a DIType>,
1460 UniqueId: *const c_char)
1461 -> &'a DICompositeType;
1463 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1464 Scope: &'a DIDescriptor,
1465 Name: *const c_char,
1473 -> &'a DIDerivedType;
1475 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1477 Name: *const c_char,
1483 Discriminant: Option<&'a Value>,
1488 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1493 -> &'a DILexicalBlock;
1495 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1498 -> &'a DILexicalBlock;
1500 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1501 Context: Option<&'a DIScope>,
1502 Name: *const c_char,
1503 LinkageName: *const c_char,
1507 isLocalToUnit: bool,
1509 Decl: Option<&'a DIDescriptor>,
1511 -> &'a DIGlobalVariableExpression;
1513 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1515 Scope: &'a DIDescriptor,
1516 Name: *const c_char,
1520 AlwaysPreserve: bool,
1526 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1530 Subscripts: &'a DIArray)
1533 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1538 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1539 Ptr: *const Option<&'a DIDescriptor>,
1543 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1545 VarInfo: &'a DIVariable,
1546 AddrOps: *const i64,
1547 AddrOpsCount: c_uint,
1549 InsertAtEnd: &'a BasicBlock)
1552 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1553 Name: *const c_char,
1555 -> &'a DIEnumerator;
1557 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1559 Name: *const c_char,
1564 Elements: &'a DIArray,
1565 ClassType: &'a DIType,
1569 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1571 Name: *const c_char,
1577 Elements: Option<&'a DIArray>,
1578 RunTimeLang: c_uint,
1579 UniqueId: *const c_char)
1582 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1584 Name: *const c_char,
1590 Discriminator: Option<&'a DIDerivedType>,
1591 Elements: &'a DIArray,
1592 UniqueId: *const c_char)
1593 -> &'a DIDerivedType;
1595 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1597 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1598 Scope: Option<&'a DIScope>,
1599 Name: *const c_char,
1604 -> &'a DITemplateTypeParameter;
1607 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1608 Scope: Option<&'a DIScope>,
1609 Name: *const c_char,
1614 pub fn LLVMRustDICompositeTypeReplaceArrays(Builder: &DIBuilder<'a>,
1615 CompositeType: &'a DIType,
1616 Elements: Option<&'a DIArray>,
1617 Params: Option<&'a DIArray>);
1620 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1624 InlinedAt: Option<&'a Metadata>)
1626 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1627 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1629 #[allow(improper_ctypes)]
1630 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1631 #[allow(improper_ctypes)]
1632 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1634 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1635 pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1637 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1638 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1639 pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1641 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1643 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1644 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1646 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1647 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1649 Features: *const c_char,
1652 Level: CodeGenOptLevel,
1654 PositionIndependentExecutable: bool,
1655 FunctionSections: bool,
1657 TrapUnreachable: bool,
1660 EmitStackSizeSection: bool)
1661 -> Option<&'static mut TargetMachine>;
1662 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1663 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1664 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1666 DisableSimplifyLibCalls: bool);
1667 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1668 OptLevel: CodeGenOptLevel,
1669 MergeFunctions: bool,
1671 LoopVectorize: bool,
1672 PrepareForThinLTO: bool,
1673 PGOGenPath: *const c_char,
1674 PGOUsePath: *const c_char);
1675 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1677 DisableSimplifyLibCalls: bool);
1678 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1679 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1680 PM: &PassManager<'a>,
1682 Output: *const c_char,
1685 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1687 Output: *const c_char,
1688 Demangle: extern fn(*const c_char,
1692 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1693 pub fn LLVMRustPrintPasses();
1694 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1695 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1696 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1697 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1699 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1700 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1701 pub fn LLVMRustArchiveIteratorNext(
1702 AIR: &ArchiveIterator<'a>,
1703 ) -> Option<&'a mut ArchiveChild<'a>>;
1704 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1705 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1706 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1707 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1708 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1710 pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1712 #[allow(improper_ctypes)]
1713 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1715 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1716 Handler: DiagnosticHandler,
1717 DiagnosticContext: *mut c_void);
1719 #[allow(improper_ctypes)]
1720 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1721 pass_name_out: &RustString,
1722 function_out: &mut Option<&'a Value>,
1723 loc_line_out: &mut c_uint,
1724 loc_column_out: &mut c_uint,
1725 loc_filename_out: &RustString,
1726 message_out: &RustString);
1728 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1729 cookie_out: &mut c_uint,
1730 message_out: &mut Option<&'a Twine>,
1731 instruction_out: &mut Option<&'a Value>);
1733 #[allow(improper_ctypes)]
1734 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1735 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1737 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1738 H: InlineAsmDiagHandler,
1741 #[allow(improper_ctypes)]
1742 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1744 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1746 Members: *const &RustArchiveMember,
1750 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1751 Name: *const c_char,
1752 Child: Option<&ArchiveChild<'a>>)
1753 -> &'a mut RustArchiveMember<'a>;
1754 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1756 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1758 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1759 Inputs: *const &'a Value,
1761 -> &'a mut OperandBundleDef<'a>;
1762 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1764 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1766 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1767 pub fn LLVMRustUnsetComdat(V: &Value);
1768 pub fn LLVMRustSetModulePIELevel(M: &Module);
1769 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1770 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1771 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1772 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1773 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1775 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1776 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1777 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1778 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1779 pub fn LLVMRustCreateThinLTOData(
1780 Modules: *const ThinLTOModule,
1782 PreservedSymbols: *const *const c_char,
1783 PreservedSymbolsLen: c_uint,
1784 ) -> Option<&'static mut ThinLTOData>;
1785 pub fn LLVMRustPrepareThinLTORename(
1789 pub fn LLVMRustPrepareThinLTOResolveWeak(
1793 pub fn LLVMRustPrepareThinLTOInternalize(
1797 pub fn LLVMRustPrepareThinLTOImport(
1801 pub fn LLVMRustGetThinLTOModuleImports(
1802 Data: *const ThinLTOData,
1803 ModuleNameCallback: ThinLTOModuleNameCallback,
1804 CallbackPayload: *mut c_void,
1806 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1807 pub fn LLVMRustParseBitcodeForThinLTO(
1811 Identifier: *const c_char,
1812 ) -> Option<&Module>;
1813 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1814 CU1: &mut *mut c_void,
1815 CU2: &mut *mut c_void);
1816 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1818 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1819 pub fn LLVMRustLinkerAdd(linker: &Linker,
1820 bytecode: *const c_char,
1821 bytecode_len: usize) -> bool;
1822 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);