2012-12-03 16:48:01 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2013-05-17 15:28:44 -07:00
|
|
|
|
2013-06-28 18:32:26 -04:00
|
|
|
use std::hashmap::HashMap;
|
|
|
|
use std::libc::{c_uint, c_ushort};
|
|
|
|
use std::option;
|
2011-05-12 17:24:54 +02:00
|
|
|
|
2013-06-15 22:16:47 +12:00
|
|
|
use middle::trans::type_::Type;
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub type Opcode = u32;
|
|
|
|
pub type Bool = c_uint;
|
2012-12-23 17:41:37 -05:00
|
|
|
|
2013-03-22 14:00:15 -07:00
|
|
|
pub static True: Bool = 1 as Bool;
|
|
|
|
pub static False: Bool = 0 as Bool;
|
2010-07-12 17:47:40 -07:00
|
|
|
|
2012-02-01 11:04:56 +01:00
|
|
|
// Consts for the LLVM CallConv type, pre-cast to uint.
|
2010-09-23 17:16:34 -07:00
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum CallConv {
|
2012-02-01 11:04:56 +01:00
|
|
|
CCallConv = 0,
|
|
|
|
FastCallConv = 8,
|
|
|
|
ColdCallConv = 9,
|
|
|
|
X86StdcallCallConv = 64,
|
|
|
|
X86FastcallCallConv = 65,
|
|
|
|
}
|
2010-09-23 17:16:34 -07:00
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum Visibility {
|
2012-02-01 11:04:56 +01:00
|
|
|
LLVMDefaultVisibility = 0,
|
|
|
|
HiddenVisibility = 1,
|
|
|
|
ProtectedVisibility = 2,
|
|
|
|
}
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum Linkage {
|
2012-02-01 11:04:56 +01:00
|
|
|
ExternalLinkage = 0,
|
|
|
|
AvailableExternallyLinkage = 1,
|
|
|
|
LinkOnceAnyLinkage = 2,
|
|
|
|
LinkOnceODRLinkage = 3,
|
2012-09-28 23:43:00 -07:00
|
|
|
LinkOnceODRAutoHideLinkage = 4,
|
|
|
|
WeakAnyLinkage = 5,
|
|
|
|
WeakODRLinkage = 6,
|
|
|
|
AppendingLinkage = 7,
|
|
|
|
InternalLinkage = 8,
|
|
|
|
PrivateLinkage = 9,
|
|
|
|
DLLImportLinkage = 10,
|
|
|
|
DLLExportLinkage = 11,
|
|
|
|
ExternalWeakLinkage = 12,
|
|
|
|
GhostLinkage = 13,
|
|
|
|
CommonLinkage = 14,
|
|
|
|
LinkerPrivateLinkage = 15,
|
|
|
|
LinkerPrivateWeakLinkage = 16,
|
2012-02-01 11:04:56 +01:00
|
|
|
}
|
2011-07-27 14:19:39 +02:00
|
|
|
|
2013-07-02 12:47:32 -07:00
|
|
|
#[deriving(Clone)]
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum Attribute {
|
2012-02-01 11:04:56 +01:00
|
|
|
ZExtAttribute = 1,
|
|
|
|
SExtAttribute = 2,
|
|
|
|
NoReturnAttribute = 4,
|
|
|
|
InRegAttribute = 8,
|
|
|
|
StructRetAttribute = 16,
|
|
|
|
NoUnwindAttribute = 32,
|
|
|
|
NoAliasAttribute = 64,
|
|
|
|
ByValAttribute = 128,
|
|
|
|
NestAttribute = 256,
|
|
|
|
ReadNoneAttribute = 512,
|
|
|
|
ReadOnlyAttribute = 1024,
|
|
|
|
NoInlineAttribute = 2048,
|
|
|
|
AlwaysInlineAttribute = 4096,
|
|
|
|
OptimizeForSizeAttribute = 8192,
|
|
|
|
StackProtectAttribute = 16384,
|
|
|
|
StackProtectReqAttribute = 32768,
|
|
|
|
// 31 << 16
|
|
|
|
AlignmentAttribute = 2031616,
|
|
|
|
NoCaptureAttribute = 2097152,
|
|
|
|
NoRedZoneAttribute = 4194304,
|
|
|
|
NoImplicitFloatAttribute = 8388608,
|
|
|
|
NakedAttribute = 16777216,
|
|
|
|
InlineHintAttribute = 33554432,
|
|
|
|
// 7 << 26
|
|
|
|
StackAttribute = 469762048,
|
|
|
|
ReturnsTwiceAttribute = 536870912,
|
|
|
|
// 1 << 30
|
|
|
|
UWTableAttribute = 1073741824,
|
|
|
|
NonLazyBindAttribute = 2147483648,
|
|
|
|
}
|
2011-07-27 14:19:39 +02:00
|
|
|
|
2012-05-17 16:17:11 -07:00
|
|
|
// enum for the LLVM IntPredicate type
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum IntPredicate {
|
2012-02-01 11:04:56 +01:00
|
|
|
IntEQ = 32,
|
|
|
|
IntNE = 33,
|
|
|
|
IntUGT = 34,
|
|
|
|
IntUGE = 35,
|
|
|
|
IntULT = 36,
|
|
|
|
IntULE = 37,
|
|
|
|
IntSGT = 38,
|
|
|
|
IntSGE = 39,
|
|
|
|
IntSLT = 40,
|
|
|
|
IntSLE = 41,
|
|
|
|
}
|
2010-09-28 14:01:21 -07:00
|
|
|
|
2012-05-17 16:17:11 -07:00
|
|
|
// enum for the LLVM RealPredicate type
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum RealPredicate {
|
2012-09-28 23:43:00 -07:00
|
|
|
RealPredicateFalse = 0,
|
2012-02-01 11:04:56 +01:00
|
|
|
RealOEQ = 1,
|
|
|
|
RealOGT = 2,
|
|
|
|
RealOGE = 3,
|
|
|
|
RealOLT = 4,
|
|
|
|
RealOLE = 5,
|
|
|
|
RealONE = 6,
|
|
|
|
RealORD = 7,
|
|
|
|
RealUNO = 8,
|
|
|
|
RealUEQ = 9,
|
|
|
|
RealUGT = 10,
|
|
|
|
RealUGE = 11,
|
|
|
|
RealULT = 12,
|
|
|
|
RealULE = 13,
|
|
|
|
RealUNE = 14,
|
2012-09-28 23:43:00 -07:00
|
|
|
RealPredicateTrue = 15,
|
2012-02-01 11:04:56 +01:00
|
|
|
}
|
|
|
|
|
2013-04-01 17:47:38 -07:00
|
|
|
// The LLVM TypeKind type - must stay in sync with the def of
|
2012-05-17 16:17:11 -07:00
|
|
|
// LLVMTypeKind in llvm/include/llvm-c/Core.h
|
2013-04-01 17:47:38 -07:00
|
|
|
pub type TypeKind = u32;
|
|
|
|
pub static Void: TypeKind = 0;
|
|
|
|
pub static Half: TypeKind = 1;
|
|
|
|
pub static Float: TypeKind = 2;
|
|
|
|
pub static Double: TypeKind = 3;
|
|
|
|
pub static X86_FP80: TypeKind = 4;
|
|
|
|
pub static FP128: TypeKind = 5;
|
|
|
|
pub static PPC_FP128: TypeKind = 6;
|
|
|
|
pub static Label: TypeKind = 7;
|
|
|
|
pub static Integer: TypeKind = 8;
|
|
|
|
pub static Function: TypeKind = 9;
|
|
|
|
pub static Struct: TypeKind = 10;
|
|
|
|
pub static Array: TypeKind = 11;
|
|
|
|
pub static Pointer: TypeKind = 12;
|
|
|
|
pub static Vector: TypeKind = 13;
|
|
|
|
pub static Metadata: TypeKind = 14;
|
|
|
|
pub static X86_MMX: TypeKind = 15;
|
2012-05-17 16:17:11 -07:00
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum AtomicBinOp {
|
2012-06-21 15:01:32 -07:00
|
|
|
Xchg = 0,
|
|
|
|
Add = 1,
|
|
|
|
Sub = 2,
|
|
|
|
And = 3,
|
|
|
|
Nand = 4,
|
|
|
|
Or = 5,
|
|
|
|
Xor = 6,
|
|
|
|
Max = 7,
|
|
|
|
Min = 8,
|
|
|
|
UMax = 9,
|
|
|
|
UMin = 10,
|
|
|
|
}
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum AtomicOrdering {
|
2012-06-21 15:01:32 -07:00
|
|
|
NotAtomic = 0,
|
|
|
|
Unordered = 1,
|
|
|
|
Monotonic = 2,
|
|
|
|
// Consume = 3, // Not specified yet.
|
|
|
|
Acquire = 4,
|
|
|
|
Release = 5,
|
|
|
|
AcquireRelease = 6,
|
|
|
|
SequentiallyConsistent = 7
|
|
|
|
}
|
|
|
|
|
2012-05-17 16:17:11 -07:00
|
|
|
// FIXME: Not used right now, but will be once #2334 is fixed
|
|
|
|
// Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum FileType {
|
2012-05-17 16:17:11 -07:00
|
|
|
AssemblyFile = 0,
|
|
|
|
ObjectFile = 1
|
|
|
|
}
|
|
|
|
|
2013-02-19 14:55:40 -05:00
|
|
|
pub enum Metadata {
|
|
|
|
MD_dbg = 0,
|
|
|
|
MD_tbaa = 1,
|
|
|
|
MD_prof = 2,
|
|
|
|
MD_fpmath = 3,
|
|
|
|
MD_range = 4,
|
|
|
|
MD_tbaa_struct = 5
|
|
|
|
}
|
|
|
|
|
2013-03-10 00:38:29 -08:00
|
|
|
// Inline Asm Dialect
|
|
|
|
pub enum AsmDialect {
|
|
|
|
AD_ATT = 0,
|
|
|
|
AD_Intel = 1
|
|
|
|
}
|
|
|
|
|
2012-02-01 11:04:56 +01:00
|
|
|
// Opaque pointer types
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum Module_opaque {}
|
|
|
|
pub type ModuleRef = *Module_opaque;
|
|
|
|
pub enum Context_opaque {}
|
|
|
|
pub type ContextRef = *Context_opaque;
|
|
|
|
pub enum Type_opaque {}
|
|
|
|
pub type TypeRef = *Type_opaque;
|
|
|
|
pub enum Value_opaque {}
|
|
|
|
pub type ValueRef = *Value_opaque;
|
|
|
|
pub enum BasicBlock_opaque {}
|
|
|
|
pub type BasicBlockRef = *BasicBlock_opaque;
|
|
|
|
pub enum Builder_opaque {}
|
|
|
|
pub type BuilderRef = *Builder_opaque;
|
2013-06-13 21:25:18 -07:00
|
|
|
pub enum ExecutionEngine_opaque {}
|
|
|
|
pub type ExecutionEngineRef = *ExecutionEngine_opaque;
|
2013-01-29 15:48:50 -08:00
|
|
|
pub enum MemoryBuffer_opaque {}
|
|
|
|
pub type MemoryBufferRef = *MemoryBuffer_opaque;
|
|
|
|
pub enum PassManager_opaque {}
|
|
|
|
pub type PassManagerRef = *PassManager_opaque;
|
|
|
|
pub enum PassManagerBuilder_opaque {}
|
|
|
|
pub type PassManagerBuilderRef = *PassManagerBuilder_opaque;
|
|
|
|
pub enum Use_opaque {}
|
|
|
|
pub type UseRef = *Use_opaque;
|
|
|
|
pub enum TargetData_opaque {}
|
|
|
|
pub type TargetDataRef = *TargetData_opaque;
|
|
|
|
pub enum ObjectFile_opaque {}
|
|
|
|
pub type ObjectFileRef = *ObjectFile_opaque;
|
|
|
|
pub enum SectionIterator_opaque {}
|
|
|
|
pub type SectionIteratorRef = *SectionIterator_opaque;
|
2013-05-28 11:15:31 +12:00
|
|
|
pub enum Pass_opaque {}
|
|
|
|
pub type PassRef = *Pass_opaque;
|
2011-02-28 16:36:08 -08:00
|
|
|
|
2013-06-14 11:38:29 -07:00
|
|
|
pub mod debuginfo {
|
|
|
|
use super::{ValueRef};
|
2013-06-14 11:59:49 -07:00
|
|
|
|
2013-06-14 11:38:29 -07:00
|
|
|
pub enum DIBuilder_opaque {}
|
|
|
|
pub type DIBuilderRef = *DIBuilder_opaque;
|
2013-06-14 11:59:49 -07:00
|
|
|
|
2013-06-14 11:38:29 -07:00
|
|
|
pub type DIDescriptor = ValueRef;
|
|
|
|
pub type DIScope = DIDescriptor;
|
|
|
|
pub type DILocation = DIDescriptor;
|
|
|
|
pub type DIFile = DIScope;
|
|
|
|
pub type DILexicalBlock = DIScope;
|
|
|
|
pub type DISubprogram = DIScope;
|
|
|
|
pub type DIType = DIDescriptor;
|
|
|
|
pub type DIBasicType = DIType;
|
|
|
|
pub type DIDerivedType = DIType;
|
|
|
|
pub type DICompositeType = DIDerivedType;
|
|
|
|
pub type DIVariable = DIDescriptor;
|
|
|
|
pub type DIArray = DIDescriptor;
|
|
|
|
pub type DISubrange = DIDescriptor;
|
|
|
|
|
|
|
|
pub enum DIDescriptorFlags {
|
|
|
|
FlagPrivate = 1 << 0,
|
|
|
|
FlagProtected = 1 << 1,
|
|
|
|
FlagFwdDecl = 1 << 2,
|
|
|
|
FlagAppleBlock = 1 << 3,
|
|
|
|
FlagBlockByrefStruct = 1 << 4,
|
|
|
|
FlagVirtual = 1 << 5,
|
|
|
|
FlagArtificial = 1 << 6,
|
|
|
|
FlagExplicit = 1 << 7,
|
|
|
|
FlagPrototyped = 1 << 8,
|
|
|
|
FlagObjcClassComplete = 1 << 9,
|
|
|
|
FlagObjectPointer = 1 << 10,
|
|
|
|
FlagVector = 1 << 11,
|
|
|
|
FlagStaticMember = 1 << 12
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
pub mod llvm {
|
2013-06-13 21:25:18 -07:00
|
|
|
use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, ExecutionEngineRef};
|
2013-03-10 00:38:29 -08:00
|
|
|
use super::{Bool, BuilderRef, ContextRef, MemoryBufferRef, ModuleRef};
|
|
|
|
use super::{ObjectFileRef, Opcode, PassManagerRef, PassManagerBuilderRef};
|
2013-03-05 14:42:58 -08:00
|
|
|
use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
|
2013-06-14 11:38:29 -07:00
|
|
|
use super::{ValueRef, PassRef};
|
|
|
|
use super::debuginfo::*;
|
2013-06-28 18:32:26 -04:00
|
|
|
use std::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong};
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
#[link_args = "-Lrustllvm -lrustllvm"]
|
|
|
|
#[link_name = "rustllvm"]
|
|
|
|
#[abi = "cdecl"]
|
2013-07-18 19:08:57 -07:00
|
|
|
extern {
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Create and destroy contexts. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMContextCreate() -> ContextRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMContextDispose(C: ContextRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetMDKindIDInContext(C: ContextRef,
|
|
|
|
Name: *c_char,
|
|
|
|
SLen: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> c_uint;
|
|
|
|
|
|
|
|
/* Create and destroy modules. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
|
|
|
|
C: ContextRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ModuleRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
|
2013-06-13 21:25:12 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeModule(M: ModuleRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Data layout. See Module::getDataLayout. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Target triple. See Module::getTargetTriple. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetTarget(M: ModuleRef) -> *c_char;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** See Module::dump. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDumpModule(M: ModuleRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** See Module::setModuleInlineAsm. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** See llvm::LLVMTypeKind::getTypeID. */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** See llvm::LLVMType::getContext. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on integer types */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
|
|
|
|
-> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on real types */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on function types */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFunctionType(ReturnType: TypeRef,
|
|
|
|
ParamTypes: *TypeRef,
|
|
|
|
ParamCount: c_uint,
|
|
|
|
IsVarArg: Bool)
|
|
|
|
-> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on struct types */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMStructTypeInContext(C: ContextRef,
|
|
|
|
ElementTypes: *TypeRef,
|
|
|
|
ElementCount: c_uint,
|
|
|
|
Packed: Bool)
|
|
|
|
-> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
|
|
|
|
Dest: *mut TypeRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on array, pointer, and vector types (sequence types) */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMArrayType(ElementType: TypeRef, ElementCount: c_uint)
|
|
|
|
-> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
|
|
|
|
-> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
|
|
|
|
-> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
|
|
|
|
-> *();
|
2013-06-13 21:25:18 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on other types */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on all values */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetValueName(Val: ValueRef) -> *c_char;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDumpValue(Val: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on Uses */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetUser(U: UseRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on Users */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on constants of any type */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
/* all zeroes */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
|
2013-05-19 16:03:52 -04:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-05-19 16:03:52 -04:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
/* only for int/vector */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsNull(Val: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on metadata */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMDStringInContext(C: ContextRef,
|
|
|
|
Str: *c_char,
|
|
|
|
SLen: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMDNodeInContext(C: ContextRef,
|
|
|
|
Vals: *ValueRef,
|
|
|
|
Count: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddNamedMetadataOperand(M: ModuleRef,
|
|
|
|
Str: *c_char,
|
|
|
|
Val: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on scalar constants */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *c_char, Radix: u8)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
|
|
|
|
Text: *c_char,
|
|
|
|
SLen: c_uint,
|
|
|
|
Radix: u8)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
|
|
|
|
Text: *c_char,
|
|
|
|
SLen: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
/* Operations on composite constants */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstStringInContext(C: ContextRef,
|
|
|
|
Str: *c_char,
|
|
|
|
Length: c_uint,
|
|
|
|
DontNullTerminate: Bool)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstStructInContext(C: ContextRef,
|
|
|
|
ConstantVals: *ValueRef,
|
|
|
|
Count: c_uint,
|
|
|
|
Packed: Bool)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstArray(ElementTy: TypeRef,
|
|
|
|
ConstantVals: *ValueRef,
|
|
|
|
Length: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstVector(ScalarConstantVals: *ValueRef, Size: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Constant expressions */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-02-06 15:37:34 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-02-06 15:37:34 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-02-06 15:37:34 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-01-29 15:48:50 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
|
|
|
|
RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstGEP(ConstantVal: ValueRef,
|
|
|
|
ConstantIndices: *ValueRef,
|
|
|
|
NumIndices: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
|
|
|
|
ConstantIndices: *ValueRef,
|
|
|
|
NumIndices: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-29 15:48:50 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntCast(ConstantVal: ValueRef,
|
|
|
|
ToType: TypeRef,
|
|
|
|
isSigned: Bool)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSelect(ConstantCondition: ValueRef,
|
|
|
|
ConstantIfTrue: ValueRef,
|
|
|
|
ConstantIfFalse: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
|
|
|
|
IndexConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
|
|
|
|
ElementValueConstant: ValueRef,
|
|
|
|
IndexConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
|
|
|
|
VectorBConstant: ValueRef,
|
|
|
|
MaskConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstExtractValue(AggConstant: ValueRef,
|
|
|
|
IdxList: *c_uint,
|
|
|
|
NumIdx: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstInsertValue(AggConstant: ValueRef,
|
|
|
|
ElementValueConstant: ValueRef,
|
|
|
|
IdxList: *c_uint,
|
|
|
|
NumIdx: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstInlineAsm(Ty: TypeRef,
|
|
|
|
AsmString: *c_char,
|
|
|
|
Constraints: *c_char,
|
|
|
|
HasSideEffects: Bool,
|
|
|
|
IsAlignStack: Bool)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
|
2010-08-18 00:19:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Operations on global variables, functions, and aliases (globals) */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetSection(Global: ValueRef) -> *c_char;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetSection(Global: ValueRef, Section: *c_char);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
|
2013-01-29 15:48:50 -08:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Operations on global variables */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Name: *c_char,
|
|
|
|
AddressSpace: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetInitializer(GlobalVar: ValueRef,
|
2013-03-05 14:42:58 -08:00
|
|
|
ConstantVal: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on aliases */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddAlias(M: ModuleRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Aliasee: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on functions */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddFunction(M: ModuleRef,
|
|
|
|
Name: *c_char,
|
|
|
|
FunctionTy: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *c_char) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDeleteFunction(Fn: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetOrInsertFunction(M: ModuleRef,
|
|
|
|
Name: *c_char,
|
|
|
|
FunctionTy: TypeRef)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetGC(Fn: ValueRef) -> *c_char;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef,
|
|
|
|
PA: c_ulonglong,
|
|
|
|
HighPA: c_ulonglong);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on parameters */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on basic blocks */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
|
|
|
|
Fn: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
|
|
|
|
BB: BasicBlockRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
|
2013-06-11 12:41:09 -07:00
|
|
|
|
2013-06-10 12:32:12 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
|
|
|
|
MoveAfter: BasicBlockRef);
|
2013-06-11 12:41:09 -07:00
|
|
|
|
2013-06-10 12:32:12 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef,
|
|
|
|
MoveBefore: BasicBlockRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on instructions */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
|
2013-07-21 16:19:34 +02:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on call sites */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddInstrAttribute(Instr: ValueRef,
|
|
|
|
index: c_uint,
|
|
|
|
IA: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
|
|
|
|
index: c_uint,
|
|
|
|
IA: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetInstrParamAlignment(Instr: ValueRef,
|
|
|
|
index: c_uint,
|
|
|
|
align: c_uint);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on call instructions (only) */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on phi nodes */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddIncoming(PhiNode: ValueRef,
|
|
|
|
IncomingValues: *ValueRef,
|
|
|
|
IncomingBlocks: *BasicBlockRef,
|
|
|
|
Count: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint)
|
|
|
|
-> BasicBlockRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Instruction builders */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPositionBuilder(Builder: BuilderRef,
|
|
|
|
Block: BasicBlockRef,
|
|
|
|
Instr: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
|
|
|
|
Instr: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
|
|
|
|
Block: BasicBlockRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
|
|
|
|
Instr: ValueRef,
|
|
|
|
Name: *c_char);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeBuilder(Builder: BuilderRef);
|
2013-06-13 21:25:18 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Metadata */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Terminators */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAggregateRet(B: BuilderRef,
|
|
|
|
RetVals: *ValueRef,
|
|
|
|
N: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildCondBr(B: BuilderRef,
|
|
|
|
If: ValueRef,
|
|
|
|
Then: BasicBlockRef,
|
|
|
|
Else: BasicBlockRef)
|
2013-01-29 15:48:50 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSwitch(B: BuilderRef,
|
|
|
|
V: ValueRef,
|
|
|
|
Else: BasicBlockRef,
|
|
|
|
NumCases: c_uint)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIndirectBr(B: BuilderRef,
|
|
|
|
Addr: ValueRef,
|
|
|
|
NumDests: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildInvoke(B: BuilderRef,
|
|
|
|
Fn: ValueRef,
|
|
|
|
Args: *ValueRef,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
Then: BasicBlockRef,
|
|
|
|
Catch: BasicBlockRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildLandingPad(B: BuilderRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
PersFn: ValueRef,
|
|
|
|
NumClauses: c_uint,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Add a case to the switch instruction */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddCase(Switch: ValueRef,
|
|
|
|
OnVal: ValueRef,
|
|
|
|
Dest: BasicBlockRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Add a destination to the indirectbr instruction */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Add a clause to the landing pad instruction */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Set the cleanup on a landing pad instruction */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Arithmetic */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNSWAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNUWAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNSWSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNUWSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNSWMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNUWMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildUDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildExactSDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildURem(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSRem(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFRem(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildShl(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildLShr(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAShr(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAnd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildOr(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildXor(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildBinOp(B: BuilderRef,
|
|
|
|
Op: Opcode,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2010-08-18 00:19:25 -07:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Memory */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildArrayMalloc(B: BuilderRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildArrayAlloca(B: BuilderRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildLoad(B: BuilderRef,
|
|
|
|
PointerVal: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-05-12 21:22:20 +02:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-05-12 21:22:20 +02:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildGEP(B: BuilderRef,
|
|
|
|
Pointer: ValueRef,
|
|
|
|
Indices: *ValueRef,
|
|
|
|
NumIndices: c_uint,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
|
|
|
|
Pointer: ValueRef,
|
|
|
|
Indices: *ValueRef,
|
|
|
|
NumIndices: c_uint,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildStructGEP(B: BuilderRef,
|
|
|
|
Pointer: ValueRef,
|
|
|
|
Idx: c_uint,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildGlobalString(B: BuilderRef,
|
|
|
|
Str: *c_char,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
|
|
|
|
Str: *c_char,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
|
|
|
|
|
|
|
/* Casts */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildTrunc(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildZExt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSExt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFPToUI(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFPToSI(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildUIToFP(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSIToFP(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFPTrunc(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFPExt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildPtrToInt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIntToPtr(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildBitCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
|
2013-03-05 14:42:58 -08:00
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
2013-08-02 14:30:00 -07:00
|
|
|
-> ValueRef;
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMBuildCast(B: BuilderRef,
|
|
|
|
Op: Opcode,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char) -> ValueRef;
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMBuildPointerCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIntCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFPCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Comparisons */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildICmp(B: BuilderRef,
|
|
|
|
Op: c_uint,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildFCmp(B: BuilderRef,
|
|
|
|
Op: c_uint,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Miscellaneous instructions */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildCall(B: BuilderRef,
|
|
|
|
Fn: ValueRef,
|
|
|
|
Args: *ValueRef,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildSelect(B: BuilderRef,
|
|
|
|
If: ValueRef,
|
|
|
|
Then: ValueRef,
|
|
|
|
Else: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildVAArg(B: BuilderRef,
|
|
|
|
list: ValueRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildExtractElement(B: BuilderRef,
|
|
|
|
VecVal: ValueRef,
|
|
|
|
Index: ValueRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildInsertElement(B: BuilderRef,
|
|
|
|
VecVal: ValueRef,
|
|
|
|
EltVal: ValueRef,
|
|
|
|
Index: ValueRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildShuffleVector(B: BuilderRef,
|
|
|
|
V1: ValueRef,
|
|
|
|
V2: ValueRef,
|
|
|
|
Mask: ValueRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildExtractValue(B: BuilderRef,
|
|
|
|
AggVal: ValueRef,
|
|
|
|
Index: c_uint,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildInsertValue(B: BuilderRef,
|
|
|
|
AggVal: ValueRef,
|
|
|
|
EltVal: ValueRef,
|
|
|
|
Index: c_uint,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-01-10 21:23:07 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildPtrDiff(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2010-08-12 12:10:36 -07:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Atomic Operations */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAtomicLoad(B: BuilderRef,
|
|
|
|
PointerVal: ValueRef,
|
|
|
|
Name: *c_char,
|
|
|
|
Order: AtomicOrdering,
|
|
|
|
Alignment: c_uint)
|
|
|
|
-> ValueRef;
|
2013-05-12 21:22:20 +02:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAtomicStore(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
Ptr: ValueRef,
|
|
|
|
Order: AtomicOrdering,
|
|
|
|
Alignment: c_uint)
|
|
|
|
-> ValueRef;
|
2013-05-13 13:33:34 +02:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
CMP: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Order: AtomicOrdering)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildAtomicRMW(B: BuilderRef,
|
|
|
|
Op: AtomicBinOp,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Order: AtomicOrdering)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
|
2013-07-28 19:48:16 +12:00
|
|
|
|
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Selected entries from the downcasts. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Writes a module to the specified path. Returns 0 on success. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *c_char) -> c_int;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Creates target data from a target layout string. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef;
|
|
|
|
/// Adds the target data to the given pass manager. The pass manager
|
|
|
|
/// references the target data only weakly.
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Number of bytes clobbered when doing a Store to *T. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
|
|
|
|
-> c_ulonglong;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Number of bytes clobbered when doing a Store to *T. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
|
|
|
|
-> c_ulonglong;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Distance between successive elements in an array of T.
|
|
|
|
Includes ABI padding. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Returns the preferred alignment of a type. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
|
|
|
|
-> c_uint;
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Returns the minimum alignment of a type. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
|
|
|
|
-> c_uint;
|
2013-06-26 16:00:42 +02:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
/// Computes the byte offset of the indexed struct element for a
|
|
|
|
/// target.
|
2013-06-26 16:00:42 +02:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMOffsetOfElement(TD: TargetDataRef,
|
|
|
|
StructTy: TypeRef,
|
|
|
|
Element: c_uint)
|
|
|
|
-> c_ulonglong;
|
2013-06-26 16:00:42 +02:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/**
|
|
|
|
* Returns the minimum alignment of a type when part of a call frame.
|
|
|
|
*/
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef)
|
|
|
|
-> c_uint;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Disposes target data. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeTargetData(TD: TargetDataRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Creates a pass manager. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreatePassManager() -> PassManagerRef;
|
2013-05-28 11:15:31 +12:00
|
|
|
/** Creates a function-by-function pass manager */
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef)
|
|
|
|
-> PassManagerRef;
|
2013-05-28 11:15:31 +12:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Disposes a pass manager. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposePassManager(PM: PassManagerRef);
|
2013-05-28 11:15:31 +12:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Runs a pass manager on a module. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-05-28 11:15:31 +12:00
|
|
|
/** Runs the function passes on the provided function. */
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef)
|
|
|
|
-> Bool;
|
2013-05-28 11:15:31 +12:00
|
|
|
|
|
|
|
/** Initializes all the function passes scheduled in the manager */
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool;
|
2013-05-28 11:15:31 +12:00
|
|
|
|
|
|
|
/** Finalizes all the function passes scheduled in the manager */
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
|
2013-05-28 11:15:31 +12:00
|
|
|
|
2013-05-29 20:08:20 +12:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInitializePasses();
|
2013-05-29 20:08:20 +12:00
|
|
|
|
2013-05-28 11:15:31 +12:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddPass(PM: PassManagerRef, P: PassRef);
|
2013-05-28 11:15:31 +12:00
|
|
|
|
2013-05-29 20:08:20 +12:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreatePass(PassName: *c_char) -> PassRef;
|
2013-05-29 20:08:20 +12:00
|
|
|
|
2013-06-19 15:18:25 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDestroyPass(P: PassRef);
|
2013-06-19 15:18:25 -07:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Adds a verification pass. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddVerifierPass(PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddReassociatePass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddLICMPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddGVNPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddSCCPPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
|
|
|
|
OptimizationLevel: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
threshold: c_uint);
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderPopulateModulePassManager(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Destroys a memory buffer. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
/* Stuff that's in rustllvm/ because it's not upstream yet. */
|
|
|
|
|
|
|
|
/** Opens an object file. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Closes an object file. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Enumerates the sections in an object file. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Destroys a section iterator. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Returns true if the section iterator is at the end of the section
|
|
|
|
list: */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
|
|
|
|
SI: SectionIteratorRef)
|
|
|
|
-> Bool;
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Moves the section iterator to point to the next section. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Returns the current section name. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Returns the current section size. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Returns the current section contents as a string buffer. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Reads the given file and returns it as a memory buffer. Use
|
|
|
|
LLVMDisposeMemoryBuffer() to get rid of it. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char)
|
|
|
|
-> MemoryBufferRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustWriteOutputFile(PM: PassManagerRef,
|
|
|
|
M: ModuleRef,
|
|
|
|
Triple: *c_char,
|
|
|
|
Feature: *c_char,
|
|
|
|
Output: *c_char,
|
|
|
|
// FIXME: When #2334 is fixed,
|
|
|
|
// change c_uint to FileType
|
|
|
|
FileType: c_uint,
|
|
|
|
OptLevel: c_int,
|
|
|
|
EnableSegmentedStacks: bool)
|
|
|
|
-> bool;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Returns a string describing the last error caused by an LLVMRust*
|
|
|
|
call. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustGetLastError() -> *c_char;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Prepare the JIT. Returns a memory manager that can load crates. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustPrepareJIT(__morestack: *()) -> *();
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Load a crate into the memory manager. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustLoadCrate(MM: *(), Filename: *c_char) -> bool;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Execute the JIT engine. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustBuildJIT(MM: *(),
|
|
|
|
M: ModuleRef,
|
|
|
|
EnableSegmentedStacks: bool)
|
|
|
|
-> ExecutionEngineRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Parses the bitcode in the given memory buffer. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Parses LLVM asm in the given file */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustParseAssemblyFile(Filename: *c_char, C: ContextRef)
|
|
|
|
-> ModuleRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustAddPrintModulePass(PM: PassManagerRef,
|
|
|
|
M: ModuleRef,
|
|
|
|
Output: *c_char);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Turn on LLVM pass-timing. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustEnableTimePasses();
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/// Print the pass timings since static dtors aren't picking them up.
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustPrintPassTimings();
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-06-13 21:25:12 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustStartMultithreading() -> bool;
|
2013-06-13 21:25:12 -07:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char) -> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMStructSetBody(StructTy: TypeRef,
|
|
|
|
ElementTypes: *TypeRef,
|
|
|
|
ElementCount: c_uint,
|
|
|
|
Packed: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNamedStruct(S: TypeRef,
|
|
|
|
ConstantVals: *ValueRef,
|
|
|
|
Count: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Enables LLVM debug output. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetDebug(Enabled: c_int);
|
2013-03-09 22:37:50 -08:00
|
|
|
|
|
|
|
/** Prepares inline assembly. */
|
2013-03-29 16:55:04 -07:00
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInlineAsm(Ty: TypeRef,
|
|
|
|
AsmString: *c_char,
|
|
|
|
Constraints: *c_char,
|
|
|
|
SideEffects: Bool,
|
|
|
|
AlignStack: Bool,
|
|
|
|
Dialect: c_uint)
|
|
|
|
-> ValueRef;
|
2013-05-28 11:15:31 +12:00
|
|
|
|
2013-06-14 11:38:29 -07:00
|
|
|
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
|
2013-06-14 11:38:29 -07:00
|
|
|
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef);
|
2013-06-14 11:38:29 -07:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
|
|
|
|
Lang: c_uint,
|
|
|
|
File: *c_char,
|
|
|
|
Dir: *c_char,
|
|
|
|
Producer: *c_char,
|
|
|
|
isOptimized: bool,
|
|
|
|
Flags: *c_char,
|
|
|
|
RuntimeVer: c_uint,
|
|
|
|
SplitName: *c_char);
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
|
|
|
|
Filename: *c_char,
|
|
|
|
Directory: *c_char)
|
|
|
|
-> DIFile;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
|
|
|
|
File: DIFile,
|
|
|
|
ParameterTypes: DIArray)
|
|
|
|
-> DICompositeType;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef,
|
|
|
|
Scope: DIDescriptor,
|
|
|
|
Name: *c_char,
|
|
|
|
LinkageName: *c_char,
|
|
|
|
File: DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
Ty: DIType,
|
|
|
|
isLocalToUnit: bool,
|
|
|
|
isDefinition: bool,
|
|
|
|
ScopeLine: c_uint,
|
|
|
|
Flags: c_uint,
|
|
|
|
isOptimized: bool,
|
|
|
|
Fn: ValueRef,
|
|
|
|
TParam: ValueRef,
|
|
|
|
Decl: ValueRef)
|
|
|
|
-> DISubprogram;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
|
|
|
|
Name: *c_char,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Encoding: c_uint)
|
|
|
|
-> DIBasicType;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
|
|
|
|
PointeeTy: DIType,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Name: *c_char)
|
|
|
|
-> DIDerivedType;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef,
|
|
|
|
Scope: DIDescriptor,
|
|
|
|
Name: *c_char,
|
|
|
|
File: DIFile,
|
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Flags: c_uint,
|
|
|
|
DerivedFrom: DIType,
|
|
|
|
Elements: DIArray,
|
|
|
|
RunTimeLang: c_uint,
|
|
|
|
VTableHolder: ValueRef)
|
|
|
|
-> DICompositeType;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef,
|
|
|
|
Scope: DIDescriptor,
|
|
|
|
Name: *c_char,
|
|
|
|
File: DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
OffsetInBits: c_ulonglong,
|
|
|
|
Flags: c_uint,
|
|
|
|
Ty: DIType)
|
|
|
|
-> DIDerivedType;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
|
|
|
|
Scope: DIDescriptor,
|
|
|
|
File: DIFile,
|
|
|
|
Line: c_uint,
|
|
|
|
Col: c_uint)
|
|
|
|
-> DILexicalBlock;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
|
|
|
|
Tag: c_uint,
|
|
|
|
Scope: DIDescriptor,
|
|
|
|
Name: *c_char,
|
|
|
|
File: DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
Ty: DIType,
|
|
|
|
AlwaysPreserve: bool,
|
|
|
|
Flags: c_uint,
|
|
|
|
ArgNo: c_uint)
|
|
|
|
-> DIVariable;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
|
|
|
|
Size: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Ty: DIType,
|
|
|
|
Subscripts: DIArray)
|
|
|
|
-> DIType;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
|
|
|
|
Size: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Ty: DIType,
|
|
|
|
Subscripts: DIArray)
|
|
|
|
-> DIType;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
|
|
|
|
Lo: c_longlong,
|
|
|
|
Count: c_longlong)
|
|
|
|
-> DISubrange;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
|
|
|
|
Ptr: *DIDescriptor,
|
|
|
|
Count: c_uint)
|
|
|
|
-> DIArray;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
VarInfo: DIVariable,
|
|
|
|
InsertAtEnd: BasicBlockRef)
|
|
|
|
-> ValueRef;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
VarInfo: DIVariable,
|
|
|
|
InsertBefore: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
|
|
|
|
Name: *c_char,
|
|
|
|
Val: c_ulonglong)
|
|
|
|
-> ValueRef;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
|
|
|
#[fast_ffi]
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
|
|
|
|
Scope: ValueRef,
|
|
|
|
Name: *c_char,
|
|
|
|
File: ValueRef,
|
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Elements: ValueRef,
|
|
|
|
ClassType: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
|
|
|
|
#[fast_ffi]
|
|
|
|
pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
|
|
|
|
Scope: ValueRef,
|
|
|
|
Name: *c_char,
|
|
|
|
File: ValueRef,
|
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Flags: c_uint,
|
|
|
|
Elements: ValueRef,
|
|
|
|
RunTimeLang: c_uint)
|
|
|
|
-> ValueRef;
|
2013-07-02 18:10:24 +02:00
|
|
|
}
|
|
|
|
}
|
2011-03-25 18:44:52 -07:00
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn SetInstructionCallConv(Instr: ValueRef, CC: CallConv) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMSetInstructionCallConv(Instr, CC as c_uint);
|
|
|
|
}
|
2012-02-01 11:04:56 +01:00
|
|
|
}
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn SetFunctionCallConv(Fn: ValueRef, CC: CallConv) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMSetFunctionCallConv(Fn, CC as c_uint);
|
|
|
|
}
|
2012-02-01 11:04:56 +01:00
|
|
|
}
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn SetLinkage(Global: ValueRef, Link: Linkage) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMSetLinkage(Global, Link as c_uint);
|
|
|
|
}
|
2012-02-01 11:04:56 +01:00
|
|
|
}
|
|
|
|
|
2013-05-19 20:18:56 -04:00
|
|
|
pub fn ConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
|
|
|
|
unsafe {
|
2013-05-19 22:08:59 -04:00
|
|
|
llvm::LLVMConstICmp(Pred as c_ushort, V1, V2)
|
2013-05-19 20:18:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pub fn ConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
|
|
|
|
unsafe {
|
2013-05-19 22:08:59 -04:00
|
|
|
llvm::LLVMConstFCmp(Pred as c_ushort, V1, V2)
|
2013-05-19 20:18:56 -04:00
|
|
|
}
|
|
|
|
}
|
2010-12-01 19:03:47 -08:00
|
|
|
/* Memory-managed object interface to type handles. */
|
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub struct TypeNames {
|
2013-06-15 22:16:47 +12:00
|
|
|
type_names: HashMap<TypeRef, ~str>,
|
|
|
|
named_types: HashMap<~str, TypeRef>
|
2013-02-19 02:40:42 -05:00
|
|
|
}
|
2011-02-17 18:16:51 -08:00
|
|
|
|
2013-06-15 14:31:52 +12:00
|
|
|
impl TypeNames {
|
|
|
|
pub fn new() -> TypeNames {
|
|
|
|
TypeNames {
|
|
|
|
type_names: HashMap::new(),
|
|
|
|
named_types: HashMap::new()
|
|
|
|
}
|
2013-02-19 02:40:42 -05:00
|
|
|
}
|
2011-02-17 18:16:51 -08:00
|
|
|
|
2013-06-15 22:16:47 +12:00
|
|
|
pub fn associate_type(&mut self, s: &str, t: &Type) {
|
|
|
|
assert!(self.type_names.insert(t.to_ref(), s.to_owned()));
|
|
|
|
assert!(self.named_types.insert(s.to_owned(), t.to_ref()));
|
2013-06-15 14:31:52 +12:00
|
|
|
}
|
2010-12-23 17:05:27 -08:00
|
|
|
|
2013-06-15 22:16:47 +12:00
|
|
|
pub fn find_name<'r>(&'r self, ty: &Type) -> Option<&'r str> {
|
2013-06-16 22:52:44 +12:00
|
|
|
match self.type_names.find(&ty.to_ref()) {
|
2013-06-15 22:16:47 +12:00
|
|
|
Some(a) => Some(a.slice(0, a.len())),
|
|
|
|
None => None
|
|
|
|
}
|
2013-06-15 14:31:52 +12:00
|
|
|
}
|
2010-12-23 17:05:27 -08:00
|
|
|
|
2013-06-15 22:16:47 +12:00
|
|
|
pub fn find_type(&self, s: &str) -> Option<Type> {
|
|
|
|
self.named_types.find_equiv(&s).map_consume(|x| Type::from_ref(*x))
|
2013-06-15 14:31:52 +12:00
|
|
|
}
|
2010-09-24 14:56:04 -07:00
|
|
|
|
2013-06-25 13:27:54 -07:00
|
|
|
// We have a depth count, because we seem to make infinite types.
|
|
|
|
pub fn type_to_str_depth(&self, ty: Type, depth: int) -> ~str {
|
2013-06-15 14:31:52 +12:00
|
|
|
match self.find_name(&ty) {
|
|
|
|
option::Some(name) => return name.to_owned(),
|
|
|
|
None => ()
|
2010-09-24 14:56:04 -07:00
|
|
|
}
|
|
|
|
|
2013-06-25 13:27:54 -07:00
|
|
|
if depth == 0 {
|
|
|
|
return ~"###";
|
|
|
|
}
|
|
|
|
|
2013-06-15 14:31:52 +12:00
|
|
|
unsafe {
|
2013-06-16 22:52:44 +12:00
|
|
|
let kind = ty.kind();
|
2013-06-15 14:31:52 +12:00
|
|
|
|
|
|
|
match kind {
|
|
|
|
Void => ~"Void",
|
|
|
|
Half => ~"Half",
|
2013-06-25 13:27:47 -07:00
|
|
|
Float => ~"Float",
|
2013-06-15 14:31:52 +12:00
|
|
|
Double => ~"Double",
|
|
|
|
X86_FP80 => ~"X86_FP80",
|
|
|
|
FP128 => ~"FP128",
|
|
|
|
PPC_FP128 => ~"PPC_FP128",
|
|
|
|
Label => ~"Label",
|
|
|
|
Vector => ~"Vector",
|
|
|
|
Metadata => ~"Metadata",
|
|
|
|
X86_MMX => ~"X86_MMAX",
|
|
|
|
Integer => {
|
2013-06-16 22:52:44 +12:00
|
|
|
fmt!("i%d", llvm::LLVMGetIntTypeWidth(ty.to_ref()) as int)
|
2013-01-10 21:23:07 -08:00
|
|
|
}
|
2013-06-15 14:31:52 +12:00
|
|
|
Function => {
|
2013-06-16 22:52:44 +12:00
|
|
|
let out_ty = ty.return_type();
|
|
|
|
let args = ty.func_params();
|
2013-06-25 13:27:54 -07:00
|
|
|
let args =
|
|
|
|
args.map(|&ty| self.type_to_str_depth(ty, depth-1)).connect(", ");
|
|
|
|
let out_ty = self.type_to_str_depth(out_ty, depth-1);
|
2013-06-15 14:31:52 +12:00
|
|
|
fmt!("fn(%s) -> %s", args, out_ty)
|
2013-01-10 21:23:07 -08:00
|
|
|
}
|
2013-06-15 14:31:52 +12:00
|
|
|
Struct => {
|
2013-06-16 22:52:44 +12:00
|
|
|
let tys = ty.field_types();
|
2013-06-25 13:27:54 -07:00
|
|
|
let tys = tys.map(|&ty| self.type_to_str_depth(ty, depth-1)).connect(", ");
|
2013-06-15 14:31:52 +12:00
|
|
|
fmt!("{%s}", tys)
|
|
|
|
}
|
|
|
|
Array => {
|
2013-06-16 22:52:44 +12:00
|
|
|
let el_ty = ty.element_type();
|
2013-06-25 13:27:54 -07:00
|
|
|
let el_ty = self.type_to_str_depth(el_ty, depth-1);
|
2013-06-16 22:52:44 +12:00
|
|
|
let len = ty.array_length();
|
2013-06-15 14:31:52 +12:00
|
|
|
fmt!("[%s x %u]", el_ty, len)
|
|
|
|
}
|
|
|
|
Pointer => {
|
2013-06-16 22:52:44 +12:00
|
|
|
let el_ty = ty.element_type();
|
2013-06-25 13:27:54 -07:00
|
|
|
let el_ty = self.type_to_str_depth(el_ty, depth-1);
|
2013-06-15 14:31:52 +12:00
|
|
|
fmt!("*%s", el_ty)
|
|
|
|
}
|
2013-06-15 15:16:03 +12:00
|
|
|
_ => fail!("Unknown Type Kind (%u)", kind as uint)
|
2013-06-15 14:31:52 +12:00
|
|
|
}
|
2013-01-10 21:23:07 -08:00
|
|
|
}
|
2010-09-24 14:56:04 -07:00
|
|
|
}
|
2013-06-15 15:16:03 +12:00
|
|
|
|
2013-06-25 13:27:54 -07:00
|
|
|
pub fn type_to_str(&self, ty: Type) -> ~str {
|
|
|
|
self.type_to_str_depth(ty, 30)
|
|
|
|
}
|
|
|
|
|
2013-06-15 15:16:03 +12:00
|
|
|
pub fn val_to_str(&self, val: ValueRef) -> ~str {
|
|
|
|
unsafe {
|
2013-06-16 22:52:44 +12:00
|
|
|
let ty = Type::from_ref(llvm::LLVMTypeOf(val));
|
|
|
|
self.type_to_str(ty)
|
2013-06-15 15:16:03 +12:00
|
|
|
}
|
|
|
|
}
|
2010-09-24 14:56:04 -07:00
|
|
|
}
|
|
|
|
|
2011-06-30 14:46:17 +02:00
|
|
|
|
2010-12-03 16:55:59 -08:00
|
|
|
/* Memory-managed interface to target data. */
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub struct target_data_res {
|
2012-09-06 19:40:15 -07:00
|
|
|
TD: TargetDataRef,
|
2013-02-27 19:13:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for target_data_res {
|
2013-06-20 21:06:13 -04:00
|
|
|
fn drop(&self) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMDisposeTargetData(self.TD);
|
|
|
|
}
|
|
|
|
}
|
2010-12-03 16:55:59 -08:00
|
|
|
}
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn target_data_res(TD: TargetDataRef) -> target_data_res {
|
2012-09-05 15:58:43 -07:00
|
|
|
target_data_res {
|
|
|
|
TD: TD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub struct TargetData {
|
|
|
|
lltd: TargetDataRef,
|
|
|
|
dtor: @target_data_res
|
|
|
|
}
|
2010-12-03 16:55:59 -08:00
|
|
|
|
2013-03-20 01:17:42 -04:00
|
|
|
pub fn mk_target_data(string_rep: &str) -> TargetData {
|
2013-07-22 21:41:46 -07:00
|
|
|
let lltd = do string_rep.as_c_str |buf| {
|
|
|
|
unsafe { llvm::LLVMCreateTargetData(buf) }
|
|
|
|
};
|
2013-02-19 02:40:42 -05:00
|
|
|
|
|
|
|
TargetData {
|
|
|
|
lltd: lltd,
|
|
|
|
dtor: @target_data_res(lltd)
|
|
|
|
}
|
2010-12-03 16:55:59 -08:00
|
|
|
}
|
|
|
|
|
2010-12-06 17:17:49 -08:00
|
|
|
/* Memory-managed interface to pass managers. */
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub struct pass_manager_res {
|
2012-09-06 19:40:15 -07:00
|
|
|
PM: PassManagerRef,
|
2013-02-27 19:13:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for pass_manager_res {
|
2013-06-20 21:06:13 -04:00
|
|
|
fn drop(&self) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMDisposePassManager(self.PM);
|
|
|
|
}
|
|
|
|
}
|
2010-12-06 17:17:49 -08:00
|
|
|
}
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn pass_manager_res(PM: PassManagerRef) -> pass_manager_res {
|
2012-09-05 15:58:43 -07:00
|
|
|
pass_manager_res {
|
|
|
|
PM: PM
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub struct PassManager {
|
|
|
|
llpm: PassManagerRef,
|
|
|
|
dtor: @pass_manager_res
|
|
|
|
}
|
2010-12-06 17:17:49 -08:00
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub fn mk_pass_manager() -> PassManager {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
let llpm = llvm::LLVMCreatePassManager();
|
2013-02-19 02:40:42 -05:00
|
|
|
|
|
|
|
PassManager {
|
|
|
|
llpm: llpm,
|
|
|
|
dtor: @pass_manager_res(llpm)
|
|
|
|
}
|
2013-01-10 21:23:07 -08:00
|
|
|
}
|
2010-12-06 17:17:49 -08:00
|
|
|
}
|
|
|
|
|
2011-03-15 12:27:15 -07:00
|
|
|
/* Memory-managed interface to object files. */
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub struct object_file_res {
|
2012-09-06 19:40:15 -07:00
|
|
|
ObjectFile: ObjectFileRef,
|
2013-02-27 19:13:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for object_file_res {
|
2013-06-20 21:06:13 -04:00
|
|
|
fn drop(&self) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMDisposeObjectFile(self.ObjectFile);
|
|
|
|
}
|
|
|
|
}
|
2011-03-15 12:27:15 -07:00
|
|
|
}
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn object_file_res(ObjFile: ObjectFileRef) -> object_file_res {
|
2012-09-05 15:58:43 -07:00
|
|
|
object_file_res {
|
2012-11-06 18:41:06 -08:00
|
|
|
ObjectFile: ObjFile
|
2012-09-05 15:58:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub struct ObjectFile {
|
|
|
|
llof: ObjectFileRef,
|
|
|
|
dtor: @object_file_res
|
|
|
|
}
|
2011-03-15 12:27:15 -07:00
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub fn mk_object_file(llmb: MemoryBufferRef) -> Option<ObjectFile> {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
let llof = llvm::LLVMCreateObjectFile(llmb);
|
2013-02-19 02:40:42 -05:00
|
|
|
if llof as int == 0 { return option::None::<ObjectFile>; }
|
|
|
|
|
|
|
|
option::Some(ObjectFile {
|
|
|
|
llof: llof,
|
|
|
|
dtor: @object_file_res(llof)
|
|
|
|
})
|
2013-01-10 21:23:07 -08:00
|
|
|
}
|
2011-03-15 12:27:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Memory-managed interface to section iterators. */
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub struct section_iter_res {
|
2012-09-06 19:40:15 -07:00
|
|
|
SI: SectionIteratorRef,
|
2013-02-27 19:13:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for section_iter_res {
|
2013-06-20 21:06:13 -04:00
|
|
|
fn drop(&self) {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
llvm::LLVMDisposeSectionIterator(self.SI);
|
|
|
|
}
|
|
|
|
}
|
2011-03-15 12:27:15 -07:00
|
|
|
}
|
|
|
|
|
2013-01-29 15:48:50 -08:00
|
|
|
pub fn section_iter_res(SI: SectionIteratorRef) -> section_iter_res {
|
2012-09-05 15:58:43 -07:00
|
|
|
section_iter_res {
|
|
|
|
SI: SI
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub struct SectionIter {
|
|
|
|
llsi: SectionIteratorRef,
|
|
|
|
dtor: @section_iter_res
|
|
|
|
}
|
2011-03-15 12:27:15 -07:00
|
|
|
|
2013-02-19 02:40:42 -05:00
|
|
|
pub fn mk_section_iter(llof: ObjectFileRef) -> SectionIter {
|
2013-01-10 21:23:07 -08:00
|
|
|
unsafe {
|
|
|
|
let llsi = llvm::LLVMGetSections(llof);
|
2013-02-19 02:40:42 -05:00
|
|
|
SectionIter {
|
|
|
|
llsi: llsi,
|
|
|
|
dtor: @section_iter_res(llsi)
|
|
|
|
}
|
2013-01-10 21:23:07 -08:00
|
|
|
}
|
2011-03-15 12:27:15 -07:00
|
|
|
}
|