1313// but many TypeRefs correspond to one ty::t; for instance, tup(int, int,
1414// int) and rec(x=int, y=int, z=int) will have the same TypeRef.
1515
16+ import core:: ctypes:: c_uint;
1617import std:: { map, time} ;
1718import std:: map:: hashmap;
1819import std:: map:: { new_int_hash, new_str_hash} ;
@@ -291,11 +292,12 @@ fn log_fn_time(ccx: @crate_ctxt, name: str, start: time::timeval,
291292}
292293
293294
294- fn decl_fn ( llmod : ModuleRef , name : str , cc : uint , llty : TypeRef ) -> ValueRef {
295+ fn decl_fn ( llmod : ModuleRef , name : str , cc : uint , llty : TypeRef ) ->
296+ ValueRef {
295297 let llfn: ValueRef =
296298 str:: as_buf ( name, { |buf|
297299 llvm:: LLVMGetOrInsertFunction ( llmod, buf, llty) } ) ;
298- llvm:: LLVMSetFunctionCallConv ( llfn, cc) ;
300+ llvm:: LLVMSetFunctionCallConv ( llfn, cc as c_uint ) ;
299301 ret llfn;
300302}
301303
@@ -338,7 +340,8 @@ fn get_simple_extern_fn(cx: @block_ctxt,
338340 let inputs = vec:: init_elt :: < TypeRef > ( ccx. int_type , n_args as uint ) ;
339341 let output = ccx. int_type ;
340342 let t = T_fn ( inputs, output) ;
341- ret get_extern_fn ( externs, llmod, name, lib:: llvm:: LLVMCCallConv , t) ;
343+ ret get_extern_fn ( externs, llmod, name,
344+ lib:: llvm:: LLVMCCallConv , t) ;
342345}
343346
344347fn trans_native_call ( cx : @block_ctxt , externs : hashmap < str , ValueRef > ,
@@ -389,12 +392,12 @@ fn align_to(cx: @block_ctxt, off: ValueRef, align: ValueRef) -> ValueRef {
389392
390393// Returns the real size of the given type for the current target.
391394fn llsize_of_real ( cx : @crate_ctxt , t : TypeRef ) -> uint {
392- ret llvm:: LLVMStoreSizeOfType ( cx. td . lltd , t) ;
395+ ret llvm:: LLVMStoreSizeOfType ( cx. td . lltd , t) as uint ;
393396}
394397
395398// Returns the real alignment of the given type for the current target.
396399fn llalign_of_real ( cx : @crate_ctxt , t : TypeRef ) -> uint {
397- ret llvm:: LLVMPreferredAlignmentOfType ( cx. td . lltd , t) ;
400+ ret llvm:: LLVMPreferredAlignmentOfType ( cx. td . lltd , t) as uint ;
398401}
399402
400403fn llsize_of ( cx : @crate_ctxt , t : TypeRef ) -> ValueRef {
@@ -1067,7 +1070,7 @@ fn set_no_inline(f: ValueRef) {
10671070 llvm:: LLVMAddFunctionAttr ( f,
10681071 lib:: llvm:: LLVMNoInlineAttribute as
10691072 lib:: llvm:: llvm:: Attribute ,
1070- 0 u ) ;
1073+ 0u32 ) ;
10711074}
10721075
10731076// Tell LLVM to emit the information necessary to unwind the stack for the
@@ -1076,19 +1079,19 @@ fn set_uwtable(f: ValueRef) {
10761079 llvm:: LLVMAddFunctionAttr ( f,
10771080 lib:: llvm:: LLVMUWTableAttribute as
10781081 lib:: llvm:: llvm:: Attribute ,
1079- 0 u ) ;
1082+ 0u32 ) ;
10801083}
10811084
10821085fn set_always_inline ( f : ValueRef ) {
10831086 llvm:: LLVMAddFunctionAttr ( f,
10841087 lib:: llvm:: LLVMAlwaysInlineAttribute as
10851088 lib:: llvm:: llvm:: Attribute ,
1086- 0 u ) ;
1089+ 0u32 ) ;
10871090}
10881091
10891092fn set_custom_stack_growth_fn ( f : ValueRef ) {
10901093 // TODO: Remove this hack to work around the lack of u64 in the FFI.
1091- llvm:: LLVMAddFunctionAttr ( f, 0 as lib:: llvm:: llvm:: Attribute , 1 u ) ;
1094+ llvm:: LLVMAddFunctionAttr ( f, 0 as lib:: llvm:: llvm:: Attribute , 1u32 ) ;
10921095}
10931096
10941097fn set_glue_inlining ( cx : @local_ctxt , f : ValueRef , t : ty:: t ) {
@@ -1175,7 +1178,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
11751178 } else { T_ptr ( T_i8 ( ) ) } ;
11761179
11771180 let ty_param_count = vec:: len :: < uint > ( ty_params) ;
1178- let lltyparams = llvm:: LLVMGetParam ( llfn, 2 u ) ;
1181+ let lltyparams = llvm:: LLVMGetParam ( llfn, 2u32 ) ;
11791182 let load_env_bcx = new_raw_block_ctxt ( fcx, fcx. llloadenv ) ;
11801183 let lltydescs = [ mutable] ;
11811184 let p = 0 u;
@@ -1190,7 +1193,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
11901193
11911194 let bcx = new_top_block_ctxt ( fcx) ;
11921195 let lltop = bcx. llbb ;
1193- let llrawptr0 = llvm:: LLVMGetParam ( llfn, 3 u ) ;
1196+ let llrawptr0 = llvm:: LLVMGetParam ( llfn, 3u32 ) ;
11941197 let llval0 = BitCast ( bcx, llrawptr0, llty) ;
11951198 helper ( bcx, llval0, t) ;
11961199 finish_fn ( fcx, lltop) ;
@@ -4302,8 +4305,8 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
43024305 -> @fn_ctxt {
43034306 let llbbs = mk_standard_basic_blocks ( llfndecl) ;
43044307 ret @{ llfn : llfndecl,
4305- llenv : llvm:: LLVMGetParam ( llfndecl, 1 u ) ,
4306- llretptr : llvm:: LLVMGetParam ( llfndecl, 0 u ) ,
4308+ llenv : llvm:: LLVMGetParam ( llfndecl, 1u32 ) ,
4309+ llretptr : llvm:: LLVMGetParam ( llfndecl, 0u32 ) ,
43074310 mutable llstaticallocas : llbbs. sa ,
43084311 mutable llloadenv : llbbs. ca ,
43094312 mutable llderivedtydescs_first : llbbs. dt ,
@@ -4346,7 +4349,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
43464349 // Skip the implicit arguments 0, and 1. TODO: Pull out 2u and define
43474350 // it as a constant, since we're using it in several places in trans this
43484351 // way.
4349- let arg_n = 2 u ;
4352+ let arg_n = 2u32 ;
43504353 alt ty_self {
43514354 impl_self( tt) {
43524355 cx. llself = some ( { v: cx. llenv , t: tt} ) ;
@@ -4355,12 +4358,12 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
43554358 }
43564359 for tp in ty_params {
43574360 let lltydesc = llvm:: LLVMGetParam ( cx. llfn , arg_n) , dicts = none;
4358- arg_n += 1 u ;
4361+ arg_n += 1u32 ;
43594362 for bound in * fcx_tcx ( cx) . ty_param_bounds . get ( tp. id ) {
43604363 alt bound {
43614364 ty : : bound_iface ( _) {
43624365 let dict = llvm:: LLVMGetParam ( cx. llfn , arg_n) ;
4363- arg_n += 1 u ;
4366+ arg_n += 1u32 ;
43644367 dicts = some ( alt dicts {
43654368 none. { [ dict] }
43664369 some ( ds) { ds + [ dict] }
@@ -4381,7 +4384,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
43814384 // copy_args_to_allocas will overwrite the table entry with local_imm
43824385 // before it's actually used.
43834386 cx. llargs . insert ( arg. id , local_mem ( llarg) ) ;
4384- arg_n += 1 u ;
4387+ arg_n += 1u32 ;
43854388 }
43864389}
43874390
@@ -4804,7 +4807,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48044807 let fcx = new_fn_ctxt ( lcx, span, llshimfn) ;
48054808 let bcx = new_top_block_ctxt ( fcx) ;
48064809 let lltop = bcx. llbb ;
4807- let llargbundle = llvm:: LLVMGetParam ( llshimfn, 0 u ) ;
4810+ let llargbundle = llvm:: LLVMGetParam ( llshimfn, 0u32 ) ;
48084811 let i = 0 u, n = vec:: len ( tys. arg_tys ) ;
48094812 let llargvals = [ ] ;
48104813 while i < n {
@@ -4814,7 +4817,8 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48144817 }
48154818
48164819 // Create the call itself and store the return value:
4817- let llretval = CallWithConv ( bcx, llbasefn, llargvals, cc) ; // r
4820+ let llretval = CallWithConv ( bcx, llbasefn,
4821+ llargvals, cc as c_uint ) ; // r
48184822 if tys. ret_def {
48194823 // R** llretptr = &args->r;
48204824 let llretptr = GEPi ( bcx, llargbundle, [ 0 , n as int ] ) ;
@@ -4848,11 +4852,12 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48484852 let i = 0 u, n = vec:: len ( tys. arg_tys ) ;
48494853 let implicit_args = 2 u + num_tps; // ret + env
48504854 while i < n {
4851- let llargval = llvm:: LLVMGetParam ( llwrapfn, i + implicit_args) ;
4855+ let llargval = llvm:: LLVMGetParam ( llwrapfn,
4856+ ( i + implicit_args) as c_uint ) ;
48524857 store_inbounds ( bcx, llargval, llargbundle, [ 0 , i as int ] ) ;
48534858 i += 1 u;
48544859 }
4855- let llretptr = llvm:: LLVMGetParam ( llwrapfn, 0 u ) ;
4860+ let llretptr = llvm:: LLVMGetParam ( llwrapfn, 0u32 ) ;
48564861 store_inbounds ( bcx, llretptr, llargbundle, [ 0 , n as int ] ) ;
48574862
48584863 // Create call itself.
@@ -4865,7 +4870,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48654870 }
48664871
48674872 let ccx = lcx_ccx ( lcx) ;
4868- let cc: uint = lib:: llvm:: LLVMCCallConv ;
4873+ let cc = lib:: llvm:: LLVMCCallConv ;
48694874 alt abi {
48704875 ast : : native_abi_rust_intrinsic. { ret; }
48714876 ast:: native_abi_cdecl. { cc = lib:: llvm:: LLVMCCallConv ; }
@@ -5037,10 +5042,10 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
50375042 let bcx = new_top_block_ctxt ( fcx) ;
50385043 let lltop = bcx. llbb ;
50395044
5040- let lloutputarg = llvm:: LLVMGetParam ( llfdecl, 0 u ) ;
5041- let llenvarg = llvm:: LLVMGetParam ( llfdecl, 1 u ) ;
5045+ let lloutputarg = llvm:: LLVMGetParam ( llfdecl, 0u32 ) ;
5046+ let llenvarg = llvm:: LLVMGetParam ( llfdecl, 1u32 ) ;
50425047 let args = [ lloutputarg, llenvarg] ;
5043- if takes_argv { args += [ llvm:: LLVMGetParam ( llfdecl, 2 u ) ] ; }
5048+ if takes_argv { args += [ llvm:: LLVMGetParam ( llfdecl, 2u32 ) ] ; }
50445049 Call ( bcx, main_llfn, args) ;
50455050 build_return ( bcx) ;
50465051
@@ -5071,11 +5076,11 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
50715076 let start = str:: as_buf ( "rust_start" , { |buf|
50725077 llvm:: LLVMAddGlobal ( ccx. llmod , start_ty, buf)
50735078 } ) ;
5074- let args = [ rust_main, llvm:: LLVMGetParam ( llfn, 0 u ) ,
5075- llvm:: LLVMGetParam ( llfn, 1 u ) , crate_map] ;
5079+ let args = [ rust_main, llvm:: LLVMGetParam ( llfn, 0u32 ) ,
5080+ llvm:: LLVMGetParam ( llfn, 1u32 ) , crate_map] ;
50765081 let result = unsafe {
50775082 llvm:: LLVMBuildCall ( bld, start, vec:: to_ptr ( args) ,
5078- vec:: len ( args) , noname ( ) )
5083+ vec:: len ( args) as c_uint , noname ( ) )
50795084 } ;
50805085 llvm:: LLVMBuildRet ( bld, result) ;
50815086 }
0 commit comments