1 #![allow(non_camel_case_types)]
2 #![allow(non_upper_case_globals)]
4 use super::debuginfo::{
5 DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
6 DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
7 DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
8 DINameSpace, DIFlags, DISPFlags, DebugEmissionKind,
11 use libc::{c_uint, c_int, size_t, c_char};
12 use libc::{c_ulonglong, c_void};
14 use std::marker::PhantomData;
16 use super::RustString;
18 pub type Bool = c_uint;
20 pub const True: Bool = 1 as Bool;
21 pub const False: Bool = 0 as Bool;
23 #[derive(Copy, Clone, PartialEq)]
25 #[allow(dead_code)] // Variants constructed by C++.
26 pub enum LLVMRustResult {
30 // Consts for the LLVM CallConv type, pre-cast to usize.
32 /// LLVM CallingConv::ID. Should we wrap this?
33 #[derive(Copy, Clone, PartialEq, Debug)]
39 X86StdcallCallConv = 64,
40 X86FastcallCallConv = 65,
41 ArmAapcsCallConv = 67,
53 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
57 AvailableExternallyLinkage = 1,
58 LinkOnceAnyLinkage = 2,
59 LinkOnceODRLinkage = 3,
65 ExternalWeakLinkage = 9,
70 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
78 /// LLVMDLLStorageClass
79 #[derive(Copy, Clone)]
81 pub enum DLLStorageClass {
84 DllImport = 1, // Function to be imported from DLL.
86 DllExport = 2, // Function to be accessible from DLL.
89 /// Matches LLVMRustAttribute in rustllvm.h
90 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
91 /// though it is not ABI compatible (since it's a C++ enum)
93 #[derive(Copy, Clone, Debug)]
108 OptimizeForSize = 13,
116 SanitizeAddress = 21,
124 #[derive(Copy, Clone)]
126 pub enum IntPredicate {
140 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
142 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
143 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
144 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
145 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
146 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
147 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
148 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
149 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
150 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
151 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
156 /// LLVMRealPredicate
157 #[derive(Copy, Clone)]
159 pub enum RealPredicate {
160 RealPredicateFalse = 0,
175 RealPredicateTrue = 15,
179 pub fn from_generic(realpred: rustc_codegen_ssa::common::RealPredicate) -> Self {
181 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse =>
182 RealPredicate::RealPredicateFalse,
183 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
184 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
185 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
186 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
187 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
188 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
189 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
190 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
191 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
192 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
193 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
194 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
195 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
196 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
197 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue =>
198 RealPredicate::RealPredicateTrue
204 #[derive(Copy, Clone, PartialEq, Debug)]
227 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
229 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
230 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
231 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
232 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
233 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
234 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
235 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
236 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
237 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
238 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
239 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
240 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
241 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
242 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
243 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
244 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
245 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
250 /// LLVMAtomicRmwBinOp
251 #[derive(Copy, Clone)]
253 pub enum AtomicRmwBinOp {
267 impl AtomicRmwBinOp {
268 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
270 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
271 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
272 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
273 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
274 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
275 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
276 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
277 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
278 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
279 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
280 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin
285 /// LLVMAtomicOrdering
286 #[derive(Copy, Clone)]
288 pub enum AtomicOrdering {
293 // Consume = 3, // Not specified yet.
297 SequentiallyConsistent = 7,
300 impl AtomicOrdering {
301 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
303 rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
304 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
305 rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
306 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
307 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
308 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease =>
309 AtomicOrdering::AcquireRelease,
310 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent =>
311 AtomicOrdering::SequentiallyConsistent
317 /// LLVMRustSynchronizationScope
318 #[derive(Copy, Clone)]
320 pub enum SynchronizationScope {
321 // FIXME: figure out if this variant is needed at all.
328 impl SynchronizationScope {
329 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
331 rustc_codegen_ssa::common::SynchronizationScope::Other => SynchronizationScope::Other,
332 rustc_codegen_ssa::common::SynchronizationScope::SingleThread =>
333 SynchronizationScope::SingleThread,
334 rustc_codegen_ssa::common::SynchronizationScope::CrossThread =>
335 SynchronizationScope::CrossThread,
341 #[derive(Copy, Clone)]
344 // FIXME: figure out if this variant is needed at all.
352 #[derive(Copy, Clone)]
354 pub enum MetadataType {
361 MD_invariant_load = 6,
365 MD_mem_parallel_loop_access = 10,
369 /// LLVMRustAsmDialect
370 #[derive(Copy, Clone)]
372 pub enum AsmDialect {
373 // FIXME: figure out if this variant is needed at all.
381 pub fn from_generic(asm: syntax::ast::AsmDialect) -> Self {
383 syntax::ast::AsmDialect::Att => AsmDialect::Att,
384 syntax::ast::AsmDialect::Intel => AsmDialect::Intel
389 /// LLVMRustCodeGenOptLevel
390 #[derive(Copy, Clone, PartialEq)]
392 pub enum CodeGenOptLevel {
393 // FIXME: figure out if this variant is needed at all.
403 #[derive(Copy, Clone, PartialEq)]
415 /// LLVMRustCodeModel
416 #[derive(Copy, Clone)]
419 // FIXME: figure out if this variant is needed at all.
429 /// LLVMRustDiagnosticKind
430 #[derive(Copy, Clone)]
432 #[allow(dead_code)] // Variants constructed by C++.
433 pub enum DiagnosticKind {
437 DebugMetadataVersion,
440 OptimizationRemarkMissed,
441 OptimizationRemarkAnalysis,
442 OptimizationRemarkAnalysisFPCommute,
443 OptimizationRemarkAnalysisAliasing,
444 OptimizationRemarkOther,
450 /// LLVMRustArchiveKind
451 #[derive(Copy, Clone)]
453 pub enum ArchiveKind {
454 // FIXME: figure out if this variant is needed at all.
463 #[derive(Copy, Clone, PartialEq, Debug)]
465 #[allow(dead_code)] // Variants constructed by C++.
472 /// LLVMRustThinLTOData
473 extern { pub type ThinLTOData; }
475 /// LLVMRustThinLTOBuffer
476 extern { pub type ThinLTOBuffer; }
478 // LLVMRustModuleNameCallback
479 pub type ThinLTOModuleNameCallback =
480 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
482 /// LLVMRustThinLTOModule
484 pub struct ThinLTOModule {
485 pub identifier: *const c_char,
490 /// LLVMThreadLocalMode
491 #[derive(Copy, Clone)]
493 pub enum ThreadLocalMode {
501 extern { type Opaque; }
503 struct InvariantOpaque<'a> {
504 _marker: PhantomData<&'a mut &'a ()>,
508 // Opaque pointer types
509 extern { pub type Module; }
510 extern { pub type Context; }
511 extern { pub type Type; }
512 extern { pub type Value; }
513 extern { pub type Metadata; }
514 extern { pub type BasicBlock; }
516 pub struct Builder<'a>(InvariantOpaque<'a>);
517 extern { pub type MemoryBuffer; }
519 pub struct PassManager<'a>(InvariantOpaque<'a>);
520 extern { pub type PassManagerBuilder; }
521 extern { pub type ObjectFile; }
523 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
524 extern { pub type Pass; }
525 extern { pub type TargetMachine; }
526 extern { pub type Archive; }
528 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
530 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
531 extern { pub type Twine; }
532 extern { pub type DiagnosticInfo; }
533 extern { pub type SMDiagnostic; }
535 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
537 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
539 pub struct Linker<'a>(InvariantOpaque<'a>);
541 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
542 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
546 use super::{InvariantOpaque, Metadata};
549 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
551 pub type DIDescriptor = Metadata;
552 pub type DIScope = DIDescriptor;
553 pub type DIFile = DIScope;
554 pub type DILexicalBlock = DIScope;
555 pub type DISubprogram = DIScope;
556 pub type DINameSpace = DIScope;
557 pub type DIType = DIDescriptor;
558 pub type DIBasicType = DIType;
559 pub type DIDerivedType = DIType;
560 pub type DICompositeType = DIDerivedType;
561 pub type DIVariable = DIDescriptor;
562 pub type DIGlobalVariableExpression = DIDescriptor;
563 pub type DIArray = DIDescriptor;
564 pub type DISubrange = DIDescriptor;
565 pub type DIEnumerator = DIDescriptor;
566 pub type DITemplateTypeParameter = DIDescriptor;
568 // These values **must** match with LLVMRustDIFlags!!
572 pub struct DIFlags: u32 {
574 const FlagPrivate = 1;
575 const FlagProtected = 2;
576 const FlagPublic = 3;
577 const FlagFwdDecl = (1 << 2);
578 const FlagAppleBlock = (1 << 3);
579 const FlagBlockByrefStruct = (1 << 4);
580 const FlagVirtual = (1 << 5);
581 const FlagArtificial = (1 << 6);
582 const FlagExplicit = (1 << 7);
583 const FlagPrototyped = (1 << 8);
584 const FlagObjcClassComplete = (1 << 9);
585 const FlagObjectPointer = (1 << 10);
586 const FlagVector = (1 << 11);
587 const FlagStaticMember = (1 << 12);
588 const FlagLValueReference = (1 << 13);
589 const FlagRValueReference = (1 << 14);
590 const FlagExternalTypeRef = (1 << 15);
591 const FlagIntroducedVirtual = (1 << 18);
592 const FlagBitField = (1 << 19);
593 const FlagNoReturn = (1 << 20);
597 // These values **must** match with LLVMRustDISPFlags!!
601 pub struct DISPFlags: u32 {
602 const SPFlagZero = 0;
603 const SPFlagVirtual = 1;
604 const SPFlagPureVirtual = 2;
605 const SPFlagLocalToUnit = (1 << 2);
606 const SPFlagDefinition = (1 << 3);
607 const SPFlagOptimized = (1 << 4);
608 const SPFlagMainSubprogram = (1 << 5);
612 /// LLVMRustDebugEmissionKind
613 #[derive(Copy, Clone)]
615 pub enum DebugEmissionKind {
621 impl DebugEmissionKind {
622 pub fn from_generic(kind: rustc::session::config::DebugInfo) -> Self {
623 use rustc::session::config::DebugInfo;
625 DebugInfo::None => DebugEmissionKind::NoDebug,
626 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
627 DebugInfo::Full => DebugEmissionKind::FullDebug,
633 extern { pub type ModuleBuffer; }
636 pub fn LLVMRustInstallFatalErrorHandler();
638 // Create and destroy contexts.
639 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
640 pub fn LLVMContextDispose(C: &'static mut Context);
641 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
644 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
645 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
646 pub fn LLVMCloneModule(M: &Module) -> &Module;
648 /// Data layout. See Module::getDataLayout.
649 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
650 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
652 /// See Module::setModuleInlineAsm.
653 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
654 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
656 /// See llvm::LLVMTypeKind::getTypeID.
657 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
659 // Operations on integer types
660 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
661 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
662 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
663 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
664 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
665 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
667 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
669 // Operations on real types
670 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
671 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
673 // Operations on function types
674 pub fn LLVMFunctionType(ReturnType: &'a Type,
675 ParamTypes: *const &'a Type,
679 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
680 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
682 // Operations on struct types
683 pub fn LLVMStructTypeInContext(C: &'a Context,
684 ElementTypes: *const &'a Type,
685 ElementCount: c_uint,
689 // Operations on array, pointer, and vector types (sequence types)
690 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
691 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
692 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
694 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
695 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
697 // Operations on other types
698 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
699 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
700 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
702 // Operations on all values
703 pub fn LLVMTypeOf(Val: &Value) -> &Type;
704 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
705 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
706 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
707 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
709 // Operations on constants of any type
710 pub fn LLVMConstNull(Ty: &Type) -> &Value;
711 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
713 // Operations on metadata
714 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
715 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
716 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
718 // Operations on scalar constants
719 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
720 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
721 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
722 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
723 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
724 high: &mut u64, low: &mut u64) -> bool;
727 // Operations on composite constants
728 pub fn LLVMConstStringInContext(C: &Context,
731 DontNullTerminate: Bool)
733 pub fn LLVMConstStructInContext(C: &'a Context,
734 ConstantVals: *const &'a Value,
739 pub fn LLVMConstArray(ElementTy: &'a Type,
740 ConstantVals: *const &'a Value,
743 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
745 // Constant expressions
746 pub fn LLVMConstInBoundsGEP(
747 ConstantVal: &'a Value,
748 ConstantIndices: *const &'a Value,
751 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
752 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
753 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
754 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
755 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
756 pub fn LLVMConstExtractValue(AggConstant: &Value,
757 IdxList: *const c_uint,
761 // Operations on global variables, functions, and aliases (globals)
762 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
763 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
764 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
765 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
766 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
767 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
768 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
769 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
770 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
773 // Operations on global variables
774 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
775 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
776 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
777 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
778 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
779 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
780 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
781 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
782 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
783 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
784 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
785 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
786 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
787 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
788 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
789 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
791 // Operations on functions
792 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
794 FunctionTy: &'a Type)
796 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
797 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
798 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
799 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
800 pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type);
801 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
802 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
805 Value: *const c_char);
806 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
808 // Operations on parameters
809 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
810 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
811 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
813 // Operations on basic blocks
814 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
815 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
819 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
821 // Operations on instructions
822 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
823 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
825 // Operations on call sites
826 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
827 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
828 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
829 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
830 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
833 pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type);
835 // Operations on load/store instructions (only)
836 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
838 // Operations on phi nodes
839 pub fn LLVMAddIncoming(PhiNode: &'a Value,
840 IncomingValues: *const &'a Value,
841 IncomingBlocks: *const &'a BasicBlock,
844 // Instruction builders
845 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
846 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
847 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
848 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
851 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
852 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
853 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
856 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
857 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
858 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
859 pub fn LLVMBuildCondBr(B: &Builder<'a>,
861 Then: &'a BasicBlock,
862 Else: &'a BasicBlock)
864 pub fn LLVMBuildSwitch(B: &Builder<'a>,
866 Else: &'a BasicBlock,
869 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
871 Args: *const &'a Value,
873 Then: &'a BasicBlock,
874 Catch: &'a BasicBlock,
875 Bundle: Option<&OperandBundleDef<'a>>,
878 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
884 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
885 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
887 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
888 ParentPad: Option<&'a Value>,
890 Args: *const &'a Value,
892 -> Option<&'a Value>;
893 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
894 CleanupPad: &'a Value,
895 UnwindBB: Option<&'a BasicBlock>)
896 -> Option<&'a Value>;
897 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
898 ParentPad: &'a Value,
900 Args: *const &'a Value,
902 -> Option<&'a Value>;
903 pub fn LLVMRustBuildCatchRet(
907 ) -> Option<&'a Value>;
908 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
909 ParentPad: Option<&'a Value>,
910 BB: Option<&'a BasicBlock>,
913 -> Option<&'a Value>;
914 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
915 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
917 // Add a case to the switch instruction
918 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
920 // Add a clause to the landing pad instruction
921 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
923 // Set the cleanup on a landing pad instruction
924 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
927 pub fn LLVMBuildAdd(B: &Builder<'a>,
932 pub fn LLVMBuildFAdd(B: &Builder<'a>,
937 pub fn LLVMBuildSub(B: &Builder<'a>,
942 pub fn LLVMBuildFSub(B: &Builder<'a>,
947 pub fn LLVMBuildMul(B: &Builder<'a>,
952 pub fn LLVMBuildFMul(B: &Builder<'a>,
957 pub fn LLVMBuildUDiv(B: &Builder<'a>,
962 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
967 pub fn LLVMBuildSDiv(B: &Builder<'a>,
972 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
977 pub fn LLVMBuildFDiv(B: &Builder<'a>,
982 pub fn LLVMBuildURem(B: &Builder<'a>,
987 pub fn LLVMBuildSRem(B: &Builder<'a>,
992 pub fn LLVMBuildFRem(B: &Builder<'a>,
997 pub fn LLVMBuildShl(B: &Builder<'a>,
1000 Name: *const c_char)
1002 pub fn LLVMBuildLShr(B: &Builder<'a>,
1005 Name: *const c_char)
1007 pub fn LLVMBuildAShr(B: &Builder<'a>,
1010 Name: *const c_char)
1012 pub fn LLVMBuildNSWAdd(B: &Builder<'a>,
1015 Name: *const c_char)
1017 pub fn LLVMBuildNUWAdd(B: &Builder<'a>,
1020 Name: *const c_char)
1022 pub fn LLVMBuildNSWSub(B: &Builder<'a>,
1025 Name: *const c_char)
1027 pub fn LLVMBuildNUWSub(B: &Builder<'a>,
1030 Name: *const c_char)
1032 pub fn LLVMBuildNSWMul(B: &Builder<'a>,
1035 Name: *const c_char)
1037 pub fn LLVMBuildNUWMul(B: &Builder<'a>,
1040 Name: *const c_char)
1042 pub fn LLVMBuildAnd(B: &Builder<'a>,
1045 Name: *const c_char)
1047 pub fn LLVMBuildOr(B: &Builder<'a>,
1050 Name: *const c_char)
1052 pub fn LLVMBuildXor(B: &Builder<'a>,
1055 Name: *const c_char)
1057 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1058 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1059 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1060 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
1063 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1064 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
1067 Name: *const c_char)
1069 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
1071 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1073 pub fn LLVMBuildGEP(B: &Builder<'a>,
1075 Indices: *const &'a Value,
1077 Name: *const c_char)
1079 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
1081 Indices: *const &'a Value,
1083 Name: *const c_char)
1085 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
1088 Name: *const c_char)
1092 pub fn LLVMBuildTrunc(B: &Builder<'a>,
1095 Name: *const c_char)
1097 pub fn LLVMBuildZExt(B: &Builder<'a>,
1100 Name: *const c_char)
1102 pub fn LLVMBuildSExt(B: &Builder<'a>,
1105 Name: *const c_char)
1107 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
1110 Name: *const c_char)
1112 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
1115 Name: *const c_char)
1117 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
1120 Name: *const c_char)
1122 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
1125 Name: *const c_char)
1127 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
1130 Name: *const c_char)
1132 pub fn LLVMBuildFPExt(B: &Builder<'a>,
1135 Name: *const c_char)
1137 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
1140 Name: *const c_char)
1142 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
1145 Name: *const c_char)
1147 pub fn LLVMBuildBitCast(B: &Builder<'a>,
1150 Name: *const c_char)
1152 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
1155 Name: *const c_char)
1157 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
1164 pub fn LLVMBuildICmp(B: &Builder<'a>,
1168 Name: *const c_char)
1170 pub fn LLVMBuildFCmp(B: &Builder<'a>,
1174 Name: *const c_char)
1177 // Miscellaneous instructions
1178 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1179 pub fn LLVMRustBuildCall(B: &Builder<'a>,
1181 Args: *const &'a Value,
1183 Bundle: Option<&OperandBundleDef<'a>>,
1184 Name: *const c_char)
1186 pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
1194 pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
1202 pub fn LLVMBuildSelect(B: &Builder<'a>,
1206 Name: *const c_char)
1208 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1211 Name: *const c_char)
1213 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1216 Name: *const c_char)
1218 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1222 Name: *const c_char)
1224 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1228 Name: *const c_char)
1230 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1233 Name: *const c_char)
1235 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1239 Name: *const c_char)
1242 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1246 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1250 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1253 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1256 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1259 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1262 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1265 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1269 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1273 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1277 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1282 pub fn LLVMRustBuildMinNum(
1287 pub fn LLVMRustBuildMaxNum(
1293 // Atomic Operations
1294 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1295 PointerVal: &'a Value,
1296 Name: *const c_char,
1297 Order: AtomicOrdering)
1300 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1303 Order: AtomicOrdering)
1306 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1310 Order: AtomicOrdering,
1311 FailureOrder: AtomicOrdering,
1315 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1319 Order: AtomicOrdering,
1320 SingleThreaded: Bool)
1323 pub fn LLVMRustBuildAtomicFence(B: &Builder<'_>,
1324 Order: AtomicOrdering,
1325 Scope: SynchronizationScope);
1327 /// Writes a module to the specified path. Returns 0 on success.
1328 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1330 /// Creates a pass manager.
1331 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1333 /// Creates a function-by-function pass manager
1334 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1336 /// Disposes a pass manager.
1337 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1339 /// Runs a pass manager on a module.
1340 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1342 pub fn LLVMInitializePasses();
1344 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1345 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1346 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1347 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1348 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1350 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1351 PM: &PassManager<'_>);
1353 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1354 PM: &PassManager<'_>);
1355 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1356 PM: &PassManager<'_>,
1359 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1360 PMB: &PassManagerBuilder,
1361 PM: &PassManager<'_>);
1363 // Stuff that's in rustllvm/ because it's not upstream yet.
1365 /// Opens an object file.
1366 pub fn LLVMCreateObjectFile(
1367 MemBuf: &'static mut MemoryBuffer,
1368 ) -> Option<&'static mut ObjectFile>;
1369 /// Closes an object file.
1370 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1372 /// Enumerates the sections in an object file.
1373 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1374 /// Destroys a section iterator.
1375 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1376 /// Returns `true` if the section iterator is at the end of the section
1378 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1379 /// Moves the section iterator to point to the next section.
1380 pub fn LLVMMoveToNextSection(SI: &SectionIterator<'_>);
1381 /// Returns the current section size.
1382 pub fn LLVMGetSectionSize(SI: &SectionIterator<'_>) -> c_ulonglong;
1383 /// Returns the current section contents as a string buffer.
1384 pub fn LLVMGetSectionContents(SI: &SectionIterator<'_>) -> *const c_char;
1386 /// Reads the given file and returns it as a memory buffer. Use
1387 /// LLVMDisposeMemoryBuffer() to get rid of it.
1388 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1389 Path: *const c_char,
1390 ) -> Option<&'static mut MemoryBuffer>;
1392 pub fn LLVMStartMultithreaded() -> Bool;
1394 /// Returns a string describing the last error caused by an LLVMRust* call.
1395 pub fn LLVMRustGetLastError() -> *const c_char;
1397 /// Print the pass timings since static dtors aren't picking them up.
1398 pub fn LLVMRustPrintPassTimings();
1400 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1402 pub fn LLVMStructSetBody(StructTy: &'a Type,
1403 ElementTypes: *const &'a Type,
1404 ElementCount: c_uint,
1407 /// Prepares inline assembly.
1408 pub fn LLVMRustInlineAsm(Ty: &Type,
1409 AsmString: *const c_char,
1410 Constraints: *const c_char,
1413 Dialect: AsmDialect)
1415 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1416 Constraints: *const c_char)
1419 pub fn LLVMRustDebugMetadataVersion() -> u32;
1420 pub fn LLVMRustVersionMajor() -> u32;
1421 pub fn LLVMRustVersionMinor() -> u32;
1423 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1425 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1427 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1429 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1431 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1433 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1436 Producer: *const c_char,
1438 Flags: *const c_char,
1440 SplitName: *const c_char,
1441 kind: DebugEmissionKind)
1442 -> &'a DIDescriptor;
1444 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1445 Filename: *const c_char,
1446 Directory: *const c_char)
1449 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1451 ParameterTypes: &'a DIArray)
1452 -> &'a DICompositeType;
1454 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1455 Scope: &'a DIDescriptor,
1456 Name: *const c_char,
1457 LinkageName: *const c_char,
1465 TParam: &'a DIArray,
1466 Decl: Option<&'a DIDescriptor>)
1467 -> &'a DISubprogram;
1469 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1470 Name: *const c_char,
1476 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1477 PointeeTy: &'a DIType,
1480 Name: *const c_char)
1481 -> &'a DIDerivedType;
1483 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1484 Scope: Option<&'a DIDescriptor>,
1485 Name: *const c_char,
1491 DerivedFrom: Option<&'a DIType>,
1492 Elements: &'a DIArray,
1493 RunTimeLang: c_uint,
1494 VTableHolder: Option<&'a DIType>,
1495 UniqueId: *const c_char)
1496 -> &'a DICompositeType;
1498 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1499 Scope: &'a DIDescriptor,
1500 Name: *const c_char,
1508 -> &'a DIDerivedType;
1510 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1512 Name: *const c_char,
1518 Discriminant: Option<&'a Value>,
1523 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1528 -> &'a DILexicalBlock;
1530 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1533 -> &'a DILexicalBlock;
1535 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1536 Context: Option<&'a DIScope>,
1537 Name: *const c_char,
1538 LinkageName: *const c_char,
1542 isLocalToUnit: bool,
1544 Decl: Option<&'a DIDescriptor>,
1546 -> &'a DIGlobalVariableExpression;
1548 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1550 Scope: &'a DIDescriptor,
1551 Name: *const c_char,
1555 AlwaysPreserve: bool,
1561 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1565 Subscripts: &'a DIArray)
1568 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1573 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1574 Ptr: *const Option<&'a DIDescriptor>,
1578 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1580 VarInfo: &'a DIVariable,
1581 AddrOps: *const i64,
1582 AddrOpsCount: c_uint,
1584 InsertAtEnd: &'a BasicBlock)
1587 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1588 Name: *const c_char,
1590 -> &'a DIEnumerator;
1592 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1594 Name: *const c_char,
1599 Elements: &'a DIArray,
1600 ClassType: &'a DIType,
1604 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1606 Name: *const c_char,
1612 Elements: Option<&'a DIArray>,
1613 RunTimeLang: c_uint,
1614 UniqueId: *const c_char)
1617 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1619 Name: *const c_char,
1625 Discriminator: Option<&'a DIDerivedType>,
1626 Elements: &'a DIArray,
1627 UniqueId: *const c_char)
1628 -> &'a DIDerivedType;
1630 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1632 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1633 Scope: Option<&'a DIScope>,
1634 Name: *const c_char,
1639 -> &'a DITemplateTypeParameter;
1642 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1643 Scope: Option<&'a DIScope>,
1644 Name: *const c_char,
1649 pub fn LLVMRustDICompositeTypeReplaceArrays(Builder: &DIBuilder<'a>,
1650 CompositeType: &'a DIType,
1651 Elements: Option<&'a DIArray>,
1652 Params: Option<&'a DIArray>);
1655 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1659 InlinedAt: Option<&'a Metadata>)
1661 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1662 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1664 #[allow(improper_ctypes)]
1665 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1666 #[allow(improper_ctypes)]
1667 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1669 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1671 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1672 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1673 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
1674 pub fn LLVMRustAddLastExtensionPasses(PMB: &PassManagerBuilder,
1675 Passes: *const &'static mut Pass,
1678 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1680 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1681 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1683 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1684 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1686 Features: *const c_char,
1689 Level: CodeGenOptLevel,
1691 PositionIndependentExecutable: bool,
1692 FunctionSections: bool,
1694 TrapUnreachable: bool,
1697 EmitStackSizeSection: bool)
1698 -> Option<&'static mut TargetMachine>;
1699 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1700 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1701 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1703 DisableSimplifyLibCalls: bool);
1704 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1705 OptLevel: CodeGenOptLevel,
1706 MergeFunctions: bool,
1708 LoopVectorize: bool,
1709 PrepareForThinLTO: bool,
1710 PGOGenPath: *const c_char,
1711 PGOUsePath: *const c_char);
1712 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1714 DisableSimplifyLibCalls: bool);
1715 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1716 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1717 PM: &PassManager<'a>,
1719 Output: *const c_char,
1722 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1724 Output: *const c_char,
1725 Demangle: extern fn(*const c_char,
1729 ) -> LLVMRustResult;
1730 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1731 pub fn LLVMRustPrintPasses();
1732 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1733 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1734 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1735 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1737 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1738 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1739 pub fn LLVMRustArchiveIteratorNext(
1740 AIR: &ArchiveIterator<'a>,
1741 ) -> Option<&'a mut ArchiveChild<'a>>;
1742 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
1743 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
1744 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1745 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1746 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1748 #[allow(improper_ctypes)]
1749 pub fn LLVMRustGetSectionName(SI: &SectionIterator<'_>,
1750 data: &mut Option<std::ptr::NonNull<c_char>>) -> size_t;
1752 #[allow(improper_ctypes)]
1753 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1755 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1756 Handler: DiagnosticHandler,
1757 DiagnosticContext: *mut c_void);
1759 #[allow(improper_ctypes)]
1760 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1761 pass_name_out: &RustString,
1762 function_out: &mut Option<&'a Value>,
1763 loc_line_out: &mut c_uint,
1764 loc_column_out: &mut c_uint,
1765 loc_filename_out: &RustString,
1766 message_out: &RustString);
1768 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1769 cookie_out: &mut c_uint,
1770 message_out: &mut Option<&'a Twine>,
1771 instruction_out: &mut Option<&'a Value>);
1773 #[allow(improper_ctypes)]
1774 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1775 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1777 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1778 H: InlineAsmDiagHandler,
1781 #[allow(improper_ctypes)]
1782 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1784 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1786 Members: *const &RustArchiveMember<'_>,
1790 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1791 Name: *const c_char,
1792 Child: Option<&ArchiveChild<'a>>)
1793 -> &'a mut RustArchiveMember<'a>;
1794 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1796 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1798 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1799 Inputs: *const &'a Value,
1801 -> &'a mut OperandBundleDef<'a>;
1802 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1804 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1806 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1807 pub fn LLVMRustUnsetComdat(V: &Value);
1808 pub fn LLVMRustSetModulePIELevel(M: &Module);
1809 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1810 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1811 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1812 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1813 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1815 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1816 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1817 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1818 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1819 pub fn LLVMRustCreateThinLTOData(
1820 Modules: *const ThinLTOModule,
1822 PreservedSymbols: *const *const c_char,
1823 PreservedSymbolsLen: c_uint,
1824 ) -> Option<&'static mut ThinLTOData>;
1825 pub fn LLVMRustPrepareThinLTORename(
1829 pub fn LLVMRustPrepareThinLTOResolveWeak(
1833 pub fn LLVMRustPrepareThinLTOInternalize(
1837 pub fn LLVMRustPrepareThinLTOImport(
1841 pub fn LLVMRustGetThinLTOModuleImports(
1842 Data: *const ThinLTOData,
1843 ModuleNameCallback: ThinLTOModuleNameCallback,
1844 CallbackPayload: *mut c_void,
1846 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1847 pub fn LLVMRustParseBitcodeForLTO(
1851 Identifier: *const c_char,
1852 ) -> Option<&Module>;
1853 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1854 CU1: &mut *mut c_void,
1855 CU2: &mut *mut c_void);
1856 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1858 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1859 pub fn LLVMRustLinkerAdd(linker: &Linker<'_>,
1860 bytecode: *const c_char,
1861 bytecode_len: usize) -> bool;
1862 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);