1 #![allow(non_camel_case_types)]
2 #![allow(non_upper_case_globals)]
4 use super::debuginfo
::{
5 DIArray
, DIBasicType
, DIBuilder
, DICompositeType
, DIDerivedType
, DIDescriptor
, DIEnumerator
,
6 DIFile
, DIFlags
, DIGlobalVariableExpression
, DILexicalBlock
, DINameSpace
, DISPFlags
, DIScope
,
7 DISubprogram
, DISubrange
, DITemplateTypeParameter
, DIType
, DIVariable
, DebugEmissionKind
,
10 use libc
::{c_char, c_int, c_uint, size_t}
;
11 use libc
::{c_ulonglong, c_void}
;
13 use std
::marker
::PhantomData
;
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,
56 AvailableExternallyLinkage
= 1,
57 LinkOnceAnyLinkage
= 2,
58 LinkOnceODRLinkage
= 3,
64 ExternalWeakLinkage
= 9,
78 pub enum UnnamedAddr
{
84 /// LLVMDLLStorageClass
85 #[derive(Copy, Clone)]
87 pub enum DLLStorageClass
{
90 DllImport
= 1, // Function to be imported from DLL.
92 DllExport
= 2, // Function to be accessible from DLL.
95 /// Matches LLVMRustAttribute in rustllvm.h
96 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
97 /// though it is not ABI compatible (since it's a C++ enum)
99 #[derive(Copy, Clone, Debug)]
114 OptimizeForSize
= 13,
122 SanitizeAddress
= 21,
130 #[derive(Copy, Clone)]
132 pub enum IntPredicate
{
146 pub fn from_generic(intpre
: rustc_codegen_ssa
::common
::IntPredicate
) -> Self {
148 rustc_codegen_ssa
::common
::IntPredicate
::IntEQ
=> IntPredicate
::IntEQ
,
149 rustc_codegen_ssa
::common
::IntPredicate
::IntNE
=> IntPredicate
::IntNE
,
150 rustc_codegen_ssa
::common
::IntPredicate
::IntUGT
=> IntPredicate
::IntUGT
,
151 rustc_codegen_ssa
::common
::IntPredicate
::IntUGE
=> IntPredicate
::IntUGE
,
152 rustc_codegen_ssa
::common
::IntPredicate
::IntULT
=> IntPredicate
::IntULT
,
153 rustc_codegen_ssa
::common
::IntPredicate
::IntULE
=> IntPredicate
::IntULE
,
154 rustc_codegen_ssa
::common
::IntPredicate
::IntSGT
=> IntPredicate
::IntSGT
,
155 rustc_codegen_ssa
::common
::IntPredicate
::IntSGE
=> IntPredicate
::IntSGE
,
156 rustc_codegen_ssa
::common
::IntPredicate
::IntSLT
=> IntPredicate
::IntSLT
,
157 rustc_codegen_ssa
::common
::IntPredicate
::IntSLE
=> IntPredicate
::IntSLE
,
162 /// LLVMRealPredicate
163 #[derive(Copy, Clone)]
165 pub enum RealPredicate
{
166 RealPredicateFalse
= 0,
181 RealPredicateTrue
= 15,
185 pub fn from_generic(realpred
: rustc_codegen_ssa
::common
::RealPredicate
) -> Self {
187 rustc_codegen_ssa
::common
::RealPredicate
::RealPredicateFalse
=> {
188 RealPredicate
::RealPredicateFalse
190 rustc_codegen_ssa
::common
::RealPredicate
::RealOEQ
=> RealPredicate
::RealOEQ
,
191 rustc_codegen_ssa
::common
::RealPredicate
::RealOGT
=> RealPredicate
::RealOGT
,
192 rustc_codegen_ssa
::common
::RealPredicate
::RealOGE
=> RealPredicate
::RealOGE
,
193 rustc_codegen_ssa
::common
::RealPredicate
::RealOLT
=> RealPredicate
::RealOLT
,
194 rustc_codegen_ssa
::common
::RealPredicate
::RealOLE
=> RealPredicate
::RealOLE
,
195 rustc_codegen_ssa
::common
::RealPredicate
::RealONE
=> RealPredicate
::RealONE
,
196 rustc_codegen_ssa
::common
::RealPredicate
::RealORD
=> RealPredicate
::RealORD
,
197 rustc_codegen_ssa
::common
::RealPredicate
::RealUNO
=> RealPredicate
::RealUNO
,
198 rustc_codegen_ssa
::common
::RealPredicate
::RealUEQ
=> RealPredicate
::RealUEQ
,
199 rustc_codegen_ssa
::common
::RealPredicate
::RealUGT
=> RealPredicate
::RealUGT
,
200 rustc_codegen_ssa
::common
::RealPredicate
::RealUGE
=> RealPredicate
::RealUGE
,
201 rustc_codegen_ssa
::common
::RealPredicate
::RealULT
=> RealPredicate
::RealULT
,
202 rustc_codegen_ssa
::common
::RealPredicate
::RealULE
=> RealPredicate
::RealULE
,
203 rustc_codegen_ssa
::common
::RealPredicate
::RealUNE
=> RealPredicate
::RealUNE
,
204 rustc_codegen_ssa
::common
::RealPredicate
::RealPredicateTrue
=> {
205 RealPredicate
::RealPredicateTrue
212 #[derive(Copy, Clone, PartialEq, Debug)]
235 pub fn to_generic(self) -> rustc_codegen_ssa
::common
::TypeKind
{
237 TypeKind
::Void
=> rustc_codegen_ssa
::common
::TypeKind
::Void
,
238 TypeKind
::Half
=> rustc_codegen_ssa
::common
::TypeKind
::Half
,
239 TypeKind
::Float
=> rustc_codegen_ssa
::common
::TypeKind
::Float
,
240 TypeKind
::Double
=> rustc_codegen_ssa
::common
::TypeKind
::Double
,
241 TypeKind
::X86_FP80
=> rustc_codegen_ssa
::common
::TypeKind
::X86_FP80
,
242 TypeKind
::FP128
=> rustc_codegen_ssa
::common
::TypeKind
::FP128
,
243 TypeKind
::PPC_FP128
=> rustc_codegen_ssa
::common
::TypeKind
::PPC_FP128
,
244 TypeKind
::Label
=> rustc_codegen_ssa
::common
::TypeKind
::Label
,
245 TypeKind
::Integer
=> rustc_codegen_ssa
::common
::TypeKind
::Integer
,
246 TypeKind
::Function
=> rustc_codegen_ssa
::common
::TypeKind
::Function
,
247 TypeKind
::Struct
=> rustc_codegen_ssa
::common
::TypeKind
::Struct
,
248 TypeKind
::Array
=> rustc_codegen_ssa
::common
::TypeKind
::Array
,
249 TypeKind
::Pointer
=> rustc_codegen_ssa
::common
::TypeKind
::Pointer
,
250 TypeKind
::Vector
=> rustc_codegen_ssa
::common
::TypeKind
::Vector
,
251 TypeKind
::Metadata
=> rustc_codegen_ssa
::common
::TypeKind
::Metadata
,
252 TypeKind
::X86_MMX
=> rustc_codegen_ssa
::common
::TypeKind
::X86_MMX
,
253 TypeKind
::Token
=> rustc_codegen_ssa
::common
::TypeKind
::Token
,
258 /// LLVMAtomicRmwBinOp
259 #[derive(Copy, Clone)]
261 pub enum AtomicRmwBinOp
{
275 impl AtomicRmwBinOp
{
276 pub fn from_generic(op
: rustc_codegen_ssa
::common
::AtomicRmwBinOp
) -> Self {
278 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicXchg
=> AtomicRmwBinOp
::AtomicXchg
,
279 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicAdd
=> AtomicRmwBinOp
::AtomicAdd
,
280 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicSub
=> AtomicRmwBinOp
::AtomicSub
,
281 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicAnd
=> AtomicRmwBinOp
::AtomicAnd
,
282 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicNand
=> AtomicRmwBinOp
::AtomicNand
,
283 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicOr
=> AtomicRmwBinOp
::AtomicOr
,
284 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicXor
=> AtomicRmwBinOp
::AtomicXor
,
285 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicMax
=> AtomicRmwBinOp
::AtomicMax
,
286 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicMin
=> AtomicRmwBinOp
::AtomicMin
,
287 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicUMax
=> AtomicRmwBinOp
::AtomicUMax
,
288 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicUMin
=> AtomicRmwBinOp
::AtomicUMin
,
293 /// LLVMAtomicOrdering
294 #[derive(Copy, Clone)]
296 pub enum AtomicOrdering
{
301 // Consume = 3, // Not specified yet.
305 SequentiallyConsistent
= 7,
308 impl AtomicOrdering
{
309 pub fn from_generic(ao
: rustc_codegen_ssa
::common
::AtomicOrdering
) -> Self {
311 rustc_codegen_ssa
::common
::AtomicOrdering
::NotAtomic
=> AtomicOrdering
::NotAtomic
,
312 rustc_codegen_ssa
::common
::AtomicOrdering
::Unordered
=> AtomicOrdering
::Unordered
,
313 rustc_codegen_ssa
::common
::AtomicOrdering
::Monotonic
=> AtomicOrdering
::Monotonic
,
314 rustc_codegen_ssa
::common
::AtomicOrdering
::Acquire
=> AtomicOrdering
::Acquire
,
315 rustc_codegen_ssa
::common
::AtomicOrdering
::Release
=> AtomicOrdering
::Release
,
316 rustc_codegen_ssa
::common
::AtomicOrdering
::AcquireRelease
=> {
317 AtomicOrdering
::AcquireRelease
319 rustc_codegen_ssa
::common
::AtomicOrdering
::SequentiallyConsistent
=> {
320 AtomicOrdering
::SequentiallyConsistent
326 /// LLVMRustSynchronizationScope
327 #[derive(Copy, Clone)]
329 pub enum SynchronizationScope
{
330 // FIXME: figure out if this variant is needed at all.
337 impl SynchronizationScope
{
338 pub fn from_generic(sc
: rustc_codegen_ssa
::common
::SynchronizationScope
) -> Self {
340 rustc_codegen_ssa
::common
::SynchronizationScope
::Other
=> SynchronizationScope
::Other
,
341 rustc_codegen_ssa
::common
::SynchronizationScope
::SingleThread
=> {
342 SynchronizationScope
::SingleThread
344 rustc_codegen_ssa
::common
::SynchronizationScope
::CrossThread
=> {
345 SynchronizationScope
::CrossThread
352 #[derive(Copy, Clone)]
355 // FIXME: figure out if this variant is needed at all.
363 #[derive(Copy, Clone)]
365 pub enum MetadataType
{
372 MD_invariant_load
= 6,
376 MD_mem_parallel_loop_access
= 10,
380 /// LLVMRustAsmDialect
381 #[derive(Copy, Clone)]
383 pub enum AsmDialect
{
384 // FIXME: figure out if this variant is needed at all.
392 pub fn from_generic(asm
: rustc_ast
::ast
::LlvmAsmDialect
) -> Self {
394 rustc_ast
::ast
::LlvmAsmDialect
::Att
=> AsmDialect
::Att
,
395 rustc_ast
::ast
::LlvmAsmDialect
::Intel
=> AsmDialect
::Intel
,
400 /// LLVMRustCodeGenOptLevel
401 #[derive(Copy, Clone, PartialEq)]
403 pub enum CodeGenOptLevel
{
404 // FIXME: figure out if this variant is needed at all.
413 /// LLVMRustPassBuilderOptLevel
415 pub enum PassBuilderOptLevel
{
435 /// LLVMRustSanitizerOptions
437 pub struct SanitizerOptions
{
438 pub sanitize_memory
: bool
,
439 pub sanitize_thread
: bool
,
440 pub sanitize_address
: bool
,
441 pub sanitize_recover
: bool
,
442 pub sanitize_memory_track_origins
: c_int
,
446 #[derive(Copy, Clone, PartialEq)]
458 /// LLVMRustCodeModel
459 #[derive(Copy, Clone)]
462 // FIXME: figure out if this variant is needed at all.
472 /// LLVMRustDiagnosticKind
473 #[derive(Copy, Clone)]
475 #[allow(dead_code)] // Variants constructed by C++.
476 pub enum DiagnosticKind
{
480 DebugMetadataVersion
,
483 OptimizationRemarkMissed
,
484 OptimizationRemarkAnalysis
,
485 OptimizationRemarkAnalysisFPCommute
,
486 OptimizationRemarkAnalysisAliasing
,
487 OptimizationRemarkOther
,
493 /// LLVMRustArchiveKind
494 #[derive(Copy, Clone)]
496 pub enum ArchiveKind
{
497 // FIXME: figure out if this variant is needed at all.
507 #[derive(Copy, Clone, PartialEq, Debug)]
509 #[allow(dead_code)] // Variants constructed by C++.
516 /// LLVMRustThinLTOData
518 pub type ThinLTOData
;
521 /// LLVMRustThinLTOBuffer
523 pub type ThinLTOBuffer
;
526 // LLVMRustModuleNameCallback
527 pub type ThinLTOModuleNameCallback
=
528 unsafe extern "C" fn(*mut c_void
, *const c_char
, *const c_char
);
530 /// LLVMRustThinLTOModule
532 pub struct ThinLTOModule
{
533 pub identifier
: *const c_char
,
538 /// LLVMThreadLocalMode
539 #[derive(Copy, Clone)]
541 pub enum ThreadLocalMode
{
549 /// LLVMRustChecksumKind
550 #[derive(Copy, Clone)]
552 pub enum ChecksumKind
{
562 struct InvariantOpaque
<'a
> {
563 _marker
: PhantomData
<&'a
mut &'
a ()>,
567 // Opaque pointer types
581 pub type ConstantInt
;
590 pub struct Builder
<'a
>(InvariantOpaque
<'a
>);
592 pub type MemoryBuffer
;
595 pub struct PassManager
<'a
>(InvariantOpaque
<'a
>);
597 pub type PassManagerBuilder
;
603 pub struct SectionIterator
<'a
>(InvariantOpaque
<'a
>);
608 pub type TargetMachine
;
614 pub struct ArchiveIterator
<'a
>(InvariantOpaque
<'a
>);
616 pub struct ArchiveChild
<'a
>(InvariantOpaque
<'a
>);
621 pub type DiagnosticInfo
;
624 pub type SMDiagnostic
;
627 pub struct RustArchiveMember
<'a
>(InvariantOpaque
<'a
>);
629 pub struct OperandBundleDef
<'a
>(InvariantOpaque
<'a
>);
631 pub struct Linker
<'a
>(InvariantOpaque
<'a
>);
633 pub type DiagnosticHandler
= unsafe extern "C" fn(&DiagnosticInfo
, *mut c_void
);
634 pub type InlineAsmDiagHandler
= unsafe extern "C" fn(&SMDiagnostic
, *const c_void
, c_uint
);
637 use super::{InvariantOpaque, Metadata}
;
638 use bitflags
::bitflags
;
641 pub struct DIBuilder
<'a
>(InvariantOpaque
<'a
>);
643 pub type DIDescriptor
= Metadata
;
644 pub type DIScope
= DIDescriptor
;
645 pub type DIFile
= DIScope
;
646 pub type DILexicalBlock
= DIScope
;
647 pub type DISubprogram
= DIScope
;
648 pub type DINameSpace
= DIScope
;
649 pub type DIType
= DIDescriptor
;
650 pub type DIBasicType
= DIType
;
651 pub type DIDerivedType
= DIType
;
652 pub type DICompositeType
= DIDerivedType
;
653 pub type DIVariable
= DIDescriptor
;
654 pub type DIGlobalVariableExpression
= DIDescriptor
;
655 pub type DIArray
= DIDescriptor
;
656 pub type DISubrange
= DIDescriptor
;
657 pub type DIEnumerator
= DIDescriptor
;
658 pub type DITemplateTypeParameter
= DIDescriptor
;
660 // These values **must** match with LLVMRustDIFlags!!
664 pub struct DIFlags
: u32 {
666 const FlagPrivate
= 1;
667 const FlagProtected
= 2;
668 const FlagPublic
= 3;
669 const FlagFwdDecl
= (1 << 2);
670 const FlagAppleBlock
= (1 << 3);
671 const FlagBlockByrefStruct
= (1 << 4);
672 const FlagVirtual
= (1 << 5);
673 const FlagArtificial
= (1 << 6);
674 const FlagExplicit
= (1 << 7);
675 const FlagPrototyped
= (1 << 8);
676 const FlagObjcClassComplete
= (1 << 9);
677 const FlagObjectPointer
= (1 << 10);
678 const FlagVector
= (1 << 11);
679 const FlagStaticMember
= (1 << 12);
680 const FlagLValueReference
= (1 << 13);
681 const FlagRValueReference
= (1 << 14);
682 const FlagExternalTypeRef
= (1 << 15);
683 const FlagIntroducedVirtual
= (1 << 18);
684 const FlagBitField
= (1 << 19);
685 const FlagNoReturn
= (1 << 20);
689 // These values **must** match with LLVMRustDISPFlags!!
693 pub struct DISPFlags
: u32 {
694 const SPFlagZero
= 0;
695 const SPFlagVirtual
= 1;
696 const SPFlagPureVirtual
= 2;
697 const SPFlagLocalToUnit
= (1 << 2);
698 const SPFlagDefinition
= (1 << 3);
699 const SPFlagOptimized
= (1 << 4);
700 const SPFlagMainSubprogram
= (1 << 5);
704 /// LLVMRustDebugEmissionKind
705 #[derive(Copy, Clone)]
707 pub enum DebugEmissionKind
{
713 impl DebugEmissionKind
{
714 pub fn from_generic(kind
: rustc_session
::config
::DebugInfo
) -> Self {
715 use rustc_session
::config
::DebugInfo
;
717 DebugInfo
::None
=> DebugEmissionKind
::NoDebug
,
718 DebugInfo
::Limited
=> DebugEmissionKind
::LineTablesOnly
,
719 DebugInfo
::Full
=> DebugEmissionKind
::FullDebug
,
726 pub type ModuleBuffer
;
729 pub type SelfProfileBeforePassCallback
=
730 unsafe extern "C" fn(*mut c_void
, *const c_char
, *const c_char
);
731 pub type SelfProfileAfterPassCallback
= unsafe extern "C" fn(*mut c_void
);
734 pub fn LLVMRustInstallFatalErrorHandler();
736 // Create and destroy contexts.
737 pub fn LLVMRustContextCreate(shouldDiscardNames
: bool
) -> &'
static mut Context
;
738 pub fn LLVMContextDispose(C
: &'
static mut Context
);
739 pub fn LLVMGetMDKindIDInContext(C
: &Context
, Name
: *const c_char
, SLen
: c_uint
) -> c_uint
;
742 pub fn LLVMModuleCreateWithNameInContext(ModuleID
: *const c_char
, C
: &Context
) -> &Module
;
743 pub fn LLVMGetModuleContext(M
: &Module
) -> &Context
;
744 pub fn LLVMCloneModule(M
: &Module
) -> &Module
;
746 /// Data layout. See Module::getDataLayout.
747 pub fn LLVMGetDataLayoutStr(M
: &Module
) -> *const c_char
;
748 pub fn LLVMSetDataLayout(M
: &Module
, Triple
: *const c_char
);
750 /// See Module::setModuleInlineAsm.
751 pub fn LLVMSetModuleInlineAsm2(M
: &Module
, Asm
: *const c_char
, AsmLen
: size_t
);
752 pub fn LLVMRustAppendModuleInlineAsm(M
: &Module
, Asm
: *const c_char
, AsmLen
: size_t
);
754 /// See llvm::LLVMTypeKind::getTypeID.
755 pub fn LLVMRustGetTypeKind(Ty
: &Type
) -> TypeKind
;
757 // Operations on integer types
758 pub fn LLVMInt1TypeInContext(C
: &Context
) -> &Type
;
759 pub fn LLVMInt8TypeInContext(C
: &Context
) -> &Type
;
760 pub fn LLVMInt16TypeInContext(C
: &Context
) -> &Type
;
761 pub fn LLVMInt32TypeInContext(C
: &Context
) -> &Type
;
762 pub fn LLVMInt64TypeInContext(C
: &Context
) -> &Type
;
763 pub fn LLVMIntTypeInContext(C
: &Context
, NumBits
: c_uint
) -> &Type
;
765 pub fn LLVMGetIntTypeWidth(IntegerTy
: &Type
) -> c_uint
;
767 // Operations on real types
768 pub fn LLVMFloatTypeInContext(C
: &Context
) -> &Type
;
769 pub fn LLVMDoubleTypeInContext(C
: &Context
) -> &Type
;
771 // Operations on function types
772 pub fn LLVMFunctionType(
773 ReturnType
: &'a Type
,
774 ParamTypes
: *const &'a Type
,
778 pub fn LLVMCountParamTypes(FunctionTy
: &Type
) -> c_uint
;
779 pub fn LLVMGetParamTypes(FunctionTy
: &'a Type
, Dest
: *mut &'a Type
);
781 // Operations on struct types
782 pub fn LLVMStructTypeInContext(
784 ElementTypes
: *const &'a Type
,
785 ElementCount
: c_uint
,
789 // Operations on array, pointer, and vector types (sequence types)
790 pub fn LLVMRustArrayType(ElementType
: &Type
, ElementCount
: u64) -> &Type
;
791 pub fn LLVMPointerType(ElementType
: &Type
, AddressSpace
: c_uint
) -> &Type
;
792 pub fn LLVMVectorType(ElementType
: &Type
, ElementCount
: c_uint
) -> &Type
;
794 pub fn LLVMGetElementType(Ty
: &Type
) -> &Type
;
795 pub fn LLVMGetVectorSize(VectorTy
: &Type
) -> c_uint
;
797 // Operations on other types
798 pub fn LLVMVoidTypeInContext(C
: &Context
) -> &Type
;
799 pub fn LLVMX86MMXTypeInContext(C
: &Context
) -> &Type
;
800 pub fn LLVMRustMetadataTypeInContext(C
: &Context
) -> &Type
;
802 // Operations on all values
803 pub fn LLVMTypeOf(Val
: &Value
) -> &Type
;
804 pub fn LLVMGetValueName2(Val
: &Value
, Length
: *mut size_t
) -> *const c_char
;
805 pub fn LLVMSetValueName2(Val
: &Value
, Name
: *const c_char
, NameLen
: size_t
);
806 pub fn LLVMReplaceAllUsesWith(OldVal
: &'a Value
, NewVal
: &'a Value
);
807 pub fn LLVMSetMetadata(Val
: &'a Value
, KindID
: c_uint
, Node
: &'a Value
);
809 // Operations on constants of any type
810 pub fn LLVMConstNull(Ty
: &Type
) -> &Value
;
811 pub fn LLVMGetUndef(Ty
: &Type
) -> &Value
;
813 // Operations on metadata
814 pub fn LLVMMDStringInContext(C
: &Context
, Str
: *const c_char
, SLen
: c_uint
) -> &Value
;
815 pub fn LLVMMDNodeInContext(C
: &'a Context
, Vals
: *const &'a Value
, Count
: c_uint
) -> &'a Value
;
816 pub fn LLVMAddNamedMetadataOperand(M
: &'a Module
, Name
: *const c_char
, Val
: &'a Value
);
818 // Operations on scalar constants
819 pub fn LLVMConstInt(IntTy
: &Type
, N
: c_ulonglong
, SignExtend
: Bool
) -> &Value
;
820 pub fn LLVMConstIntOfArbitraryPrecision(IntTy
: &Type
, Wn
: c_uint
, Ws
: *const u64) -> &Value
;
821 pub fn LLVMConstReal(RealTy
: &Type
, N
: f64) -> &Value
;
822 pub fn LLVMConstIntGetZExtValue(ConstantVal
: &ConstantInt
) -> c_ulonglong
;
823 pub fn LLVMRustConstInt128Get(
824 ConstantVal
: &ConstantInt
,
830 // Operations on composite constants
831 pub fn LLVMConstStringInContext(
835 DontNullTerminate
: Bool
,
837 pub fn LLVMConstStructInContext(
839 ConstantVals
: *const &'a Value
,
844 pub fn LLVMConstArray(
846 ConstantVals
: *const &'a Value
,
849 pub fn LLVMConstVector(ScalarConstantVals
: *const &Value
, Size
: c_uint
) -> &Value
;
851 // Constant expressions
852 pub fn LLVMConstInBoundsGEP(
853 ConstantVal
: &'a Value
,
854 ConstantIndices
: *const &'a Value
,
857 pub fn LLVMConstZExt(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
858 pub fn LLVMConstPtrToInt(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
859 pub fn LLVMConstIntToPtr(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
860 pub fn LLVMConstBitCast(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
861 pub fn LLVMConstPointerCast(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
862 pub fn LLVMConstExtractValue(
864 IdxList
: *const c_uint
,
868 // Operations on global variables, functions, and aliases (globals)
869 pub fn LLVMIsDeclaration(Global
: &Value
) -> Bool
;
870 pub fn LLVMRustGetLinkage(Global
: &Value
) -> Linkage
;
871 pub fn LLVMRustSetLinkage(Global
: &Value
, RustLinkage
: Linkage
);
872 pub fn LLVMSetSection(Global
: &Value
, Section
: *const c_char
);
873 pub fn LLVMRustGetVisibility(Global
: &Value
) -> Visibility
;
874 pub fn LLVMRustSetVisibility(Global
: &Value
, Viz
: Visibility
);
875 pub fn LLVMGetAlignment(Global
: &Value
) -> c_uint
;
876 pub fn LLVMSetAlignment(Global
: &Value
, Bytes
: c_uint
);
877 pub fn LLVMSetDLLStorageClass(V
: &Value
, C
: DLLStorageClass
);
879 // Operations on global variables
880 pub fn LLVMIsAGlobalVariable(GlobalVar
: &Value
) -> Option
<&Value
>;
881 pub fn LLVMAddGlobal(M
: &'a Module
, Ty
: &'a Type
, Name
: *const c_char
) -> &'a Value
;
882 pub fn LLVMGetNamedGlobal(M
: &Module
, Name
: *const c_char
) -> Option
<&Value
>;
883 pub fn LLVMRustGetOrInsertGlobal(
889 pub fn LLVMRustInsertPrivateGlobal(M
: &'a Module
, T
: &'a Type
) -> &'a Value
;
890 pub fn LLVMGetFirstGlobal(M
: &Module
) -> Option
<&Value
>;
891 pub fn LLVMGetNextGlobal(GlobalVar
: &Value
) -> Option
<&Value
>;
892 pub fn LLVMDeleteGlobal(GlobalVar
: &Value
);
893 pub fn LLVMGetInitializer(GlobalVar
: &Value
) -> Option
<&Value
>;
894 pub fn LLVMSetInitializer(GlobalVar
: &'a Value
, ConstantVal
: &'a Value
);
895 pub fn LLVMSetThreadLocal(GlobalVar
: &Value
, IsThreadLocal
: Bool
);
896 pub fn LLVMSetThreadLocalMode(GlobalVar
: &Value
, Mode
: ThreadLocalMode
);
897 pub fn LLVMIsGlobalConstant(GlobalVar
: &Value
) -> Bool
;
898 pub fn LLVMSetGlobalConstant(GlobalVar
: &Value
, IsConstant
: Bool
);
899 pub fn LLVMRustGetNamedValue(
904 pub fn LLVMSetTailCall(CallInst
: &Value
, IsTailCall
: Bool
);
906 // Operations on functions
907 pub fn LLVMRustGetOrInsertFunction(
911 FunctionTy
: &'a Type
,
913 pub fn LLVMSetFunctionCallConv(Fn
: &Value
, CC
: c_uint
);
914 pub fn LLVMRustAddAlignmentAttr(Fn
: &Value
, index
: c_uint
, bytes
: u32);
915 pub fn LLVMRustAddDereferenceableAttr(Fn
: &Value
, index
: c_uint
, bytes
: u64);
916 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn
: &Value
, index
: c_uint
, bytes
: u64);
917 pub fn LLVMRustAddByValAttr(Fn
: &Value
, index
: c_uint
, ty
: &Type
);
918 pub fn LLVMRustAddFunctionAttribute(Fn
: &Value
, index
: c_uint
, attr
: Attribute
);
919 pub fn LLVMRustAddFunctionAttrStringValue(
923 Value
: *const c_char
,
925 pub fn LLVMRustRemoveFunctionAttributes(Fn
: &Value
, index
: c_uint
, attr
: Attribute
);
927 // Operations on parameters
928 pub fn LLVMIsAArgument(Val
: &Value
) -> Option
<&Value
>;
929 pub fn LLVMCountParams(Fn
: &Value
) -> c_uint
;
930 pub fn LLVMGetParam(Fn
: &Value
, Index
: c_uint
) -> &Value
;
932 // Operations on basic blocks
933 pub fn LLVMGetBasicBlockParent(BB
: &BasicBlock
) -> &Value
;
934 pub fn LLVMAppendBasicBlockInContext(
939 pub fn LLVMDeleteBasicBlock(BB
: &BasicBlock
);
941 // Operations on instructions
942 pub fn LLVMIsAInstruction(Val
: &Value
) -> Option
<&Value
>;
943 pub fn LLVMGetFirstBasicBlock(Fn
: &Value
) -> &BasicBlock
;
945 // Operations on call sites
946 pub fn LLVMSetInstructionCallConv(Instr
: &Value
, CC
: c_uint
);
947 pub fn LLVMRustAddCallSiteAttribute(Instr
: &Value
, index
: c_uint
, attr
: Attribute
);
948 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr
: &Value
, index
: c_uint
, bytes
: u32);
949 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr
: &Value
, index
: c_uint
, bytes
: u64);
950 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr
: &Value
, index
: c_uint
, bytes
: u64);
951 pub fn LLVMRustAddByValCallSiteAttr(Instr
: &Value
, index
: c_uint
, ty
: &Type
);
953 // Operations on load/store instructions (only)
954 pub fn LLVMSetVolatile(MemoryAccessInst
: &Value
, volatile
: Bool
);
956 // Operations on phi nodes
957 pub fn LLVMAddIncoming(
959 IncomingValues
: *const &'a Value
,
960 IncomingBlocks
: *const &'a BasicBlock
,
964 // Instruction builders
965 pub fn LLVMCreateBuilderInContext(C
: &'a Context
) -> &'a
mut Builder
<'a
>;
966 pub fn LLVMPositionBuilderAtEnd(Builder
: &Builder
<'a
>, Block
: &'a BasicBlock
);
967 pub fn LLVMGetInsertBlock(Builder
: &Builder
<'a
>) -> &'a BasicBlock
;
968 pub fn LLVMDisposeBuilder(Builder
: &'a
mut Builder
<'a
>);
971 pub fn LLVMSetCurrentDebugLocation(Builder
: &Builder
<'a
>, L
: &'a Value
);
974 pub fn LLVMBuildRetVoid(B
: &Builder
<'a
>) -> &'a Value
;
975 pub fn LLVMBuildRet(B
: &Builder
<'a
>, V
: &'a Value
) -> &'a Value
;
976 pub fn LLVMBuildBr(B
: &Builder
<'a
>, Dest
: &'a BasicBlock
) -> &'a Value
;
977 pub fn LLVMBuildCondBr(
980 Then
: &'a BasicBlock
,
981 Else
: &'a BasicBlock
,
983 pub fn LLVMBuildSwitch(
986 Else
: &'a BasicBlock
,
989 pub fn LLVMRustBuildInvoke(
992 Args
: *const &'a Value
,
994 Then
: &'a BasicBlock
,
995 Catch
: &'a BasicBlock
,
996 Bundle
: Option
<&OperandBundleDef
<'a
>>,
999 pub fn LLVMBuildLandingPad(
1004 Name
: *const c_char
,
1006 pub fn LLVMBuildResume(B
: &Builder
<'a
>, Exn
: &'a Value
) -> &'a Value
;
1007 pub fn LLVMBuildUnreachable(B
: &Builder
<'a
>) -> &'a Value
;
1009 pub fn LLVMRustBuildCleanupPad(
1011 ParentPad
: Option
<&'a Value
>,
1013 Args
: *const &'a Value
,
1014 Name
: *const c_char
,
1015 ) -> Option
<&'a Value
>;
1016 pub fn LLVMRustBuildCleanupRet(
1018 CleanupPad
: &'a Value
,
1019 UnwindBB
: Option
<&'a BasicBlock
>,
1020 ) -> Option
<&'a Value
>;
1021 pub fn LLVMRustBuildCatchPad(
1023 ParentPad
: &'a Value
,
1025 Args
: *const &'a Value
,
1026 Name
: *const c_char
,
1027 ) -> Option
<&'a Value
>;
1028 pub fn LLVMRustBuildCatchRet(
1032 ) -> Option
<&'a Value
>;
1033 pub fn LLVMRustBuildCatchSwitch(
1034 Builder
: &Builder
<'a
>,
1035 ParentPad
: Option
<&'a Value
>,
1036 BB
: Option
<&'a BasicBlock
>,
1037 NumHandlers
: c_uint
,
1038 Name
: *const c_char
,
1039 ) -> Option
<&'a Value
>;
1040 pub fn LLVMRustAddHandler(CatchSwitch
: &'a Value
, Handler
: &'a BasicBlock
);
1041 pub fn LLVMSetPersonalityFn(Func
: &'a Value
, Pers
: &'a Value
);
1043 // Add a case to the switch instruction
1044 pub fn LLVMAddCase(Switch
: &'a Value
, OnVal
: &'a Value
, Dest
: &'a BasicBlock
);
1046 // Add a clause to the landing pad instruction
1047 pub fn LLVMAddClause(LandingPad
: &'a Value
, ClauseVal
: &'a Value
);
1049 // Set the cleanup on a landing pad instruction
1050 pub fn LLVMSetCleanup(LandingPad
: &Value
, Val
: Bool
);
1053 pub fn LLVMBuildAdd(
1057 Name
: *const c_char
,
1059 pub fn LLVMBuildFAdd(
1063 Name
: *const c_char
,
1065 pub fn LLVMBuildSub(
1069 Name
: *const c_char
,
1071 pub fn LLVMBuildFSub(
1075 Name
: *const c_char
,
1077 pub fn LLVMBuildMul(
1081 Name
: *const c_char
,
1083 pub fn LLVMBuildFMul(
1087 Name
: *const c_char
,
1089 pub fn LLVMBuildUDiv(
1093 Name
: *const c_char
,
1095 pub fn LLVMBuildExactUDiv(
1099 Name
: *const c_char
,
1101 pub fn LLVMBuildSDiv(
1105 Name
: *const c_char
,
1107 pub fn LLVMBuildExactSDiv(
1111 Name
: *const c_char
,
1113 pub fn LLVMBuildFDiv(
1117 Name
: *const c_char
,
1119 pub fn LLVMBuildURem(
1123 Name
: *const c_char
,
1125 pub fn LLVMBuildSRem(
1129 Name
: *const c_char
,
1131 pub fn LLVMBuildFRem(
1135 Name
: *const c_char
,
1137 pub fn LLVMBuildShl(
1141 Name
: *const c_char
,
1143 pub fn LLVMBuildLShr(
1147 Name
: *const c_char
,
1149 pub fn LLVMBuildAShr(
1153 Name
: *const c_char
,
1155 pub fn LLVMBuildNSWAdd(
1159 Name
: *const c_char
,
1161 pub fn LLVMBuildNUWAdd(
1165 Name
: *const c_char
,
1167 pub fn LLVMBuildNSWSub(
1171 Name
: *const c_char
,
1173 pub fn LLVMBuildNUWSub(
1177 Name
: *const c_char
,
1179 pub fn LLVMBuildNSWMul(
1183 Name
: *const c_char
,
1185 pub fn LLVMBuildNUWMul(
1189 Name
: *const c_char
,
1191 pub fn LLVMBuildAnd(
1195 Name
: *const c_char
,
1201 Name
: *const c_char
,
1203 pub fn LLVMBuildXor(
1207 Name
: *const c_char
,
1209 pub fn LLVMBuildNeg(B
: &Builder
<'a
>, V
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1210 pub fn LLVMBuildFNeg(B
: &Builder
<'a
>, V
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1211 pub fn LLVMBuildNot(B
: &Builder
<'a
>, V
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1212 pub fn LLVMRustSetHasUnsafeAlgebra(Instr
: &Value
);
1215 pub fn LLVMBuildAlloca(B
: &Builder
<'a
>, Ty
: &'a Type
, Name
: *const c_char
) -> &'a Value
;
1216 pub fn LLVMBuildArrayAlloca(
1220 Name
: *const c_char
,
1222 pub fn LLVMBuildLoad(B
: &Builder
<'a
>, PointerVal
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1224 pub fn LLVMBuildStore(B
: &Builder
<'a
>, Val
: &'a Value
, Ptr
: &'a Value
) -> &'a Value
;
1226 pub fn LLVMBuildGEP(
1229 Indices
: *const &'a Value
,
1231 Name
: *const c_char
,
1233 pub fn LLVMBuildInBoundsGEP(
1236 Indices
: *const &'a Value
,
1238 Name
: *const c_char
,
1240 pub fn LLVMBuildStructGEP(
1244 Name
: *const c_char
,
1248 pub fn LLVMBuildTrunc(
1252 Name
: *const c_char
,
1254 pub fn LLVMBuildZExt(
1258 Name
: *const c_char
,
1260 pub fn LLVMBuildSExt(
1264 Name
: *const c_char
,
1266 pub fn LLVMBuildFPToUI(
1270 Name
: *const c_char
,
1272 pub fn LLVMBuildFPToSI(
1276 Name
: *const c_char
,
1278 pub fn LLVMBuildUIToFP(
1282 Name
: *const c_char
,
1284 pub fn LLVMBuildSIToFP(
1288 Name
: *const c_char
,
1290 pub fn LLVMBuildFPTrunc(
1294 Name
: *const c_char
,
1296 pub fn LLVMBuildFPExt(
1300 Name
: *const c_char
,
1302 pub fn LLVMBuildPtrToInt(
1306 Name
: *const c_char
,
1308 pub fn LLVMBuildIntToPtr(
1312 Name
: *const c_char
,
1314 pub fn LLVMBuildBitCast(
1318 Name
: *const c_char
,
1320 pub fn LLVMBuildPointerCast(
1324 Name
: *const c_char
,
1326 pub fn LLVMRustBuildIntCast(
1334 pub fn LLVMBuildICmp(
1339 Name
: *const c_char
,
1341 pub fn LLVMBuildFCmp(
1346 Name
: *const c_char
,
1349 // Miscellaneous instructions
1350 pub fn LLVMBuildPhi(B
: &Builder
<'a
>, Ty
: &'a Type
, Name
: *const c_char
) -> &'a Value
;
1351 pub fn LLVMRustBuildCall(
1354 Args
: *const &'a Value
,
1356 Bundle
: Option
<&OperandBundleDef
<'a
>>,
1358 pub fn LLVMRustBuildMemCpy(
1367 pub fn LLVMRustBuildMemMove(
1376 pub fn LLVMRustBuildMemSet(
1384 pub fn LLVMBuildSelect(
1389 Name
: *const c_char
,
1391 pub fn LLVMBuildVAArg(
1395 Name
: *const c_char
,
1397 pub fn LLVMBuildExtractElement(
1401 Name
: *const c_char
,
1403 pub fn LLVMBuildInsertElement(
1408 Name
: *const c_char
,
1410 pub fn LLVMBuildShuffleVector(
1415 Name
: *const c_char
,
1417 pub fn LLVMBuildExtractValue(
1421 Name
: *const c_char
,
1423 pub fn LLVMBuildInsertValue(
1428 Name
: *const c_char
,
1431 pub fn LLVMRustBuildVectorReduceFAdd(
1436 pub fn LLVMRustBuildVectorReduceFMul(
1441 pub fn LLVMRustBuildVectorReduceAdd(B
: &Builder
<'a
>, Src
: &'a Value
) -> &'a Value
;
1442 pub fn LLVMRustBuildVectorReduceMul(B
: &Builder
<'a
>, Src
: &'a Value
) -> &'a Value
;
1443 pub fn LLVMRustBuildVectorReduceAnd(B
: &Builder
<'a
>, Src
: &'a Value
) -> &'a Value
;
1444 pub fn LLVMRustBuildVectorReduceOr(B
: &Builder
<'a
>, Src
: &'a Value
) -> &'a Value
;
1445 pub fn LLVMRustBuildVectorReduceXor(B
: &Builder
<'a
>, Src
: &'a Value
) -> &'a Value
;
1446 pub fn LLVMRustBuildVectorReduceMin(
1451 pub fn LLVMRustBuildVectorReduceMax(
1456 pub fn LLVMRustBuildVectorReduceFMin(B
: &Builder
<'a
>, Src
: &'a Value
, IsNaN
: bool
)
1458 pub fn LLVMRustBuildVectorReduceFMax(B
: &Builder
<'a
>, Src
: &'a Value
, IsNaN
: bool
)
1461 pub fn LLVMRustBuildMinNum(B
: &Builder
<'a
>, LHS
: &'a Value
, LHS
: &'a Value
) -> &'a Value
;
1462 pub fn LLVMRustBuildMaxNum(B
: &Builder
<'a
>, LHS
: &'a Value
, LHS
: &'a Value
) -> &'a Value
;
1464 // Atomic Operations
1465 pub fn LLVMRustBuildAtomicLoad(
1467 PointerVal
: &'a Value
,
1468 Name
: *const c_char
,
1469 Order
: AtomicOrdering
,
1472 pub fn LLVMRustBuildAtomicStore(
1476 Order
: AtomicOrdering
,
1479 pub fn LLVMRustBuildAtomicCmpXchg(
1484 Order
: AtomicOrdering
,
1485 FailureOrder
: AtomicOrdering
,
1489 pub fn LLVMBuildAtomicRMW(
1494 Order
: AtomicOrdering
,
1495 SingleThreaded
: Bool
,
1498 pub fn LLVMRustBuildAtomicFence(
1500 Order
: AtomicOrdering
,
1501 Scope
: SynchronizationScope
,
1504 /// Writes a module to the specified path. Returns 0 on success.
1505 pub fn LLVMWriteBitcodeToFile(M
: &Module
, Path
: *const c_char
) -> c_int
;
1507 /// Creates a pass manager.
1508 pub fn LLVMCreatePassManager() -> &'a
mut PassManager
<'a
>;
1510 /// Creates a function-by-function pass manager
1511 pub fn LLVMCreateFunctionPassManagerForModule(M
: &'a Module
) -> &'a
mut PassManager
<'a
>;
1513 /// Disposes a pass manager.
1514 pub fn LLVMDisposePassManager(PM
: &'a
mut PassManager
<'a
>);
1516 /// Runs a pass manager on a module.
1517 pub fn LLVMRunPassManager(PM
: &PassManager
<'a
>, M
: &'a Module
) -> Bool
;
1519 pub fn LLVMInitializePasses();
1521 pub fn LLVMTimeTraceProfilerInitialize();
1523 pub fn LLVMTimeTraceProfilerFinish(FileName
: *const c_char
);
1525 pub fn LLVMAddAnalysisPasses(T
: &'a TargetMachine
, PM
: &PassManager
<'a
>);
1527 pub fn LLVMPassManagerBuilderCreate() -> &'
static mut PassManagerBuilder
;
1528 pub fn LLVMPassManagerBuilderDispose(PMB
: &'
static mut PassManagerBuilder
);
1529 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB
: &PassManagerBuilder
, Value
: Bool
);
1530 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB
: &PassManagerBuilder
, Value
: Bool
);
1531 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1532 PMB
: &PassManagerBuilder
,
1535 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1536 PMB
: &PassManagerBuilder
,
1537 PM
: &PassManager
<'_
>,
1540 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1541 PMB
: &PassManagerBuilder
,
1542 PM
: &PassManager
<'_
>,
1544 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1545 PMB
: &PassManagerBuilder
,
1546 PM
: &PassManager
<'_
>,
1550 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1551 PMB
: &PassManagerBuilder
,
1552 PM
: &PassManager
<'_
>,
1555 // Stuff that's in rustllvm/ because it's not upstream yet.
1557 /// Opens an object file.
1558 pub fn LLVMCreateObjectFile(
1559 MemBuf
: &'
static mut MemoryBuffer
,
1560 ) -> Option
<&'
static mut ObjectFile
>;
1561 /// Closes an object file.
1562 pub fn LLVMDisposeObjectFile(ObjFile
: &'
static mut ObjectFile
);
1564 /// Enumerates the sections in an object file.
1565 pub fn LLVMGetSections(ObjFile
: &'a ObjectFile
) -> &'a
mut SectionIterator
<'a
>;
1566 /// Destroys a section iterator.
1567 pub fn LLVMDisposeSectionIterator(SI
: &'a
mut SectionIterator
<'a
>);
1568 /// Returns `true` if the section iterator is at the end of the section
1570 pub fn LLVMIsSectionIteratorAtEnd(ObjFile
: &'a ObjectFile
, SI
: &SectionIterator
<'a
>) -> Bool
;
1571 /// Moves the section iterator to point to the next section.
1572 pub fn LLVMMoveToNextSection(SI
: &SectionIterator
<'_
>);
1573 /// Returns the current section size.
1574 pub fn LLVMGetSectionSize(SI
: &SectionIterator
<'_
>) -> c_ulonglong
;
1575 /// Returns the current section contents as a string buffer.
1576 pub fn LLVMGetSectionContents(SI
: &SectionIterator
<'_
>) -> *const c_char
;
1578 /// Reads the given file and returns it as a memory buffer. Use
1579 /// LLVMDisposeMemoryBuffer() to get rid of it.
1580 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1581 Path
: *const c_char
,
1582 ) -> Option
<&'
static mut MemoryBuffer
>;
1584 pub fn LLVMStartMultithreaded() -> Bool
;
1586 /// Returns a string describing the last error caused by an LLVMRust* call.
1587 pub fn LLVMRustGetLastError() -> *const c_char
;
1589 /// Print the pass timings since static dtors aren't picking them up.
1590 pub fn LLVMRustPrintPassTimings();
1592 pub fn LLVMStructCreateNamed(C
: &Context
, Name
: *const c_char
) -> &Type
;
1594 pub fn LLVMStructSetBody(
1596 ElementTypes
: *const &'a Type
,
1597 ElementCount
: c_uint
,
1601 /// Prepares inline assembly.
1602 pub fn LLVMRustInlineAsm(
1604 AsmString
: *const c_char
,
1605 AsmStringLen
: size_t
,
1606 Constraints
: *const c_char
,
1607 ConstraintsLen
: size_t
,
1610 Dialect
: AsmDialect
,
1612 pub fn LLVMRustInlineAsmVerify(
1614 Constraints
: *const c_char
,
1615 ConstraintsLen
: size_t
,
1618 pub fn LLVMRustDebugMetadataVersion() -> u32;
1619 pub fn LLVMRustVersionMajor() -> u32;
1620 pub fn LLVMRustVersionMinor() -> u32;
1622 pub fn LLVMRustAddModuleFlag(M
: &Module
, name
: *const c_char
, value
: u32);
1624 pub fn LLVMRustMetadataAsValue(C
: &'a Context
, MD
: &'a Metadata
) -> &'a Value
;
1626 pub fn LLVMRustDIBuilderCreate(M
: &'a Module
) -> &'a
mut DIBuilder
<'a
>;
1628 pub fn LLVMRustDIBuilderDispose(Builder
: &'a
mut DIBuilder
<'a
>);
1630 pub fn LLVMRustDIBuilderFinalize(Builder
: &DIBuilder
<'_
>);
1632 pub fn LLVMRustDIBuilderCreateCompileUnit(
1633 Builder
: &DIBuilder
<'a
>,
1636 Producer
: *const c_char
,
1637 ProducerLen
: size_t
,
1639 Flags
: *const c_char
,
1641 SplitName
: *const c_char
,
1642 SplitNameLen
: size_t
,
1643 kind
: DebugEmissionKind
,
1644 ) -> &'a DIDescriptor
;
1646 pub fn LLVMRustDIBuilderCreateFile(
1647 Builder
: &DIBuilder
<'a
>,
1648 Filename
: *const c_char
,
1649 FilenameLen
: size_t
,
1650 Directory
: *const c_char
,
1651 DirectoryLen
: size_t
,
1652 CSKind
: ChecksumKind
,
1653 Checksum
: *const c_char
,
1654 ChecksumLen
: size_t
,
1657 pub fn LLVMRustDIBuilderCreateSubroutineType(
1658 Builder
: &DIBuilder
<'a
>,
1660 ParameterTypes
: &'a DIArray
,
1661 ) -> &'a DICompositeType
;
1663 pub fn LLVMRustDIBuilderCreateFunction(
1664 Builder
: &DIBuilder
<'a
>,
1665 Scope
: &'a DIDescriptor
,
1666 Name
: *const c_char
,
1668 LinkageName
: *const c_char
,
1669 LinkageNameLen
: size_t
,
1677 TParam
: &'a DIArray
,
1678 Decl
: Option
<&'a DIDescriptor
>,
1679 ) -> &'a DISubprogram
;
1681 pub fn LLVMRustDIBuilderCreateBasicType(
1682 Builder
: &DIBuilder
<'a
>,
1683 Name
: *const c_char
,
1688 ) -> &'a DIBasicType
;
1690 pub fn LLVMRustDIBuilderCreatePointerType(
1691 Builder
: &DIBuilder
<'a
>,
1692 PointeeTy
: &'a DIType
,
1695 AddressSpace
: c_uint
,
1696 Name
: *const c_char
,
1698 ) -> &'a DIDerivedType
;
1700 pub fn LLVMRustDIBuilderCreateStructType(
1701 Builder
: &DIBuilder
<'a
>,
1702 Scope
: Option
<&'a DIDescriptor
>,
1703 Name
: *const c_char
,
1710 DerivedFrom
: Option
<&'a DIType
>,
1711 Elements
: &'a DIArray
,
1712 RunTimeLang
: c_uint
,
1713 VTableHolder
: Option
<&'a DIType
>,
1714 UniqueId
: *const c_char
,
1715 UniqueIdLen
: size_t
,
1716 ) -> &'a DICompositeType
;
1718 pub fn LLVMRustDIBuilderCreateMemberType(
1719 Builder
: &DIBuilder
<'a
>,
1720 Scope
: &'a DIDescriptor
,
1721 Name
: *const c_char
,
1730 ) -> &'a DIDerivedType
;
1732 pub fn LLVMRustDIBuilderCreateVariantMemberType(
1733 Builder
: &DIBuilder
<'a
>,
1735 Name
: *const c_char
,
1742 Discriminant
: Option
<&'a Value
>,
1747 pub fn LLVMRustDIBuilderCreateLexicalBlock(
1748 Builder
: &DIBuilder
<'a
>,
1753 ) -> &'a DILexicalBlock
;
1755 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(
1756 Builder
: &DIBuilder
<'a
>,
1759 ) -> &'a DILexicalBlock
;
1761 pub fn LLVMRustDIBuilderCreateStaticVariable(
1762 Builder
: &DIBuilder
<'a
>,
1763 Context
: Option
<&'a DIScope
>,
1764 Name
: *const c_char
,
1766 LinkageName
: *const c_char
,
1767 LinkageNameLen
: size_t
,
1771 isLocalToUnit
: bool
,
1773 Decl
: Option
<&'a DIDescriptor
>,
1775 ) -> &'a DIGlobalVariableExpression
;
1777 pub fn LLVMRustDIBuilderCreateVariable(
1778 Builder
: &DIBuilder
<'a
>,
1780 Scope
: &'a DIDescriptor
,
1781 Name
: *const c_char
,
1786 AlwaysPreserve
: bool
,
1790 ) -> &'a DIVariable
;
1792 pub fn LLVMRustDIBuilderCreateArrayType(
1793 Builder
: &DIBuilder
<'a
>,
1797 Subscripts
: &'a DIArray
,
1800 pub fn LLVMRustDIBuilderGetOrCreateSubrange(
1801 Builder
: &DIBuilder
<'a
>,
1804 ) -> &'a DISubrange
;
1806 pub fn LLVMRustDIBuilderGetOrCreateArray(
1807 Builder
: &DIBuilder
<'a
>,
1808 Ptr
: *const Option
<&'a DIDescriptor
>,
1812 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(
1813 Builder
: &DIBuilder
<'a
>,
1815 VarInfo
: &'a DIVariable
,
1816 AddrOps
: *const i64,
1817 AddrOpsCount
: c_uint
,
1819 InsertAtEnd
: &'a BasicBlock
,
1822 pub fn LLVMRustDIBuilderCreateEnumerator(
1823 Builder
: &DIBuilder
<'a
>,
1824 Name
: *const c_char
,
1828 ) -> &'a DIEnumerator
;
1830 pub fn LLVMRustDIBuilderCreateEnumerationType(
1831 Builder
: &DIBuilder
<'a
>,
1833 Name
: *const c_char
,
1839 Elements
: &'a DIArray
,
1840 ClassType
: &'a DIType
,
1844 pub fn LLVMRustDIBuilderCreateUnionType(
1845 Builder
: &DIBuilder
<'a
>,
1847 Name
: *const c_char
,
1854 Elements
: Option
<&'a DIArray
>,
1855 RunTimeLang
: c_uint
,
1856 UniqueId
: *const c_char
,
1857 UniqueIdLen
: size_t
,
1860 pub fn LLVMRustDIBuilderCreateVariantPart(
1861 Builder
: &DIBuilder
<'a
>,
1863 Name
: *const c_char
,
1870 Discriminator
: Option
<&'a DIDerivedType
>,
1871 Elements
: &'a DIArray
,
1872 UniqueId
: *const c_char
,
1873 UniqueIdLen
: size_t
,
1874 ) -> &'a DIDerivedType
;
1876 pub fn LLVMSetUnnamedAddress(Global
: &Value
, UnnamedAddr
: UnnamedAddr
);
1878 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
1879 Builder
: &DIBuilder
<'a
>,
1880 Scope
: Option
<&'a DIScope
>,
1881 Name
: *const c_char
,
1887 ) -> &'a DITemplateTypeParameter
;
1889 pub fn LLVMRustDIBuilderCreateNameSpace(
1890 Builder
: &DIBuilder
<'a
>,
1891 Scope
: Option
<&'a DIScope
>,
1892 Name
: *const c_char
,
1894 ExportSymbols
: bool
,
1895 ) -> &'a DINameSpace
;
1897 pub fn LLVMRustDICompositeTypeReplaceArrays(
1898 Builder
: &DIBuilder
<'a
>,
1899 CompositeType
: &'a DIType
,
1900 Elements
: Option
<&'a DIArray
>,
1901 Params
: Option
<&'a DIArray
>,
1904 pub fn LLVMRustDIBuilderCreateDebugLocation(
1905 Context
: &'a Context
,
1909 InlinedAt
: Option
<&'a Metadata
>,
1911 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1912 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1914 #[allow(improper_ctypes)]
1915 pub fn LLVMRustWriteTypeToString(Type
: &Type
, s
: &RustString
);
1916 #[allow(improper_ctypes)]
1917 pub fn LLVMRustWriteValueToString(value_ref
: &Value
, s
: &RustString
);
1919 pub fn LLVMIsAConstantInt(value_ref
: &Value
) -> Option
<&ConstantInt
>;
1921 pub fn LLVMRustPassKind(Pass
: &Pass
) -> PassKind
;
1922 pub fn LLVMRustFindAndCreatePass(Pass
: *const c_char
) -> Option
<&'
static mut Pass
>;
1923 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover
: bool
) -> &'
static mut Pass
;
1924 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover
: bool
) -> &'
static mut Pass
;
1925 pub fn LLVMRustCreateMemorySanitizerPass(
1926 TrackOrigins
: c_int
,
1928 ) -> &'
static mut Pass
;
1929 pub fn LLVMRustCreateThreadSanitizerPass() -> &'
static mut Pass
;
1930 pub fn LLVMRustAddPass(PM
: &PassManager
<'_
>, Pass
: &'
static mut Pass
);
1931 pub fn LLVMRustAddLastExtensionPasses(
1932 PMB
: &PassManagerBuilder
,
1933 Passes
: *const &'
static mut Pass
,
1937 pub fn LLVMRustHasFeature(T
: &TargetMachine
, s
: *const c_char
) -> bool
;
1939 pub fn LLVMRustPrintTargetCPUs(T
: &TargetMachine
);
1940 pub fn LLVMRustPrintTargetFeatures(T
: &TargetMachine
);
1942 pub fn LLVMRustGetHostCPUName(len
: *mut usize) -> *const c_char
;
1943 pub fn LLVMRustCreateTargetMachine(
1944 Triple
: *const c_char
,
1946 Features
: *const c_char
,
1950 Level
: CodeGenOptLevel
,
1952 PositionIndependentExecutable
: bool
,
1953 FunctionSections
: bool
,
1955 TrapUnreachable
: bool
,
1958 EmitStackSizeSection
: bool
,
1959 RelaxELFRelocations
: bool
,
1960 ) -> Option
<&'
static mut TargetMachine
>;
1961 pub fn LLVMRustDisposeTargetMachine(T
: &'
static mut TargetMachine
);
1962 pub fn LLVMRustAddBuilderLibraryInfo(
1963 PMB
: &'a PassManagerBuilder
,
1965 DisableSimplifyLibCalls
: bool
,
1967 pub fn LLVMRustConfigurePassManagerBuilder(
1968 PMB
: &PassManagerBuilder
,
1969 OptLevel
: CodeGenOptLevel
,
1970 MergeFunctions
: bool
,
1972 LoopVectorize
: bool
,
1973 PrepareForThinLTO
: bool
,
1974 PGOGenPath
: *const c_char
,
1975 PGOUsePath
: *const c_char
,
1977 pub fn LLVMRustAddLibraryInfo(
1978 PM
: &PassManager
<'a
>,
1980 DisableSimplifyLibCalls
: bool
,
1982 pub fn LLVMRustRunFunctionPassManager(PM
: &PassManager
<'a
>, M
: &'a Module
);
1983 pub fn LLVMRustWriteOutputFile(
1984 T
: &'a TargetMachine
,
1985 PM
: &PassManager
<'a
>,
1987 Output
: *const c_char
,
1989 ) -> LLVMRustResult
;
1990 pub fn LLVMRustOptimizeWithNewPassManager(
1992 TM
: &'a TargetMachine
,
1993 OptLevel
: PassBuilderOptLevel
,
1995 NoPrepopulatePasses
: bool
,
1997 UseThinLTOBuffers
: bool
,
1998 MergeFunctions
: bool
,
2001 LoopVectorize
: bool
,
2002 DisableSimplifyLibCalls
: bool
,
2003 SanitizerOptions
: Option
<&SanitizerOptions
>,
2004 PGOGenPath
: *const c_char
,
2005 PGOUsePath
: *const c_char
,
2006 llvm_selfprofiler
: *mut c_void
,
2007 begin_callback
: SelfProfileBeforePassCallback
,
2008 end_callback
: SelfProfileAfterPassCallback
,
2010 pub fn LLVMRustPrintModule(
2012 Output
: *const c_char
,
2013 Demangle
: extern "C" fn(*const c_char
, size_t
, *mut c_char
, size_t
) -> size_t
,
2014 ) -> LLVMRustResult
;
2015 pub fn LLVMRustSetLLVMOptions(Argc
: c_int
, Argv
: *const *const c_char
);
2016 pub fn LLVMRustPrintPasses();
2017 pub fn LLVMRustGetInstructionCount(M
: &Module
) -> u32;
2018 pub fn LLVMRustSetNormalizedTarget(M
: &Module
, triple
: *const c_char
);
2019 pub fn LLVMRustAddAlwaysInlinePass(P
: &PassManagerBuilder
, AddLifetimes
: bool
);
2020 pub fn LLVMRustRunRestrictionPass(M
: &Module
, syms
: *const *const c_char
, len
: size_t
);
2021 pub fn LLVMRustMarkAllFunctionsNounwind(M
: &Module
);
2023 pub fn LLVMRustOpenArchive(path
: *const c_char
) -> Option
<&'
static mut Archive
>;
2024 pub fn LLVMRustArchiveIteratorNew(AR
: &'a Archive
) -> &'a
mut ArchiveIterator
<'a
>;
2025 pub fn LLVMRustArchiveIteratorNext(
2026 AIR
: &ArchiveIterator
<'a
>,
2027 ) -> Option
<&'a
mut ArchiveChild
<'a
>>;
2028 pub fn LLVMRustArchiveChildName(ACR
: &ArchiveChild
<'_
>, size
: &mut size_t
) -> *const c_char
;
2029 pub fn LLVMRustArchiveChildData(ACR
: &ArchiveChild
<'_
>, size
: &mut size_t
) -> *const c_char
;
2030 pub fn LLVMRustArchiveChildFree(ACR
: &'a
mut ArchiveChild
<'a
>);
2031 pub fn LLVMRustArchiveIteratorFree(AIR
: &'a
mut ArchiveIterator
<'a
>);
2032 pub fn LLVMRustDestroyArchive(AR
: &'
static mut Archive
);
2034 #[allow(improper_ctypes)]
2035 pub fn LLVMRustGetSectionName(
2036 SI
: &SectionIterator
<'_
>,
2037 data
: &mut Option
<std
::ptr
::NonNull
<c_char
>>,
2040 #[allow(improper_ctypes)]
2041 pub fn LLVMRustWriteTwineToString(T
: &Twine
, s
: &RustString
);
2043 pub fn LLVMContextSetDiagnosticHandler(
2045 Handler
: DiagnosticHandler
,
2046 DiagnosticContext
: *mut c_void
,
2049 #[allow(improper_ctypes)]
2050 pub fn LLVMRustUnpackOptimizationDiagnostic(
2051 DI
: &'a DiagnosticInfo
,
2052 pass_name_out
: &RustString
,
2053 function_out
: &mut Option
<&'a Value
>,
2054 loc_line_out
: &mut c_uint
,
2055 loc_column_out
: &mut c_uint
,
2056 loc_filename_out
: &RustString
,
2057 message_out
: &RustString
,
2060 pub fn LLVMRustUnpackInlineAsmDiagnostic(
2061 DI
: &'a DiagnosticInfo
,
2062 cookie_out
: &mut c_uint
,
2063 message_out
: &mut Option
<&'a Twine
>,
2064 instruction_out
: &mut Option
<&'a Value
>,
2067 #[allow(improper_ctypes)]
2068 pub fn LLVMRustWriteDiagnosticInfoToString(DI
: &DiagnosticInfo
, s
: &RustString
);
2069 pub fn LLVMRustGetDiagInfoKind(DI
: &DiagnosticInfo
) -> DiagnosticKind
;
2071 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2073 H
: InlineAsmDiagHandler
,
2077 #[allow(improper_ctypes)]
2078 pub fn LLVMRustWriteSMDiagnosticToString(d
: &SMDiagnostic
, s
: &RustString
);
2080 pub fn LLVMRustWriteArchive(
2083 Members
: *const &RustArchiveMember
<'_
>,
2086 ) -> LLVMRustResult
;
2087 pub fn LLVMRustArchiveMemberNew(
2088 Filename
: *const c_char
,
2089 Name
: *const c_char
,
2090 Child
: Option
<&ArchiveChild
<'a
>>,
2091 ) -> &'a
mut RustArchiveMember
<'a
>;
2092 pub fn LLVMRustArchiveMemberFree(Member
: &'a
mut RustArchiveMember
<'a
>);
2094 pub fn LLVMRustSetDataLayoutFromTargetMachine(M
: &'a Module
, TM
: &'a TargetMachine
);
2096 pub fn LLVMRustBuildOperandBundleDef(
2097 Name
: *const c_char
,
2098 Inputs
: *const &'a Value
,
2100 ) -> &'a
mut OperandBundleDef
<'a
>;
2101 pub fn LLVMRustFreeOperandBundleDef(Bundle
: &'a
mut OperandBundleDef
<'a
>);
2103 pub fn LLVMRustPositionBuilderAtStart(B
: &Builder
<'a
>, BB
: &'a BasicBlock
);
2105 pub fn LLVMRustSetComdat(M
: &'a Module
, V
: &'a Value
, Name
: *const c_char
, NameLen
: size_t
);
2106 pub fn LLVMRustUnsetComdat(V
: &Value
);
2107 pub fn LLVMRustSetModulePICLevel(M
: &Module
);
2108 pub fn LLVMRustSetModulePIELevel(M
: &Module
);
2109 pub fn LLVMRustModuleBufferCreate(M
: &Module
) -> &'
static mut ModuleBuffer
;
2110 pub fn LLVMRustModuleBufferPtr(p
: &ModuleBuffer
) -> *const u8;
2111 pub fn LLVMRustModuleBufferLen(p
: &ModuleBuffer
) -> usize;
2112 pub fn LLVMRustModuleBufferFree(p
: &'
static mut ModuleBuffer
);
2113 pub fn LLVMRustModuleCost(M
: &Module
) -> u64;
2115 pub fn LLVMRustThinLTOBufferCreate(M
: &Module
) -> &'
static mut ThinLTOBuffer
;
2116 pub fn LLVMRustThinLTOBufferFree(M
: &'
static mut ThinLTOBuffer
);
2117 pub fn LLVMRustThinLTOBufferPtr(M
: &ThinLTOBuffer
) -> *const c_char
;
2118 pub fn LLVMRustThinLTOBufferLen(M
: &ThinLTOBuffer
) -> size_t
;
2119 pub fn LLVMRustCreateThinLTOData(
2120 Modules
: *const ThinLTOModule
,
2122 PreservedSymbols
: *const *const c_char
,
2123 PreservedSymbolsLen
: c_uint
,
2124 ) -> Option
<&'
static mut ThinLTOData
>;
2125 pub fn LLVMRustPrepareThinLTORename(Data
: &ThinLTOData
, Module
: &Module
) -> bool
;
2126 pub fn LLVMRustPrepareThinLTOResolveWeak(Data
: &ThinLTOData
, Module
: &Module
) -> bool
;
2127 pub fn LLVMRustPrepareThinLTOInternalize(Data
: &ThinLTOData
, Module
: &Module
) -> bool
;
2128 pub fn LLVMRustPrepareThinLTOImport(Data
: &ThinLTOData
, Module
: &Module
) -> bool
;
2129 pub fn LLVMRustGetThinLTOModuleImports(
2130 Data
: *const ThinLTOData
,
2131 ModuleNameCallback
: ThinLTOModuleNameCallback
,
2132 CallbackPayload
: *mut c_void
,
2134 pub fn LLVMRustFreeThinLTOData(Data
: &'
static mut ThinLTOData
);
2135 pub fn LLVMRustParseBitcodeForLTO(
2139 Identifier
: *const c_char
,
2140 ) -> Option
<&Module
>;
2141 pub fn LLVMRustThinLTOGetDICompileUnit(
2143 CU1
: &mut *mut c_void
,
2144 CU2
: &mut *mut c_void
,
2146 pub fn LLVMRustThinLTOPatchDICompileUnit(M
: &Module
, CU
: *mut c_void
);
2148 pub fn LLVMRustLinkerNew(M
: &'a Module
) -> &'a
mut Linker
<'a
>;
2149 pub fn LLVMRustLinkerAdd(
2150 linker
: &Linker
<'_
>,
2151 bytecode
: *const c_char
,
2152 bytecode_len
: usize,
2154 pub fn LLVMRustLinkerFree(linker
: &'a
mut Linker
<'a
>);