core:: Eliminate str::sbuf. Replace with *u8
This commit is contained in:
parent
3864d6d845
commit
9e480708a2
6 changed files with 138 additions and 145 deletions
|
@ -38,8 +38,8 @@ export as_c_charp, fill_charp_buf;
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn rust_env_pairs() -> [str];
|
fn rust_env_pairs() -> [str];
|
||||||
fn rust_getcwd() -> str;
|
fn rust_getcwd() -> str;
|
||||||
fn rust_path_is_dir(path: str::sbuf) -> c_int;
|
fn rust_path_is_dir(path: *u8) -> c_int;
|
||||||
fn rust_path_exists(path: str::sbuf) -> c_int;
|
fn rust_path_exists(path: *u8) -> c_int;
|
||||||
fn rust_list_files(path: str) -> [str];
|
fn rust_list_files(path: str) -> [str];
|
||||||
fn rust_process_wait(handle: c_int) -> c_int;
|
fn rust_process_wait(handle: c_int) -> c_int;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ fn fill_charp_buf(f: fn(*mutable c_char, size_t) -> bool)
|
||||||
let buf = vec::to_mut(vec::from_elem(tmpbuf_sz, 0u8 as c_char));
|
let buf = vec::to_mut(vec::from_elem(tmpbuf_sz, 0u8 as c_char));
|
||||||
vec::as_mut_buf(buf) { |b|
|
vec::as_mut_buf(buf) { |b|
|
||||||
if f(b, tmpbuf_sz as size_t) {
|
if f(b, tmpbuf_sz as size_t) {
|
||||||
some(str::from_cstr(b as str::sbuf))
|
some(str::from_cstr(b as *u8))
|
||||||
} else {
|
} else {
|
||||||
none
|
none
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#[doc ="Process spawning"];
|
#[doc ="Process spawning"];
|
||||||
import option::{some, none};
|
import option::{some, none};
|
||||||
import str::sbuf;
|
|
||||||
import libc::{pid_t, c_void, c_int};
|
import libc::{pid_t, c_void, c_int};
|
||||||
|
|
||||||
export program;
|
export program;
|
||||||
|
@ -12,7 +11,7 @@ export waitpid;
|
||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn rust_run_program(argv: *sbuf, envp: *c_void, dir: sbuf,
|
fn rust_run_program(argv: **u8, envp: *c_void, dir: *u8,
|
||||||
in_fd: c_int, out_fd: c_int, err_fd: c_int)
|
in_fd: c_int, out_fd: c_int, err_fd: c_int)
|
||||||
-> pid_t;
|
-> pid_t;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +77,7 @@ fn spawn_process(prog: str, args: [str],
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_argv<T>(prog: str, args: [str],
|
fn with_argv<T>(prog: str, args: [str],
|
||||||
cb: fn(*sbuf) -> T) -> T unsafe {
|
cb: fn(**u8) -> T) -> T unsafe {
|
||||||
let mut argptrs = str::as_buf(prog) {|b| [b] };
|
let mut argptrs = str::as_buf(prog) {|b| [b] };
|
||||||
let mut tmps = [];
|
let mut tmps = [];
|
||||||
for arg in args {
|
for arg in args {
|
||||||
|
@ -141,7 +140,7 @@ fn with_envp<T>(env: option<[(str,str)]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_dirp<T>(d: option<str>,
|
fn with_dirp<T>(d: option<str>,
|
||||||
cb: fn(sbuf) -> T) -> T unsafe {
|
cb: fn(*u8) -> T) -> T unsafe {
|
||||||
alt d {
|
alt d {
|
||||||
some(dir) { str::as_buf(dir, cb) }
|
some(dir) { str::as_buf(dir, cb) }
|
||||||
none { cb(ptr::null()) }
|
none { cb(ptr::null()) }
|
||||||
|
|
|
@ -90,7 +90,6 @@ export
|
||||||
char_at,
|
char_at,
|
||||||
as_bytes,
|
as_bytes,
|
||||||
as_buf,
|
as_buf,
|
||||||
sbuf,
|
|
||||||
reserve,
|
reserve,
|
||||||
|
|
||||||
unsafe;
|
unsafe;
|
||||||
|
@ -184,7 +183,7 @@ fn from_chars(chs: [char]) -> str {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc = "Create a Rust string from a null-terminated C string"]
|
#[doc = "Create a Rust string from a null-terminated C string"]
|
||||||
fn from_cstr(cstr: sbuf) -> str unsafe {
|
fn from_cstr(cstr: *u8) -> str unsafe {
|
||||||
let mut curr = cstr, i = 0u;
|
let mut curr = cstr, i = 0u;
|
||||||
while *curr != 0u8 {
|
while *curr != 0u8 {
|
||||||
i += 1u;
|
i += 1u;
|
||||||
|
@ -194,7 +193,7 @@ fn from_cstr(cstr: sbuf) -> str unsafe {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc = "Create a Rust string from a C string of the given length"]
|
#[doc = "Create a Rust string from a C string of the given length"]
|
||||||
fn from_cstr_len(cstr: sbuf, len: uint) -> str unsafe {
|
fn from_cstr_len(cstr: *u8, len: uint) -> str unsafe {
|
||||||
let mut buf: [u8] = [];
|
let mut buf: [u8] = [];
|
||||||
vec::reserve(buf, len + 1u);
|
vec::reserve(buf, len + 1u);
|
||||||
vec::as_buf(buf) {|b| ptr::memcpy(b, cstr, len); }
|
vec::as_buf(buf) {|b| ptr::memcpy(b, cstr, len); }
|
||||||
|
@ -1248,13 +1247,10 @@ interop.
|
||||||
let s = str::as_buf(\"PATH\", { |path_buf| libc::getenv(path_buf) });
|
let s = str::as_buf(\"PATH\", { |path_buf| libc::getenv(path_buf) });
|
||||||
```
|
```
|
||||||
"]
|
"]
|
||||||
fn as_buf<T>(s: str, f: fn(sbuf) -> T) -> T unsafe {
|
fn as_buf<T>(s: str, f: fn(*u8) -> T) -> T unsafe {
|
||||||
as_bytes(s) { |v| vec::as_buf(v, f) }
|
as_bytes(s) { |v| vec::as_buf(v, f) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc = "An unsafe buffer of bytes"]
|
|
||||||
type sbuf = *u8;
|
|
||||||
|
|
||||||
#[doc = "Allocate more memory for a string, up to `nn` + 1 bytes"]
|
#[doc = "Allocate more memory for a string, up to `nn` + 1 bytes"]
|
||||||
fn reserve(&ss: str, nn: uint) {
|
fn reserve(&ss: str, nn: uint) {
|
||||||
rustrt::str_reserve_shared(ss, nn);
|
rustrt::str_reserve_shared(ss, nn);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import str::sbuf;
|
|
||||||
import std::map::hashmap;
|
import std::map::hashmap;
|
||||||
|
|
||||||
import libc::{c_int, c_uint, c_longlong, c_ulonglong};
|
import libc::{c_int, c_uint, c_longlong, c_ulonglong};
|
||||||
|
@ -148,28 +147,28 @@ native mod llvm {
|
||||||
fn LLVMContextCreate() -> ContextRef;
|
fn LLVMContextCreate() -> ContextRef;
|
||||||
fn LLVMGetGlobalContext() -> ContextRef;
|
fn LLVMGetGlobalContext() -> ContextRef;
|
||||||
fn LLVMContextDispose(C: ContextRef);
|
fn LLVMContextDispose(C: ContextRef);
|
||||||
fn LLVMGetMDKindIDInContext(C: ContextRef, Name: sbuf, SLen: c_uint) ->
|
fn LLVMGetMDKindIDInContext(C: ContextRef, Name: *u8, SLen: c_uint) ->
|
||||||
c_uint;
|
c_uint;
|
||||||
fn LLVMGetMDKindID(Name: sbuf, SLen: c_uint) -> c_uint;
|
fn LLVMGetMDKindID(Name: *u8, SLen: c_uint) -> c_uint;
|
||||||
|
|
||||||
/* Create and destroy modules. */
|
/* Create and destroy modules. */
|
||||||
fn LLVMModuleCreateWithNameInContext(ModuleID: sbuf, C: ContextRef) ->
|
fn LLVMModuleCreateWithNameInContext(ModuleID: *u8, C: ContextRef) ->
|
||||||
ModuleRef;
|
ModuleRef;
|
||||||
fn LLVMDisposeModule(M: ModuleRef);
|
fn LLVMDisposeModule(M: ModuleRef);
|
||||||
|
|
||||||
/** Data layout. See Module::getDataLayout. */
|
/** Data layout. See Module::getDataLayout. */
|
||||||
fn LLVMGetDataLayout(M: ModuleRef) -> sbuf;
|
fn LLVMGetDataLayout(M: ModuleRef) -> *u8;
|
||||||
fn LLVMSetDataLayout(M: ModuleRef, Triple: sbuf);
|
fn LLVMSetDataLayout(M: ModuleRef, Triple: *u8);
|
||||||
|
|
||||||
/** Target triple. See Module::getTargetTriple. */
|
/** Target triple. See Module::getTargetTriple. */
|
||||||
fn LLVMGetTarget(M: ModuleRef) -> sbuf;
|
fn LLVMGetTarget(M: ModuleRef) -> *u8;
|
||||||
fn LLVMSetTarget(M: ModuleRef, Triple: sbuf);
|
fn LLVMSetTarget(M: ModuleRef, Triple: *u8);
|
||||||
|
|
||||||
/** See Module::dump. */
|
/** See Module::dump. */
|
||||||
fn LLVMDumpModule(M: ModuleRef);
|
fn LLVMDumpModule(M: ModuleRef);
|
||||||
|
|
||||||
/** See Module::setModuleInlineAsm. */
|
/** See Module::setModuleInlineAsm. */
|
||||||
fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: sbuf);
|
fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *u8);
|
||||||
|
|
||||||
/** See llvm::LLVMTypeKind::getTypeID. */
|
/** See llvm::LLVMTypeKind::getTypeID. */
|
||||||
|
|
||||||
|
@ -253,8 +252,8 @@ native mod llvm {
|
||||||
|
|
||||||
/* Operations on all values */
|
/* Operations on all values */
|
||||||
fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
|
fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
|
||||||
fn LLVMGetValueName(Val: ValueRef) -> sbuf;
|
fn LLVMGetValueName(Val: ValueRef) -> *u8;
|
||||||
fn LLVMSetValueName(Val: ValueRef, Name: sbuf);
|
fn LLVMSetValueName(Val: ValueRef, Name: *u8);
|
||||||
fn LLVMDumpValue(Val: ValueRef);
|
fn LLVMDumpValue(Val: ValueRef);
|
||||||
fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
|
fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
|
||||||
fn LLVMHasMetadata(Val: ValueRef) -> c_int;
|
fn LLVMHasMetadata(Val: ValueRef) -> c_int;
|
||||||
|
@ -283,13 +282,13 @@ native mod llvm {
|
||||||
fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
|
fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
|
||||||
|
|
||||||
/* Operations on metadata */
|
/* Operations on metadata */
|
||||||
fn LLVMMDStringInContext(C: ContextRef, Str: sbuf, SLen: c_uint) ->
|
fn LLVMMDStringInContext(C: ContextRef, Str: *u8, SLen: c_uint) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMMDString(Str: sbuf, SLen: c_uint) -> ValueRef;
|
fn LLVMMDString(Str: *u8, SLen: c_uint) -> ValueRef;
|
||||||
fn LLVMMDNodeInContext(C: ContextRef, Vals: *ValueRef, Count: c_uint) ->
|
fn LLVMMDNodeInContext(C: ContextRef, Vals: *ValueRef, Count: c_uint) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
|
fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
|
||||||
fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: sbuf,
|
fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *u8,
|
||||||
Val: ValueRef);
|
Val: ValueRef);
|
||||||
|
|
||||||
/* Operations on scalar constants */
|
/* Operations on scalar constants */
|
||||||
|
@ -297,25 +296,25 @@ native mod llvm {
|
||||||
ValueRef;
|
ValueRef;
|
||||||
// FIXME: radix is actually u8, but our native layer can't handle this
|
// FIXME: radix is actually u8, but our native layer can't handle this
|
||||||
// yet. lucky for us we're little-endian. Small miracles.
|
// yet. lucky for us we're little-endian. Small miracles.
|
||||||
fn LLVMConstIntOfString(IntTy: TypeRef, Text: sbuf, Radix: c_int) ->
|
fn LLVMConstIntOfString(IntTy: TypeRef, Text: *u8, Radix: c_int) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: sbuf, SLen: c_uint,
|
fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: *u8, SLen: c_uint,
|
||||||
Radix: u8) -> ValueRef;
|
Radix: u8) -> ValueRef;
|
||||||
fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
|
fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
|
||||||
fn LLVMConstRealOfString(RealTy: TypeRef, Text: sbuf) -> ValueRef;
|
fn LLVMConstRealOfString(RealTy: TypeRef, Text: *u8) -> ValueRef;
|
||||||
fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: sbuf,
|
fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: *u8,
|
||||||
SLen: c_uint) -> ValueRef;
|
SLen: c_uint) -> ValueRef;
|
||||||
fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
|
fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
|
||||||
fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
|
fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
|
||||||
|
|
||||||
|
|
||||||
/* Operations on composite constants */
|
/* Operations on composite constants */
|
||||||
fn LLVMConstStringInContext(C: ContextRef, Str: sbuf, Length: c_uint,
|
fn LLVMConstStringInContext(C: ContextRef, Str: *u8, Length: c_uint,
|
||||||
DontNullTerminate: Bool) -> ValueRef;
|
DontNullTerminate: Bool) -> ValueRef;
|
||||||
fn LLVMConstStructInContext(C: ContextRef, ConstantVals: *ValueRef,
|
fn LLVMConstStructInContext(C: ContextRef, ConstantVals: *ValueRef,
|
||||||
Count: c_uint, Packed: Bool) -> ValueRef;
|
Count: c_uint, Packed: Bool) -> ValueRef;
|
||||||
|
|
||||||
fn LLVMConstString(Str: sbuf, Length: c_uint,
|
fn LLVMConstString(Str: *u8, Length: c_uint,
|
||||||
DontNullTerminate: Bool) -> ValueRef;
|
DontNullTerminate: Bool) -> ValueRef;
|
||||||
fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
|
fn LLVMConstArray(ElementTy: TypeRef, ConstantVals: *ValueRef,
|
||||||
Length: c_uint) -> ValueRef;
|
Length: c_uint) -> ValueRef;
|
||||||
|
@ -417,7 +416,7 @@ native mod llvm {
|
||||||
fn LLVMConstInsertValue(AggConstant: ValueRef,
|
fn LLVMConstInsertValue(AggConstant: ValueRef,
|
||||||
ElementValueConstant: ValueRef, IdxList: *uint,
|
ElementValueConstant: ValueRef, IdxList: *uint,
|
||||||
NumIdx: c_uint) -> ValueRef;
|
NumIdx: c_uint) -> ValueRef;
|
||||||
fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: sbuf, Constraints: sbuf,
|
fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *u8, Constraints: *u8,
|
||||||
HasSideEffects: Bool, IsAlignStack: Bool) ->
|
HasSideEffects: Bool, IsAlignStack: Bool) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
|
fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef;
|
||||||
|
@ -429,8 +428,8 @@ native mod llvm {
|
||||||
fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
|
fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
|
||||||
fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
|
fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
|
||||||
fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
|
fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
|
||||||
fn LLVMGetSection(Global: ValueRef) -> sbuf;
|
fn LLVMGetSection(Global: ValueRef) -> *u8;
|
||||||
fn LLVMSetSection(Global: ValueRef, Section: sbuf);
|
fn LLVMSetSection(Global: ValueRef, Section: *u8);
|
||||||
fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
|
fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
|
||||||
fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
|
fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
|
||||||
fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
|
fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
|
||||||
|
@ -438,10 +437,10 @@ native mod llvm {
|
||||||
|
|
||||||
|
|
||||||
/* Operations on global variables */
|
/* Operations on global variables */
|
||||||
fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMAddGlobalInAddressSpace(M: ModuleRef, Ty: TypeRef, Name: sbuf,
|
fn LLVMAddGlobalInAddressSpace(M: ModuleRef, Ty: TypeRef, Name: *u8,
|
||||||
AddressSpace: c_uint) -> ValueRef;
|
AddressSpace: c_uint) -> ValueRef;
|
||||||
fn LLVMGetNamedGlobal(M: ModuleRef, Name: sbuf) -> ValueRef;
|
fn LLVMGetNamedGlobal(M: ModuleRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
|
fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
|
||||||
fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
|
fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
|
||||||
fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
|
fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
|
||||||
|
@ -455,25 +454,25 @@ native mod llvm {
|
||||||
fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
|
fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
|
||||||
|
|
||||||
/* Operations on aliases */
|
/* Operations on aliases */
|
||||||
fn LLVMAddAlias(M: ModuleRef, Ty: TypeRef, Aliasee: ValueRef, Name: sbuf)
|
fn LLVMAddAlias(M: ModuleRef, Ty: TypeRef, Aliasee: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
|
|
||||||
/* Operations on functions */
|
/* Operations on functions */
|
||||||
fn LLVMAddFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef) ->
|
fn LLVMAddFunction(M: ModuleRef, Name: *u8, FunctionTy: TypeRef) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMGetNamedFunction(M: ModuleRef, Name: sbuf) -> ValueRef;
|
fn LLVMGetNamedFunction(M: ModuleRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
|
fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
|
||||||
fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
|
fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
|
||||||
fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
|
fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
|
||||||
fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
|
fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
|
||||||
fn LLVMDeleteFunction(Fn: ValueRef);
|
fn LLVMDeleteFunction(Fn: ValueRef);
|
||||||
fn LLVMGetOrInsertFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef)
|
fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *u8, FunctionTy: TypeRef)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
|
fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
|
||||||
fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
|
fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
|
||||||
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
|
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
|
||||||
fn LLVMGetGC(Fn: ValueRef) -> sbuf;
|
fn LLVMGetGC(Fn: ValueRef) -> *u8;
|
||||||
fn LLVMSetGC(Fn: ValueRef, Name: sbuf);
|
fn LLVMSetGC(Fn: ValueRef, Name: *u8);
|
||||||
fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint);
|
fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint);
|
||||||
fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_uint;
|
fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_uint;
|
||||||
fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint);
|
fn LLVMRemoveFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint);
|
||||||
|
@ -505,13 +504,13 @@ native mod llvm {
|
||||||
fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
|
fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
|
||||||
fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
|
||||||
|
|
||||||
fn LLVMAppendBasicBlockInContext(C: ContextRef, Fn: ValueRef, Name: sbuf)
|
fn LLVMAppendBasicBlockInContext(C: ContextRef, Fn: ValueRef, Name: *u8)
|
||||||
-> BasicBlockRef;
|
-> BasicBlockRef;
|
||||||
fn LLVMInsertBasicBlockInContext(C: ContextRef, BB: BasicBlockRef,
|
fn LLVMInsertBasicBlockInContext(C: ContextRef, BB: BasicBlockRef,
|
||||||
Name: sbuf) -> BasicBlockRef;
|
Name: *u8) -> BasicBlockRef;
|
||||||
|
|
||||||
fn LLVMAppendBasicBlock(Fn: ValueRef, Name: sbuf) -> BasicBlockRef;
|
fn LLVMAppendBasicBlock(Fn: ValueRef, Name: *u8) -> BasicBlockRef;
|
||||||
fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef, Name: sbuf) ->
|
fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef, Name: *u8) ->
|
||||||
BasicBlockRef;
|
BasicBlockRef;
|
||||||
fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
|
fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
|
||||||
|
|
||||||
|
@ -554,7 +553,7 @@ native mod llvm {
|
||||||
fn LLVMClearInsertionPosition(Builder: BuilderRef);
|
fn LLVMClearInsertionPosition(Builder: BuilderRef);
|
||||||
fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
|
fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
|
||||||
fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef, Instr: ValueRef,
|
fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef, Instr: ValueRef,
|
||||||
Name: sbuf);
|
Name: *u8);
|
||||||
fn LLVMDisposeBuilder(Builder: BuilderRef);
|
fn LLVMDisposeBuilder(Builder: BuilderRef);
|
||||||
|
|
||||||
/* Metadata */
|
/* Metadata */
|
||||||
|
@ -576,9 +575,9 @@ native mod llvm {
|
||||||
NumDests: c_uint) -> ValueRef;
|
NumDests: c_uint) -> ValueRef;
|
||||||
fn LLVMBuildInvoke(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
fn LLVMBuildInvoke(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
||||||
NumArgs: c_uint, Then: BasicBlockRef,
|
NumArgs: c_uint, Then: BasicBlockRef,
|
||||||
Catch: BasicBlockRef, Name: sbuf) -> ValueRef;
|
Catch: BasicBlockRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildLandingPad(B: BuilderRef, Ty: TypeRef, PersFn: ValueRef,
|
fn LLVMBuildLandingPad(B: BuilderRef, Ty: TypeRef, PersFn: ValueRef,
|
||||||
NumClauses: c_uint, Name: sbuf) -> ValueRef;
|
NumClauses: c_uint, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
|
fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
|
||||||
fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
|
fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
|
||||||
|
|
||||||
|
@ -595,169 +594,169 @@ native mod llvm {
|
||||||
fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
|
fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
|
||||||
|
|
||||||
/* Arithmetic */
|
/* Arithmetic */
|
||||||
fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildNSWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildNSWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNUWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildNUWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildFAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildNSWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildNSWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNUWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildNUWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildFSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildNSWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildNSWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNUWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildNUWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildFMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildUDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildUDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildExactSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildExactSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildFDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildURem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildURem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildSRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildSRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildFRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildFRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildShl(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildShl(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildLShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildLShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildAShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildAShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildAnd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildAnd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildOr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf) ->
|
fn LLVMBuildOr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBuildXor(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
|
fn LLVMBuildXor(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildBinOp(B: BuilderRef, Op: Opcode, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildBinOp(B: BuilderRef, Op: Opcode, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *u8) -> ValueRef;
|
||||||
|
|
||||||
/* Memory */
|
/* Memory */
|
||||||
fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildArrayMalloc(B: BuilderRef, Ty: TypeRef, Val: ValueRef,
|
fn LLVMBuildArrayMalloc(B: BuilderRef, Ty: TypeRef, Val: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildArrayAlloca(B: BuilderRef, Ty: TypeRef, Val: ValueRef,
|
fn LLVMBuildArrayAlloca(B: BuilderRef, Ty: TypeRef, Val: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
|
fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
|
||||||
fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: sbuf) ->
|
fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: *u8) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) ->
|
fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBuildGEP(B: BuilderRef, Pointer: ValueRef, Indices: *ValueRef,
|
fn LLVMBuildGEP(B: BuilderRef, Pointer: ValueRef, Indices: *ValueRef,
|
||||||
NumIndices: c_uint, Name: sbuf) -> ValueRef;
|
NumIndices: c_uint, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
|
fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
|
||||||
Indices: *ValueRef, NumIndices: c_uint,
|
Indices: *ValueRef, NumIndices: c_uint,
|
||||||
Name: sbuf)
|
Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildStructGEP(B: BuilderRef, Pointer: ValueRef, Idx: c_uint,
|
fn LLVMBuildStructGEP(B: BuilderRef, Pointer: ValueRef, Idx: c_uint,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildGlobalString(B: BuilderRef, Str: sbuf, Name: sbuf) ->
|
fn LLVMBuildGlobalString(B: BuilderRef, Str: *u8, Name: *u8) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBuildGlobalStringPtr(B: BuilderRef, Str: sbuf, Name: sbuf) ->
|
fn LLVMBuildGlobalStringPtr(B: BuilderRef, Str: *u8, Name: *u8) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
|
|
||||||
/* Casts */
|
/* Casts */
|
||||||
fn LLVMBuildTrunc(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildTrunc(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildZExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildZExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildSExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildSExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFPToUI(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildFPToUI(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFPToSI(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildFPToSI(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildUIToFP(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildUIToFP(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildSIToFP(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildSIToFP(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFPTrunc(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildFPTrunc(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFPExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildFPExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildPtrToInt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildPtrToInt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildIntToPtr(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildIntToPtr(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildZExtOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildZExtOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildSExtOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildSExtOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildTruncOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildTruncOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
|
fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
|
||||||
DestTy: TypeRef, Name: sbuf) -> ValueRef;
|
DestTy: TypeRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildPointerCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildPointerCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildIntCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildIntCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFPCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
fn LLVMBuildFPCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
|
|
||||||
/* Comparisons */
|
/* Comparisons */
|
||||||
fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
|
fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
|
||||||
RHS: ValueRef, Name: sbuf) -> ValueRef;
|
RHS: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
|
fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
|
||||||
RHS: ValueRef, Name: sbuf) -> ValueRef;
|
RHS: ValueRef, Name: *u8) -> ValueRef;
|
||||||
|
|
||||||
/* Miscellaneous instructions */
|
/* Miscellaneous instructions */
|
||||||
fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
|
||||||
NumArgs: c_uint, Name: sbuf) -> ValueRef;
|
NumArgs: c_uint, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
|
fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
|
||||||
Else: ValueRef, Name: sbuf) -> ValueRef;
|
Else: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef, Name: sbuf)
|
fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildExtractElement(B: BuilderRef, VecVal: ValueRef,
|
fn LLVMBuildExtractElement(B: BuilderRef, VecVal: ValueRef,
|
||||||
Index: ValueRef, Name: sbuf) -> ValueRef;
|
Index: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildInsertElement(B: BuilderRef, VecVal: ValueRef,
|
fn LLVMBuildInsertElement(B: BuilderRef, VecVal: ValueRef,
|
||||||
EltVal: ValueRef, Index: ValueRef, Name: sbuf)
|
EltVal: ValueRef, Index: ValueRef, Name: *u8)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
fn LLVMBuildShuffleVector(B: BuilderRef, V1: ValueRef, V2: ValueRef,
|
fn LLVMBuildShuffleVector(B: BuilderRef, V1: ValueRef, V2: ValueRef,
|
||||||
Mask: ValueRef, Name: sbuf) -> ValueRef;
|
Mask: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildExtractValue(B: BuilderRef, AggVal: ValueRef, Index: c_uint,
|
fn LLVMBuildExtractValue(B: BuilderRef, AggVal: ValueRef, Index: c_uint,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildInsertValue(B: BuilderRef, AggVal: ValueRef, EltVal: ValueRef,
|
fn LLVMBuildInsertValue(B: BuilderRef, AggVal: ValueRef, EltVal: ValueRef,
|
||||||
Index: c_uint, Name: sbuf) -> ValueRef;
|
Index: c_uint, Name: *u8) -> ValueRef;
|
||||||
|
|
||||||
fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: sbuf) -> ValueRef;
|
fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *u8) -> ValueRef;
|
||||||
fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: sbuf) ->
|
fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *u8) ->
|
||||||
ValueRef;
|
ValueRef;
|
||||||
fn LLVMBuildPtrDiff(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
fn LLVMBuildPtrDiff(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
|
||||||
Name: sbuf) -> ValueRef;
|
Name: *u8) -> ValueRef;
|
||||||
|
|
||||||
/* Selected entries from the downcasts. */
|
/* Selected entries from the downcasts. */
|
||||||
fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
|
fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
|
||||||
|
|
||||||
/** Writes a module to the specified path. Returns 0 on success. */
|
/** Writes a module to the specified path. Returns 0 on success. */
|
||||||
fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: sbuf) -> c_int;
|
fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *u8) -> c_int;
|
||||||
|
|
||||||
/** Creates target data from a target layout string. */
|
/** Creates target data from a target layout string. */
|
||||||
fn LLVMCreateTargetData(StringRep: sbuf) -> TargetDataRef;
|
fn LLVMCreateTargetData(StringRep: *u8) -> TargetDataRef;
|
||||||
/** Adds the target data to the given pass manager. The pass manager
|
/** Adds the target data to the given pass manager. The pass manager
|
||||||
references the target data only weakly. */
|
references the target data only weakly. */
|
||||||
fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
|
fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
|
||||||
|
@ -857,38 +856,38 @@ native mod llvm {
|
||||||
/** Moves the section iterator to point to the next section. */
|
/** Moves the section iterator to point to the next section. */
|
||||||
fn LLVMMoveToNextSection(SI: SectionIteratorRef);
|
fn LLVMMoveToNextSection(SI: SectionIteratorRef);
|
||||||
/** Returns the current section name. */
|
/** Returns the current section name. */
|
||||||
fn LLVMGetSectionName(SI: SectionIteratorRef) -> sbuf;
|
fn LLVMGetSectionName(SI: SectionIteratorRef) -> *u8;
|
||||||
/** Returns the current section size. */
|
/** Returns the current section size. */
|
||||||
fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
|
fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
|
||||||
/** Returns the current section contents as a string buffer. */
|
/** Returns the current section contents as a string buffer. */
|
||||||
fn LLVMGetSectionContents(SI: SectionIteratorRef) -> sbuf;
|
fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *u8;
|
||||||
|
|
||||||
/** Reads the given file and returns it as a memory buffer. Use
|
/** Reads the given file and returns it as a memory buffer. Use
|
||||||
LLVMDisposeMemoryBuffer() to get rid of it. */
|
LLVMDisposeMemoryBuffer() to get rid of it. */
|
||||||
fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: sbuf) ->
|
fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *u8) ->
|
||||||
MemoryBufferRef;
|
MemoryBufferRef;
|
||||||
|
|
||||||
/* FIXME: The FileType is an enum.*/
|
/* FIXME: The FileType is an enum.*/
|
||||||
fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef, Triple: sbuf,
|
fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef, Triple: *u8,
|
||||||
Output: sbuf, FileType: c_int, OptLevel: c_int,
|
Output: *u8, FileType: c_int, OptLevel: c_int,
|
||||||
EnableSegmentedStacks: bool);
|
EnableSegmentedStacks: bool);
|
||||||
|
|
||||||
/** Returns a string describing the last error caused by an LLVMRust*
|
/** Returns a string describing the last error caused by an LLVMRust*
|
||||||
call. */
|
call. */
|
||||||
fn LLVMRustGetLastError() -> sbuf;
|
fn LLVMRustGetLastError() -> *u8;
|
||||||
|
|
||||||
/** Parses the bitcode in the given memory buffer. */
|
/** Parses the bitcode in the given memory buffer. */
|
||||||
fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
|
fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
|
||||||
|
|
||||||
/** Parses LLVM asm in the given file */
|
/** Parses LLVM asm in the given file */
|
||||||
fn LLVMRustParseAssemblyFile(Filename: sbuf) -> ModuleRef;
|
fn LLVMRustParseAssemblyFile(Filename: *u8) -> ModuleRef;
|
||||||
|
|
||||||
/** FiXME: Hacky adaptor for lack of c_ulonglong in FFI: */
|
/** FiXME: Hacky adaptor for lack of c_ulonglong in FFI: */
|
||||||
fn LLVMRustConstInt(IntTy: TypeRef, N_hi: c_uint, N_lo: c_uint,
|
fn LLVMRustConstInt(IntTy: TypeRef, N_hi: c_uint, N_lo: c_uint,
|
||||||
SignExtend: Bool) -> ValueRef;
|
SignExtend: Bool) -> ValueRef;
|
||||||
|
|
||||||
fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
|
fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
|
||||||
Output: sbuf);
|
Output: *u8);
|
||||||
|
|
||||||
/** Turn on LLVM pass-timing. */
|
/** Turn on LLVM pass-timing. */
|
||||||
fn LLVMRustEnableTimePasses();
|
fn LLVMRustEnableTimePasses();
|
||||||
|
@ -896,7 +895,7 @@ native mod llvm {
|
||||||
/** Print the pass timings since static dtors aren't picking them up. */
|
/** Print the pass timings since static dtors aren't picking them up. */
|
||||||
fn LLVMRustPrintPassTimings();
|
fn LLVMRustPrintPassTimings();
|
||||||
|
|
||||||
fn LLVMStructCreateNamed(C: ContextRef, Name: sbuf) -> TypeRef;
|
fn LLVMStructCreateNamed(C: ContextRef, Name: *u8) -> TypeRef;
|
||||||
|
|
||||||
fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
|
fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
|
||||||
ElementCount: c_uint, Packed: Bool);
|
ElementCount: c_uint, Packed: Bool);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import libc::{c_uint, c_int};
|
import libc::{c_uint, c_int};
|
||||||
import str::sbuf;
|
|
||||||
import lib::llvm::llvm;
|
import lib::llvm::llvm;
|
||||||
import syntax::codemap;
|
import syntax::codemap;
|
||||||
import codemap::span;
|
import codemap::span;
|
||||||
|
@ -83,7 +82,7 @@ fn IndirectBr(cx: block, Addr: ValueRef, NumDests: uint) {
|
||||||
|
|
||||||
// This is a really awful way to get a zero-length c-string, but better (and a
|
// This is a really awful way to get a zero-length c-string, but better (and a
|
||||||
// lot more efficient) than doing str::as_buf("", ...) every time.
|
// lot more efficient) than doing str::as_buf("", ...) every time.
|
||||||
fn noname() -> sbuf unsafe {
|
fn noname() -> *u8 unsafe {
|
||||||
const cnull: uint = 0u;
|
const cnull: uint = 0u;
|
||||||
ret unsafe::reinterpret_cast(ptr::addr_of(cnull));
|
ret unsafe::reinterpret_cast(ptr::addr_of(cnull));
|
||||||
}
|
}
|
||||||
|
@ -360,12 +359,12 @@ fn StructGEP(cx: block, Pointer: ValueRef, Idx: uint) -> ValueRef {
|
||||||
ret llvm::LLVMBuildStructGEP(B(cx), Pointer, Idx as c_uint, noname());
|
ret llvm::LLVMBuildStructGEP(B(cx), Pointer, Idx as c_uint, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GlobalString(cx: block, _Str: sbuf) -> ValueRef {
|
fn GlobalString(cx: block, _Str: *u8) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_i8())); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_i8())); }
|
||||||
ret llvm::LLVMBuildGlobalString(B(cx), _Str, noname());
|
ret llvm::LLVMBuildGlobalString(B(cx), _Str, noname());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn GlobalStringPtr(cx: block, _Str: sbuf) -> ValueRef {
|
fn GlobalStringPtr(cx: block, _Str: *u8) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_i8())); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(T_ptr(T_i8())); }
|
||||||
ret llvm::LLVMBuildGlobalStringPtr(B(cx), _Str, noname());
|
ret llvm::LLVMBuildGlobalStringPtr(B(cx), _Str, noname());
|
||||||
}
|
}
|
||||||
|
@ -450,7 +449,7 @@ fn TruncOrBitCast(cx: block, Val: ValueRef, DestTy: TypeRef) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Cast(cx: block, Op: Opcode, Val: ValueRef, DestTy: TypeRef,
|
fn Cast(cx: block, Op: Opcode, Val: ValueRef, DestTy: TypeRef,
|
||||||
_Name: sbuf) -> ValueRef {
|
_Name: *u8) -> ValueRef {
|
||||||
if cx.unreachable { ret llvm::LLVMGetUndef(DestTy); }
|
if cx.unreachable { ret llvm::LLVMGetUndef(DestTy); }
|
||||||
ret llvm::LLVMBuildCast(B(cx), Op, Val, DestTy, noname());
|
ret llvm::LLVMBuildCast(B(cx), Op, Val, DestTy, noname());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import str;
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
#[nolink]
|
#[nolink]
|
||||||
native mod libc {
|
native mod libc {
|
||||||
fn atol(x: str::sbuf) -> int;
|
fn atol(x: *u8) -> int;
|
||||||
fn atoll(x: str::sbuf) -> i64;
|
fn atoll(x: *u8) -> i64;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn atol(s: str) -> int {
|
fn atol(s: str) -> int {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue