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,
57 AvailableExternallyLinkage
= 1,
58 LinkOnceAnyLinkage
= 2,
59 LinkOnceODRLinkage
= 3,
65 ExternalWeakLinkage
= 9,
77 /// LLVMDLLStorageClass
78 #[derive(Copy, Clone)]
80 pub enum DLLStorageClass
{
83 DllImport
= 1, // Function to be imported from DLL.
85 DllExport
= 2, // Function to be accessible from DLL.
88 /// Matches LLVMRustAttribute in rustllvm.h
89 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
90 /// though it is not ABI compatible (since it's a C++ enum)
92 #[derive(Copy, Clone, Debug)]
107 OptimizeForSize
= 13,
115 SanitizeAddress
= 21,
123 #[derive(Copy, Clone)]
125 pub enum IntPredicate
{
139 pub fn from_generic(intpre
: rustc_codegen_ssa
::common
::IntPredicate
) -> Self {
141 rustc_codegen_ssa
::common
::IntPredicate
::IntEQ
=> IntPredicate
::IntEQ
,
142 rustc_codegen_ssa
::common
::IntPredicate
::IntNE
=> IntPredicate
::IntNE
,
143 rustc_codegen_ssa
::common
::IntPredicate
::IntUGT
=> IntPredicate
::IntUGT
,
144 rustc_codegen_ssa
::common
::IntPredicate
::IntUGE
=> IntPredicate
::IntUGE
,
145 rustc_codegen_ssa
::common
::IntPredicate
::IntULT
=> IntPredicate
::IntULT
,
146 rustc_codegen_ssa
::common
::IntPredicate
::IntULE
=> IntPredicate
::IntULE
,
147 rustc_codegen_ssa
::common
::IntPredicate
::IntSGT
=> IntPredicate
::IntSGT
,
148 rustc_codegen_ssa
::common
::IntPredicate
::IntSGE
=> IntPredicate
::IntSGE
,
149 rustc_codegen_ssa
::common
::IntPredicate
::IntSLT
=> IntPredicate
::IntSLT
,
150 rustc_codegen_ssa
::common
::IntPredicate
::IntSLE
=> IntPredicate
::IntSLE
,
155 /// LLVMRealPredicate
156 #[derive(Copy, Clone)]
158 pub enum RealPredicate
{
159 RealPredicateFalse
= 0,
174 RealPredicateTrue
= 15,
178 pub fn from_generic(realpred
: rustc_codegen_ssa
::common
::RealPredicate
) -> Self {
180 rustc_codegen_ssa
::common
::RealPredicate
::RealPredicateFalse
=>
181 RealPredicate
::RealPredicateFalse
,
182 rustc_codegen_ssa
::common
::RealPredicate
::RealOEQ
=> RealPredicate
::RealOEQ
,
183 rustc_codegen_ssa
::common
::RealPredicate
::RealOGT
=> RealPredicate
::RealOGT
,
184 rustc_codegen_ssa
::common
::RealPredicate
::RealOGE
=> RealPredicate
::RealOGE
,
185 rustc_codegen_ssa
::common
::RealPredicate
::RealOLT
=> RealPredicate
::RealOLT
,
186 rustc_codegen_ssa
::common
::RealPredicate
::RealOLE
=> RealPredicate
::RealOLE
,
187 rustc_codegen_ssa
::common
::RealPredicate
::RealONE
=> RealPredicate
::RealONE
,
188 rustc_codegen_ssa
::common
::RealPredicate
::RealORD
=> RealPredicate
::RealORD
,
189 rustc_codegen_ssa
::common
::RealPredicate
::RealUNO
=> RealPredicate
::RealUNO
,
190 rustc_codegen_ssa
::common
::RealPredicate
::RealUEQ
=> RealPredicate
::RealUEQ
,
191 rustc_codegen_ssa
::common
::RealPredicate
::RealUGT
=> RealPredicate
::RealUGT
,
192 rustc_codegen_ssa
::common
::RealPredicate
::RealUGE
=> RealPredicate
::RealUGE
,
193 rustc_codegen_ssa
::common
::RealPredicate
::RealULT
=> RealPredicate
::RealULT
,
194 rustc_codegen_ssa
::common
::RealPredicate
::RealULE
=> RealPredicate
::RealULE
,
195 rustc_codegen_ssa
::common
::RealPredicate
::RealUNE
=> RealPredicate
::RealUNE
,
196 rustc_codegen_ssa
::common
::RealPredicate
::RealPredicateTrue
=>
197 RealPredicate
::RealPredicateTrue
203 #[derive(Copy, Clone, PartialEq, Debug)]
226 pub fn to_generic(self) -> rustc_codegen_ssa
::common
::TypeKind
{
228 TypeKind
::Void
=> rustc_codegen_ssa
::common
::TypeKind
::Void
,
229 TypeKind
::Half
=> rustc_codegen_ssa
::common
::TypeKind
::Half
,
230 TypeKind
::Float
=> rustc_codegen_ssa
::common
::TypeKind
::Float
,
231 TypeKind
::Double
=> rustc_codegen_ssa
::common
::TypeKind
::Double
,
232 TypeKind
::X86_FP80
=> rustc_codegen_ssa
::common
::TypeKind
::X86_FP80
,
233 TypeKind
::FP128
=> rustc_codegen_ssa
::common
::TypeKind
::FP128
,
234 TypeKind
::PPC_FP128
=> rustc_codegen_ssa
::common
::TypeKind
::PPC_FP128
,
235 TypeKind
::Label
=> rustc_codegen_ssa
::common
::TypeKind
::Label
,
236 TypeKind
::Integer
=> rustc_codegen_ssa
::common
::TypeKind
::Integer
,
237 TypeKind
::Function
=> rustc_codegen_ssa
::common
::TypeKind
::Function
,
238 TypeKind
::Struct
=> rustc_codegen_ssa
::common
::TypeKind
::Struct
,
239 TypeKind
::Array
=> rustc_codegen_ssa
::common
::TypeKind
::Array
,
240 TypeKind
::Pointer
=> rustc_codegen_ssa
::common
::TypeKind
::Pointer
,
241 TypeKind
::Vector
=> rustc_codegen_ssa
::common
::TypeKind
::Vector
,
242 TypeKind
::Metadata
=> rustc_codegen_ssa
::common
::TypeKind
::Metadata
,
243 TypeKind
::X86_MMX
=> rustc_codegen_ssa
::common
::TypeKind
::X86_MMX
,
244 TypeKind
::Token
=> rustc_codegen_ssa
::common
::TypeKind
::Token
,
249 /// LLVMAtomicRmwBinOp
250 #[derive(Copy, Clone)]
252 pub enum AtomicRmwBinOp
{
266 impl AtomicRmwBinOp
{
267 pub fn from_generic(op
: rustc_codegen_ssa
::common
::AtomicRmwBinOp
) -> Self {
269 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicXchg
=> AtomicRmwBinOp
::AtomicXchg
,
270 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicAdd
=> AtomicRmwBinOp
::AtomicAdd
,
271 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicSub
=> AtomicRmwBinOp
::AtomicSub
,
272 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicAnd
=> AtomicRmwBinOp
::AtomicAnd
,
273 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicNand
=> AtomicRmwBinOp
::AtomicNand
,
274 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicOr
=> AtomicRmwBinOp
::AtomicOr
,
275 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicXor
=> AtomicRmwBinOp
::AtomicXor
,
276 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicMax
=> AtomicRmwBinOp
::AtomicMax
,
277 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicMin
=> AtomicRmwBinOp
::AtomicMin
,
278 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicUMax
=> AtomicRmwBinOp
::AtomicUMax
,
279 rustc_codegen_ssa
::common
::AtomicRmwBinOp
::AtomicUMin
=> AtomicRmwBinOp
::AtomicUMin
284 /// LLVMAtomicOrdering
285 #[derive(Copy, Clone)]
287 pub enum AtomicOrdering
{
292 // Consume = 3, // Not specified yet.
296 SequentiallyConsistent
= 7,
299 impl AtomicOrdering
{
300 pub fn from_generic(ao
: rustc_codegen_ssa
::common
::AtomicOrdering
) -> Self {
302 rustc_codegen_ssa
::common
::AtomicOrdering
::NotAtomic
=> AtomicOrdering
::NotAtomic
,
303 rustc_codegen_ssa
::common
::AtomicOrdering
::Unordered
=> AtomicOrdering
::Unordered
,
304 rustc_codegen_ssa
::common
::AtomicOrdering
::Monotonic
=> AtomicOrdering
::Monotonic
,
305 rustc_codegen_ssa
::common
::AtomicOrdering
::Acquire
=> AtomicOrdering
::Acquire
,
306 rustc_codegen_ssa
::common
::AtomicOrdering
::Release
=> AtomicOrdering
::Release
,
307 rustc_codegen_ssa
::common
::AtomicOrdering
::AcquireRelease
=>
308 AtomicOrdering
::AcquireRelease
,
309 rustc_codegen_ssa
::common
::AtomicOrdering
::SequentiallyConsistent
=>
310 AtomicOrdering
::SequentiallyConsistent
316 /// LLVMRustSynchronizationScope
317 #[derive(Copy, Clone)]
319 pub enum SynchronizationScope
{
320 // FIXME: figure out if this variant is needed at all.
327 impl SynchronizationScope
{
328 pub fn from_generic(sc
: rustc_codegen_ssa
::common
::SynchronizationScope
) -> Self {
330 rustc_codegen_ssa
::common
::SynchronizationScope
::Other
=> SynchronizationScope
::Other
,
331 rustc_codegen_ssa
::common
::SynchronizationScope
::SingleThread
=>
332 SynchronizationScope
::SingleThread
,
333 rustc_codegen_ssa
::common
::SynchronizationScope
::CrossThread
=>
334 SynchronizationScope
::CrossThread
,
340 #[derive(Copy, Clone)]
343 // FIXME: figure out if this variant is needed at all.
351 #[derive(Copy, Clone)]
353 pub enum MetadataType
{
360 MD_invariant_load
= 6,
364 MD_mem_parallel_loop_access
= 10,
368 /// LLVMRustAsmDialect
369 #[derive(Copy, Clone)]
371 pub enum AsmDialect
{
372 // FIXME: figure out if this variant is needed at all.
380 pub fn from_generic(asm
: syntax
::ast
::AsmDialect
) -> Self {
382 syntax
::ast
::AsmDialect
::Att
=> AsmDialect
::Att
,
383 syntax
::ast
::AsmDialect
::Intel
=> AsmDialect
::Intel
388 /// LLVMRustCodeGenOptLevel
389 #[derive(Copy, Clone, PartialEq)]
391 pub enum CodeGenOptLevel
{
392 // FIXME: figure out if this variant is needed at all.
402 #[derive(Copy, Clone, PartialEq)]
414 /// LLVMRustCodeModel
415 #[derive(Copy, Clone)]
418 // FIXME: figure out if this variant is needed at all.
428 /// LLVMRustDiagnosticKind
429 #[derive(Copy, Clone)]
431 #[allow(dead_code)] // Variants constructed by C++.
432 pub enum DiagnosticKind
{
436 DebugMetadataVersion
,
439 OptimizationRemarkMissed
,
440 OptimizationRemarkAnalysis
,
441 OptimizationRemarkAnalysisFPCommute
,
442 OptimizationRemarkAnalysisAliasing
,
443 OptimizationRemarkOther
,
449 /// LLVMRustArchiveKind
450 #[derive(Copy, Clone)]
452 pub enum ArchiveKind
{
453 // FIXME: figure out if this variant is needed at all.
462 #[derive(Copy, Clone, PartialEq, Debug)]
464 #[allow(dead_code)] // Variants constructed by C++.
471 /// LLVMRustThinLTOData
472 extern { pub type ThinLTOData; }
474 /// LLVMRustThinLTOBuffer
475 extern { pub type ThinLTOBuffer; }
477 // LLVMRustModuleNameCallback
478 pub type ThinLTOModuleNameCallback
=
479 unsafe extern "C" fn(*mut c_void
, *const c_char
, *const c_char
);
481 /// LLVMRustThinLTOModule
483 pub struct ThinLTOModule
{
484 pub identifier
: *const c_char
,
489 /// LLVMThreadLocalMode
490 #[derive(Copy, Clone)]
492 pub enum ThreadLocalMode
{
500 extern { type Opaque; }
502 struct InvariantOpaque
<'a
> {
503 _marker
: PhantomData
<&'a
mut &'
a ()>,
507 // Opaque pointer types
508 extern { pub type Module; }
509 extern { pub type Context; }
510 extern { pub type Type; }
511 extern { pub type Value; }
512 extern { pub type ConstantInt; }
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}
;
547 use bitflags
::bitflags
;
550 pub struct DIBuilder
<'a
>(InvariantOpaque
<'a
>);
552 pub type DIDescriptor
= Metadata
;
553 pub type DIScope
= DIDescriptor
;
554 pub type DIFile
= DIScope
;
555 pub type DILexicalBlock
= DIScope
;
556 pub type DISubprogram
= DIScope
;
557 pub type DINameSpace
= DIScope
;
558 pub type DIType
= DIDescriptor
;
559 pub type DIBasicType
= DIType
;
560 pub type DIDerivedType
= DIType
;
561 pub type DICompositeType
= DIDerivedType
;
562 pub type DIVariable
= DIDescriptor
;
563 pub type DIGlobalVariableExpression
= DIDescriptor
;
564 pub type DIArray
= DIDescriptor
;
565 pub type DISubrange
= DIDescriptor
;
566 pub type DIEnumerator
= DIDescriptor
;
567 pub type DITemplateTypeParameter
= DIDescriptor
;
569 // These values **must** match with LLVMRustDIFlags!!
573 pub struct DIFlags
: u32 {
575 const FlagPrivate
= 1;
576 const FlagProtected
= 2;
577 const FlagPublic
= 3;
578 const FlagFwdDecl
= (1 << 2);
579 const FlagAppleBlock
= (1 << 3);
580 const FlagBlockByrefStruct
= (1 << 4);
581 const FlagVirtual
= (1 << 5);
582 const FlagArtificial
= (1 << 6);
583 const FlagExplicit
= (1 << 7);
584 const FlagPrototyped
= (1 << 8);
585 const FlagObjcClassComplete
= (1 << 9);
586 const FlagObjectPointer
= (1 << 10);
587 const FlagVector
= (1 << 11);
588 const FlagStaticMember
= (1 << 12);
589 const FlagLValueReference
= (1 << 13);
590 const FlagRValueReference
= (1 << 14);
591 const FlagExternalTypeRef
= (1 << 15);
592 const FlagIntroducedVirtual
= (1 << 18);
593 const FlagBitField
= (1 << 19);
594 const FlagNoReturn
= (1 << 20);
598 // These values **must** match with LLVMRustDISPFlags!!
602 pub struct DISPFlags
: u32 {
603 const SPFlagZero
= 0;
604 const SPFlagVirtual
= 1;
605 const SPFlagPureVirtual
= 2;
606 const SPFlagLocalToUnit
= (1 << 2);
607 const SPFlagDefinition
= (1 << 3);
608 const SPFlagOptimized
= (1 << 4);
609 const SPFlagMainSubprogram
= (1 << 5);
613 /// LLVMRustDebugEmissionKind
614 #[derive(Copy, Clone)]
616 pub enum DebugEmissionKind
{
622 impl DebugEmissionKind
{
623 pub fn from_generic(kind
: rustc
::session
::config
::DebugInfo
) -> Self {
624 use rustc
::session
::config
::DebugInfo
;
626 DebugInfo
::None
=> DebugEmissionKind
::NoDebug
,
627 DebugInfo
::Limited
=> DebugEmissionKind
::LineTablesOnly
,
628 DebugInfo
::Full
=> DebugEmissionKind
::FullDebug
,
634 extern { pub type ModuleBuffer; }
637 pub fn LLVMRustInstallFatalErrorHandler();
639 // Create and destroy contexts.
640 pub fn LLVMRustContextCreate(shouldDiscardNames
: bool
) -> &'
static mut Context
;
641 pub fn LLVMContextDispose(C
: &'
static mut Context
);
642 pub fn LLVMGetMDKindIDInContext(C
: &Context
, Name
: *const c_char
, SLen
: c_uint
) -> c_uint
;
645 pub fn LLVMModuleCreateWithNameInContext(ModuleID
: *const c_char
, C
: &Context
) -> &Module
;
646 pub fn LLVMGetModuleContext(M
: &Module
) -> &Context
;
647 pub fn LLVMCloneModule(M
: &Module
) -> &Module
;
649 /// Data layout. See Module::getDataLayout.
650 pub fn LLVMGetDataLayout(M
: &Module
) -> *const c_char
;
651 pub fn LLVMSetDataLayout(M
: &Module
, Triple
: *const c_char
);
653 /// See Module::setModuleInlineAsm.
654 pub fn LLVMSetModuleInlineAsm(M
: &Module
, Asm
: *const c_char
);
655 pub fn LLVMRustAppendModuleInlineAsm(M
: &Module
, Asm
: *const c_char
);
657 /// See llvm::LLVMTypeKind::getTypeID.
658 pub fn LLVMRustGetTypeKind(Ty
: &Type
) -> TypeKind
;
660 // Operations on integer types
661 pub fn LLVMInt1TypeInContext(C
: &Context
) -> &Type
;
662 pub fn LLVMInt8TypeInContext(C
: &Context
) -> &Type
;
663 pub fn LLVMInt16TypeInContext(C
: &Context
) -> &Type
;
664 pub fn LLVMInt32TypeInContext(C
: &Context
) -> &Type
;
665 pub fn LLVMInt64TypeInContext(C
: &Context
) -> &Type
;
666 pub fn LLVMIntTypeInContext(C
: &Context
, NumBits
: c_uint
) -> &Type
;
668 pub fn LLVMGetIntTypeWidth(IntegerTy
: &Type
) -> c_uint
;
670 // Operations on real types
671 pub fn LLVMFloatTypeInContext(C
: &Context
) -> &Type
;
672 pub fn LLVMDoubleTypeInContext(C
: &Context
) -> &Type
;
674 // Operations on function types
675 pub fn LLVMFunctionType(ReturnType
: &'a Type
,
676 ParamTypes
: *const &'a Type
,
680 pub fn LLVMCountParamTypes(FunctionTy
: &Type
) -> c_uint
;
681 pub fn LLVMGetParamTypes(FunctionTy
: &'a Type
, Dest
: *mut &'a Type
);
683 // Operations on struct types
684 pub fn LLVMStructTypeInContext(C
: &'a Context
,
685 ElementTypes
: *const &'a Type
,
686 ElementCount
: c_uint
,
690 // Operations on array, pointer, and vector types (sequence types)
691 pub fn LLVMRustArrayType(ElementType
: &Type
, ElementCount
: u64) -> &Type
;
692 pub fn LLVMPointerType(ElementType
: &Type
, AddressSpace
: c_uint
) -> &Type
;
693 pub fn LLVMVectorType(ElementType
: &Type
, ElementCount
: c_uint
) -> &Type
;
695 pub fn LLVMGetElementType(Ty
: &Type
) -> &Type
;
696 pub fn LLVMGetVectorSize(VectorTy
: &Type
) -> c_uint
;
698 // Operations on other types
699 pub fn LLVMVoidTypeInContext(C
: &Context
) -> &Type
;
700 pub fn LLVMX86MMXTypeInContext(C
: &Context
) -> &Type
;
701 pub fn LLVMRustMetadataTypeInContext(C
: &Context
) -> &Type
;
703 // Operations on all values
704 pub fn LLVMTypeOf(Val
: &Value
) -> &Type
;
705 pub fn LLVMGetValueName2(Val
: &Value
, Length
: *mut size_t
) -> *const c_char
;
706 pub fn LLVMSetValueName2(Val
: &Value
, Name
: *const c_char
, NameLen
: size_t
);
707 pub fn LLVMReplaceAllUsesWith(OldVal
: &'a Value
, NewVal
: &'a Value
);
708 pub fn LLVMSetMetadata(Val
: &'a Value
, KindID
: c_uint
, Node
: &'a Value
);
710 // Operations on constants of any type
711 pub fn LLVMConstNull(Ty
: &Type
) -> &Value
;
712 pub fn LLVMGetUndef(Ty
: &Type
) -> &Value
;
714 // Operations on metadata
715 pub fn LLVMMDStringInContext(C
: &Context
, Str
: *const c_char
, SLen
: c_uint
) -> &Value
;
716 pub fn LLVMMDNodeInContext(C
: &'a Context
, Vals
: *const &'a Value
, Count
: c_uint
) -> &'a Value
;
717 pub fn LLVMAddNamedMetadataOperand(M
: &'a Module
, Name
: *const c_char
, Val
: &'a Value
);
719 // Operations on scalar constants
720 pub fn LLVMConstInt(IntTy
: &Type
, N
: c_ulonglong
, SignExtend
: Bool
) -> &Value
;
721 pub fn LLVMConstIntOfArbitraryPrecision(IntTy
: &Type
, Wn
: c_uint
, Ws
: *const u64) -> &Value
;
722 pub fn LLVMConstReal(RealTy
: &Type
, N
: f64) -> &Value
;
723 pub fn LLVMConstIntGetZExtValue(ConstantVal
: &ConstantInt
) -> c_ulonglong
;
724 pub fn LLVMRustConstInt128Get(ConstantVal
: &ConstantInt
, SExt
: bool
,
725 high
: &mut u64, low
: &mut u64) -> bool
;
728 // Operations on composite constants
729 pub fn LLVMConstStringInContext(C
: &Context
,
732 DontNullTerminate
: Bool
)
734 pub fn LLVMConstStructInContext(C
: &'a Context
,
735 ConstantVals
: *const &'a Value
,
740 pub fn LLVMConstArray(ElementTy
: &'a Type
,
741 ConstantVals
: *const &'a Value
,
744 pub fn LLVMConstVector(ScalarConstantVals
: *const &Value
, Size
: c_uint
) -> &Value
;
746 // Constant expressions
747 pub fn LLVMConstInBoundsGEP(
748 ConstantVal
: &'a Value
,
749 ConstantIndices
: *const &'a Value
,
752 pub fn LLVMConstZExt(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
753 pub fn LLVMConstPtrToInt(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
754 pub fn LLVMConstIntToPtr(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
755 pub fn LLVMConstBitCast(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
756 pub fn LLVMConstPointerCast(ConstantVal
: &'a Value
, ToType
: &'a Type
) -> &'a Value
;
757 pub fn LLVMConstExtractValue(AggConstant
: &Value
,
758 IdxList
: *const c_uint
,
762 // Operations on global variables, functions, and aliases (globals)
763 pub fn LLVMIsDeclaration(Global
: &Value
) -> Bool
;
764 pub fn LLVMRustGetLinkage(Global
: &Value
) -> Linkage
;
765 pub fn LLVMRustSetLinkage(Global
: &Value
, RustLinkage
: Linkage
);
766 pub fn LLVMSetSection(Global
: &Value
, Section
: *const c_char
);
767 pub fn LLVMRustGetVisibility(Global
: &Value
) -> Visibility
;
768 pub fn LLVMRustSetVisibility(Global
: &Value
, Viz
: Visibility
);
769 pub fn LLVMGetAlignment(Global
: &Value
) -> c_uint
;
770 pub fn LLVMSetAlignment(Global
: &Value
, Bytes
: c_uint
);
771 pub fn LLVMSetDLLStorageClass(V
: &Value
, C
: DLLStorageClass
);
774 // Operations on global variables
775 pub fn LLVMIsAGlobalVariable(GlobalVar
: &Value
) -> Option
<&Value
>;
776 pub fn LLVMAddGlobal(M
: &'a Module
, Ty
: &'a Type
, Name
: *const c_char
) -> &'a Value
;
777 pub fn LLVMGetNamedGlobal(M
: &Module
, Name
: *const c_char
) -> Option
<&Value
>;
778 pub fn LLVMRustGetOrInsertGlobal(M
: &'a Module
, Name
: *const c_char
, NameLen
: size_t
,
779 T
: &'a Type
) -> &'a Value
;
780 pub fn LLVMRustInsertPrivateGlobal(M
: &'a Module
, T
: &'a Type
) -> &'a Value
;
781 pub fn LLVMGetFirstGlobal(M
: &Module
) -> Option
<&Value
>;
782 pub fn LLVMGetNextGlobal(GlobalVar
: &Value
) -> Option
<&Value
>;
783 pub fn LLVMDeleteGlobal(GlobalVar
: &Value
);
784 pub fn LLVMGetInitializer(GlobalVar
: &Value
) -> Option
<&Value
>;
785 pub fn LLVMSetInitializer(GlobalVar
: &'a Value
, ConstantVal
: &'a Value
);
786 pub fn LLVMSetThreadLocal(GlobalVar
: &Value
, IsThreadLocal
: Bool
);
787 pub fn LLVMSetThreadLocalMode(GlobalVar
: &Value
, Mode
: ThreadLocalMode
);
788 pub fn LLVMIsGlobalConstant(GlobalVar
: &Value
) -> Bool
;
789 pub fn LLVMSetGlobalConstant(GlobalVar
: &Value
, IsConstant
: Bool
);
790 pub fn LLVMRustGetNamedValue(M
: &Module
, Name
: *const c_char
) -> Option
<&Value
>;
791 pub fn LLVMSetTailCall(CallInst
: &Value
, IsTailCall
: Bool
);
793 // Operations on functions
794 pub fn LLVMRustGetOrInsertFunction(M
: &'a Module
,
796 FunctionTy
: &'a Type
)
798 pub fn LLVMSetFunctionCallConv(Fn
: &Value
, CC
: c_uint
);
799 pub fn LLVMRustAddAlignmentAttr(Fn
: &Value
, index
: c_uint
, bytes
: u32);
800 pub fn LLVMRustAddDereferenceableAttr(Fn
: &Value
, index
: c_uint
, bytes
: u64);
801 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn
: &Value
, index
: c_uint
, bytes
: u64);
802 pub fn LLVMRustAddByValAttr(Fn
: &Value
, index
: c_uint
, ty
: &Type
);
803 pub fn LLVMRustAddFunctionAttribute(Fn
: &Value
, index
: c_uint
, attr
: Attribute
);
804 pub fn LLVMRustAddFunctionAttrStringValue(Fn
: &Value
,
807 Value
: *const c_char
);
808 pub fn LLVMRustRemoveFunctionAttributes(Fn
: &Value
, index
: c_uint
, attr
: Attribute
);
810 // Operations on parameters
811 pub fn LLVMIsAArgument(Val
: &Value
) -> Option
<&Value
>;
812 pub fn LLVMCountParams(Fn
: &Value
) -> c_uint
;
813 pub fn LLVMGetParam(Fn
: &Value
, Index
: c_uint
) -> &Value
;
815 // Operations on basic blocks
816 pub fn LLVMGetBasicBlockParent(BB
: &BasicBlock
) -> &Value
;
817 pub fn LLVMAppendBasicBlockInContext(C
: &'a Context
,
821 pub fn LLVMDeleteBasicBlock(BB
: &BasicBlock
);
823 // Operations on instructions
824 pub fn LLVMIsAInstruction(Val
: &Value
) -> Option
<&Value
>;
825 pub fn LLVMGetFirstBasicBlock(Fn
: &Value
) -> &BasicBlock
;
827 // Operations on call sites
828 pub fn LLVMSetInstructionCallConv(Instr
: &Value
, CC
: c_uint
);
829 pub fn LLVMRustAddCallSiteAttribute(Instr
: &Value
, index
: c_uint
, attr
: Attribute
);
830 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr
: &Value
, index
: c_uint
, bytes
: u32);
831 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr
: &Value
, index
: c_uint
, bytes
: u64);
832 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr
: &Value
,
835 pub fn LLVMRustAddByValCallSiteAttr(Instr
: &Value
, index
: c_uint
, ty
: &Type
);
837 // Operations on load/store instructions (only)
838 pub fn LLVMSetVolatile(MemoryAccessInst
: &Value
, volatile
: Bool
);
840 // Operations on phi nodes
841 pub fn LLVMAddIncoming(PhiNode
: &'a Value
,
842 IncomingValues
: *const &'a Value
,
843 IncomingBlocks
: *const &'a BasicBlock
,
846 // Instruction builders
847 pub fn LLVMCreateBuilderInContext(C
: &'a Context
) -> &'a
mut Builder
<'a
>;
848 pub fn LLVMPositionBuilderAtEnd(Builder
: &Builder
<'a
>, Block
: &'a BasicBlock
);
849 pub fn LLVMGetInsertBlock(Builder
: &Builder
<'a
>) -> &'a BasicBlock
;
850 pub fn LLVMDisposeBuilder(Builder
: &'a
mut Builder
<'a
>);
853 pub fn LLVMSetCurrentDebugLocation(Builder
: &Builder
<'a
>, L
: Option
<&'a Value
>);
854 pub fn LLVMGetCurrentDebugLocation(Builder
: &Builder
<'a
>) -> &'a Value
;
855 pub fn LLVMSetInstDebugLocation(Builder
: &Builder
<'a
>, Inst
: &'a Value
);
858 pub fn LLVMBuildRetVoid(B
: &Builder
<'a
>) -> &'a Value
;
859 pub fn LLVMBuildRet(B
: &Builder
<'a
>, V
: &'a Value
) -> &'a Value
;
860 pub fn LLVMBuildBr(B
: &Builder
<'a
>, Dest
: &'a BasicBlock
) -> &'a Value
;
861 pub fn LLVMBuildCondBr(B
: &Builder
<'a
>,
863 Then
: &'a BasicBlock
,
864 Else
: &'a BasicBlock
)
866 pub fn LLVMBuildSwitch(B
: &Builder
<'a
>,
868 Else
: &'a BasicBlock
,
871 pub fn LLVMRustBuildInvoke(B
: &Builder
<'a
>,
873 Args
: *const &'a Value
,
875 Then
: &'a BasicBlock
,
876 Catch
: &'a BasicBlock
,
877 Bundle
: Option
<&OperandBundleDef
<'a
>>,
880 pub fn LLVMBuildLandingPad(B
: &Builder
<'a
>,
886 pub fn LLVMBuildResume(B
: &Builder
<'a
>, Exn
: &'a Value
) -> &'a Value
;
887 pub fn LLVMBuildUnreachable(B
: &Builder
<'a
>) -> &'a Value
;
889 pub fn LLVMRustBuildCleanupPad(B
: &Builder
<'a
>,
890 ParentPad
: Option
<&'a Value
>,
892 Args
: *const &'a Value
,
894 -> Option
<&'a Value
>;
895 pub fn LLVMRustBuildCleanupRet(B
: &Builder
<'a
>,
896 CleanupPad
: &'a Value
,
897 UnwindBB
: Option
<&'a BasicBlock
>)
898 -> Option
<&'a Value
>;
899 pub fn LLVMRustBuildCatchPad(B
: &Builder
<'a
>,
900 ParentPad
: &'a Value
,
902 Args
: *const &'a Value
,
904 -> Option
<&'a Value
>;
905 pub fn LLVMRustBuildCatchRet(
909 ) -> Option
<&'a Value
>;
910 pub fn LLVMRustBuildCatchSwitch(Builder
: &Builder
<'a
>,
911 ParentPad
: Option
<&'a Value
>,
912 BB
: Option
<&'a BasicBlock
>,
915 -> Option
<&'a Value
>;
916 pub fn LLVMRustAddHandler(CatchSwitch
: &'a Value
, Handler
: &'a BasicBlock
);
917 pub fn LLVMSetPersonalityFn(Func
: &'a Value
, Pers
: &'a Value
);
919 // Add a case to the switch instruction
920 pub fn LLVMAddCase(Switch
: &'a Value
, OnVal
: &'a Value
, Dest
: &'a BasicBlock
);
922 // Add a clause to the landing pad instruction
923 pub fn LLVMAddClause(LandingPad
: &'a Value
, ClauseVal
: &'a Value
);
925 // Set the cleanup on a landing pad instruction
926 pub fn LLVMSetCleanup(LandingPad
: &Value
, Val
: Bool
);
929 pub fn LLVMBuildAdd(B
: &Builder
<'a
>,
934 pub fn LLVMBuildFAdd(B
: &Builder
<'a
>,
939 pub fn LLVMBuildSub(B
: &Builder
<'a
>,
944 pub fn LLVMBuildFSub(B
: &Builder
<'a
>,
949 pub fn LLVMBuildMul(B
: &Builder
<'a
>,
954 pub fn LLVMBuildFMul(B
: &Builder
<'a
>,
959 pub fn LLVMBuildUDiv(B
: &Builder
<'a
>,
964 pub fn LLVMBuildExactUDiv(B
: &Builder
<'a
>,
969 pub fn LLVMBuildSDiv(B
: &Builder
<'a
>,
974 pub fn LLVMBuildExactSDiv(B
: &Builder
<'a
>,
979 pub fn LLVMBuildFDiv(B
: &Builder
<'a
>,
984 pub fn LLVMBuildURem(B
: &Builder
<'a
>,
989 pub fn LLVMBuildSRem(B
: &Builder
<'a
>,
994 pub fn LLVMBuildFRem(B
: &Builder
<'a
>,
999 pub fn LLVMBuildShl(B
: &Builder
<'a
>,
1002 Name
: *const c_char
)
1004 pub fn LLVMBuildLShr(B
: &Builder
<'a
>,
1007 Name
: *const c_char
)
1009 pub fn LLVMBuildAShr(B
: &Builder
<'a
>,
1012 Name
: *const c_char
)
1014 pub fn LLVMBuildNSWAdd(B
: &Builder
<'a
>,
1017 Name
: *const c_char
)
1019 pub fn LLVMBuildNUWAdd(B
: &Builder
<'a
>,
1022 Name
: *const c_char
)
1024 pub fn LLVMBuildNSWSub(B
: &Builder
<'a
>,
1027 Name
: *const c_char
)
1029 pub fn LLVMBuildNUWSub(B
: &Builder
<'a
>,
1032 Name
: *const c_char
)
1034 pub fn LLVMBuildNSWMul(B
: &Builder
<'a
>,
1037 Name
: *const c_char
)
1039 pub fn LLVMBuildNUWMul(B
: &Builder
<'a
>,
1042 Name
: *const c_char
)
1044 pub fn LLVMBuildAnd(B
: &Builder
<'a
>,
1047 Name
: *const c_char
)
1049 pub fn LLVMBuildOr(B
: &Builder
<'a
>,
1052 Name
: *const c_char
)
1054 pub fn LLVMBuildXor(B
: &Builder
<'a
>,
1057 Name
: *const c_char
)
1059 pub fn LLVMBuildNeg(B
: &Builder
<'a
>, V
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1060 pub fn LLVMBuildFNeg(B
: &Builder
<'a
>, V
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1061 pub fn LLVMBuildNot(B
: &Builder
<'a
>, V
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1062 pub fn LLVMRustSetHasUnsafeAlgebra(Instr
: &Value
);
1065 pub fn LLVMBuildAlloca(B
: &Builder
<'a
>, Ty
: &'a Type
, Name
: *const c_char
) -> &'a Value
;
1066 pub fn LLVMBuildArrayAlloca(B
: &Builder
<'a
>,
1069 Name
: *const c_char
)
1071 pub fn LLVMBuildLoad(B
: &Builder
<'a
>, PointerVal
: &'a Value
, Name
: *const c_char
) -> &'a Value
;
1073 pub fn LLVMBuildStore(B
: &Builder
<'a
>, Val
: &'a Value
, Ptr
: &'a Value
) -> &'a Value
;
1075 pub fn LLVMBuildGEP(B
: &Builder
<'a
>,
1077 Indices
: *const &'a Value
,
1079 Name
: *const c_char
)
1081 pub fn LLVMBuildInBoundsGEP(B
: &Builder
<'a
>,
1083 Indices
: *const &'a Value
,
1085 Name
: *const c_char
)
1087 pub fn LLVMBuildStructGEP(B
: &Builder
<'a
>,
1090 Name
: *const c_char
)
1094 pub fn LLVMBuildTrunc(B
: &Builder
<'a
>,
1097 Name
: *const c_char
)
1099 pub fn LLVMBuildZExt(B
: &Builder
<'a
>,
1102 Name
: *const c_char
)
1104 pub fn LLVMBuildSExt(B
: &Builder
<'a
>,
1107 Name
: *const c_char
)
1109 pub fn LLVMBuildFPToUI(B
: &Builder
<'a
>,
1112 Name
: *const c_char
)
1114 pub fn LLVMBuildFPToSI(B
: &Builder
<'a
>,
1117 Name
: *const c_char
)
1119 pub fn LLVMBuildUIToFP(B
: &Builder
<'a
>,
1122 Name
: *const c_char
)
1124 pub fn LLVMBuildSIToFP(B
: &Builder
<'a
>,
1127 Name
: *const c_char
)
1129 pub fn LLVMBuildFPTrunc(B
: &Builder
<'a
>,
1132 Name
: *const c_char
)
1134 pub fn LLVMBuildFPExt(B
: &Builder
<'a
>,
1137 Name
: *const c_char
)
1139 pub fn LLVMBuildPtrToInt(B
: &Builder
<'a
>,
1142 Name
: *const c_char
)
1144 pub fn LLVMBuildIntToPtr(B
: &Builder
<'a
>,
1147 Name
: *const c_char
)
1149 pub fn LLVMBuildBitCast(B
: &Builder
<'a
>,
1152 Name
: *const c_char
)
1154 pub fn LLVMBuildPointerCast(B
: &Builder
<'a
>,
1157 Name
: *const c_char
)
1159 pub fn LLVMRustBuildIntCast(B
: &Builder
<'a
>,
1166 pub fn LLVMBuildICmp(B
: &Builder
<'a
>,
1170 Name
: *const c_char
)
1172 pub fn LLVMBuildFCmp(B
: &Builder
<'a
>,
1176 Name
: *const c_char
)
1179 // Miscellaneous instructions
1180 pub fn LLVMBuildPhi(B
: &Builder
<'a
>, Ty
: &'a Type
, Name
: *const c_char
) -> &'a Value
;
1181 pub fn LLVMRustBuildCall(B
: &Builder
<'a
>,
1183 Args
: *const &'a Value
,
1185 Bundle
: Option
<&OperandBundleDef
<'a
>>,
1186 Name
: *const c_char
)
1188 pub fn LLVMRustBuildMemCpy(B
: &Builder
<'a
>,
1196 pub fn LLVMRustBuildMemMove(B
: &Builder
<'a
>,
1204 pub fn LLVMBuildSelect(B
: &Builder
<'a
>,
1208 Name
: *const c_char
)
1210 pub fn LLVMBuildVAArg(B
: &Builder
<'a
>,
1213 Name
: *const c_char
)
1215 pub fn LLVMBuildExtractElement(B
: &Builder
<'a
>,
1218 Name
: *const c_char
)
1220 pub fn LLVMBuildInsertElement(B
: &Builder
<'a
>,
1224 Name
: *const c_char
)
1226 pub fn LLVMBuildShuffleVector(B
: &Builder
<'a
>,
1230 Name
: *const c_char
)
1232 pub fn LLVMBuildExtractValue(B
: &Builder
<'a
>,
1235 Name
: *const c_char
)
1237 pub fn LLVMBuildInsertValue(B
: &Builder
<'a
>,
1241 Name
: *const c_char
)
1244 pub fn LLVMRustBuildVectorReduceFAdd(B
: &Builder
<'a
>,
1248 pub fn LLVMRustBuildVectorReduceFMul(B
: &Builder
<'a
>,
1252 pub fn LLVMRustBuildVectorReduceAdd(B
: &Builder
<'a
>,
1255 pub fn LLVMRustBuildVectorReduceMul(B
: &Builder
<'a
>,
1258 pub fn LLVMRustBuildVectorReduceAnd(B
: &Builder
<'a
>,
1261 pub fn LLVMRustBuildVectorReduceOr(B
: &Builder
<'a
>,
1264 pub fn LLVMRustBuildVectorReduceXor(B
: &Builder
<'a
>,
1267 pub fn LLVMRustBuildVectorReduceMin(B
: &Builder
<'a
>,
1271 pub fn LLVMRustBuildVectorReduceMax(B
: &Builder
<'a
>,
1275 pub fn LLVMRustBuildVectorReduceFMin(B
: &Builder
<'a
>,
1279 pub fn LLVMRustBuildVectorReduceFMax(B
: &Builder
<'a
>,
1284 pub fn LLVMRustBuildMinNum(
1289 pub fn LLVMRustBuildMaxNum(
1295 // Atomic Operations
1296 pub fn LLVMRustBuildAtomicLoad(B
: &Builder
<'a
>,
1297 PointerVal
: &'a Value
,
1298 Name
: *const c_char
,
1299 Order
: AtomicOrdering
)
1302 pub fn LLVMRustBuildAtomicStore(B
: &Builder
<'a
>,
1305 Order
: AtomicOrdering
)
1308 pub fn LLVMRustBuildAtomicCmpXchg(B
: &Builder
<'a
>,
1312 Order
: AtomicOrdering
,
1313 FailureOrder
: AtomicOrdering
,
1317 pub fn LLVMBuildAtomicRMW(B
: &Builder
<'a
>,
1321 Order
: AtomicOrdering
,
1322 SingleThreaded
: Bool
)
1325 pub fn LLVMRustBuildAtomicFence(B
: &Builder
<'_
>,
1326 Order
: AtomicOrdering
,
1327 Scope
: SynchronizationScope
);
1329 /// Writes a module to the specified path. Returns 0 on success.
1330 pub fn LLVMWriteBitcodeToFile(M
: &Module
, Path
: *const c_char
) -> c_int
;
1332 /// Creates a pass manager.
1333 pub fn LLVMCreatePassManager() -> &'a
mut PassManager
<'a
>;
1335 /// Creates a function-by-function pass manager
1336 pub fn LLVMCreateFunctionPassManagerForModule(M
: &'a Module
) -> &'a
mut PassManager
<'a
>;
1338 /// Disposes a pass manager.
1339 pub fn LLVMDisposePassManager(PM
: &'a
mut PassManager
<'a
>);
1341 /// Runs a pass manager on a module.
1342 pub fn LLVMRunPassManager(PM
: &PassManager
<'a
>, M
: &'a Module
) -> Bool
;
1344 pub fn LLVMInitializePasses();
1346 pub fn LLVMAddAnalysisPasses(T
: &'a TargetMachine
, PM
: &PassManager
<'a
>);
1348 pub fn LLVMPassManagerBuilderCreate() -> &'
static mut PassManagerBuilder
;
1349 pub fn LLVMPassManagerBuilderDispose(PMB
: &'
static mut PassManagerBuilder
);
1350 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB
: &PassManagerBuilder
, Value
: Bool
);
1351 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB
: &PassManagerBuilder
, Value
: Bool
);
1352 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB
: &PassManagerBuilder
,
1354 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB
: &PassManagerBuilder
,
1355 PM
: &PassManager
<'_
>);
1357 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB
: &PassManagerBuilder
,
1358 PM
: &PassManager
<'_
>);
1359 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB
: &PassManagerBuilder
,
1360 PM
: &PassManager
<'_
>,
1363 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1364 PMB
: &PassManagerBuilder
,
1365 PM
: &PassManager
<'_
>);
1367 // Stuff that's in rustllvm/ because it's not upstream yet.
1369 /// Opens an object file.
1370 pub fn LLVMCreateObjectFile(
1371 MemBuf
: &'
static mut MemoryBuffer
,
1372 ) -> Option
<&'
static mut ObjectFile
>;
1373 /// Closes an object file.
1374 pub fn LLVMDisposeObjectFile(ObjFile
: &'
static mut ObjectFile
);
1376 /// Enumerates the sections in an object file.
1377 pub fn LLVMGetSections(ObjFile
: &'a ObjectFile
) -> &'a
mut SectionIterator
<'a
>;
1378 /// Destroys a section iterator.
1379 pub fn LLVMDisposeSectionIterator(SI
: &'a
mut SectionIterator
<'a
>);
1380 /// Returns `true` if the section iterator is at the end of the section
1382 pub fn LLVMIsSectionIteratorAtEnd(ObjFile
: &'a ObjectFile
, SI
: &SectionIterator
<'a
>) -> Bool
;
1383 /// Moves the section iterator to point to the next section.
1384 pub fn LLVMMoveToNextSection(SI
: &SectionIterator
<'_
>);
1385 /// Returns the current section size.
1386 pub fn LLVMGetSectionSize(SI
: &SectionIterator
<'_
>) -> c_ulonglong
;
1387 /// Returns the current section contents as a string buffer.
1388 pub fn LLVMGetSectionContents(SI
: &SectionIterator
<'_
>) -> *const c_char
;
1390 /// Reads the given file and returns it as a memory buffer. Use
1391 /// LLVMDisposeMemoryBuffer() to get rid of it.
1392 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1393 Path
: *const c_char
,
1394 ) -> Option
<&'
static mut MemoryBuffer
>;
1396 pub fn LLVMStartMultithreaded() -> Bool
;
1398 /// Returns a string describing the last error caused by an LLVMRust* call.
1399 pub fn LLVMRustGetLastError() -> *const c_char
;
1401 /// Print the pass timings since static dtors aren't picking them up.
1402 pub fn LLVMRustPrintPassTimings();
1404 pub fn LLVMStructCreateNamed(C
: &Context
, Name
: *const c_char
) -> &Type
;
1406 pub fn LLVMStructSetBody(StructTy
: &'a Type
,
1407 ElementTypes
: *const &'a Type
,
1408 ElementCount
: c_uint
,
1411 /// Prepares inline assembly.
1412 pub fn LLVMRustInlineAsm(Ty
: &Type
,
1413 AsmString
: *const c_char
,
1414 Constraints
: *const c_char
,
1417 Dialect
: AsmDialect
)
1419 pub fn LLVMRustInlineAsmVerify(Ty
: &Type
,
1420 Constraints
: *const c_char
)
1423 pub fn LLVMRustDebugMetadataVersion() -> u32;
1424 pub fn LLVMRustVersionMajor() -> u32;
1425 pub fn LLVMRustVersionMinor() -> u32;
1427 pub fn LLVMRustAddModuleFlag(M
: &Module
, name
: *const c_char
, value
: u32);
1429 pub fn LLVMRustMetadataAsValue(C
: &'a Context
, MD
: &'a Metadata
) -> &'a Value
;
1431 pub fn LLVMRustDIBuilderCreate(M
: &'a Module
) -> &'a
mut DIBuilder
<'a
>;
1433 pub fn LLVMRustDIBuilderDispose(Builder
: &'a
mut DIBuilder
<'a
>);
1435 pub fn LLVMRustDIBuilderFinalize(Builder
: &DIBuilder
<'_
>);
1437 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder
: &DIBuilder
<'a
>,
1440 Producer
: *const c_char
,
1442 Flags
: *const c_char
,
1444 SplitName
: *const c_char
,
1445 kind
: DebugEmissionKind
)
1446 -> &'a DIDescriptor
;
1448 pub fn LLVMRustDIBuilderCreateFile(Builder
: &DIBuilder
<'a
>,
1449 Filename
: *const c_char
,
1450 Directory
: *const c_char
)
1453 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder
: &DIBuilder
<'a
>,
1455 ParameterTypes
: &'a DIArray
)
1456 -> &'a DICompositeType
;
1458 pub fn LLVMRustDIBuilderCreateFunction(Builder
: &DIBuilder
<'a
>,
1459 Scope
: &'a DIDescriptor
,
1460 Name
: *const c_char
,
1461 LinkageName
: *const c_char
,
1469 TParam
: &'a DIArray
,
1470 Decl
: Option
<&'a DIDescriptor
>)
1471 -> &'a DISubprogram
;
1473 pub fn LLVMRustDIBuilderCreateBasicType(Builder
: &DIBuilder
<'a
>,
1474 Name
: *const c_char
,
1480 pub fn LLVMRustDIBuilderCreatePointerType(Builder
: &DIBuilder
<'a
>,
1481 PointeeTy
: &'a DIType
,
1484 Name
: *const c_char
)
1485 -> &'a DIDerivedType
;
1487 pub fn LLVMRustDIBuilderCreateStructType(Builder
: &DIBuilder
<'a
>,
1488 Scope
: Option
<&'a DIDescriptor
>,
1489 Name
: *const c_char
,
1495 DerivedFrom
: Option
<&'a DIType
>,
1496 Elements
: &'a DIArray
,
1497 RunTimeLang
: c_uint
,
1498 VTableHolder
: Option
<&'a DIType
>,
1499 UniqueId
: *const c_char
)
1500 -> &'a DICompositeType
;
1502 pub fn LLVMRustDIBuilderCreateMemberType(Builder
: &DIBuilder
<'a
>,
1503 Scope
: &'a DIDescriptor
,
1504 Name
: *const c_char
,
1512 -> &'a DIDerivedType
;
1514 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder
: &DIBuilder
<'a
>,
1516 Name
: *const c_char
,
1522 Discriminant
: Option
<&'a Value
>,
1527 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder
: &DIBuilder
<'a
>,
1532 -> &'a DILexicalBlock
;
1534 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder
: &DIBuilder
<'a
>,
1537 -> &'a DILexicalBlock
;
1539 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder
: &DIBuilder
<'a
>,
1540 Context
: Option
<&'a DIScope
>,
1541 Name
: *const c_char
,
1542 LinkageName
: *const c_char
,
1546 isLocalToUnit
: bool
,
1548 Decl
: Option
<&'a DIDescriptor
>,
1550 -> &'a DIGlobalVariableExpression
;
1552 pub fn LLVMRustDIBuilderCreateVariable(Builder
: &DIBuilder
<'a
>,
1554 Scope
: &'a DIDescriptor
,
1555 Name
: *const c_char
,
1559 AlwaysPreserve
: bool
,
1565 pub fn LLVMRustDIBuilderCreateArrayType(Builder
: &DIBuilder
<'a
>,
1569 Subscripts
: &'a DIArray
)
1572 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder
: &DIBuilder
<'a
>,
1577 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder
: &DIBuilder
<'a
>,
1578 Ptr
: *const Option
<&'a DIDescriptor
>,
1582 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder
: &DIBuilder
<'a
>,
1584 VarInfo
: &'a DIVariable
,
1585 AddrOps
: *const i64,
1586 AddrOpsCount
: c_uint
,
1588 InsertAtEnd
: &'a BasicBlock
)
1591 pub fn LLVMRustDIBuilderCreateEnumerator(Builder
: &DIBuilder
<'a
>,
1592 Name
: *const c_char
,
1594 -> &'a DIEnumerator
;
1596 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder
: &DIBuilder
<'a
>,
1598 Name
: *const c_char
,
1603 Elements
: &'a DIArray
,
1604 ClassType
: &'a DIType
,
1608 pub fn LLVMRustDIBuilderCreateUnionType(Builder
: &DIBuilder
<'a
>,
1610 Name
: *const c_char
,
1616 Elements
: Option
<&'a DIArray
>,
1617 RunTimeLang
: c_uint
,
1618 UniqueId
: *const c_char
)
1621 pub fn LLVMRustDIBuilderCreateVariantPart(Builder
: &DIBuilder
<'a
>,
1623 Name
: *const c_char
,
1629 Discriminator
: Option
<&'a DIDerivedType
>,
1630 Elements
: &'a DIArray
,
1631 UniqueId
: *const c_char
)
1632 -> &'a DIDerivedType
;
1634 pub fn LLVMSetUnnamedAddr(GlobalVar
: &Value
, UnnamedAddr
: Bool
);
1636 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder
: &DIBuilder
<'a
>,
1637 Scope
: Option
<&'a DIScope
>,
1638 Name
: *const c_char
,
1643 -> &'a DITemplateTypeParameter
;
1646 pub fn LLVMRustDIBuilderCreateNameSpace(Builder
: &DIBuilder
<'a
>,
1647 Scope
: Option
<&'a DIScope
>,
1648 Name
: *const c_char
,
1653 pub fn LLVMRustDICompositeTypeReplaceArrays(Builder
: &DIBuilder
<'a
>,
1654 CompositeType
: &'a DIType
,
1655 Elements
: Option
<&'a DIArray
>,
1656 Params
: Option
<&'a DIArray
>);
1659 pub fn LLVMRustDIBuilderCreateDebugLocation(Context
: &'a Context
,
1663 InlinedAt
: Option
<&'a Metadata
>)
1665 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1666 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1668 #[allow(improper_ctypes)]
1669 pub fn LLVMRustWriteTypeToString(Type
: &Type
, s
: &RustString
);
1670 #[allow(improper_ctypes)]
1671 pub fn LLVMRustWriteValueToString(value_ref
: &Value
, s
: &RustString
);
1673 pub fn LLVMIsAConstantInt(value_ref
: &Value
) -> Option
<&ConstantInt
>;
1675 pub fn LLVMRustPassKind(Pass
: &Pass
) -> PassKind
;
1676 pub fn LLVMRustFindAndCreatePass(Pass
: *const c_char
) -> Option
<&'
static mut Pass
>;
1677 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover
: bool
) -> &'
static mut Pass
;
1678 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover
: bool
) -> &'
static mut Pass
;
1679 pub fn LLVMRustCreateMemorySanitizerPass(TrackOrigins
: c_int
,
1680 Recover
: bool
) -> &'
static mut Pass
;
1681 pub fn LLVMRustCreateThreadSanitizerPass() -> &'
static mut Pass
;
1682 pub fn LLVMRustAddPass(PM
: &PassManager
<'_
>, Pass
: &'
static mut Pass
);
1683 pub fn LLVMRustAddLastExtensionPasses(PMB
: &PassManagerBuilder
,
1684 Passes
: *const &'
static mut Pass
,
1687 pub fn LLVMRustHasFeature(T
: &TargetMachine
, s
: *const c_char
) -> bool
;
1689 pub fn LLVMRustPrintTargetCPUs(T
: &TargetMachine
);
1690 pub fn LLVMRustPrintTargetFeatures(T
: &TargetMachine
);
1692 pub fn LLVMRustGetHostCPUName(len
: *mut usize) -> *const c_char
;
1693 pub fn LLVMRustCreateTargetMachine(Triple
: *const c_char
,
1695 Features
: *const c_char
,
1699 Level
: CodeGenOptLevel
,
1701 PositionIndependentExecutable
: bool
,
1702 FunctionSections
: bool
,
1704 TrapUnreachable
: bool
,
1707 EmitStackSizeSection
: bool
,
1708 RelaxELFRelocations
: bool
)
1709 -> Option
<&'
static mut TargetMachine
>;
1710 pub fn LLVMRustDisposeTargetMachine(T
: &'
static mut TargetMachine
);
1711 pub fn LLVMRustAddBuilderLibraryInfo(PMB
: &'a PassManagerBuilder
,
1713 DisableSimplifyLibCalls
: bool
);
1714 pub fn LLVMRustConfigurePassManagerBuilder(PMB
: &PassManagerBuilder
,
1715 OptLevel
: CodeGenOptLevel
,
1716 MergeFunctions
: bool
,
1718 LoopVectorize
: bool
,
1719 PrepareForThinLTO
: bool
,
1720 PGOGenPath
: *const c_char
,
1721 PGOUsePath
: *const c_char
);
1722 pub fn LLVMRustAddLibraryInfo(PM
: &PassManager
<'a
>,
1724 DisableSimplifyLibCalls
: bool
);
1725 pub fn LLVMRustRunFunctionPassManager(PM
: &PassManager
<'a
>, M
: &'a Module
);
1726 pub fn LLVMRustWriteOutputFile(T
: &'a TargetMachine
,
1727 PM
: &PassManager
<'a
>,
1729 Output
: *const c_char
,
1732 pub fn LLVMRustPrintModule(M
: &'a Module
,
1733 Output
: *const c_char
,
1734 Demangle
: extern fn(*const c_char
,
1738 ) -> LLVMRustResult
;
1739 pub fn LLVMRustSetLLVMOptions(Argc
: c_int
, Argv
: *const *const c_char
);
1740 pub fn LLVMRustPrintPasses();
1741 pub fn LLVMRustGetInstructionCount(M
: &Module
) -> u32;
1742 pub fn LLVMRustSetNormalizedTarget(M
: &Module
, triple
: *const c_char
);
1743 pub fn LLVMRustAddAlwaysInlinePass(P
: &PassManagerBuilder
, AddLifetimes
: bool
);
1744 pub fn LLVMRustRunRestrictionPass(M
: &Module
, syms
: *const *const c_char
, len
: size_t
);
1745 pub fn LLVMRustMarkAllFunctionsNounwind(M
: &Module
);
1747 pub fn LLVMRustOpenArchive(path
: *const c_char
) -> Option
<&'
static mut Archive
>;
1748 pub fn LLVMRustArchiveIteratorNew(AR
: &'a Archive
) -> &'a
mut ArchiveIterator
<'a
>;
1749 pub fn LLVMRustArchiveIteratorNext(
1750 AIR
: &ArchiveIterator
<'a
>,
1751 ) -> Option
<&'a
mut ArchiveChild
<'a
>>;
1752 pub fn LLVMRustArchiveChildName(ACR
: &ArchiveChild
<'_
>, size
: &mut size_t
) -> *const c_char
;
1753 pub fn LLVMRustArchiveChildData(ACR
: &ArchiveChild
<'_
>, size
: &mut size_t
) -> *const c_char
;
1754 pub fn LLVMRustArchiveChildFree(ACR
: &'a
mut ArchiveChild
<'a
>);
1755 pub fn LLVMRustArchiveIteratorFree(AIR
: &'a
mut ArchiveIterator
<'a
>);
1756 pub fn LLVMRustDestroyArchive(AR
: &'
static mut Archive
);
1758 #[allow(improper_ctypes)]
1759 pub fn LLVMRustGetSectionName(SI
: &SectionIterator
<'_
>,
1760 data
: &mut Option
<std
::ptr
::NonNull
<c_char
>>) -> size_t
;
1762 #[allow(improper_ctypes)]
1763 pub fn LLVMRustWriteTwineToString(T
: &Twine
, s
: &RustString
);
1765 pub fn LLVMContextSetDiagnosticHandler(C
: &Context
,
1766 Handler
: DiagnosticHandler
,
1767 DiagnosticContext
: *mut c_void
);
1769 #[allow(improper_ctypes)]
1770 pub fn LLVMRustUnpackOptimizationDiagnostic(DI
: &'a DiagnosticInfo
,
1771 pass_name_out
: &RustString
,
1772 function_out
: &mut Option
<&'a Value
>,
1773 loc_line_out
: &mut c_uint
,
1774 loc_column_out
: &mut c_uint
,
1775 loc_filename_out
: &RustString
,
1776 message_out
: &RustString
);
1778 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI
: &'a DiagnosticInfo
,
1779 cookie_out
: &mut c_uint
,
1780 message_out
: &mut Option
<&'a Twine
>,
1781 instruction_out
: &mut Option
<&'a Value
>);
1783 #[allow(improper_ctypes)]
1784 pub fn LLVMRustWriteDiagnosticInfoToString(DI
: &DiagnosticInfo
, s
: &RustString
);
1785 pub fn LLVMRustGetDiagInfoKind(DI
: &DiagnosticInfo
) -> DiagnosticKind
;
1787 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C
: &Context
,
1788 H
: InlineAsmDiagHandler
,
1791 #[allow(improper_ctypes)]
1792 pub fn LLVMRustWriteSMDiagnosticToString(d
: &SMDiagnostic
, s
: &RustString
);
1794 pub fn LLVMRustWriteArchive(Dst
: *const c_char
,
1796 Members
: *const &RustArchiveMember
<'_
>,
1800 pub fn LLVMRustArchiveMemberNew(Filename
: *const c_char
,
1801 Name
: *const c_char
,
1802 Child
: Option
<&ArchiveChild
<'a
>>)
1803 -> &'a
mut RustArchiveMember
<'a
>;
1804 pub fn LLVMRustArchiveMemberFree(Member
: &'a
mut RustArchiveMember
<'a
>);
1806 pub fn LLVMRustSetDataLayoutFromTargetMachine(M
: &'a Module
, TM
: &'a TargetMachine
);
1808 pub fn LLVMRustBuildOperandBundleDef(Name
: *const c_char
,
1809 Inputs
: *const &'a Value
,
1811 -> &'a
mut OperandBundleDef
<'a
>;
1812 pub fn LLVMRustFreeOperandBundleDef(Bundle
: &'a
mut OperandBundleDef
<'a
>);
1814 pub fn LLVMRustPositionBuilderAtStart(B
: &Builder
<'a
>, BB
: &'a BasicBlock
);
1816 pub fn LLVMRustSetComdat(M
: &'a Module
, V
: &'a Value
, Name
: *const c_char
, NameLen
: size_t
);
1817 pub fn LLVMRustUnsetComdat(V
: &Value
);
1818 pub fn LLVMRustSetModulePICLevel(M
: &Module
);
1819 pub fn LLVMRustSetModulePIELevel(M
: &Module
);
1820 pub fn LLVMRustModuleBufferCreate(M
: &Module
) -> &'
static mut ModuleBuffer
;
1821 pub fn LLVMRustModuleBufferPtr(p
: &ModuleBuffer
) -> *const u8;
1822 pub fn LLVMRustModuleBufferLen(p
: &ModuleBuffer
) -> usize;
1823 pub fn LLVMRustModuleBufferFree(p
: &'
static mut ModuleBuffer
);
1824 pub fn LLVMRustModuleCost(M
: &Module
) -> u64;
1826 pub fn LLVMRustThinLTOBufferCreate(M
: &Module
) -> &'
static mut ThinLTOBuffer
;
1827 pub fn LLVMRustThinLTOBufferFree(M
: &'
static mut ThinLTOBuffer
);
1828 pub fn LLVMRustThinLTOBufferPtr(M
: &ThinLTOBuffer
) -> *const c_char
;
1829 pub fn LLVMRustThinLTOBufferLen(M
: &ThinLTOBuffer
) -> size_t
;
1830 pub fn LLVMRustCreateThinLTOData(
1831 Modules
: *const ThinLTOModule
,
1833 PreservedSymbols
: *const *const c_char
,
1834 PreservedSymbolsLen
: c_uint
,
1835 ) -> Option
<&'
static mut ThinLTOData
>;
1836 pub fn LLVMRustPrepareThinLTORename(
1840 pub fn LLVMRustPrepareThinLTOResolveWeak(
1844 pub fn LLVMRustPrepareThinLTOInternalize(
1848 pub fn LLVMRustPrepareThinLTOImport(
1852 pub fn LLVMRustGetThinLTOModuleImports(
1853 Data
: *const ThinLTOData
,
1854 ModuleNameCallback
: ThinLTOModuleNameCallback
,
1855 CallbackPayload
: *mut c_void
,
1857 pub fn LLVMRustFreeThinLTOData(Data
: &'
static mut ThinLTOData
);
1858 pub fn LLVMRustParseBitcodeForLTO(
1862 Identifier
: *const c_char
,
1863 ) -> Option
<&Module
>;
1864 pub fn LLVMRustThinLTOGetDICompileUnit(M
: &Module
,
1865 CU1
: &mut *mut c_void
,
1866 CU2
: &mut *mut c_void
);
1867 pub fn LLVMRustThinLTOPatchDICompileUnit(M
: &Module
, CU
: *mut c_void
);
1869 pub fn LLVMRustLinkerNew(M
: &'a Module
) -> &'a
mut Linker
<'a
>;
1870 pub fn LLVMRustLinkerAdd(linker
: &Linker
<'_
>,
1871 bytecode
: *const c_char
,
1872 bytecode_len
: usize) -> bool
;
1873 pub fn LLVMRustLinkerFree(linker
: &'a
mut Linker
<'a
>);