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} ;
@@ -292,11 +293,12 @@ fn log_fn_time(ccx: @crate_ctxt, name: str, start: time::timeval,
292293}
293294
294295
295- fn decl_fn ( llmod : ModuleRef , name : str , cc : uint , llty : TypeRef ) -> ValueRef {
296+ fn decl_fn ( llmod : ModuleRef , name : str , cc : uint , llty : TypeRef ) ->
297+ ValueRef {
296298 let llfn: ValueRef =
297299 str:: as_buf ( name, { |buf|
298300 llvm:: LLVMGetOrInsertFunction ( llmod, buf, llty) } ) ;
299- llvm:: LLVMSetFunctionCallConv ( llfn, cc) ;
301+ llvm:: LLVMSetFunctionCallConv ( llfn, cc as c_uint ) ;
300302 ret llfn;
301303}
302304
@@ -339,7 +341,8 @@ fn get_simple_extern_fn(cx: @block_ctxt,
339341 let inputs = vec:: init_elt :: < TypeRef > ( ccx. int_type , n_args as uint ) ;
340342 let output = ccx. int_type ;
341343 let t = T_fn ( inputs, output) ;
342- ret get_extern_fn ( externs, llmod, name, lib:: llvm:: LLVMCCallConv , t) ;
344+ ret get_extern_fn ( externs, llmod, name,
345+ lib:: llvm:: LLVMCCallConv , t) ;
343346}
344347
345348fn trans_native_call ( cx : @block_ctxt , externs : hashmap < str , ValueRef > ,
@@ -390,12 +393,12 @@ fn align_to(cx: @block_ctxt, off: ValueRef, align: ValueRef) -> ValueRef {
390393
391394// Returns the real size of the given type for the current target.
392395fn llsize_of_real ( cx : @crate_ctxt , t : TypeRef ) -> uint {
393- ret llvm:: LLVMStoreSizeOfType ( cx. td . lltd , t) ;
396+ ret llvm:: LLVMStoreSizeOfType ( cx. td . lltd , t) as uint ;
394397}
395398
396399// Returns the real alignment of the given type for the current target.
397400fn llalign_of_real ( cx : @crate_ctxt , t : TypeRef ) -> uint {
398- ret llvm:: LLVMPreferredAlignmentOfType ( cx. td . lltd , t) ;
401+ ret llvm:: LLVMPreferredAlignmentOfType ( cx. td . lltd , t) as uint ;
399402}
400403
401404fn llsize_of ( cx : @crate_ctxt , t : TypeRef ) -> ValueRef {
@@ -1070,7 +1073,7 @@ fn set_no_inline(f: ValueRef) {
10701073 llvm:: LLVMAddFunctionAttr ( f,
10711074 lib:: llvm:: LLVMNoInlineAttribute as
10721075 lib:: llvm:: llvm:: Attribute ,
1073- 0 u ) ;
1076+ 0u32 ) ;
10741077}
10751078
10761079// Tell LLVM to emit the information necessary to unwind the stack for the
@@ -1079,19 +1082,19 @@ fn set_uwtable(f: ValueRef) {
10791082 llvm:: LLVMAddFunctionAttr ( f,
10801083 lib:: llvm:: LLVMUWTableAttribute as
10811084 lib:: llvm:: llvm:: Attribute ,
1082- 0 u ) ;
1085+ 0u32 ) ;
10831086}
10841087
10851088fn set_always_inline ( f : ValueRef ) {
10861089 llvm:: LLVMAddFunctionAttr ( f,
10871090 lib:: llvm:: LLVMAlwaysInlineAttribute as
10881091 lib:: llvm:: llvm:: Attribute ,
1089- 0 u ) ;
1092+ 0u32 ) ;
10901093}
10911094
10921095fn set_custom_stack_growth_fn ( f : ValueRef ) {
10931096 // TODO: Remove this hack to work around the lack of u64 in the FFI.
1094- llvm:: LLVMAddFunctionAttr ( f, 0 as lib:: llvm:: llvm:: Attribute , 1 u ) ;
1097+ llvm:: LLVMAddFunctionAttr ( f, 0 as lib:: llvm:: llvm:: Attribute , 1u32 ) ;
10951098}
10961099
10971100fn set_glue_inlining ( cx : @local_ctxt , f : ValueRef , t : ty:: t ) {
@@ -1178,7 +1181,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
11781181 } else { T_ptr ( T_i8 ( ) ) } ;
11791182
11801183 let ty_param_count = vec:: len :: < uint > ( ty_params) ;
1181- let lltyparams = llvm:: LLVMGetParam ( llfn, 2 u ) ;
1184+ let lltyparams = llvm:: LLVMGetParam ( llfn, 2u32 ) ;
11821185 let load_env_bcx = new_raw_block_ctxt ( fcx, fcx. llloadenv ) ;
11831186 let lltydescs = [ mutable] ;
11841187 let p = 0 u;
@@ -1193,7 +1196,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
11931196
11941197 let bcx = new_top_block_ctxt ( fcx) ;
11951198 let lltop = bcx. llbb ;
1196- let llrawptr0 = llvm:: LLVMGetParam ( llfn, 3 u ) ;
1199+ let llrawptr0 = llvm:: LLVMGetParam ( llfn, 3u32 ) ;
11971200 let llval0 = BitCast ( bcx, llrawptr0, llty) ;
11981201 helper ( bcx, llval0, t) ;
11991202 finish_fn ( fcx, lltop) ;
@@ -4300,8 +4303,8 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
43004303 -> @fn_ctxt {
43014304 let llbbs = mk_standard_basic_blocks ( llfndecl) ;
43024305 ret @{ llfn : llfndecl,
4303- llenv : llvm:: LLVMGetParam ( llfndecl, 1 u ) ,
4304- llretptr : llvm:: LLVMGetParam ( llfndecl, 0 u ) ,
4306+ llenv : llvm:: LLVMGetParam ( llfndecl, 1u32 ) ,
4307+ llretptr : llvm:: LLVMGetParam ( llfndecl, 0u32 ) ,
43054308 mutable llstaticallocas : llbbs. sa ,
43064309 mutable llloadenv : llbbs. ca ,
43074310 mutable llderivedtydescs_first : llbbs. dt ,
@@ -4344,7 +4347,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
43444347 // Skip the implicit arguments 0, and 1. TODO: Pull out 2u and define
43454348 // it as a constant, since we're using it in several places in trans this
43464349 // way.
4347- let arg_n = 2 u ;
4350+ let arg_n = 2u32 ;
43484351 alt ty_self {
43494352 impl_self( tt) {
43504353 cx. llself = some ( { v: cx. llenv , t: tt} ) ;
@@ -4353,12 +4356,12 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
43534356 }
43544357 for tp in ty_params {
43554358 let lltydesc = llvm:: LLVMGetParam ( cx. llfn , arg_n) , dicts = none;
4356- arg_n += 1 u ;
4359+ arg_n += 1u32 ;
43574360 for bound in * fcx_tcx ( cx) . ty_param_bounds . get ( tp. id ) {
43584361 alt bound {
43594362 ty : : bound_iface ( _) {
43604363 let dict = llvm:: LLVMGetParam ( cx. llfn , arg_n) ;
4361- arg_n += 1 u ;
4364+ arg_n += 1u32 ;
43624365 dicts = some ( alt dicts {
43634366 none. { [ dict] }
43644367 some ( ds) { ds + [ dict] }
@@ -4379,7 +4382,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
43794382 // copy_args_to_allocas will overwrite the table entry with local_imm
43804383 // before it's actually used.
43814384 cx. llargs . insert ( arg. id , local_mem ( llarg) ) ;
4382- arg_n += 1 u ;
4385+ arg_n += 1u32 ;
43834386 }
43844387}
43854388
@@ -4798,7 +4801,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
47984801 let fcx = new_fn_ctxt ( lcx, span, llshimfn) ;
47994802 let bcx = new_top_block_ctxt ( fcx) ;
48004803 let lltop = bcx. llbb ;
4801- let llargbundle = llvm:: LLVMGetParam ( llshimfn, 0 u ) ;
4804+ let llargbundle = llvm:: LLVMGetParam ( llshimfn, 0u32 ) ;
48024805 let i = 0 u, n = vec:: len ( tys. arg_tys ) ;
48034806 let llargvals = [ ] ;
48044807 while i < n {
@@ -4808,7 +4811,8 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48084811 }
48094812
48104813 // Create the call itself and store the return value:
4811- let llretval = CallWithConv ( bcx, llbasefn, llargvals, cc) ; // r
4814+ let llretval = CallWithConv ( bcx, llbasefn,
4815+ llargvals, cc as c_uint ) ; // r
48124816 if tys. ret_def {
48134817 // R** llretptr = &args->r;
48144818 let llretptr = GEPi ( bcx, llargbundle, [ 0 , n as int ] ) ;
@@ -4842,11 +4846,12 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48424846 let i = 0 u, n = vec:: len ( tys. arg_tys ) ;
48434847 let implicit_args = 2 u + num_tps; // ret + env
48444848 while i < n {
4845- let llargval = llvm:: LLVMGetParam ( llwrapfn, i + implicit_args) ;
4849+ let llargval = llvm:: LLVMGetParam ( llwrapfn,
4850+ ( i + implicit_args) as c_uint ) ;
48464851 store_inbounds ( bcx, llargval, llargbundle, [ 0 , i as int ] ) ;
48474852 i += 1 u;
48484853 }
4849- let llretptr = llvm:: LLVMGetParam ( llwrapfn, 0 u ) ;
4854+ let llretptr = llvm:: LLVMGetParam ( llwrapfn, 0u32 ) ;
48504855 store_inbounds ( bcx, llretptr, llargbundle, [ 0 , n as int ] ) ;
48514856
48524857 // Create call itself.
@@ -4859,7 +4864,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
48594864 }
48604865
48614866 let ccx = lcx_ccx ( lcx) ;
4862- let cc: uint = lib:: llvm:: LLVMCCallConv ;
4867+ let cc = lib:: llvm:: LLVMCCallConv ;
48634868 alt abi {
48644869 ast : : native_abi_rust_intrinsic. { ret; }
48654870 ast:: native_abi_cdecl. { cc = lib:: llvm:: LLVMCCallConv ; }
@@ -5031,10 +5036,10 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
50315036 let bcx = new_top_block_ctxt ( fcx) ;
50325037 let lltop = bcx. llbb ;
50335038
5034- let lloutputarg = llvm:: LLVMGetParam ( llfdecl, 0 u ) ;
5035- let llenvarg = llvm:: LLVMGetParam ( llfdecl, 1 u ) ;
5039+ let lloutputarg = llvm:: LLVMGetParam ( llfdecl, 0u32 ) ;
5040+ let llenvarg = llvm:: LLVMGetParam ( llfdecl, 1u32 ) ;
50365041 let args = [ lloutputarg, llenvarg] ;
5037- if takes_argv { args += [ llvm:: LLVMGetParam ( llfdecl, 2 u ) ] ; }
5042+ if takes_argv { args += [ llvm:: LLVMGetParam ( llfdecl, 2u32 ) ] ; }
50385043 Call ( bcx, main_llfn, args) ;
50395044 build_return ( bcx) ;
50405045
@@ -5065,11 +5070,11 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
50655070 let start = str:: as_buf ( "rust_start" , { |buf|
50665071 llvm:: LLVMAddGlobal ( ccx. llmod , start_ty, buf)
50675072 } ) ;
5068- let args = [ rust_main, llvm:: LLVMGetParam ( llfn, 0 u ) ,
5069- llvm:: LLVMGetParam ( llfn, 1 u ) , crate_map] ;
5073+ let args = [ rust_main, llvm:: LLVMGetParam ( llfn, 0u32 ) ,
5074+ llvm:: LLVMGetParam ( llfn, 1u32 ) , crate_map] ;
50705075 let result = unsafe {
50715076 llvm:: LLVMBuildCall ( bld, start, vec:: to_ptr ( args) ,
5072- vec:: len ( args) , noname ( ) )
5077+ vec:: len ( args) as c_uint , noname ( ) )
50735078 } ;
50745079 llvm:: LLVMBuildRet ( bld, result) ;
50755080 }
0 commit comments