@@ -3724,7 +3724,7 @@ fn trans_arg_expr(cx: @block_ctxt, arg: ty::arg, lldestty0: TypeRef,
3724
3724
// to have type lldestty0 (the callee's expected type).
3725
3725
val = llvm:: LLVMGetUndef ( lldestty0) ;
3726
3726
} else if arg. mode == ast:: by_ref || arg. mode == ast:: by_val {
3727
- let copied = false , imm = type_is_immediate ( ccx, e_ty) ;
3727
+ let copied = false , imm = ty :: type_is_immediate ( ccx. tcx , e_ty) ;
3728
3728
if arg. mode == ast:: by_ref && lv. kind != owned && imm {
3729
3729
val = do_spill_noroot ( bcx, val) ;
3730
3730
copied = true ;
@@ -3741,7 +3741,7 @@ fn trans_arg_expr(cx: @block_ctxt, arg: ty::arg, lldestty0: TypeRef,
3741
3741
if arg. mode == ast:: by_val && ( lv. kind == owned || !imm) {
3742
3742
val = Load ( bcx, val) ;
3743
3743
}
3744
- } else if type_is_immediate ( ccx, e_ty) && lv. kind != owned {
3744
+ } else if ty :: type_is_immediate ( ccx. tcx , e_ty) && lv. kind != owned {
3745
3745
let r = do_spill ( bcx, val, e_ty) ;
3746
3746
val = r. val ;
3747
3747
bcx = r. bcx ;
@@ -4243,7 +4243,7 @@ fn trans_temp_lval(bcx: @block_ctxt, e: @ast::expr) -> lval_result {
4243
4243
if ty:: type_is_nil ( tcx, ty) || ty:: type_is_bot ( tcx, ty) {
4244
4244
bcx = trans_expr ( bcx, e, ignore) ;
4245
4245
ret { bcx : bcx, val : C_nil ( ) , kind : temporary} ;
4246
- } else if type_is_immediate ( bcx_ccx ( bcx) , ty) {
4246
+ } else if ty :: type_is_immediate ( bcx_tcx ( bcx) , ty) {
4247
4247
let cell = empty_dest_cell ( ) ;
4248
4248
bcx = trans_expr ( bcx, e, by_val ( cell) ) ;
4249
4249
add_clean_temp ( bcx, * cell, ty) ;
@@ -4467,16 +4467,6 @@ fn lval_to_dps(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
4467
4467
ret bcx;
4468
4468
}
4469
4469
4470
- // We pass structural values around the compiler "by pointer" and
4471
- // non-structural values (scalars, boxes, pointers) "by value". We call the
4472
- // latter group "immediates" and, in some circumstances when we know we have a
4473
- // pointer (or need one), perform load/store operations based on the
4474
- // immediate-ness of the type.
4475
- // FIXME simply call the version in ty.rs immediately
4476
- fn type_is_immediate ( ccx : @crate_ctxt , t : ty:: t ) -> bool {
4477
- ty:: type_is_immediate ( ccx. tcx , t)
4478
- }
4479
-
4480
4470
fn do_spill ( cx : @block_ctxt , v : ValueRef , t : ty:: t ) -> result {
4481
4471
// We have a value but we have to spill it, and root it, to pass by alias.
4482
4472
let bcx = cx;
@@ -4503,12 +4493,12 @@ fn do_spill_noroot(cx: @block_ctxt, v: ValueRef) -> ValueRef {
4503
4493
}
4504
4494
4505
4495
fn spill_if_immediate ( cx : @block_ctxt , v : ValueRef , t : ty:: t ) -> result {
4506
- if type_is_immediate ( bcx_ccx ( cx) , t) { ret do_spill ( cx, v, t) ; }
4496
+ if ty :: type_is_immediate ( bcx_tcx ( cx) , t) { ret do_spill ( cx, v, t) ; }
4507
4497
ret rslt( cx, v) ;
4508
4498
}
4509
4499
4510
4500
fn load_if_immediate ( cx : @block_ctxt , v : ValueRef , t : ty:: t ) -> ValueRef {
4511
- if type_is_immediate ( bcx_ccx ( cx) , t) { ret Load ( cx, v) ; }
4501
+ if ty :: type_is_immediate ( bcx_tcx ( cx) , t) { ret Load ( cx, v) ; }
4512
4502
ret v;
4513
4503
}
4514
4504
@@ -5343,7 +5333,7 @@ fn trans_closure(cx: @local_ctxt, sp: span, f: ast::_fn, llfndecl: ValueRef,
5343
5333
f. proto == ast:: proto_iter ||
5344
5334
option:: is_none ( f. body . node . expr ) {
5345
5335
bcx = trans_block_dps ( bcx, f. body , ignore) ;
5346
- } else if type_is_immediate ( cx. ccx , block_ty) {
5336
+ } else if ty :: type_is_immediate ( cx. ccx . tcx , block_ty) {
5347
5337
let cell = empty_dest_cell ( ) ;
5348
5338
bcx = trans_block_dps ( bcx, f. body , by_val ( cell) ) ;
5349
5339
Store ( bcx, * cell, fcx. llretptr ) ;
0 commit comments