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-08-14 21:41:40 -04:00
|
|
|
// LLVM wrappers are intended to be called from trans,
|
|
|
|
// which already runs in a #[fixed_stack_segment]
|
|
|
|
#[allow(cstack)];
|
2013-09-30 17:44:58 +02:00
|
|
|
#[allow(non_uppercase_pattern_statics)];
|
2013-08-14 21:41:40 -04:00
|
|
|
|
2013-08-03 17:13:14 -07:00
|
|
|
use std::c_str::ToCStr;
|
2013-06-28 18:32:26 -04:00
|
|
|
use std::hashmap::HashMap;
|
2013-10-11 19:56:11 -04:00
|
|
|
use std::libc::{c_uint, c_ushort, c_void, free};
|
|
|
|
use std::str::raw::from_c_str;
|
2013-06-28 18:32:26 -04:00
|
|
|
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 {
|
2013-05-25 21:26:08 -05:00
|
|
|
ZExtAttribute = 1 << 0,
|
|
|
|
SExtAttribute = 1 << 1,
|
|
|
|
NoReturnAttribute = 1 << 2,
|
|
|
|
InRegAttribute = 1 << 3,
|
|
|
|
StructRetAttribute = 1 << 4,
|
|
|
|
NoUnwindAttribute = 1 << 5,
|
|
|
|
NoAliasAttribute = 1 << 6,
|
|
|
|
ByValAttribute = 1 << 7,
|
|
|
|
NestAttribute = 1 << 8,
|
|
|
|
ReadNoneAttribute = 1 << 9,
|
|
|
|
ReadOnlyAttribute = 1 << 10,
|
|
|
|
NoInlineAttribute = 1 << 11,
|
|
|
|
AlwaysInlineAttribute = 1 << 12,
|
|
|
|
OptimizeForSizeAttribute = 1 << 13,
|
|
|
|
StackProtectAttribute = 1 << 14,
|
|
|
|
StackProtectReqAttribute = 1 << 15,
|
|
|
|
AlignmentAttribute = 31 << 16,
|
|
|
|
NoCaptureAttribute = 1 << 21,
|
|
|
|
NoRedZoneAttribute = 1 << 22,
|
|
|
|
NoImplicitFloatAttribute = 1 << 23,
|
|
|
|
NakedAttribute = 1 << 24,
|
|
|
|
InlineHintAttribute = 1 << 25,
|
|
|
|
StackAttribute = 7 << 26,
|
|
|
|
ReturnsTwiceAttribute = 1 << 29,
|
|
|
|
UWTableAttribute = 1 << 30,
|
|
|
|
NonLazyBindAttribute = 1 << 31,
|
2012-02-01 11:04:56 +01:00
|
|
|
}
|
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
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2013-08-30 17:56:04 -07:00
|
|
|
#[deriving(Eq)]
|
2013-08-22 20:58:42 -07:00
|
|
|
pub enum CodeGenOptLevel {
|
|
|
|
CodeGenLevelNone = 0,
|
|
|
|
CodeGenLevelLess = 1,
|
|
|
|
CodeGenLevelDefault = 2,
|
|
|
|
CodeGenLevelAggressive = 3,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum RelocMode {
|
|
|
|
RelocDefault = 0,
|
|
|
|
RelocStatic = 1,
|
|
|
|
RelocPIC = 2,
|
|
|
|
RelocDynamicNoPic = 3,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum CodeGenModel {
|
|
|
|
CodeModelDefault = 0,
|
|
|
|
CodeModelJITDefault = 1,
|
|
|
|
CodeModelSmall = 2,
|
|
|
|
CodeModelKernel = 3,
|
|
|
|
CodeModelMedium = 4,
|
|
|
|
CodeModelLarge = 5,
|
|
|
|
}
|
|
|
|
|
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;
|
2013-08-22 20:58:42 -07:00
|
|
|
pub enum TargetMachine_opaque {}
|
|
|
|
pub type TargetMachineRef = *TargetMachine_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-08-22 20:58:42 -07:00
|
|
|
use super::{ValueRef, TargetMachineRef, FileType};
|
|
|
|
use super::{CodeGenModel, RelocMode, CodeGenOptLevel};
|
2013-06-14 11:38:29 -07:00
|
|
|
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"]
|
2013-09-29 07:46:26 -07:00
|
|
|
extern "cdecl" {
|
2013-03-05 14:42:58 -08:00
|
|
|
/* Create and destroy contexts. */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMContextCreate() -> ContextRef;
|
|
|
|
pub fn LLVMContextDispose(C: ContextRef);
|
|
|
|
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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
|
|
|
|
pub fn LLVMDisposeModule(M: ModuleRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Data layout. See Module::getDataLayout. */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
|
|
|
|
pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Target triple. See Module::getTargetTriple. */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetTarget(M: ModuleRef) -> *c_char;
|
|
|
|
pub fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** See Module::dump. */
|
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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint)
|
|
|
|
-> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on function types */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFunctionType(ReturnType: TypeRef,
|
|
|
|
ParamTypes: *TypeRef,
|
|
|
|
ParamCount: c_uint,
|
|
|
|
IsVarArg: Bool)
|
|
|
|
-> TypeRef;
|
|
|
|
pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
|
|
|
|
pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
|
|
|
|
pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
|
|
|
|
pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on struct types */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMStructTypeInContext(C: ContextRef,
|
|
|
|
ElementTypes: *TypeRef,
|
|
|
|
ElementCount: c_uint,
|
|
|
|
Packed: Bool)
|
|
|
|
-> TypeRef;
|
|
|
|
pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
|
|
|
|
pub fn LLVMGetStructElementTypes(StructTy: TypeRef,
|
|
|
|
Dest: *mut TypeRef);
|
|
|
|
pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on array, pointer, and vector types (sequence types) */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMArrayType(ElementType: TypeRef, ElementCount: c_uint)
|
|
|
|
-> TypeRef;
|
|
|
|
pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
|
|
|
|
-> TypeRef;
|
|
|
|
pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
|
|
|
|
-> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
|
|
|
|
pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
|
|
|
|
pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
|
|
|
|
pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef)
|
|
|
|
-> *();
|
|
|
|
pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on other types */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
|
|
|
|
pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on all values */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
|
|
|
|
pub fn LLVMGetValueName(Val: ValueRef) -> *c_char;
|
|
|
|
pub fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
|
|
|
|
pub fn LLVMDumpValue(Val: ValueRef);
|
|
|
|
pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
|
|
|
|
pub fn LLVMHasMetadata(Val: ValueRef) -> c_int;
|
|
|
|
pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
|
|
|
|
pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on Uses */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
|
|
|
|
pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
|
|
|
|
pub fn LLVMGetUser(U: UseRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on Users */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
|
|
|
|
pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
/* all zeroes */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
/* only for int/vector */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
|
|
|
|
pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMIsNull(Val: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on metadata */
|
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-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-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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
|
|
|
|
Text: *c_char,
|
|
|
|
SLen: c_uint,
|
|
|
|
Radix: u8)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
|
|
|
|
pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
|
|
|
|
Text: *c_char,
|
|
|
|
SLen: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
|
|
|
|
pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
/* Operations on composite constants */
|
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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstArray(ElementTy: TypeRef,
|
|
|
|
ConstantVals: *ValueRef,
|
|
|
|
Length: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstVector(ScalarConstantVals: *ValueRef, Size: c_uint)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Constant expressions */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
|
|
|
|
pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-02-06 15:37:34 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-02-06 15:37:34 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstExactSDiv(LHSConstant: ValueRef,
|
|
|
|
RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstGEP(ConstantVal: ValueRef,
|
|
|
|
ConstantIndices: *ValueRef,
|
|
|
|
NumIndices: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
|
|
|
|
ConstantIndices: *ValueRef,
|
|
|
|
NumIndices: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-01-29 15:48:50 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstIntCast(ConstantVal: ValueRef,
|
|
|
|
ToType: TypeRef,
|
|
|
|
isSigned: Bool)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMConstSelect(ConstantCondition: ValueRef,
|
|
|
|
ConstantIfTrue: ValueRef,
|
|
|
|
ConstantIfFalse: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstExtractElement(VectorConstant: ValueRef,
|
|
|
|
IndexConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstInsertElement(VectorConstant: ValueRef,
|
|
|
|
ElementValueConstant: ValueRef,
|
|
|
|
IndexConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
|
|
|
|
VectorBConstant: ValueRef,
|
|
|
|
MaskConstant: ValueRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstExtractValue(AggConstant: ValueRef,
|
|
|
|
IdxList: *c_uint,
|
|
|
|
NumIdx: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstInsertValue(AggConstant: ValueRef,
|
|
|
|
ElementValueConstant: ValueRef,
|
|
|
|
IdxList: *c_uint,
|
|
|
|
NumIdx: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMConstInlineAsm(Ty: TypeRef,
|
|
|
|
AsmString: *c_char,
|
|
|
|
Constraints: *c_char,
|
|
|
|
HasSideEffects: Bool,
|
|
|
|
IsAlignStack: Bool)
|
|
|
|
-> ValueRef;
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
|
|
|
|
pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
|
|
|
|
pub fn LLVMGetSection(Global: ValueRef) -> *c_char;
|
|
|
|
pub fn LLVMSetSection(Global: ValueRef, Section: *c_char);
|
|
|
|
pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
|
|
|
|
pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
|
|
|
|
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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
|
|
|
|
pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
|
|
|
|
pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMSetInitializer(GlobalVar: ValueRef,
|
2013-03-05 14:42:58 -08:00
|
|
|
ConstantVal: ValueRef);
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
|
|
|
|
pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on aliases */
|
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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *c_char) -> ValueRef;
|
|
|
|
pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMDeleteFunction(Fn: ValueRef);
|
|
|
|
pub fn LLVMGetOrInsertFunction(M: ModuleRef,
|
|
|
|
Name: *c_char,
|
|
|
|
FunctionTy: TypeRef)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
|
|
|
|
pub fn LLVMGetGC(Fn: ValueRef) -> *c_char;
|
|
|
|
pub fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
|
2013-08-05 21:21:37 -07:00
|
|
|
pub fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint);
|
|
|
|
pub fn LLVMAddFunctionAttrString(Fn: ValueRef, Name: *c_char);
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
|
2013-09-09 02:32:30 -04:00
|
|
|
|
|
|
|
pub fn LLVMAddReturnAttribute(Fn: ValueRef, PA: c_uint);
|
|
|
|
pub fn LLVMRemoveReturnAttribute(Fn: ValueRef, PA: c_uint);
|
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
|
|
|
|
pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
|
|
|
|
pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
|
|
|
|
pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
|
|
|
|
pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on basic blocks */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
|
|
|
|
pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
|
|
|
|
pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
|
|
|
|
pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
|
|
|
|
Fn: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> BasicBlockRef;
|
|
|
|
pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
|
|
|
|
BB: BasicBlockRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> BasicBlockRef;
|
|
|
|
pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
|
2013-06-11 12:41:09 -07:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef,
|
|
|
|
MoveAfter: BasicBlockRef);
|
2013-06-11 12:41:09 -07:00
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on call sites */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
|
|
|
|
pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMAddInstrAttribute(Instr: ValueRef,
|
|
|
|
index: c_uint,
|
|
|
|
IA: c_uint);
|
|
|
|
pub fn LLVMRemoveInstrAttribute(Instr: ValueRef,
|
|
|
|
index: c_uint,
|
|
|
|
IA: c_uint);
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
|
|
|
|
pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Operations on phi nodes */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddIncoming(PhiNode: ValueRef,
|
|
|
|
IncomingValues: *ValueRef,
|
|
|
|
IncomingBlocks: *BasicBlockRef,
|
|
|
|
Count: c_uint);
|
|
|
|
pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
|
|
|
|
pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
|
|
|
|
pub fn LLVMPositionBuilder(Builder: BuilderRef,
|
|
|
|
Block: BasicBlockRef,
|
|
|
|
Instr: ValueRef);
|
|
|
|
pub fn LLVMPositionBuilderBefore(Builder: BuilderRef,
|
|
|
|
Instr: ValueRef);
|
|
|
|
pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
|
|
|
|
Block: BasicBlockRef);
|
|
|
|
pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
|
|
|
|
pub fn LLVMClearInsertionPosition(Builder: BuilderRef);
|
|
|
|
pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
|
|
|
|
pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
|
|
|
|
Instr: ValueRef,
|
|
|
|
Name: *c_char);
|
|
|
|
pub fn LLVMDisposeBuilder(Builder: BuilderRef);
|
|
|
|
pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Metadata */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
|
|
|
|
pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
|
|
|
|
pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Terminators */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
|
|
|
|
pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMBuildAggregateRet(B: BuilderRef,
|
|
|
|
RetVals: *ValueRef,
|
|
|
|
N: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
|
|
|
|
pub fn LLVMBuildCondBr(B: BuilderRef,
|
|
|
|
If: ValueRef,
|
|
|
|
Then: BasicBlockRef,
|
|
|
|
Else: BasicBlockRef)
|
2013-01-29 15:48:50 -08:00
|
|
|
-> ValueRef;
|
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-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-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;
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Add a case to the switch instruction */
|
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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Arithmetic */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildNSWAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildNUWAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFAdd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildNSWSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildNUWSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFSub(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildNSWMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildNUWMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFMul(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildUDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildSDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildExactSDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFDiv(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildURem(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildSRem(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFRem(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildShl(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildLShr(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildAShr(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildAnd(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildOr(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildXor(B: BuilderRef,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildBinOp(B: BuilderRef,
|
|
|
|
Op: Opcode,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
2013-01-10 21:23:07 -08:00
|
|
|
-> ValueRef;
|
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-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-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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildArrayMalloc(B: BuilderRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildArrayAlloca(B: BuilderRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
|
|
|
|
pub fn LLVMBuildLoad(B: BuilderRef,
|
|
|
|
PointerVal: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-05-12 21:22:20 +02:00
|
|
|
|
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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
|
|
|
|
Pointer: ValueRef,
|
|
|
|
Indices: *ValueRef,
|
|
|
|
NumIndices: c_uint,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildStructGEP(B: BuilderRef,
|
|
|
|
Pointer: ValueRef,
|
|
|
|
Idx: c_uint,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildTrunc(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildZExt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildSExt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFPToUI(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFPToSI(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildUIToFP(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildSIToFP(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFPTrunc(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFPExt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildPtrToInt(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildIntToPtr(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildBitCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-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;
|
|
|
|
pub fn LLVMBuildCast(B: BuilderRef,
|
|
|
|
Op: Opcode,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char) -> ValueRef;
|
|
|
|
pub fn LLVMBuildPointerCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIntCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildFPCast(B: BuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
DestTy: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/* Comparisons */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildICmp(B: BuilderRef,
|
|
|
|
Op: c_uint,
|
|
|
|
LHS: ValueRef,
|
|
|
|
RHS: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildCall(B: BuilderRef,
|
|
|
|
Fn: ValueRef,
|
|
|
|
Args: *ValueRef,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildSelect(B: BuilderRef,
|
|
|
|
If: ValueRef,
|
|
|
|
Then: ValueRef,
|
|
|
|
Else: ValueRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildVAArg(B: BuilderRef,
|
|
|
|
list: ValueRef,
|
|
|
|
Ty: TypeRef,
|
|
|
|
Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildExtractElement(B: BuilderRef,
|
|
|
|
VecVal: ValueRef,
|
|
|
|
Index: ValueRef,
|
|
|
|
Name: *c_char)
|
2013-03-05 14:42:58 -08:00
|
|
|
-> ValueRef;
|
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-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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
|
|
|
|
-> ValueRef;
|
|
|
|
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,
|
2013-05-25 17:23:12 -05:00
|
|
|
Order: AtomicOrdering,
|
|
|
|
SingleThreaded: Bool)
|
2013-08-02 14:30:00 -07:00
|
|
|
-> 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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
|
2013-07-28 16:40:35 +02:00
|
|
|
pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Writes a module to the specified path. Returns 0 on success. */
|
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-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.
|
|
|
|
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-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-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-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-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-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.
|
|
|
|
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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMCreatePassManager() -> PassManagerRef;
|
2013-08-22 20:58:42 -07:00
|
|
|
|
2013-05-28 11:15:31 +12:00
|
|
|
/** Creates a function-by-function pass manager */
|
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-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-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. */
|
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 */
|
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 */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool;
|
2013-05-28 11:15:31 +12:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMInitializePasses();
|
2013-05-29 20:08:20 +12:00
|
|
|
|
2013-03-05 14:42:58 -08:00
|
|
|
/** Adds a verification pass. */
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddVerifierPass(PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddIPSCCPPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddReassociatePass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddLoopRotatePass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddLICMPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddGVNPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddSCCPPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddConstantMergePass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddPruneEHPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
|
|
|
|
pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
|
|
|
|
pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
|
|
|
|
pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef,
|
|
|
|
OptimizationLevel: c_uint);
|
|
|
|
pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
|
|
|
pub fn LLVMPassManagerBuilderSetDisableUnitAtATime(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
|
|
|
pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
|
|
|
pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
Value: Bool);
|
|
|
|
pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
threshold: c_uint);
|
|
|
|
pub fn LLVMPassManagerBuilderPopulateModulePassManager(
|
|
|
|
PMB: PassManagerBuilderRef,
|
|
|
|
PM: PassManagerRef);
|
2013-03-05 14:42:58 -08:00
|
|
|
|
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-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-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-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-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-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-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-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-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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char)
|
|
|
|
-> MemoryBufferRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/** Returns a string describing the last error caused by an LLVMRust*
|
|
|
|
call. */
|
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-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-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-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustBuildJIT(MM: *(),
|
|
|
|
M: ModuleRef,
|
|
|
|
EnableSegmentedStacks: bool)
|
|
|
|
-> ExecutionEngineRef;
|
2013-03-05 14:42:58 -08:00
|
|
|
|
|
|
|
/// Print the pass timings since static dtors aren't picking them up.
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustPrintPassTimings();
|
2013-03-05 14:42:58 -08:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMRustStartMultithreading() -> bool;
|
2013-06-13 21:25:12 -07:00
|
|
|
|
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-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-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-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-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
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
2013-08-02 14:30:00 -07:00
|
|
|
pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef);
|
2013-06-14 11:38:29 -07:00
|
|
|
|
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
|
|
|
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);
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
|
|
|
|
Filename: *c_char,
|
|
|
|
Directory: *c_char)
|
|
|
|
-> DIFile;
|
|
|
|
|
|
|
|
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
|
|
|
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;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
|
|
|
|
Name: *c_char,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Encoding: c_uint)
|
|
|
|
-> DIBasicType;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef,
|
|
|
|
PointeeTy: DIType,
|
|
|
|
SizeInBits: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Name: *c_char)
|
|
|
|
-> DIDerivedType;
|
|
|
|
|
|
|
|
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,
|
2013-10-01 12:24:50 +02:00
|
|
|
VTableHolder: ValueRef,
|
|
|
|
UniqueId: *c_char)
|
2013-08-02 14:30:00 -07:00
|
|
|
-> DICompositeType;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
|
|
|
|
Scope: DIDescriptor,
|
|
|
|
File: DIFile,
|
|
|
|
Line: c_uint,
|
|
|
|
Col: c_uint)
|
|
|
|
-> DILexicalBlock;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef,
|
|
|
|
Size: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Ty: DIType,
|
|
|
|
Subscripts: DIArray)
|
|
|
|
-> DIType;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef,
|
|
|
|
Size: c_ulonglong,
|
|
|
|
AlignInBits: c_ulonglong,
|
|
|
|
Ty: DIType,
|
|
|
|
Subscripts: DIArray)
|
|
|
|
-> DIType;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
|
|
|
|
Lo: c_longlong,
|
|
|
|
Count: c_longlong)
|
|
|
|
-> DISubrange;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
|
|
|
|
Ptr: *DIDescriptor,
|
|
|
|
Count: c_uint)
|
|
|
|
-> DIArray;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
|
|
|
|
Val: ValueRef,
|
|
|
|
VarInfo: DIVariable,
|
|
|
|
InsertAtEnd: BasicBlockRef)
|
|
|
|
-> ValueRef;
|
2013-06-14 11:38:29 -07:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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;
|
|
|
|
|
|
|
|
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-08-09 13:47:00 -07:00
|
|
|
|
|
|
|
pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
|
2013-08-08 18:33:06 +02:00
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
|
|
|
|
Scope: ValueRef,
|
|
|
|
Name: *c_char,
|
|
|
|
Ty: ValueRef,
|
|
|
|
File: ValueRef,
|
|
|
|
LineNo: c_uint,
|
|
|
|
ColumnNo: c_uint)
|
|
|
|
-> ValueRef;
|
2013-08-22 20:58:42 -07:00
|
|
|
|
2013-08-23 18:45:02 +02:00
|
|
|
pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
|
|
|
|
|
|
|
|
pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
|
|
|
|
Tag: c_uint,
|
|
|
|
Scope: ValueRef,
|
|
|
|
Name: *c_char,
|
|
|
|
File: ValueRef,
|
|
|
|
LineNo: c_uint,
|
|
|
|
Ty: ValueRef,
|
|
|
|
AddrOps: *ValueRef,
|
|
|
|
AddrOpsCount: c_uint,
|
|
|
|
ArgNo: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
|
2013-09-05 13:29:30 +02:00
|
|
|
pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
|
|
|
|
Scope: ValueRef,
|
|
|
|
Name: *c_char,
|
|
|
|
File: ValueRef,
|
|
|
|
LineNo: c_uint)
|
|
|
|
-> ValueRef;
|
|
|
|
|
2013-09-11 16:37:43 +02:00
|
|
|
pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
|
2013-10-11 19:56:11 -04:00
|
|
|
pub fn LLVMTypeToString(Type: TypeRef) -> *c_char;
|
2013-09-11 16:37:43 +02:00
|
|
|
|
2013-08-28 17:47:31 +02:00
|
|
|
pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
|
|
|
|
|
|
|
|
pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
|
|
|
|
|
2013-08-22 20:58:42 -07:00
|
|
|
pub fn LLVMInitializeX86TargetInfo();
|
|
|
|
pub fn LLVMInitializeX86Target();
|
|
|
|
pub fn LLVMInitializeX86TargetMC();
|
|
|
|
pub fn LLVMInitializeX86AsmPrinter();
|
|
|
|
pub fn LLVMInitializeX86AsmParser();
|
|
|
|
pub fn LLVMInitializeARMTargetInfo();
|
|
|
|
pub fn LLVMInitializeARMTarget();
|
|
|
|
pub fn LLVMInitializeARMTargetMC();
|
|
|
|
pub fn LLVMInitializeARMAsmPrinter();
|
|
|
|
pub fn LLVMInitializeARMAsmParser();
|
|
|
|
pub fn LLVMInitializeMipsTargetInfo();
|
|
|
|
pub fn LLVMInitializeMipsTarget();
|
|
|
|
pub fn LLVMInitializeMipsTargetMC();
|
|
|
|
pub fn LLVMInitializeMipsAsmPrinter();
|
|
|
|
pub fn LLVMInitializeMipsAsmParser();
|
|
|
|
|
|
|
|
pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *c_char) -> bool;
|
|
|
|
pub fn LLVMRustCreateTargetMachine(Triple: *c_char,
|
|
|
|
CPU: *c_char,
|
|
|
|
Features: *c_char,
|
|
|
|
Model: CodeGenModel,
|
|
|
|
Reloc: RelocMode,
|
|
|
|
Level: CodeGenOptLevel,
|
2013-09-30 13:20:52 +08:00
|
|
|
EnableSegstk: bool,
|
|
|
|
UseSoftFP: bool) -> TargetMachineRef;
|
2013-08-22 20:58:42 -07:00
|
|
|
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
|
|
|
|
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
|
|
|
|
PM: PassManagerRef,
|
|
|
|
M: ModuleRef);
|
|
|
|
pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
|
|
|
|
M: ModuleRef);
|
|
|
|
pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef, M: ModuleRef);
|
|
|
|
pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
|
|
|
|
pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
|
|
|
|
PM: PassManagerRef,
|
|
|
|
M: ModuleRef,
|
|
|
|
Output: *c_char,
|
|
|
|
FileType: FileType) -> bool;
|
|
|
|
pub fn LLVMRustPrintModule(PM: PassManagerRef,
|
|
|
|
M: ModuleRef,
|
|
|
|
Output: *c_char);
|
2013-08-30 17:56:04 -07:00
|
|
|
pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: **c_char);
|
2013-08-22 20:58:42 -07:00
|
|
|
pub fn LLVMRustPrintPasses();
|
|
|
|
pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *c_char);
|
|
|
|
pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,
|
|
|
|
AddLifetimes: bool);
|
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-08-09 13:47:00 -07:00
|
|
|
pub fn SetUnnamedAddr(Global: ValueRef, Unnamed: bool) {
|
|
|
|
unsafe {
|
|
|
|
llvm::LLVMSetUnnamedAddr(Global, Unnamed as Bool);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2013-05-25 21:26:08 -05:00
|
|
|
|
|
|
|
pub fn SetFunctionAttribute(Fn: ValueRef, attr: Attribute) {
|
|
|
|
unsafe {
|
2013-08-05 21:21:37 -07:00
|
|
|
llvm::LLVMAddFunctionAttr(Fn, attr as c_uint)
|
2013-08-02 00:55:49 -07:00
|
|
|
}
|
2013-08-01 15:47:09 -07: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> {
|
2013-09-20 02:08:47 -04:00
|
|
|
self.named_types.find_equiv(&s).map(|x| Type::from_ref(*x))
|
2013-06-15 14:31:52 +12:00
|
|
|
}
|
2010-09-24 14:56:04 -07:00
|
|
|
|
2013-10-11 19:56:11 -04:00
|
|
|
pub fn type_to_str(&self, ty: Type) -> ~str {
|
2013-06-15 14:31:52 +12:00
|
|
|
unsafe {
|
2013-10-11 19:56:11 -04:00
|
|
|
let s = llvm::LLVMTypeToString(ty.to_ref());
|
|
|
|
let ret = from_c_str(s);
|
|
|
|
free(s as *c_void);
|
|
|
|
ret
|
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-05-21 15:25:44 -04:00
|
|
|
pub fn types_to_str(&self, tys: &[Type]) -> ~str {
|
|
|
|
let strs = tys.map(|t| self.type_to_str(*t));
|
2013-09-27 22:38:08 -07:00
|
|
|
format!("[{}]", strs.connect(","))
|
2013-05-21 15:25:44 -04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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-09-16 21:18:07 -04:00
|
|
|
fn drop(&mut 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-08-14 19:21:59 -07:00
|
|
|
let lltd = do string_rep.with_c_str |buf| {
|
2013-07-22 21:41:46 -07:00
|
|
|
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-09-16 21:18:07 -04:00
|
|
|
fn drop(&mut 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-09-16 21:18:07 -04:00
|
|
|
fn drop(&mut 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-09-16 21:18:07 -04:00
|
|
|
fn drop(&mut 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
|
|
|
}
|