llvm::LLVMAddTargetData(td.lltd, fpm.llpm);
let FPMB = llvm::LLVMPassManagerBuilderCreate();
- llvm::LLVMPassManagerBuilderSetOptLevel(FPMB, 2u32);
+ llvm::LLVMPassManagerBuilderSetOptLevel(FPMB, 2u as c_uint);
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(FPMB,
fpm.llpm);
llvm::LLVMPassManagerBuilderDispose(FPMB);
llvm::LLVMRunPassManager(fpm.llpm, llmod);
- let threshold = 225u as c_uint;
- if opts.optimize == 3u { threshold = 275u as c_uint; }
+ let threshold = 225u;
+ if opts.optimize == 3u { threshold = 275u; }
let MPMB = llvm::LLVMPassManagerBuilderCreate();
llvm::LLVMPassManagerBuilderSetOptLevel(MPMB,
- opts.optimize as u32);
+ opts.optimize as c_uint);
llvm::LLVMPassManagerBuilderSetSizeLevel(MPMB, 0);
llvm::LLVMPassManagerBuilderSetDisableUnitAtATime(MPMB, False);
llvm::LLVMPassManagerBuilderSetDisableUnrollLoops(MPMB, False);
llvm::LLVMPassManagerBuilderSetDisableSimplifyLibCalls(MPMB,
False);
- if threshold != 0u32 {
+ if threshold != 0u {
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold
- (MPMB, threshold);
+ (MPMB, threshold as c_uint);
}
llvm::LLVMPassManagerBuilderPopulateModulePassManager(MPMB,
pm.llpm);
fn llstr(s: str) -> ValueRef {
str::as_buf(s, {|sbuf|
- llvm::LLVMMDString(sbuf, str::byte_len(s) as u32)
+ llvm::LLVMMDString(sbuf, str::byte_len(s) as ctypes::c_uint)
})
}
fn lltag(lltag: int) -> ValueRef {
}
fn llmdnode(elems: [ValueRef]) -> ValueRef unsafe {
llvm::LLVMMDNode(vec::unsafe::to_ptr(elems),
- vec::len(elems) as u32)
+ vec::len(elems) as ctypes::c_uint)
}
fn llunused() -> ValueRef {
lli32(0x0)
llvm::LLVMAddFunctionAttr(f,
lib::llvm::LLVMNoInlineAttribute as
lib::llvm::llvm::Attribute,
- 0u32);
+ 0u as c_uint);
}
// Tell LLVM to emit the information necessary to unwind the stack for the
llvm::LLVMAddFunctionAttr(f,
lib::llvm::LLVMUWTableAttribute as
lib::llvm::llvm::Attribute,
- 0u32);
+ 0u as c_uint);
}
fn set_always_inline(f: ValueRef) {
llvm::LLVMAddFunctionAttr(f,
lib::llvm::LLVMAlwaysInlineAttribute as
lib::llvm::llvm::Attribute,
- 0u32);
+ 0u as c_uint);
}
fn set_custom_stack_growth_fn(f: ValueRef) {
// TODO: Remove this hack to work around the lack of u64 in the FFI.
- llvm::LLVMAddFunctionAttr(f, 0 as lib::llvm::llvm::Attribute, 1u32);
+ llvm::LLVMAddFunctionAttr(f, 0 as lib::llvm::llvm::Attribute,
+ 1u as c_uint);
}
fn set_glue_inlining(cx: @local_ctxt, f: ValueRef, t: ty::t) {
} else { T_ptr(T_i8()) };
let ty_param_count = vec::len::<uint>(ty_params);
- let lltyparams = llvm::LLVMGetParam(llfn, 2u32);
+ let lltyparams = llvm::LLVMGetParam(llfn, 2u as c_uint);
let load_env_bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
let lltydescs = [mutable];
let p = 0u;
let bcx = new_top_block_ctxt(fcx);
let lltop = bcx.llbb;
- let llrawptr0 = llvm::LLVMGetParam(llfn, 3u32);
+ let llrawptr0 = llvm::LLVMGetParam(llfn, 3u as c_uint);
let llval0 = BitCast(bcx, llrawptr0, llty);
helper(bcx, llval0, t);
finish_fn(fcx, lltop);
-> @fn_ctxt {
let llbbs = mk_standard_basic_blocks(llfndecl);
ret @{llfn: llfndecl,
- llenv: llvm::LLVMGetParam(llfndecl, 1u32),
- llretptr: llvm::LLVMGetParam(llfndecl, 0u32),
+ llenv: llvm::LLVMGetParam(llfndecl, 1u as c_uint),
+ llretptr: llvm::LLVMGetParam(llfndecl, 0u as c_uint),
mutable llstaticallocas: llbbs.sa,
mutable llloadenv: llbbs.ca,
mutable llderivedtydescs_first: llbbs.dt,
// Skip the implicit arguments 0, and 1. TODO: Pull out 2u and define
// it as a constant, since we're using it in several places in trans this
// way.
- let arg_n = 2u32;
+ let arg_n = 2u;
alt ty_self {
impl_self(tt) {
cx.llself = some({v: cx.llenv, t: tt});
no_self. {}
}
for tp in ty_params {
- let lltydesc = llvm::LLVMGetParam(cx.llfn, arg_n), dicts = none;
- arg_n += 1u32;
+ let lltydesc = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
+ let dicts = none;
+ arg_n += 1u;
for bound in *fcx_tcx(cx).ty_param_bounds.get(tp.id) {
alt bound {
ty::bound_iface(_) {
- let dict = llvm::LLVMGetParam(cx.llfn, arg_n);
- arg_n += 1u32;
+ let dict = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
+ arg_n += 1u;
dicts = some(alt dicts {
none. { [dict] }
some(ds) { ds + [dict] }
// Populate the llargs field of the function context with the ValueRefs
// that we get from llvm::LLVMGetParam for each argument.
for arg: ast::arg in args {
- let llarg = llvm::LLVMGetParam(cx.llfn, arg_n);
+ let llarg = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
assert (llarg as int != 0);
// Note that this uses local_mem even for things passed by value.
// copy_args_to_allocas will overwrite the table entry with local_imm
// before it's actually used.
cx.llargs.insert(arg.id, local_mem(llarg));
- arg_n += 1u32;
+ arg_n += 1u;
}
}
let fcx = new_fn_ctxt(lcx, span, llshimfn);
let bcx = new_top_block_ctxt(fcx);
let lltop = bcx.llbb;
- let llargbundle = llvm::LLVMGetParam(llshimfn, 0u32);
+ let llargbundle = llvm::LLVMGetParam(llshimfn, 0 as c_uint);
let i = 0u, n = vec::len(tys.arg_tys);
let llargvals = [];
while i < n {
store_inbounds(bcx, llargval, llargbundle, [0, i as int]);
i += 1u;
}
- let llretptr = llvm::LLVMGetParam(llwrapfn, 0u32);
+ let llretptr = llvm::LLVMGetParam(llwrapfn, 0 as c_uint);
store_inbounds(bcx, llretptr, llargbundle, [0, n as int]);
// Create call itself.
let bcx = new_top_block_ctxt(fcx);
let lltop = bcx.llbb;
- let lloutputarg = llvm::LLVMGetParam(llfdecl, 0u32);
- let llenvarg = llvm::LLVMGetParam(llfdecl, 1u32);
+ let lloutputarg = llvm::LLVMGetParam(llfdecl, 0 as c_uint);
+ let llenvarg = llvm::LLVMGetParam(llfdecl, 1 as c_uint);
let args = [lloutputarg, llenvarg];
- if takes_argv { args += [llvm::LLVMGetParam(llfdecl, 2u32)]; }
+ if takes_argv { args += [llvm::LLVMGetParam(llfdecl, 2 as c_uint)]; }
Call(bcx, main_llfn, args);
build_return(bcx);
let start = str::as_buf("rust_start", {|buf|
llvm::LLVMAddGlobal(ccx.llmod, start_ty, buf)
});
- let args = [rust_main, llvm::LLVMGetParam(llfn, 0u32),
- llvm::LLVMGetParam(llfn, 1u32), crate_map];
+ let args = [rust_main, llvm::LLVMGetParam(llfn, 0 as c_uint),
+ llvm::LLVMGetParam(llfn, 1 as c_uint), crate_map];
let result = unsafe {
llvm::LLVMBuildCall(bld, start, vec::to_ptr(args),
vec::len(args) as c_uint, noname())
import core::{vec, str};
-import core::ctypes::c_uint;
+import core::ctypes::{c_uint, c_int};
import str::sbuf;
import lib::llvm::llvm;
import syntax::codemap;
let ccx = cx.fcx.lcx.ccx;
if cx.unreachable {
let ty = val_ty(PointerVal);
- let eltty = if llvm::LLVMGetTypeKind(ty) == 11i32 {
+ let eltty = if llvm::LLVMGetTypeKind(ty) == 11 as c_int {
llvm::LLVMGetElementType(ty) } else { ccx.int_type };
ret llvm::LLVMGetUndef(eltty);
}
unsafe {
let valptr = unsafe::reinterpret_cast(ptr::addr_of(val));
let bbptr = unsafe::reinterpret_cast(ptr::addr_of(bb));
- llvm::LLVMAddIncoming(phi, valptr, bbptr, 1u32);
+ llvm::LLVMAddIncoming(phi, valptr, bbptr, 1 as c_uint);
}
}
fn _UndefReturn(cx: @block_ctxt, Fn: ValueRef) -> ValueRef {
let ccx = cx.fcx.lcx.ccx;
let ty = val_ty(Fn);
- let retty = if llvm::LLVMGetTypeKind(ty) == 8i32 {
+ let retty = if llvm::LLVMGetTypeKind(ty) == 8 as c_int {
llvm::LLVMGetReturnType(ty) } else { ccx.int_type };
ret llvm::LLVMGetUndef(retty);
}
+import core::ctypes::c_uint;
import syntax::ast;
import syntax::ast_util;
import lib::llvm::llvm;
fcx.lltyparams += [{desc: dsc, dicts: dicts}];
}
- let a: u32 = 2u32; // retptr, env come first
+ let a: uint = 2u; // retptr, env come first
let b: int = starting_idx;
let outgoing_arg_index: uint = 0u;
let llout_arg_tys: [TypeRef] =
// Arg will be provided when the thunk is invoked.
none. {
- let arg: ValueRef = llvm::LLVMGetParam(llthunk, a);
+ let arg: ValueRef = llvm::LLVMGetParam(llthunk, a as c_uint);
if ty::type_contains_params(cx.ccx.tcx, out_arg.ty) {
arg = PointerCast(bcx, arg, llout_arg_ty);
}
llargs += [arg];
- a += 1u32;
+ a += 1u;
}
}
outgoing_arg_index += 1u;
+import core::ctypes::c_uint;
import trans::*;
import trans_common::*;
import trans_build::*;
vec::slice(real_args, 2u + vec::len(extra_ptrs), vec::len(real_args));
let llfn_ty = T_fn(wrap_args, real_ret);
trans_wrapper(ccx, pt, llfn_ty, {|llfn, bcx|
- let dict = PointerCast(bcx, LLVMGetParam(llfn, 0u32), env_ty);
+ let dict = PointerCast(bcx, LLVMGetParam(llfn, 0 as c_uint), env_ty);
// retptr, self
- let args = [LLVMGetParam(llfn, 1u32), LLVMGetParam(llfn, 2u32)];
+ let args = [LLVMGetParam(llfn, 1 as c_uint),
+ LLVMGetParam(llfn, 2 as c_uint)];
let i = 0u;
// saved tydescs/dicts
while i < n_extra_ptrs {
args += [load_inbounds(bcx, dict, [0, i as int])];
}
// the rest of the parameters
- let i = 3u32, params_total = llvm::LLVMCountParamTypes(llfn_ty);
- while i < params_total {
- args += [LLVMGetParam(llfn, i)];
- i += 1u32;
+ let j = 3u as c_uint;
+ let params_total = llvm::LLVMCountParamTypes(llfn_ty);
+ while j < params_total {
+ args += [LLVMGetParam(llfn, j)];
+ j += 1u as c_uint;
}
Call(bcx, real_fn, args);
bcx
n: uint) -> ValueRef {
let {llty: llfty, _} = wrapper_fn_ty(ccx, T_ptr(T_i8()), m);
trans_wrapper(ccx, pt, llfty, {|llfn, bcx|
- let self = Load(bcx, PointerCast(bcx, LLVMGetParam(llfn, 2u32),
+ let self = Load(bcx, PointerCast(bcx,
+ LLVMGetParam(llfn, 2u as c_uint),
T_ptr(T_opaque_iface_ptr(ccx))));
let boxed = GEPi(bcx, self, [0, abi::box_rc_field_body]);
let dict = Load(bcx, PointerCast(bcx, GEPi(bcx, boxed, [0, 1]),
// FIXME[impl] This doesn't account for more-than-ptr-sized alignment
let inner_self = GEPi(bcx, boxed, [0, 2]);
let args = [PointerCast(bcx, dict, T_ptr(T_i8())),
- LLVMGetParam(llfn, 1u32),
+ LLVMGetParam(llfn, 1u as c_uint),
PointerCast(bcx, inner_self, T_opaque_cbox_ptr(ccx))];
- let i = 3u32, total = llvm::LLVMCountParamTypes(llfty);
+ let i = 3u as c_uint, total = llvm::LLVMCountParamTypes(llfty);
while i < total {
args += [LLVMGetParam(llfn, i)];
- i += 1u32;
+ i += 1u as c_uint;
}
Call(bcx, mptr, args);
bcx
Indicates whether a path represents a directory.
*/
fn path_is_dir(p: path) -> bool {
- ret str::as_buf(p, {|buf| rustrt::rust_path_is_dir(buf) != 0i32 });
+ ret str::as_buf(p, {|buf|
+ rustrt::rust_path_is_dir(buf) != 0 as ctypes::c_int
+ });
}
/*
Indicates whether a path exists.
*/
fn path_exists(p: path) -> bool {
- ret str::as_buf(p, {|buf| rustrt::rust_path_exists(buf) != 0i32 });
+ ret str::as_buf(p, {|buf|
+ rustrt::rust_path_exists(buf) != 0 as ctypes::c_int
+ });
}
/*